adverich-kun-ui 0.1.504 → 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,15 +1,15 @@
|
|
|
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
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import le from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
4
|
+
import Re from "../../../../icons/IconFilter.vue.js";
|
|
5
|
+
import Ee from "../../../../icons/IconSearch.vue.js";
|
|
6
|
+
import xe from "./KunTableHeaders.vue.js";
|
|
7
7
|
import Be from "./KunTableFooter.vue.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
8
|
+
import He from "./KunTableRows.vue.js";
|
|
9
|
+
import Ve from "./KunTableIterators.vue.js";
|
|
10
|
+
import Oe from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
11
|
+
import ze from "./KunTableFilter.vue.js";
|
|
12
|
+
import De from "../composables/useExpand.js";
|
|
13
13
|
import Ne from "../composables/useOptions.js";
|
|
14
14
|
import je from "../composables/useSelect.js";
|
|
15
15
|
import Ke from "../composables/useFilter.js";
|
|
@@ -33,93 +33,96 @@ 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
|
-
} =
|
|
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,
|
|
79
|
-
toggleSelect:
|
|
80
|
-
isSelected:
|
|
81
|
-
toggleExpand:
|
|
82
|
-
isExpanded:
|
|
79
|
+
toggleSelect: R,
|
|
80
|
+
isSelected: I,
|
|
81
|
+
toggleExpand: x,
|
|
82
|
+
isExpanded: E,
|
|
83
83
|
sortBy: c.sortBy,
|
|
84
|
-
hasActions:
|
|
85
|
-
})),
|
|
86
|
-
|
|
87
|
-
const q = C(null), B = C(!0),
|
|
88
|
-
function Ce() {
|
|
89
|
-
ke();
|
|
90
|
-
}
|
|
84
|
+
hasActions: m.hasActions
|
|
85
|
+
})), Se = [os, ce.value], Ce = [ts, ie.value];
|
|
86
|
+
Pe(() => G());
|
|
87
|
+
const q = C(null), B = C(!0), H = C(!1);
|
|
91
88
|
function ke() {
|
|
92
|
-
|
|
89
|
+
Te();
|
|
90
|
+
}
|
|
91
|
+
function Te() {
|
|
92
|
+
f.value && (J(), Ie(() => {
|
|
93
93
|
q.value.focus();
|
|
94
94
|
}));
|
|
95
95
|
}
|
|
96
96
|
function G() {
|
|
97
|
-
f.value && (
|
|
97
|
+
f.value && (V.value = "w-fit", B.value = !1, H.value = !0, k("focusOnSearch", !1));
|
|
98
98
|
}
|
|
99
99
|
function J() {
|
|
100
|
-
f.value && (
|
|
100
|
+
f.value && (V.value = "w-full border", H.value = !1, B.value = !0, k("focusOnSearch", !0));
|
|
101
101
|
}
|
|
102
|
-
const
|
|
103
|
-
return (e, o) => (l(), n("div",
|
|
104
|
-
s(U) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), n("div", Ue, [
|
|
105
|
-
|
|
106
|
-
r(e.$slots, "
|
|
102
|
+
const V = C("w-full border max-w-sm");
|
|
103
|
+
return (e, o) => (l(), n("div", O({ class: Se }, e.$attrs, { style: { "user-select": "text" } }), [
|
|
104
|
+
s(U) || e.filterable || e.$slots.prependHeader || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), n("div", Ue, [
|
|
105
|
+
v("div", We, [
|
|
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
|
-
|
|
122
|
-
e
|
|
123
|
+
v("div", Ge, [
|
|
124
|
+
r(e.$slots, "prependSearch"),
|
|
125
|
+
e.filterable && e.filters.length ? (l(), T(Oe, {
|
|
123
126
|
key: 0,
|
|
124
127
|
class: "h-fit",
|
|
125
128
|
onClick: o[2] || (o[2] = (t) => S.value = !0),
|
|
@@ -127,10 +130,10 @@ const Ue = {
|
|
|
127
130
|
size: "xs",
|
|
128
131
|
bgColor: "bg-green-200 dark:bg-green-800"
|
|
129
132
|
}, {
|
|
130
|
-
default:
|
|
131
|
-
|
|
133
|
+
default: D(() => [
|
|
134
|
+
$(le, {
|
|
132
135
|
class: "h-fit",
|
|
133
|
-
icon:
|
|
136
|
+
icon: Re,
|
|
134
137
|
size: "text-lg"
|
|
135
138
|
})
|
|
136
139
|
]),
|
|
@@ -138,10 +141,10 @@ const Ue = {
|
|
|
138
141
|
})) : a("", !0),
|
|
139
142
|
s(U) ? (l(), n("div", {
|
|
140
143
|
key: 1,
|
|
141
|
-
class: N(["rounded flex mx-2", [
|
|
144
|
+
class: N(["rounded flex mx-2", [V.value]])
|
|
142
145
|
}, [
|
|
143
|
-
|
|
144
|
-
"onUpdate:modelValue": o[3] || (o[3] = (t) =>
|
|
146
|
+
ee(v("input", {
|
|
147
|
+
"onUpdate:modelValue": o[3] || (o[3] = (t) => b.value = t),
|
|
145
148
|
type: "text",
|
|
146
149
|
placeholder: e.searchPlaceholder,
|
|
147
150
|
class: N(["w-full text-sm", s(f) ? "px-1" : "px-2 py-1"]),
|
|
@@ -150,71 +153,71 @@ const Ue = {
|
|
|
150
153
|
onFocus: J,
|
|
151
154
|
onBlur: G
|
|
152
155
|
}, null, 42, Je), [
|
|
153
|
-
[
|
|
154
|
-
[
|
|
156
|
+
[Ae, b.value],
|
|
157
|
+
[se, B.value]
|
|
155
158
|
]),
|
|
156
|
-
|
|
157
|
-
icon:
|
|
158
|
-
onClick:
|
|
159
|
+
ee($(le, {
|
|
160
|
+
icon: Ee,
|
|
161
|
+
onClick: ke
|
|
159
162
|
}, null, 512), [
|
|
160
|
-
[
|
|
163
|
+
[se, H.value]
|
|
161
164
|
])
|
|
162
165
|
], 2)) : a("", !0),
|
|
163
166
|
r(e.$slots, "appendSearch")
|
|
164
167
|
])
|
|
165
168
|
])) : a("", !0),
|
|
166
|
-
|
|
167
|
-
s(
|
|
169
|
+
v("div", Xe, [
|
|
170
|
+
s(u).length ? (l(), n("table", {
|
|
168
171
|
key: 0,
|
|
169
|
-
class: N(
|
|
172
|
+
class: N(Ce)
|
|
170
173
|
}, [
|
|
171
174
|
e.$slots.colgroup && !s(f) ? (l(), n("colgroup", Ye, [
|
|
172
|
-
r(e.$slots, "colgroup",
|
|
175
|
+
r(e.$slots, "colgroup", p(y(g.value)))
|
|
173
176
|
])) : a("", !0),
|
|
174
|
-
!s(
|
|
177
|
+
!s(re) && !s(f) ? (l(), T(xe, {
|
|
175
178
|
key: 1,
|
|
176
179
|
headers: s(K),
|
|
177
180
|
"sort-by": s(c).sortBy,
|
|
178
181
|
"show-select": s(A),
|
|
179
182
|
"show-expand": s(P),
|
|
180
|
-
"all-selected": s(
|
|
181
|
-
"more-than-paginated": s(
|
|
183
|
+
"all-selected": s(ye),
|
|
184
|
+
"more-than-paginated": s(be),
|
|
182
185
|
"some-selected": s(we),
|
|
183
186
|
"thead-class": e.theadClass,
|
|
184
187
|
"tr-class": e.trClass,
|
|
185
188
|
"th-class": e.thClass,
|
|
186
189
|
"has-actions": e.hasActions,
|
|
187
190
|
"action-label": e.actionLabel,
|
|
188
|
-
onSort: s(
|
|
189
|
-
onToggleSelectAll: s(
|
|
191
|
+
onSort: s(ge),
|
|
192
|
+
onToggleSelectAll: s(ve),
|
|
190
193
|
customHeaders: e.customSlots
|
|
191
|
-
}, 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",
|
|
192
|
-
s(f) ? (l(), T(
|
|
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))),
|
|
195
|
+
s(f) ? (l(), T(Ve, {
|
|
193
196
|
key: 4,
|
|
194
|
-
items: s(
|
|
197
|
+
items: s(u),
|
|
195
198
|
headers: M.value,
|
|
196
199
|
"row-class": s(L),
|
|
197
200
|
"row-class-condition": e.rowClassCondition,
|
|
198
|
-
"is-selected": s(
|
|
199
|
-
"is-expanded": s(
|
|
201
|
+
"is-selected": s(I),
|
|
202
|
+
"is-expanded": s(E),
|
|
200
203
|
"show-select": s(A),
|
|
201
204
|
"show-expand": s(P),
|
|
202
205
|
"has-actions": e.hasActions,
|
|
203
206
|
"action-loading-map": e.actionLoadingMap,
|
|
204
|
-
onToggleExpand: s(
|
|
205
|
-
onToggleSelect: s(
|
|
207
|
+
onToggleExpand: s(x),
|
|
208
|
+
onToggleSelect: s(R),
|
|
206
209
|
customSlots: e.customSlots
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
name:
|
|
210
|
-
fn:
|
|
211
|
-
r(e.$slots,
|
|
210
|
+
}, oe({ _: 2 }, [
|
|
211
|
+
te(e.$slots, (t, d) => ({
|
|
212
|
+
name: d,
|
|
213
|
+
fn: D((i) => [
|
|
214
|
+
r(e.$slots, d, p(y(i)))
|
|
212
215
|
])
|
|
213
216
|
}))
|
|
214
|
-
]), 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(
|
|
215
|
-
r(e.$slots, "body.prepend",
|
|
216
|
-
|
|
217
|
-
items: s(
|
|
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))),
|
|
219
|
+
$(He, {
|
|
220
|
+
items: s(u),
|
|
218
221
|
headers: M.value,
|
|
219
222
|
"tbody-class": e.tbodyClass,
|
|
220
223
|
"row-class": s(L),
|
|
@@ -223,51 +226,51 @@ const Ue = {
|
|
|
223
226
|
"td-class": e.tdClass,
|
|
224
227
|
"selected-class": e.selectedClass,
|
|
225
228
|
"striped-class": e.stripedClass,
|
|
226
|
-
"is-selected": s(
|
|
227
|
-
"is-expanded": s(
|
|
229
|
+
"is-selected": s(I),
|
|
230
|
+
"is-expanded": s(E),
|
|
228
231
|
"show-select": s(A),
|
|
229
232
|
"show-expand": s(P),
|
|
230
233
|
"has-actions": e.hasActions,
|
|
231
234
|
"action-loading-map": e.actionLoadingMap,
|
|
232
|
-
onToggleExpand: s(
|
|
233
|
-
onToggleSelect: s(
|
|
235
|
+
onToggleExpand: s(x),
|
|
236
|
+
onToggleSelect: s(R),
|
|
234
237
|
customSlots: e.customSlots
|
|
235
|
-
},
|
|
236
|
-
|
|
237
|
-
name:
|
|
238
|
-
fn:
|
|
239
|
-
r(e.$slots,
|
|
238
|
+
}, oe({ _: 2 }, [
|
|
239
|
+
te(e.$slots, (t, d) => ({
|
|
240
|
+
name: d,
|
|
241
|
+
fn: D((i) => [
|
|
242
|
+
r(e.$slots, d, p(y(i)))
|
|
240
243
|
])
|
|
241
244
|
}))
|
|
242
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"]),
|
|
243
|
-
r(e.$slots, "body.append",
|
|
246
|
+
r(e.$slots, "body.append", p(y(g.value)))
|
|
244
247
|
], 64)),
|
|
245
248
|
e.$slots.tfoot ? (l(), n("tfoot", Ze, [
|
|
246
|
-
r(e.$slots, "tfoot",
|
|
249
|
+
r(e.$slots, "tfoot", p(y(g.value)))
|
|
247
250
|
])) : a("", !0)
|
|
248
251
|
])) : a("", !0),
|
|
249
|
-
s(
|
|
250
|
-
|
|
252
|
+
s(u).length ? a("", !0) : (l(), n("div", _e, [
|
|
253
|
+
v("div", es, z(e.noDataText), 1)
|
|
251
254
|
]))
|
|
252
255
|
]),
|
|
253
|
-
s(
|
|
254
|
-
|
|
255
|
-
"items-length": s(
|
|
256
|
+
s(ae) ? r(e.$slots, "footer", p(O({ key: 2 }, g.value))) : (l(), n("div", ss, [
|
|
257
|
+
$(Be, {
|
|
258
|
+
"items-length": s(h).length,
|
|
256
259
|
"items-per-page": s(c).itemsPerPage,
|
|
257
260
|
"current-page": s(c).page,
|
|
258
|
-
"page-options": s(
|
|
261
|
+
"page-options": s(ue),
|
|
259
262
|
"onUpdate:itemsPerPage": o[4] || (o[4] = (t) => s(c).itemsPerPage = t),
|
|
260
263
|
"onUpdate:page": o[5] || (o[5] = (t) => s(c).page = t)
|
|
261
264
|
}, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
|
|
262
265
|
])),
|
|
263
|
-
e.filterable && s(S) ? (l(), T(
|
|
266
|
+
e.filterable && s(S) ? (l(), T(ze, {
|
|
264
267
|
key: 3,
|
|
265
268
|
filters: e.filters,
|
|
266
269
|
modelValue: s(S),
|
|
267
270
|
"onUpdate:modelValue": o[6] || (o[6] = (t) => Me(S) ? S.value = t : null),
|
|
268
|
-
onApplyFilters: s(
|
|
269
|
-
onClearFilters: s(
|
|
270
|
-
activeFilters: s(
|
|
271
|
+
onApplyFilters: s(me),
|
|
272
|
+
onClearFilters: s(fe),
|
|
273
|
+
activeFilters: s(he).byColumn
|
|
271
274
|
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : a("", !0)
|
|
272
275
|
], 16));
|
|
273
276
|
}
|