import { CascadeSelection, DataRowPathItem, DataSourceState, IMap, LazyDataSourceApi } from '../../../../types'; import { ITree } from './ITree'; import { FetchingOptions } from '../../../../services'; import { NOT_FOUND_RECORD } from './constants'; import type { ITreeNodeInfo, ITreeParams } from './treeStructure/types'; import { TreeStructure } from './treeStructure'; export interface LoadOptions extends FetchingOptions { tree: ITree; api: LazyDataSourceApi; getChildCount?(item: TItem): number; isFolded?: (item: TItem) => boolean; dataSourceState: DataSourceState; filter?: TFilter; } export interface LoadMissingOnCheckOptions extends Omit, 'withNestedChildren'> { cascadeSelection?: CascadeSelection; checkedId?: TId; isRoot: boolean; isChecked: boolean; } /** * Structured result of tree records loading. */ export interface ITreeLoadResult { /** * Loaded records. */ loadedItems: TItem[]; /** * Loaded records, structured by parents IDs. */ byParentId: IMap; /** * Loading node info, like count/assumedCount/totalCount, by IDs. */ nodeInfoById: IMap; } export declare class Tree { static createFromItems({ params, items }: { params: ITreeParams; items: TItem[]; }): TreeStructure; static getParents(id: TId, tree: ITree): TId[]; static getPathById(id: TId, tree: ITree): DataRowPathItem[]; static getPathItem(item: TItem, tree: ITree): DataRowPathItem; static forEach(tree: ITree, action: (item: TItem, id: TId, parentId: TId, stop: () => void) => void, options?: { direction?: 'bottom-up' | 'top-down'; parentId?: TId; includeParent?: boolean; }): void; static forEachChildren(tree: ITree, action: (id: TId) => void, isSelectable: (id: TId, item: TItem | typeof NOT_FOUND_RECORD) => boolean, parentId?: TId, includeParent?: boolean): void; static load({ tree, dataSourceState, api, getChildCount, isFolded, filter, signal, }: LoadOptions): Promise>; static loadMissingOnCheck({ tree, dataSourceState, api, getChildCount, isFolded, filter, cascadeSelection, isRoot, isChecked, checkedId, signal, }: LoadMissingOnCheckOptions): Promise | ITreeLoadResult>; static computeSubtotals(tree: ITree, get: (item: TItem, hasChildren: boolean) => TSubtotals, add: (a: TSubtotals, b: TSubtotals) => TSubtotals): IMap; } //# sourceMappingURL=Tree.d.ts.map