@true-engineering/true-react-common-ui-kit 3.24.0 → 3.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/components/Select/CustomSelect.stories.d.ts +1 -1
- package/dist/components/Select/MultiSelect.stories.d.ts +2 -2
- package/dist/components/Select/Select.d.ts +14 -9
- package/dist/components/Select/Select.styles.d.ts +5 -5
- package/dist/components/Select/components/SelectList/SelectList.d.ts +7 -6
- package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
- package/dist/components/Select/components/SelectListItem/SelectListItem.d.ts +4 -3
- package/dist/components/Select/helpers.d.ts +0 -3
- package/dist/true-react-common-ui-kit.js +140 -114
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +139 -113
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +2 -2
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +21 -38
- package/src/components/Select/CustomSelect.stories.tsx +52 -16
- package/src/components/Select/MultiSelect.stories.tsx +3 -3
- package/src/components/Select/Select.styles.ts +8 -7
- package/src/components/Select/Select.tsx +106 -62
- package/src/components/Select/components/SelectList/SelectList.styles.ts +6 -4
- package/src/components/Select/components/SelectList/SelectList.tsx +25 -29
- package/src/components/Select/components/SelectListItem/SelectListItem.tsx +23 -19
- package/src/components/Select/helpers.ts +0 -7
- package/src/components/TextWithTooltip/TextWithTooltip.tsx +2 -3
|
@@ -10607,15 +10607,11 @@
|
|
|
10607
10607
|
withListHeader: {
|
|
10608
10608
|
paddingTop: 0
|
|
10609
10609
|
},
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
borderTop: [
|
|
10613
|
-
1,
|
|
10614
|
-
"solid",
|
|
10615
|
-
colors.BORDER_LIGHT
|
|
10616
|
-
]
|
|
10617
|
-
}
|
|
10610
|
+
withListFooter: {
|
|
10611
|
+
paddingBottom: 0
|
|
10618
10612
|
},
|
|
10613
|
+
listHeader: {},
|
|
10614
|
+
listFooter: {},
|
|
10619
10615
|
list: _object_spread$K({
|
|
10620
10616
|
height: "100%",
|
|
10621
10617
|
maxHeight: ROW_HEIGHT$1 * 6,
|
|
@@ -10712,8 +10708,18 @@
|
|
|
10712
10708
|
return target;
|
|
10713
10709
|
}
|
|
10714
10710
|
var SelectListItem = function(param) {
|
|
10715
|
-
var classes = param.classes, index = param.index, isSemiChecked = param.isSemiChecked, isDisabled = param.isDisabled, isActive = param.isActive, children = param.children, isFocused = param.isFocused, onOptionSelect = param.onOptionSelect, onToggleCheckbox = param.onToggleCheckbox;
|
|
10716
|
-
var
|
|
10711
|
+
var classes = param.classes, index = param.index, isSemiChecked = param.isSemiChecked, isDisabled = param.isDisabled, isActive = param.isActive, children = param.children, isFocused = param.isFocused, isMultiSelect = param.isMultiSelect, onOptionSelect = param.onOptionSelect, onToggleCheckbox = param.onToggleCheckbox;
|
|
10712
|
+
var multiSelectContent = isMultiSelect && /* @__PURE__ */ jsx(Checkbox, {
|
|
10713
|
+
isChecked: isActive || isSemiChecked,
|
|
10714
|
+
isSemiChecked,
|
|
10715
|
+
isDisabled,
|
|
10716
|
+
tweakStyles: checkboxStyles$1,
|
|
10717
|
+
onSelect: function(param2, event) {
|
|
10718
|
+
var isSelected = param2.isSelected;
|
|
10719
|
+
return onToggleCheckbox(index, isSelected, event);
|
|
10720
|
+
},
|
|
10721
|
+
children
|
|
10722
|
+
});
|
|
10717
10723
|
var _obj2;
|
|
10718
10724
|
return /* @__PURE__ */ jsx(ScrollIntoViewIfNeeded, _object_spread_props$E(_object_spread$J({
|
|
10719
10725
|
active: isFocused,
|
|
@@ -10729,17 +10735,7 @@
|
|
|
10729
10735
|
onClick: !isDisabled && !isMultiSelect ? function(event) {
|
|
10730
10736
|
return onOptionSelect(index, event);
|
|
10731
10737
|
} : void 0,
|
|
10732
|
-
children: isMultiSelect ?
|
|
10733
|
-
value: index,
|
|
10734
|
-
isChecked: isActive || isSemiChecked,
|
|
10735
|
-
isSemiChecked,
|
|
10736
|
-
isDisabled,
|
|
10737
|
-
tweakStyles: checkboxStyles$1,
|
|
10738
|
-
onSelect: function(v, event) {
|
|
10739
|
-
return onToggleCheckbox(index, v.isSelected, event);
|
|
10740
|
-
},
|
|
10741
|
-
children
|
|
10742
|
-
}) : children
|
|
10738
|
+
children: isMultiSelect ? multiSelectContent : children
|
|
10743
10739
|
}));
|
|
10744
10740
|
};
|
|
10745
10741
|
function _define_property$K(obj, key, value) {
|
|
@@ -10795,47 +10791,39 @@
|
|
|
10795
10791
|
return target;
|
|
10796
10792
|
}
|
|
10797
10793
|
function SelectList(param) {
|
|
10798
|
-
var options = param.options, focusedIndex = param.focusedIndex, activeValue = param.activeValue, defaultOptionLabel = param.defaultOptionLabel, _param_noMatchesLabel = param.noMatchesLabel, noMatchesLabel = _param_noMatchesLabel === void 0 ? "Совпадений не найдено" : _param_noMatchesLabel, isLoading = param.isLoading, _param_loadingLabel = param.loadingLabel, loadingLabel = _param_loadingLabel === void 0 ? "Загрузка..." : _param_loadingLabel, tweakStyles = param.tweakStyles, testId = param.testId, _param_shouldScrollToList = param.shouldScrollToList, shouldScrollToList = _param_shouldScrollToList === void 0 ? true : _param_shouldScrollToList, areAllOptionsSelected = param.areAllOptionsSelected, customListHeader = param.customListHeader, isOptionDisabled = param.isOptionDisabled, allOptionsLabel = param.allOptionsLabel, onOptionSelect = param.onOptionSelect, onToggleCheckbox = param.onToggleCheckbox, convertValueToString = param.convertValueToString, _param_convertValueToReactNode = param.convertValueToReactNode, convertValueToReactNode = _param_convertValueToReactNode === void 0 ? convertValueToString : _param_convertValueToReactNode, convertValueToId = param.convertValueToId;
|
|
10794
|
+
var options = param.options, focusedIndex = param.focusedIndex, activeValue = param.activeValue, defaultOptionLabel = param.defaultOptionLabel, _param_noMatchesLabel = param.noMatchesLabel, noMatchesLabel = _param_noMatchesLabel === void 0 ? "Совпадений не найдено" : _param_noMatchesLabel, isLoading = param.isLoading, _param_loadingLabel = param.loadingLabel, loadingLabel = _param_loadingLabel === void 0 ? "Загрузка..." : _param_loadingLabel, tweakStyles = param.tweakStyles, testId = param.testId, _param_shouldScrollToList = param.shouldScrollToList, shouldScrollToList = _param_shouldScrollToList === void 0 ? true : _param_shouldScrollToList, areAllOptionsSelected = param.areAllOptionsSelected, customListHeader = param.customListHeader, customListFooter = param.customListFooter, isMultiSelect = param.isMultiSelect, isOptionDisabled = param.isOptionDisabled, allOptionsLabel = param.allOptionsLabel, onOptionSelect = param.onOptionSelect, onToggleCheckbox = param.onToggleCheckbox, convertValueToString = param.convertValueToString, _param_convertValueToReactNode = param.convertValueToReactNode, convertValueToReactNode = _param_convertValueToReactNode === void 0 ? convertValueToString : _param_convertValueToReactNode, convertValueToId = param.convertValueToId;
|
|
10799
10795
|
var classes = useStyles$F({
|
|
10800
10796
|
theme: tweakStyles
|
|
10801
10797
|
});
|
|
10802
|
-
var
|
|
10803
|
-
var
|
|
10804
|
-
var _multiSelectValue_length;
|
|
10805
|
-
var selectedOptionsCount = (_multiSelectValue_length = multiSelectValue === null || multiSelectValue === void 0 ? void 0 : multiSelectValue.length) !== null && _multiSelectValue_length !== void 0 ? _multiSelectValue_length : 0;
|
|
10806
|
-
var activeOptionsIdMap = React.useMemo(function() {
|
|
10807
|
-
var _multiSelectValue_map;
|
|
10808
|
-
return isMultiSelect ? (_multiSelectValue_map = multiSelectValue === null || multiSelectValue === void 0 ? void 0 : multiSelectValue.map(convertValueToId)) !== null && _multiSelectValue_map !== void 0 ? _multiSelectValue_map : [] : [];
|
|
10809
|
-
}, [
|
|
10810
|
-
isMultiSelect,
|
|
10811
|
-
multiSelectValue,
|
|
10812
|
-
convertValueToId
|
|
10813
|
-
]);
|
|
10798
|
+
var isHeaderNotEmpty = trueReactPlatformHelpers.isReactNodeNotEmpty(customListHeader);
|
|
10799
|
+
var isFooterNotEmpty = trueReactPlatformHelpers.isReactNodeNotEmpty(customListFooter);
|
|
10814
10800
|
var optionsDisableMap = React.useMemo(function() {
|
|
10815
|
-
return options.map(
|
|
10816
|
-
return isOptionDisabled(o);
|
|
10817
|
-
});
|
|
10801
|
+
return options.map(isOptionDisabled);
|
|
10818
10802
|
}, [
|
|
10819
10803
|
options,
|
|
10820
10804
|
isOptionDisabled
|
|
10821
10805
|
]);
|
|
10822
10806
|
var listOptions = React.useMemo(function() {
|
|
10823
|
-
return options.map(function(
|
|
10824
|
-
return convertValueToReactNode(
|
|
10807
|
+
return options.map(function(option, index) {
|
|
10808
|
+
return convertValueToReactNode(option, optionsDisableMap[index]);
|
|
10825
10809
|
});
|
|
10826
10810
|
}, [
|
|
10827
10811
|
options,
|
|
10828
10812
|
convertValueToReactNode,
|
|
10829
10813
|
optionsDisableMap
|
|
10830
10814
|
]);
|
|
10831
|
-
var
|
|
10832
|
-
return
|
|
10833
|
-
}
|
|
10815
|
+
var activeOptionsIds = React.useMemo(function() {
|
|
10816
|
+
return new Set(trueReactPlatformHelpers.getArray(activeValue).map(convertValueToId));
|
|
10817
|
+
}, [
|
|
10818
|
+
activeValue,
|
|
10819
|
+
convertValueToId
|
|
10820
|
+
]);
|
|
10821
|
+
var _obj2;
|
|
10834
10822
|
return /* @__PURE__ */ jsxs(ScrollIntoViewIfNeeded, {
|
|
10835
10823
|
active: shouldScrollToList && !isMultiSelect,
|
|
10836
|
-
className: clsx(classes.root, _define_property$K(
|
|
10824
|
+
className: clsx(classes.root, (_obj2 = {}, _define_property$K(_obj2, classes.withListHeader, isHeaderNotEmpty), _define_property$K(_obj2, classes.withListFooter, isFooterNotEmpty), _obj2)),
|
|
10837
10825
|
children: [
|
|
10838
|
-
|
|
10826
|
+
isHeaderNotEmpty && /* @__PURE__ */ jsx("div", {
|
|
10839
10827
|
className: classes.listHeader,
|
|
10840
10828
|
children: customListHeader
|
|
10841
10829
|
}),
|
|
@@ -10861,9 +10849,10 @@
|
|
|
10861
10849
|
trueReactPlatformHelpers.isReactNodeNotEmpty(allOptionsLabel) && /* @__PURE__ */ jsx(SelectListItem, {
|
|
10862
10850
|
classes,
|
|
10863
10851
|
index: ALL_OPTION_INDEX,
|
|
10864
|
-
isSemiChecked:
|
|
10852
|
+
isSemiChecked: activeOptionsIds.size > 0 && !areAllOptionsSelected,
|
|
10865
10853
|
isActive: areAllOptionsSelected,
|
|
10866
10854
|
isFocused: focusedIndex === ALL_OPTION_INDEX,
|
|
10855
|
+
isMultiSelect,
|
|
10867
10856
|
onOptionSelect,
|
|
10868
10857
|
onToggleCheckbox,
|
|
10869
10858
|
children: allOptionsLabel
|
|
@@ -10871,7 +10860,7 @@
|
|
|
10871
10860
|
listOptions.map(function(opt, i) {
|
|
10872
10861
|
var optionValue = options[i];
|
|
10873
10862
|
var isFocused = focusedIndex === i;
|
|
10874
|
-
var isActive =
|
|
10863
|
+
var isActive = activeOptionsIds.has(convertValueToId(optionValue));
|
|
10875
10864
|
var isDisabled = optionsDisableMap[i];
|
|
10876
10865
|
return /* @__PURE__ */ jsx(SelectListItem, {
|
|
10877
10866
|
classes,
|
|
@@ -10879,6 +10868,7 @@
|
|
|
10879
10868
|
isDisabled,
|
|
10880
10869
|
isActive,
|
|
10881
10870
|
isFocused,
|
|
10871
|
+
isMultiSelect,
|
|
10882
10872
|
onOptionSelect,
|
|
10883
10873
|
onToggleCheckbox,
|
|
10884
10874
|
children: opt
|
|
@@ -10890,7 +10880,11 @@
|
|
|
10890
10880
|
})
|
|
10891
10881
|
]
|
|
10892
10882
|
})
|
|
10893
|
-
}))
|
|
10883
|
+
})),
|
|
10884
|
+
isFooterNotEmpty && /* @__PURE__ */ jsx("div", {
|
|
10885
|
+
className: classes.listFooter,
|
|
10886
|
+
children: customListFooter
|
|
10887
|
+
})
|
|
10894
10888
|
]
|
|
10895
10889
|
});
|
|
10896
10890
|
}
|
|
@@ -10909,9 +10903,6 @@
|
|
|
10909
10903
|
return trueReactPlatformHelpers.isNotEmpty(value === null || value === void 0 ? void 0 : value.id) ? String(value.id) : convertValueToString(value);
|
|
10910
10904
|
};
|
|
10911
10905
|
};
|
|
10912
|
-
var isMultiSelectValue = function(props, _value) {
|
|
10913
|
-
return props.isMultiSelect === true;
|
|
10914
|
-
};
|
|
10915
10906
|
var useStyles$E = createThemedStyles("Select", {
|
|
10916
10907
|
root: {
|
|
10917
10908
|
width: "100%",
|
|
@@ -10931,7 +10922,7 @@
|
|
|
10931
10922
|
},
|
|
10932
10923
|
withoutPopper: {
|
|
10933
10924
|
position: "absolute",
|
|
10934
|
-
top: "calc(100% + 6px)"
|
|
10925
|
+
top: "calc(var(--dropdown-offset, 100%) + 6px)"
|
|
10935
10926
|
},
|
|
10936
10927
|
listWrapperInBody: {
|
|
10937
10928
|
minWidth: "auto",
|
|
@@ -10946,7 +10937,8 @@
|
|
|
10946
10937
|
height: 20,
|
|
10947
10938
|
cursor: "pointer",
|
|
10948
10939
|
zIndex: 1,
|
|
10949
|
-
transition:
|
|
10940
|
+
transition: animations.defaultTransition,
|
|
10941
|
+
transitionProperty: "transform"
|
|
10950
10942
|
},
|
|
10951
10943
|
activeArrow: {
|
|
10952
10944
|
transform: "rotate(180deg)"
|
|
@@ -11305,9 +11297,13 @@
|
|
|
11305
11297
|
}
|
|
11306
11298
|
}
|
|
11307
11299
|
function Select(props) {
|
|
11308
|
-
var
|
|
11300
|
+
var _input_current;
|
|
11301
|
+
var options = props.options, isMultiSelect = props.isMultiSelect, value = props.value, header = props.header, footer = props.footer, defaultOptionLabel = props.defaultOptionLabel, allOptionsLabel = props.allOptionsLabel, _props_debounceTime = props.debounceTime, debounceTime = _props_debounceTime === void 0 ? 400 : _props_debounceTime, _props_optionsMode = props.optionsMode, optionsMode = _props_optionsMode === void 0 ? "normal" : _props_optionsMode, noMatchesLabel = props.noMatchesLabel, loadingLabel = props.loadingLabel, tweakStyles = props.tweakStyles, testId = props.testId, isReadonly = props.isReadonly, isDisabled = props.isDisabled, dropdownOptions = props.dropdownOptions, _props_minSymbolsCountToOpenList = props.minSymbolsCountToOpenList, minSymbolsCountToOpenList = _props_minSymbolsCountToOpenList === void 0 ? 0 : _props_minSymbolsCountToOpenList, _props_dropdownIcon = props.dropdownIcon, dropdownIcon = _props_dropdownIcon === void 0 ? "chevron-down" : _props_dropdownIcon, _props_shouldScrollToList = props.shouldScrollToList, shouldScrollToList = _props_shouldScrollToList === void 0 ? true : _props_shouldScrollToList, searchInput = props.searchInput, iconType = props.iconType, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onType = props.onType, onOpen = props.onOpen, _props_isOptionDisabled = props.isOptionDisabled, isOptionDisabled = _props_isOptionDisabled === void 0 ? defaultIsOptionDisabled : _props_isOptionDisabled, _props_compareValuesOnChange = props.compareValuesOnChange, compareValuesOnChange = _props_compareValuesOnChange === void 0 ? defaultCompareFunction : _props_compareValuesOnChange, _props_convertValueToString = props.convertValueToString, convertValueToString = _props_convertValueToString === void 0 ? defaultConvertFunction$2 : _props_convertValueToString, convertValueToId = props.convertValueToId, convertValueToReactNode = props.convertValueToReactNode, optionsFilter = props.optionsFilter, inputProps = _object_without_properties$b(props, [
|
|
11309
11302
|
"options",
|
|
11303
|
+
"isMultiSelect",
|
|
11310
11304
|
"value",
|
|
11305
|
+
"header",
|
|
11306
|
+
"footer",
|
|
11311
11307
|
"defaultOptionLabel",
|
|
11312
11308
|
"allOptionsLabel",
|
|
11313
11309
|
"debounceTime",
|
|
@@ -11343,7 +11339,6 @@
|
|
|
11343
11339
|
"shouldRenderInList"
|
|
11344
11340
|
]);
|
|
11345
11341
|
var hasSearchInputInList = optionsMode !== "normal" && shouldRenderSearchInputInList;
|
|
11346
|
-
var isMultiSelect = isMultiSelectValue(props);
|
|
11347
11342
|
var hasReadonlyInput = isReadonly || optionsMode === "normal" || shouldRenderSearchInputInList;
|
|
11348
11343
|
var tweakInputStyles = useTweakStyles({
|
|
11349
11344
|
innerStyles: getInputStyles({
|
|
@@ -11372,6 +11367,7 @@
|
|
|
11372
11367
|
var _useState2 = _sliced_to_array$k(React.useState(DEFAULT_OPTION_INDEX), 2), focusedListCellIndex = _useState2[0], setFocusedListCellIndex = _useState2[1];
|
|
11373
11368
|
var _useState3 = _sliced_to_array$k(React.useState(""), 2), searchValue = _useState3[0], setSearchValue = _useState3[1];
|
|
11374
11369
|
var _useState4 = _sliced_to_array$k(React.useState(true), 2), shouldShowDefaultOption = _useState4[0], setShouldShowDefaultOption = _useState4[1];
|
|
11370
|
+
var root2 = React.useRef(null);
|
|
11375
11371
|
var inputWrapper = React.useRef(null);
|
|
11376
11372
|
var list = React.useRef(null);
|
|
11377
11373
|
var input = React.useRef(null);
|
|
@@ -11396,8 +11392,8 @@
|
|
|
11396
11392
|
optionsMode
|
|
11397
11393
|
]);
|
|
11398
11394
|
var availableOptions = React.useMemo(function() {
|
|
11399
|
-
return options.filter(function(
|
|
11400
|
-
return !isOptionDisabled(
|
|
11395
|
+
return options.filter(function(option) {
|
|
11396
|
+
return !isOptionDisabled(option);
|
|
11401
11397
|
});
|
|
11402
11398
|
}, [
|
|
11403
11399
|
options,
|
|
@@ -11434,17 +11430,39 @@
|
|
|
11434
11430
|
convertValueToId,
|
|
11435
11431
|
convertValueToString
|
|
11436
11432
|
]);
|
|
11437
|
-
var
|
|
11433
|
+
var getDropdownOffset = function() {
|
|
11434
|
+
var _input_current_parentElement2;
|
|
11435
|
+
if (trueReactPlatformHelpers.isEmpty(input.current) || inputProps.errorPosition === "top") {
|
|
11436
|
+
return 0;
|
|
11437
|
+
}
|
|
11438
|
+
var _input_current_parentElement_offsetHeight;
|
|
11439
|
+
return (_input_current_parentElement_offsetHeight = (_input_current_parentElement2 = input.current.parentElement) === null || _input_current_parentElement2 === void 0 ? void 0 : _input_current_parentElement2.offsetHeight) !== null && _input_current_parentElement_offsetHeight !== void 0 ? _input_current_parentElement_offsetHeight : 0;
|
|
11440
|
+
};
|
|
11441
|
+
var closeList = React.useCallback(function() {
|
|
11438
11442
|
setIsListOpen(false);
|
|
11439
11443
|
setSearchValue("");
|
|
11440
11444
|
setShouldShowDefaultOption(true);
|
|
11445
|
+
if (!(dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.shouldUsePopper)) {
|
|
11446
|
+
var _root_current;
|
|
11447
|
+
(_root_current = root2.current) === null || _root_current === void 0 ? void 0 : _root_current.style.removeProperty("--dropdown-offset");
|
|
11448
|
+
}
|
|
11449
|
+
}, [
|
|
11450
|
+
dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.shouldUsePopper
|
|
11451
|
+
]);
|
|
11452
|
+
var handleListClose = React.useCallback(function(event) {
|
|
11453
|
+
closeList();
|
|
11441
11454
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
11442
11455
|
}, [
|
|
11456
|
+
closeList,
|
|
11443
11457
|
onBlur
|
|
11444
11458
|
]);
|
|
11445
11459
|
var handleListOpen = function() {
|
|
11446
11460
|
if (!isListOpen) {
|
|
11447
11461
|
setIsListOpen(true);
|
|
11462
|
+
if (!(dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.shouldUsePopper)) {
|
|
11463
|
+
var _root_current;
|
|
11464
|
+
(_root_current = root2.current) === null || _root_current === void 0 ? void 0 : _root_current.style.setProperty("--dropdown-offset", "".concat(getDropdownOffset(), "px"));
|
|
11465
|
+
}
|
|
11448
11466
|
}
|
|
11449
11467
|
};
|
|
11450
11468
|
var handleFocus = function(event) {
|
|
@@ -11467,7 +11485,7 @@
|
|
|
11467
11485
|
handleListClose(event);
|
|
11468
11486
|
}
|
|
11469
11487
|
};
|
|
11470
|
-
var
|
|
11488
|
+
var handleChange = React.useCallback(function(newValue, event) {
|
|
11471
11489
|
if (!compareValuesOnChange(value, newValue)) {
|
|
11472
11490
|
onChange(newValue, event);
|
|
11473
11491
|
}
|
|
@@ -11477,12 +11495,12 @@
|
|
|
11477
11495
|
onChange
|
|
11478
11496
|
]);
|
|
11479
11497
|
var handleOptionSelect = React.useCallback(function(index, event) {
|
|
11480
|
-
var
|
|
11481
|
-
|
|
11498
|
+
var _input_current2;
|
|
11499
|
+
handleChange(index === DEFAULT_OPTION_INDEX ? void 0 : filteredOptions[index], event);
|
|
11482
11500
|
handleListClose(event);
|
|
11483
|
-
(
|
|
11501
|
+
(_input_current2 = input.current) === null || _input_current2 === void 0 ? void 0 : _input_current2.blur();
|
|
11484
11502
|
}, [
|
|
11485
|
-
|
|
11503
|
+
handleChange,
|
|
11486
11504
|
handleListClose,
|
|
11487
11505
|
filteredOptions
|
|
11488
11506
|
]);
|
|
@@ -11491,15 +11509,15 @@
|
|
|
11491
11509
|
return;
|
|
11492
11510
|
}
|
|
11493
11511
|
if (index === DEFAULT_OPTION_INDEX || index === ALL_OPTION_INDEX && !isSelected) {
|
|
11494
|
-
|
|
11512
|
+
handleChange(void 0, event);
|
|
11495
11513
|
return;
|
|
11496
11514
|
}
|
|
11497
11515
|
if (index === ALL_OPTION_INDEX && isSelected) {
|
|
11498
|
-
|
|
11516
|
+
handleChange(availableOptions, event);
|
|
11499
11517
|
return;
|
|
11500
11518
|
}
|
|
11501
11519
|
var option = filteredOptions[index];
|
|
11502
|
-
|
|
11520
|
+
handleChange(isSelected ? (
|
|
11503
11521
|
// Добавляем
|
|
11504
11522
|
_to_consumable_array$7(value !== null && value !== void 0 ? value : []).concat([
|
|
11505
11523
|
option
|
|
@@ -11513,7 +11531,7 @@
|
|
|
11513
11531
|
}, [
|
|
11514
11532
|
isMultiSelect,
|
|
11515
11533
|
filteredOptions,
|
|
11516
|
-
|
|
11534
|
+
handleChange,
|
|
11517
11535
|
value,
|
|
11518
11536
|
availableOptions,
|
|
11519
11537
|
convertToId
|
|
@@ -11573,7 +11591,7 @@
|
|
|
11573
11591
|
setShouldShowDefaultOption(v === "");
|
|
11574
11592
|
}
|
|
11575
11593
|
if (v === "" && !hasSearchInputInList) {
|
|
11576
|
-
|
|
11594
|
+
handleChange(void 0, event);
|
|
11577
11595
|
}
|
|
11578
11596
|
setSearchValue(v);
|
|
11579
11597
|
};
|
|
@@ -11597,7 +11615,8 @@
|
|
|
11597
11615
|
if (indexToSelect === ALL_OPTION_INDEX) {
|
|
11598
11616
|
isThisValueAlreadySelected = areAllOptionsSelected;
|
|
11599
11617
|
} else {
|
|
11600
|
-
var
|
|
11618
|
+
var option = filteredOptions[indexToSelect];
|
|
11619
|
+
var valueIdToSelect = convertToId(option);
|
|
11601
11620
|
var _value_some;
|
|
11602
11621
|
isThisValueAlreadySelected = (_value_some = value === null || value === void 0 ? void 0 : value.some(function(opt) {
|
|
11603
11622
|
return convertToId(opt) === valueIdToSelect;
|
|
@@ -11625,8 +11644,9 @@
|
|
|
11625
11644
|
};
|
|
11626
11645
|
var onArrowClick = function() {
|
|
11627
11646
|
if (isListOpen) {
|
|
11628
|
-
var
|
|
11629
|
-
(
|
|
11647
|
+
var _input_current2;
|
|
11648
|
+
(_input_current2 = input.current) === null || _input_current2 === void 0 ? void 0 : _input_current2.blur();
|
|
11649
|
+
closeList();
|
|
11630
11650
|
} else {
|
|
11631
11651
|
var _input_current1;
|
|
11632
11652
|
(_input_current1 = input.current) === null || _input_current1 === void 0 ? void 0 : _input_current1.focus();
|
|
@@ -11646,10 +11666,11 @@
|
|
|
11646
11666
|
(optionsMode === "normal" || hasEnoughSymbolsToSearch)
|
|
11647
11667
|
);
|
|
11648
11668
|
var _ref1 = dropdownOptions !== null && dropdownOptions !== void 0 ? dropdownOptions : {}, _ref_shouldUsePopper = _ref1.shouldUsePopper, shouldUsePopper = _ref_shouldUsePopper === void 0 ? false : _ref_shouldUsePopper, _ref_shouldRenderInBody = _ref1.shouldRenderInBody, shouldRenderInBody = _ref_shouldRenderInBody === void 0 ? false : _ref_shouldRenderInBody, _ref_shouldHideOnScroll = _ref1.shouldHideOnScroll, shouldHideOnScroll = _ref_shouldHideOnScroll === void 0 ? false : _ref_shouldHideOnScroll;
|
|
11669
|
+
var _input_current_parentElement;
|
|
11649
11670
|
var popperData = useDropdown({
|
|
11650
11671
|
isOpen,
|
|
11651
11672
|
onDropdownClose: handleListClose,
|
|
11652
|
-
referenceElement: inputWrapper.current,
|
|
11673
|
+
referenceElement: (_input_current_parentElement = (_input_current = input.current) === null || _input_current === void 0 ? void 0 : _input_current.parentElement) !== null && _input_current_parentElement !== void 0 ? _input_current_parentElement : inputWrapper.current,
|
|
11653
11674
|
dropdownElement: list.current,
|
|
11654
11675
|
options: dropdownOptions,
|
|
11655
11676
|
dependenciesForPositionUpdating: [
|
|
@@ -11658,10 +11679,11 @@
|
|
|
11658
11679
|
]
|
|
11659
11680
|
});
|
|
11660
11681
|
React.useEffect(function() {
|
|
11661
|
-
var
|
|
11662
|
-
|
|
11663
|
-
return trueReactPlatformHelpers.isNotEmpty(
|
|
11664
|
-
})
|
|
11682
|
+
var focusedCellIndex = trueReactPlatformHelpers.isNotEmpty(strValue) ? optionsIndexesForNavigation.find(function(index) {
|
|
11683
|
+
var option = filteredOptions[index];
|
|
11684
|
+
return trueReactPlatformHelpers.isNotEmpty(option) && convertToId(option) === convertToId(strValue);
|
|
11685
|
+
}) : void 0;
|
|
11686
|
+
setFocusedListCellIndex(focusedCellIndex !== null && focusedCellIndex !== void 0 ? focusedCellIndex : optionsIndexesForNavigation[0]);
|
|
11665
11687
|
}, [
|
|
11666
11688
|
strValue,
|
|
11667
11689
|
filteredOptions,
|
|
@@ -11675,11 +11697,24 @@
|
|
|
11675
11697
|
}, [
|
|
11676
11698
|
isOpen
|
|
11677
11699
|
]);
|
|
11700
|
+
var searchInputEl = hasSearchInputInList && /* @__PURE__ */ jsx(SearchInput, _object_spread$H({
|
|
11701
|
+
value: searchValue,
|
|
11702
|
+
onChange: handleInputChange,
|
|
11703
|
+
tweakStyles: tweakSearchInputStyles,
|
|
11704
|
+
placeholder: "Поиск"
|
|
11705
|
+
}, searchInputProps));
|
|
11706
|
+
var customHeader = (trueReactPlatformHelpers.isReactNodeNotEmpty(searchInputEl) || trueReactPlatformHelpers.isReactNodeNotEmpty(header)) && /* @__PURE__ */ jsxs(Fragment, {
|
|
11707
|
+
children: [
|
|
11708
|
+
searchInputEl,
|
|
11709
|
+
header
|
|
11710
|
+
]
|
|
11711
|
+
});
|
|
11678
11712
|
var _obj2;
|
|
11679
11713
|
var listEl = /* @__PURE__ */ jsx("div", _object_spread_props$C(_object_spread$H({
|
|
11680
11714
|
className: clsx(classes.listWrapper, (_obj2 = {}, _define_property$J(_obj2, classes.withoutPopper, !shouldUsePopper), _define_property$J(_obj2, classes.listWrapperInBody, shouldRenderInBody), _obj2)),
|
|
11681
11715
|
ref: list,
|
|
11682
11716
|
style: popperData === null || popperData === void 0 ? void 0 : popperData.styles.popper,
|
|
11717
|
+
tabIndex: 0,
|
|
11683
11718
|
onBlur: handleBlur
|
|
11684
11719
|
}, popperData === null || popperData === void 0 ? void 0 : popperData.attributes.popper), {
|
|
11685
11720
|
children: isOpen && /* @__PURE__ */ jsx(SelectList, {
|
|
@@ -11687,12 +11722,8 @@
|
|
|
11687
11722
|
defaultOptionLabel: hasDefaultOption && shouldShowDefaultOption && defaultOptionLabel,
|
|
11688
11723
|
allOptionsLabel: shouldShowAllOption && allOptionsLabel,
|
|
11689
11724
|
areAllOptionsSelected,
|
|
11690
|
-
customListHeader:
|
|
11691
|
-
|
|
11692
|
-
onChange: handleInputChange,
|
|
11693
|
-
tweakStyles: tweakSearchInputStyles,
|
|
11694
|
-
placeholder: "Поиск"
|
|
11695
|
-
}, searchInputProps)),
|
|
11725
|
+
customListHeader: customHeader,
|
|
11726
|
+
customListFooter: footer,
|
|
11696
11727
|
noMatchesLabel,
|
|
11697
11728
|
focusedIndex: focusedListCellIndex,
|
|
11698
11729
|
activeValue: value,
|
|
@@ -11700,13 +11731,14 @@
|
|
|
11700
11731
|
loadingLabel,
|
|
11701
11732
|
tweakStyles: tweakSelectListStyles,
|
|
11702
11733
|
testId: trueReactPlatformHelpers.getTestId(testId, "list"),
|
|
11734
|
+
isMultiSelect,
|
|
11703
11735
|
shouldScrollToList: shouldScrollToList && !shouldUsePopper && !shouldHideOnScroll,
|
|
11704
11736
|
isOptionDisabled,
|
|
11705
11737
|
convertValueToString,
|
|
11706
11738
|
convertValueToReactNode,
|
|
11707
11739
|
convertValueToId: convertToId,
|
|
11708
11740
|
onOptionSelect: handleOptionSelect,
|
|
11709
|
-
onToggleCheckbox:
|
|
11741
|
+
onToggleCheckbox: handleToggleOptionCheckbox
|
|
11710
11742
|
})
|
|
11711
11743
|
}));
|
|
11712
11744
|
var multiSelectCounterWithIcon = shouldShowMultiSelectCounter || trueReactPlatformHelpers.isNotEmpty(iconType) ? /* @__PURE__ */ jsxs(Fragment, {
|
|
@@ -11728,6 +11760,7 @@
|
|
|
11728
11760
|
return /* @__PURE__ */ jsxs("div", {
|
|
11729
11761
|
className: classes.root,
|
|
11730
11762
|
onKeyDown: handleKeyDown,
|
|
11763
|
+
ref: root2,
|
|
11731
11764
|
children: [
|
|
11732
11765
|
/* @__PURE__ */ jsxs("div", {
|
|
11733
11766
|
className: clsx(classes.inputWrapper, isDisabled && classes.disabled),
|
|
@@ -26080,17 +26113,8 @@
|
|
|
26080
26113
|
});
|
|
26081
26114
|
var _useState = _sliced_to_array$8(React.useState(false), 2), isFocused = _useState[0], setFocused = _useState[1];
|
|
26082
26115
|
var _useState1 = _sliced_to_array$8(React.useState(function() {
|
|
26083
|
-
|
|
26084
|
-
|
|
26085
|
-
setNestedComponent({
|
|
26086
|
-
isOpen: false
|
|
26087
|
-
});
|
|
26088
|
-
}) : void 0;
|
|
26089
|
-
return trueReactPlatformHelpers.isReactNodeNotEmpty(component) ? {
|
|
26090
|
-
isOpen: true,
|
|
26091
|
-
component
|
|
26092
|
-
} : {
|
|
26093
|
-
isOpen: false
|
|
26116
|
+
return {
|
|
26117
|
+
isOpen: trueReactPlatformHelpers.applyAction(isExpandableRowComponentInitiallyOpen, item, index)
|
|
26094
26118
|
};
|
|
26095
26119
|
}), 2), nestedComponent = _useState1[0], setNestedComponent = _useState1[1];
|
|
26096
26120
|
var _activeRows_includes;
|
|
@@ -26112,38 +26136,40 @@
|
|
|
26112
26136
|
onRowHover === null || onRowHover === void 0 ? void 0 : onRowHover(void 0);
|
|
26113
26137
|
setFocused(false);
|
|
26114
26138
|
};
|
|
26115
|
-
var updateNestedComponent = function(component, cellKey) {
|
|
26116
|
-
setNestedComponent(component === void 0 ? {
|
|
26117
|
-
isOpen: false
|
|
26118
|
-
} : {
|
|
26119
|
-
isOpen: true,
|
|
26120
|
-
component,
|
|
26121
|
-
cellKey
|
|
26122
|
-
});
|
|
26123
|
-
};
|
|
26124
26139
|
var closeNestedComponent = function() {
|
|
26125
26140
|
setNestedComponent({
|
|
26126
26141
|
isOpen: false
|
|
26127
26142
|
});
|
|
26128
26143
|
};
|
|
26144
|
+
var updateNestedComponent = function(component, cellKey) {
|
|
26145
|
+
if (trueReactPlatformHelpers.isEmpty(component)) {
|
|
26146
|
+
closeNestedComponent();
|
|
26147
|
+
} else {
|
|
26148
|
+
setNestedComponent({
|
|
26149
|
+
isOpen: true,
|
|
26150
|
+
component,
|
|
26151
|
+
cellKey
|
|
26152
|
+
});
|
|
26153
|
+
}
|
|
26154
|
+
};
|
|
26129
26155
|
var handleRowClick = function() {
|
|
26130
26156
|
if (trueReactPlatformHelpers.isNotEmpty(uniqueField)) {
|
|
26131
26157
|
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(item[uniqueField]);
|
|
26132
26158
|
}
|
|
26133
|
-
if (trueReactPlatformHelpers.
|
|
26134
|
-
|
|
26135
|
-
|
|
26136
|
-
|
|
26137
|
-
|
|
26138
|
-
|
|
26139
|
-
|
|
26140
|
-
|
|
26141
|
-
|
|
26142
|
-
}
|
|
26159
|
+
if (trueReactPlatformHelpers.isEmpty(expandableRowComponent)) {
|
|
26160
|
+
return;
|
|
26161
|
+
}
|
|
26162
|
+
if (!isNestedComponentExpanded) {
|
|
26163
|
+
setNestedComponent({
|
|
26164
|
+
isOpen: true
|
|
26165
|
+
});
|
|
26166
|
+
} else if (trueReactPlatformHelpers.isEmpty(nestedComponentCellKey)) {
|
|
26167
|
+
closeNestedComponent();
|
|
26143
26168
|
}
|
|
26144
26169
|
};
|
|
26145
26170
|
var TableRow = renderMode === "divs" ? "div" : "tr";
|
|
26146
26171
|
var TableCell = renderMode === "divs" ? "div" : "td";
|
|
26172
|
+
var _nestedComponent_component;
|
|
26147
26173
|
var _obj2;
|
|
26148
26174
|
return /* @__PURE__ */ jsxs(Fragment, {
|
|
26149
26175
|
children: [
|
|
@@ -26182,7 +26208,7 @@
|
|
|
26182
26208
|
children: /* @__PURE__ */ jsx(TableCell, {
|
|
26183
26209
|
className: classes.nestedComponent,
|
|
26184
26210
|
colSpan: columns.length,
|
|
26185
|
-
children: nestedComponent.component
|
|
26211
|
+
children: (_nestedComponent_component = nestedComponent.component) !== null && _nestedComponent_component !== void 0 ? _nestedComponent_component : expandableRowComponent === null || expandableRowComponent === void 0 ? void 0 : expandableRowComponent(item, true, closeNestedComponent)
|
|
26186
26212
|
})
|
|
26187
26213
|
})
|
|
26188
26214
|
]
|