adverich-kun-ui 0.1.237 → 0.1.238
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,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as
|
|
2
|
-
import { isMobile as
|
|
1
|
+
import { mergeModels as V, toRefs as ie, useModel as de, ref as pe, watch as j, computed as z, createElementBlock as c, openBlock as l, mergeProps as A, createCommentVNode as i, createElementVNode as D, renderSlot as a, createBlock as y, unref as s, normalizeClass as L, withDirectives as ce, vModelText as me, normalizeProps as d, guardReactiveProps as u, Fragment as ue, createVNode as R, createSlots as U, renderList as N, withCtx as K, isRef as he } from "vue";
|
|
2
|
+
import { isMobile as w } from "../../../../utils/_platform.js";
|
|
3
3
|
import ge from "./KunTableHeaders.vue.js";
|
|
4
4
|
import fe from "./KunTableFooter.vue.js";
|
|
5
5
|
import ye from "./KunTableRows.vue.js";
|
|
@@ -12,58 +12,58 @@ import $e from "../composables/useOptions.js";
|
|
|
12
12
|
import ke from "../composables/useSelect.js";
|
|
13
13
|
import Pe from "../composables/useFilter.js";
|
|
14
14
|
import Te from "../composables/KunTableProps.js";
|
|
15
|
-
const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-full" },
|
|
15
|
+
const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-full" }, Ie = {
|
|
16
16
|
key: 1,
|
|
17
17
|
class: "sticky bottom-0 z-10"
|
|
18
|
-
},
|
|
18
|
+
}, Me = "overflow-auto h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", Ve = "table-auto w-full h-fit text-sm text-left", Ge = {
|
|
19
19
|
__name: "KunTable",
|
|
20
|
-
props: /* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
props: /* @__PURE__ */ V(Te(), {
|
|
21
|
+
selectedItems: { type: Array, default: () => [] },
|
|
22
|
+
selectedItemsModifiers: {}
|
|
23
23
|
}),
|
|
24
|
-
emits: /* @__PURE__ */
|
|
25
|
-
setup(
|
|
26
|
-
const
|
|
27
|
-
headers:
|
|
28
|
-
showExpand:
|
|
29
|
-
showSelect:
|
|
30
|
-
rowClass:
|
|
24
|
+
emits: /* @__PURE__ */ V(["update:page", "update:itemsPerPage", "update:sortBy", "update:search"], ["update:selectedItems"]),
|
|
25
|
+
setup(E, { emit: O }) {
|
|
26
|
+
const B = O, r = E, v = ie(r), W = de(E, "selectedItems"), {
|
|
27
|
+
headers: b,
|
|
28
|
+
showExpand: S,
|
|
29
|
+
showSelect: C,
|
|
30
|
+
rowClass: I,
|
|
31
31
|
hideDefaultFooter: x,
|
|
32
32
|
hideDefaultHeader: H,
|
|
33
33
|
tableClass: Q,
|
|
34
34
|
wrapperClass: q,
|
|
35
35
|
pageOptions: G,
|
|
36
36
|
items: J,
|
|
37
|
-
searchable:
|
|
37
|
+
searchable: M,
|
|
38
38
|
debounceTime: X
|
|
39
|
-
} =
|
|
40
|
-
|
|
39
|
+
} = v, h = pe(r.search);
|
|
40
|
+
j(() => r.search, (e) => {
|
|
41
41
|
e !== h.value && (h.value = e);
|
|
42
42
|
});
|
|
43
|
-
const { filteredItems: Y, setSearch: Z, modalFilter: g, applyColumnFilters: _, clearFilters: ee, appliedFilters: se } = Pe(
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const { filteredItems: Y, setSearch: Z, modalFilter: g, applyColumnFilters: _, clearFilters: ee, appliedFilters: se } = Pe(v, X);
|
|
44
|
+
j(h, (e) => {
|
|
45
|
+
B("update:search", e), Z(e);
|
|
46
46
|
});
|
|
47
|
-
const { options:
|
|
47
|
+
const { options: n, paginatedItems: p, updateSort: te } = $e(v, B, Y), { isSelected: $, toggleSelect: k, toggleSelectAll: le, allSelected: oe, someSelected: ae } = ke(p, W), { isExpanded: P, toggleExpand: T } = Ce(), m = z(() => ({
|
|
48
48
|
items: p.value,
|
|
49
|
-
headers:
|
|
50
|
-
page:
|
|
51
|
-
itemsPerPage:
|
|
52
|
-
toggleSelect:
|
|
53
|
-
isSelected:
|
|
54
|
-
toggleExpand:
|
|
55
|
-
isExpanded:
|
|
56
|
-
sortBy:
|
|
49
|
+
headers: b.value,
|
|
50
|
+
page: n.page,
|
|
51
|
+
itemsPerPage: n.itemsPerPage,
|
|
52
|
+
toggleSelect: k,
|
|
53
|
+
isSelected: $,
|
|
54
|
+
toggleExpand: T,
|
|
55
|
+
isExpanded: P,
|
|
56
|
+
sortBy: n.sortBy,
|
|
57
57
|
hasActions: r.hasActions
|
|
58
|
-
})), re = [
|
|
59
|
-
return
|
|
58
|
+
})), re = [Me, q.value], ne = [Ve, Q.value];
|
|
59
|
+
return z(() => {
|
|
60
60
|
var t;
|
|
61
61
|
let e = ((t = r.headers) == null ? void 0 : t.length) || 0;
|
|
62
62
|
return r.showSelect && (e += 1), r.showExpand && (e += 1), r.hasActions && (e += 1), e;
|
|
63
|
-
}), (e, t) => (l(), c("div",
|
|
64
|
-
s(
|
|
63
|
+
}), (e, t) => (l(), c("div", A({ class: re }, e.$attrs, { style: { "user-select": "text" } }), [
|
|
64
|
+
s(M) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), c("div", {
|
|
65
65
|
key: 0,
|
|
66
|
-
class:
|
|
66
|
+
class: L(["p-2 bg-slate-200 dark:bg-slate-800", {
|
|
67
67
|
"justify-start flex": e.searchPosition === "start",
|
|
68
68
|
"justify-center flex": e.searchPosition === "center",
|
|
69
69
|
"justify-end flex": e.searchPosition === "end"
|
|
@@ -75,8 +75,8 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
|
|
|
75
75
|
onClick: t[0] || (t[0] = (o) => g.value = !0),
|
|
76
76
|
text: "Filtrar",
|
|
77
77
|
bgColor: "bg-slate-300 dark:bg-slate-700"
|
|
78
|
-
})) :
|
|
79
|
-
s(
|
|
78
|
+
})) : i("", !0),
|
|
79
|
+
s(M) ? ce((l(), c("input", {
|
|
80
80
|
key: 1,
|
|
81
81
|
"onUpdate:modelValue": t[1] || (t[1] = (o) => h.value = o),
|
|
82
82
|
type: "text",
|
|
@@ -84,21 +84,21 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
|
|
|
84
84
|
class: "border mx-2 px-3 py-1 rounded w-full max-w-sm text-sm"
|
|
85
85
|
}, null, 8, Fe)), [
|
|
86
86
|
[me, h.value]
|
|
87
|
-
]) :
|
|
87
|
+
]) : i("", !0),
|
|
88
88
|
a(e.$slots, "appendSearch")
|
|
89
|
-
], 2)) :
|
|
90
|
-
|
|
91
|
-
class:
|
|
89
|
+
], 2)) : i("", !0),
|
|
90
|
+
D("table", {
|
|
91
|
+
class: L(ne)
|
|
92
92
|
}, [
|
|
93
|
-
e.$slots.colgroup && !s(
|
|
93
|
+
e.$slots.colgroup && !s(w) ? (l(), c("colgroup", Ae, [
|
|
94
94
|
a(e.$slots, "colgroup", d(u(m.value)))
|
|
95
|
-
])) :
|
|
96
|
-
!s(H) && !s(
|
|
95
|
+
])) : i("", !0),
|
|
96
|
+
!s(H) && !s(w) ? (l(), y(ge, {
|
|
97
97
|
key: 1,
|
|
98
|
-
headers: s(
|
|
99
|
-
"sort-by": s(
|
|
100
|
-
"show-select": s(
|
|
101
|
-
"show-expand": s(
|
|
98
|
+
headers: s(b),
|
|
99
|
+
"sort-by": s(n).sortBy,
|
|
100
|
+
"show-select": s(C),
|
|
101
|
+
"show-expand": s(S),
|
|
102
102
|
"all-selected": s(oe),
|
|
103
103
|
"some-selected": s(ae),
|
|
104
104
|
"thead-class": e.theadClass,
|
|
@@ -108,76 +108,76 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
|
|
|
108
108
|
"action-label": e.actionLabel,
|
|
109
109
|
onSort: s(te),
|
|
110
110
|
onToggleSelectAll: s(le)
|
|
111
|
-
}, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "some-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "onSort", "onToggleSelectAll"])) : a(e.$slots, "thead", d(
|
|
112
|
-
s(p).length && !s(
|
|
111
|
+
}, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "some-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "onSort", "onToggleSelectAll"])) : a(e.$slots, "thead", d(A({ key: 2 }, m.value))),
|
|
112
|
+
s(p).length && !s(w) ? (l(), c(ue, { key: 3 }, [
|
|
113
113
|
a(e.$slots, "body.prepend", d(u(m.value))),
|
|
114
|
-
|
|
114
|
+
R(ye, {
|
|
115
115
|
items: s(p),
|
|
116
|
-
headers: s(
|
|
116
|
+
headers: s(b),
|
|
117
117
|
"tbody-class": e.tbodyClass,
|
|
118
|
-
"row-class": s(
|
|
118
|
+
"row-class": s(I),
|
|
119
119
|
"tr-class": e.trClass,
|
|
120
120
|
"td-class": e.tdClass,
|
|
121
121
|
"selected-class": e.selectedClass,
|
|
122
122
|
"striped-class": e.stripedClass,
|
|
123
|
-
"is-selected": s(
|
|
124
|
-
"is-expanded": s(
|
|
125
|
-
"show-select": s(
|
|
126
|
-
"show-expand": s(
|
|
123
|
+
"is-selected": s($),
|
|
124
|
+
"is-expanded": s(P),
|
|
125
|
+
"show-select": s(C),
|
|
126
|
+
"show-expand": s(S),
|
|
127
127
|
"has-actions": e.hasActions,
|
|
128
128
|
"action-loading-map": e.actionLoadingMap,
|
|
129
|
-
onToggleExpand: s(
|
|
130
|
-
onToggleSelect: s(
|
|
131
|
-
},
|
|
129
|
+
onToggleExpand: s(T),
|
|
130
|
+
onToggleSelect: s(k)
|
|
131
|
+
}, U({ _: 2 }, [
|
|
132
132
|
N(e.$slots, (o, f) => ({
|
|
133
133
|
name: f,
|
|
134
|
-
fn: K((
|
|
135
|
-
a(e.$slots, f, d(u(
|
|
134
|
+
fn: K((F) => [
|
|
135
|
+
a(e.$slots, f, d(u(F)))
|
|
136
136
|
])
|
|
137
137
|
}))
|
|
138
138
|
]), 1032, ["items", "headers", "tbody-class", "row-class", "tr-class", "td-class", "selected-class", "striped-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"]),
|
|
139
139
|
a(e.$slots, "body.append", d(u(m.value)))
|
|
140
|
-
], 64)) : s(p).length && s(
|
|
140
|
+
], 64)) : s(p).length && s(w) ? (l(), y(be, {
|
|
141
141
|
key: 4,
|
|
142
142
|
items: s(p),
|
|
143
|
-
headers: s(
|
|
144
|
-
"row-class": s(
|
|
145
|
-
"is-selected": s(
|
|
146
|
-
"is-expanded": s(
|
|
147
|
-
"show-select": s(
|
|
148
|
-
"show-expand": s(
|
|
143
|
+
headers: s(b),
|
|
144
|
+
"row-class": s(I),
|
|
145
|
+
"is-selected": s($),
|
|
146
|
+
"is-expanded": s(P),
|
|
147
|
+
"show-select": s(C),
|
|
148
|
+
"show-expand": s(S),
|
|
149
149
|
"has-actions": e.hasActions,
|
|
150
150
|
"action-loading-map": e.actionLoadingMap,
|
|
151
|
-
onToggleExpand: s(
|
|
152
|
-
onToggleSelect: s(
|
|
153
|
-
},
|
|
151
|
+
onToggleExpand: s(T),
|
|
152
|
+
onToggleSelect: s(k)
|
|
153
|
+
}, U({ _: 2 }, [
|
|
154
154
|
N(e.$slots, (o, f) => ({
|
|
155
155
|
name: f,
|
|
156
|
-
fn: K((
|
|
157
|
-
a(e.$slots, f, d(u(
|
|
156
|
+
fn: K((F) => [
|
|
157
|
+
a(e.$slots, f, d(u(F)))
|
|
158
158
|
])
|
|
159
159
|
}))
|
|
160
|
-
]), 1032, ["items", "headers", "row-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"])) :
|
|
160
|
+
]), 1032, ["items", "headers", "row-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"])) : i("", !0),
|
|
161
161
|
e.$slots.tfoot ? (l(), c("tfoot", Ee, [
|
|
162
162
|
a(e.$slots, "tfoot", d(u(m.value)))
|
|
163
|
-
])) :
|
|
163
|
+
])) : i("", !0)
|
|
164
164
|
]),
|
|
165
|
-
|
|
166
|
-
s(p).length ?
|
|
165
|
+
D("div", Be, [
|
|
166
|
+
s(p).length ? i("", !0) : (l(), y(Se, {
|
|
167
167
|
key: 0,
|
|
168
168
|
class: "h-full flex justify-center items-center",
|
|
169
169
|
title: e.noDataText,
|
|
170
170
|
titleSize: "text-4xl"
|
|
171
171
|
}, null, 8, ["title"]))
|
|
172
172
|
]),
|
|
173
|
-
s(x) ? a(e.$slots, "footer", d(
|
|
174
|
-
|
|
173
|
+
s(x) ? a(e.$slots, "footer", d(A({ key: 2 }, m.value))) : (l(), c("div", Ie, [
|
|
174
|
+
R(fe, {
|
|
175
175
|
"items-length": s(J).length,
|
|
176
|
-
"items-per-page": s(
|
|
177
|
-
"current-page": s(
|
|
176
|
+
"items-per-page": s(n).itemsPerPage,
|
|
177
|
+
"current-page": s(n).page,
|
|
178
178
|
"page-options": s(G),
|
|
179
|
-
"onUpdate:itemsPerPage": t[2] || (t[2] = (o) => s(
|
|
180
|
-
"onUpdate:page": t[3] || (t[3] = (o) => s(
|
|
179
|
+
"onUpdate:itemsPerPage": t[2] || (t[2] = (o) => s(n).itemsPerPage = o),
|
|
180
|
+
"onUpdate:page": t[3] || (t[3] = (o) => s(n).page = o)
|
|
181
181
|
}, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
|
|
182
182
|
])),
|
|
183
183
|
e.filterable && s(g) ? (l(), y(ve, {
|
|
@@ -188,7 +188,7 @@ const Fe = ["placeholder"], Ae = { key: 0 }, Ee = { key: 5 }, Be = { class: "h-f
|
|
|
188
188
|
onApplyFilters: s(_),
|
|
189
189
|
onClearFilters: s(ee),
|
|
190
190
|
activeFilters: s(se).byColumn
|
|
191
|
-
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) :
|
|
191
|
+
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : i("", !0)
|
|
192
192
|
], 16));
|
|
193
193
|
}
|
|
194
194
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { computed as r, watch as
|
|
2
|
-
function
|
|
1
|
+
import { computed as r, watch as g } from "vue";
|
|
2
|
+
function i(n, u) {
|
|
3
3
|
const a = (l) => u.value.includes(l), h = (l) => {
|
|
4
4
|
const o = u.value.indexOf(l);
|
|
5
5
|
o === -1 ? u.value.push(l) : u.value.splice(o, 1);
|
|
@@ -12,11 +12,11 @@ function x(g, i, n, u) {
|
|
|
12
12
|
}, c = r(() => {
|
|
13
13
|
var l;
|
|
14
14
|
return ((l = n.value) == null ? void 0 : l.length) > 0 && u.value.length === n.value.length;
|
|
15
|
-
}),
|
|
15
|
+
}), S = r(() => {
|
|
16
16
|
var l;
|
|
17
17
|
return ((l = n.value) == null ? void 0 : l.length) > 0 && u.value.length > 0 && u.value.length < n.value.length;
|
|
18
18
|
});
|
|
19
|
-
return
|
|
19
|
+
return g(() => n, (l, o) => {
|
|
20
20
|
l !== o && e();
|
|
21
21
|
}, { deep: !0 }), {
|
|
22
22
|
selectedItems: u,
|
|
@@ -26,9 +26,9 @@ function x(g, i, n, u) {
|
|
|
26
26
|
clearSelection: e,
|
|
27
27
|
toggleSelectAll: f,
|
|
28
28
|
allSelected: c,
|
|
29
|
-
someSelected:
|
|
29
|
+
someSelected: S
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
export {
|
|
33
|
-
|
|
33
|
+
i as default
|
|
34
34
|
};
|