sccoreui 5.9.60 → 5.9.62
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.
|
@@ -16,8 +16,8 @@ const ScMultiSelect = (props) => {
|
|
|
16
16
|
let totalWidth = 0;
|
|
17
17
|
for (let i = 0; i < selectedItems.length; i++) {
|
|
18
18
|
totalWidth += selectedItems[i].offsetWidth; // Approximation, adjust as necessary
|
|
19
|
-
if (totalWidth > containerWidth -
|
|
20
|
-
setShowCount(
|
|
19
|
+
if (totalWidth > containerWidth - 64) { // 20px buffer for ellipsis
|
|
20
|
+
setShowCount(props.value.length - (i - 1));
|
|
21
21
|
break;
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
@@ -36,7 +36,7 @@ const ScMultiSelect = (props) => {
|
|
|
36
36
|
yield (props === null || props === void 0 ? void 0 : props.onChange(e));
|
|
37
37
|
if (props === null || props === void 0 ? void 0 : props.showSelectedCount)
|
|
38
38
|
checkOverflow();
|
|
39
|
-
}), options: props === null || props === void 0 ? void 0 : props.options, optionLabel: props === null || props === void 0 ? void 0 : props.optionLabel, placeholder: props === null || props === void 0 ? void 0 : props.placeholder, className: (props === null || props === void 0 ? void 0 : props.className) + ` ${(props === null || props === void 0 ? void 0 : props.showSelectedCount) ? 'showSelectedCount' : 'noShowSelectedCount'} ${(props === null || props === void 0 ? void 0 : props.removeChipIcon) ? 'hideChipremoveIcon' : ''} sc_multiSelect`, id: props === null || props === void 0 ? void 0 : props.id }), (showCount !== 0 && (props === null || props === void 0 ? void 0 : props.showSelectedCount) && ((_a = props === null || props === void 0 ? void 0 : props.value) === null || _a === void 0 ? void 0 : _a.length) > 1) &&
|
|
39
|
+
}), itemTemplate: (item) => (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: item[props.optionLabel] }), options: props === null || props === void 0 ? void 0 : props.options, optionLabel: props === null || props === void 0 ? void 0 : props.optionLabel, placeholder: props === null || props === void 0 ? void 0 : props.placeholder, className: (props === null || props === void 0 ? void 0 : props.className) + ` ${(props === null || props === void 0 ? void 0 : props.showSelectedCount) ? 'showSelectedCount' : 'noShowSelectedCount'} ${(props === null || props === void 0 ? void 0 : props.removeChipIcon) ? 'hideChipremoveIcon' : ''} sc_multiSelect`, id: props === null || props === void 0 ? void 0 : props.id }), (showCount !== 0 && (props === null || props === void 0 ? void 0 : props.showSelectedCount) && ((_a = props === null || props === void 0 ? void 0 : props.value) === null || _a === void 0 ? void 0 : _a.length) > 1) &&
|
|
40
40
|
(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "absolute top-0 h-full text-center flex align-items-center w-2rem justify-content-center", style: { right: `${(props === null || props === void 0 ? void 0 : props.showClear) ? '68px' : '40px'}` } }, { children: (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "px-2 bg-primary-50 border-round-sm text-base" }, { children: `+${showCount}` })) }))] })) }));
|
|
41
41
|
};
|
|
42
42
|
exports.default = ScMultiSelect;
|