Skip to content

Commit

Permalink
Merge pull request #77 from ellisgl:issue-76
Browse files Browse the repository at this point in the history
Update LayoutManager.ts
  • Loading branch information
Elius94 authored Sep 25, 2023
2 parents 4757fb4 + 3446cb2 commit 6f9eb63
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "console-gui-tools",
"version": "3.2.0",
"version": "3.2.1",
"description": "A simple library to draw option menu, text popup or other widgets and layout on a Node.js console.",
"main": "dist/esm/ConsoleGui.mjs",
"types": "dist/types/ConsoleGui.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/ConsoleGui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class ConsoleManager extends EventEmitter {
*/
public updateLayout(): void {
/** @const {string} changeLayoutKey - The key or combination to switch the selected page */
this.changeLayoutKey = this.layoutOptions.changeFocusKey
this.changeLayoutKey = this.layoutOptions.changeFocusKey || ""
this.changeLayoutkeys = this.changeLayoutKey ? this.changeLayoutKey.split("+") : []
/** @const {Array<PageBuilder>} homePage - The main application */
switch (this.layoutOptions.type) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/DoubleLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface DoubleLayoutOptions {
boxed?: boolean;
boxColor?: ForegroundColorName | HEX | RGB | ""; // add color list from chalk
boxStyle?: "bold";
changeFocusKey: string;
changeFocusKey?: string;
direction?: "horizontal" | "vertical";
page1Title?: string;
page2Title?: string;
Expand Down
14 changes: 7 additions & 7 deletions src/components/layout/LayoutManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface LayoutOptions {
boxed?: boolean;
boxColor?: ForegroundColorName | HEX | RGB | ""; // add color list from chalk
boxStyle?: "bold";
changeFocusKey: string;
changeFocusKey?: string;
type: "single" | "double" | "triple" | "quad";
direction?: "horizontal" | "vertical";
pageTitles?: string[];
Expand Down Expand Up @@ -91,7 +91,7 @@ export class LayoutManager {
boxed: this.options.boxed,
boxColor: this.options.boxColor,
boxStyle: this.options.boxStyle,
changeFocusKey: this.options.changeFocusKey,
changeFocusKey: this.options.changeFocusKey || "",
direction: this.options.direction,
page1Title: this.pageTitles ? this.pageTitles[0] : "",
page2Title: this.pageTitles ? this.pageTitles[1] : "",
Expand All @@ -109,7 +109,7 @@ export class LayoutManager {
boxed: this.options.boxed,
boxColor: this.options.boxColor,
boxStyle: this.options.boxStyle,
changeFocusKey: this.options.changeFocusKey,
changeFocusKey: this.options.changeFocusKey || "",
direction: this.options.direction,
page1Title: this.pageTitles ? this.pageTitles[0] : "",
page2Title: this.pageTitles ? this.pageTitles[1] : "",
Expand Down Expand Up @@ -161,7 +161,7 @@ export class LayoutManager {
* @param {number} index the index of the page
* @memberof LayoutManager
*/
public setPage(page: PageBuilder, index: number): void {
public setPage(page: PageBuilder, index: number): void {
this.pages[index] = page
if (this.isSingleLayout(this.layout)) {
this.layout.setPage(page)
Expand All @@ -177,7 +177,7 @@ export class LayoutManager {
* @memberof LayoutManager
* @example layout.setTitle("Page Title", 1)
*/
public setTitle(title: string, index: number): void {
public setTitle(title: string, index: number): void {
this.pageTitles[index] = title
if (this.isSingleLayout(this.layout)) {
this.layout.setTitle(title)
Expand Down Expand Up @@ -213,9 +213,9 @@ export class LayoutManager {
* @param {0 | 1 | 2 | 3} selected 0 for page1, 1 for page2
* @memberof LayoutManager
*/
public setSelected(selected: 0 | 1 | 2 | 3): void {
public setSelected(selected: 0 | 1 | 2 | 3): void {
if (!this.isSingleLayout(this.layout)) {
this.layout.setSelected(selected as 0 | 1)
this.layout.setSelected(selected as 0 | 1)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/QuadLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface QuadLayoutOptions {
boxed?: boolean;
boxColor?: ForegroundColorName | HEX | RGB | ""; // add color list from chalk
boxStyle?: "bold";
changeFocusKey: string;
changeFocusKey?: string;
page1Title?: string;
page2Title?: string;
page3Title?: string;
Expand Down

0 comments on commit 6f9eb63

Please sign in to comment.