Methods
BlessedTabContainer(options) → {BlessedTabContainer}
Merges multiple elements into the same position on the screen, while only enabling visiblity for one at a time depending on the active tab.
Renders tabs in different styles depending on if they are visible, hidden, or hidden and modified (dirty).
Dirty flags are automatically cleared when tabs are opened, and set when they
are updated in the background, unless the autoDirty flag is explicity set
to false for that individual tab.
A basic API is exposed on both the individual tab elements themselves, and on the root tabbed container element.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
BlessedTabContainerArgs | tab container options |
Returns:
- Type
- BlessedTabContainer
Type Definitions
BlessedTabContainer
- Source:
Blessed Tab Container Element
Type:
BlessedTabContainerAPI
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
setDirty |
function | modify the dirty flag for a specified tab |
generateLabel |
function | internal helper that is used to render the label shared by all tabs |
setVisibleTab |
function | takes a label, hides all other tabs and re-renders the shared label |
tabs |
Array.<BlessedTabContainerTabState> | array of tab states |
Parent tab container element API
BlessedTabContainerArgs
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
screen |
object | blessed screen instance |
|
defaultVisible |
string |
<optional> |
label visible by default, must exist as a tab label. Uniqueness not enforced. |
tabSeperator |
string |
<optional> |
seperater rendered between tab labels |
tabPadding |
number |
<optional> |
number of chars to pad with on either side of the seperator. Default 1 |
tabPaddingChar |
string |
<optional> |
character used to pad labels, not colored. Defaults to a single space, and appears on either side of each seperator. |
autoDirtyUpdateFunctions |
Array.<string> |
<optional> |
array of function names that should be wrapped to automatically set the dirty flag on a tab. i.e. ['pushLine', 'setContent', ...] |
inactiveColorFunc |
function |
<optional> |
color function for inactive tab |
activeColorFunc |
function |
<optional> |
color function for active tab |
dirtyColorFunc |
function |
<optional> |
color function for dirty tab, applied to active/inactive color function output |
cleanColorFunc |
function |
<optional> |
color function for clean tab, applied to active/inactive color function output |
tabs |
Array.<BlessedTabContainerTabState> |
<optional> |
array of tab objects |
elementOptions |
object |
<optional> |
configuration object passed to tabFunc if needed; if provided, should be valid for the desired blessed element. |
Verifies arguments for BlesssedTabContainer
BlessedTabContainerState
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
tabs |
Array.<BlessedTabState> | array of tabs that belong to the container |
|
tabFunc |
function |
<optional> |
alertnative to the 'tab' key; executed with the provided element options to create a dynamic component. |
tabPadding |
number |
<optional> |
number of characters to pad on either side of each tab seperator; default 1 |
tabPaddingChar |
string |
<optional> |
tab padding character, default space |
autoDirty |
boolean |
<optional> |
default true, enables automatic updating of
the dirty flag by tapping all content modification functions be default.
For control over this, pass a custom |
Blessed Tab Container State Object
BlessedTabContainerTabAPI
Properties:
| Name | Type | Description |
|---|---|---|
setAutoDirty |
function | helper to modify underlying elements' autoDirty flag. If set to 'false', automatic dirty flag updates are disabled |
setDirty |
function | modify the tab's dirty flag directly, triggers a re-render |
isDirty |
function | query the tab's dirty flag |
Single tab element API
BlessedTabContainerTabConfig
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
label |
string | tab label, used as clickable tab, highlighted based on active/inactive/dirty/clean status and configured color functions. |
|
tab |
object | the tab element itself, should be a configured blessed component |
|
tabFunc |
function |
<optional> |
alertnative to the 'tab' key; executed with the provided element options to create a dynamic component. |
autoDirty |
boolean |
<optional> |
default true, enables automatic updating of
the dirty flag by tapping all content modification functions be default.
For control over this, pass a custom |
Blessed Tab Container Tab Configuration Object, passed to initTabs(). Note no underlying 'elm' element yet, as it must be constructed from tab or tabFunc
Used to create BlessedTabContainerTabState, hence similar
BlessedTabContainerTabState
Properties:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
label |
string | tab label, used as clickable tab, highlighted based on active/inactive/dirty/clean status and configured color functions. |
||||||
elm |
object | the underlying blessed element Properties
|
Blessed Tab Container Tab State Object, holds data for tab managemnet