adverich-kun-ui 0.1.316 → 0.1.317
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,11 +1,11 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { ref as $, onMounted as E, watch as f, createElementBlock as a, openBlock as o, normalizeClass as r, createElementVNode as k, createCommentVNode as u, renderSlot as g, Fragment as T, renderList as D, normalizeStyle as O, createBlock as h, resolveDynamicComponent as b, toDisplayString as x } from "vue";
|
|
2
|
+
import j from "../../../../icons/IconArrowUp.vue.js";
|
|
3
|
+
import z from "../../../../icons/IconArrowDown.vue.js";
|
|
4
|
+
import I from "../../../../icons/IconArrowDownUp.vue.js";
|
|
5
|
+
const L = { key: 0 }, N = { key: 1 }, R = ["checked", "aria-checked"], U = ["onClick"], V = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "inline-flex items-center gap-1 ml-1 print:hidden"
|
|
8
|
-
}, F = "bg-slate-200 dark:bg-slate-800 sticky top-0 z-5", H = "", K = "px-3 py-2 text-xs font-medium text-slate-700 dark:text-slate-300 uppercase tracking-wider",
|
|
8
|
+
}, F = "bg-slate-200 dark:bg-slate-800 sticky top-0 z-5", H = "", K = "px-3 py-2 text-xs font-medium text-slate-700 dark:text-slate-300 uppercase tracking-wider", Q = {
|
|
9
9
|
__name: "KunTableHeaders",
|
|
10
10
|
props: {
|
|
11
11
|
headers: Array,
|
|
@@ -19,86 +19,96 @@ const j = { key: 0 }, N = { key: 1 }, R = ["checked", "aria-checked"], U = ["onC
|
|
|
19
19
|
trClass: String,
|
|
20
20
|
thClass: String,
|
|
21
21
|
hasActions: Boolean,
|
|
22
|
-
actionLabel: String
|
|
22
|
+
actionLabel: String,
|
|
23
|
+
customSlots: Object
|
|
23
24
|
},
|
|
24
25
|
emits: ["toggle-select-all", "sort", "expandAll", "collapseAll"],
|
|
25
|
-
setup(
|
|
26
|
-
const t =
|
|
27
|
-
function
|
|
26
|
+
setup(l, { emit: S }) {
|
|
27
|
+
const t = l, c = S;
|
|
28
|
+
function p() {
|
|
28
29
|
c("toggle-select-all");
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
if (!
|
|
32
|
-
let
|
|
33
|
-
Array.isArray(t.sortBy) ?
|
|
34
|
-
const e = (
|
|
35
|
-
c("sort", { key:
|
|
31
|
+
function C(s) {
|
|
32
|
+
if (!s.sortable) return;
|
|
33
|
+
let n = null;
|
|
34
|
+
Array.isArray(t.sortBy) ? n = t.sortBy.find((d) => d.key === s.value) : typeof t.sortBy == "string" && (n = t.sortBy === s.value ? { key: s.value, order: "asc" } : null);
|
|
35
|
+
const e = (n == null ? void 0 : n.order) === "asc" ? "desc" : "asc";
|
|
36
|
+
c("sort", { key: s.value, order: e });
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
var
|
|
38
|
+
function B(s) {
|
|
39
|
+
var n;
|
|
39
40
|
if (Array.isArray(t.sortBy))
|
|
40
|
-
return (
|
|
41
|
-
if (typeof t.sortBy == "string" && t.sortBy ===
|
|
41
|
+
return (n = t.sortBy.find((e) => e.key === s.value)) == null ? void 0 : n.order;
|
|
42
|
+
if (typeof t.sortBy == "string" && t.sortBy === s.value)
|
|
42
43
|
return "asc";
|
|
43
44
|
}
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
return
|
|
47
|
-
},
|
|
48
|
-
|
|
45
|
+
const w = (s) => {
|
|
46
|
+
const n = B(s);
|
|
47
|
+
return n ? n === "asc" ? j : z : I;
|
|
48
|
+
}, A = [F, t.theadClass], v = [H, t.trClass], i = [K, t.thClass], y = $(null), m = () => {
|
|
49
|
+
y.value && (y.value.indeterminate = t.someSelected && !t.allSelected);
|
|
49
50
|
};
|
|
50
|
-
return
|
|
51
|
-
class:
|
|
51
|
+
return E(m), f(() => t.someSelected, m), f(() => t.allSelected, m), (s, n) => (o(), a("thead", {
|
|
52
|
+
class: r(A)
|
|
52
53
|
}, [
|
|
53
|
-
|
|
54
|
-
class:
|
|
54
|
+
k("tr", {
|
|
55
|
+
class: r(v)
|
|
55
56
|
}, [
|
|
56
|
-
|
|
57
|
+
l.showExpand ? (o(), a("th", {
|
|
57
58
|
key: 0,
|
|
58
|
-
class:
|
|
59
|
+
class: r([i])
|
|
59
60
|
}, [
|
|
60
|
-
|
|
61
|
+
s.$slots.expandIcon ? g(s.$slots, "expand-icon", { key: 0 }) : (o(), a("button", {
|
|
61
62
|
key: 1,
|
|
62
|
-
onClick:
|
|
63
|
+
onClick: n[0] || (n[0] = (e) => l.isExpanded ? c("expandAll") : c("collapseAll"))
|
|
63
64
|
}, [
|
|
64
|
-
|
|
65
|
+
l.isExpanded ? (o(), a("span", L, "−")) : (o(), a("span", N, "+"))
|
|
65
66
|
]))
|
|
66
|
-
], 2)) :
|
|
67
|
-
|
|
67
|
+
], 2)) : u("", !0),
|
|
68
|
+
l.showSelect ? (o(), a("th", {
|
|
68
69
|
key: 1,
|
|
69
|
-
class:
|
|
70
|
+
class: r([i, "h-full w-10 flex flex-col items-center justify-center"])
|
|
70
71
|
}, [
|
|
71
|
-
|
|
72
|
+
k("input", {
|
|
72
73
|
ref_key: "checkboxRef",
|
|
73
|
-
ref:
|
|
74
|
+
ref: y,
|
|
74
75
|
type: "checkbox",
|
|
75
|
-
checked:
|
|
76
|
-
"aria-checked":
|
|
77
|
-
onChange:
|
|
76
|
+
checked: l.allSelected,
|
|
77
|
+
"aria-checked": l.someSelected && !l.allSelected ? "mixed" : l.allSelected ? "true" : "false",
|
|
78
|
+
onChange: p,
|
|
78
79
|
class: "h-6 w-6 text-blue-600 transition-all duration-200 ease-in-out rounded print:hidden border-gray-300 dark:border-slate-600 checked:bg-blue-600 checked:border-blue-600 indeterminate:bg-blue-400 indeterminate:border-blue-400"
|
|
79
80
|
}, null, 40, R)
|
|
80
|
-
])) :
|
|
81
|
-
(o(!0),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
e.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
81
|
+
])) : u("", !0),
|
|
82
|
+
(o(!0), a(T, null, D(l.headers, (e) => {
|
|
83
|
+
var d;
|
|
84
|
+
return o(), a("th", {
|
|
85
|
+
key: e.key,
|
|
86
|
+
class: r([i, e.headerAlign === "right" ? "text-right" : e.headerAlign === "left" ? "text-left" : "text-center"]),
|
|
87
|
+
onClick: (M) => C(e),
|
|
88
|
+
style: O({ cursor: e.sortable ? "pointer" : "default" })
|
|
89
|
+
}, [
|
|
90
|
+
(d = l.customSlots) != null && d[`header.${e.value}`] ? (o(), h(b(l.customSlots[`header.${e.value}`]), {
|
|
91
|
+
key: 0,
|
|
92
|
+
header: e
|
|
93
|
+
}, null, 8, ["header"])) : g(s.$slots, `header.${e.key}`, {
|
|
94
|
+
key: 1,
|
|
95
|
+
header: e
|
|
96
|
+
}, () => [
|
|
97
|
+
k("span", null, x(e.label ?? e.text), 1),
|
|
98
|
+
e.sortable ? (o(), a("span", V, [
|
|
99
|
+
(o(), h(b(w(e)), { class: "w-4 h-4 text-gray-500" }))
|
|
100
|
+
])) : u("", !0)
|
|
101
|
+
])
|
|
102
|
+
], 14, U);
|
|
103
|
+
}), 128)),
|
|
104
|
+
l.hasActions ? (o(), a("th", {
|
|
95
105
|
key: 2,
|
|
96
|
-
class:
|
|
97
|
-
},
|
|
106
|
+
class: r([[i], "text-center print:hidden"])
|
|
107
|
+
}, x(l.actionLabel), 3)) : u("", !0)
|
|
98
108
|
])
|
|
99
109
|
]));
|
|
100
110
|
}
|
|
101
111
|
};
|
|
102
112
|
export {
|
|
103
|
-
|
|
113
|
+
Q as default
|
|
104
114
|
};
|