Constructor
new TabStack()
Members
type
Type of the content item. Always stack, but useful for distinguishing between a TabStack and ColumnOrRow.
Methods
addView(view, options) → {Promise.<identity>}
Adds or creates a view in this TabStack.
Known Issue: If adding a view overflows the tab-container, the added view will be set as active and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
Parameters:
Name | Type | Description |
---|---|---|
view |
View~options | The identity of an existing view to add, or options to create a view. |
options |
TabStack~AddViewOptions | Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack) |
- Tutorials:
Throws:
-
If the view does not exist or fails to create.
-
If the TabStack has been destroyed.
Returns:
Resolves with the identity of the added view.
- Type
- Promise.<identity>
createAdjacentStack(views, options) → {Promise.<TabStack>}
Given a list of view creation options or references and a layout position, creates a TabStack adjacent to the current TabStack
Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged. This means the views you pass to createAdjacentStack() may not render in the order given by the array. Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
Parameters:
Name | Type | Description |
---|---|---|
views |
View~options | List of identities or view creation options of the views to include in the stack |
options |
StackCreationOptions | Creation options. |
- Tutorials:
Returns:
The created TabStack.
- Type
- Promise.<TabStack>
exists() → {Promise.<boolean>}
Determines if this TabStack exists.
- Tutorials:
Returns:
Resolves true if this is the TabStack exists, or false if it has been destroyed.
- Type
- Promise.<boolean>
getAdjacentStacks(edge) → {Promise.<Array.<TabStack>>}
Returns all the adjacent stacks that share an edge with the given TabStack.
Parameters:
Name | Type | Description |
---|---|---|
edge |
LayoutPosition | Edge to check for any adjacent stacks. |
- Tutorials:
Returns:
- Type
- Promise.<Array.<TabStack>>
getParent() → {Promise.<(ColumnOrRow|TabStack|undefined)>}
Retrieves the parent ColumnOrRow of this TabStack, if one exists.
- Tutorials:
Returns:
Promise resolving with the ColumnOrRow that contains this item, or undefined if this TabStack is the root content item or does not exist.
- Type
- Promise.<(ColumnOrRow|TabStack|undefined)>
getViews() → {Promise.<Array.<Identity>>}
Retrieves a list of all views belonging to this TabStack.
Known Issue: If adding a view overflows the tab-container width, the added view will be set as active and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged. If that happens and then getViews() is called, it will return the identities in a different order than than the currently rendered tab order.
- Tutorials:
Throws:
If the TabStack has been destroyed.
Returns:
Resolves with a list containing the identities of each view belonging to the TabStack.
- Type
- Promise.<Array.<Identity>>
isRoot() → {Promise.<boolean>}
Determines if this TabStack is the top level content item in the current layout.
- Tutorials:
Returns:
Resolves true if this TabStack is the top level content item, or false if it is not.
- Type
- Promise.<boolean>
removeView(view) → {Promise.<void>}
Removes a view from this TabStack.
Parameters:
Name | Type | Description |
---|---|---|
view |
Identity | Identity of the view to remove. |
- Tutorials:
Throws:
-
If the view does not exist or does not belong to the stack.
-
If the TabStack has been destroyed.
Returns:
- Type
- Promise.<void>
setActiveView(view) → {Promise.<void>}
Sets the active view of the TabStack without focusing it.
Parameters:
Name | Type | Description |
---|---|---|
view |
Identity | Identity of the view to activate. |
- Tutorials:
Throws:
-
If the TabStack has been destroyed.
-
If the view does not exist.
Returns:
Promise which resolves with void once the view has been activated.
- Type
- Promise.<void>
Type Definitions
AddViewOptions
Options to use when adding a view to a TabStack
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
index |
number |
<optional> |
Insertion index when adding the view. Defaults to 0. |