adverich-kun-ui 0.1.483 → 0.1.484

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,4 +1,4 @@
1
- import { computed as k, ref as g, onMounted as C, createBlock as x, createCommentVNode as $, openBlock as d, withCtx as l, createElementVNode as c, createVNode as o, createElementBlock as N, Fragment as b, renderList as h, createTextVNode as V } from "vue";
1
+ import { computed as k, ref as b, onMounted as g, createBlock as x, createCommentVNode as C, openBlock as d, withCtx as l, createElementVNode as c, createVNode as o, createElementBlock as $, Fragment as N, renderList as h, createTextVNode as V } from "vue";
2
2
  import z from "../../../KunDialog/src/components/KunDialog.vue.js";
3
3
  import B from "../../../KunRow/src/components/KunRow.vue.js";
4
4
  import j from "../../../KunCol/src/components/KunCol.vue.js";
@@ -18,8 +18,8 @@ const A = { class: "w-full" }, D = { class: "flex justify-end px-1" }, E = { cla
18
18
  const n = f, i = v, m = k({
19
19
  get: () => n.modelValue,
20
20
  set: (a) => i("update:modelValue", a)
21
- }), s = g({});
22
- C(() => {
21
+ }), s = b({});
22
+ g(() => {
23
23
  s.value = { ...n.filters.reduce((a, t) => {
24
24
  var _;
25
25
  const e = t.key, r = (_ = n.activeFilters) == null ? void 0 : _[e];
@@ -63,7 +63,7 @@ const A = { class: "w-full" }, D = { class: "flex justify-end px-1" }, E = { cla
63
63
  ]),
64
64
  o(B, null, {
65
65
  default: l(() => [
66
- (d(!0), N(b, null, h(f.filters, (e) => (d(), x(j, {
66
+ (d(!0), $(N, null, h(f.filters, (e) => (d(), x(j, {
67
67
  cols: "4",
68
68
  class: "px-2"
69
69
  }, {
@@ -77,9 +77,10 @@ const A = { class: "w-full" }, D = { class: "flex justify-end px-1" }, E = { cla
77
77
  "item-value": "id",
78
78
  "item-title": e.title ?? e.text,
79
79
  "item-text": "filter.text",
80
+ label: e.label ?? "",
80
81
  "text-no-items": e.textNoItem ?? `No hay ${e.name ?? "elementos"} disponibles`,
81
82
  "placeholder-text": e.placeholderText ?? "Seleccionar"
82
- }, null, 8, ["modelValue", "onUpdate:modelValue", "items", "item-title", "text-no-items", "placeholder-text"])
83
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "items", "item-title", "label", "text-no-items", "placeholder-text"])
83
84
  ]),
84
85
  _: 2
85
86
  }, 1024))), 256))
@@ -105,7 +106,7 @@ const A = { class: "w-full" }, D = { class: "flex justify-end px-1" }, E = { cla
105
106
  ])
106
107
  ]),
107
108
  _: 1
108
- }, 8, ["modelValue"])) : $("", !0);
109
+ }, 8, ["modelValue"])) : C("", !0);
109
110
  }
110
111
  };
111
112
  export {
@@ -1,11 +1,11 @@
1
- import { reactive as j, ref as S, computed as C, unref as i, watch as d } from "vue";
2
- import { debounce as q } from "../../../../utils/utils.js";
3
- import { getValue as x, formatValue as B } from "../../../../utils/tableFormatters.js";
4
- function P(b, w, A, l = !1) {
5
- const a = j({
1
+ import { reactive as G, ref as A, computed as p, unref as i, watch as V } from "vue";
2
+ import { debounce as H } from "../../../../utils/utils.js";
3
+ import { getValue as E, formatValue as J } from "../../../../utils/tableFormatters.js";
4
+ function U(C, L, O, l = !1) {
5
+ const c = G({
6
6
  search: "",
7
7
  byColumn: {}
8
- }), { items: f, customFilter: V, searchableKeys: E, headers: M } = b, L = S(!1), m = (e) => {
8
+ }), { items: m, customFilter: K, searchableKeys: j, headers: N } = C, x = A(!1), h = (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,87 +24,91 @@ function P(b, w, A, l = !1) {
24
24
  } catch {
25
25
  return "";
26
26
  }
27
- }, F = (e, r) => {
28
- const t = m(e).toLowerCase(), o = m(r).toLowerCase();
29
- return o ? t ? t.includes(o) : !1 : !0;
30
- }, h = C(() => A.value ?? []), g = C(() => {
31
- const e = i(E);
32
- return Array.isArray(e) && e.length ? e : h.value.map((r) => r == null ? void 0 : r.value).filter(Boolean);
33
- }), y = S(/* @__PURE__ */ new Map());
34
- function p() {
35
- y.value.clear();
36
- const e = i(f);
27
+ }, g = (e, r) => {
28
+ const n = h(e).toLowerCase(), t = h(r).toLowerCase();
29
+ return t ? n ? n.includes(t) : !1 : !0;
30
+ }, F = p(() => O.value ?? []), w = p(() => {
31
+ const e = i(j);
32
+ return Array.isArray(e) && e.length ? e : F.value.map((r) => r == null ? void 0 : r.value).filter(Boolean);
33
+ }), d = A(/* @__PURE__ */ new Map());
34
+ function R() {
35
+ d.value.clear();
36
+ const e = i(m);
37
37
  Array.isArray(e) && (e.forEach((r) => {
38
- const t = {};
39
- g.value.forEach((o) => {
40
- const n = h.value.find((u) => u.value === o);
41
- let s, c;
38
+ const n = {};
39
+ w.value.forEach((t) => {
40
+ const o = F.value.find((f) => f.value === t);
41
+ let s, u;
42
42
  try {
43
- s = n ? x(n, r) : r[o];
44
- } catch (u) {
45
- s = "", l && console.error("[useFilter] ERROR getValue", { item: r, key: o, err: u });
43
+ s = o ? E(o, r) : r[t];
44
+ } catch (f) {
45
+ s = "", l && console.error("[useFilter] ERROR getValue", { item: r, key: t, err: f });
46
46
  }
47
47
  try {
48
- c = n ? B(n, s) : s;
49
- } catch (u) {
50
- c = s, l && console.error("[useFilter] ERROR formatValue", { header: n, raw: s, err: u });
48
+ u = o ? J(o, s) : s;
49
+ } catch (f) {
50
+ u = s, l && console.error("[useFilter] ERROR formatValue", { header: o, raw: s, err: f });
51
51
  }
52
- t[o] = m(c).toLowerCase();
53
- }), y.value.set(r, t);
54
- }), l && console.log("[useFilter] Cache reconstruida", y.value));
52
+ n[t] = h(u).toLowerCase();
53
+ }), d.value.set(r, n);
54
+ }), l && console.log("[useFilter] Cache reconstruida", d.value));
55
55
  }
56
- d(() => i(f), () => p(), { immediate: !0 }), d(() => {
56
+ V(() => i(m), () => R(), { immediate: !0 }), V(() => {
57
57
  var e;
58
- return (e = i(f)) == null ? void 0 : e.length;
59
- }, () => p());
60
- const O = (e, r) => {
61
- var o;
62
- const t = ((o = y.value.get(e)) == null ? void 0 : o[r]) ?? "";
63
- return l && console.log("[getDisplayValue]", { item: e, key: r, val: t }), t;
64
- }, R = (e, r, t) => {
65
- const o = O(e, r), n = i(V);
66
- if (typeof n == "function") {
67
- const s = h.value.find((c) => (c == null ? void 0 : c.value) === r);
58
+ return (e = i(m)) == null ? void 0 : e.length;
59
+ }, () => R());
60
+ const S = (e, r, n) => {
61
+ const t = D(e, r), o = i(K);
62
+ if (typeof o == "function") {
63
+ const a = F.value.find((y) => (y == null ? void 0 : y.value) === r);
68
64
  try {
69
- return n(e, r, t, s);
70
- } catch (c) {
71
- return l && console.error("[matchesFilter] ERROR customFilter", { item: e, key: r, value: t, header: s, err: c }), !1;
65
+ return o(e, r, n, a);
66
+ } catch (y) {
67
+ return l && console.error("[matchesFilter] ERROR customFilter", { item: e, key: r, value: n, header: a, err: y }), !1;
72
68
  }
73
69
  }
74
- return Array.isArray(t) ? t.some((s) => F(o, s)) : F(o, t);
75
- }, D = C(() => {
76
- const e = i(f);
70
+ const s = i(C.filters) ?? C.filters, u = Array.isArray(s) ? s.find((a) => a.value === r) : void 0, f = (u == null ? void 0 : u["item-value"]) ?? "id", b = (a) => a != null && typeof a == "object" ? a[f] : a;
71
+ return Array.isArray(n) ? n.some((a) => g(t, b(a))) : g(t, b(n));
72
+ }, I = p(() => {
73
+ const e = i(m);
77
74
  return Array.isArray(e) ? e.filter((r) => {
78
- const t = a.search;
79
- if (t && !g.value.some((s) => R(r, s, t)))
75
+ const n = c.search;
76
+ if (n && !w.value.some((s) => S(r, s, n)))
80
77
  return !1;
81
- for (const o in a.byColumn) {
82
- const n = a.byColumn[o];
83
- if (n != null && n !== "" && !R(r, o, n)) return !1;
78
+ for (const t in c.byColumn) {
79
+ const o = c.byColumn[t];
80
+ if (o != null && o !== "" && !S(r, t, o)) return !1;
84
81
  }
85
82
  return !0;
86
83
  }) : [];
87
- }), I = q((e) => {
88
- a.search = m(e).toLowerCase(), l && console.log("[setSearch]", a.search);
89
- }, i(w) ?? 150), K = (e, r) => {
90
- a.byColumn[e] = r, l && console.log("[setColumnFilter]", e, r);
84
+ }), q = H((e) => {
85
+ c.search = h(e).toLowerCase(), l && console.log("[setSearch]", c.search);
86
+ }, i(L) ?? 150), B = (e, r) => {
87
+ c.byColumn[e] = r, l && console.log("[setColumnFilter]", e, r);
88
+ }, M = (e) => {
89
+ for (const r in e) B(r, e[r]);
90
+ l && console.log("[applyColumnFilters]", e);
91
+ }, z = () => {
92
+ c.search = "", c.byColumn = {}, l && console.log("[clearFilters] filtros reseteados");
93
+ }, D = (e, r) => {
94
+ const n = F.value.find((t) => (t == null ? void 0 : t.value) === r);
95
+ try {
96
+ return n ? E(n, e) : e[r];
97
+ } catch (t) {
98
+ return l && console.error("[useFilter] ERROR getRawValue", { item: e, key: r, err: t }), null;
99
+ }
91
100
  };
92
101
  return {
93
- modalFilter: L,
94
- appliedFilters: a,
95
- filteredItems: D,
96
- setSearch: I,
97
- applyColumnFilters: (e) => {
98
- for (const r in e) K(r, e[r]);
99
- l && console.log("[applyColumnFilters]", e);
100
- },
101
- clearFilters: () => {
102
- a.search = "", a.byColumn = {}, l && console.log("[clearFilters] filtros reseteados");
103
- },
102
+ modalFilter: x,
103
+ appliedFilters: c,
104
+ filteredItems: I,
105
+ setSearch: q,
106
+ applyColumnFilters: M,
107
+ clearFilters: z,
104
108
  // 👇 Exponemos también por si querés refrescar manualmente
105
- refreshCache: p
109
+ refreshCache: R
106
110
  };
107
111
  }
108
112
  export {
109
- P as default
113
+ U as default
110
114
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.483",
3
+ "version": "0.1.484",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",