adverich-kun-ui 0.1.463 → 0.1.465
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.
|
@@ -1,50 +1,123 @@
|
|
|
1
|
-
import { reactive as
|
|
2
|
-
import { debounce as
|
|
3
|
-
import { getValue as
|
|
4
|
-
function
|
|
5
|
-
const
|
|
1
|
+
import { reactive as O, ref as E, computed as g, unref as i, watch as N } from "vue";
|
|
2
|
+
import { debounce as K } from "../../../../utils/utils.js";
|
|
3
|
+
import { getValue as T, formatValue as k } from "../../../../utils/tableFormatters.js";
|
|
4
|
+
function q(p, h) {
|
|
5
|
+
const c = O({
|
|
6
6
|
search: "",
|
|
7
7
|
byColumn: {}
|
|
8
|
-
}), { items:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const t = n.byColumn[r];
|
|
22
|
-
if (t != null && t !== "" && !i(e, r, t))
|
|
23
|
-
return !1;
|
|
8
|
+
}), { items: m, customFilter: F, searchableKeys: b, headers: V } = p, R = E(!1), u = (e) => {
|
|
9
|
+
if (e == null) return "";
|
|
10
|
+
if (typeof e == "string") return e;
|
|
11
|
+
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
12
|
+
if (e instanceof Date) return e.toISOString();
|
|
13
|
+
if (typeof e == "object") {
|
|
14
|
+
if ("label" in e) return String(e.label);
|
|
15
|
+
if ("name" in e) return String(e.name);
|
|
16
|
+
try {
|
|
17
|
+
return String(e);
|
|
18
|
+
} catch {
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
try {
|
|
23
|
+
return String(e);
|
|
24
|
+
} catch {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
}, d = (e, t) => {
|
|
28
|
+
const r = u(e).toLowerCase(), l = u(t).toLowerCase();
|
|
29
|
+
return l ? r ? r.includes(l) : !1 : !0;
|
|
30
|
+
}, f = g(() => i(V) ?? []), I = g(() => {
|
|
31
|
+
const e = i(b);
|
|
32
|
+
return Array.isArray(e) && e.length ? e : f.value.map((t) => t == null ? void 0 : t.value).filter(Boolean);
|
|
33
|
+
}), S = (e, t) => {
|
|
34
|
+
console.log("[getDisplayValue] START → key:", t, "item:", e);
|
|
35
|
+
const r = f.value.find((o) => (o == null ? void 0 : o.value) === t);
|
|
36
|
+
if (console.log("[getDisplayValue] header encontrado:", r), !r) {
|
|
37
|
+
const o = e == null ? void 0 : e[t];
|
|
38
|
+
return console.log("[getDisplayValue] SIN header, devuelvo item[key]:", o), o;
|
|
39
|
+
}
|
|
40
|
+
let l, a;
|
|
41
|
+
try {
|
|
42
|
+
l = T(r, e), console.log("[getDisplayValue] raw value de getValue:", l);
|
|
43
|
+
} catch (o) {
|
|
44
|
+
console.error("[getDisplayValue] ERROR en getValue", { header: r, item: e, err: o });
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
a = k(r, l), console.log("[getDisplayValue] shown value de formatValue:", a);
|
|
48
|
+
} catch (o) {
|
|
49
|
+
console.error("[getDisplayValue] ERROR en formatValue", { header: r, raw: l, err: o });
|
|
50
|
+
}
|
|
51
|
+
const s = u(a);
|
|
52
|
+
return console.log("[getDisplayValue] FINAL stringified:", s), s;
|
|
53
|
+
}, y = (e, t, r) => {
|
|
54
|
+
console.log("[matchesFilter] item:", e, "key:", t, "filter value:", r);
|
|
55
|
+
const l = S(e, t);
|
|
56
|
+
console.log("[matchesFilter] itemValue obtenido:", l);
|
|
57
|
+
const a = i(F);
|
|
58
|
+
if (typeof a == "function") {
|
|
59
|
+
console.log("[matchesFilter] customFilter detectado, llamando...");
|
|
60
|
+
const o = f.value.find((n) => (n == null ? void 0 : n.value) === t);
|
|
61
|
+
try {
|
|
62
|
+
const n = a(e, t, r, o);
|
|
63
|
+
return console.log("[matchesFilter] customFilter result:", n), n;
|
|
64
|
+
} catch (n) {
|
|
65
|
+
return console.error("[matchesFilter] ERROR en customFilter", { item: e, key: t, value: r, header: o, err: n }), !1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (Array.isArray(r)) {
|
|
69
|
+
console.log("[matchesFilter] value es array, evaluando...");
|
|
70
|
+
const o = r.some((n) => d(l, n));
|
|
71
|
+
return console.log("[matchesFilter] array filter result:", o), o;
|
|
72
|
+
}
|
|
73
|
+
const s = d(l, r);
|
|
74
|
+
return console.log("[matchesFilter] default filter result:", s), s;
|
|
75
|
+
}, A = g(() => {
|
|
76
|
+
const e = i(m);
|
|
77
|
+
if (console.log("[filteredItems] recompute → items length:", Array.isArray(e) ? e.length : "NO ARRAY"), !Array.isArray(e)) return [];
|
|
78
|
+
const t = e.filter((r, l) => {
|
|
79
|
+
console.log(`
|
|
80
|
+
[filteredItems] --- Evaluando item idx:`, l, r);
|
|
81
|
+
const a = c.search;
|
|
82
|
+
if (a) {
|
|
83
|
+
console.log("[filteredItems] search activo:", a);
|
|
84
|
+
const s = I.value;
|
|
85
|
+
console.log("[filteredItems] searchableKeys:", s);
|
|
86
|
+
const o = s.some((n) => y(r, n, a));
|
|
87
|
+
if (console.log("[filteredItems] resultado filtro global:", o), !o) return !1;
|
|
88
|
+
}
|
|
89
|
+
for (const s in c.byColumn) {
|
|
90
|
+
const o = c.byColumn[s];
|
|
91
|
+
if (o != null && o !== "" && (console.log("[filteredItems] columna con filtro:", s, "value:", o), !y(r, s, o)))
|
|
92
|
+
return console.log("[filteredItems] filtro por columna NO pasó"), !1;
|
|
93
|
+
}
|
|
94
|
+
return console.log("[filteredItems] item pasó todos los filtros ✅"), !0;
|
|
95
|
+
});
|
|
96
|
+
return console.log("[filteredItems] RESULT FINAL →", t), t;
|
|
97
|
+
}), C = K((e) => {
|
|
98
|
+
console.log("[setSearch] nuevo valor:", e), c.search = u(e).toLowerCase();
|
|
99
|
+
}, i(h) ?? 150), w = (e, t) => {
|
|
100
|
+
console.log("[setColumnFilter] key:", e, "value:", t), c.byColumn[e] = t;
|
|
30
101
|
};
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
102
|
+
function D(e) {
|
|
103
|
+
console.log("[applyColumnFilters] aplicando:", e);
|
|
104
|
+
for (const t in e)
|
|
105
|
+
w(t, e[t]);
|
|
34
106
|
}
|
|
35
|
-
const
|
|
36
|
-
|
|
107
|
+
const L = () => {
|
|
108
|
+
console.log("[clearFilters] reseteando filtros"), c.search = "", c.byColumn = {};
|
|
37
109
|
};
|
|
38
|
-
return
|
|
110
|
+
return N(() => i(m), (e, t) => {
|
|
111
|
+
console.log("[watch items] old:", t, "new:", e);
|
|
39
112
|
}, { deep: !0 }), {
|
|
40
|
-
modalFilter:
|
|
41
|
-
appliedFilters:
|
|
42
|
-
filteredItems:
|
|
113
|
+
modalFilter: R,
|
|
114
|
+
appliedFilters: c,
|
|
115
|
+
filteredItems: A,
|
|
43
116
|
setSearch: C,
|
|
44
|
-
applyColumnFilters:
|
|
45
|
-
clearFilters:
|
|
117
|
+
applyColumnFilters: D,
|
|
118
|
+
clearFilters: L
|
|
46
119
|
};
|
|
47
120
|
}
|
|
48
121
|
export {
|
|
49
|
-
|
|
122
|
+
q as default
|
|
50
123
|
};
|