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