MCPcopy Create free account
hub / github.com/react-component/select / triggerSelect

Function triggerSelect

src/Select.tsx:508–530  ·  view source on GitHub ↗
(val: RawValueType, selected: boolean, type?: DisplayInfoType)

Source from the content-addressed store, hash-verified

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) => {

Callers 4

Select.tsxFile · 0.85
onDisplayValuesChangeFunction · 0.85
onInternalSearchFunction · 0.85
onInternalSearchSplitFunction · 0.85

Calls 2

getSelectEntFunction · 0.85
onSelectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…