-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
123 lines (117 loc) · 2.91 KB
/
types.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import * as React from 'react';
import {TreeProps} from "@idui/react-tree";
/**
* all props from tree node and some props from tree
*/
export interface SearchTreeLeafProps {
toggle: () => void;
close: () => void;
onSelect: (value: any) => void;
hasChildren: boolean;
isOpen: boolean;
canSelectParentNode: boolean;
closeOnSelect: boolean;
valueKey: string;
labelKey: string;
className: string;
}
export class SearchTreeLeaf extends React.Component<SearchTreeLeafProps> {}
interface RenderSearchTreeInputProps {
value: string;
onChange: (value: string) => void;
placeholder?: string;
}
interface RenderInputProps {
/**
* TreeSelect value
*/
value: string;
/**
* onClear value handler
*/
onClear: React.EventHandler<void>;
/**
* input placeholder from TreeSelect props
*/
placeholder?: string;
/**
* open menu
*/
open: () => void;
/**
* close menu
*/
close: () => void;
/**
* toggle menu
*/
toggle: () => void;
/**
* is menu open
*/
isOpen: () => void;
}
export interface TreeSelectProps extends TreeProps {
/**
* property for node value
* @default value
*/
valueKey?: string;
/**
* property for node label
* @default label
*/
labelKey?: string;
/**
* input renderer, should return readonly input
* @default TextInput from @idui/react-inputs
*/
renderInput?: (props: RenderInputProps) => React.ReactChild;
/**
* search input renderer, use autoFocus to set focus when popover opens
* @default SearchInput from @idui/react-inputs
*/
renderSearchInput?: (props: RenderSearchTreeInputProps) => React.ReactChild;
/**
* search tree leaf renderer
* @default SearchTreeLeaf from @idui/react-tree-select
*/
renderLeaf?: (props: SearchTreeLeafProps) => React.ReactChild;
/**
* whether node with children selectable or not
* @default false
*/
canSelectParentNode?: boolean;
/**
* whether close on select or not
* @default true
*/
closeOnSelect?: boolean;
/**
* maximum search tree height
* @default 300px
*/
maxTreeHeight?: string;
/**
* whether hide search tree scrollbar or not
* @default false
*/
hideScrollbar?: boolean;
/**
* select placeholder
*/
placeholder?: string;
/**
* search input placeholder
*/
searchPlaceholder?: string;
/**
* elements, rendered after tree outside scroll container (for example you might want to add pagination)
*/
searchTreeBottomAddon?: React.ReactChildren;
/**
* elements, rendered after tree inside scroll container (for example you might want to add waypoint)
*/
searchTreeScrollBottomAddon?: React.ReactChildren;
}
export default class TreeSelect extends React.Component<TreeSelectProps> {}