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