-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
105 lines (87 loc) · 3.21 KB
/
index.d.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import * as React from "react";
interface DataType {
id?: string,
label?: string,
value?: any,
children?: [DataType]
active?: boolean,
toggled?: boolean,
leaf?:boolean
}
interface ReactTreeProps {
/**
* The data to be rendered. Required!
*/
data?: DataType,
/**
* Triggered every time a node item is clicked (left clicked).
* It receives as argurments the `id` and the `value` of the data for the node clicked.
* The isLeafNode is true if, well, the node clicked is a leaf node.
*/
onNodeClick?: (nodeId:string, nodeValue:any, isLeafNode:boolean) => any,
/**
* Triggered every time a node item is right-clicked.
* It receives as argurments the `id` and the `value` of the data for the node clicked.
* The isLeafNode is true if, well, the node clicked is a leaf node.
*/
onNodeRightClick?: (nodeId:string, nodeValue:any, isLeafNode:boolean) => any,
/**
* Provides a custom component to be used in rendering a parent node.
* The `label` for the current parent node to be rendered is passed as argurment.
*/
renderParent?: (label:string) => React.ElementType,
/**
* Provides a custom component to be used in rendering a leaf node.
* The `label` for the current leaf node to be rendered is passed as argurment.
*/
renderLeaf?: (label:string) => React.ElementType,
/**
* Provides a custom component to used in rendering a node (leaf or parent).
* The `label` for the current node to be rendered is passed as argurment
*/
renderNode?: (label:string) => React.ElementType,
/**
* Takes as argument the label to be displayed for a node and returns the actual text that will be displayed.
*/
transformLabel?: (label:string)=>string,
/**
* Custom icon to used for leaf nodes. It Should be a react component.
*/
leafIcon?: React.ReactElement,
/**
* Custom icon to used for parent nodes. It Should be a react component.
*/
parentIcon?: React.ReactElement,
/**
* Custom css style properties to be used for a parent node text.
* This does not apply for custom rendered parent nodes.
*/
parentStyle?: React.CSSProperties,
/**
* Custom css style properties to be used for a leaf node text.
* This does not apply for custom rendered leaf nodes.
*/
leafStyle?: React.CSSProperties,
/**
* Custom css style properties to applied to both leaf and parent node texts.
* This does not apply for custom rendered nodes.
*/
nodeStyle?: React.CSSProperties,
/**
* Custom css style properties to be used for the react-tree component
*/
style?: React.CSSProperties,
/**
* disables the mouse hover background color on nodes
*/
disableHoverEffect?:boolean,
/**
* Custom color to used for the current active node (the node currently selected)
*/
activeNodeColor?: string
/**
* If true, the leaf node is automatically detected from the data structure instead of explicitly setting the `leaf` field to *true*
*/
autoDetectLeafNode?: boolean
}
export default class ReactTree extends React.Component<ReactTreeProps, any> {}