-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathtree.ts
77 lines (67 loc) · 1.82 KB
/
tree.ts
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
76
77
import * as React from 'react';
import {
State,
IdReducerFunctions,
Modifier,
Nullish,
} from '@table-library/react-table-library/types/common';
import { TableNode, GetRowProps, CellProps } from '@table-library/react-table-library/types/table';
export enum TreeExpandClickTypes {
RowClick,
ButtonClick,
}
export type CustomIcon<T extends TableNode> =
| React.ReactElement
| ((node: T) => React.ReactElement)
| Nullish;
export type TreeOptionsIcon<T extends TableNode> = {
margin?: string;
size?: string;
noIconMargin?: string;
iconDefault?: CustomIcon<T>;
iconRight?: CustomIcon<T>;
iconDown?: CustomIcon<T>;
};
export type TreeOptions<T extends TableNode> = {
isServer?: boolean;
treeIcon?: TreeOptionsIcon<T>;
clickType?: TreeExpandClickTypes;
indentation?: number;
treeXLevel?: number;
treeYLevel?: number;
};
export type TreeOptionsIconSound<T extends TableNode> = {
margin: string;
size: string;
noIconMargin: string;
iconDefault: CustomIcon<T>;
iconRight: CustomIcon<T>;
iconDown: CustomIcon<T>;
};
export type TreeOptionsSound<T extends TableNode> = {
isServer: boolean;
treeIcon: TreeOptionsIconSound<T>;
clickType: TreeExpandClickTypes;
indentation: number;
treeXLevel: number;
treeYLevel: number;
};
export type ColumnTreePropsObject<T extends TableNode> = {
treeIcon?: TreeOptionsIcon<T>;
};
export type ColumnTreeProps<T extends TableNode> = ColumnTreePropsObject<T> | boolean;
export type CellTreeProps<T extends TableNode> = {
item: T;
treeIcon?: TreeOptionsIcon<T>;
children?: React.ReactNode;
} & CellProps;
export type Tree<T extends TableNode> = {
state: State;
fns: IdReducerFunctions<T>;
options: TreeOptionsSound<T>;
_getRowProps: GetRowProps<T>;
modifier: Modifier<T>;
components: {
CellTree: React.FunctionComponent<CellTreeProps<T>>;
};
};