adverich-kun-ui 0.1.312 → 0.1.313
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,217 +1,248 @@
|
|
|
1
|
-
import { mergeModels as
|
|
2
|
-
import { isMobile as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
|
|
1
|
+
import { mergeModels as O, toRefs as ye, useModel as be, ref as y, watch as W, computed as Q, onMounted as Se, createElementBlock as c, openBlock as l, mergeProps as B, createCommentVNode as u, createElementVNode as V, renderSlot as a, createBlock as b, unref as s, normalizeClass as S, withDirectives as q, vModelText as Ce, vShow as G, createVNode as C, normalizeProps as d, guardReactiveProps as g, Fragment as Te, createSlots as J, renderList as X, withCtx as Y, isRef as $e, nextTick as Fe } from "vue";
|
|
2
|
+
import { isMobile as p } from "../../../../utils/_platform.js";
|
|
3
|
+
import ke from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
4
|
+
import Pe from "../../../../icons/IconSearch.vue.js";
|
|
5
|
+
import Me from "./KunTableHeaders.vue.js";
|
|
6
|
+
import Ae from "./KunTableFooter.vue.js";
|
|
7
|
+
import Re from "./KunTableRows.vue.js";
|
|
8
|
+
import Ee from "./KunTableIterators.vue.js";
|
|
9
|
+
import Ie from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
10
|
+
import Be from "./KunTableFilter.vue.js";
|
|
11
|
+
import Ve from "../../../KunCard/src/components/KunCard.vue.js";
|
|
12
|
+
import xe from "../composables/useExpand.js";
|
|
13
|
+
import je from "../composables/useOptions.js";
|
|
14
|
+
import Ne from "../composables/useSelect.js";
|
|
15
|
+
import ze from "../composables/useFilter.js";
|
|
16
|
+
import De from "../composables/KunTableProps.js";
|
|
17
|
+
const Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto" }, Ue = { key: 0 }, He = { key: 5 }, Oe = {
|
|
16
18
|
key: 0,
|
|
17
19
|
class: "h-full"
|
|
18
|
-
},
|
|
20
|
+
}, We = {
|
|
19
21
|
key: 1,
|
|
20
22
|
class: "sticky bottom-0 z-10 print:hidden"
|
|
21
|
-
},
|
|
23
|
+
}, Qe = "overflow-hidden h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", qe = "table-auto w-full h-fit text-sm text-left", us = {
|
|
22
24
|
__name: "KunTable",
|
|
23
|
-
props: /* @__PURE__ */
|
|
25
|
+
props: /* @__PURE__ */ O(De(), {
|
|
24
26
|
selectedItems: { type: Array, default: () => [] },
|
|
25
27
|
selectedItemsModifiers: {}
|
|
26
28
|
}),
|
|
27
|
-
emits: /* @__PURE__ */
|
|
28
|
-
setup(
|
|
29
|
-
const
|
|
30
|
-
headers:
|
|
31
|
-
showExpand:
|
|
32
|
-
showSelect:
|
|
33
|
-
rowClass:
|
|
34
|
-
hideDefaultFooter:
|
|
35
|
-
hideDefaultHeader:
|
|
36
|
-
tableClass:
|
|
37
|
-
wrapperClass:
|
|
38
|
-
pageOptions:
|
|
39
|
-
items:
|
|
40
|
-
searchable:
|
|
41
|
-
debounceTime:
|
|
42
|
-
} =
|
|
43
|
-
|
|
44
|
-
e !==
|
|
29
|
+
emits: /* @__PURE__ */ O(["update:page", "update:itemsPerPage", "update:sortBy", "update:search"], ["update:selectedItems"]),
|
|
30
|
+
setup(x, { emit: Z }) {
|
|
31
|
+
const j = Z, m = x, T = ye(m), _ = be(x, "selectedItems"), {
|
|
32
|
+
headers: N,
|
|
33
|
+
showExpand: $,
|
|
34
|
+
showSelect: F,
|
|
35
|
+
rowClass: z,
|
|
36
|
+
hideDefaultFooter: ee,
|
|
37
|
+
hideDefaultHeader: se,
|
|
38
|
+
tableClass: oe,
|
|
39
|
+
wrapperClass: te,
|
|
40
|
+
pageOptions: le,
|
|
41
|
+
items: ae,
|
|
42
|
+
searchable: D,
|
|
43
|
+
debounceTime: ne
|
|
44
|
+
} = T, w = y(m.search);
|
|
45
|
+
W(() => m.search, (e) => {
|
|
46
|
+
e !== w.value && (w.value = e);
|
|
45
47
|
});
|
|
46
|
-
const { filteredItems:
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
const { filteredItems: re, setSearch: ie, modalFilter: v, applyColumnFilters: ce, clearFilters: ue, appliedFilters: de } = ze(T, ne);
|
|
49
|
+
W(w, (e) => {
|
|
50
|
+
j("update:search", e), ie(e);
|
|
49
51
|
});
|
|
50
|
-
const { options: r, paginatedItems:
|
|
51
|
-
items:
|
|
52
|
-
headers:
|
|
52
|
+
const { options: r, paginatedItems: f, updateSort: pe } = je(T, j, re), { isSelected: k, toggleSelect: P, toggleSelectAll: me, allSelected: fe, someSelected: he } = Ne(f, _), { isExpanded: M, toggleExpand: A } = xe(), h = Q(() => ({
|
|
53
|
+
items: f.value,
|
|
54
|
+
headers: N.value,
|
|
53
55
|
page: r.page,
|
|
54
56
|
itemsPerPage: r.itemsPerPage,
|
|
55
|
-
toggleSelect:
|
|
56
|
-
isSelected:
|
|
57
|
-
toggleExpand:
|
|
58
|
-
isExpanded:
|
|
57
|
+
toggleSelect: P,
|
|
58
|
+
isSelected: k,
|
|
59
|
+
toggleExpand: A,
|
|
60
|
+
isExpanded: M,
|
|
59
61
|
sortBy: r.sortBy,
|
|
60
|
-
hasActions:
|
|
61
|
-
})),
|
|
62
|
-
var
|
|
63
|
-
const
|
|
62
|
+
hasActions: m.hasActions
|
|
63
|
+
})), ge = [Qe, te.value], we = [qe, oe.value], K = Q(() => m.headers.map((e) => {
|
|
64
|
+
var t, i;
|
|
65
|
+
const o = { ...e };
|
|
64
66
|
if ((e.columnType === "function" || e.columnType == "objectFunction" || e.columnType == "simpleFunction") && typeof e.columnFunction == "string") {
|
|
65
|
-
const n = (
|
|
66
|
-
typeof n == "function" ?
|
|
67
|
+
const n = (t = m.functionMap) == null ? void 0 : t[e.columnFunction];
|
|
68
|
+
typeof n == "function" ? o.columnFunction = n : (console.warn(
|
|
67
69
|
`[KunTable] No se encontró la función "${e.columnFunction}" en functionMap`
|
|
68
|
-
),
|
|
70
|
+
), o.columnFunction = () => "");
|
|
69
71
|
}
|
|
70
72
|
if (e.columnFormat === "function" && typeof e.columnRowText == "string") {
|
|
71
|
-
const n = (i =
|
|
72
|
-
typeof n == "function" ?
|
|
73
|
+
const n = (i = m.functionMap) == null ? void 0 : i[e.columnRowText];
|
|
74
|
+
typeof n == "function" ? o.columnRowText = n : (console.warn(
|
|
73
75
|
`[KunTable] No se encontró la función "${e.columnRowText}" en functionMap`
|
|
74
|
-
),
|
|
76
|
+
), o.columnRowText = () => "");
|
|
75
77
|
}
|
|
76
|
-
return
|
|
78
|
+
return o;
|
|
77
79
|
}));
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
Se(() => U());
|
|
81
|
+
const L = y(null), R = y(!0), E = y(!1);
|
|
82
|
+
function ve() {
|
|
83
|
+
p.value && (H(), Fe(() => {
|
|
84
|
+
L.value.focus();
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
function U() {
|
|
88
|
+
p.value && (I.value = "w-fit", R.value = !1, E.value = !0);
|
|
89
|
+
}
|
|
90
|
+
function H() {
|
|
91
|
+
p.value && (I.value = "w-full border", E.value = !1, R.value = !0);
|
|
92
|
+
}
|
|
93
|
+
const I = y("w-full border max-w-sm");
|
|
94
|
+
return (e, o) => (l(), c("div", B({ class: ge }, e.$attrs, { style: { "user-select": "text" } }), [
|
|
95
|
+
s(D) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), c("div", {
|
|
80
96
|
key: 0,
|
|
81
|
-
class:
|
|
97
|
+
class: S(["p-2 bg-slate-200 dark:bg-slate-800 print:hidden", {
|
|
82
98
|
"justify-start flex": e.searchPosition === "start",
|
|
83
99
|
"justify-center flex": e.searchPosition === "center",
|
|
84
100
|
"justify-end flex": e.searchPosition === "end"
|
|
85
101
|
}])
|
|
86
102
|
}, [
|
|
87
103
|
a(e.$slots, "prependSearch"),
|
|
88
|
-
e.filterable && e.filters.length ? (l(),
|
|
104
|
+
e.filterable && e.filters.length ? (l(), b(Ie, {
|
|
89
105
|
key: 0,
|
|
90
|
-
onClick:
|
|
106
|
+
onClick: o[0] || (o[0] = (t) => v.value = !0),
|
|
91
107
|
text: "Filtros",
|
|
92
108
|
bgColor: "bg-green-200 dark:bg-green-800 px-2"
|
|
93
|
-
})) :
|
|
94
|
-
s(
|
|
109
|
+
})) : u("", !0),
|
|
110
|
+
s(D) ? (l(), c("div", {
|
|
95
111
|
key: 1,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
class: S(["rounded flex mx-2", [I.value]])
|
|
113
|
+
}, [
|
|
114
|
+
q(V("input", {
|
|
115
|
+
"onUpdate:modelValue": o[1] || (o[1] = (t) => w.value = t),
|
|
116
|
+
type: "text",
|
|
117
|
+
placeholder: e.searchPlaceholder,
|
|
118
|
+
class: S(["w-full text-sm", s(p) ? "px-1" : "px-2 py-1"]),
|
|
119
|
+
ref_key: "searchRef",
|
|
120
|
+
ref: L,
|
|
121
|
+
onFocus: H,
|
|
122
|
+
onBlur: U
|
|
123
|
+
}, null, 42, Ke), [
|
|
124
|
+
[Ce, w.value],
|
|
125
|
+
[G, R.value]
|
|
126
|
+
]),
|
|
127
|
+
q(C(ke, {
|
|
128
|
+
icon: Pe,
|
|
129
|
+
onClick: ve
|
|
130
|
+
}, null, 512), [
|
|
131
|
+
[G, E.value]
|
|
132
|
+
])
|
|
133
|
+
], 2)) : u("", !0),
|
|
103
134
|
a(e.$slots, "appendSearch")
|
|
104
|
-
], 2)) :
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
class:
|
|
135
|
+
], 2)) : u("", !0),
|
|
136
|
+
V("div", Le, [
|
|
137
|
+
V("table", {
|
|
138
|
+
class: S(we)
|
|
108
139
|
}, [
|
|
109
|
-
e.$slots.colgroup && !s(
|
|
110
|
-
a(e.$slots, "colgroup",
|
|
111
|
-
])) :
|
|
112
|
-
!s(
|
|
140
|
+
e.$slots.colgroup && !s(p) ? (l(), c("colgroup", Ue, [
|
|
141
|
+
a(e.$slots, "colgroup", d(g(h.value)))
|
|
142
|
+
])) : u("", !0),
|
|
143
|
+
!s(se) && !s(p) ? (l(), b(Me, {
|
|
113
144
|
key: 1,
|
|
114
|
-
headers: s(
|
|
145
|
+
headers: s(N),
|
|
115
146
|
"sort-by": s(r).sortBy,
|
|
116
|
-
"show-select": s(
|
|
117
|
-
"show-expand": s(
|
|
118
|
-
"all-selected": s(
|
|
119
|
-
"some-selected": s(
|
|
147
|
+
"show-select": s(F),
|
|
148
|
+
"show-expand": s($),
|
|
149
|
+
"all-selected": s(fe),
|
|
150
|
+
"some-selected": s(he),
|
|
120
151
|
"thead-class": e.theadClass,
|
|
121
152
|
"tr-class": e.trClass,
|
|
122
153
|
"th-class": e.thClass,
|
|
123
154
|
"has-actions": e.hasActions,
|
|
124
155
|
"action-label": e.actionLabel,
|
|
125
|
-
onSort: s(
|
|
126
|
-
onToggleSelectAll: s(
|
|
127
|
-
}, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "some-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "onSort", "onToggleSelectAll"])) : a(e.$slots, "thead",
|
|
128
|
-
s(
|
|
129
|
-
a(e.$slots, "body.prepend",
|
|
130
|
-
|
|
131
|
-
items: s(
|
|
132
|
-
headers:
|
|
156
|
+
onSort: s(pe),
|
|
157
|
+
onToggleSelectAll: s(me)
|
|
158
|
+
}, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "some-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "onSort", "onToggleSelectAll"])) : a(e.$slots, "thead", d(B({ key: 2 }, h.value))),
|
|
159
|
+
s(f).length && !s(p) ? (l(), c(Te, { key: 3 }, [
|
|
160
|
+
a(e.$slots, "body.prepend", d(g(h.value))),
|
|
161
|
+
C(Re, {
|
|
162
|
+
items: s(f),
|
|
163
|
+
headers: K.value,
|
|
133
164
|
"tbody-class": e.tbodyClass,
|
|
134
|
-
"row-class": s(
|
|
165
|
+
"row-class": s(z),
|
|
135
166
|
"row-class-condition": e.rowClassCondition,
|
|
136
167
|
"tr-class": e.trClass,
|
|
137
168
|
"td-class": e.tdClass,
|
|
138
169
|
"selected-class": e.selectedClass,
|
|
139
170
|
"striped-class": e.stripedClass,
|
|
140
|
-
"is-selected": s(
|
|
141
|
-
"is-expanded": s(
|
|
142
|
-
"show-select": s(
|
|
143
|
-
"show-expand": s(
|
|
171
|
+
"is-selected": s(k),
|
|
172
|
+
"is-expanded": s(M),
|
|
173
|
+
"show-select": s(F),
|
|
174
|
+
"show-expand": s($),
|
|
144
175
|
"has-actions": e.hasActions,
|
|
145
176
|
"action-loading-map": e.actionLoadingMap,
|
|
146
|
-
onToggleExpand: s(
|
|
147
|
-
onToggleSelect: s(
|
|
177
|
+
onToggleExpand: s(A),
|
|
178
|
+
onToggleSelect: s(P),
|
|
148
179
|
customSlots: e.customSlots
|
|
149
|
-
},
|
|
150
|
-
|
|
180
|
+
}, J({ _: 2 }, [
|
|
181
|
+
X(e.$slots, (t, i) => ({
|
|
151
182
|
name: i,
|
|
152
|
-
fn:
|
|
153
|
-
a(e.$slots, i,
|
|
183
|
+
fn: Y((n) => [
|
|
184
|
+
a(e.$slots, i, d(g(n)))
|
|
154
185
|
])
|
|
155
186
|
}))
|
|
156
187
|
]), 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"]),
|
|
157
|
-
a(e.$slots, "body.append",
|
|
158
|
-
], 64)) : s(
|
|
188
|
+
a(e.$slots, "body.append", d(g(h.value)))
|
|
189
|
+
], 64)) : s(f).length && s(p) ? (l(), b(Ee, {
|
|
159
190
|
key: 4,
|
|
160
|
-
items: s(
|
|
161
|
-
headers:
|
|
162
|
-
"row-class": s(
|
|
191
|
+
items: s(f),
|
|
192
|
+
headers: K.value,
|
|
193
|
+
"row-class": s(z),
|
|
163
194
|
"row-class-condition": e.rowClassCondition,
|
|
164
|
-
"is-selected": s(
|
|
165
|
-
"is-expanded": s(
|
|
166
|
-
"show-select": s(
|
|
167
|
-
"show-expand": s(
|
|
195
|
+
"is-selected": s(k),
|
|
196
|
+
"is-expanded": s(M),
|
|
197
|
+
"show-select": s(F),
|
|
198
|
+
"show-expand": s($),
|
|
168
199
|
"has-actions": e.hasActions,
|
|
169
200
|
"action-loading-map": e.actionLoadingMap,
|
|
170
|
-
onToggleExpand: s(
|
|
171
|
-
onToggleSelect: s(
|
|
201
|
+
onToggleExpand: s(A),
|
|
202
|
+
onToggleSelect: s(P),
|
|
172
203
|
customSlots: e.customSlots
|
|
173
|
-
},
|
|
174
|
-
|
|
204
|
+
}, J({ _: 2 }, [
|
|
205
|
+
X(e.$slots, (t, i) => ({
|
|
175
206
|
name: i,
|
|
176
|
-
fn:
|
|
177
|
-
a(e.$slots, i,
|
|
207
|
+
fn: Y((n) => [
|
|
208
|
+
a(e.$slots, i, d(g(n)))
|
|
178
209
|
])
|
|
179
210
|
}))
|
|
180
|
-
]), 1032, ["items", "headers", "row-class", "row-class-condition", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect", "customSlots"])) :
|
|
181
|
-
e.$slots.tfoot ? (l(), c("tfoot",
|
|
182
|
-
a(e.$slots, "tfoot",
|
|
183
|
-
])) :
|
|
211
|
+
]), 1032, ["items", "headers", "row-class", "row-class-condition", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect", "customSlots"])) : u("", !0),
|
|
212
|
+
e.$slots.tfoot ? (l(), c("tfoot", He, [
|
|
213
|
+
a(e.$slots, "tfoot", d(g(h.value)))
|
|
214
|
+
])) : u("", !0)
|
|
184
215
|
]),
|
|
185
|
-
s(
|
|
186
|
-
|
|
216
|
+
s(f).length ? u("", !0) : (l(), c("div", Oe, [
|
|
217
|
+
C(Ve, {
|
|
187
218
|
class: "h-full flex justify-center items-center text-center",
|
|
188
219
|
title: e.noDataText,
|
|
189
220
|
titleSize: "text-4xl"
|
|
190
221
|
}, null, 8, ["title"])
|
|
191
222
|
]))
|
|
192
223
|
]),
|
|
193
|
-
s(
|
|
194
|
-
|
|
195
|
-
"items-length": s(
|
|
224
|
+
s(ee) ? a(e.$slots, "footer", d(B({ key: 2 }, h.value))) : (l(), c("div", We, [
|
|
225
|
+
C(Ae, {
|
|
226
|
+
"items-length": s(ae).length,
|
|
196
227
|
"items-per-page": s(r).itemsPerPage,
|
|
197
228
|
"current-page": s(r).page,
|
|
198
|
-
"page-options": s(
|
|
199
|
-
"onUpdate:itemsPerPage":
|
|
200
|
-
"onUpdate:page":
|
|
229
|
+
"page-options": s(le),
|
|
230
|
+
"onUpdate:itemsPerPage": o[2] || (o[2] = (t) => s(r).itemsPerPage = t),
|
|
231
|
+
"onUpdate:page": o[3] || (o[3] = (t) => s(r).page = t)
|
|
201
232
|
}, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
|
|
202
233
|
])),
|
|
203
|
-
e.filterable && s(
|
|
234
|
+
e.filterable && s(v) ? (l(), b(Be, {
|
|
204
235
|
key: 3,
|
|
205
236
|
filters: e.filters,
|
|
206
|
-
modelValue: s(
|
|
207
|
-
"onUpdate:modelValue":
|
|
208
|
-
onApplyFilters: s(
|
|
209
|
-
onClearFilters: s(
|
|
210
|
-
activeFilters: s(
|
|
211
|
-
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) :
|
|
237
|
+
modelValue: s(v),
|
|
238
|
+
"onUpdate:modelValue": o[4] || (o[4] = (t) => $e(v) ? v.value = t : null),
|
|
239
|
+
onApplyFilters: s(ce),
|
|
240
|
+
onClearFilters: s(ue),
|
|
241
|
+
activeFilters: s(de).byColumn
|
|
242
|
+
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : u("", !0)
|
|
212
243
|
], 16));
|
|
213
244
|
}
|
|
214
245
|
};
|
|
215
246
|
export {
|
|
216
|
-
|
|
247
|
+
us as default
|
|
217
248
|
};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { createElementBlock as
|
|
1
|
+
import { createElementBlock as e, openBlock as o, createElementVNode as r } from "vue";
|
|
2
2
|
import n from "../_virtual/_plugin-vue_export-helper.js";
|
|
3
3
|
const c = {}, l = {
|
|
4
4
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
width: "24",
|
|
6
|
+
height: "24",
|
|
7
|
+
viewBox: "0 0 24 24"
|
|
7
8
|
};
|
|
8
|
-
function s(
|
|
9
|
-
return
|
|
10
|
-
r("path", {
|
|
9
|
+
function s(T, t) {
|
|
10
|
+
return o(), e("svg", l, t[0] || (t[0] = [
|
|
11
|
+
r("path", {
|
|
12
|
+
fill: "currentColor",
|
|
13
|
+
d: "M9.5 16q-2.725 0-4.612-1.888T3 9.5t1.888-4.612T9.5 3t4.613 1.888T16 9.5q0 1.1-.35 2.075T14.7 13.3l5.6 5.6q.275.275.275.7t-.275.7t-.7.275t-.7-.275l-5.6-5.6q-.75.6-1.725.95T9.5 16m0-2q1.875 0 3.188-1.312T14 9.5t-1.312-3.187T9.5 5T6.313 6.313T5 9.5t1.313 3.188T9.5 14"
|
|
14
|
+
}, null, -1)
|
|
11
15
|
]));
|
|
12
16
|
}
|
|
13
|
-
const
|
|
17
|
+
const f = /* @__PURE__ */ n(c, [["render", s]]);
|
|
14
18
|
export {
|
|
15
|
-
|
|
19
|
+
f as default
|
|
16
20
|
};
|