forked from vueComponent/ant-design-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcascader.d.ts
209 lines (179 loc) · 4.47 KB
/
cascader.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// Project: https://github.com/vueComponent/ant-design-vue
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from './component';
import { VNode } from 'vue';
export interface CascaderOptionType {
value?: string | number;
label?: any;
disabled?: boolean;
children?: any;
key?: string | number;
}
export interface ShowSearchType {
/**
* The function will receive two arguments, inputValue and option,
* if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded.
* @type Function
*/
filter?: (inputValue: any, path: any) => boolean;
/**
* Used to render filtered options, you can use slot="showSearchRender" and slot-scope="{inputValue, path}"
* @type Function
*/
render?: ({ inputValue, path }: { inputValue: any; path: any }) => VNode;
/**
* Used to sort filtered options.
* @type Function
*/
sort?: (a: any, b: any, inputValue: any) => any;
/**
* Whether the width of result list equals to input's
* @type boolean
*/
matchInputWidth?: boolean;
/**
* Set the count of filtered items
* @type number | false
*/
limit?: number | false;
}
export declare class Cascader extends AntdComponent {
/**
* whether allow clear
* @default true
* @type boolean
*/
allowClear: boolean;
/**
* get focus when component mounted
* @default false
* @type boolean
*/
autoFocus: boolean;
/**
* change value on each selection if set to true.
* @default false
* @type boolean
*/
changeOnSelect: boolean;
/**
* initial selected value
* @type Array<string | number>
*/
defaultValue: Array<string | number>;
/**
* Whether disabled select
* @default false
* @type boolean
*/
disabled: boolean;
/**
* render function of displaying selected options, you can use slot="displayRender" and slot-scope="{labels, selectedOptions}"
* @default labels => labels.join(' / ')
* @type Function
*/
displayRender: ({
labels,
selectedOptions,
}: {
labels: string[];
selectedOptions: CascaderOptionType[];
}) => VNode;
/**
* expand current item when click or hover, one of 'click' 'hover'
* @default 'click'
* @type string
*/
expandTrigger: 'click' | 'hover';
/**
* custom field name for label and value and children
* @default { label: 'label', value: 'value', children: 'children' }
* @type { value: string; label: string; children?: string; }
*/
fieldNames: {
value: string;
label: string;
children?: string;
};
/**
* Parent Node which the selector should be rendered to. Default to body.
* When position issues happen, try to modify it into scrollable content and position it relative.
* @default () => document.body
* @type Function
*/
getPopupContainer: (triggerNode: any) => HTMLElement;
/**
* To load option lazily, and it cannot work with showSearch
* @type Function
*/
loadData: (selectedOptions: CascaderOptionType[]) => void;
/**
* Specify content to show when no result matches.
* @default 'Not Found'
* @type string
*/
notFoundContent: string;
/**
* data options of cascade
* @type CascaderOptionType
*/
options: CascaderOptionType;
/**
* input placeholder
* @default 'Please select'
* @type string
*/
placeholder: string;
/**
* additional className of popup overlay
* @type string
*/
popupClassName: string;
/**
* additional style of popup overlay
* @type object
*/
popupStyle: object;
/**
* use preset popup align config from builtinPlacements:bottomLeft bottomRight topLeft topRight
* @default 'bottomLeft'
* @type string
*/
popupPlacement: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
/**
* set visible of cascader popup
* @type boolean
*/
popupVisible: boolean;
/**
* Whether show search input in single mode.
* @default false
* @type boolean | ShowSearchType
*/
showSearch: boolean | ShowSearchType;
/**
* input size, one of large default small
* @default 'default'
* @type string
*/
size: 'large' | 'default' | 'small';
/**
* The custom suffix icon
* @type String | VNode | slot
*/
suffixIcon: any;
/**
* selected value
* @type Array<string | number>
*/
value: Array<string | number>;
/**
* remove focus
*/
blur(): void;
/**
* get focus
*/
focus(): void;
}