(val: RawValueType, selected: boolean, type?: DisplayInfoType)
| 506 | |
| 507 | // ========================= OptionList ========================= |
| 508 | const triggerSelect = (val: RawValueType, selected: boolean, type?: DisplayInfoType) => { |
| 509 | const getSelectEnt = (): [RawValueType | LabelInValueType, DefaultOptionType] => { |
| 510 | const option = getMixedOption(val); |
| 511 | return [ |
| 512 | labelInValue |
| 513 | ? { |
| 514 | label: option?.[mergedFieldNames.label], |
| 515 | value: val, |
| 516 | key: option?.key ?? val, |
| 517 | } |
| 518 | : val, |
| 519 | injectPropsWithOption(option), |
| 520 | ]; |
| 521 | }; |
| 522 | |
| 523 | if (selected && onSelect) { |
| 524 | const [wrappedValue, option] = getSelectEnt(); |
| 525 | onSelect(wrappedValue, option); |
| 526 | } else if (!selected && onDeselect && type !== 'clear') { |
| 527 | const [wrappedValue, option] = getSelectEnt(); |
| 528 | onDeselect(wrappedValue, option); |
| 529 | } |
| 530 | }; |
| 531 | |
| 532 | // Used for OptionList selection |
| 533 | const onInternalSelect = useRefFunc<OnInternalSelect>((val, info) => { |
no test coverage detected
searching dependent graphs…