adverich-kun-ui 0.1.608 → 0.1.609
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,36 +1,36 @@
|
|
|
1
|
-
import { toRefs as
|
|
1
|
+
import { toRefs as Ie, useModel as He, computed as P, reactive as ue, ref as S, watch as m, onMounted as Oe, openBlock as n, createElementBlock as i, mergeProps as q, unref as o, renderSlot as d, createCommentVNode as f, createElementVNode as R, toDisplayString as ie, createBlock as K, withCtx as J, createVNode as V, normalizeClass as W, withDirectives as ce, vModelText as ze, vShow as de, normalizeProps as y, guardReactiveProps as B, Fragment as Le, createSlots as pe, renderList as me, mergeModels as ge, nextTick as fe } from "vue";
|
|
2
2
|
import { isMobile as b } from "../../../../utils/_platform.js";
|
|
3
|
-
import { debounce as
|
|
3
|
+
import { debounce as je } from "../../../../utils/utils.js";
|
|
4
4
|
import he from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { resolveRowKeyValue as
|
|
15
|
-
import
|
|
16
|
-
const
|
|
5
|
+
import De from "../../../../icons/IconFilter.vue.js";
|
|
6
|
+
import Ue from "../../../../icons/IconSearch.vue.js";
|
|
7
|
+
import Qe from "../../../KunTable/src/components/KunTableHeaders.vue.js";
|
|
8
|
+
import qe from "../../../KunTable/src/components/KunTableFooter.vue.js";
|
|
9
|
+
import Je from "../../../KunTable/src/components/KunTableRows.vue.js";
|
|
10
|
+
import We from "../../../KunTable/src/components/KunTableIterators.vue.js";
|
|
11
|
+
import Ge from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
12
|
+
import Xe from "../../../KunTable/src/components/KunTableFilter.vue.js";
|
|
13
|
+
import Ye from "../../../KunTable/src/composables/useExpand.js";
|
|
14
|
+
import { resolveRowKeyValue as Ze } from "../../../KunTable/src/composables/useRowKey.js";
|
|
15
|
+
import _e from "../composables/KunTableServerSideProps.js";
|
|
16
|
+
const es = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "p-2 bg-surface print:hidden flex w-full justify-between"
|
|
19
|
-
},
|
|
19
|
+
}, ss = {
|
|
20
20
|
key: 0,
|
|
21
21
|
class: "w-full flex items-center"
|
|
22
|
-
},
|
|
22
|
+
}, ts = {
|
|
23
23
|
key: 1,
|
|
24
24
|
class: "inline-flex items-center justify-center whitespace-nowrap"
|
|
25
|
-
},
|
|
25
|
+
}, as = { class: "pr-2" }, os = { class: "min-w-1/3 flex h-full items-center justify-end" }, ls = ["placeholder"], rs = { class: "flex-1 overflow-auto bg-surface" }, ns = { key: 0 }, us = { key: 5 }, is = {
|
|
26
26
|
key: 1,
|
|
27
27
|
class: "h-full flex justify-center items-center"
|
|
28
|
-
},
|
|
28
|
+
}, cs = { class: "text-center text-4xl" }, ds = {
|
|
29
29
|
key: 1,
|
|
30
30
|
class: "sticky bottom-0 z-10 print:hidden"
|
|
31
|
-
},
|
|
31
|
+
}, ps = "overflow-hidden h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", ms = "table-auto w-full h-fit text-sm text-left", As = {
|
|
32
32
|
__name: "KunTableServerSide",
|
|
33
|
-
props: /* @__PURE__ */ ge(
|
|
33
|
+
props: /* @__PURE__ */ ge(_e(), {
|
|
34
34
|
selectedItems: { type: Array, default: () => [] },
|
|
35
35
|
selectedItemsModifiers: {}
|
|
36
36
|
}),
|
|
@@ -43,7 +43,7 @@ const _e = {
|
|
|
43
43
|
"focusOnSearch"
|
|
44
44
|
], ["update:selectedItems"]),
|
|
45
45
|
setup(G, { emit: ve }) {
|
|
46
|
-
const w = ve, r = G, ye =
|
|
46
|
+
const w = ve, r = G, ye = Ie(r), u = He(G, "selectedItems"), {
|
|
47
47
|
headers: X,
|
|
48
48
|
showExpand: I,
|
|
49
49
|
showSelect: H,
|
|
@@ -55,7 +55,8 @@ const _e = {
|
|
|
55
55
|
wrapperClass: ke,
|
|
56
56
|
pageOptions: Ce,
|
|
57
57
|
searchable: Z,
|
|
58
|
-
filters: _
|
|
58
|
+
filters: _,
|
|
59
|
+
hideSelected: $e
|
|
59
60
|
} = ye, ee = (e) => typeof e == "string" ? [{ key: e, order: "asc" }] : Array.isArray(e) ? e.map((s) => typeof s == "string" ? { key: s, order: "asc" } : s) : [], p = P(() => {
|
|
60
61
|
var e;
|
|
61
62
|
return (e = r.result) != null && e.result && typeof r.result.result == "object" ? r.result.result : r.result ?? {};
|
|
@@ -120,7 +121,7 @@ const _e = {
|
|
|
120
121
|
s.columnFunction = typeof l == "function" ? l : () => "";
|
|
121
122
|
}
|
|
122
123
|
return s;
|
|
123
|
-
})), N = (e, s = -1) =>
|
|
124
|
+
})), N = (e, s = -1) => Ze(e, be.value, s), te = (e, s = -1) => N(e, s) ?? `kun-table-server-row-${s}`, ae = (e, s = -1) => {
|
|
124
125
|
var l;
|
|
125
126
|
const a = N(e, s);
|
|
126
127
|
return a === null ? !1 : ((l = r.actionLoadingMap) == null ? void 0 : l[a]) || !1;
|
|
@@ -135,7 +136,7 @@ const _e = {
|
|
|
135
136
|
return;
|
|
136
137
|
}
|
|
137
138
|
u.value = [...u.value, e];
|
|
138
|
-
}, L = P(() => c.value.length > 0 && c.value.every(C)),
|
|
139
|
+
}, L = P(() => c.value.length > 0 && c.value.every(C)), Fe = P(() => c.value.some(C) && !L.value), Be = () => {
|
|
139
140
|
if (L.value) {
|
|
140
141
|
oe();
|
|
141
142
|
return;
|
|
@@ -145,7 +146,7 @@ const _e = {
|
|
|
145
146
|
m(c, () => {
|
|
146
147
|
u.value = u.value.filter((e, s) => c.value.some((a, l) => O(e, a, s, l)));
|
|
147
148
|
}, { deep: !0 });
|
|
148
|
-
const { isExpanded: j, toggleExpand: D } =
|
|
149
|
+
const { isExpanded: j, toggleExpand: D } = Ye(), Te = () => {
|
|
149
150
|
const [e] = t.sortBy;
|
|
150
151
|
return {
|
|
151
152
|
page: t.page,
|
|
@@ -157,8 +158,8 @@ const _e = {
|
|
|
157
158
|
filters: { ...v.byColumn }
|
|
158
159
|
};
|
|
159
160
|
}, $ = () => {
|
|
160
|
-
w("update:page", t.page), w("update:itemsPerPage", t.itemsPerPage), w("update:sortBy", t.sortBy), w("update:query",
|
|
161
|
-
},
|
|
161
|
+
w("update:page", t.page), w("update:itemsPerPage", t.itemsPerPage), w("update:sortBy", t.sortBy), w("update:query", Te());
|
|
162
|
+
}, Ae = je((e) => {
|
|
162
163
|
if (v.search = e ?? "", t.page !== 1) {
|
|
163
164
|
t.page = 1;
|
|
164
165
|
return;
|
|
@@ -166,7 +167,7 @@ const _e = {
|
|
|
166
167
|
$();
|
|
167
168
|
}, r.debounceTime ?? 300);
|
|
168
169
|
m(T, (e) => {
|
|
169
|
-
k.value || (w("update:search", e),
|
|
170
|
+
k.value || (w("update:search", e), Ae(e));
|
|
170
171
|
}), m(() => t.page, (e, s) => {
|
|
171
172
|
k.value || e !== s && $();
|
|
172
173
|
}), m(() => t.itemsPerPage, (e, s) => {
|
|
@@ -186,19 +187,19 @@ const _e = {
|
|
|
186
187
|
$();
|
|
187
188
|
}
|
|
188
189
|
}, { deep: !0 });
|
|
189
|
-
const
|
|
190
|
+
const Ne = (e) => {
|
|
190
191
|
if (v.byColumn = { ...e }, t.page !== 1) {
|
|
191
192
|
t.page = 1;
|
|
192
193
|
return;
|
|
193
194
|
}
|
|
194
195
|
$();
|
|
195
|
-
},
|
|
196
|
+
}, Ee = () => {
|
|
196
197
|
if (v.byColumn = {}, t.page !== 1) {
|
|
197
198
|
t.page = 1;
|
|
198
199
|
return;
|
|
199
200
|
}
|
|
200
201
|
$();
|
|
201
|
-
},
|
|
202
|
+
}, Re = ({ key: e, order: s }) => {
|
|
202
203
|
if (t.sortBy.find((l) => l.key === e)) {
|
|
203
204
|
t.sortBy = [{ key: e, order: s }];
|
|
204
205
|
return;
|
|
@@ -217,13 +218,13 @@ const _e = {
|
|
|
217
218
|
hasActions: r.hasActions,
|
|
218
219
|
getRowKey: N,
|
|
219
220
|
pagination: h.value
|
|
220
|
-
})),
|
|
221
|
-
|
|
221
|
+
})), Me = [ps, ke.value], xe = [ms, Se.value];
|
|
222
|
+
Oe(() => re());
|
|
222
223
|
const le = S(null), U = S(!0), x = S(!1), Q = S("w-full border max-w-sm");
|
|
223
|
-
function xe() {
|
|
224
|
-
Ke();
|
|
225
|
-
}
|
|
226
224
|
function Ke() {
|
|
225
|
+
Ve();
|
|
226
|
+
}
|
|
227
|
+
function Ve() {
|
|
227
228
|
b.value && (ne(), fe(() => {
|
|
228
229
|
var e;
|
|
229
230
|
(e = le.value) == null || e.focus();
|
|
@@ -235,22 +236,22 @@ const _e = {
|
|
|
235
236
|
function ne() {
|
|
236
237
|
b.value && (Q.value = "w-full border", x.value = !1, U.value = !0, w("focusOnSearch", !0));
|
|
237
238
|
}
|
|
238
|
-
return (e, s) => (n(), i("div", q({ class:
|
|
239
|
-
o(Z) || e.filterable || e.$slots.prependHeader || e.$slots.prependSearch || e.$slots.appendSearch ? (n(), i("div",
|
|
240
|
-
x.value || !o(b) ? (n(), i("div",
|
|
239
|
+
return (e, s) => (n(), i("div", q({ class: Me }, e.$attrs, { style: { "user-select": "text" } }), [
|
|
240
|
+
o(Z) || e.filterable || e.$slots.prependHeader || e.$slots.prependSearch || e.$slots.appendSearch ? (n(), i("div", es, [
|
|
241
|
+
x.value || !o(b) ? (n(), i("div", ss, [
|
|
241
242
|
d(e.$slots, "prependHeader")
|
|
242
243
|
])) : f("", !0),
|
|
243
|
-
u.value.length ? (n(), i("div",
|
|
244
|
-
R("span",
|
|
244
|
+
u.value.length && !o($e) ? (n(), i("div", ts, [
|
|
245
|
+
R("span", as, "Se han seleccionado " + ie(u.value.length) + " registros.", 1),
|
|
245
246
|
u.value.length ? (n(), i("span", {
|
|
246
247
|
key: 0,
|
|
247
248
|
onClick: oe,
|
|
248
249
|
class: "bg-blue-300 dark:bg-blue-700 hover:!bg-blue-500 rounded cursor-pointer px-2 ml-2"
|
|
249
250
|
}, " Anular selección ")) : f("", !0)
|
|
250
251
|
])) : f("", !0),
|
|
251
|
-
R("div",
|
|
252
|
+
R("div", os, [
|
|
252
253
|
d(e.$slots, "prependSearch"),
|
|
253
|
-
e.filterable && o(_).length ? (n(), K(
|
|
254
|
+
e.filterable && o(_).length ? (n(), K(Ge, {
|
|
254
255
|
key: 0,
|
|
255
256
|
class: "h-fit",
|
|
256
257
|
onClick: s[0] || (s[0] = (a) => M.value = !0),
|
|
@@ -261,7 +262,7 @@ const _e = {
|
|
|
261
262
|
default: J(() => [
|
|
262
263
|
V(he, {
|
|
263
264
|
class: "h-fit",
|
|
264
|
-
icon:
|
|
265
|
+
icon: De,
|
|
265
266
|
size: "text-lg"
|
|
266
267
|
})
|
|
267
268
|
]),
|
|
@@ -280,13 +281,13 @@ const _e = {
|
|
|
280
281
|
ref: le,
|
|
281
282
|
onFocus: ne,
|
|
282
283
|
onBlur: re
|
|
283
|
-
}, null, 42,
|
|
284
|
-
[
|
|
284
|
+
}, null, 42, ls), [
|
|
285
|
+
[ze, T.value],
|
|
285
286
|
[de, U.value]
|
|
286
287
|
]),
|
|
287
288
|
ce(V(he, {
|
|
288
|
-
icon:
|
|
289
|
-
onClick:
|
|
289
|
+
icon: Ue,
|
|
290
|
+
onClick: Ke
|
|
290
291
|
}, null, 512), [
|
|
291
292
|
[de, x.value]
|
|
292
293
|
])
|
|
@@ -294,15 +295,15 @@ const _e = {
|
|
|
294
295
|
d(e.$slots, "appendSearch")
|
|
295
296
|
])
|
|
296
297
|
])) : f("", !0),
|
|
297
|
-
R("div",
|
|
298
|
+
R("div", rs, [
|
|
298
299
|
c.value.length ? (n(), i("table", {
|
|
299
300
|
key: 0,
|
|
300
|
-
class: W(
|
|
301
|
+
class: W(xe)
|
|
301
302
|
}, [
|
|
302
|
-
e.$slots.colgroup && !o(b) ? (n(), i("colgroup",
|
|
303
|
+
e.$slots.colgroup && !o(b) ? (n(), i("colgroup", ns, [
|
|
303
304
|
d(e.$slots, "colgroup", y(B(F.value)))
|
|
304
305
|
])) : f("", !0),
|
|
305
|
-
!o(Pe) && !o(b) ? (n(), K(
|
|
306
|
+
!o(Pe) && !o(b) ? (n(), K(Qe, {
|
|
306
307
|
key: 1,
|
|
307
308
|
headers: o(X),
|
|
308
309
|
"sort-by": t.sortBy,
|
|
@@ -310,17 +311,17 @@ const _e = {
|
|
|
310
311
|
"show-expand": o(I),
|
|
311
312
|
"all-selected": L.value,
|
|
312
313
|
"more-than-paginated": !1,
|
|
313
|
-
"some-selected":
|
|
314
|
+
"some-selected": Fe.value,
|
|
314
315
|
"thead-class": e.theadClass,
|
|
315
316
|
"tr-class": e.trClass,
|
|
316
317
|
"th-class": e.thClass,
|
|
317
318
|
"has-actions": e.hasActions,
|
|
318
319
|
"action-label": e.actionLabel,
|
|
319
|
-
onSort:
|
|
320
|
-
onToggleSelectAll:
|
|
320
|
+
onSort: Re,
|
|
321
|
+
onToggleSelectAll: Be,
|
|
321
322
|
customHeaders: e.customSlots
|
|
322
323
|
}, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "some-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "customHeaders"])) : d(e.$slots, "thead", y(q({ key: 2 }, F.value))),
|
|
323
|
-
o(b) ? (n(), K(
|
|
324
|
+
o(b) ? (n(), K(We, {
|
|
324
325
|
key: 4,
|
|
325
326
|
items: c.value,
|
|
326
327
|
headers: se.value,
|
|
@@ -344,9 +345,9 @@ const _e = {
|
|
|
344
345
|
d(e.$slots, l, y(B(g)))
|
|
345
346
|
])
|
|
346
347
|
}))
|
|
347
|
-
]), 1032, ["items", "headers", "row-class", "row-class-condition", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "customSlots"])) : (n(), i(
|
|
348
|
+
]), 1032, ["items", "headers", "row-class", "row-class-condition", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "customSlots"])) : (n(), i(Le, { key: 3 }, [
|
|
348
349
|
d(e.$slots, "body.prepend", y(B(F.value))),
|
|
349
|
-
V(
|
|
350
|
+
V(Je, {
|
|
350
351
|
items: c.value,
|
|
351
352
|
headers: se.value,
|
|
352
353
|
"tbody-class": e.tbodyClass,
|
|
@@ -377,15 +378,15 @@ const _e = {
|
|
|
377
378
|
]), 1032, ["items", "headers", "tbody-class", "row-class", "row-class-condition", "tr-class", "td-class", "selected-class", "striped-class", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "customSlots"]),
|
|
378
379
|
d(e.$slots, "body.append", y(B(F.value)))
|
|
379
380
|
], 64)),
|
|
380
|
-
e.$slots.tfoot ? (n(), i("tfoot",
|
|
381
|
+
e.$slots.tfoot ? (n(), i("tfoot", us, [
|
|
381
382
|
d(e.$slots, "tfoot", y(B(F.value)))
|
|
382
383
|
])) : f("", !0)
|
|
383
|
-
])) : (n(), i("div",
|
|
384
|
-
R("div",
|
|
384
|
+
])) : (n(), i("div", is, [
|
|
385
|
+
R("div", cs, ie(e.loading ? e.loadingText : e.noDataText), 1)
|
|
385
386
|
]))
|
|
386
387
|
]),
|
|
387
|
-
o(we) ? d(e.$slots, "footer", y(q({ key: 2 }, F.value))) : (n(), i("div",
|
|
388
|
-
V(
|
|
388
|
+
o(we) ? d(e.$slots, "footer", y(q({ key: 2 }, F.value))) : (n(), i("div", ds, [
|
|
389
|
+
V(qe, {
|
|
389
390
|
"items-length": h.value.total,
|
|
390
391
|
"items-per-page": t.itemsPerPage,
|
|
391
392
|
"current-page": t.page,
|
|
@@ -397,18 +398,18 @@ const _e = {
|
|
|
397
398
|
"onUpdate:page": s[3] || (s[3] = (a) => t.page = a)
|
|
398
399
|
}, null, 8, ["items-length", "items-per-page", "current-page", "total-pages", "from", "to", "page-options"])
|
|
399
400
|
])),
|
|
400
|
-
e.filterable && M.value ? (n(), K(
|
|
401
|
+
e.filterable && M.value ? (n(), K(Xe, {
|
|
401
402
|
key: 3,
|
|
402
403
|
filters: o(_),
|
|
403
404
|
modelValue: M.value,
|
|
404
405
|
"onUpdate:modelValue": s[4] || (s[4] = (a) => M.value = a),
|
|
405
|
-
onApplyFilters:
|
|
406
|
-
onClearFilters:
|
|
406
|
+
onApplyFilters: Ne,
|
|
407
|
+
onClearFilters: Ee,
|
|
407
408
|
activeFilters: v.byColumn
|
|
408
409
|
}, null, 8, ["filters", "modelValue", "activeFilters"])) : f("", !0)
|
|
409
410
|
], 16));
|
|
410
411
|
}
|
|
411
412
|
};
|
|
412
413
|
export {
|
|
413
|
-
|
|
414
|
+
As as default
|
|
414
415
|
};
|