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