adverich-kun-ui 0.1.464 → 0.1.466

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 { mergeModels as W, toRefs as be, useModel as Ce, ref as v, watch as Q, computed as q, onMounted as Te, createElementBlock as r, openBlock as l, mergeProps as V, createCommentVNode as u, createElementVNode as O, renderSlot as a, createBlock as b, unref as s, normalizeClass as C, withCtx as j, createVNode as T, withDirectives as G, vModelText as Fe, vShow as J, normalizeProps as d, guardReactiveProps as g, Fragment as $e, createSlots as X, renderList as Y, toDisplayString as ke, isRef as Pe, nextTick as Me } from "vue";
1
+ import { mergeModels as W, toRefs as be, useModel as Ce, ref as v, watch as Q, computed as q, onMounted as Te, createElementBlock as r, openBlock as l, mergeProps as O, createCommentVNode as u, createElementVNode as j, renderSlot as a, createBlock as b, unref as s, normalizeClass as C, withCtx as x, createVNode as T, withDirectives as G, vModelText as Fe, vShow as J, normalizeProps as d, guardReactiveProps as g, Fragment as $e, createSlots as X, renderList as Y, toDisplayString as ke, isRef as Pe, nextTick as Me } from "vue";
2
2
  import { isMobile as m } from "../../../../utils/_platform.js";
3
3
  import Z from "../../../KunIcon/src/components/KunIcon.vue.js";
4
4
  import Ae from "../../../../icons/IconFilter.vue.js";
@@ -27,40 +27,25 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto bg-surface" }, U
27
27
  selectedItemsModifiers: {}
28
28
  }),
29
29
  emits: /* @__PURE__ */ W(["update:page", "update:itemsPerPage", "update:sortBy", "update:search", "focusOnSearch"], ["update:selectedItems"]),
30
- setup(x, { emit: _ }) {
31
- const S = _, p = x, F = be(p), ee = Ce(x, "selectedItems"), {
32
- headers: z,
30
+ setup(z, { emit: _ }) {
31
+ const S = _, p = z, F = be(p), ee = Ce(z, "selectedItems"), {
32
+ headers: D,
33
33
  showExpand: $,
34
34
  showSelect: k,
35
- rowClass: D,
35
+ rowClass: H,
36
36
  hideDefaultFooter: se,
37
37
  hideDefaultHeader: oe,
38
38
  tableClass: te,
39
39
  wrapperClass: le,
40
40
  pageOptions: ae,
41
41
  items: ne,
42
- searchable: H,
42
+ searchable: N,
43
43
  debounceTime: re
44
44
  } = F, w = v(p.search);
45
45
  Q(() => p.search, (e) => {
46
46
  e !== w.value && (w.value = e);
47
47
  });
48
- const { filteredItems: ie, setSearch: ce, modalFilter: y, applyColumnFilters: ue, clearFilters: de, appliedFilters: pe } = He(F, re);
49
- Q(w, (e) => {
50
- S("update:search", e), ce(e);
51
- });
52
- const { options: i, paginatedItems: f, updateSort: me } = ze(F, S, ie), { isSelected: P, toggleSelect: M, toggleSelectAll: fe, allSelected: he, someSelected: ge } = De(f, ee), { isExpanded: A, toggleExpand: I } = xe(), h = q(() => ({
53
- items: f.value,
54
- headers: z.value,
55
- page: i.page,
56
- itemsPerPage: i.itemsPerPage,
57
- toggleSelect: M,
58
- isSelected: P,
59
- toggleExpand: I,
60
- isExpanded: A,
61
- sortBy: i.sortBy,
62
- hasActions: p.hasActions
63
- })), we = [Je, le.value], ye = [Xe, te.value], N = q(() => p.headers.map((e) => {
48
+ const P = q(() => p.headers.map((e) => {
64
49
  var t, c;
65
50
  const o = { ...e };
66
51
  if ((e.columnType === "function" || e.columnType == "objectFunction" || e.columnType == "simpleFunction") && typeof e.columnFunction == "string") {
@@ -76,9 +61,24 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto bg-surface" }, U
76
61
  ), o.columnRowText = () => "");
77
62
  }
78
63
  return o;
79
- }));
64
+ })), { filteredItems: ie, setSearch: ce, modalFilter: y, applyColumnFilters: ue, clearFilters: de, appliedFilters: pe } = He(F, re, P);
65
+ Q(w, (e) => {
66
+ S("update:search", e), ce(e);
67
+ });
68
+ const { options: i, paginatedItems: f, updateSort: me } = ze(F, S, ie), { isSelected: M, toggleSelect: A, toggleSelectAll: fe, allSelected: he, someSelected: ge } = De(f, ee), { isExpanded: I, toggleExpand: R } = xe(), h = q(() => ({
69
+ items: f.value,
70
+ headers: D.value,
71
+ page: i.page,
72
+ itemsPerPage: i.itemsPerPage,
73
+ toggleSelect: A,
74
+ isSelected: M,
75
+ toggleExpand: R,
76
+ isExpanded: I,
77
+ sortBy: i.sortBy,
78
+ hasActions: p.hasActions
79
+ })), we = [Je, le.value], ye = [Xe, te.value];
80
80
  Te(() => L());
81
- const K = v(null), R = v(!0), E = v(!1);
81
+ const K = v(null), E = v(!0), B = v(!1);
82
82
  function ve() {
83
83
  Se();
84
84
  }
@@ -88,14 +88,14 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto bg-surface" }, U
88
88
  }));
89
89
  }
90
90
  function L() {
91
- m.value && (B.value = "w-fit", R.value = !1, E.value = !0, S("focusOnSearch", !1));
91
+ m.value && (V.value = "w-fit", E.value = !1, B.value = !0, S("focusOnSearch", !1));
92
92
  }
93
93
  function U() {
94
- m.value && (B.value = "w-full border", E.value = !1, R.value = !0, S("focusOnSearch", !0));
94
+ m.value && (V.value = "w-full border", B.value = !1, E.value = !0, S("focusOnSearch", !0));
95
95
  }
96
- const B = v("w-full border max-w-sm");
97
- return (e, o) => (l(), r("div", V({ class: we }, e.$attrs, { style: { "user-select": "text" } }), [
98
- s(H) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), r("div", {
96
+ const V = v("w-full border max-w-sm");
97
+ return (e, o) => (l(), r("div", O({ class: we }, e.$attrs, { style: { "user-select": "text" } }), [
98
+ s(N) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), r("div", {
99
99
  key: 0,
100
100
  class: C(["p-2 bg-surface print:hidden", {
101
101
  "justify-start flex": e.searchPosition === "start",
@@ -112,7 +112,7 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto bg-surface" }, U
112
112
  size: "xs",
113
113
  bgColor: "bg-green-200 dark:bg-green-800"
114
114
  }, {
115
- default: j(() => [
115
+ default: x(() => [
116
116
  T(Z, {
117
117
  class: "h-fit",
118
118
  icon: Ae,
@@ -121,11 +121,11 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto bg-surface" }, U
121
121
  ]),
122
122
  _: 1
123
123
  })) : u("", !0),
124
- s(H) ? (l(), r("div", {
124
+ s(N) ? (l(), r("div", {
125
125
  key: 1,
126
- class: C(["rounded flex mx-2", [B.value]])
126
+ class: C(["rounded flex mx-2", [V.value]])
127
127
  }, [
128
- G(O("input", {
128
+ G(j("input", {
129
129
  "onUpdate:modelValue": o[1] || (o[1] = (t) => w.value = t),
130
130
  type: "text",
131
131
  placeholder: e.searchPlaceholder,
@@ -136,18 +136,18 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto bg-surface" }, U
136
136
  onBlur: L
137
137
  }, null, 42, Ke), [
138
138
  [Fe, w.value],
139
- [J, R.value]
139
+ [J, E.value]
140
140
  ]),
141
141
  G(T(Z, {
142
142
  icon: Ie,
143
143
  onClick: ve
144
144
  }, null, 512), [
145
- [J, E.value]
145
+ [J, B.value]
146
146
  ])
147
147
  ], 2)) : u("", !0),
148
148
  a(e.$slots, "appendSearch")
149
149
  ], 2)) : u("", !0),
150
- O("div", Le, [
150
+ j("div", Le, [
151
151
  s(f).length ? (l(), r("table", {
152
152
  key: 0,
153
153
  class: C(ye)
@@ -157,7 +157,7 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto bg-surface" }, U
157
157
  ])) : u("", !0),
158
158
  !s(oe) && !s(m) ? (l(), b(Re, {
159
159
  key: 1,
160
- headers: s(z),
160
+ headers: s(D),
161
161
  "sort-by": s(i).sortBy,
162
162
  "show-select": s(k),
163
163
  "show-expand": s($),
@@ -171,26 +171,26 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto bg-surface" }, U
171
171
  onSort: s(me),
172
172
  onToggleSelectAll: s(fe),
173
173
  customHeaders: e.customSlots
174
- }, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "some-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "onSort", "onToggleSelectAll", "customHeaders"])) : a(e.$slots, "thead", d(V({ key: 2 }, h.value))),
174
+ }, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "some-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "onSort", "onToggleSelectAll", "customHeaders"])) : a(e.$slots, "thead", d(O({ key: 2 }, h.value))),
175
175
  s(m) ? (l(), b(Ve, {
176
176
  key: 4,
177
177
  items: s(f),
178
- headers: N.value,
179
- "row-class": s(D),
178
+ headers: P.value,
179
+ "row-class": s(H),
180
180
  "row-class-condition": e.rowClassCondition,
181
- "is-selected": s(P),
182
- "is-expanded": s(A),
181
+ "is-selected": s(M),
182
+ "is-expanded": s(I),
183
183
  "show-select": s(k),
184
184
  "show-expand": s($),
185
185
  "has-actions": e.hasActions,
186
186
  "action-loading-map": e.actionLoadingMap,
187
- onToggleExpand: s(I),
188
- onToggleSelect: s(M),
187
+ onToggleExpand: s(R),
188
+ onToggleSelect: s(A),
189
189
  customSlots: e.customSlots
190
190
  }, X({ _: 2 }, [
191
191
  Y(e.$slots, (t, c) => ({
192
192
  name: c,
193
- fn: j((n) => [
193
+ fn: x((n) => [
194
194
  a(e.$slots, c, d(g(n)))
195
195
  ])
196
196
  }))
@@ -198,27 +198,27 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto bg-surface" }, U
198
198
  a(e.$slots, "body.prepend", d(g(h.value))),
199
199
  T(Be, {
200
200
  items: s(f),
201
- headers: N.value,
201
+ headers: P.value,
202
202
  "tbody-class": e.tbodyClass,
203
- "row-class": s(D),
203
+ "row-class": s(H),
204
204
  "row-class-condition": e.rowClassCondition,
205
205
  "tr-class": e.trClass,
206
206
  "td-class": e.tdClass,
207
207
  "selected-class": e.selectedClass,
208
208
  "striped-class": e.stripedClass,
209
- "is-selected": s(P),
210
- "is-expanded": s(A),
209
+ "is-selected": s(M),
210
+ "is-expanded": s(I),
211
211
  "show-select": s(k),
212
212
  "show-expand": s($),
213
213
  "has-actions": e.hasActions,
214
214
  "action-loading-map": e.actionLoadingMap,
215
- onToggleExpand: s(I),
216
- onToggleSelect: s(M),
215
+ onToggleExpand: s(R),
216
+ onToggleSelect: s(A),
217
217
  customSlots: e.customSlots
218
218
  }, X({ _: 2 }, [
219
219
  Y(e.$slots, (t, c) => ({
220
220
  name: c,
221
- fn: j((n) => [
221
+ fn: x((n) => [
222
222
  a(e.$slots, c, d(g(n)))
223
223
  ])
224
224
  }))
@@ -230,10 +230,10 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto bg-surface" }, U
230
230
  ])) : u("", !0)
231
231
  ])) : u("", !0),
232
232
  s(f).length ? u("", !0) : (l(), r("div", Qe, [
233
- O("div", qe, ke(e.noDataText), 1)
233
+ j("div", qe, ke(e.noDataText), 1)
234
234
  ]))
235
235
  ]),
236
- s(se) ? a(e.$slots, "footer", d(V({ key: 2 }, h.value))) : (l(), r("div", Ge, [
236
+ s(se) ? a(e.$slots, "footer", d(O({ key: 2 }, h.value))) : (l(), r("div", Ge, [
237
237
  T(Ee, {
238
238
  "items-length": s(ne).length,
239
239
  "items-per-page": s(i).itemsPerPage,
@@ -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 v } from "../../../../utils/utils.js";
3
+ import { getValue as K, formatValue as T } from "../../../../utils/tableFormatters.js";
4
+ function B(p, h, F) {
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: b, searchableKeys: V, headers: k } = 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(() => F.value ?? []), I = g(() => {
31
+ const e = i(V);
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 = K(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 = T(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(b);
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 = v((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
+ B 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.466",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",