adverich-kun-ui 0.1.559 → 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
  };
@@ -1,11 +1,11 @@
1
- import { ref as c, watch as T } from "vue";
1
+ import { ref as i, watch as h } from "vue";
2
2
  function V(e, n) {
3
- const u = c(e.modelValue), a = c(null), t = c(null);
4
- T(() => e.modelValue, (l) => {
3
+ const u = i(e.modelValue), a = i(null), t = i(null);
4
+ h(() => e.modelValue, (l) => {
5
5
  u.value = l, n("update:modelValue", l);
6
6
  });
7
- function i() {
8
- console.log(1), !e.disabled && (clearTimeout(t.value), a.value = setTimeout(() => {
7
+ function c() {
8
+ e.disabled || (clearTimeout(t.value), a.value = setTimeout(() => {
9
9
  u.value = !0, n("update:modelValue", !0);
10
10
  }, +e.openDelay));
11
11
  }
@@ -15,7 +15,7 @@ function V(e, n) {
15
15
  }, +e.closeDelay);
16
16
  }
17
17
  function d() {
18
- u.value ? o() : i();
18
+ u.value ? o() : c();
19
19
  }
20
20
  function f() {
21
21
  e.disabled || !e.openOnClick || d();
@@ -23,10 +23,10 @@ function V(e, n) {
23
23
  function m(l) {
24
24
  if (!e.openOnHover || e.disabled) return;
25
25
  clearTimeout(a.value), clearTimeout(t.value);
26
- const s = l === "enter" ? e.openDelay : e.closeDelay;
26
+ const T = l === "enter" ? e.openDelay : e.closeDelay;
27
27
  setTimeout(() => {
28
28
  u.value = l === "enter";
29
- }, +s);
29
+ }, +T);
30
30
  }
31
31
  function v() {
32
32
  e.openOnFocus && (u.value = !0);
@@ -36,7 +36,7 @@ function V(e, n) {
36
36
  }
37
37
  return {
38
38
  menuVisible: u,
39
- showMenu: i,
39
+ showMenu: c,
40
40
  hideMenu: o,
41
41
  toggleMenu: d,
42
42
  handleActivatorClick: f,
@@ -7,7 +7,6 @@ function f(t, n) {
7
7
  return u(r);
8
8
  }
9
9
  if (t.columnType === "function") {
10
- console.log(t), console.log(t.columnFunction);
11
10
  const r = (e = t.columnFunction) == null ? void 0 : e.call(t, n, t);
12
11
  return u(r);
13
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.559",
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",