sccoreui 5.9.52 → 5.9.53
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/dist/assets/sccoreui.css
CHANGED
|
@@ -8923,5 +8923,7 @@ input[type="number"]::-webkit-outer-spin-button {
|
|
|
8923
8923
|
box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05), 0px 0px 0px 2px var(--gray-100);
|
|
8924
8924
|
}
|
|
8925
8925
|
|
|
8926
|
-
|
|
8927
|
-
|
|
8926
|
+
.sc_multiSelect.p-inputwrapper-filled.p-multiselect.p-multiselect-clearable
|
|
8927
|
+
.p-multiselect-label {
|
|
8928
|
+
padding-right: 2.5rem;
|
|
8929
|
+
}
|
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
5
|
const multiselect_1 = require("primereact/multiselect");
|
|
6
|
+
const react_1 = require("react");
|
|
5
7
|
const ScMultiSelect = (props) => {
|
|
6
8
|
var _a, _b;
|
|
7
|
-
|
|
9
|
+
const multiselectElm = (0, react_1.useRef)(null);
|
|
10
|
+
const [showCount, setShowCount] = (0, react_1.useState)(false);
|
|
11
|
+
const checkOverflow = () => {
|
|
12
|
+
if (multiselectElm === null || multiselectElm === void 0 ? void 0 : multiselectElm.current) {
|
|
13
|
+
const dropDownItem = multiselectElm.current.getElement().children[1].children[0];
|
|
14
|
+
const selectedItems = multiselectElm.current.getElement().children[1].children[0].children;
|
|
15
|
+
const containerWidth = dropDownItem.offsetWidth;
|
|
16
|
+
let totalWidth = 0;
|
|
17
|
+
for (let i = 0; i < selectedItems.length; i++) {
|
|
18
|
+
totalWidth += selectedItems[i].offsetWidth; // Approximation, adjust as necessary
|
|
19
|
+
if (totalWidth > containerWidth - 40) { // 20px buffer for ellipsis
|
|
20
|
+
setShowCount(true);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
setShowCount(false);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
setShowCount(false);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "relative form_field" }, { children: [(0, jsx_runtime_1.jsx)(multiselect_1.MultiSelect, { ref: multiselectElm, selectAll: props === null || props === void 0 ? void 0 : props.selectAll, filter: props === null || props === void 0 ? void 0 : props.filter, filterIcon: props === null || props === void 0 ? void 0 : props.filterIcon, filterBy: props === null || props === void 0 ? void 0 : props.filterBy, onFilter: props === null || props === void 0 ? void 0 : props.onFilter, filterPlaceholder: props === null || props === void 0 ? void 0 : props.filterPlaceholder, filterTemplate: props === null || props === void 0 ? void 0 : props.filterTemplate, filterMatchMode: props.filterMatchMode, fixedPlaceholder: props === null || props === void 0 ? void 0 : props.fixedPlaceholder, filterLocale: props === null || props === void 0 ? void 0 : props.filterLocale, filterInputAutoFocus: props === null || props === void 0 ? void 0 : props.filterInputAutoFocus, emptyFilterMessage: props === null || props === void 0 ? void 0 : props.emptyFilterMessage, panelClassName: "sc_multiSelect_panel", onShow: props === null || props === void 0 ? void 0 : props.onShow, onHide: props === null || props === void 0 ? void 0 : props.onHide, dropdownIcon: props === null || props === void 0 ? void 0 : props.dropdownIcon, showClear: props === null || props === void 0 ? void 0 : props.showClear, display: props === null || props === void 0 ? void 0 : props.display, value: props === null || props === void 0 ? void 0 : props.value, onChange: (e) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
yield (props === null || props === void 0 ? void 0 : props.onChange(e));
|
|
34
|
+
if (props === null || props === void 0 ? void 0 : props.showSelectedCount)
|
|
35
|
+
checkOverflow();
|
|
36
|
+
}), 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 && (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) &&
|
|
8
37
|
(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: `+${((_b = props === null || props === void 0 ? void 0 : props.value) === null || _b === void 0 ? void 0 : _b.length) - 1}` })) }))] })) }));
|
|
9
38
|
};
|
|
10
39
|
exports.default = ScMultiSelect;
|