adverich-kun-ui 0.1.158 → 0.1.159
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/components/KunTable/src/components/KunTableHeaders.vue.js +55 -46
- package/dist/components/KunTable/src/composables/KunTableProps.js +1 -0
- package/dist/components/KunTable/src/composables/useOptions.js +37 -19
- package/dist/icons/IconArrowDown.vue.js +20 -0
- package/dist/icons/IconArrowDownUp.vue.js +20 -0
- package/dist/icons/IconArrowUp.vue.js +20 -0
- package/dist/icons/index.js +34 -28
- package/package.json +1 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { createElementBlock as
|
|
2
|
-
|
|
1
|
+
import { createElementBlock as o, openBlock as l, normalizeClass as a, createElementVNode as u, createCommentVNode as m, renderSlot as g, Fragment as w, renderList as B, normalizeStyle as A, toDisplayString as k, createBlock as E, resolveDynamicComponent as T } from "vue";
|
|
2
|
+
import v from "../../../../icons/IconArrowUp.vue.js";
|
|
3
|
+
import $ from "../../../../icons/IconArrowDown.vue.js";
|
|
4
|
+
import D from "../../../../icons/IconArrowDownUp.vue.js";
|
|
5
|
+
const z = { key: 0 }, L = { key: 1 }, O = ["checked"], I = ["onClick"], N = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "inline-flex items-center gap-1 ml-1"
|
|
8
|
+
}, U = "bg-slate-200 dark:bg-slate-800 sticky top-0 z-5", V = "", j = "px-3 py-2 text-xs font-medium text-slate-700 dark:text-slate-300 uppercase tracking-wider", G = {
|
|
3
9
|
__name: "KunTableHeaders",
|
|
4
10
|
props: {
|
|
5
11
|
headers: Array,
|
|
@@ -16,71 +22,74 @@ const A = { key: 0 }, E = { key: 1 }, T = ["checked"], w = ["onClick"], $ = { ke
|
|
|
16
22
|
actionLabel: String
|
|
17
23
|
},
|
|
18
24
|
emits: ["toggle-select-all", "sort", "expandAll", "collapseAll"],
|
|
19
|
-
setup(
|
|
20
|
-
const
|
|
21
|
-
function
|
|
22
|
-
|
|
25
|
+
setup(n, { emit: y }) {
|
|
26
|
+
const r = n, i = y;
|
|
27
|
+
function h() {
|
|
28
|
+
i("toggle-select-all");
|
|
23
29
|
}
|
|
24
|
-
function
|
|
25
|
-
var
|
|
26
|
-
if (!
|
|
27
|
-
const
|
|
28
|
-
|
|
30
|
+
function p(s) {
|
|
31
|
+
var c;
|
|
32
|
+
if (!s.sortable) return;
|
|
33
|
+
const t = (c = r.sortBy) == null ? void 0 : c.find((S) => S.key === s.value), e = (t == null ? void 0 : t.order) === "asc" ? "desc" : "asc";
|
|
34
|
+
i("sort", { key: s.value, order: e });
|
|
29
35
|
}
|
|
30
|
-
function
|
|
31
|
-
var
|
|
32
|
-
return ((
|
|
36
|
+
function x(s) {
|
|
37
|
+
var t, e;
|
|
38
|
+
return (e = (t = r.sortBy) == null ? void 0 : t.find((c) => c.key === s.value)) == null ? void 0 : e.order;
|
|
33
39
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
const C = (s) => {
|
|
41
|
+
const t = x(s);
|
|
42
|
+
return t ? t === "asc" ? v : $ : D;
|
|
43
|
+
}, f = [U, r.theadClass], b = [V, r.trClass], d = [j, r.thClass];
|
|
44
|
+
return (s, t) => (l(), o("thead", {
|
|
45
|
+
class: a(f)
|
|
37
46
|
}, [
|
|
38
|
-
|
|
39
|
-
class:
|
|
47
|
+
u("tr", {
|
|
48
|
+
class: a(b)
|
|
40
49
|
}, [
|
|
41
|
-
|
|
50
|
+
n.showExpand ? (l(), o("th", {
|
|
42
51
|
key: 0,
|
|
43
|
-
class:
|
|
52
|
+
class: a([d])
|
|
44
53
|
}, [
|
|
45
|
-
|
|
54
|
+
s.$slots.expandIcon ? g(s.$slots, "expand-icon", { key: 0 }) : (l(), o("button", {
|
|
46
55
|
key: 1,
|
|
47
|
-
onClick:
|
|
56
|
+
onClick: t[0] || (t[0] = (e) => n.isExpanded ? i("expandAll") : i("collapseAll"))
|
|
48
57
|
}, [
|
|
49
|
-
|
|
58
|
+
n.isExpanded ? (l(), o("span", z, "−")) : (l(), o("span", L, "+"))
|
|
50
59
|
]))
|
|
51
|
-
], 2)) :
|
|
52
|
-
|
|
60
|
+
], 2)) : m("", !0),
|
|
61
|
+
n.showSelect ? (l(), o("th", {
|
|
53
62
|
key: 1,
|
|
54
|
-
class:
|
|
63
|
+
class: a(d)
|
|
55
64
|
}, [
|
|
56
|
-
|
|
65
|
+
u("input", {
|
|
57
66
|
type: "checkbox",
|
|
58
|
-
checked:
|
|
59
|
-
onChange:
|
|
67
|
+
checked: n.allSelected,
|
|
68
|
+
onChange: h,
|
|
60
69
|
class: "form-checkbox"
|
|
61
|
-
}, null, 40,
|
|
62
|
-
])) :
|
|
63
|
-
(
|
|
70
|
+
}, null, 40, O)
|
|
71
|
+
])) : m("", !0),
|
|
72
|
+
(l(!0), o(w, null, B(n.headers, (e) => (l(), o("th", {
|
|
64
73
|
key: e.key,
|
|
65
|
-
class:
|
|
66
|
-
onClick: (
|
|
67
|
-
style:
|
|
74
|
+
class: a([d, e.headerAlign === "right" ? "text-right" : e.headerAlign === "center" ? "text-center" : "text-left"]),
|
|
75
|
+
onClick: (c) => p(e),
|
|
76
|
+
style: A({ cursor: e.sortable ? "pointer" : "default" })
|
|
68
77
|
}, [
|
|
69
|
-
g(
|
|
70
|
-
|
|
71
|
-
e.sortable ? (
|
|
72
|
-
|
|
73
|
-
])) :
|
|
78
|
+
g(s.$slots, `header.${e.key}`, { header: e }, () => [
|
|
79
|
+
u("span", null, k(e.label ?? e.text), 1),
|
|
80
|
+
e.sortable ? (l(), o("span", N, [
|
|
81
|
+
(l(), E(T(C(e)), { class: "w-4 h-4 text-gray-500" }))
|
|
82
|
+
])) : m("", !0)
|
|
74
83
|
])
|
|
75
|
-
], 14,
|
|
76
|
-
|
|
84
|
+
], 14, I))), 128)),
|
|
85
|
+
n.hasActions ? (l(), o("th", {
|
|
77
86
|
key: 2,
|
|
78
|
-
class:
|
|
79
|
-
},
|
|
87
|
+
class: a([[d], "text-center"])
|
|
88
|
+
}, k(n.actionLabel), 3)) : m("", !0)
|
|
80
89
|
])
|
|
81
90
|
]));
|
|
82
91
|
}
|
|
83
92
|
};
|
|
84
93
|
export {
|
|
85
|
-
|
|
94
|
+
G as default
|
|
86
95
|
};
|
|
@@ -12,6 +12,7 @@ const t = () => ({
|
|
|
12
12
|
itemsPerPage: { type: Number, default: 10 },
|
|
13
13
|
page: { type: Number, default: 1 },
|
|
14
14
|
sortBy: { type: Array, default: () => [] },
|
|
15
|
+
mutliSort: Boolean,
|
|
15
16
|
pageOptions: { type: Array, default: () => [5, 10, 25, 50, 100] },
|
|
16
17
|
searchable: { type: Boolean, default: !1 },
|
|
17
18
|
searchableKeys: { type: Array, default: null },
|
|
@@ -1,29 +1,47 @@
|
|
|
1
|
-
import { reactive as x, watch as
|
|
2
|
-
function
|
|
3
|
-
const { page: p, itemsPerPage:
|
|
1
|
+
import { reactive as x, watch as c, computed as f } from "vue";
|
|
2
|
+
function A(y, u, l) {
|
|
3
|
+
const { page: p, itemsPerPage: g, sortBy: P, mutliSort: m } = y, e = x({
|
|
4
4
|
page: p.value,
|
|
5
|
-
itemsPerPage:
|
|
6
|
-
sortBy: [...
|
|
5
|
+
itemsPerPage: g.value,
|
|
6
|
+
sortBy: [...P.value || []]
|
|
7
7
|
});
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
for (const { key:
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
return
|
|
8
|
+
c(() => p.value, (t) => e.page = t), c(() => g.value, (t) => e.itemsPerPage = t), c(() => e.page, (t) => u == null ? void 0 : u("update:page", t)), c(() => e.itemsPerPage, (t) => u == null ? void 0 : u("update:itemsPerPage", t));
|
|
9
|
+
const d = f(() => (e.page - 1) * e.itemsPerPage), B = f(() => d.value + e.itemsPerPage), v = f(() => Array.isArray(l.value) ? e.sortBy.length ? [...l.value].sort((t, s) => {
|
|
10
|
+
for (const { key: i, order: o } of e.sortBy) {
|
|
11
|
+
const n = t[i], r = s[i];
|
|
12
|
+
if (!(n == null && r == null)) {
|
|
13
|
+
if (n == null) return o === "asc" ? -1 : 1;
|
|
14
|
+
if (r == null) return o === "asc" ? 1 : -1;
|
|
15
|
+
if (n instanceof Date && r instanceof Date) {
|
|
16
|
+
const a = n.getTime() - r.getTime();
|
|
17
|
+
if (a !== 0) return o === "asc" ? a : -a;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (typeof n == "number" && typeof r == "number") {
|
|
21
|
+
const a = n - r;
|
|
22
|
+
if (a !== 0) return o === "asc" ? a : -a;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (typeof n == "string" && typeof r == "string") {
|
|
26
|
+
const a = n.localeCompare(r, void 0, { sensitivity: "base" });
|
|
27
|
+
if (a !== 0) return o === "asc" ? a : -a;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (n !== r) return o === "asc" ? n > r ? 1 : -1 : n < r ? 1 : -1;
|
|
31
|
+
}
|
|
14
32
|
}
|
|
15
33
|
return 0;
|
|
16
|
-
}) :
|
|
34
|
+
}) : l.value : []), b = f(() => v.value.slice(d.value, B.value));
|
|
17
35
|
return {
|
|
18
|
-
options:
|
|
19
|
-
paginatedItems:
|
|
20
|
-
updateSort: (
|
|
21
|
-
const
|
|
22
|
-
|
|
36
|
+
options: e,
|
|
37
|
+
paginatedItems: b,
|
|
38
|
+
updateSort: ({ key: t, order: s }) => {
|
|
39
|
+
const i = e.sortBy.find((o) => o.key === t);
|
|
40
|
+
i ? i.order = s : m.value ? e.sortBy.push({ key: t, order: s }) : e.sortBy = [{ key: t, order: s }];
|
|
23
41
|
},
|
|
24
|
-
sortedItems:
|
|
42
|
+
sortedItems: v
|
|
25
43
|
};
|
|
26
44
|
}
|
|
27
45
|
export {
|
|
28
|
-
|
|
46
|
+
A as default
|
|
29
47
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createElementBlock as e, openBlock as o, createElementVNode as l } from "vue";
|
|
2
|
+
import r from "../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
const n = {}, m = {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: "24",
|
|
6
|
+
height: "24",
|
|
7
|
+
viewBox: "0 0 24 24"
|
|
8
|
+
};
|
|
9
|
+
function c(s, t) {
|
|
10
|
+
return o(), e("svg", m, t[0] || (t[0] = [
|
|
11
|
+
l("path", {
|
|
12
|
+
fill: "currentColor",
|
|
13
|
+
d: "m12 20l-.707.707l.707.707l.707-.707zm1-15a1 1 0 1 0-2 0zm-7.707 9.707l6 6l1.414-1.414l-6-6zm7.414 6l6-6l-1.414-1.414l-6 6zM13 20V5h-2v15z"
|
|
14
|
+
}, null, -1)
|
|
15
|
+
]));
|
|
16
|
+
}
|
|
17
|
+
const w = /* @__PURE__ */ r(n, [["render", c]]);
|
|
18
|
+
export {
|
|
19
|
+
w as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createElementBlock as t, openBlock as e, createElementVNode as o } from "vue";
|
|
2
|
+
import r from "../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
const n = {}, m = {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: "24",
|
|
6
|
+
height: "24",
|
|
7
|
+
viewBox: "0 0 24 24"
|
|
8
|
+
};
|
|
9
|
+
function c(s, l) {
|
|
10
|
+
return e(), t("svg", m, l[0] || (l[0] = [
|
|
11
|
+
o("path", {
|
|
12
|
+
fill: "currentColor",
|
|
13
|
+
d: "m8 2l-.707-.707L8 .586l.707.707zm1 15a1 1 0 1 1-2 0zM2.293 6.293l5-5l1.414 1.414l-5 5zm6.414-5l5 5l-1.414 1.414l-5-5zM9 2v15H7V2zm7 20l-.707.707l.707.707l.707-.707zm1-15a1 1 0 1 0-2 0zm-6.707 10.707l5 5l1.414-1.414l-5-5zm6.414 5l5-5l-1.414-1.414l-5 5zM17 22V7h-2v15z"
|
|
14
|
+
}, null, -1)
|
|
15
|
+
]));
|
|
16
|
+
}
|
|
17
|
+
const a = /* @__PURE__ */ r(n, [["render", c]]);
|
|
18
|
+
export {
|
|
19
|
+
a as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createElementBlock as e, openBlock as l, createElementVNode as o } from "vue";
|
|
2
|
+
import r from "../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
const n = {}, c = {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
width: "24",
|
|
6
|
+
height: "24",
|
|
7
|
+
viewBox: "0 0 24 24"
|
|
8
|
+
};
|
|
9
|
+
function m(s, t) {
|
|
10
|
+
return l(), e("svg", c, t[0] || (t[0] = [
|
|
11
|
+
o("path", {
|
|
12
|
+
fill: "currentColor",
|
|
13
|
+
d: "m12 4l-.707-.707l.707-.707l.707.707zm1 15a1 1 0 1 1-2 0zM5.293 9.293l6-6l1.414 1.414l-6 6zm7.414-6l6 6l-1.414 1.414l-6-6zM13 4v15h-2V4z"
|
|
14
|
+
}, null, -1)
|
|
15
|
+
]));
|
|
16
|
+
}
|
|
17
|
+
const p = /* @__PURE__ */ r(n, [["render", m]]);
|
|
18
|
+
export {
|
|
19
|
+
p as default
|
|
20
|
+
};
|
package/dist/icons/index.js
CHANGED
|
@@ -1,33 +1,39 @@
|
|
|
1
|
-
import o from "./
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import i from "./
|
|
7
|
-
import m from "./
|
|
8
|
-
import c from "./
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import u from "./
|
|
1
|
+
import o from "./IconAccountOutline.vue.js";
|
|
2
|
+
import r from "./IconArrowDown.vue.js";
|
|
3
|
+
import n from "./IconArrowDownUp.vue.js";
|
|
4
|
+
import t from "./IconArrowUp.vue.js";
|
|
5
|
+
import e from "./IconAsterisk.vue.js";
|
|
6
|
+
import i from "./IconCheck.vue.js";
|
|
7
|
+
import m from "./IconClose.vue.js";
|
|
8
|
+
import c from "./IconDelete.vue.js";
|
|
9
|
+
import p from "./IconEdit.vue.js";
|
|
10
|
+
import f from "./IconEyeOutline.vue.js";
|
|
11
|
+
import l from "./IconEyeOffOutline.vue.js";
|
|
12
|
+
import u from "./IconMenuDownOutline.vue.js";
|
|
13
|
+
import a from "./IconMenuUpOutline.vue.js";
|
|
13
14
|
import I from "./IconPencil.vue.js";
|
|
14
|
-
import O from "./
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
import O from "./IconSearch.vue.js";
|
|
16
|
+
import s from "./IconStar.vue.js";
|
|
17
|
+
import w from "./IconTrashOutline.vue.js";
|
|
18
|
+
const q = {
|
|
19
|
+
accountOutline: o,
|
|
20
|
+
arrowDown: r,
|
|
21
|
+
arrowDownUp: n,
|
|
22
|
+
arrowUp: t,
|
|
23
|
+
asterisk: e,
|
|
24
|
+
check: i,
|
|
25
|
+
close: m,
|
|
26
|
+
delete: c,
|
|
27
|
+
edit: p,
|
|
28
|
+
eyeOutline: f,
|
|
29
|
+
eyeOffOutline: l,
|
|
30
|
+
menuDownOutline: u,
|
|
31
|
+
menuUpOutline: a,
|
|
28
32
|
pencil: I,
|
|
29
|
-
|
|
33
|
+
search: O,
|
|
34
|
+
star: s,
|
|
35
|
+
trashOutline: w
|
|
30
36
|
};
|
|
31
37
|
export {
|
|
32
|
-
|
|
38
|
+
q as icons
|
|
33
39
|
};
|