adverich-kun-ui 0.1.189 → 0.1.190
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,49 +1,49 @@
|
|
|
1
|
-
import { toRefs as
|
|
1
|
+
import { toRefs as re, ref as ne, watch as j, computed as z, createElementBlock as c, openBlock as l, mergeProps as E, createCommentVNode as i, createElementVNode as D, renderSlot as a, createBlock as b, unref as s, normalizeClass as L, withDirectives as ie, vModelText as de, normalizeProps as d, guardReactiveProps as u, Fragment as pe, createVNode as M, createSlots as R, renderList as U, withCtx as I, isRef as ce } from "vue";
|
|
2
2
|
import { isMobile as v } from "../../../../utils/_platform.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
3
|
+
import me from "./KunTableHeaders.vue.js";
|
|
4
|
+
import ue from "./KunTableFooter.vue.js";
|
|
5
|
+
import he from "./KunTableRows.vue.js";
|
|
6
|
+
import ge from "./KunTableIterators.vue.js";
|
|
7
|
+
import fe from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
8
|
+
import be from "./KunTableFilter.vue.js";
|
|
9
|
+
import ye from "../../../KunCard/src/components/KunCard.vue.js";
|
|
10
|
+
import we from "../composables/useExpand.js";
|
|
11
|
+
import ve from "../composables/useOptions.js";
|
|
12
12
|
import Se from "../composables/useSelect.js";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
const
|
|
13
|
+
import Ce from "../composables/useFilter.js";
|
|
14
|
+
import $e from "../composables/KunTableProps.js";
|
|
15
|
+
const ke = ["placeholder"], Pe = { key: 0 }, Te = { key: 5 }, Fe = { class: "h-full" }, Ae = {
|
|
16
16
|
key: 1,
|
|
17
17
|
class: "sticky bottom-0 z-10"
|
|
18
|
-
},
|
|
18
|
+
}, Ee = "overflow-auto h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", Be = "table-auto w-full h-fit text-sm text-left", He = {
|
|
19
19
|
__name: "KunTable",
|
|
20
|
-
props:
|
|
20
|
+
props: $e(),
|
|
21
21
|
emits: ["update:page", "update:itemsPerPage", "update:sortBy", "update:selectedItems", "update:search"],
|
|
22
|
-
setup(
|
|
23
|
-
const
|
|
24
|
-
headers:
|
|
25
|
-
showExpand:
|
|
22
|
+
setup(N, { emit: K }) {
|
|
23
|
+
const S = K, r = N, y = re(r), {
|
|
24
|
+
headers: w,
|
|
25
|
+
showExpand: C,
|
|
26
26
|
showSelect: $,
|
|
27
|
-
rowClass:
|
|
27
|
+
rowClass: B,
|
|
28
28
|
hideDefaultFooter: O,
|
|
29
29
|
hideDefaultHeader: W,
|
|
30
30
|
tableClass: x,
|
|
31
31
|
wrapperClass: H,
|
|
32
32
|
pageOptions: Q,
|
|
33
33
|
items: q,
|
|
34
|
-
searchable:
|
|
34
|
+
searchable: V,
|
|
35
35
|
debounceTime: G
|
|
36
|
-
} =
|
|
37
|
-
|
|
36
|
+
} = y, h = ne(r.search);
|
|
37
|
+
j(() => r.search, (e) => {
|
|
38
38
|
e !== h.value && (h.value = e);
|
|
39
39
|
});
|
|
40
|
-
const { filteredItems: J, setSearch: X, modalFilter: g, applyColumnFilters: Y, clearFilters: Z, appliedFilters: _ } =
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const { filteredItems: J, setSearch: X, modalFilter: g, applyColumnFilters: Y, clearFilters: Z, appliedFilters: _ } = Ce(y, G);
|
|
41
|
+
j(h, (e) => {
|
|
42
|
+
S("update:search", e), X(e);
|
|
43
43
|
});
|
|
44
|
-
const { options: n, paginatedItems: p, updateSort: ee } =
|
|
44
|
+
const { options: n, paginatedItems: p, updateSort: ee } = ve(y, S, J), { isSelected: k, toggleSelect: P, toggleSelectAll: se, allSelected: te, someSelected: le } = Se(y, S, p), { isExpanded: T, toggleExpand: F } = we(), m = z(() => ({
|
|
45
45
|
items: p.value,
|
|
46
|
-
headers:
|
|
46
|
+
headers: w.value,
|
|
47
47
|
page: n.page,
|
|
48
48
|
itemsPerPage: n.itemsPerPage,
|
|
49
49
|
toggleSelect: P,
|
|
@@ -52,50 +52,50 @@ const Pe = ["placeholder"], Te = { key: 0 }, Fe = { key: 5 }, Ae = ["colspan"],
|
|
|
52
52
|
isExpanded: T,
|
|
53
53
|
sortBy: n.sortBy,
|
|
54
54
|
hasActions: r.hasActions
|
|
55
|
-
})), oe = [
|
|
55
|
+
})), oe = [Ee, H.value], ae = [Be, x.value];
|
|
56
|
+
return z(() => {
|
|
56
57
|
var t;
|
|
57
58
|
let e = ((t = r.headers) == null ? void 0 : t.length) || 0;
|
|
58
59
|
return r.showSelect && (e += 1), r.showExpand && (e += 1), r.hasActions && (e += 1), e;
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
s(z) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), i("div", {
|
|
60
|
+
}), (e, t) => (l(), c("div", E({ class: oe }, e.$attrs, { style: { "user-select": "text" } }), [
|
|
61
|
+
s(V) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), c("div", {
|
|
62
62
|
key: 0,
|
|
63
|
-
class:
|
|
63
|
+
class: L(["p-2 bg-slate-200 dark:bg-slate-800", {
|
|
64
64
|
"justify-start flex": e.searchPosition === "start",
|
|
65
65
|
"justify-center flex": e.searchPosition === "center",
|
|
66
66
|
"justify-end flex": e.searchPosition === "end"
|
|
67
67
|
}])
|
|
68
68
|
}, [
|
|
69
69
|
a(e.$slots, "prependSearch"),
|
|
70
|
-
e.filterable ? (l(),
|
|
70
|
+
e.filterable ? (l(), b(fe, {
|
|
71
71
|
key: 0,
|
|
72
72
|
onClick: t[0] || (t[0] = (o) => g.value = !0),
|
|
73
73
|
text: "Filtrar",
|
|
74
74
|
bgColor: "bg-slate-300 dark:bg-slate-700"
|
|
75
|
-
})) :
|
|
76
|
-
s(
|
|
75
|
+
})) : i("", !0),
|
|
76
|
+
s(V) ? ie((l(), c("input", {
|
|
77
77
|
key: 1,
|
|
78
78
|
"onUpdate:modelValue": t[1] || (t[1] = (o) => h.value = o),
|
|
79
79
|
type: "text",
|
|
80
80
|
placeholder: e.searchPlaceholder,
|
|
81
81
|
class: "border mx-2 px-3 py-1 rounded w-full max-w-sm text-sm"
|
|
82
|
-
}, null, 8,
|
|
83
|
-
[
|
|
84
|
-
]) :
|
|
82
|
+
}, null, 8, ke)), [
|
|
83
|
+
[de, h.value]
|
|
84
|
+
]) : i("", !0),
|
|
85
85
|
a(e.$slots, "appendSearch")
|
|
86
|
-
], 2)) :
|
|
87
|
-
|
|
88
|
-
class:
|
|
86
|
+
], 2)) : i("", !0),
|
|
87
|
+
D("table", {
|
|
88
|
+
class: L(ae)
|
|
89
89
|
}, [
|
|
90
|
-
e.$slots.colgroup && !s(v) ? (l(),
|
|
91
|
-
a(e.$slots, "colgroup", d(u(
|
|
92
|
-
])) :
|
|
93
|
-
!s(W) && !s(v) ? (l(),
|
|
90
|
+
e.$slots.colgroup && !s(v) ? (l(), c("colgroup", Pe, [
|
|
91
|
+
a(e.$slots, "colgroup", d(u(m.value)))
|
|
92
|
+
])) : i("", !0),
|
|
93
|
+
!s(W) && !s(v) ? (l(), b(me, {
|
|
94
94
|
key: 1,
|
|
95
|
-
headers: s(
|
|
95
|
+
headers: s(w),
|
|
96
96
|
"sort-by": s(n).sortBy,
|
|
97
97
|
"show-select": s($),
|
|
98
|
-
"show-expand": s(
|
|
98
|
+
"show-expand": s(C),
|
|
99
99
|
"all-selected": s(te),
|
|
100
100
|
"some-selected": s(le),
|
|
101
101
|
"thead-class": e.theadClass,
|
|
@@ -105,14 +105,14 @@ const Pe = ["placeholder"], Te = { key: 0 }, Fe = { key: 5 }, Ae = ["colspan"],
|
|
|
105
105
|
"action-label": e.actionLabel,
|
|
106
106
|
onSort: s(ee),
|
|
107
107
|
onToggleSelectAll: s(se)
|
|
108
|
-
}, 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(E({ key: 2 },
|
|
109
|
-
s(p).length && !s(v) ? (l(),
|
|
110
|
-
a(e.$slots, "body.prepend", d(u(
|
|
111
|
-
|
|
108
|
+
}, 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(E({ key: 2 }, m.value))),
|
|
109
|
+
s(p).length && !s(v) ? (l(), c(pe, { key: 3 }, [
|
|
110
|
+
a(e.$slots, "body.prepend", d(u(m.value))),
|
|
111
|
+
M(he, {
|
|
112
112
|
items: s(p),
|
|
113
|
-
headers: s(
|
|
113
|
+
headers: s(w),
|
|
114
114
|
"tbody-class": e.tbodyClass,
|
|
115
|
-
"row-class": s(
|
|
115
|
+
"row-class": s(B),
|
|
116
116
|
"tr-class": e.trClass,
|
|
117
117
|
"td-class": e.tdClass,
|
|
118
118
|
"selected-class": e.selectedClass,
|
|
@@ -120,7 +120,7 @@ const Pe = ["placeholder"], Te = { key: 0 }, Fe = { key: 5 }, Ae = ["colspan"],
|
|
|
120
120
|
"is-selected": s(k),
|
|
121
121
|
"is-expanded": s(T),
|
|
122
122
|
"show-select": s($),
|
|
123
|
-
"show-expand": s(
|
|
123
|
+
"show-expand": s(C),
|
|
124
124
|
"has-actions": e.hasActions,
|
|
125
125
|
"action-loading-map": e.actionLoadingMap,
|
|
126
126
|
onToggleExpand: s(F),
|
|
@@ -128,21 +128,21 @@ const Pe = ["placeholder"], Te = { key: 0 }, Fe = { key: 5 }, Ae = ["colspan"],
|
|
|
128
128
|
}, R({ _: 2 }, [
|
|
129
129
|
U(e.$slots, (o, f) => ({
|
|
130
130
|
name: f,
|
|
131
|
-
fn:
|
|
131
|
+
fn: I((A) => [
|
|
132
132
|
a(e.$slots, f, d(u(A)))
|
|
133
133
|
])
|
|
134
134
|
}))
|
|
135
135
|
]), 1032, ["items", "headers", "tbody-class", "row-class", "tr-class", "td-class", "selected-class", "striped-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"]),
|
|
136
|
-
a(e.$slots, "body.append", d(u(
|
|
137
|
-
], 64)) : s(p).length && s(v) ? (l(),
|
|
136
|
+
a(e.$slots, "body.append", d(u(m.value)))
|
|
137
|
+
], 64)) : s(p).length && s(v) ? (l(), b(ge, {
|
|
138
138
|
key: 4,
|
|
139
139
|
items: s(p),
|
|
140
|
-
headers: s(
|
|
141
|
-
"row-class": s(
|
|
140
|
+
headers: s(w),
|
|
141
|
+
"row-class": s(B),
|
|
142
142
|
"is-selected": s(k),
|
|
143
143
|
"is-expanded": s(T),
|
|
144
144
|
"show-select": s($),
|
|
145
|
-
"show-expand": s(
|
|
145
|
+
"show-expand": s(C),
|
|
146
146
|
"has-actions": e.hasActions,
|
|
147
147
|
"action-loading-map": e.actionLoadingMap,
|
|
148
148
|
onToggleExpand: s(F),
|
|
@@ -150,26 +150,25 @@ const Pe = ["placeholder"], Te = { key: 0 }, Fe = { key: 5 }, Ae = ["colspan"],
|
|
|
150
150
|
}, R({ _: 2 }, [
|
|
151
151
|
U(e.$slots, (o, f) => ({
|
|
152
152
|
name: f,
|
|
153
|
-
fn:
|
|
153
|
+
fn: I((A) => [
|
|
154
154
|
a(e.$slots, f, d(u(A)))
|
|
155
155
|
])
|
|
156
156
|
}))
|
|
157
|
-
]), 1032, ["items", "headers", "row-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"])) :
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
157
|
+
]), 1032, ["items", "headers", "row-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"])) : i("", !0),
|
|
158
|
+
e.$slots.tfoot ? (l(), c("tfoot", Te, [
|
|
159
|
+
a(e.$slots, "tfoot", d(u(m.value)))
|
|
160
|
+
])) : i("", !0)
|
|
161
|
+
]),
|
|
162
|
+
D("div", Fe, [
|
|
163
|
+
s(p).length ? i("", !0) : (l(), b(ye, {
|
|
164
|
+
key: 0,
|
|
165
|
+
class: "h-full flex justify-center items-center",
|
|
166
|
+
title: e.noDataText,
|
|
167
|
+
titleSize: "text-4xl"
|
|
168
|
+
}, null, 8, ["title"]))
|
|
169
169
|
]),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
V(he, {
|
|
170
|
+
s(O) ? a(e.$slots, "footer", d(E({ key: 2 }, m.value))) : (l(), c("div", Ae, [
|
|
171
|
+
M(ue, {
|
|
173
172
|
"items-length": s(q).length,
|
|
174
173
|
"items-per-page": s(n).itemsPerPage,
|
|
175
174
|
"current-page": s(n).page,
|
|
@@ -178,18 +177,18 @@ const Pe = ["placeholder"], Te = { key: 0 }, Fe = { key: 5 }, Ae = ["colspan"],
|
|
|
178
177
|
"onUpdate:page": t[3] || (t[3] = (o) => s(n).page = o)
|
|
179
178
|
}, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
|
|
180
179
|
])),
|
|
181
|
-
e.filterable && s(g) ? (l(),
|
|
180
|
+
e.filterable && s(g) ? (l(), b(be, {
|
|
182
181
|
key: 3,
|
|
183
182
|
filters: e.filters,
|
|
184
183
|
modelValue: s(g),
|
|
185
|
-
"onUpdate:modelValue": t[4] || (t[4] = (o) =>
|
|
184
|
+
"onUpdate:modelValue": t[4] || (t[4] = (o) => ce(g) ? g.value = o : null),
|
|
186
185
|
onApplyFilters: s(Y),
|
|
187
186
|
onClearFilters: s(Z),
|
|
188
187
|
activeFilters: s(_).byColumn
|
|
189
|
-
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) :
|
|
188
|
+
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : i("", !0)
|
|
190
189
|
], 16));
|
|
191
190
|
}
|
|
192
191
|
};
|
|
193
192
|
export {
|
|
194
|
-
|
|
193
|
+
He as default
|
|
195
194
|
};
|
|
@@ -50,8 +50,8 @@ const t = () => ({
|
|
|
50
50
|
tfootClass: { type: String, default: "" },
|
|
51
51
|
rowClass: { type: String, default: "" },
|
|
52
52
|
// Misc
|
|
53
|
-
noDataText: { type: String, default: "No
|
|
54
|
-
loadingText: { type: String, default: "
|
|
53
|
+
noDataText: { type: String, default: "No hay elementos disponibles" },
|
|
54
|
+
loadingText: { type: String, default: "Cargando..." },
|
|
55
55
|
// Slots control
|
|
56
56
|
showTopSlot: { type: Boolean, default: !1 },
|
|
57
57
|
showBottomSlot: { type: Boolean, default: !1 }
|