adverich-kun-ui 0.1.462 → 0.1.464

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,43 +1,82 @@
1
- import { reactive as F, ref as k, computed as w, watch as A } from "vue";
2
- import { debounce as S } from "../../../../utils/utils.js";
3
- function v(u, i) {
4
- const t = F({
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({
5
6
  search: "",
6
7
  byColumn: {}
7
- }), { items: c, customFilter: s, searchableKeys: f } = u, y = k(!1), a = (e, r) => e == null ? !1 : String(e).toLowerCase().includes(String(r).toLowerCase()), l = (e, r, n) => {
8
- const o = e[r];
9
- return typeof (s == null ? void 0 : s.value) == "function" ? s.value(e, r, n) : Array.isArray(n) ? n.some((b) => a(o, b)) : a(o, n);
10
- }, m = w(() => Array.isArray(c.value) ? c.value.filter((e) => {
11
- if (t.search && !(f.value || Object.keys(e)).some((o) => l(e, o, t.search)))
12
- return !1;
13
- for (const r in t.byColumn) {
14
- const n = t.byColumn[r];
15
- if (n != null && n !== "" && !l(e, r, n))
16
- return !1;
8
+ }), { items: y, customFilter: g, searchableKeys: C, headers: S } = b, F = K(!1), c = (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
+ }
21
+ }
22
+ try {
23
+ return String(e);
24
+ } catch {
25
+ return "";
17
26
  }
18
- return !0;
19
- }) : []), h = S((e) => {
20
- t.search = (e == null ? void 0 : e.toString().toLowerCase()) || "";
21
- }, i.value), p = (e, r) => {
22
- t.byColumn[e] = r;
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);
43
+ }
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;
55
+ }
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;
23
62
  };
24
- function C(e) {
63
+ function L(e) {
25
64
  for (const r in e)
26
- p(r, e[r]);
65
+ V(r, e[r]);
27
66
  }
28
- const d = () => {
29
- t.search = "", t.byColumn = {};
67
+ const D = () => {
68
+ a.search = "", a.byColumn = {};
30
69
  };
31
- return A(() => c.value, () => {
70
+ return R(() => u(y), () => {
32
71
  }, { deep: !0 }), {
33
- modalFilter: y,
34
- appliedFilters: t,
35
- filteredItems: m,
36
- setSearch: h,
37
- applyColumnFilters: C,
38
- clearFilters: d
72
+ modalFilter: F,
73
+ appliedFilters: a,
74
+ filteredItems: A,
75
+ setSearch: k,
76
+ applyColumnFilters: L,
77
+ clearFilters: D
39
78
  };
40
79
  }
41
80
  export {
42
- v as default
81
+ E as default
43
82
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.462",
3
+ "version": "0.1.464",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",