adverich-kun-ui 0.1.464 → 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,11 +1,11 @@
1
- import { reactive as I, ref as K, computed as f, unref as u, watch as R } from "vue";
2
- import { debounce as j } from "../../../../utils/utils.js";
3
- import { getValue as q, formatValue as x } from "../../../../utils/tableFormatters.js";
4
- function E(b, d) {
5
- const a = I({
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: y, customFilter: g, searchableKeys: C, headers: S } = b, F = K(!1), c = (e) => {
8
+ }), { items: m, customFilter: F, searchableKeys: b, headers: V } = p, R = E(!1), u = (e) => {
9
9
  if (e == null) return "";
10
10
  if (typeof e == "string") return e;
11
11
  if (typeof e == "number" || typeof e == "boolean") return String(e);
@@ -24,59 +24,100 @@ function E(b, d) {
24
24
  } catch {
25
25
  return "";
26
26
  }
27
- }, m = (e, r) => {
28
- const t = c(e).toLowerCase(), n = c(r).toLowerCase();
29
- return n ? t ? t.includes(n) : !1 : !0;
30
- }, i = f(() => u(S) ?? []), h = f(() => {
31
- const e = u(C);
32
- return Array.isArray(e) && e.length ? e : i.value.map((r) => r == null ? void 0 : r.value).filter(Boolean);
33
- }), w = (e, r) => {
34
- const t = i.value.find((s) => (s == null ? void 0 : s.value) === r);
35
- if (!t) return e == null ? void 0 : e[r];
36
- const n = q(t, e), o = x(t, n);
37
- return c(o);
38
- }, p = (e, r, t) => {
39
- const n = w(e, r), o = u(g);
40
- if (typeof o == "function") {
41
- const s = i.value.find((l) => (l == null ? void 0 : l.value) === r);
42
- return o(e, r, t, s);
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;
43
39
  }
44
- return Array.isArray(t) ? t.some((s) => m(n, s)) : m(n, t);
45
- }, A = f(() => {
46
- const e = u(y);
47
- return Array.isArray(e) ? e.filter((r) => {
48
- const t = a.search;
49
- if (t && !h.value.some((s) => p(r, s, t)))
50
- return !1;
51
- for (const n in a.byColumn) {
52
- const o = a.byColumn[n];
53
- if (o != null && o !== "" && !p(r, n, o))
54
- return !1;
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;
55
93
  }
56
- return !0;
57
- }) : [];
58
- }), k = j((e) => {
59
- a.search = c(e).toLowerCase();
60
- }, u(d) ?? 150), V = (e, r) => {
61
- a.byColumn[e] = r;
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;
62
101
  };
63
- function L(e) {
64
- for (const r in e)
65
- V(r, e[r]);
102
+ function D(e) {
103
+ console.log("[applyColumnFilters] aplicando:", e);
104
+ for (const t in e)
105
+ w(t, e[t]);
66
106
  }
67
- const D = () => {
68
- a.search = "", a.byColumn = {};
107
+ const L = () => {
108
+ console.log("[clearFilters] reseteando filtros"), c.search = "", c.byColumn = {};
69
109
  };
70
- return R(() => u(y), () => {
110
+ return N(() => i(m), (e, t) => {
111
+ console.log("[watch items] old:", t, "new:", e);
71
112
  }, { deep: !0 }), {
72
- modalFilter: F,
73
- appliedFilters: a,
113
+ modalFilter: R,
114
+ appliedFilters: c,
74
115
  filteredItems: A,
75
- setSearch: k,
76
- applyColumnFilters: L,
77
- clearFilters: D
116
+ setSearch: C,
117
+ applyColumnFilters: D,
118
+ clearFilters: L
78
119
  };
79
120
  }
80
121
  export {
81
- E as default
122
+ q as default
82
123
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.464",
3
+ "version": "0.1.465",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",