adverich-kun-ui 0.1.560 → 0.1.561

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,47 +1,63 @@
1
- import { reactive as A, watch as c, computed as f } from "vue";
2
- function D(v, o, l) {
3
- const { page: p, itemsPerPage: g, sortBy: P, mutliSort: B } = v, b = (e) => typeof e == "string" ? [{ key: e, order: "asc" }] : Array.isArray(e) ? e.map((u) => typeof u == "string" ? { key: u, order: "asc" } : u) : [], t = A({
4
- page: p.value,
1
+ import { reactive as z, watch as c, computed as p } from "vue";
2
+ function I(B, u, l) {
3
+ const { page: d, itemsPerPage: g, sortBy: b, mutliSort: A } = B, x = (e) => typeof e == "string" ? [{ key: e, order: "asc" }] : Array.isArray(e) ? e.map((t) => typeof t == "string" ? { key: t, order: "asc" } : t) : [], r = z({
4
+ page: d.value,
5
5
  itemsPerPage: g.value,
6
- sortBy: b(P.value)
6
+ sortBy: x(b.value)
7
7
  });
8
- c(() => p.value, (e) => t.page = e), c(() => g.value, (e) => t.itemsPerPage = e), c(() => t.sortBy, (e) => o == null ? void 0 : o("update:sortBy", e)), c(() => t.page, (e) => o == null ? void 0 : o("update:page", e)), c(() => t.itemsPerPage, (e) => o == null ? void 0 : o("update:itemsPerPage", e));
9
- const y = f(() => (t.page - 1) * t.itemsPerPage), m = f(() => y.value + t.itemsPerPage), d = f(() => Array.isArray(l.value) ? t.sortBy.length ? [...l.value].sort((e, u) => {
10
- for (const { key: i, order: s } of t.sortBy) {
11
- const r = e[i], n = u[i];
12
- if (!(r == null && n == null)) {
13
- if (r == null) return s === "asc" ? -1 : 1;
14
- if (n == null) return s === "asc" ? 1 : -1;
15
- if (r instanceof Date && n instanceof Date) {
16
- const a = r.getTime() - n.getTime();
17
- if (a !== 0) return s === "asc" ? a : -a;
8
+ c(() => d.value, (e) => r.page = e), c(() => g.value, (e) => r.itemsPerPage = e), c(() => r.sortBy, (e) => u == null ? void 0 : u("update:sortBy", e)), c(() => r.page, (e) => u == null ? void 0 : u("update:page", e)), c(() => r.itemsPerPage, (e) => u == null ? void 0 : u("update:itemsPerPage", e));
9
+ const y = p(() => (r.page - 1) * r.itemsPerPage), h = p(() => y.value + r.itemsPerPage), P = p(() => {
10
+ if (!Array.isArray(l.value)) return [];
11
+ if (!r.sortBy.length) return l.value;
12
+ const e = (t) => {
13
+ if (typeof t == "number") return t;
14
+ if (typeof t == "string") {
15
+ if (/[a-zA-Z]/.test(t)) return t;
16
+ const s = t.replace(/[^\d.,-]/g, "");
17
+ if (/^-?(\d{1,3}(\.\d{3})*|\d+),\d+$/.test(s))
18
+ return parseFloat(s.replace(/\./g, "").replace(",", "."));
19
+ if (/^-?\d+(\.\d+)?$/.test(s))
20
+ return parseFloat(s);
21
+ }
22
+ return t;
23
+ };
24
+ return [...l.value].sort((t, s) => {
25
+ for (const { key: f, order: i } of r.sortBy) {
26
+ const a = t[f], o = s[f];
27
+ if (a == null && o == null) continue;
28
+ if (a == null) return i === "asc" ? -1 : 1;
29
+ if (o == null) return i === "asc" ? 1 : -1;
30
+ if (a instanceof Date && o instanceof Date) {
31
+ const n = a.getTime() - o.getTime();
32
+ if (n !== 0) return i === "asc" ? n : -n;
18
33
  continue;
19
34
  }
20
- if (typeof r == "number" && typeof n == "number") {
21
- const a = r - n;
22
- if (a !== 0) return s === "asc" ? a : -a;
35
+ const v = e(a), m = e(o);
36
+ if (typeof v == "number" && typeof m == "number") {
37
+ const n = v - m;
38
+ if (n !== 0) return i === "asc" ? n : -n;
23
39
  continue;
24
40
  }
25
- if (typeof r == "string" && typeof n == "string") {
26
- const a = r.localeCompare(n, void 0, { sensitivity: "base" });
27
- if (a !== 0) return s === "asc" ? a : -a;
41
+ if (typeof a == "string" && typeof o == "string") {
42
+ const n = a.localeCompare(o, void 0, { sensitivity: "base" });
43
+ if (n !== 0) return i === "asc" ? n : -n;
28
44
  continue;
29
45
  }
30
- if (r !== n) return s === "asc" ? r > n ? 1 : -1 : r < n ? 1 : -1;
46
+ if (a !== o) return i === "asc" ? a > o ? 1 : -1 : a < o ? 1 : -1;
31
47
  }
32
- }
33
- return 0;
34
- }) : l.value : []), x = f(() => d.value.slice(y.value, m.value));
48
+ return 0;
49
+ });
50
+ }), k = p(() => P.value.slice(y.value, h.value));
35
51
  return {
36
- options: t,
37
- paginatedItems: x,
38
- updateSort: ({ key: e, order: u }) => {
39
- const i = t.sortBy.find((s) => s.key === e);
40
- i ? i.order = u : B.value ? t.sortBy.push({ key: e, order: u }) : t.sortBy = [{ key: e, order: u }];
52
+ options: r,
53
+ paginatedItems: k,
54
+ updateSort: ({ key: e, order: t }) => {
55
+ const s = r.sortBy.find((f) => f.key === e);
56
+ s ? s.order = t : A.value ? r.sortBy.push({ key: e, order: t }) : r.sortBy = [{ key: e, order: t }];
41
57
  },
42
- sortedItems: d
58
+ sortedItems: P
43
59
  };
44
60
  }
45
61
  export {
46
- D as default
62
+ I as default
47
63
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.560",
3
+ "version": "0.1.561",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",