adverich-kun-ui 0.1.502 → 0.1.504

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,12 +1,12 @@
1
- import { ref as $, onMounted as E, watch as f, createElementBlock as a, openBlock as o, normalizeClass as r, createElementVNode as g, createCommentVNode as u, renderSlot as k, createVNode as T, Fragment as D, renderList as H, normalizeStyle as O, createBlock as x, resolveDynamicComponent as S, toDisplayString as h } from "vue";
2
- import V from "../../../../icons/IconArrowUp.vue.js";
3
- import j from "../../../../icons/IconArrowDown.vue.js";
4
- import z from "../../../../icons/IconArrowDownUp.vue.js";
5
- import I from "../../../KunCheckbox/src/components/KunCheckbox.vue.js";
6
- const L = { key: 0 }, N = { key: 1 }, U = ["onClick"], F = {
1
+ import { ref as T, onMounted as $, watch as f, createElementBlock as o, openBlock as s, normalizeClass as r, createElementVNode as g, createCommentVNode as u, renderSlot as k, createVNode as E, Fragment as D, renderList as H, normalizeStyle as O, createBlock as x, resolveDynamicComponent as h, toDisplayString as S } from "vue";
2
+ import P from "../../../../icons/IconArrowUp.vue.js";
3
+ import V from "../../../../icons/IconArrowDown.vue.js";
4
+ import j from "../../../../icons/IconArrowDownUp.vue.js";
5
+ import z from "../../../KunCheckbox/src/components/KunCheckbox.vue.js";
6
+ const I = { key: 0 }, L = { key: 1 }, N = ["onClick"], U = {
7
7
  key: 0,
8
8
  class: "inline-flex items-center gap-1 ml-1 print:hidden"
9
- }, K = "bg-surface sticky top-0 z-5", M = "", R = "px-3 py-2 text-xs font-medium text-slate-700 dark:text-slate-300 uppercase tracking-wider", X = {
9
+ }, F = "bg-surface sticky top-0 z-5", K = "", M = "px-3 py-2 text-xs font-medium text-slate-700 dark:text-slate-300 uppercase tracking-wider", X = {
10
10
  __name: "KunTableHeaders",
11
11
  props: {
12
12
  headers: Array,
@@ -15,6 +15,7 @@ const L = { key: 0 }, N = { key: 1 }, U = ["onClick"], F = {
15
15
  isExpanded: Boolean,
16
16
  allSelected: Boolean,
17
17
  someSelected: Boolean,
18
+ moreThanPaginated: Boolean,
18
19
  sortBy: Object,
19
20
  theadClass: String,
20
21
  trClass: String,
@@ -24,89 +25,89 @@ const L = { key: 0 }, N = { key: 1 }, U = ["onClick"], F = {
24
25
  customHeaders: Object
25
26
  },
26
27
  emits: ["toggle-select-all", "sort", "expandAll", "collapseAll"],
27
- setup(t, { emit: p }) {
28
- const l = t, c = p;
29
- function B() {
28
+ setup(t, { emit: B }) {
29
+ const l = t, c = B;
30
+ function C() {
30
31
  c("toggle-select-all");
31
32
  }
32
- function C(s) {
33
- if (!s.sortable) return;
33
+ function v(a) {
34
+ if (!a.sortable) return;
34
35
  let n = null;
35
- Array.isArray(l.sortBy) ? n = l.sortBy.find((d) => d.key === s.value) : typeof l.sortBy == "string" && (n = l.sortBy === s.value ? { key: s.value, order: "asc" } : null);
36
+ Array.isArray(l.sortBy) ? n = l.sortBy.find((d) => d.key === a.value) : typeof l.sortBy == "string" && (n = l.sortBy === a.value ? { key: a.value, order: "asc" } : null);
36
37
  const e = (n == null ? void 0 : n.order) === "asc" ? "desc" : "asc";
37
- c("sort", { key: s.value, order: e });
38
+ c("sort", { key: a.value, order: e });
38
39
  }
39
- function v(s) {
40
+ function w(a) {
40
41
  var n;
41
42
  if (Array.isArray(l.sortBy))
42
- return (n = l.sortBy.find((e) => e.key === s.value)) == null ? void 0 : n.order;
43
- if (typeof l.sortBy == "string" && l.sortBy === s.value)
43
+ return (n = l.sortBy.find((e) => e.key === a.value)) == null ? void 0 : n.order;
44
+ if (typeof l.sortBy == "string" && l.sortBy === a.value)
44
45
  return "asc";
45
46
  }
46
- const w = (s) => {
47
- const n = v(s);
48
- return n ? n === "asc" ? V : j : z;
49
- }, b = [K, l.theadClass], A = [M, l.trClass], i = [R, l.thClass], y = $(null), m = () => {
50
- y.value && (y.value.indeterminate = l.someSelected && !l.allSelected);
47
+ const b = (a) => {
48
+ const n = w(a);
49
+ return n ? n === "asc" ? P : V : j;
50
+ }, p = [F, l.theadClass], A = [K, l.trClass], i = [M, l.thClass], y = T(null), m = () => {
51
+ y.value && (y.value.indeterminate = l.someSelected && !l.allSelected && l.moreThanPaginated);
51
52
  };
52
- return E(m), f(() => l.someSelected, m), f(() => l.allSelected, m), (s, n) => (o(), a("thead", {
53
- class: r(b)
53
+ return $(m), f(() => l.someSelected, m), f(() => l.allSelected, m), (a, n) => (s(), o("thead", {
54
+ class: r(p)
54
55
  }, [
55
56
  g("tr", {
56
57
  class: r(A)
57
58
  }, [
58
- t.showExpand ? (o(), a("th", {
59
+ t.showExpand ? (s(), o("th", {
59
60
  key: 0,
60
61
  class: r([i])
61
62
  }, [
62
- s.$slots.expandIcon ? k(s.$slots, "expand-icon", { key: 0 }) : (o(), a("button", {
63
+ a.$slots.expandIcon ? k(a.$slots, "expand-icon", { key: 0 }) : (s(), o("button", {
63
64
  key: 1,
64
65
  onClick: n[0] || (n[0] = (e) => t.isExpanded ? c("expandAll") : c("collapseAll"))
65
66
  }, [
66
- t.isExpanded ? (o(), a("span", L, "−")) : (o(), a("span", N, "+"))
67
+ t.isExpanded ? (s(), o("span", I, "−")) : (s(), o("span", L, "+"))
67
68
  ]))
68
69
  ], 2)) : u("", !0),
69
- t.showSelect ? (o(), a("th", {
70
+ t.showSelect ? (s(), o("th", {
70
71
  key: 1,
71
72
  class: r([i, "h-full w-10 flex flex-col items-center justify-center"])
72
73
  }, [
73
- T(I, {
74
+ E(z, {
74
75
  "model-value": t.allSelected,
75
- "onUpdate:modelValue": B,
76
+ "onUpdate:modelValue": C,
76
77
  indeterminate: t.someSelected,
77
78
  ripple: !1,
78
79
  "true-value": !0,
79
80
  "false-value": !1,
80
- color: t.someSelected && !t.allSelected ? "text-yellow-600 dark:text-yellow-400" : t.allSelected ? "text-green-600 dark:text-green-400" : "",
81
+ color: t.someSelected && !t.allSelected && !t.moreThanPaginated ? "text-yellow-600 dark:text-yellow-400" : t.allSelected ? "text-green-600 dark:text-green-400" : t.moreThanPaginated ? "text-green-900 dark:text-green-600" : "",
81
82
  "hide-details": ""
82
83
  }, null, 8, ["model-value", "indeterminate", "color"])
83
84
  ])) : u("", !0),
84
- (o(!0), a(D, null, H(t.headers, (e) => {
85
+ (s(!0), o(D, null, H(t.headers, (e) => {
85
86
  var d;
86
- return o(), a("th", {
87
+ return s(), o("th", {
87
88
  key: e.key,
88
89
  class: r([i, e.headerAlign === "right" ? "text-right" : e.headerAlign === "left" ? "text-left" : "text-center"]),
89
- onClick: (q) => C(e),
90
+ onClick: (R) => v(e),
90
91
  style: O({ cursor: e.sortable ? "pointer" : "default" })
91
92
  }, [
92
- (d = t.customHeaders) != null && d[`header.${e.value}`] ? (o(), x(S(t.customHeaders[`header.${e.value}`]), {
93
+ (d = t.customHeaders) != null && d[`header.${e.value}`] ? (s(), x(h(t.customHeaders[`header.${e.value}`]), {
93
94
  key: 0,
94
95
  header: e
95
- }, null, 8, ["header"])) : k(s.$slots, `header.${e.key}`, {
96
+ }, null, 8, ["header"])) : k(a.$slots, `header.${e.key}`, {
96
97
  key: 1,
97
98
  header: e
98
99
  }, () => [
99
- g("span", null, h(e.label ?? e.text), 1),
100
- e.sortable ? (o(), a("span", F, [
101
- (o(), x(S(w(e)), { class: "w-4 h-4 text-gray-500" }))
100
+ g("span", null, S(e.label ?? e.text), 1),
101
+ e.sortable ? (s(), o("span", U, [
102
+ (s(), x(h(b(e)), { class: "w-4 h-4 text-gray-500" }))
102
103
  ])) : u("", !0)
103
104
  ])
104
- ], 14, U);
105
+ ], 14, N);
105
106
  }), 128)),
106
- t.hasActions ? (o(), a("th", {
107
+ t.hasActions ? (s(), o("th", {
107
108
  key: 2,
108
109
  class: r([[i], "text-center print:hidden"])
109
- }, h(t.actionLabel), 3)) : u("", !0)
110
+ }, S(t.actionLabel), 3)) : u("", !0)
110
111
  ])
111
112
  ]));
112
113
  }
@@ -1,33 +1,42 @@
1
- import { computed as c, watch as g } from "vue";
2
- function t(n, u) {
3
- const e = (l) => u.value.includes(l), f = (l) => {
4
- u.value.indexOf(l) === -1 ? u.value = [...u.value, l] : u.value = u.value.filter((S) => S.id !== l.id);
5
- }, v = () => {
1
+ import { computed as a, watch as A } from "vue";
2
+ function C(n, u, c) {
3
+ const h = (l) => u.value.includes(l), f = (l) => {
4
+ u.value.indexOf(l) === -1 ? u.value = [...u.value, l] : u.value = u.value.filter((x) => x.id !== l.id);
5
+ }, r = () => {
6
6
  u.value = [...n.value];
7
- }, o = () => {
7
+ }, v = () => {
8
8
  u.value = [];
9
- }, h = () => {
10
- a.value ? o() : v();
11
- }, a = c(() => {
9
+ }, g = () => {
10
+ e.value ? v() : r();
11
+ };
12
+ function i() {
13
+ u.value = [...c.value];
14
+ }
15
+ const e = a(() => {
12
16
  var l;
13
17
  return ((l = n.value) == null ? void 0 : l.length) > 0 && u.value.length === n.value.length;
14
- }), i = c(() => {
18
+ }), S = a(() => {
19
+ var l, o;
20
+ return ((l = u.value) == null ? void 0 : l.length) > ((o = n.value) == null ? void 0 : o.length);
21
+ }), t = a(() => {
15
22
  var l;
16
23
  return ((l = n.value) == null ? void 0 : l.length) > 0 && u.value.length > 0 && u.value.length < n.value.length;
17
24
  });
18
- return g(() => n, (l, r) => {
19
- l !== r && o();
25
+ return A(() => n, (l, o) => {
26
+ l !== o && v();
20
27
  }, { deep: !0 }), {
21
28
  selectedItems: u,
22
- isSelected: e,
29
+ isSelected: h,
23
30
  toggleSelect: f,
24
- selectAll: v,
25
- clearSelection: o,
26
- toggleSelectAll: h,
27
- allSelected: a,
28
- someSelected: i
31
+ selectAll: r,
32
+ clearSelection: v,
33
+ toggleSelectAll: g,
34
+ allSelected: e,
35
+ someSelected: t,
36
+ moreThanPaginated: S,
37
+ selectCompleteAll: i
29
38
  };
30
39
  }
31
40
  export {
32
- t as default
41
+ C as default
33
42
  };
@@ -1,25 +1,21 @@
1
- function a(t, n) {
2
- var r, c;
1
+ function f(t, n) {
2
+ var o;
3
3
  if (!t || !t.value) return;
4
4
  if (t.columnType === "relation") {
5
- const i = f(n, t.relationPath);
5
+ const i = a(n, t.relationPath);
6
6
  return u(i);
7
7
  }
8
8
  if (t.columnType === "function") {
9
- const i = (r = t.columnFunction) == null ? void 0 : r.call(t, n, t);
10
- return u(i);
11
- }
12
- if (t.columnFormat === "function") {
13
- const i = (c = t.columnFunction) == null ? void 0 : c.call(t, n, t);
9
+ const i = (o = t.columnFunction) == null ? void 0 : o.call(t, n, t);
14
10
  return u(i);
15
11
  }
16
- const o = n == null ? void 0 : n[t.value];
17
- return u(o);
12
+ const e = n == null ? void 0 : n[t.value];
13
+ return u(e);
18
14
  }
19
- function l(t, n) {
20
- return t.columnType === "toComplete" ? "" : n == null ? "Sin datos" : t.columnType === "dateTime" || t.columnType === "date" ? (e[t.columnType] || e.default)(n) : (e[t.columnFormat] || e.default)(n);
15
+ function m(t, n) {
16
+ return t.columnType === "toComplete" ? "" : n == null ? "Sin datos" : t.columnType === "dateTime" || t.columnType === "date" ? (r[t.columnType] || r.default)(n) : (r[t.columnFormat] || r.default)(n);
21
17
  }
22
- const e = {
18
+ const r = {
23
19
  default: (t) => t,
24
20
  // TEXTS
25
21
  text: (t) => String(t),
@@ -61,14 +57,14 @@ const e = {
61
57
  hourCycle: "h23"
62
58
  }).format(n);
63
59
  },
64
- secondsToTime: (t) => m(t ?? 0)
60
+ secondsToTime: (t) => c(t ?? 0)
65
61
  };
66
- function f(t, n) {
67
- return !t || !n ? t : n.split(".").reduce((o, r) => o == null ? void 0 : o[r], t);
62
+ function a(t, n) {
63
+ return !t || !n ? t : n.split(".").reduce((e, o) => e == null ? void 0 : e[o], t);
68
64
  }
69
- function m(t) {
70
- const n = Math.floor(t / 3600), o = Math.floor(t % 3600 / 60), r = t % 60;
71
- return `${n} horas, ${o} minutos y ${r} segundos`;
65
+ function c(t) {
66
+ const n = Math.floor(t / 3600), e = Math.floor(t % 3600 / 60), o = t % 60;
67
+ return `${n} horas, ${e} minutos y ${o} segundos`;
72
68
  }
73
69
  function u(t) {
74
70
  if (t != null && !(t === "null" || t === "undefined"))
@@ -79,8 +75,8 @@ function s(t) {
79
75
  return !isNaN(n.getTime());
80
76
  }
81
77
  export {
82
- l as formatValue,
83
- e as formatters,
84
- f as getNestedValue,
85
- a as getValue
78
+ m as formatValue,
79
+ r as formatters,
80
+ a as getNestedValue,
81
+ f as getValue
86
82
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.502",
3
+ "version": "0.1.504",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",