adverich-kun-ui 0.1.505 → 0.1.507
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 j, Fragment as _, withCtx as z, createVNode as $, normalizeClass as D, withDirectives as ee, vModelText as Ae, vShow as se, normalizeProps as p, guardReactiveProps as w, 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";
|
|
@@ -8,19 +8,19 @@ import Be from "./KunTableFooter.vue.js";
|
|
|
8
8
|
import He from "./KunTableRows.vue.js";
|
|
9
9
|
import Ve from "./KunTableIterators.vue.js";
|
|
10
10
|
import Oe from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
11
|
+
import je from "./KunTableFilter.vue.js";
|
|
12
|
+
import ze from "../composables/useExpand.js";
|
|
13
|
+
import De from "../composables/useOptions.js";
|
|
14
|
+
import Ne from "../composables/useSelect.js";
|
|
15
15
|
import Ke from "../composables/useFilter.js";
|
|
16
16
|
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 = { class: "w-
|
|
20
|
+
}, We = { class: "w-full flex items-center" }, Qe = {
|
|
21
21
|
key: 0,
|
|
22
|
-
class: "flex items-center justify-center"
|
|
23
|
-
}, qe = { class: "pr-2" }, Ge = { class: "flex h-full items-center" }, Je = ["placeholder"], Xe = { class: "flex-1 overflow-auto bg-surface" }, Ye = { key: 0 }, Ze = { key: 5 }, _e = {
|
|
22
|
+
class: "inline-flex items-center justify-center whitespace-nowrap"
|
|
23
|
+
}, qe = { class: "pr-2" }, Ge = { class: "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
24
|
key: 1,
|
|
25
25
|
class: "h-full flex justify-center items-center"
|
|
26
26
|
}, es = { class: "text-center text-4xl" }, ss = {
|
|
@@ -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(
|
|
37
|
-
const k =
|
|
36
|
+
setup(N, { emit: ne }) {
|
|
37
|
+
const k = ne, m = N, F = $e(m), y = Fe(N, "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 } = De(F, k, h), { isSelected: I, toggleSelect: R, toggleSelectAll: ve, allSelected: we, someSelected: ye, moreThanPaginated: be, clearSelection: W, selectCompleteAll: Q } = Ne(u, y, h), { isExpanded: E, toggleExpand: x } = ze(), 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
|
-
|
|
109
|
-
|
|
110
|
-
s(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
y.value.length ? (l(), n("div", Qe, [
|
|
109
|
+
v("span", qe, "Se han seleccionado " + j(y.value.length) + " registros.", 1),
|
|
110
|
+
s(u).length !== s(h).length ? (l(), n(_, { key: 0 }, [
|
|
111
|
+
s(u).length === y.value.length ? (l(), n("span", {
|
|
112
|
+
key: 0,
|
|
113
|
+
onClick: o[0] || (o[0] = (...t) => s(Q) && s(Q)(...t)),
|
|
114
|
+
class: "bg-secondary hover:!bg-blue-500 rounded cursor-pointer px-2 ml-2"
|
|
115
|
+
}, " Seleccionar todos los " + j(s(h).length) + " registros ", 1)) : a("", !0),
|
|
116
|
+
s(h).length === y.value.length ? (l(), n("span", {
|
|
117
|
+
key: 1,
|
|
118
|
+
onClick: o[1] || (o[1] = (...t) => s(W) && s(W)(...t)),
|
|
119
|
+
class: "bg-secondary hover:!bg-blue-500 rounded cursor-pointer px-2 ml-2"
|
|
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,
|
|
@@ -128,8 +130,8 @@ const Ue = {
|
|
|
128
130
|
size: "xs",
|
|
129
131
|
bgColor: "bg-green-200 dark:bg-green-800"
|
|
130
132
|
}, {
|
|
131
|
-
default:
|
|
132
|
-
$(
|
|
133
|
+
default: z(() => [
|
|
134
|
+
$(le, {
|
|
133
135
|
class: "h-fit",
|
|
134
136
|
icon: Re,
|
|
135
137
|
size: "text-lg"
|
|
@@ -139,60 +141,60 @@ const Ue = {
|
|
|
139
141
|
})) : a("", !0),
|
|
140
142
|
s(U) ? (l(), n("div", {
|
|
141
143
|
key: 1,
|
|
142
|
-
class:
|
|
144
|
+
class: D(["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
|
-
class:
|
|
150
|
+
class: D(["w-full text-sm", s(f) ? "px-1" : "px-2 py-1"]),
|
|
149
151
|
ref_key: "searchRef",
|
|
150
152
|
ref: q,
|
|
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:
|
|
172
|
+
class: D(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(w(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
|
-
"some-selected": s(
|
|
183
|
+
"all-selected": s(we),
|
|
184
|
+
"more-than-paginated": s(be),
|
|
185
|
+
"some-selected": s(ye),
|
|
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:
|
|
211
|
-
fn:
|
|
212
|
-
r(e.$slots,
|
|
210
|
+
}, oe({ _: 2 }, [
|
|
211
|
+
te(e.$slots, (t, d) => ({
|
|
212
|
+
name: d,
|
|
213
|
+
fn: z((i) => [
|
|
214
|
+
r(e.$slots, d, p(w(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(w(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,42 +235,42 @@ const Ue = {
|
|
|
233
235
|
onToggleExpand: s(x),
|
|
234
236
|
onToggleSelect: s(R),
|
|
235
237
|
customSlots: e.customSlots
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
-
name:
|
|
239
|
-
fn:
|
|
240
|
-
r(e.$slots,
|
|
238
|
+
}, oe({ _: 2 }, [
|
|
239
|
+
te(e.$slots, (t, d) => ({
|
|
240
|
+
name: d,
|
|
241
|
+
fn: z((i) => [
|
|
242
|
+
r(e.$slots, d, p(w(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(w(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(w(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, j(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"])
|
|
263
265
|
])),
|
|
264
|
-
e.filterable && s(S) ? (l(), T(
|
|
266
|
+
e.filterable && s(S) ? (l(), T(je, {
|
|
265
267
|
key: 3,
|
|
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
|
}
|