@@ -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 ;
@@ -129,8 +129,8 @@ export type ValueType<
129
129
ValueField extends keyof OptionType = keyof OptionType ,
130
130
> = keyof OptionType extends ValueField
131
131
? unknown extends OptionType [ 'value' ]
132
- ? OptionType [ ValueField ]
133
- : OptionType [ 'value' ]
132
+ ? OptionType [ ValueField ]
133
+ : OptionType [ 'value' ]
134
134
: OptionType [ ValueField ] ;
135
135
136
136
export type GetValueType <
@@ -146,11 +146,19 @@ export type GetOptionType<
146
146
Multiple extends boolean | React . ReactNode = false ,
147
147
> = false extends Multiple ? OptionType [ ] : OptionType [ ] [ ] ;
148
148
149
+ type SemanticName = 'input' | 'prefix' | 'suffix' ;
150
+ type PopupSemantic = 'list' | 'listItem' ;
149
151
export interface CascaderProps <
150
152
OptionType extends DefaultOptionType = DefaultOptionType ,
151
153
ValueField extends keyof OptionType = keyof OptionType ,
152
154
Multiple extends boolean | React . ReactNode = false ,
153
155
> extends BaseCascaderProps < OptionType , ValueField > {
156
+ styles ?: Partial < Record < SemanticName , React . CSSProperties > > & {
157
+ popup ?: Partial < Record < PopupSemantic , React . CSSProperties > > ;
158
+ } ;
159
+ classNames ?: Partial < Record < SemanticName , string > > & {
160
+ popup ?: Partial < Record < PopupSemantic , string > > ;
161
+ } ;
154
162
checkable ?: Multiple ;
155
163
value ?: GetValueType < OptionType , ValueField , Multiple > ;
156
164
defaultValue ?: GetValueType < OptionType , ValueField , Multiple > ;
@@ -216,6 +224,9 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
216
224
popupMenuColumnStyle,
217
225
popupStyle : customPopupStyle ,
218
226
227
+ classNames,
228
+ styles,
229
+
219
230
placement,
220
231
221
232
onPopupVisibleChange,
@@ -372,7 +383,6 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
372
383
onPopupVisibleChange ?.( nextVisible ) ;
373
384
} ;
374
385
375
-
376
386
// ========================== Warning ===========================
377
387
if ( process . env . NODE_ENV !== 'production' ) {
378
388
warningNullOptions ( mergedOptions , mergedFieldNames ) ;
@@ -381,6 +391,8 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
381
391
// ========================== Context ===========================
382
392
const cascaderContext = React . useMemo (
383
393
( ) => ( {
394
+ classNames,
395
+ styles,
384
396
options : mergedOptions ,
385
397
fieldNames : mergedFieldNames ,
386
398
values : checkedValues ,
@@ -424,12 +436,12 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
424
436
const popupStyle : React . CSSProperties =
425
437
// Search to match width
426
438
( mergedSearchValue && searchConfig . matchInputWidth ) ||
427
- // Empty keep the width
428
- emptyOptions
439
+ // Empty keep the width
440
+ emptyOptions
429
441
? { }
430
442
: {
431
- minWidth : 'auto' ,
432
- } ;
443
+ minWidth : 'auto' ,
444
+ } ;
433
445
434
446
return (
435
447
< CascaderContext . Provider value = { cascaderContext } >
@@ -441,6 +453,16 @@ const Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, re
441
453
prefixCls = { prefixCls }
442
454
autoClearSearchValue = { autoClearSearchValue }
443
455
popupMatchSelectWidth = { popupMatchSelectWidth }
456
+ classNames = { {
457
+ prefix : classNames ?. prefix ,
458
+ suffix : classNames ?. suffix ,
459
+ input : classNames ?. input ,
460
+ } }
461
+ styles = { {
462
+ prefix : styles ?. prefix ,
463
+ suffix : styles ?. suffix ,
464
+ input : styles ?. input ,
465
+ } }
444
466
popupStyle = { {
445
467
...popupStyle ,
446
468
...customPopupStyle ,
0 commit comments