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