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