adverich-kun-ui 0.1.389 → 0.1.390
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,37 +1,37 @@
|
|
|
1
|
-
import { mergeModels as W, toRefs as
|
|
1
|
+
import { mergeModels as W, toRefs as Se, useModel as Ce, ref as v, watch as Q, computed as q, onMounted as Te, createElementBlock as r, openBlock as l, mergeProps as V, createCommentVNode as u, createElementVNode as j, renderSlot as a, createBlock as b, unref as s, normalizeClass as S, withCtx as x, createVNode as C, withDirectives as G, vModelText as Fe, vShow as J, normalizeProps as d, guardReactiveProps as g, Fragment as ke, createSlots as X, renderList as Y, toDisplayString as $e, isRef as Pe, nextTick as Me } from "vue";
|
|
2
2
|
import { isMobile as m } from "../../../../utils/_platform.js";
|
|
3
3
|
import Z from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key: 0 },
|
|
4
|
+
import Ae from "../../../../icons/IconFilter.vue.js";
|
|
5
|
+
import Ie from "../../../../icons/IconSearch.vue.js";
|
|
6
|
+
import Re from "./KunTableHeaders.vue.js";
|
|
7
|
+
import Ee from "./KunTableFooter.vue.js";
|
|
8
|
+
import Be from "./KunTableRows.vue.js";
|
|
9
|
+
import Ve from "./KunTableIterators.vue.js";
|
|
10
|
+
import je from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
11
|
+
import xe from "./KunTableFilter.vue.js";
|
|
12
|
+
import ze from "../composables/useExpand.js";
|
|
13
|
+
import De from "../composables/useOptions.js";
|
|
14
|
+
import He from "../composables/useSelect.js";
|
|
15
|
+
import Ne from "../composables/useFilter.js";
|
|
16
|
+
import Oe from "../composables/KunTableProps.js";
|
|
17
|
+
const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key: 0 }, We = { key: 5 }, Qe = {
|
|
18
18
|
key: 1,
|
|
19
19
|
class: "h-full flex justify-center items-center"
|
|
20
|
-
},
|
|
20
|
+
}, qe = { class: "text-center text-4xl" }, Ge = {
|
|
21
21
|
key: 1,
|
|
22
22
|
class: "sticky bottom-0 z-10 print:hidden"
|
|
23
|
-
},
|
|
23
|
+
}, Je = "overflow-hidden h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", Xe = "table-auto w-full h-fit text-sm text-left", ms = {
|
|
24
24
|
__name: "KunTable",
|
|
25
|
-
props: /* @__PURE__ */ W(
|
|
25
|
+
props: /* @__PURE__ */ W(Oe(), {
|
|
26
26
|
selectedItems: { type: Array, default: () => [] },
|
|
27
27
|
selectedItemsModifiers: {}
|
|
28
28
|
}),
|
|
29
|
-
emits: /* @__PURE__ */ W(["update:page", "update:itemsPerPage", "update:sortBy", "update:search"], ["update:selectedItems"]),
|
|
30
|
-
setup(
|
|
31
|
-
const
|
|
29
|
+
emits: /* @__PURE__ */ W(["update:page", "update:itemsPerPage", "update:sortBy", "update:search", "focusOnSearch"], ["update:selectedItems"]),
|
|
30
|
+
setup(z, { emit: _ }) {
|
|
31
|
+
const T = _, p = z, F = Se(p), ee = Ce(z, "selectedItems"), {
|
|
32
32
|
headers: D,
|
|
33
33
|
showExpand: k,
|
|
34
|
-
showSelect:
|
|
34
|
+
showSelect: $,
|
|
35
35
|
rowClass: H,
|
|
36
36
|
hideDefaultFooter: se,
|
|
37
37
|
hideDefaultHeader: oe,
|
|
@@ -41,26 +41,26 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key:
|
|
|
41
41
|
items: ne,
|
|
42
42
|
searchable: N,
|
|
43
43
|
debounceTime: re
|
|
44
|
-
} =
|
|
44
|
+
} = F, w = v(p.search);
|
|
45
45
|
Q(() => p.search, (e) => {
|
|
46
46
|
e !== w.value && (w.value = e);
|
|
47
47
|
});
|
|
48
|
-
const { filteredItems: ie, setSearch: ce, modalFilter: y, applyColumnFilters: ue, clearFilters: de, appliedFilters: pe } =
|
|
48
|
+
const { filteredItems: ie, setSearch: ce, modalFilter: y, applyColumnFilters: ue, clearFilters: de, appliedFilters: pe } = Ne(F, re);
|
|
49
49
|
Q(w, (e) => {
|
|
50
|
-
|
|
50
|
+
T("update:search", e), ce(e);
|
|
51
51
|
});
|
|
52
|
-
const { options: i, paginatedItems: f, updateSort: me } =
|
|
52
|
+
const { options: i, paginatedItems: f, updateSort: me } = De(F, T, ie), { isSelected: P, toggleSelect: M, toggleSelectAll: fe, allSelected: he, someSelected: ge } = He(f, ee), { isExpanded: A, toggleExpand: I } = ze(), h = q(() => ({
|
|
53
53
|
items: f.value,
|
|
54
54
|
headers: D.value,
|
|
55
55
|
page: i.page,
|
|
56
56
|
itemsPerPage: i.itemsPerPage,
|
|
57
|
-
toggleSelect:
|
|
58
|
-
isSelected:
|
|
59
|
-
toggleExpand:
|
|
60
|
-
isExpanded:
|
|
57
|
+
toggleSelect: M,
|
|
58
|
+
isSelected: P,
|
|
59
|
+
toggleExpand: I,
|
|
60
|
+
isExpanded: A,
|
|
61
61
|
sortBy: i.sortBy,
|
|
62
62
|
hasActions: p.hasActions
|
|
63
|
-
})), we = [
|
|
63
|
+
})), we = [Je, le.value], ye = [Xe, te.value], O = q(() => p.headers.map((e) => {
|
|
64
64
|
var t, c;
|
|
65
65
|
const o = { ...e };
|
|
66
66
|
if ((e.columnType === "function" || e.columnType == "objectFunction" || e.columnType == "simpleFunction") && typeof e.columnFunction == "string") {
|
|
@@ -77,21 +77,24 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key:
|
|
|
77
77
|
}
|
|
78
78
|
return o;
|
|
79
79
|
}));
|
|
80
|
-
|
|
81
|
-
const
|
|
80
|
+
Te(() => L());
|
|
81
|
+
const K = v(null), R = v(!0), E = v(!1);
|
|
82
82
|
function ve() {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
T("focusOnSearch"), be();
|
|
84
|
+
}
|
|
85
|
+
function be() {
|
|
86
|
+
m.value && (U(), Me(() => {
|
|
87
|
+
K.value.focus();
|
|
85
88
|
}));
|
|
86
89
|
}
|
|
87
|
-
function
|
|
88
|
-
m.value && (
|
|
90
|
+
function L() {
|
|
91
|
+
m.value && (B.value = "w-fit", R.value = !1, E.value = !0);
|
|
89
92
|
}
|
|
90
|
-
function
|
|
91
|
-
m.value && (
|
|
93
|
+
function U() {
|
|
94
|
+
m.value && (B.value = "w-full border", E.value = !1, R.value = !0);
|
|
92
95
|
}
|
|
93
|
-
const
|
|
94
|
-
return (e, o) => (l(), r("div",
|
|
96
|
+
const B = v("w-full border max-w-sm");
|
|
97
|
+
return (e, o) => (l(), r("div", V({ class: we }, e.$attrs, { style: { "user-select": "text" } }), [
|
|
95
98
|
s(N) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), r("div", {
|
|
96
99
|
key: 0,
|
|
97
100
|
class: S(["p-2 bg-slate-200 dark:bg-slate-800 print:hidden", {
|
|
@@ -101,7 +104,7 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key:
|
|
|
101
104
|
}])
|
|
102
105
|
}, [
|
|
103
106
|
a(e.$slots, "prependSearch"),
|
|
104
|
-
e.filterable && e.filters.length ? (l(), b(
|
|
107
|
+
e.filterable && e.filters.length ? (l(), b(je, {
|
|
105
108
|
key: 0,
|
|
106
109
|
class: "h-fit",
|
|
107
110
|
onClick: o[0] || (o[0] = (t) => y.value = !0),
|
|
@@ -109,10 +112,10 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key:
|
|
|
109
112
|
size: "xs",
|
|
110
113
|
bgColor: "bg-green-200 dark:bg-green-800"
|
|
111
114
|
}, {
|
|
112
|
-
default:
|
|
115
|
+
default: x(() => [
|
|
113
116
|
C(Z, {
|
|
114
117
|
class: "h-fit",
|
|
115
|
-
icon:
|
|
118
|
+
icon: Ae,
|
|
116
119
|
size: "text-lg"
|
|
117
120
|
})
|
|
118
121
|
]),
|
|
@@ -120,31 +123,31 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key:
|
|
|
120
123
|
})) : u("", !0),
|
|
121
124
|
s(N) ? (l(), r("div", {
|
|
122
125
|
key: 1,
|
|
123
|
-
class: S(["rounded flex mx-2", [
|
|
126
|
+
class: S(["rounded flex mx-2", [B.value]])
|
|
124
127
|
}, [
|
|
125
|
-
G(
|
|
128
|
+
G(j("input", {
|
|
126
129
|
"onUpdate:modelValue": o[1] || (o[1] = (t) => w.value = t),
|
|
127
130
|
type: "text",
|
|
128
131
|
placeholder: e.searchPlaceholder,
|
|
129
132
|
class: S(["w-full text-sm", s(m) ? "px-1" : "px-2 py-1"]),
|
|
130
133
|
ref_key: "searchRef",
|
|
131
|
-
ref:
|
|
132
|
-
onFocus:
|
|
133
|
-
onBlur:
|
|
134
|
+
ref: K,
|
|
135
|
+
onFocus: U,
|
|
136
|
+
onBlur: L
|
|
134
137
|
}, null, 42, Ke), [
|
|
135
|
-
[
|
|
136
|
-
[J,
|
|
138
|
+
[Fe, w.value],
|
|
139
|
+
[J, R.value]
|
|
137
140
|
]),
|
|
138
141
|
G(C(Z, {
|
|
139
|
-
icon:
|
|
142
|
+
icon: Ie,
|
|
140
143
|
onClick: ve
|
|
141
144
|
}, null, 512), [
|
|
142
|
-
[J,
|
|
145
|
+
[J, E.value]
|
|
143
146
|
])
|
|
144
147
|
], 2)) : u("", !0),
|
|
145
148
|
a(e.$slots, "appendSearch")
|
|
146
149
|
], 2)) : u("", !0),
|
|
147
|
-
|
|
150
|
+
j("div", Le, [
|
|
148
151
|
s(f).length ? (l(), r("table", {
|
|
149
152
|
key: 0,
|
|
150
153
|
class: S(ye)
|
|
@@ -152,11 +155,11 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key:
|
|
|
152
155
|
e.$slots.colgroup && !s(m) ? (l(), r("colgroup", Ue, [
|
|
153
156
|
a(e.$slots, "colgroup", d(g(h.value)))
|
|
154
157
|
])) : u("", !0),
|
|
155
|
-
!s(oe) && !s(m) ? (l(), b(
|
|
158
|
+
!s(oe) && !s(m) ? (l(), b(Re, {
|
|
156
159
|
key: 1,
|
|
157
160
|
headers: s(D),
|
|
158
161
|
"sort-by": s(i).sortBy,
|
|
159
|
-
"show-select": s(
|
|
162
|
+
"show-select": s($),
|
|
160
163
|
"show-expand": s(k),
|
|
161
164
|
"all-selected": s(he),
|
|
162
165
|
"some-selected": s(ge),
|
|
@@ -168,34 +171,34 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key:
|
|
|
168
171
|
onSort: s(me),
|
|
169
172
|
onToggleSelectAll: s(fe),
|
|
170
173
|
customHeaders: e.customSlots
|
|
171
|
-
}, 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", "customHeaders"])) : a(e.$slots, "thead", d(
|
|
172
|
-
s(m) ? (l(), b(
|
|
174
|
+
}, 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", "customHeaders"])) : a(e.$slots, "thead", d(V({ key: 2 }, h.value))),
|
|
175
|
+
s(m) ? (l(), b(Ve, {
|
|
173
176
|
key: 4,
|
|
174
177
|
items: s(f),
|
|
175
|
-
headers:
|
|
178
|
+
headers: O.value,
|
|
176
179
|
"row-class": s(H),
|
|
177
180
|
"row-class-condition": e.rowClassCondition,
|
|
178
|
-
"is-selected": s(
|
|
179
|
-
"is-expanded": s(
|
|
180
|
-
"show-select": s(
|
|
181
|
+
"is-selected": s(P),
|
|
182
|
+
"is-expanded": s(A),
|
|
183
|
+
"show-select": s($),
|
|
181
184
|
"show-expand": s(k),
|
|
182
185
|
"has-actions": e.hasActions,
|
|
183
186
|
"action-loading-map": e.actionLoadingMap,
|
|
184
|
-
onToggleExpand: s(
|
|
185
|
-
onToggleSelect: s(
|
|
187
|
+
onToggleExpand: s(I),
|
|
188
|
+
onToggleSelect: s(M),
|
|
186
189
|
customSlots: e.customSlots
|
|
187
190
|
}, X({ _: 2 }, [
|
|
188
191
|
Y(e.$slots, (t, c) => ({
|
|
189
192
|
name: c,
|
|
190
|
-
fn:
|
|
193
|
+
fn: x((n) => [
|
|
191
194
|
a(e.$slots, c, d(g(n)))
|
|
192
195
|
])
|
|
193
196
|
}))
|
|
194
197
|
]), 1032, ["items", "headers", "row-class", "row-class-condition", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect", "customSlots"])) : (l(), r(ke, { key: 3 }, [
|
|
195
198
|
a(e.$slots, "body.prepend", d(g(h.value))),
|
|
196
|
-
C(
|
|
199
|
+
C(Be, {
|
|
197
200
|
items: s(f),
|
|
198
|
-
headers:
|
|
201
|
+
headers: O.value,
|
|
199
202
|
"tbody-class": e.tbodyClass,
|
|
200
203
|
"row-class": s(H),
|
|
201
204
|
"row-class-condition": e.rowClassCondition,
|
|
@@ -203,35 +206,35 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key:
|
|
|
203
206
|
"td-class": e.tdClass,
|
|
204
207
|
"selected-class": e.selectedClass,
|
|
205
208
|
"striped-class": e.stripedClass,
|
|
206
|
-
"is-selected": s(
|
|
207
|
-
"is-expanded": s(
|
|
208
|
-
"show-select": s(
|
|
209
|
+
"is-selected": s(P),
|
|
210
|
+
"is-expanded": s(A),
|
|
211
|
+
"show-select": s($),
|
|
209
212
|
"show-expand": s(k),
|
|
210
213
|
"has-actions": e.hasActions,
|
|
211
214
|
"action-loading-map": e.actionLoadingMap,
|
|
212
|
-
onToggleExpand: s(
|
|
213
|
-
onToggleSelect: s(
|
|
215
|
+
onToggleExpand: s(I),
|
|
216
|
+
onToggleSelect: s(M),
|
|
214
217
|
customSlots: e.customSlots
|
|
215
218
|
}, X({ _: 2 }, [
|
|
216
219
|
Y(e.$slots, (t, c) => ({
|
|
217
220
|
name: c,
|
|
218
|
-
fn:
|
|
221
|
+
fn: x((n) => [
|
|
219
222
|
a(e.$slots, c, d(g(n)))
|
|
220
223
|
])
|
|
221
224
|
}))
|
|
222
225
|
]), 1032, ["items", "headers", "tbody-class", "row-class", "row-class-condition", "tr-class", "td-class", "selected-class", "striped-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect", "customSlots"]),
|
|
223
226
|
a(e.$slots, "body.append", d(g(h.value)))
|
|
224
227
|
], 64)),
|
|
225
|
-
e.$slots.tfoot ? (l(), r("tfoot",
|
|
228
|
+
e.$slots.tfoot ? (l(), r("tfoot", We, [
|
|
226
229
|
a(e.$slots, "tfoot", d(g(h.value)))
|
|
227
230
|
])) : u("", !0)
|
|
228
231
|
])) : u("", !0),
|
|
229
|
-
s(f).length ? u("", !0) : (l(), r("div",
|
|
230
|
-
|
|
232
|
+
s(f).length ? u("", !0) : (l(), r("div", Qe, [
|
|
233
|
+
j("div", qe, $e(e.noDataText), 1)
|
|
231
234
|
]))
|
|
232
235
|
]),
|
|
233
|
-
s(se) ? a(e.$slots, "footer", d(
|
|
234
|
-
C(
|
|
236
|
+
s(se) ? a(e.$slots, "footer", d(V({ key: 2 }, h.value))) : (l(), r("div", Ge, [
|
|
237
|
+
C(Ee, {
|
|
235
238
|
"items-length": s(ne).length,
|
|
236
239
|
"items-per-page": s(i).itemsPerPage,
|
|
237
240
|
"current-page": s(i).page,
|
|
@@ -240,11 +243,11 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key:
|
|
|
240
243
|
"onUpdate:page": o[3] || (o[3] = (t) => s(i).page = t)
|
|
241
244
|
}, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
|
|
242
245
|
])),
|
|
243
|
-
e.filterable && s(y) ? (l(), b(
|
|
246
|
+
e.filterable && s(y) ? (l(), b(xe, {
|
|
244
247
|
key: 3,
|
|
245
248
|
filters: e.filters,
|
|
246
249
|
modelValue: s(y),
|
|
247
|
-
"onUpdate:modelValue": o[4] || (o[4] = (t) =>
|
|
250
|
+
"onUpdate:modelValue": o[4] || (o[4] = (t) => Pe(y) ? y.value = t : null),
|
|
248
251
|
onApplyFilters: s(ue),
|
|
249
252
|
onClearFilters: s(de),
|
|
250
253
|
activeFilters: s(pe).byColumn
|
|
@@ -253,5 +256,5 @@ const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key:
|
|
|
253
256
|
}
|
|
254
257
|
};
|
|
255
258
|
export {
|
|
256
|
-
|
|
259
|
+
ms as default
|
|
257
260
|
};
|