@megha-ui/react 1.2.358 → 1.2.360
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.
|
@@ -144,8 +144,19 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
144
144
|
const _options = isSort
|
|
145
145
|
? options
|
|
146
146
|
.sort((a, b) => (a.label > b.label ? 1 : -1))
|
|
147
|
-
.filter((option) =>
|
|
148
|
-
|
|
147
|
+
.filter((option) => {
|
|
148
|
+
console.log(option.label
|
|
149
|
+
.toLowerCase()
|
|
150
|
+
.includes(searchTerm.toLowerCase()), option.label, searchTerm);
|
|
151
|
+
return option.label
|
|
152
|
+
.toLowerCase()
|
|
153
|
+
.includes(searchTerm.toLowerCase());
|
|
154
|
+
})
|
|
155
|
+
: options.filter((option) => {
|
|
156
|
+
return option.label.toLowerCase().includes(searchTerm.toLowerCase());
|
|
157
|
+
});
|
|
158
|
+
console.log(options);
|
|
159
|
+
setFilteredOptions(options);
|
|
149
160
|
const grouped = [];
|
|
150
161
|
if (isGrouping) {
|
|
151
162
|
const groups = [...new Set(options.map((opt) => opt.group))];
|
|
@@ -165,7 +176,6 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
165
176
|
}
|
|
166
177
|
setGroupedOptions(grouped);
|
|
167
178
|
}
|
|
168
|
-
setFilteredOptions(options);
|
|
169
179
|
}, [searchTerm, options, isSort, isGrouping]);
|
|
170
180
|
const handleSelect = (value, isDisabled) => {
|
|
171
181
|
if (isDisabled)
|
|
@@ -394,7 +404,7 @@ const Dropdown = ({ options, selectedValues, onChange, placeholder = "Select..."
|
|
|
394
404
|
width: "100%",
|
|
395
405
|
}, children: [option.icon &&
|
|
396
406
|
option.isDelete &&
|
|
397
|
-
!option.isDelete &&
|
|
407
|
+
!option.isDelete && _jsx("span", { children: option.icon }), _jsx("span", { style: { margin: "0 0.5rem" }, children: option.label })] }), option.icon && option.isDelete && option.icon] }, String(option.value)));
|
|
398
408
|
})] }, gIndex)))) : (filteredOptions.map((option, index) => (_jsxs("li", { ref: (el) => {
|
|
399
409
|
optionRefs.current[index] = el;
|
|
400
410
|
}, onClick: (e) => onSelectChange
|
package/package.json
CHANGED