/** * Utility class for working with trees * * @author Sergey Shishigin * @date 2019-10-21 */ import { IFlatListItem } from '../../component/'; import { ITreeNode } from '../tree/Tree'; export declare class TreeUtil { /** * Method for converting a flat list to a tree * inspired by * https://github.com/philipstanislaus/performant-array-to-tree/blob/master/src/arrayToTree.ts * https://github.com/philipstanislaus/performant-array-to-tree * * @param items {IFlatListItem[]} FlatListItem * @param onItemAdd */ static listToTree(items: Array>, onItemAdd?: (item: T, node: ITreeNode) => void): Array>; /** * Expand the entire tree (starting at any level) * @param tree */ static expandAll(tree: Array>): void; /** * Collapse the entire tree (starting at any level) * @param tree */ static collapseAll(tree: Array>): void; /** * Sorting the tree and nested sub trees * @param a * @param b */ static sortTree(a: ITreeNode, b: ITreeNode): number; static forEachTreeNode(handler: (item: ITreeNode) => void, currentList: Array>): void; static flatTree(nodes: Array>): Array>; static mapTree(handler: (item: ITreeNode) => ITreeNode, currentList: Array>): Array>; static cloneTree(nodes: Array>): Array>; static filterTree(handler: (item: ITreeNode) => boolean, currentList: Array>): Array>; static findTreeNode(handler: (item: ITreeNode) => boolean, currentList: Array>): ITreeNode | undefined; static findParentNode(nodes: Array>, itemKey: string): ITreeNode | undefined; /** * @deprecated */ static initParents(parentNode: ITreeNode, recursive?: boolean): void; }