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.
- package/dist/adverich-kun-ui.css +1 -1
- package/dist/components/KunAutocomplete/src/components/KunAutocomplete.vue.js +87 -86
- package/dist/components/KunTable/src/components/KunTable.vue.js +211 -194
- package/dist/components/KunTable/src/components/KunTableFilter.vue.js +41 -38
- package/dist/components/KunTable/src/components/KunTableHeaders.vue.js +43 -42
- package/dist/components/KunTable/src/composables/useSelect.js +28 -19
- package/dist/utils/tableFormatters.js +19 -23
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
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
|
-
},
|
|
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:
|
|
28
|
-
const l = t, c =
|
|
29
|
-
function
|
|
28
|
+
setup(t, { emit: B }) {
|
|
29
|
+
const l = t, c = B;
|
|
30
|
+
function C() {
|
|
30
31
|
c("toggle-select-all");
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
-
if (!
|
|
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 ===
|
|
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:
|
|
38
|
+
c("sort", { key: a.value, order: e });
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
+
function w(a) {
|
|
40
41
|
var n;
|
|
41
42
|
if (Array.isArray(l.sortBy))
|
|
42
|
-
return (n = l.sortBy.find((e) => e.key ===
|
|
43
|
-
if (typeof l.sortBy == "string" && l.sortBy ===
|
|
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
|
|
47
|
-
const n =
|
|
48
|
-
return n ? n === "asc" ?
|
|
49
|
-
},
|
|
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
|
|
53
|
-
class: r(
|
|
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 ? (
|
|
59
|
+
t.showExpand ? (s(), o("th", {
|
|
59
60
|
key: 0,
|
|
60
61
|
class: r([i])
|
|
61
62
|
}, [
|
|
62
|
-
|
|
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 ? (
|
|
67
|
+
t.isExpanded ? (s(), o("span", I, "−")) : (s(), o("span", L, "+"))
|
|
67
68
|
]))
|
|
68
69
|
], 2)) : u("", !0),
|
|
69
|
-
t.showSelect ? (
|
|
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
|
-
|
|
74
|
+
E(z, {
|
|
74
75
|
"model-value": t.allSelected,
|
|
75
|
-
"onUpdate:modelValue":
|
|
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
|
-
(
|
|
85
|
+
(s(!0), o(D, null, H(t.headers, (e) => {
|
|
85
86
|
var d;
|
|
86
|
-
return
|
|
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: (
|
|
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}`] ? (
|
|
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(
|
|
96
|
+
}, null, 8, ["header"])) : k(a.$slots, `header.${e.key}`, {
|
|
96
97
|
key: 1,
|
|
97
98
|
header: e
|
|
98
99
|
}, () => [
|
|
99
|
-
g("span", null,
|
|
100
|
-
e.sortable ? (
|
|
101
|
-
(
|
|
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,
|
|
105
|
+
], 14, N);
|
|
105
106
|
}), 128)),
|
|
106
|
-
t.hasActions ? (
|
|
107
|
+
t.hasActions ? (s(), o("th", {
|
|
107
108
|
key: 2,
|
|
108
109
|
class: r([[i], "text-center print:hidden"])
|
|
109
|
-
},
|
|
110
|
+
}, S(t.actionLabel), 3)) : u("", !0)
|
|
110
111
|
])
|
|
111
112
|
]));
|
|
112
113
|
}
|
|
@@ -1,33 +1,42 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
u.value.indexOf(l) === -1 ? u.value = [...u.value, l] : u.value = u.value.filter((
|
|
5
|
-
},
|
|
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
|
-
},
|
|
7
|
+
}, v = () => {
|
|
8
8
|
u.value = [];
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
}
|
|
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
|
-
}),
|
|
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
|
|
19
|
-
l !==
|
|
25
|
+
return A(() => n, (l, o) => {
|
|
26
|
+
l !== o && v();
|
|
20
27
|
}, { deep: !0 }), {
|
|
21
28
|
selectedItems: u,
|
|
22
|
-
isSelected:
|
|
29
|
+
isSelected: h,
|
|
23
30
|
toggleSelect: f,
|
|
24
|
-
selectAll:
|
|
25
|
-
clearSelection:
|
|
26
|
-
toggleSelectAll:
|
|
27
|
-
allSelected:
|
|
28
|
-
someSelected:
|
|
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
|
-
|
|
41
|
+
C as default
|
|
33
42
|
};
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
function
|
|
2
|
-
var
|
|
1
|
+
function f(t, n) {
|
|
2
|
+
var o;
|
|
3
3
|
if (!t || !t.value) return;
|
|
4
4
|
if (t.columnType === "relation") {
|
|
5
|
-
const i =
|
|
5
|
+
const i = a(n, t.relationPath);
|
|
6
6
|
return u(i);
|
|
7
7
|
}
|
|
8
8
|
if (t.columnType === "function") {
|
|
9
|
-
const i = (
|
|
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
|
|
17
|
-
return u(
|
|
12
|
+
const e = n == null ? void 0 : n[t.value];
|
|
13
|
+
return u(e);
|
|
18
14
|
}
|
|
19
|
-
function
|
|
20
|
-
return t.columnType === "toComplete" ? "" : n == null ? "Sin datos" : t.columnType === "dateTime" || t.columnType === "date" ? (
|
|
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
|
|
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) =>
|
|
60
|
+
secondsToTime: (t) => c(t ?? 0)
|
|
65
61
|
};
|
|
66
|
-
function
|
|
67
|
-
return !t || !n ? t : n.split(".").reduce((
|
|
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
|
|
70
|
-
const n = Math.floor(t / 3600),
|
|
71
|
-
return `${n} horas, ${
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
m as formatValue,
|
|
79
|
+
r as formatters,
|
|
80
|
+
a as getNestedValue,
|
|
81
|
+
f as getValue
|
|
86
82
|
};
|