@@ -28,7 +28,7 @@ import {
28
28
toRawValues ,
29
29
} from './utils/commonUtil' ;
30
30
import { formatStrategyValues , toPathOptions } from './utils/treeUtil' ;
31
- import warningProps , { warningNullOptions } from './utils/warningPropsUtil' ;
31
+ import { warningNullOptions } from './utils/warningPropsUtil' ;
32
32
33
33
export interface BaseOptionType {
34
34
disabled ?: boolean ;
@@ -71,9 +71,9 @@ interface BaseCascaderProps<
71
71
OptionType extends DefaultOptionType = DefaultOptionType ,
72
72
ValueField extends keyof OptionType = keyof OptionType ,
73
73
> extends Omit <
74
- BaseSelectPropsWithoutPrivate ,
75
- 'tokenSeparators' | 'labelInValue' | 'mode' | 'showSearch'
76
- > {
74
+ BaseSelectPropsWithoutPrivate ,
75
+ 'tokenSeparators' | 'labelInValue' | 'mode' | 'showSearch'
76
+ > {
77
77
// MISC
78
78
id ?: string ;
79
79
prefixCls ?: string ;
@@ -99,18 +99,12 @@ interface BaseCascaderProps<
99
99
// Options
100
100
options ?: OptionType [ ] ;
101
101
/** @private Internal usage. Do not use in your production. */
102
- dropdownPrefixCls ?: string ;
102
+ popupPrefixCls ?: string ;
103
103
loadData ?: ( selectOptions : OptionType [ ] ) => void ;
104
104
105
- // Open
106
- /** @deprecated Use `open` instead */
107
- popupVisible ?: boolean ;
108
-
109
105
popupClassName ?: string ;
110
- dropdownMenuColumnStyle ?: React . CSSProperties ;
106
+ popupMenuColumnStyle ?: React . CSSProperties ;
111
107
112
- /** @deprecated Use `placement` instead */
113
- popupPlacement ?: Placement ;
114
108
placement ?: Placement ;
115
109
builtinPlacements ?: BuildInPlacements ;
116
110
@@ -135,8 +129,8 @@ export type ValueType<
135
129
ValueField extends keyof OptionType = keyof OptionType ,
136
130
> = keyof OptionType extends ValueField
137
131
? unknown extends OptionType [ 'value' ]
138
- ? OptionType [ ValueField ]
139
- : OptionType [ 'value' ]
132
+ ? OptionType [ ValueField ]
133
+ : OptionType [ 'value' ]
140
134
: OptionType [ ValueField ] ;
141
135
142
136
export type GetValueType <
@@ -167,6 +161,9 @@ export interface CascaderProps<
167
161
}
168
162
169
163
export type SingleValueType = ( string | number ) [ ] ;
164
+
165
+ export type LegacyKey = string | number ;
166
+
170
167
export type InternalValueType = SingleValueType | SingleValueType [ ] ;
171
168
172
169
export interface InternalFieldNames extends Required < FieldNames > {
@@ -210,18 +207,15 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
210
207
211
208
// Options
212
209
options,
213
- dropdownPrefixCls ,
210
+ popupPrefixCls ,
214
211
loadData,
215
212
216
- // Open
217
- popupVisible,
218
213
open,
219
214
220
215
popupClassName,
221
- dropdownMenuColumnStyle ,
216
+ popupMenuColumnStyle ,
222
217
popupStyle : customPopupStyle ,
223
218
224
- popupPlacement,
225
219
placement,
226
220
227
221
onPopupVisibleChange,
@@ -281,7 +275,7 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
281
275
mergedSearchValue ,
282
276
mergedOptions ,
283
277
mergedFieldNames ,
284
- dropdownPrefixCls || prefixCls ,
278
+ popupPrefixCls || prefixCls ,
285
279
searchConfig ,
286
280
changeOnSelect || multiple ,
287
281
) ;
@@ -374,18 +368,13 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
374
368
onInternalSelect ( valueCells ) ;
375
369
} ;
376
370
377
- // ============================ Open ============================
378
- const mergedOpen = open !== undefined ? open : popupVisible ;
379
-
380
- const mergedPlacement = placement || popupPlacement ;
381
-
382
371
const onInternalPopupVisibleChange = ( nextVisible : boolean ) => {
383
372
onPopupVisibleChange ?.( nextVisible ) ;
384
373
} ;
385
374
375
+
386
376
// ========================== Warning ===========================
387
377
if ( process . env . NODE_ENV !== 'production' ) {
388
- warningProps ( props ) ;
389
378
warningNullOptions ( mergedOptions , mergedFieldNames ) ;
390
379
}
391
380
@@ -400,12 +389,12 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
400
389
onSelect : onInternalSelect ,
401
390
checkable,
402
391
searchOptions,
403
- dropdownPrefixCls ,
392
+ popupPrefixCls ,
404
393
loadData,
405
394
expandTrigger,
406
395
expandIcon,
407
396
loadingIcon,
408
- dropdownMenuColumnStyle ,
397
+ popupMenuColumnStyle ,
409
398
optionRender,
410
399
} ) ,
411
400
[
@@ -417,12 +406,12 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
417
406
onInternalSelect ,
418
407
checkable ,
419
408
searchOptions ,
420
- dropdownPrefixCls ,
409
+ popupPrefixCls ,
421
410
loadData ,
422
411
expandTrigger ,
423
412
expandIcon ,
424
413
loadingIcon ,
425
- dropdownMenuColumnStyle ,
414
+ popupMenuColumnStyle ,
426
415
optionRender ,
427
416
] ,
428
417
) ;
@@ -435,12 +424,12 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
435
424
const popupStyle : React . CSSProperties =
436
425
// Search to match width
437
426
( mergedSearchValue && searchConfig . matchInputWidth ) ||
438
- // Empty keep the width
439
- emptyOptions
427
+ // Empty keep the width
428
+ emptyOptions
440
429
? { }
441
430
: {
442
- minWidth : 'auto' ,
443
- } ;
431
+ minWidth : 'auto' ,
432
+ } ;
444
433
445
434
return (
446
435
< CascaderContext . Provider value = { cascaderContext } >
@@ -468,9 +457,9 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
468
457
OptionList = { OptionList }
469
458
emptyOptions = { emptyOptions }
470
459
// Open
471
- open = { mergedOpen }
460
+ open = { open }
472
461
popupClassName = { popupClassName }
473
- placement = { mergedPlacement }
462
+ placement = { placement }
474
463
onPopupVisibleChange = { onInternalPopupVisibleChange }
475
464
// Children
476
465
getRawInputElement = { ( ) => children as React . ReactElement }
0 commit comments