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