@@ -117,10 +117,12 @@ export interface SearchConfig<OptionType> {
117117 onSearch ?: ( value : string ) => void ;
118118 filterOption ?: boolean | FilterFunc < OptionType > ;
119119 filterSort ?: ( optionA : OptionType , optionB : OptionType , info : { searchValue : string } ) => number ;
120- optionFilterProp ?: string ;
120+ optionFilterProp ?: string | string [ ] ;
121121}
122- export interface SelectProps < ValueType = any , OptionType extends BaseOptionType = DefaultOptionType >
123- extends Omit < BaseSelectPropsWithoutPrivate , 'showSearch' > {
122+ export interface SelectProps <
123+ ValueType = any ,
124+ OptionType extends BaseOptionType = DefaultOptionType ,
125+ > extends Omit < BaseSelectPropsWithoutPrivate , 'showSearch' > {
124126 prefixCls ?: string ;
125127 id ?: string ;
126128
@@ -152,7 +154,7 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
152154 /** @deprecated please use showSearch.filterSort */
153155 filterSort ?: SearchConfig < OptionType > [ 'filterSort' ] ;
154156 /** @deprecated please use showSearch.optionFilterProp */
155- optionFilterProp ?: string ;
157+ optionFilterProp ?: string | string [ ] ;
156158 optionLabelProp ?: string ;
157159
158160 children ?: React . ReactNode ;
@@ -248,6 +250,11 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
248250 autoClearSearchValue = true ,
249251 } = searchConfig ;
250252
253+ const normalizedOptionFilterProp = React . useMemo ( ( ) => {
254+ if ( ! optionFilterProp ) return [ ] ;
255+ return Array . isArray ( optionFilterProp ) ? optionFilterProp : [ optionFilterProp ] ;
256+ } , [ optionFilterProp ] ) ;
257+
251258 const mergedId = useId ( id ) ;
252259 const multiple = isMultiple ( mode ) ;
253260 const childrenAsData = ! ! ( ! options && children ) ;
@@ -280,7 +287,7 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
280287 options ,
281288 children ,
282289 mergedFieldNames ,
283- optionFilterProp ,
290+ normalizedOptionFilterProp ,
284291 optionLabelProp ,
285292 ) ;
286293 const { valueOptions, labelOptions, options : mergedOptions } = parsedOptions ;
@@ -432,15 +439,21 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
432439 mergedFieldNames ,
433440 mergedSearchValue ,
434441 mergedFilterOption ,
435- optionFilterProp ,
442+ normalizedOptionFilterProp ,
436443 ) ;
437444
438445 // Fill options with search value if needed
439446 const filledSearchOptions = React . useMemo ( ( ) => {
447+ const hasItemMatchingSearch = ( item : DefaultOptionType ) => {
448+ if ( normalizedOptionFilterProp . length ) {
449+ return normalizedOptionFilterProp . some ( ( prop ) => item ?. [ prop ] === mergedSearchValue ) ;
450+ }
451+ return item ?. value === mergedSearchValue ;
452+ } ;
440453 if (
441454 mode !== 'tags' ||
442455 ! mergedSearchValue ||
443- filteredOptions . some ( ( item ) => item [ optionFilterProp || 'value' ] === mergedSearchValue )
456+ filteredOptions . some ( ( item ) => hasItemMatchingSearch ( item ) )
444457 ) {
445458 return filteredOptions ;
446459 }
@@ -452,7 +465,7 @@ const Select = React.forwardRef<BaseSelectRef, SelectProps<any, DefaultOptionTyp
452465 return [ createTagOption ( mergedSearchValue ) , ...filteredOptions ] ;
453466 } , [
454467 createTagOption ,
455- optionFilterProp ,
468+ normalizedOptionFilterProp ,
456469 mode ,
457470 filteredOptions ,
458471 mergedSearchValue ,
0 commit comments