import { ElementRef } from '@angular/core'; import { DragAndDropEvent, TreeEvent } from './events'; import { TreeModel } from './tree-model'; import { AvailableMouseEvents, CustomFieldPrefix, TreeDataOptions } from './tree-options'; export declare class TreeNode { /** * any - Pointer to the original data. * */ data: any; /** * TreeNode - Parent node */ parent: TreeNode | null; treeModel: TreeModel; /** * index of the node inside its parent's children */ index: number; /** * The children of the node. * By default is determined by 'node.data.children', unless stated otherwise in the options */ children: TreeNode[]; /** * top edge position relative to the top edge of scroll area */ position: number; /** * the visual height of the node */ height: number; loadingChildren: boolean; elementRef: ElementRef | null; get isHidden(): boolean; get isExpanded(): boolean; get isCollapsed(): boolean; get isActive(): boolean; get isFocused(): boolean; get isLeaf(): boolean; get isRoot(): boolean; /** * Level in the tree (starts from 1). */ get level(): number; /** * Path in the tree: Array of IDs. */ get path(): string[]; get hasChildren(): boolean; get hasVisibleChildren(): boolean; get options(): TreeDataOptions; /** * The value of the node's field that is used for displaying its content. * By default 'name', unless stated otherwise in the options */ get displayField(): any; /** * A unique key of this node among its siblings. * By default it's the 'id' of the original node, unless stated otherwise in options.idField */ get id(): any; set id(value: any); get visibleChildren(): TreeNode[]; constructor( /** * any - Pointer to the original data. * */ data: any, /** * TreeNode - Parent node */ parent: TreeNode | null, treeModel: TreeModel, /** * index of the node inside its parent's children */ index: number); /** * Fire an event to the renderer of the tree (if it was registered) */ fireEvent(event: TreeEvent): void; getField(key: CustomFieldPrefix): any; setField(key: string, value: any): void; onDrop($event: DragAndDropEvent): void; findAdjacentSibling(steps: number, skipHidden?: boolean): TreeNode; /** * @param skipHidden whether to skip hidden nodes * @returns next sibling (or null) */ findNextSibling(skipHidden?: boolean): TreeNode; /** * @param skipHidden whether to skip hidden nodes * @returns previous sibling (or null) */ findPreviousSibling(skipHidden?: boolean): TreeNode; /** * @param skipHidden whether to skip hidden nodes * @returns first child (or null) */ getFirstChild(skipHidden?: boolean): TreeNode | undefined; /** * @param skipHidden whether to skip hidden nodes * @returns last child (or null) */ getLastChild(skipHidden?: boolean): TreeNode | undefined; /** * Finds the visually next node in the tree. * @param goInside whether to look for children or just siblings * @param skipHidden * @returns next node. */ findNextNode(goInside?: boolean, skipHidden?: boolean): false | TreeNode | null; /** * Finds the visually previous node in the tree. * @param skipHidden whether to skip hidden nodes * @returns previous node. */ findPreviousNode(skipHidden?: boolean): TreeNode | null; /** * @returns true if this node is a descendant of the parameter node */ isDescendantOf(node: TreeNode): boolean; loadChildren(): Promise; /** * Expands the node */ expand(): Promise | this; /** * Collapses the node */ collapse(): this; /** * Invokes a method for every node under this one - depth first(preorder) * @param fn a function that receives the node */ traverse(fn: (node: TreeNode) => any): void; /** * expand all nodes under this one */ expandAll(): void; /** * collapse all nodes under this one */ collapseAll(): void; /** * Expands / Collapses the node */ toggleExpanded(isExpanded?: boolean): Promise | this; setActive(isActive?: boolean, isMulti?: boolean): this; /** * @param isHidden if true makes the node hidden, otherwise visible */ setHidden(isHidden?: boolean): this; /** * Activates / Deactivates the node (selects / deselects) */ toggleActivated(isMulti?: boolean): this; setActiveAndVisible(isMulti?: boolean): this; /** * Expands all ancestors of the node */ ensureVisible(): this; scrollIntoView(force?: boolean, scrollToMiddle?: boolean): void; /** * Focus on the node */ focus(scroll?: boolean): this; /** * Blur (unfocus) the node */ blur(): this; /** * Hides the node */ hide(): this; /** * Makes the node visible */ show(): this; addChild(data: any, index: number): void; appendChild(data: any): void; remove(): void; removeChild(node: TreeNode): void; mouseAction(actionName: AvailableMouseEvents, $event: any, data?: any): void; private reCalcChildrenIndices; private initChildren; private getLastOpenDescendant; private getParentChildren; }