adverich-kun-ui 0.1.613 → 0.1.616
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/AGENTS.md +9 -1
- package/dist/AGENTS.md +9 -1
- package/dist/components/KunFileInput/src/components/KunFileInput.vue.js +58 -55
- package/dist/components/KunFileInput/src/composables/kunFileInputProps.js +4 -0
- package/dist/components/KunTable/src/components/KunTableFilter.vue.js +3 -3
- package/dist/components/KunTable/src/composables/useFilter.js +59 -57
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -356,17 +356,25 @@ const headers = [
|
|
|
356
356
|
```javascript
|
|
357
357
|
const filters = [
|
|
358
358
|
{
|
|
359
|
-
value: 'rol', // Clave del filtro (debe coincidir con header.value)
|
|
359
|
+
value: 'rol', // Clave del filtro (debe coincidir con header.value / row key)
|
|
360
360
|
label: 'Rol', // Etiqueta visible
|
|
361
361
|
text: 'Rol', // Texto alternativo
|
|
362
362
|
name: 'roles', // Nombre para textos genéricos
|
|
363
363
|
items: [...], // Lista de opciones para el filtro
|
|
364
|
+
'item-value': 'id', // Clave de comparación (default: 'id')
|
|
364
365
|
placeholderText: 'Seleccionar rol',
|
|
365
366
|
textNoItem: 'No hay roles disponibles'
|
|
366
367
|
}
|
|
367
368
|
]
|
|
368
369
|
```
|
|
369
370
|
|
|
371
|
+
**Matching de filtros por columna:**
|
|
372
|
+
|
|
373
|
+
- Selección múltiple dentro de un filtro: **OR** (pasa si coincide alguno de los valores seleccionados).
|
|
374
|
+
- Varios filtros activos: **AND**.
|
|
375
|
+
- Celda escalar: igualdad exacta (case-insensitive) contra `item-value`.
|
|
376
|
+
- Celda array (relaciones M2M, p. ej. `price_lists`): **includes-any** — pasa si algún miembro del array tiene `item-value` (default `id`) entre los seleccionados.
|
|
377
|
+
|
|
370
378
|
**Slots:**
|
|
371
379
|
|
|
372
380
|
| Slot | Props | Descripción |
|
package/dist/AGENTS.md
CHANGED
|
@@ -356,17 +356,25 @@ const headers = [
|
|
|
356
356
|
```javascript
|
|
357
357
|
const filters = [
|
|
358
358
|
{
|
|
359
|
-
value: 'rol', // Clave del filtro (debe coincidir con header.value)
|
|
359
|
+
value: 'rol', // Clave del filtro (debe coincidir con header.value / row key)
|
|
360
360
|
label: 'Rol', // Etiqueta visible
|
|
361
361
|
text: 'Rol', // Texto alternativo
|
|
362
362
|
name: 'roles', // Nombre para textos genéricos
|
|
363
363
|
items: [...], // Lista de opciones para el filtro
|
|
364
|
+
'item-value': 'id', // Clave de comparación (default: 'id')
|
|
364
365
|
placeholderText: 'Seleccionar rol',
|
|
365
366
|
textNoItem: 'No hay roles disponibles'
|
|
366
367
|
}
|
|
367
368
|
]
|
|
368
369
|
```
|
|
369
370
|
|
|
371
|
+
**Matching de filtros por columna:**
|
|
372
|
+
|
|
373
|
+
- Selección múltiple dentro de un filtro: **OR** (pasa si coincide alguno de los valores seleccionados).
|
|
374
|
+
- Varios filtros activos: **AND**.
|
|
375
|
+
- Celda escalar: igualdad exacta (case-insensitive) contra `item-value`.
|
|
376
|
+
- Celda array (relaciones M2M, p. ej. `price_lists`): **includes-any** — pasa si algún miembro del array tiene `item-value` (default `id`) entre los seleccionados.
|
|
377
|
+
|
|
370
378
|
**Slots:**
|
|
371
379
|
|
|
372
380
|
| Slot | Props | Descripción |
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as h, watch as M, computed as f, openBlock as l, createElementBlock as o, normalizeClass as K, toDisplayString as a, createCommentVNode as u, createElementVNode as y, mergeProps as L, renderSlot as b, unref as k, withModifiers as P, Fragment as j, renderList as x, createTextVNode as D } from "vue";
|
|
2
2
|
import { renderIconSlot as g } from "../../../../utils/renderIcon.js";
|
|
3
3
|
import { kunFileInputProps as G } from "../composables/kunFileInputProps.js";
|
|
4
|
-
const
|
|
5
|
-
key: 0,
|
|
6
|
-
class: "block text-sm font-medium mb-1"
|
|
7
|
-
}, q = { key: 0 }, H = ["multiple", "disabled"], J = { class: "flex-1 truncate" }, O = { key: 0 }, Q = {
|
|
4
|
+
const T = { class: "relative flex w-full flex-col" }, q = { key: 0 }, H = ["multiple", "disabled"], J = { class: "flex-1 truncate" }, O = { key: 0 }, Q = {
|
|
8
5
|
key: 1,
|
|
9
6
|
class: "text-gray-400"
|
|
10
7
|
}, U = { key: 0 }, W = { key: 0 }, X = { key: 1 }, Y = {
|
|
@@ -13,13 +10,13 @@ const L = { class: "relative w-full" }, T = {
|
|
|
13
10
|
}, Z = {
|
|
14
11
|
key: 0,
|
|
15
12
|
class: "text-red-500"
|
|
16
|
-
},
|
|
13
|
+
}, ee = {
|
|
17
14
|
key: 1,
|
|
18
15
|
class: "text-gray-500"
|
|
19
|
-
},
|
|
16
|
+
}, te = {
|
|
20
17
|
key: 2,
|
|
21
18
|
class: "mt-1 text-xs text-gray-400 text-right"
|
|
22
|
-
},
|
|
19
|
+
}, le = { key: 0 }, re = {
|
|
23
20
|
__name: "KunFileInput",
|
|
24
21
|
props: G,
|
|
25
22
|
emits: [
|
|
@@ -28,64 +25,70 @@ const L = { class: "relative w-full" }, T = {
|
|
|
28
25
|
"click:control",
|
|
29
26
|
"update:focused"
|
|
30
27
|
],
|
|
31
|
-
setup(
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
() =>
|
|
28
|
+
setup(_, { expose: S, emit: $ }) {
|
|
29
|
+
const i = _, c = $, B = h(null), v = h(!1), d = h([]), n = h([]);
|
|
30
|
+
M(
|
|
31
|
+
() => i.modelValue,
|
|
35
32
|
(e) => {
|
|
36
33
|
d.value = Array.isArray(e) ? e : e ? [e] : [];
|
|
37
34
|
},
|
|
38
35
|
{ immediate: !0 }
|
|
39
36
|
);
|
|
40
|
-
function
|
|
37
|
+
function z(e) {
|
|
41
38
|
const t = e.target.files;
|
|
42
39
|
if (!t) return;
|
|
43
40
|
const s = Array.from(t);
|
|
44
|
-
d.value =
|
|
41
|
+
d.value = i.multiple ? s : [s[0]], c("update:modelValue", i.multiple ? s : s[0]), I();
|
|
45
42
|
}
|
|
46
43
|
function V() {
|
|
47
|
-
d.value = [], c("update:modelValue",
|
|
44
|
+
d.value = [], c("update:modelValue", i.multiple ? [] : null), c("click:clear"), n.value = [];
|
|
48
45
|
}
|
|
49
|
-
function
|
|
46
|
+
function C() {
|
|
50
47
|
v.value = !0, c("update:focused", !0);
|
|
51
48
|
}
|
|
52
|
-
function
|
|
49
|
+
function A() {
|
|
53
50
|
v.value = !1, c("update:focused", !1);
|
|
54
51
|
}
|
|
55
|
-
const p =
|
|
56
|
-
const e = F.value, t =
|
|
57
|
-
let
|
|
58
|
-
for (;
|
|
59
|
-
|
|
60
|
-
return `${
|
|
52
|
+
const p = f(() => d.value.map((e) => e.name)), N = f(() => i.dirty || v.value || p.value.length > 0), F = f(() => d.value.reduce((e, t) => e + t.size, 0)), w = f(() => {
|
|
53
|
+
const e = F.value, t = i.showSize === 1024 ? 1024 : 1e3, s = ["B", "KB", "MB", "GB"];
|
|
54
|
+
let r = 0, m = e;
|
|
55
|
+
for (; m >= t && r < s.length - 1; )
|
|
56
|
+
m /= t, r++;
|
|
57
|
+
return `${m.toFixed(1)} ${s[r]}`;
|
|
61
58
|
});
|
|
62
59
|
async function I(e = !1) {
|
|
63
60
|
const t = [];
|
|
64
|
-
for (const s of
|
|
65
|
-
const
|
|
66
|
-
typeof
|
|
61
|
+
for (const s of i.rules) {
|
|
62
|
+
const r = typeof s == "function" ? s(i.multiple ? d.value : d.value[0]) : !0;
|
|
63
|
+
typeof r == "string" ? t.push(r) : r === !1 && t.push("Valor inválido");
|
|
67
64
|
}
|
|
68
|
-
return
|
|
65
|
+
return n.value = t, !e && t.length && c("update:focused", !0), t;
|
|
69
66
|
}
|
|
70
|
-
async function
|
|
67
|
+
async function R() {
|
|
71
68
|
V();
|
|
72
69
|
}
|
|
73
|
-
async function
|
|
74
|
-
|
|
70
|
+
async function E() {
|
|
71
|
+
n.value = [];
|
|
75
72
|
}
|
|
76
73
|
return S({
|
|
77
|
-
reset:
|
|
78
|
-
resetValidation:
|
|
74
|
+
reset: R,
|
|
75
|
+
resetValidation: E,
|
|
79
76
|
validate: I,
|
|
80
|
-
isValid:
|
|
81
|
-
errorMessages:
|
|
82
|
-
}), (e, t) => (l(), o("div",
|
|
83
|
-
e.label ? (l(), o("label",
|
|
84
|
-
|
|
77
|
+
isValid: f(() => n.value.length === 0),
|
|
78
|
+
errorMessages: n
|
|
79
|
+
}), (e, t) => (l(), o("div", T, [
|
|
80
|
+
e.label ? (l(), o("label", {
|
|
81
|
+
key: 0,
|
|
82
|
+
class: K([
|
|
83
|
+
"absolute left-2 z-10 px-1 text-black/80 transition-all duration-200 ease-in-out pointer-events-none select-none dark:text-white/80",
|
|
84
|
+
N.value ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
85
|
+
])
|
|
86
|
+
}, a(e.label), 3)) : u("", !0),
|
|
87
|
+
y("div", L({
|
|
85
88
|
class: ["flex items-center gap-2 rounded px-3 py-2 cursor-pointer transition", [
|
|
86
89
|
e.variant === "outlined" ? "border border-slate-400 dark:border-slate-600" : e.variant === "solo" ? "border-slate-400 dark:border-slate-600 shadow-inner" : "bg-surface border border-slate-400 dark:border-slate-600",
|
|
87
90
|
e.disabled ? "border-slate-400 dark:border-slate-600 cursor-not-allowed" : "hover:border-blue-500",
|
|
88
|
-
e.error ||
|
|
91
|
+
e.error || n.value.length ? "border-red-500" : "",
|
|
89
92
|
v.value ? "ring-2 ring-blue-500" : ""
|
|
90
93
|
]]
|
|
91
94
|
}, e.$attrs, {
|
|
@@ -93,11 +96,11 @@ const L = { class: "relative w-full" }, T = {
|
|
|
93
96
|
var s;
|
|
94
97
|
return (s = B.value) == null ? void 0 : s.click();
|
|
95
98
|
}),
|
|
96
|
-
onFocusin:
|
|
97
|
-
onFocusout:
|
|
99
|
+
onFocusin: C,
|
|
100
|
+
onFocusout: A
|
|
98
101
|
}), [
|
|
99
102
|
b(e.$slots, "prepend", {}, () => [
|
|
100
|
-
e.prependIcon ? (l(), o("span", q, a(k(g)(e.prependIcon)), 1)) :
|
|
103
|
+
e.prependIcon ? (l(), o("span", q, a(k(g)(e.prependIcon)), 1)) : u("", !0)
|
|
101
104
|
]),
|
|
102
105
|
y("input", {
|
|
103
106
|
ref_key: "inputRef",
|
|
@@ -106,37 +109,37 @@ const L = { class: "relative w-full" }, T = {
|
|
|
106
109
|
class: "hidden",
|
|
107
110
|
multiple: e.multiple,
|
|
108
111
|
disabled: e.disabled,
|
|
109
|
-
onChange:
|
|
112
|
+
onChange: z
|
|
110
113
|
}, null, 40, H),
|
|
111
114
|
y("div", J, [
|
|
112
115
|
b(e.$slots, "selection", {
|
|
113
116
|
fileNames: p.value,
|
|
114
117
|
totalBytes: F.value,
|
|
115
|
-
totalBytesReadable:
|
|
118
|
+
totalBytesReadable: w.value
|
|
116
119
|
}, () => [
|
|
117
120
|
p.value.length ? (l(), o("span", O, a(p.value.join(", ")), 1)) : (l(), o("span", Q, "Seleccionar archivo"))
|
|
118
121
|
])
|
|
119
122
|
]),
|
|
120
123
|
b(e.$slots, "append", {}, () => [
|
|
121
|
-
e.appendIcon ? (l(), o("span", U, a(k(g)(e.appendIcon)), 1)) :
|
|
124
|
+
e.appendIcon ? (l(), o("span", U, a(k(g)(e.appendIcon)), 1)) : u("", !0)
|
|
122
125
|
]),
|
|
123
126
|
e.clearable && p.value.length ? (l(), o("button", {
|
|
124
127
|
key: 0,
|
|
125
|
-
onClick:
|
|
126
|
-
class: "text-gray-500 hover:text-red-500"
|
|
128
|
+
onClick: P(V, ["stop"]),
|
|
129
|
+
class: "cursor-pointer text-gray-500 hover:text-red-500"
|
|
127
130
|
}, [
|
|
128
131
|
e.clearIcon ? (l(), o("span", W, a(k(g)(e.clearIcon)), 1)) : (l(), o("span", X, "✕"))
|
|
129
|
-
])) :
|
|
132
|
+
])) : u("", !0)
|
|
130
133
|
], 16),
|
|
131
|
-
e.hint ||
|
|
132
|
-
|
|
133
|
-
(l(!0), o(
|
|
134
|
-
])) : e.hint ? (l(), o("div",
|
|
135
|
-
])) :
|
|
136
|
-
e.counter ? (l(), o("div",
|
|
134
|
+
e.hint || n.value.length ? (l(), o("div", Y, [
|
|
135
|
+
n.value.length ? (l(), o("div", Z, [
|
|
136
|
+
(l(!0), o(j, null, x(n.value, (s, r) => (l(), o("div", { key: r }, a(s), 1))), 128))
|
|
137
|
+
])) : e.hint ? (l(), o("div", ee, a(e.hint), 1)) : u("", !0)
|
|
138
|
+
])) : u("", !0),
|
|
139
|
+
e.counter ? (l(), o("div", te, [
|
|
137
140
|
D(a(e.counterString ?? `${p.value.length} archivo(s)`) + " ", 1),
|
|
138
|
-
e.showSize ? (l(), o("span",
|
|
139
|
-
])) :
|
|
141
|
+
e.showSize ? (l(), o("span", le, " — " + a(w.value), 1)) : u("", !0)
|
|
142
|
+
])) : u("", !0)
|
|
140
143
|
]));
|
|
141
144
|
}
|
|
142
145
|
};
|
|
@@ -74,13 +74,13 @@ const E = { class: "w-full" }, I = { class: "flex justify-end px-1" }, K = { cla
|
|
|
74
74
|
"onUpdate:modelValue": (s) => i.value[e.value] = s,
|
|
75
75
|
items: e.items,
|
|
76
76
|
"z-index": "z-250",
|
|
77
|
-
"item-value": "id",
|
|
77
|
+
"item-value": e["item-value"] ?? "id",
|
|
78
78
|
"item-title": e.title ?? e.text,
|
|
79
|
-
"item-text":
|
|
79
|
+
"item-text": e.text,
|
|
80
80
|
label: e.label ?? "",
|
|
81
81
|
"text-no-items": e.textNoItem ?? `No hay ${e.name ?? "elementos"} disponibles`,
|
|
82
82
|
"placeholder-text": e.placeholderText ?? "Seleccionar"
|
|
83
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "items", "item-title", "label", "text-no-items", "placeholder-text"])
|
|
83
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "items", "item-value", "item-title", "item-text", "label", "text-no-items", "placeholder-text"])
|
|
84
84
|
]),
|
|
85
85
|
_: 2
|
|
86
86
|
}, 1024))), 256))
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { reactive as
|
|
2
|
-
import { debounce as
|
|
3
|
-
import { getValue as
|
|
4
|
-
function
|
|
5
|
-
const u =
|
|
1
|
+
import { reactive as H, ref as S, computed as V, unref as f, watch as O } from "vue";
|
|
2
|
+
import { debounce as J } from "../../../../utils/utils.js";
|
|
3
|
+
import { getValue as E, formatValue as N } from "../../../../utils/tableFormatters.js";
|
|
4
|
+
function Y(d, L, M, i = !1) {
|
|
5
|
+
const u = H({
|
|
6
6
|
search: "",
|
|
7
7
|
// Búsqueda global
|
|
8
8
|
byColumn: {}
|
|
9
9
|
// Mapa columna -> valor
|
|
10
|
-
}), { items: m, customFilter:
|
|
10
|
+
}), { items: m, customFilter: j, searchableKeys: x, headers: Q } = d, T = S(!1), h = (e) => {
|
|
11
11
|
if (e == null) return "";
|
|
12
12
|
if (typeof e == "string") return e;
|
|
13
13
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -26,90 +26,92 @@ function Q(F, E, L, i = !1) {
|
|
|
26
26
|
} catch {
|
|
27
27
|
return "";
|
|
28
28
|
}
|
|
29
|
-
},
|
|
30
|
-
const
|
|
31
|
-
return t ?
|
|
32
|
-
}, p =
|
|
33
|
-
const e = f(
|
|
29
|
+
}, K = (e, r) => {
|
|
30
|
+
const a = h(e).toLowerCase(), t = h(r).toLowerCase();
|
|
31
|
+
return t ? a === t : !0;
|
|
32
|
+
}, p = V(() => M.value ?? []), g = V(() => {
|
|
33
|
+
const e = f(x);
|
|
34
34
|
return Array.isArray(e) && e.length ? e : p.value.map((r) => r == null ? void 0 : r.value).filter(Boolean);
|
|
35
|
-
}), C =
|
|
36
|
-
function
|
|
35
|
+
}), C = S(/* @__PURE__ */ new Map());
|
|
36
|
+
function A() {
|
|
37
37
|
C.value.clear();
|
|
38
38
|
const e = f(m);
|
|
39
39
|
Array.isArray(e) && (e.forEach((r) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
const a = {};
|
|
41
|
+
g.value.forEach((t) => {
|
|
42
42
|
const n = p.value.find((l) => l.value === t);
|
|
43
|
-
let
|
|
43
|
+
let o, c;
|
|
44
44
|
try {
|
|
45
|
-
|
|
45
|
+
o = n ? E(n, r) : r[t];
|
|
46
46
|
} catch (l) {
|
|
47
|
-
|
|
47
|
+
o = "", i && console.error("[useFilter] ERROR getValue", { item: r, key: t, err: l });
|
|
48
48
|
}
|
|
49
49
|
try {
|
|
50
|
-
c = n ?
|
|
50
|
+
c = n ? N(n, o) : o;
|
|
51
51
|
} catch (l) {
|
|
52
|
-
c =
|
|
52
|
+
c = o, i && console.error("[useFilter] ERROR formatValue", { header: n, raw: o, err: l });
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
}), C.value.set(r,
|
|
54
|
+
a[t] = h(c).toLowerCase();
|
|
55
|
+
}), C.value.set(r, a);
|
|
56
56
|
}), i && console.log("[useFilter] Cache reconstruida", C.value));
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
O(() => f(m), () => A(), { immediate: !0 }), O(() => {
|
|
59
59
|
var e;
|
|
60
60
|
return (e = f(m)) == null ? void 0 : e.length;
|
|
61
|
-
}, () =>
|
|
62
|
-
const
|
|
63
|
-
const t =
|
|
61
|
+
}, () => A());
|
|
62
|
+
const I = (e, r, a) => {
|
|
63
|
+
const t = w(e, r), n = f(j);
|
|
64
64
|
if (typeof n == "function") {
|
|
65
|
-
const
|
|
65
|
+
const s = p.value.find((y) => (y == null ? void 0 : y.value) === r);
|
|
66
66
|
try {
|
|
67
|
-
return n(e, r,
|
|
68
|
-
} catch (
|
|
69
|
-
return i && console.error("[matchesFilter] ERROR customFilter", { item: e, key: r, value:
|
|
67
|
+
return n(e, r, a, s);
|
|
68
|
+
} catch (y) {
|
|
69
|
+
return i && console.error("[matchesFilter] ERROR customFilter", { item: e, key: r, value: a, header: s, err: y }), !1;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
const
|
|
73
|
-
return
|
|
74
|
-
|
|
72
|
+
const o = f(d.filters) ?? d.filters, c = Array.isArray(o) ? o.find((s) => s.value === r) : void 0, l = (c == null ? void 0 : c["item-value"]) ?? "id", F = (s) => s != null && typeof s == "object" ? s[l] : s, R = (s) => s != null && typeof s == "object" && !Array.isArray(s) ? s[l] : s, b = (Array.isArray(a) ? a : [a]).map(F), G = Array.isArray(t) ? t.map(R) : [t];
|
|
73
|
+
return b.some(
|
|
74
|
+
(s) => G.some((y) => K(y, s))
|
|
75
|
+
);
|
|
76
|
+
}, q = V(() => {
|
|
75
77
|
const e = f(m);
|
|
76
78
|
return Array.isArray(e) ? e.filter((r) => {
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
const t =
|
|
79
|
+
const a = u.search;
|
|
80
|
+
if (a) {
|
|
81
|
+
const t = a.split(/\s+/).filter((n) => n.length > 0);
|
|
80
82
|
if (t.length > 0) {
|
|
81
83
|
const n = C.value.get(r);
|
|
82
84
|
if (n) {
|
|
83
85
|
if (!t.every((c) => Object.values(n).some((l) => l.includes(c)))) return !1;
|
|
84
86
|
} else {
|
|
85
|
-
const
|
|
86
|
-
if (!t.every((l) =>
|
|
87
|
-
const
|
|
88
|
-
return
|
|
87
|
+
const o = g.value;
|
|
88
|
+
if (!t.every((l) => o.some((F) => {
|
|
89
|
+
const R = w(r, F);
|
|
90
|
+
return h(R).toLowerCase().includes(l);
|
|
89
91
|
}))) return !1;
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
for (const t in u.byColumn) {
|
|
94
|
-
const n = u.byColumn[t],
|
|
95
|
-
if (n != null && n !== "" && !
|
|
96
|
+
const n = u.byColumn[t], o = Array.isArray(n) && n.length === 0;
|
|
97
|
+
if (n != null && n !== "" && !o && !I(r, t, n)) return !1;
|
|
96
98
|
}
|
|
97
99
|
return !0;
|
|
98
100
|
}) : [];
|
|
99
|
-
}),
|
|
100
|
-
u.search =
|
|
101
|
-
}, f(
|
|
101
|
+
}), B = J((e) => {
|
|
102
|
+
u.search = h(e).toLowerCase(), i && console.log("[setSearch]", u.search);
|
|
103
|
+
}, f(L) ?? 150), P = (e, r) => {
|
|
102
104
|
u.byColumn[e] = r, i && console.log("[setColumnFilter]", e, r);
|
|
103
|
-
},
|
|
104
|
-
for (const r in e)
|
|
105
|
+
}, z = (e) => {
|
|
106
|
+
for (const r in e) P(r, e[r]);
|
|
105
107
|
i && console.log("[applyColumnFilters]", e);
|
|
106
|
-
},
|
|
108
|
+
}, D = () => {
|
|
107
109
|
u.search = "", u.byColumn = {}, i && console.log("[clearFilters] filtros reseteados");
|
|
108
|
-
},
|
|
110
|
+
}, w = (e, r) => {
|
|
109
111
|
if (Object.prototype.hasOwnProperty.call(e, r)) return e[r];
|
|
110
|
-
const
|
|
112
|
+
const a = p.value.find((t) => (t == null ? void 0 : t.value) === r);
|
|
111
113
|
try {
|
|
112
|
-
return
|
|
114
|
+
return a ? E(a, e) : e[r];
|
|
113
115
|
} catch (t) {
|
|
114
116
|
return i && console.error("[useFilter] ERROR getRawValue", { item: e, key: r, err: t }), null;
|
|
115
117
|
}
|
|
@@ -117,14 +119,14 @@ function Q(F, E, L, i = !1) {
|
|
|
117
119
|
return {
|
|
118
120
|
modalFilter: T,
|
|
119
121
|
appliedFilters: u,
|
|
120
|
-
filteredItems:
|
|
121
|
-
setSearch:
|
|
122
|
-
applyColumnFilters:
|
|
123
|
-
clearFilters:
|
|
122
|
+
filteredItems: q,
|
|
123
|
+
setSearch: B,
|
|
124
|
+
applyColumnFilters: z,
|
|
125
|
+
clearFilters: D,
|
|
124
126
|
// 👇 Exponemos también por si querés refrescar manualmente
|
|
125
|
-
refreshCache:
|
|
127
|
+
refreshCache: A
|
|
126
128
|
};
|
|
127
129
|
}
|
|
128
130
|
export {
|
|
129
|
-
|
|
131
|
+
Y as default
|
|
130
132
|
};
|