@megha-ui/react 1.2.765 → 1.2.767
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,7 +145,18 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
145
145
|
useEffect(() => {
|
|
146
146
|
const _options = isSort
|
|
147
147
|
? options
|
|
148
|
-
.sort((a, b) =>
|
|
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
|
+
aValue = isNaN(parseFloat(aValue)) ? aValue : parseFloat(aValue);
|
|
156
|
+
bValue = isNaN(parseFloat(bValue)) ? bValue : parseFloat(bValue);
|
|
157
|
+
}
|
|
158
|
+
return aValue > bValue ? 1 : -1;
|
|
159
|
+
})
|
|
149
160
|
.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()))
|
|
150
161
|
: options.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
151
162
|
setFilteredOptions(_options);
|
package/package.json
CHANGED