@@ -110,11 +110,11 @@ type ArrayElementType<T> = T extends (infer E)[] ? E : T;
110
110
111
111
export type SemanticName = BaseSelectSemanticName ;
112
112
export type PopupSemantic = 'listItem' | 'list' ;
113
- interface ShowSearch < OptionType > {
113
+ interface SearchConfig < OptionType > {
114
114
searchValue ?: string ;
115
115
autoClearSearchValue ?: boolean ;
116
116
onSearch ?: ( value : string ) => void ;
117
- tokenSeparators ?: string | string [ ] ;
117
+ tokenSeparators ?: string [ ] ;
118
118
filterOption ?: boolean | FilterFunc < OptionType > ;
119
119
filterSort ?: ( optionA : OptionType , optionB : OptionType , info : { searchValue : string } ) => number ;
120
120
optionFilterProp ?: string ;
@@ -129,25 +129,33 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
129
129
130
130
// >>> Field Names
131
131
fieldNames ?: FieldNames ;
132
- showSearch ?: boolean | ShowSearch < OptionType > ;
133
- searchValue ?: string ;
134
- onSearch ?: ( value : string ) => void ;
132
+ showSearch ?: boolean | SearchConfig < OptionType > ;
133
+ /** @deprecated pleace use SearchConfig.searchValue */
134
+ searchValue ?: SearchConfig < OptionType > [ 'searchValue' ] ;
135
+ /** @deprecated pleace use SearchConfig.autoClearSearchValue */
135
136
autoClearSearchValue ?: boolean ;
136
-
137
- // >>> Select
138
- onSelect ?: SelectHandler < ArrayElementType < ValueType > , OptionType > ;
139
- onDeselect ?: SelectHandler < ArrayElementType < ValueType > , OptionType > ;
140
-
137
+ /** @deprecated pleace use SearchConfig.onSearch */
138
+ onSearch ?: SearchConfig < OptionType > [ 'onSearch' ] ;
139
+ /** @deprecated pleace use SearchConfig.tokenSeparators */
140
+ tokenSeparators ?: string [ ] ;
141
141
// >>> Options
142
142
/**
143
143
* In Select, `false` means do nothing.
144
144
* In TreeSelect, `false` will highlight match item.
145
145
* It's by design.
146
146
*/
147
- filterOption ?: boolean | FilterFunc < OptionType > ;
148
- filterSort ?: ( optionA : OptionType , optionB : OptionType , info : { searchValue : string } ) => number ;
147
+ /** @deprecated pleace use SearchConfig.filterOption */
148
+ filterOption ?: SearchConfig < OptionType > [ 'filterOption' ] ;
149
+ /** @deprecated pleace use SearchConfig.filterSort */
150
+ filterSort ?: SearchConfig < OptionType > [ 'filterSort' ] ;
151
+ /** @deprecated pleace use SearchConfig.optionFilterProp */
149
152
optionFilterProp ?: string ;
153
+ /** @deprecated pleace use SearchConfig.optionLabelProp */
150
154
optionLabelProp ?: string ;
155
+ // >>> Select
156
+ onSelect ?: SelectHandler < ArrayElementType < ValueType > , OptionType > ;
157
+ onDeselect ?: SelectHandler < ArrayElementType < ValueType > , OptionType > ;
158
+
151
159
children ?: React . ReactNode ;
152
160
options ?: OptionType [ ] ;
153
161
optionRender ?: (
@@ -224,7 +232,7 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
224
232
'autoClearSearchValue' ,
225
233
'tokenSeparators' ,
226
234
] ;
227
- const legacyShowSearch : ShowSearch < DefaultOptionType > = { } ;
235
+ const legacyShowSearch : SearchConfig < DefaultOptionType > = { } ;
228
236
legacySearchProps . forEach ( ( propsName ) => {
229
237
legacyShowSearch [ propsName ] = restProps ?. [ propsName ] ;
230
238
} ) ;
@@ -237,6 +245,7 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
237
245
filterSort,
238
246
onSearch,
239
247
autoClearSearchValue,
248
+ tokenSeparators,
240
249
} = mergedShowSearch ;
241
250
242
251
const mergedId = useId ( id ) ;
@@ -715,6 +724,7 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
715
724
onSearch = { onInternalSearch }
716
725
autoClearSearchValue = { autoClearSearchValue }
717
726
onSearchSplit = { onInternalSearchSplit }
727
+ tokenSeparators = { tokenSeparators }
718
728
popupMatchSelectWidth = { popupMatchSelectWidth }
719
729
// >>> OptionList
720
730
OptionList = { OptionList }
0 commit comments