Autocomplete works with array and objects
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 4s

This commit is contained in:
2026-05-02 20:52:35 +02:00
parent 098508d12a
commit 97f481e22f
13 changed files with 74 additions and 39 deletions

6
dist/sigpro-ui.css vendored
View File

@@ -3408,6 +3408,9 @@
font-weight: 600;
}
}
.mb-2 {
margin-bottom: calc(var(--spacing) * 2);
}
.mb-4 {
margin-bottom: calc(var(--spacing) * 4);
}
@@ -4495,6 +4498,9 @@
.gap-8 {
gap: calc(var(--spacing) * 8);
}
.gap-10 {
gap: calc(var(--spacing) * 10);
}
.space-y-1 {
:where(& > :not(:last-child)) {
--tw-space-y-reverse: 0;

View File

@@ -637,7 +637,11 @@ if (typeof window !== "undefined") {
var val = (val2) => typeof val2 === "function" ? val2() : val2;
var getBy = (item, field = "label") => item && typeof item === "object" ? item[field] : item;
var cls = (...classes) => classes.filter(Boolean).join(" ").trim();
var filterBy = (items, query, field = "label", q = String(query).toLowerCase()) => !query ? val(items) : val(items).filter((item) => String(item && typeof item === "object" ? item[field] : item).toLowerCase().includes(q));
var filterBy = (items, query, field = "label") => {
const q = String(val(query) || "").toLowerCase();
const list = (val(items) || []).map((i) => typeof i === "object" ? i : { label: i, value: i });
return !q ? list : list.filter((item) => String(item[field] || "").toLowerCase().includes(q));
};
var rand = (r) => `${r}-${Math.random().toString(36).slice(2, 9)}`;
var hide = () => document.activeElement?.blur();
var lang = {
@@ -694,7 +698,7 @@ var Autocomplete = ({ items, value, onselect, placeholder = "...", ...props }) =
onmousedown: (e) => e.preventDefault(),
onclick: () => pick(item)
}, getBy(item))
]), (item) => getBy(item)),
]), "value"),
() => filtered().length === 0 ? h("li", { class: "p-4 opacity-50 text-center" }, "Sin resultados") : null
]))
]);

File diff suppressed because one or more lines are too long

8
dist/sigpro-ui.js vendored
View File

@@ -667,7 +667,11 @@
var val = (val2) => typeof val2 === "function" ? val2() : val2;
var getBy = (item, field = "label") => item && typeof item === "object" ? item[field] : item;
var cls = (...classes) => classes.filter(Boolean).join(" ").trim();
var filterBy = (items, query, field = "label", q = String(query).toLowerCase()) => !query ? val(items) : val(items).filter((item) => String(item && typeof item === "object" ? item[field] : item).toLowerCase().includes(q));
var filterBy = (items, query, field = "label") => {
const q = String(val(query) || "").toLowerCase();
const list = (val(items) || []).map((i) => typeof i === "object" ? i : { label: i, value: i });
return !q ? list : list.filter((item) => String(item[field] || "").toLowerCase().includes(q));
};
var rand = (r) => `${r}-${Math.random().toString(36).slice(2, 9)}`;
var hide = () => document.activeElement?.blur();
var lang = {
@@ -724,7 +728,7 @@
onmousedown: (e) => e.preventDefault(),
onclick: () => pick(item)
}, getBy(item))
]), (item) => getBy(item)),
]), "value"),
() => filtered().length === 0 ? h("li", { class: "p-4 opacity-50 text-center" }, "Sin resultados") : null
]))
]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long