@@ -209,7 +209,7 @@ export interface GenerateConfig<OptionsType extends object[]> {
209
209
| ( (
210
210
values : RawValueType [ ] ,
211
211
options : FlattenOptionsType < OptionsType > ,
212
- info ?: { prevValueOptions ?: OptionsType [ ] } ,
212
+ info ?: { prevValueOptions ?: OptionsType [ ] ; props ?: any } ,
213
213
) => OptionsType ) ;
214
214
/** Check if a value is disabled */
215
215
isValueDisabled : ( value : RawValueType , options : FlattenOptionsType < OptionsType > ) => boolean ;
@@ -233,7 +233,7 @@ export default function generateSelector<
233
233
label ?: React . ReactNode ;
234
234
key ?: Key ;
235
235
disabled ?: boolean ;
236
- } [ ]
236
+ } [ ] ,
237
237
> ( config : GenerateConfig < OptionsType > ) {
238
238
const {
239
239
prefixCls : defaultPrefixCls ,
@@ -527,18 +527,20 @@ export default function generateSelector<
527
527
528
528
const triggerSelect = ( newValue : RawValueType , isSelect : boolean , source : SelectSource ) => {
529
529
const newValueOption = getValueOption ( [ newValue ] ) ;
530
- const outOption = findValueOption ( [ newValue ] , newValueOption ) [ 0 ] ;
530
+ const outOption = findValueOption ( [ newValue ] , newValueOption , { props } ) [ 0 ] ;
531
531
532
532
if ( ! internalProps . skipTriggerSelect ) {
533
533
// Skip trigger `onSelect` or `onDeselect` if configured
534
- const selectValue = ( mergedLabelInValue
535
- ? getLabeledValue ( newValue , {
536
- options : newValueOption ,
537
- prevValueMap : mergedValueMap ,
538
- labelInValue : mergedLabelInValue ,
539
- optionLabelProp : mergedOptionLabelProp ,
540
- } )
541
- : newValue ) as SingleType < ValueType > ;
534
+ const selectValue = (
535
+ mergedLabelInValue
536
+ ? getLabeledValue ( newValue , {
537
+ options : newValueOption ,
538
+ prevValueMap : mergedValueMap ,
539
+ labelInValue : mergedLabelInValue ,
540
+ optionLabelProp : mergedOptionLabelProp ,
541
+ } )
542
+ : newValue
543
+ ) as SingleType < ValueType > ;
542
544
543
545
if ( isSelect && onSelect ) {
544
546
onSelect ( selectValue , outOption ) ;
@@ -576,7 +578,10 @@ export default function generateSelector<
576
578
const outValue : ValueType = ( isMultiple ? outValues : outValues [ 0 ] ) as ValueType ;
577
579
// Skip trigger if prev & current value is both empty
578
580
if ( onChange && ( mergedRawValue . length !== 0 || outValues . length !== 0 ) ) {
579
- const outOptions = findValueOption ( newRawValues , newRawValuesOptions , { prevValueOptions } ) ;
581
+ const outOptions = findValueOption ( newRawValues , newRawValuesOptions , {
582
+ prevValueOptions,
583
+ props,
584
+ } ) ;
580
585
581
586
// We will cache option in case it removed by ajax
582
587
setPrevValueOptions (
@@ -756,9 +761,7 @@ export default function generateSelector<
756
761
if ( ! searchText || ! searchText . trim ( ) ) {
757
762
return ;
758
763
}
759
- const newRawValues = Array . from (
760
- new Set < RawValueType > ( [ ...mergedRawValue , searchText ] ) ,
761
- ) ;
764
+ const newRawValues = Array . from ( new Set < RawValueType > ( [ ...mergedRawValue , searchText ] ) ) ;
762
765
triggerChange ( newRawValues ) ;
763
766
newRawValues . forEach ( ( newRawValue ) => {
764
767
triggerSelect ( newRawValue , true , 'input' ) ;
@@ -1148,7 +1151,7 @@ export default function generateSelector<
1148
1151
1149
1152
// Ref of Select
1150
1153
type RefSelectFuncType = typeof RefSelectFunc ;
1151
- const RefSelect = ( ( React . forwardRef as unknown ) as RefSelectFuncType ) ( Select ) ;
1154
+ const RefSelect = ( React . forwardRef as unknown as RefSelectFuncType ) ( Select ) ;
1152
1155
1153
1156
return RefSelect ;
1154
1157
}
0 commit comments