1 | import * as React from 'react';
|
2 | import { TreeNodeProps } from './TreeNode';
|
3 | export { ScrollTo } from 'rc-virtual-list/lib/List';
|
4 |
|
5 | export interface BasicDataNode {
|
6 | checkable?: boolean;
|
7 | disabled?: boolean;
|
8 | disableCheckbox?: boolean;
|
9 | icon?: IconType;
|
10 | isLeaf?: boolean;
|
11 | selectable?: boolean;
|
12 | switcherIcon?: IconType;
|
13 |
|
14 | className?: string;
|
15 | style?: React.CSSProperties;
|
16 | }
|
17 |
|
18 | export type FieldDataNode<T, ChildFieldName extends string = 'children'> = BasicDataNode & T & Partial<Record<ChildFieldName, FieldDataNode<T, ChildFieldName>[]>>;
|
19 | export type DataNode = FieldDataNode<{
|
20 | key: string | number;
|
21 | title?: React.ReactNode | ((data: DataNode) => React.ReactNode);
|
22 | }>;
|
23 | export type EventDataNode<TreeDataType> = {
|
24 | key: React.Key;
|
25 | expanded: boolean;
|
26 | selected: boolean;
|
27 | checked: boolean;
|
28 | loaded: boolean;
|
29 | loading: boolean;
|
30 | halfChecked: boolean;
|
31 | dragOver: boolean;
|
32 | dragOverGapTop: boolean;
|
33 | dragOverGapBottom: boolean;
|
34 | pos: string;
|
35 | active: boolean;
|
36 | } & TreeDataType & BasicDataNode;
|
37 | export type IconType = React.ReactNode | ((props: TreeNodeProps) => React.ReactNode);
|
38 | export type Key = string | number;
|
39 | export type NodeElement = React.ReactElement<TreeNodeProps> & {
|
40 | selectHandle?: HTMLSpanElement;
|
41 | type: {
|
42 | isTreeNode: boolean;
|
43 | };
|
44 | };
|
45 | export type NodeInstance<TreeDataType extends BasicDataNode = DataNode> = React.Component<TreeNodeProps<TreeDataType>> & {
|
46 | selectHandle?: HTMLSpanElement;
|
47 | };
|
48 | export interface Entity {
|
49 | node: NodeElement;
|
50 | index: number;
|
51 | key: Key;
|
52 | pos: string;
|
53 | parent?: Entity;
|
54 | children?: Entity[];
|
55 | }
|
56 | export interface DataEntity<TreeDataType extends BasicDataNode = DataNode> extends Omit<Entity, 'node' | 'parent' | 'children'> {
|
57 | node: TreeDataType;
|
58 | nodes: TreeDataType[];
|
59 | parent?: DataEntity<TreeDataType>;
|
60 | children?: DataEntity<TreeDataType>[];
|
61 | level: number;
|
62 | }
|
63 | export interface FlattenNode<TreeDataType extends BasicDataNode = DataNode> {
|
64 | parent: FlattenNode<TreeDataType> | null;
|
65 | children: FlattenNode<TreeDataType>[];
|
66 | pos: string;
|
67 | data: TreeDataType;
|
68 | title: React.ReactNode;
|
69 | key: Key;
|
70 | isStart: boolean[];
|
71 | isEnd: boolean[];
|
72 | }
|
73 | export type GetKey<RecordType> = (record: RecordType, index?: number) => Key;
|
74 | export type GetCheckDisabled<RecordType> = (record: RecordType) => boolean;
|
75 | export type Direction = 'ltr' | 'rtl' | undefined;
|
76 | export interface FieldNames {
|
77 | title?: string;
|
78 |
|
79 | _title?: string[];
|
80 | key?: string;
|
81 | children?: string;
|
82 | }
|