Skip to content

Commit 941ebc2

Browse files
author
binhaoCen
authored
chore: update type Cascader (#2725)
1 parent 4063fe6 commit 941ebc2

File tree

1 file changed

+153
-151
lines changed

1 file changed

+153
-151
lines changed

types/cascader.d.ts

+153-151
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

55
import { AntdComponent } from './component';
6-
import { VNode } from 'vue';
6+
import { VNode, VNodeChild, CSSProperties } from 'vue';
77

88
export interface CascaderOptionType {
99
value?: string | number;
@@ -41,162 +41,164 @@ export interface ShowSearchType {
4141

4242
/**
4343
* Set the count of filtered items
44+
* @default 50
4445
* @type number | false
4546
*/
4647
limit?: number | false;
4748
}
4849

4950
export declare class Cascader extends AntdComponent {
50-
/**
51-
* whether allow clear
52-
* @default true
53-
* @type boolean
54-
*/
55-
allowClear: boolean;
56-
57-
/**
58-
* get focus when component mounted
59-
* @default false
60-
* @type boolean
61-
*/
62-
autofocus: boolean;
63-
64-
/**
65-
* change value on each selection if set to true.
66-
* @default false
67-
* @type boolean
68-
*/
69-
changeOnSelect: boolean;
70-
71-
/**
72-
* initial selected value
73-
* @type Array<string | number>
74-
*/
75-
defaultValue: Array<string | number>;
76-
77-
/**
78-
* Whether disabled select
79-
* @default false
80-
* @type boolean
81-
*/
82-
disabled: boolean;
83-
84-
/**
85-
* render function of displaying selected options, you can use slot="displayRender" and slot-scope="{labels, selectedOptions}"
86-
* @default labels => labels.join(' / ')
87-
* @type Function
88-
*/
89-
displayRender: ({
90-
labels,
91-
selectedOptions,
92-
}: {
93-
labels: string[];
94-
selectedOptions: CascaderOptionType[];
95-
}) => VNode;
96-
97-
/**
98-
* expand current item when click or hover, one of 'click' 'hover'
99-
* @default 'click'
100-
* @type string
101-
*/
102-
expandTrigger: 'click' | 'hover';
103-
104-
/**
105-
* custom field name for label and value and children
106-
* @default { label: 'label', value: 'value', children: 'children' }
107-
* @type { value: string; label: string; children?: string; }
108-
*/
109-
fieldNames: {
110-
value: string;
111-
label: string;
112-
children?: string;
113-
};
114-
115-
/**
116-
* Parent Node which the selector should be rendered to. Default to body.
117-
* When position issues happen, try to modify it into scrollable content and position it relative.
118-
* @default () => document.body
119-
* @type Function
120-
*/
121-
getPopupContainer: (triggerNode: any) => HTMLElement;
122-
123-
/**
124-
* To load option lazily, and it cannot work with showSearch
125-
* @type Function
126-
*/
127-
loadData: (selectedOptions: CascaderOptionType[]) => void;
128-
129-
/**
130-
* Specify content to show when no result matches.
131-
* @default 'Not Found'
132-
* @type string
133-
*/
134-
notFoundContent: string;
135-
136-
/**
137-
* data options of cascade
138-
* @type CascaderOptionType
139-
*/
140-
options: CascaderOptionType;
141-
142-
/**
143-
* input placeholder
144-
* @default 'Please select'
145-
* @type string
146-
*/
147-
placeholder: string;
148-
149-
/**
150-
* additional className of popup overlay
151-
* @type string
152-
*/
153-
popupClassName: string;
154-
155-
/**
156-
* additional style of popup overlay
157-
* @type object
158-
*/
159-
popupStyle: object;
160-
161-
/**
162-
* use preset popup align config from builtinPlacements:bottomLeft bottomRight topLeft topRight
163-
* @default 'bottomLeft'
164-
* @type string
165-
*/
166-
popupPlacement: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
167-
168-
/**
169-
* set visible of cascader popup
170-
* @type boolean
171-
*/
172-
popupVisible: boolean;
173-
174-
/**
175-
* Whether show search input in single mode.
176-
* @default false
177-
* @type boolean | ShowSearchType
178-
*/
179-
showSearch: boolean | ShowSearchType;
180-
181-
/**
182-
* input size, one of large default small
183-
* @default 'default'
184-
* @type string
185-
*/
186-
size: 'large' | 'default' | 'small';
187-
188-
/**
189-
* The custom suffix icon
190-
* @type String | VNode | slot
191-
*/
192-
suffixIcon: any;
193-
194-
/**
195-
* selected value
196-
* @type Array<string | number>
197-
*/
198-
value: Array<string | number>;
199-
51+
$props: {
52+
/**
53+
* whether allow clear
54+
* @default true
55+
* @type boolean
56+
*/
57+
allowClear?: boolean;
58+
59+
/**
60+
* get focus when component mounted
61+
* @default false
62+
* @type boolean
63+
*/
64+
autofocus?: boolean;
65+
66+
/**
67+
* change value on each selection if set to true.
68+
* @default false
69+
* @type boolean
70+
*/
71+
changeOnSelect?: boolean;
72+
73+
/**
74+
* initial selected value
75+
* @type Array<string | number>
76+
*/
77+
defaultValue?: Array<string | number>;
78+
79+
/**
80+
* Whether disabled select
81+
* @default false
82+
* @type boolean
83+
*/
84+
disabled?: boolean;
85+
86+
/**
87+
* render function of displaying selected options, you can use slot="displayRender" and slot-scope="{labels, selectedOptions}"
88+
* @default labels => labels.join(' / ')
89+
* @type Function
90+
*/
91+
displayRender?: ({
92+
labels,
93+
selectedOptions,
94+
}: {
95+
labels: string[];
96+
selectedOptions: CascaderOptionType[];
97+
}) => VNodeChild;
98+
99+
/**
100+
* expand current item when click or hover, one of 'click' 'hover'
101+
* @default 'click'
102+
* @type string
103+
*/
104+
expandTrigger?: 'click' | 'hover';
105+
106+
/**
107+
* custom field name for label and value and children
108+
* @default { label: 'label', value: 'value', children: 'children' }
109+
* @type { value: string; label: string; children?: string; }
110+
*/
111+
fieldNames?: {
112+
value: string;
113+
label: string;
114+
children?: string;
115+
};
116+
117+
/**
118+
* Parent Node which the selector should be rendered to. Default to body.
119+
* When position issues happen, try to modify it into scrollable content and position it relative.
120+
* @default () => document.body
121+
* @type Function
122+
*/
123+
getPopupContainer?: (triggerNode: any) => HTMLElement;
124+
125+
/**
126+
* To load option lazily, and it cannot work with showSearch
127+
* @type Function
128+
*/
129+
loadData?: (selectedOptions: CascaderOptionType[]) => void;
130+
131+
/**
132+
* Specify content to show when no result matches.
133+
* @default 'Not Found'
134+
* @type string
135+
*/
136+
notFoundContent?: string;
137+
138+
/**
139+
* data options of cascade
140+
* @type CascaderOptionType
141+
*/
142+
options?: CascaderOptionType;
143+
144+
/**
145+
* input placeholder
146+
* @default 'Please select'
147+
* @type string
148+
*/
149+
placeholder?: string;
150+
151+
/**
152+
* additional className of popup overlay
153+
* @type string
154+
*/
155+
popupClassName?: string;
156+
157+
/**
158+
* additional style of popup overlay
159+
* @type object
160+
*/
161+
popupStyle?: CSSProperties;
162+
163+
/**
164+
* use preset popup align config from builtinPlacements:bottomLeft bottomRight topLeft topRight
165+
* @default 'bottomLeft'
166+
* @type string
167+
*/
168+
popupPlacement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
169+
170+
/**
171+
* set visible of cascader popup
172+
* @type boolean
173+
*/
174+
popupVisible?: boolean;
175+
176+
/**
177+
* Whether show search input in single mode.
178+
* @default false
179+
* @type boolean | ShowSearchType
180+
*/
181+
showSearch?: boolean | ShowSearchType;
182+
183+
/**
184+
* input size, one of large default small
185+
* @default 'default'
186+
* @type string
187+
*/
188+
size?: 'large' | 'default' | 'small';
189+
190+
/**
191+
* The custom suffix icon
192+
* @type String | VNode | slot
193+
*/
194+
suffixIcon?: VNodeChild | JSX.Element;
195+
196+
/**
197+
* selected value
198+
* @type Array<string | number>
199+
*/
200+
value?: Array<string | number>;
201+
}
200202
/**
201203
* remove focus
202204
*/

0 commit comments

Comments
 (0)