adverich-kun-ui 0.1.560 → 0.1.562

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
  };
@@ -1,12 +1,15 @@
1
- import { computed as i, ref as w } from "vue";
2
- function m() {
3
- var s, t, a, u, v;
1
+ import { computed as i, ref as c } from "vue";
2
+ const s = typeof window < "u";
3
+ function f() {
4
+ var t, a, u, r, v;
5
+ if (!s)
6
+ return { os: "Server", osVersion: "Unknown" };
4
7
  const l = window.navigator.userAgent;
5
- let d = "Unknown OS", o = "Unknown Version";
6
- return /Mac/.test(l) ? (d = "Mac OS", o = (t = (s = l.match(/Mac OS X (\d+[\._]\d+[\._]\d+)/)) == null ? void 0 : s[1]) == null ? void 0 : t.replace(/_/g, ".")) : /iPhone|iPad|iPod/.test(l) ? (d = "iOS", o = ((a = l.match(/OS (\d+)[._](\d+)[._]?(\d+)?/)) == null ? void 0 : a.slice(1, 4).join(".")) || "Unknown") : /Windows/.test(l) ? (d = "Windows", o = (u = l.match(/Windows NT (\d+\.\d+)/)) == null ? void 0 : u[1]) : /Android/.test(l) ? (d = "Android", o = (v = l.match(/Android (\d+\.\d+)/)) == null ? void 0 : v[1]) : /Linux/.test(l) && (d = "Linux"), { os: d, osVersion: o };
8
+ let o = "Unknown OS", d = "Unknown Version";
9
+ return /Mac/.test(l) ? (o = "Mac OS", d = (a = (t = l.match(/Mac OS X (\d+[\._]\d+[\._]\d+)/)) == null ? void 0 : t[1]) == null ? void 0 : a.replace(/_/g, ".")) : /iPhone|iPad|iPod/.test(l) ? (o = "iOS", d = ((u = l.match(/OS (\d+)[._](\d+)[._]?(\d+)?/)) == null ? void 0 : u.slice(1, 4).join(".")) || "Unknown") : /Windows/.test(l) ? (o = "Windows", d = (r = l.match(/Windows NT (\d+\.\d+)/)) == null ? void 0 : r[1]) : /Android/.test(l) ? (o = "Android", d = (v = l.match(/Android (\d+\.\d+)/)) == null ? void 0 : v[1]) : /Linux/.test(l) && (o = "Linux"), { os: o, osVersion: d };
7
10
  }
8
- const e = w(window.innerWidth), x = w(window.innerHeight), r = m(), h = i(
9
- () => r.os === "iOS" || r.os === "Android" || x.value > e.value
11
+ const e = c(s ? window.innerWidth : 1024), m = c(s ? window.innerHeight : 768), w = f(), h = i(
12
+ () => w.os === "iOS" || w.os === "Android" || m.value > e.value
10
13
  ), n = {
11
14
  xs: 475,
12
15
  sm: 640,
@@ -33,16 +36,15 @@ i(() => e.value < n.lg);
33
36
  i(() => e.value < n.xl);
34
37
  i(() => e.value < n.xxl);
35
38
  i(() => e.value < n.xxl);
36
- function c() {
37
- e.value = window.innerWidth, x.value = window.innerHeight;
39
+ function x() {
40
+ s && (e.value = window.innerWidth, m.value = window.innerHeight);
38
41
  }
39
- window.addEventListener("resize", c);
40
- window.addEventListener("beforeunload", () => {
41
- window.removeEventListener("resize", c);
42
- });
42
+ s && (window.addEventListener("resize", x), window.addEventListener("beforeunload", () => {
43
+ window.removeEventListener("resize", x);
44
+ }));
43
45
  export {
44
46
  h as isMobile,
45
- r as kunOS,
46
- x as screenHeight,
47
+ w as kunOS,
48
+ m as screenHeight,
47
49
  e as screenWidth
48
50
  };
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.562",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",