@economic/taco 2.63.1 → 2.63.2-combobox-search.0
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/taco.cjs +13 -4
- package/dist/taco.cjs.map +1 -1
- package/dist/taco.js +13 -4
- package/dist/taco.js.map +1 -1
- package/package.json +2 -2
package/dist/taco.cjs
CHANGED
@@ -18386,7 +18386,7 @@ const filterData = (data, value = "") => {
|
|
18386
18386
|
if (value === "" || value === null) {
|
18387
18387
|
return data;
|
18388
18388
|
}
|
18389
|
-
const
|
18389
|
+
const filteredOptions = [];
|
18390
18390
|
const shouldFilterOption = (option) => {
|
18391
18391
|
if (option.disabled) {
|
18392
18392
|
return false;
|
@@ -18396,13 +18396,22 @@ const filterData = (data, value = "") => {
|
|
18396
18396
|
data.forEach((option) => {
|
18397
18397
|
if (shouldFilterOption(option)) {
|
18398
18398
|
const parents = getOptionParents(data, option.path);
|
18399
|
-
|
18399
|
+
const index2 = option.text.toString().toLocaleLowerCase().indexOf(value.toString().toLocaleLowerCase());
|
18400
|
+
filteredOptions.push({ value: option.value, score: index2 });
|
18400
18401
|
if (parents !== null) {
|
18401
|
-
parents.forEach((option2) =>
|
18402
|
+
parents.forEach((option2) => filteredOptions.push({ value: option2 == null ? void 0 : option2.value }));
|
18402
18403
|
}
|
18403
18404
|
}
|
18404
18405
|
});
|
18405
|
-
return data.filter(({ value: value2 }) =>
|
18406
|
+
return data.filter(({ value: value2 }) => filteredOptions.find((x2) => x2.value === value2)).toSorted((a2, b2) => {
|
18407
|
+
var _a, _b;
|
18408
|
+
const scoreA = (_a = filteredOptions.find((x2) => x2.value === a2.value)) == null ? void 0 : _a.score;
|
18409
|
+
const scoreB = (_b = filteredOptions.find((x2) => x2.value === b2.value)) == null ? void 0 : _b.score;
|
18410
|
+
if (scoreA !== void 0 && scoreB !== void 0) {
|
18411
|
+
return scoreA - scoreB;
|
18412
|
+
}
|
18413
|
+
return 0;
|
18414
|
+
});
|
18406
18415
|
};
|
18407
18416
|
const debouncer = debounce$1((f2) => f2(), 200);
|
18408
18417
|
const convertToInputValue = (value) => String(value ?? "");
|