treeUtil.d.ts
2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import * as React from 'react';
import { DataNode, FlattenNode, DataEntity, Key, EventDataNode, GetKey } from '../interface';
import { TreeNodeProps } from '../TreeNode';
export declare function getKey(key: Key, pos: string): string | number;
/**
* Warning if TreeNode do not provides key
*/
export declare function warningWithoutKey(treeData?: DataNode[]): void;
/**
* Convert `children` of Tree into `treeData` structure.
*/
export declare function convertTreeToData(rootNodes: React.ReactNode): DataNode[];
/**
* Flat nest tree data into flatten list. This is used for virtual list render.
* @param treeNodeList Origin data node list
* @param expandedKeys
* need expanded keys, provides `true` means all expanded (used in `rc-tree-select`).
*/
export declare function flattenTreeData(treeNodeList?: DataNode[], expandedKeys?: Key[] | true): FlattenNode[];
/**
* Traverse all the data by `treeData`.
* Please not use it out of the `rc-tree` since we may refactor this code.
*/
export declare function traverseDataNodes(dataNodes: DataNode[], callback: (data: {
node: DataNode;
index: number;
pos: string;
key: Key;
parentPos: string | number;
level: number;
}) => void, externalGetKey?: GetKey<DataNode> | string): void;
interface Wrapper {
posEntities: Record<string, DataEntity>;
keyEntities: Record<Key, DataEntity>;
}
/**
* Convert `treeData` into entity records.
*/
export declare function convertDataToEntities(dataNodes: DataNode[], { initWrapper, processEntity, onProcessFinished, }?: {
initWrapper?: (wrapper: Wrapper) => Wrapper;
processEntity?: (entity: DataEntity, wrapper: Wrapper) => void;
onProcessFinished?: (wrapper: Wrapper) => void;
}, externalGetKey?: GetKey<DataNode> | string): {
posEntities: {};
keyEntities: {};
};
export interface TreeNodeRequiredProps {
expandedKeys: Key[];
selectedKeys: Key[];
loadedKeys: Key[];
loadingKeys: Key[];
checkedKeys: Key[];
halfCheckedKeys: Key[];
dragOverNodeKey: Key;
dropPosition: number;
keyEntities: Record<Key, DataEntity>;
}
/**
* Get TreeNode props with Tree props.
*/
export declare function getTreeNodeProps(key: Key, { expandedKeys, selectedKeys, loadedKeys, loadingKeys, checkedKeys, halfCheckedKeys, dragOverNodeKey, dropPosition, keyEntities, }: TreeNodeRequiredProps): {
eventKey: string | number;
expanded: boolean;
selected: boolean;
loaded: boolean;
loading: boolean;
checked: boolean;
halfChecked: boolean;
pos: string;
dragOver: boolean;
dragOverGapTop: boolean;
dragOverGapBottom: boolean;
};
export declare function convertNodePropsToEventData(props: TreeNodeProps): EventDataNode;
export {};