@megha-ui/react 1.2.764 → 1.2.766
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.
|
@@ -145,8 +145,16 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
145
145
|
useEffect(() => {
|
|
146
146
|
const _options = isSort
|
|
147
147
|
? options
|
|
148
|
-
.sort((a, b) =>
|
|
149
|
-
|
|
148
|
+
.sort((a, b) => {
|
|
149
|
+
let aValue = a.label;
|
|
150
|
+
let bValue = b.label;
|
|
151
|
+
if (aValue.toString().includes("-") &&
|
|
152
|
+
bValue.toString().includes("-")) {
|
|
153
|
+
aValue = aValue.toString().split("-")[0];
|
|
154
|
+
bValue = bValue.toString().split("-")[0];
|
|
155
|
+
}
|
|
156
|
+
return aValue > bValue ? 1 : -1;
|
|
157
|
+
}).filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()))
|
|
150
158
|
: options.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
151
159
|
setFilteredOptions(_options);
|
|
152
160
|
const grouped = [];
|
|
@@ -374,7 +382,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
374
382
|
display: "flex",
|
|
375
383
|
alignItems: "start",
|
|
376
384
|
width: "100%",
|
|
377
|
-
}, children: _jsx("span", { children: "Select All" }) })] })), _jsx("div", { style: { maxHeight: maxDropdownHeight, overflowY: "auto" }, children: isLoading ? (_jsxs(Block, { as: "div", className: "flex items-center justify-between", children: [_jsx(Text, { as: "span", children: "Loading options" }), _jsx(Loader, { size: 12 })] })) : isCreatable && filteredOptions.length < 1 ? (_jsxs("li", { onClick: (e) => onCreate(searchTerm), style: Object.assign(Object.assign({}, listItemStyle), { display: "flex", alignItems: "center", wordWrap: "break-word", textWrap: "wrap", justifyContent: "space-between" }), children: [isMultiple && (_jsx(Checkbox, { selected: intermediateValues.includes(searchTerm), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper })), _jsx("div", { style: {
|
|
385
|
+
}, children: _jsx("span", { children: "Select All" }) })] })), _jsx("div", { style: { maxHeight: maxDropdownHeight, overflowY: "auto" }, children: isLoading ? (_jsxs(Block, { as: "div", className: "flex items-center justify-between", children: [_jsx(Text, { as: "span", children: "Loading options" }), _jsx(Loader, { size: 12 })] })) : isCreatable && filteredOptions.length < 1 && searchTerm ? (_jsxs("li", { onClick: (e) => onCreate(searchTerm), style: Object.assign(Object.assign({}, listItemStyle), { display: "flex", alignItems: "center", wordWrap: "break-word", textWrap: "wrap", justifyContent: "space-between" }), children: [isMultiple && (_jsx(Checkbox, { selected: intermediateValues.includes(searchTerm), onChange: () => { }, style: { pointerEvents: "none" }, noLabel: true, wrapperClass: checkboxWrapper })), _jsx("div", { style: {
|
|
378
386
|
display: "flex",
|
|
379
387
|
alignItems: "start",
|
|
380
388
|
width: "100%",
|
package/package.json
CHANGED