import { KbqTreeModule } from '@koobiq/components/tree';

Selector: [kbqTreeNodeOutlet]

Properties
Name Description
changeDetectorRef: ChangeDetectorRef
viewContainer: ViewContainerRef

Selector: kbq-tree

Exported as: kbqTree
Properties
Name Description
dataDiffer: IterableDiffer Differ used to find the changes in the data provided by the data source.
dataSource: DataSource | T[] | Observable Provides a stream containing the latest data array to render. Influenced by the tree's stream of view window (what dataNodes are currently on screen). Data source can be an observable of data array, or a data array to render.
destroyRef: DestroyRef
nodeDefs: QueryList> The tree node template for the tree
nodeOutlet: KbqTreeNodeOutlet
trackBy: TrackByFunction Tracking function that will be used to check the differences in data changes. Used similarly to `ngFor` `trackBy` function. Optimize node operations by identifying a node based on its data relative to the function to know if a node should be added/removed/moved. Accepts a function that takes two parameters, `index` and `item`.
treeControl: TreeControl
viewChange: BehaviorSubject<{ start: number; end: number; }> Stream containing the latest information on what rows are being displayed on screen. Can be used by the data source to as a heuristic of what data should be provided.
Methods
getNodeDef
Finds the matching node definition that should be used for this node data. If there is only one node definition, it is returned. Otherwise, find the node definition that has a when predicate that returns true with the data. If none return true, return the default node definition.
insertNode
Create the embedded view for the data node template and place it in the correct index location within the data node view container.
renderNodeChanges
Check for changes made in the data and render each change (node added/removed/moved).

Data node definition for the KbqTree. Captures the node's template and a when predicate that describes when this node should be used.

Selector: [kbqTreeNodeDef]

Properties
Name Description
@Input('kbqTreeNode')
data: T
@Input('kbqTreeNodeDefWhen')
when: (index: number, nodeData: T) => boolean
Function that should return true if this node template should be used for the provided node data and index. If left undefined, this node will be considered the default node template to use when no other when functions return true for the data. For every node, there must be at least one when function that passes or an undefined to default.
template: TemplateRef

Selector: [kbqTreeNodePadding]

Exported as: kbqTreeNodePadding
Properties
Name Description
@Input('kbqTreeNodePaddingIndent')
indent: string | number
iconWidth: number
indentUnits: string CSS units used for the indentation value.
leftPadding: number
leftPaddingForFirstLevel: number
level: number
withIcon: boolean
Methods
paddingIndent
Properties
Name Description
@Input()
dataSource: DataSource | T[] | Observable
Provides a stream containing the latest data array to render. Influenced by the tree's stream of view window (what dataNodes are currently on screen). Data source can be an observable of data array, or a data array to render.
@Input()
trackBy: TrackByFunction
Tracking function that will be used to check the differences in data changes. Used similarly to `ngFor` `trackBy` function. Optimize node operations by identifying a node based on its data relative to the function to know if a node should be added/removed/moved. Accepts a function that takes two parameters, `index` and `item`.
@Input()
treeControl: TreeControl
dataDiffer: IterableDiffer Differ used to find the changes in the data provided by the data source.
destroyRef: DestroyRef
nodeDefs: QueryList> The tree node template for the tree
nodeOutlet: KbqTreeNodeOutlet
viewChange: BehaviorSubject<{ start: number; end: number; }> Stream containing the latest information on what rows are being displayed on screen. Can be used by the data source to as a heuristic of what data should be provided.
Methods
getNodeDef
Finds the matching node definition that should be used for this node data. If there is only one node definition, it is returned. Otherwise, find the node definition that has a when predicate that returns true with the data. If none return true, return the default node definition.
insertNode
Create the embedded view for the data node template and place it in the correct index location within the data node view container.
renderNodeChanges
Check for changes made in the data and render each change (node added/removed/moved).

Selector: kbq-tree-node-toggle

Exported as: kbqTreeNodeToggle
Properties
Name Description
disabled: boolean
iconState: boolean
node: T
recursive: boolean
Methods
toggle

Selector: kbq-tree-option

Exported as: kbqTreeOption
Properties
Name Description
@Input()
checkboxThirdState: boolean
@Input()
disabled: any
@Input()
selectable: boolean
@Input()
showCheckbox: any
@Output('onSelectionChange')
onSelectionChange: EventEmitter
actionButton: KbqOptionActionComponent
checkboxState: KbqPseudoCheckboxState
data: T
destroyed: Subject
dropdownTrigger: KbqDropdownTrigger
externalPseudoCheckbox: boolean
hasFocus: boolean
id: string
isExpandable: boolean
isExpanded: boolean
isToggleInDefaultPlace: boolean
level: number
mostRecentTreeNode: KbqTreeNode The most recently created `KbqTreeNode`. We save it in static variable so we can retrieve it in `KbqTree` and set the data to it.
onBlur: Subject
onFocus: Subject
parentTextElement: ElementRef
preventBlur: boolean
pseudoCheckbox: KbqPseudoCheckbox
selected: boolean
toggleElement: KbqTreeNodeToggleBaseDirective
toggleElementComponent: KbqTreeNodeToggleBaseDirective
toggleElementDirective: KbqTreeNodeToggleBaseDirective
tooltipTrigger: KbqTooltipTrigger
tree: any
updateCheckboxState: () => void
userInteraction: EventEmitter
value: any
viewValue: string
Methods
blur
descendantsAllSelected
descendantsPartiallySelected
deselect
emitSelectionChangeEvent
focus
getHostElement
markForCheck
onKeydown
select
selectViaInteraction
setSelected
toggle
updateParentsCheckboxState

Selector: [kbq-tree-node-toggle], [kbqTreeNodeToggle]

Exported as: kbqTreeNodeToggle
Properties
Name Description
disabled: boolean
iconState: boolean
node: T
recursive: boolean
Methods
toggle

Selector: kbq-tree-selection

Exported as: kbqTreeSelection
Properties
Name Description
@Input()
autoSelect: boolean
@Input()
disabled: boolean
@Input()
noUnselectLast: boolean
@Input()
treeControl: FlatTreeControl
@Output('navigationChange')
navigationChange: EventEmitter>
@Output('onCopy')
onCopy: EventEmitter>
@Output('onSelectAll')
onSelectAll: EventEmitter>
@Output('selectionChange')
selectionChange: EventEmitter>
dataDiffer: IterableDiffer Differ used to find the changes in the data provided by the data source.
dataSource: DataSource | T[] | Observable Provides a stream containing the latest data array to render. Influenced by the tree's stream of view window (what dataNodes are currently on screen). Data source can be an observable of data array, or a data array to render.
destroyRef: DestroyRef
focusMonitor: FocusMonitor
inSelect: boolean Indicates whether this component is placed inside a KbqFormField component.
isEmpty: boolean
keyManager: FocusKeyManager
multiple: boolean
multipleMode: MultipleMode
nodeDefs: QueryList> The tree node template for the tree
nodeOutlet: KbqTreeNodeOutlet
onChange: (value: any) => void `View -> model callback called when value changes`
onTouched: () => void `View -> model callback called when select has been touched`
optionBlurChanges: Observable
optionFocusChanges: Observable
optionShouldHoldFocusOnBlur: boolean
renderedOptions: QueryList
resetFocusedItemOnBlur: boolean
selectionModel: SelectionModel
showCheckbox: boolean
trackBy: TrackByFunction Tracking function that will be used to check the differences in data changes. Used similarly to `ngFor` `trackBy` function. Optimize node operations by identifying a node based on its data relative to the function to know if a node should be added/removed/moved. Accepts a function that takes two parameters, `index` and `item`.
unorderedOptions: QueryList
userTabIndex: number
viewChange: BehaviorSubject<{ start: number; end: number; }> Stream containing the latest information on what rows are being displayed on screen. Can be used by the data source to as a heuristic of what data should be provided.
Methods
blur
copyActiveOption
emitChangeEvent
emitNavigationEvent
focus
getItemHeight
getNodeDef
Finds the matching node definition that should be used for this node data. If there is only one node definition, it is returned. Otherwise, find the node definition that has a when predicate that returns true with the data. If none return true, return the default node definition.
getSelectedValues
highlightSelectedOption
insertNode
Create the embedded view for the data node template and place it in the correct index location within the data node view container.
onKeyDown
renderNodeChanges
selectActiveOptions
selectAllOptions
setFocusedOption
setOptionsFromValues
setSelectedOptionsByClick
setSelectedOptionsByKey
setStateChildren
toggleFocusedOption
updateScrollSize

Selector: kbq-tree-node

Exported as: kbqTreeNode
Properties
Name Description
data: T
destroyed: Subject
isExpanded: boolean
level: number
mostRecentTreeNode: KbqTreeNode The most recently created `KbqTreeNode`. We save it in static variable so we can retrieve it in `KbqTree` and set the data to it.
tree: KbqTreeBase
Methods
focus

Context provided to the tree node component.

Properties
Name Description
$implicit: T Data for the node.
count: number Length of the number of total dataNodes.
index: number Index location of the node.
level: number Depth of the node.

Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type.

Properties
Name Description
dataNodes: T[]
expansionModel: SelectionModel A selection model with multi-selection to track expansion status.
filterModel: SelectionModel
filterValue: BehaviorSubject
getChildren: (dataNode: T) => Observable
getLevel: (dataNode: T) => number Get depth of a given data node, return the level number. This is for flat tree node.
isExpandable: (dataNode: T) => boolean Whether the data node is expandable. Returns true if expandable. This is for flat tree node.
Methods
collapse
Collapses one single data node.
collapseAll
Collapse all dataNodes in the tree.
collapseDescendants
Collapses a subtree rooted at given data node recursively.
expand
Expands one single data node.
expandAll
Expands all dataNodes in the tree. To make this working, the `dataNodes` variable of the TreeControl must be set to all root level data nodes of the tree.
expandDescendants
Expands a subtree rooted at given data node recursively.
getDescendants
Gets a list of descendant dataNodes of a subtree rooted at given data node recursively.
isExpanded
Whether a given data node is expanded or not. Returns true if the data node is expanded.
toggle
Toggles one single data node's expanded/collapsed state.
toggleDescendants
Toggles a subtree rooted at `node` recursively.

Base tree control. It has basic toggle/expand/collapse operations on a single data node.

Properties
Name Description
dataNodes: T[]
expansionModel: SelectionModel A selection model with multi-selection to track expansion status.
filterModel: SelectionModel
filterValue: BehaviorSubject
getChildren: (dataNode: T) => Observable Gets a stream that emits whenever the given data node's children change.
getLevel: (dataNode: T) => number Get depth of a given data node, return the level number. This is for flat tree node.
isExpandable: (dataNode: T) => boolean Whether the data node is expandable. Returns true if expandable. This is for flat tree node.
Methods
collapse
Collapses one single data node.
collapseAll
Collapse all dataNodes in the tree.
collapseDescendants
Collapses a subtree rooted at given data node recursively.
expand
Expands one single data node.
expandAll
Expands all data nodes in the tree.
expandDescendants
Expands a subtree rooted at given data node recursively.
getDescendants
Gets a list of descendent data nodes of a subtree rooted at given data node recursively.
isExpanded
Whether a given data node is expanded or not. Returns true if the data node is expanded.
toggle
Toggles one single data node's expanded/collapsed state.
toggleDescendants
Toggles a subtree rooted at `node` recursively.

Data source for nested tree. The data source for nested tree doesn't have to consider node flattener, or the way to expand or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node.

Properties
Name Description
data: T[]
Methods
connect
disconnect
Properties
Name Description
result: T[]
Methods
handle

Tree flattener to convert a normal type of node to node with children & level information. Transform nested nodes of type `T` to flattened nodes of type `F`. For example, the input data of type `T` is nested, and contains its children data: SomeNode: { key: 'Fruits', children: [ NodeOne: { key: 'Apple', }, NodeTwo: { key: 'Pear', } ] } After flattener flatten the tree, the structure will become SomeNode: { key: 'Fruits', expandable: true, level: 1 }, NodeOne: { key: 'Apple', expandable: false, level: 2 }, NodeTwo: { key: 'Pear', expandable: false, level: 2 } and the output flattened type is `F` with additional information.

Properties
Name Description
getChildren: (node: T) => T[] | Observable
getLevel: (node: F) => number
isExpandable: (node: F) => boolean
transformFunction: (node: T, level: number, parent: F) => F
Methods
expandFlattenedNodes
Expand flattened node with current expansion status. The returned list may have different length.
flattenChildren
flattenNode
flattenNodes
Flatten a list of node type T to flattened version of node F. Please note that type T may be nested, and the length of `structuredData` may be different from that of returned list `F[]`.

Flat tree control. Able to expand/collapse a subtree recursively for flattened tree.

Properties
Name Description
compareValues: (firstValue: any, secondValue: any) => boolean compareValues will be used to comparing values.
compareViewValues: (firstViewValue: any, secondViewValue: any) => boolean compareValues will be used to comparing values.
dataNodes: T[]
expandedItemsBeforeFiltration: T[]
expansionModel: SelectionModel A selection model with multi-selection to track expansion status.
filterModel: SelectionModel
filterValue: BehaviorSubject
getChildren: (dataNode: T) => Observable Gets a stream that emits whenever the given data node's children change.
getLevel: (dataNode: T) => number
getValue: (dataNode: T) => any getValue will be used to determine if the tree contains value or not. Used in method hasValue
getViewValue: (dataNode: T) => string getViewValue will be used for filter nodes. Returned value will be first argument in filterNodesFunction
isDisabled: (dataNode: T) => boolean isDisabled will be used to determine if the node is disabled.
isExpandable: (dataNode: T) => boolean
Methods
collapse
Collapses one single data node.
collapseAll
Collapse all dataNodes in the tree.
collapseDescendants
Collapses a subtree rooted at given data node recursively.
expand
Expands one single data node.
expandAll
Expands all data nodes in the tree. To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened data nodes of the tree.
expandDescendants
Expands a subtree rooted at given data node recursively.
filterNodes
getDescendants
Gets a list of the data node's subtree of descendent data nodes. To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes with correct levels.
getFilters
getParents
hasValue
isExpanded
Whether a given data node is expanded or not. Returns true if the data node is expanded.
setFilters
toggle
Toggles one single data node's expanded/collapsed state.
toggleDescendants
Toggles a subtree rooted at `node` recursively.
Properties
Name Description
result: T[]
Methods
handle

Represents a change event for a tree option.

Properties
Name Description
isUserInput: boolean
source: KbqTreeOption
Properties
Name Description
result: T[]
setValues: (values: string[]) => void
Methods
getValues
handle
Properties
Name Description
options: T[]
source: KbqTreeSelection

Event class that occurs when copying an item from the KbqTreeSelection. Used to pass data about the copied item and copy context.

Properties
Name Description
event: KeyboardEvent
option: T
source: KbqTreeSelection
Properties
Name Description
option: T
source: KbqTreeSelection
Properties
Name Description
option: T
options: T[]
source: KbqTreeSelection

Data source for flat tree. The data source need to handle expansion/collapsion of the tree node and change the data feed to `KbqTree`. The nested tree nodes of type `T` are flattened through `MсTreeFlattener`, and converted to type `F` for `KbqTree` to consume.

Properties
Name Description
data: T[]
expandedData: BehaviorSubject
filteredData: BehaviorSubject
flattenedData: BehaviorSubject
Methods
connect
disconnect
expansionHandler
filterHandler
Properties
Name Description
result: T[]
Methods
handle

Tree control interface. User can implement TreeControl to expand/collapse dataNodes in the tree. The Tree will use this TreeControl to expand/collapse a node. User can also use it outside the `` to control the expansion status of the tree.

Properties
Name Description
dataNodes: T[] The saved tree nodes data for `expandAll` action.
expansionModel: SelectionModel The expansion model
filterModel: SelectionModel
filterValue: BehaviorSubject
Methods
collapse
Collapse one data node
collapseAll
Collapse all the dataNodes in the tree
collapseDescendants
Collapse a data node and all its descendants
expand
Expand one data node
expandAll
Expand all the dataNodes in the tree
expandDescendants
Expand a data node and all its descendants
getChildren
Gets a stream that emits whenever the given data node's children change.
getDescendants
Get all descendants of a data node
getLevel
Get depth of a given data node, return the level number. This is for flat tree node.
isExpandable
Whether the data node is expandable. Returns true if expandable. This is for flat tree node.
isExpanded
Whether the data node is expanded or collapsed. Return true if it's expanded.
toggle
Expand or collapse data node
toggleDescendants
Toggle a data node by expand/collapse it and all its descendants
Properties
Name Description
option: KbqTreeOption
const defaultCompareValues(firstValue: string, secondValue: string): boolean;
Parameters Description
firstValue: string
secondValue: string
const defaultCompareViewValues(firstViewValue: string, secondViewValue: string): boolean;
Parameters Description
firstViewValue: string
secondViewValue: string
const kbqTreeSelectAllValue: string;

Injection token used to provide the parent component to options.

const KBQ_TREE_OPTION_PARENT_COMPONENT: InjectionToken<any>;
const KBQ_SELECTION_TREE_VALUE_ACCESSOR: any;
Вопросы и предложения по документации
Если у вас есть вопросы или вы хотите внести свой вклад в написание документации, пожалуйста, создайте issue в нашем репозитории на GitHub.