adverich-kun-ui 0.1.246 → 0.1.247
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,10 +1,10 @@
|
|
|
1
|
-
import { mergeModels as V, toRefs as de, useModel as pe, ref as ce, watch as
|
|
1
|
+
import { mergeModels as V, toRefs as de, useModel as pe, ref as ce, watch as H, computed as j, createElementBlock as c, openBlock as o, mergeProps as A, createCommentVNode as i, createElementVNode as z, renderSlot as a, createBlock as y, unref as s, normalizeClass as D, withDirectives as ue, vModelText as me, normalizeProps as d, guardReactiveProps as f, Fragment as fe, createVNode as L, createSlots as N, renderList as R, withCtx as U, isRef as ge } from "vue";
|
|
2
2
|
import { isMobile as b } from "../../../../utils/_platform.js";
|
|
3
3
|
import he from "./KunTableHeaders.vue.js";
|
|
4
4
|
import ye from "./KunTableFooter.vue.js";
|
|
5
5
|
import be from "./KunTableRows.vue.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import ve from "./KunTableIterators.vue.js";
|
|
7
|
+
import we from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
8
8
|
import Se from "./KunTableFilter.vue.js";
|
|
9
9
|
import $e from "../../../KunCard/src/components/KunCard.vue.js";
|
|
10
10
|
import Ce from "../composables/useExpand.js";
|
|
@@ -15,7 +15,7 @@ import Te from "../composables/KunTableProps.js";
|
|
|
15
15
|
const Ae = ["placeholder"], Ee = { key: 0 }, Me = { key: 5 }, Be = { class: "h-full" }, Ie = {
|
|
16
16
|
key: 1,
|
|
17
17
|
class: "sticky bottom-0 z-10"
|
|
18
|
-
}, Ve = "overflow-auto h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded",
|
|
18
|
+
}, Ve = "overflow-auto h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", He = "table-auto w-full h-fit text-sm text-left", Xe = {
|
|
19
19
|
__name: "KunTable",
|
|
20
20
|
props: /* @__PURE__ */ V(Te(), {
|
|
21
21
|
selectedItems: { type: Array, default: () => [] },
|
|
@@ -23,8 +23,8 @@ const Ae = ["placeholder"], Ee = { key: 0 }, Me = { key: 5 }, Be = { class: "h-f
|
|
|
23
23
|
}),
|
|
24
24
|
emits: /* @__PURE__ */ V(["update:page", "update:itemsPerPage", "update:sortBy", "update:search"], ["update:selectedItems"]),
|
|
25
25
|
setup(E, { emit: K }) {
|
|
26
|
-
const M = K, u = E,
|
|
27
|
-
headers:
|
|
26
|
+
const M = K, u = E, v = de(u), O = pe(E, "selectedItems"), {
|
|
27
|
+
headers: w,
|
|
28
28
|
showExpand: S,
|
|
29
29
|
showSelect: $,
|
|
30
30
|
rowClass: B,
|
|
@@ -36,17 +36,17 @@ const Ae = ["placeholder"], Ee = { key: 0 }, Me = { key: 5 }, Be = { class: "h-f
|
|
|
36
36
|
items: X,
|
|
37
37
|
searchable: I,
|
|
38
38
|
debounceTime: Y
|
|
39
|
-
} =
|
|
40
|
-
|
|
39
|
+
} = v, g = ce(u.search);
|
|
40
|
+
H(() => u.search, (e) => {
|
|
41
41
|
e !== g.value && (g.value = e);
|
|
42
42
|
});
|
|
43
|
-
const { filteredItems: Z, setSearch: x, modalFilter: h, applyColumnFilters: _, clearFilters: ee, appliedFilters: se } = Pe(
|
|
44
|
-
|
|
43
|
+
const { filteredItems: Z, setSearch: x, modalFilter: h, applyColumnFilters: _, clearFilters: ee, appliedFilters: se } = Pe(v, Y);
|
|
44
|
+
H(g, (e) => {
|
|
45
45
|
M("update:search", e), x(e);
|
|
46
46
|
});
|
|
47
|
-
const { options: r, paginatedItems: p, updateSort: te } = ke(
|
|
47
|
+
const { options: r, paginatedItems: p, updateSort: te } = ke(v, M, Z), { isSelected: C, toggleSelect: k, toggleSelectAll: le, allSelected: oe, someSelected: ae } = Fe(p, O), { isExpanded: F, toggleExpand: P } = Ce(), m = j(() => ({
|
|
48
48
|
items: p.value,
|
|
49
|
-
headers:
|
|
49
|
+
headers: w.value,
|
|
50
50
|
page: r.page,
|
|
51
51
|
itemsPerPage: r.itemsPerPage,
|
|
52
52
|
toggleSelect: k,
|
|
@@ -55,7 +55,7 @@ const Ae = ["placeholder"], Ee = { key: 0 }, Me = { key: 5 }, Be = { class: "h-f
|
|
|
55
55
|
isExpanded: F,
|
|
56
56
|
sortBy: r.sortBy,
|
|
57
57
|
hasActions: u.hasActions
|
|
58
|
-
})), re = [Ve, G.value], ne = [
|
|
58
|
+
})), re = [Ve, G.value], ne = [He, q.value], ie = j(() => u.headers.map((e) => {
|
|
59
59
|
var l;
|
|
60
60
|
const t = { ...e };
|
|
61
61
|
if (e.columnType === "function" && typeof e.columnFunction == "string") {
|
|
@@ -69,14 +69,14 @@ const Ae = ["placeholder"], Ee = { key: 0 }, Me = { key: 5 }, Be = { class: "h-f
|
|
|
69
69
|
return (e, t) => (o(), c("div", A({ class: re }, e.$attrs, { style: { "user-select": "text" } }), [
|
|
70
70
|
s(I) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (o(), c("div", {
|
|
71
71
|
key: 0,
|
|
72
|
-
class:
|
|
72
|
+
class: D(["p-2 bg-slate-200 dark:bg-slate-800", {
|
|
73
73
|
"justify-start flex": e.searchPosition === "start",
|
|
74
74
|
"justify-center flex": e.searchPosition === "center",
|
|
75
75
|
"justify-end flex": e.searchPosition === "end"
|
|
76
76
|
}])
|
|
77
77
|
}, [
|
|
78
78
|
a(e.$slots, "prependSearch"),
|
|
79
|
-
e.filterable ? (o(), y(
|
|
79
|
+
e.filterable ? (o(), y(we, {
|
|
80
80
|
key: 0,
|
|
81
81
|
onClick: t[0] || (t[0] = (l) => h.value = !0),
|
|
82
82
|
text: "Filtrar",
|
|
@@ -93,15 +93,15 @@ const Ae = ["placeholder"], Ee = { key: 0 }, Me = { key: 5 }, Be = { class: "h-f
|
|
|
93
93
|
]) : i("", !0),
|
|
94
94
|
a(e.$slots, "appendSearch")
|
|
95
95
|
], 2)) : i("", !0),
|
|
96
|
-
|
|
97
|
-
class:
|
|
96
|
+
z("table", {
|
|
97
|
+
class: D(ne)
|
|
98
98
|
}, [
|
|
99
99
|
e.$slots.colgroup && !s(b) ? (o(), c("colgroup", Ee, [
|
|
100
100
|
a(e.$slots, "colgroup", d(f(m.value)))
|
|
101
101
|
])) : i("", !0),
|
|
102
102
|
!s(Q) && !s(b) ? (o(), y(he, {
|
|
103
103
|
key: 1,
|
|
104
|
-
headers: s(
|
|
104
|
+
headers: s(w),
|
|
105
105
|
"sort-by": s(r).sortBy,
|
|
106
106
|
"show-select": s($),
|
|
107
107
|
"show-expand": s(S),
|
|
@@ -117,9 +117,9 @@ const Ae = ["placeholder"], Ee = { key: 0 }, Me = { key: 5 }, Be = { class: "h-f
|
|
|
117
117
|
}, 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(A({ key: 2 }, m.value))),
|
|
118
118
|
s(p).length && !s(b) ? (o(), c(fe, { key: 3 }, [
|
|
119
119
|
a(e.$slots, "body.prepend", d(f(m.value))),
|
|
120
|
-
|
|
120
|
+
L(be, {
|
|
121
121
|
items: s(p),
|
|
122
|
-
|
|
122
|
+
resolvedHeaders: ie.value,
|
|
123
123
|
"tbody-class": e.tbodyClass,
|
|
124
124
|
"row-class": s(B),
|
|
125
125
|
"tr-class": e.trClass,
|
|
@@ -135,19 +135,19 @@ const Ae = ["placeholder"], Ee = { key: 0 }, Me = { key: 5 }, Be = { class: "h-f
|
|
|
135
135
|
onToggleExpand: s(P),
|
|
136
136
|
onToggleSelect: s(k),
|
|
137
137
|
customSlots: e.customSlots
|
|
138
|
-
},
|
|
139
|
-
|
|
138
|
+
}, N({ _: 2 }, [
|
|
139
|
+
R(e.$slots, (l, n) => ({
|
|
140
140
|
name: n,
|
|
141
|
-
fn:
|
|
141
|
+
fn: U((T) => [
|
|
142
142
|
a(e.$slots, n, d(f(T)))
|
|
143
143
|
])
|
|
144
144
|
}))
|
|
145
|
-
]), 1032, ["items", "
|
|
145
|
+
]), 1032, ["items", "resolvedHeaders", "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", "customSlots"]),
|
|
146
146
|
a(e.$slots, "body.append", d(f(m.value)))
|
|
147
|
-
], 64)) : s(p).length && s(b) ? (o(), y(
|
|
147
|
+
], 64)) : s(p).length && s(b) ? (o(), y(ve, {
|
|
148
148
|
key: 4,
|
|
149
149
|
items: s(p),
|
|
150
|
-
headers: s(
|
|
150
|
+
headers: s(w),
|
|
151
151
|
"row-class": s(B),
|
|
152
152
|
"is-selected": s(C),
|
|
153
153
|
"is-expanded": s(F),
|
|
@@ -157,10 +157,10 @@ const Ae = ["placeholder"], Ee = { key: 0 }, Me = { key: 5 }, Be = { class: "h-f
|
|
|
157
157
|
"action-loading-map": e.actionLoadingMap,
|
|
158
158
|
onToggleExpand: s(P),
|
|
159
159
|
onToggleSelect: s(k)
|
|
160
|
-
},
|
|
161
|
-
|
|
160
|
+
}, N({ _: 2 }, [
|
|
161
|
+
R(e.$slots, (l, n) => ({
|
|
162
162
|
name: n,
|
|
163
|
-
fn:
|
|
163
|
+
fn: U((T) => [
|
|
164
164
|
a(e.$slots, n, d(f(T)))
|
|
165
165
|
])
|
|
166
166
|
}))
|
|
@@ -169,7 +169,7 @@ const Ae = ["placeholder"], Ee = { key: 0 }, Me = { key: 5 }, Be = { class: "h-f
|
|
|
169
169
|
a(e.$slots, "tfoot", d(f(m.value)))
|
|
170
170
|
])) : i("", !0)
|
|
171
171
|
]),
|
|
172
|
-
|
|
172
|
+
z("div", Be, [
|
|
173
173
|
s(p).length ? i("", !0) : (o(), y($e, {
|
|
174
174
|
key: 0,
|
|
175
175
|
class: "h-full flex justify-center items-center",
|
|
@@ -178,7 +178,7 @@ const Ae = ["placeholder"], Ee = { key: 0 }, Me = { key: 5 }, Be = { class: "h-f
|
|
|
178
178
|
}, null, 8, ["title"]))
|
|
179
179
|
]),
|
|
180
180
|
s(W) ? a(e.$slots, "footer", d(A({ key: 2 }, m.value))) : (o(), c("div", Ie, [
|
|
181
|
-
|
|
181
|
+
L(ye, {
|
|
182
182
|
"items-length": s(X).length,
|
|
183
183
|
"items-per-page": s(r).itemsPerPage,
|
|
184
184
|
"current-page": s(r).page,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createElementBlock as l, openBlock as s, normalizeClass as a, createCommentVNode as
|
|
1
|
+
import { createElementBlock as l, openBlock as s, normalizeClass as a, createCommentVNode as m, renderSlot as u, createElementVNode as w, withModifiers as y, Fragment as S, renderList as v, createBlock as f, resolveDynamicComponent as h, unref as c, createTextVNode as B, toDisplayString as $ } from "vue";
|
|
2
2
|
import { getValue as g, formatValue as A } from "../../../../utils/tableFormatters.js";
|
|
3
|
-
const E = { key: 0 }, T = { key: 1 }, V = ["checked"], N = "hover:bg-slate-300 dark:hover:bg-slate-600 border-t border-slate-300 dark:border-slate-700", j = "bg-slate-100 dark:bg-slate-900", D = "px-3 py-2 whitespace-nowrap text-sm text-black dark:text-white",
|
|
3
|
+
const E = { key: 0 }, T = { key: 1 }, V = ["checked"], N = "hover:bg-slate-300 dark:hover:bg-slate-600 border-t border-slate-300 dark:border-slate-700", j = "bg-slate-100 dark:bg-slate-900", D = "px-3 py-2 whitespace-nowrap text-sm text-black dark:text-white", R = {
|
|
4
4
|
__name: "KunTableRow",
|
|
5
5
|
props: {
|
|
6
6
|
item: Object,
|
|
7
7
|
index: Number,
|
|
8
|
-
|
|
8
|
+
resolvedHeaders: Array,
|
|
9
9
|
showExpand: Boolean,
|
|
10
10
|
showSelect: Boolean,
|
|
11
11
|
isExpanded: Boolean,
|
|
@@ -22,7 +22,7 @@ const E = { key: 0 }, T = { key: 1 }, V = ["checked"], N = "hover:bg-slate-300 d
|
|
|
22
22
|
},
|
|
23
23
|
emits: ["toggle-expand", "toggle-select", "row-click"],
|
|
24
24
|
setup(e, { emit: k }) {
|
|
25
|
-
const n = e,
|
|
25
|
+
const n = e, r = k, C = [
|
|
26
26
|
N,
|
|
27
27
|
j,
|
|
28
28
|
n.rowClass,
|
|
@@ -32,7 +32,7 @@ const E = { key: 0 }, T = { key: 1 }, V = ["checked"], N = "hover:bg-slate-300 d
|
|
|
32
32
|
], o = [D, n.tdClass], b = ["text-center", n.actionsAlign];
|
|
33
33
|
return (d, i) => (s(), l("tr", {
|
|
34
34
|
class: a(C),
|
|
35
|
-
onClick: i[2] || (i[2] = (t) =>
|
|
35
|
+
onClick: i[2] || (i[2] = (t) => r("row-click", { item: e.item, index: e.index, event: t }))
|
|
36
36
|
}, [
|
|
37
37
|
e.showExpand ? (s(), l("td", {
|
|
38
38
|
key: 0,
|
|
@@ -44,11 +44,11 @@ const E = { key: 0 }, T = { key: 1 }, V = ["checked"], N = "hover:bg-slate-300 d
|
|
|
44
44
|
index: e.index
|
|
45
45
|
}) : (s(), l("button", {
|
|
46
46
|
key: 1,
|
|
47
|
-
onClick: i[0] || (i[0] = (t) =>
|
|
47
|
+
onClick: i[0] || (i[0] = (t) => r("toggle-expand", e.item))
|
|
48
48
|
}, [
|
|
49
49
|
e.isExpanded ? (s(), l("span", E, "−")) : (s(), l("span", T, "+"))
|
|
50
50
|
]))
|
|
51
|
-
])) :
|
|
51
|
+
])) : m("", !0),
|
|
52
52
|
e.showSelect ? (s(), l("td", {
|
|
53
53
|
key: 1,
|
|
54
54
|
class: a([o, "h-full w-10 flex flex-col items-center justify-center"])
|
|
@@ -56,17 +56,17 @@ const E = { key: 0 }, T = { key: 1 }, V = ["checked"], N = "hover:bg-slate-300 d
|
|
|
56
56
|
w("input", {
|
|
57
57
|
type: "checkbox",
|
|
58
58
|
checked: e.isSelected,
|
|
59
|
-
onChange: i[1] || (i[1] = y((t) =>
|
|
59
|
+
onChange: i[1] || (i[1] = y((t) => r("toggle-select", e.item), ["stop"])),
|
|
60
60
|
class: "h-5 w-5 text-blue-600 transition-all duration-200 ease-in-out rounded"
|
|
61
61
|
}, null, 40, V)
|
|
62
|
-
])) :
|
|
63
|
-
(s(!0), l(S, null,
|
|
62
|
+
])) : m("", !0),
|
|
63
|
+
(s(!0), l(S, null, v(e.resolvedHeaders, (t) => {
|
|
64
64
|
var x;
|
|
65
65
|
return s(), l("td", {
|
|
66
66
|
key: t.value,
|
|
67
67
|
class: a([o, t.align === "right" ? "text-right" : t.align === "left" ? "text-left" : "text-center"])
|
|
68
68
|
}, [
|
|
69
|
-
(x = e.customSlots) != null && x[`item.${t.value}`] ? (s(),
|
|
69
|
+
(x = e.customSlots) != null && x[`item.${t.value}`] ? (s(), f(h(e.customSlots[`item.${t.value}`]), {
|
|
70
70
|
key: 0,
|
|
71
71
|
item: e.item,
|
|
72
72
|
value: c(g)(t, e.item),
|
|
@@ -92,10 +92,10 @@ const E = { key: 0 }, T = { key: 1 }, V = ["checked"], N = "hover:bg-slate-300 d
|
|
|
92
92
|
index: e.index,
|
|
93
93
|
loading: e.loading
|
|
94
94
|
})
|
|
95
|
-
], 2)) :
|
|
95
|
+
], 2)) : m("", !0)
|
|
96
96
|
]));
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
export {
|
|
100
|
-
|
|
100
|
+
R as default
|
|
101
101
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { computed as w, createElementBlock as l, openBlock as d, normalizeClass as g, Fragment as c, renderList as u, createVNode as b, createCommentVNode as E, mergeProps as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { computed as w, createElementBlock as l, openBlock as d, normalizeClass as g, Fragment as c, renderList as u, createVNode as b, createCommentVNode as E, mergeProps as m, createSlots as p, withCtx as C, renderSlot as f, createElementVNode as h } from "vue";
|
|
2
|
+
import v from "./KunTableRow.vue.js";
|
|
3
|
+
const B = { key: 0 }, A = ["colspan"], H = "table-auto w-full text-sm text-left", L = {
|
|
4
4
|
__name: "KunTableRows",
|
|
5
5
|
props: {
|
|
6
6
|
items: Array,
|
|
@@ -17,7 +17,7 @@ const A = { key: 0 }, $ = ["colspan"], k = "table-auto w-full text-sm text-left"
|
|
|
17
17
|
type: Function,
|
|
18
18
|
default: (e, o) => o
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
resolvedHeaders: Array,
|
|
21
21
|
showExpand: Boolean,
|
|
22
22
|
showSelect: Boolean,
|
|
23
23
|
hasActions: Boolean,
|
|
@@ -26,9 +26,9 @@ const A = { key: 0 }, $ = ["colspan"], k = "table-auto w-full text-sm text-left"
|
|
|
26
26
|
customSlots: Object
|
|
27
27
|
},
|
|
28
28
|
setup(e) {
|
|
29
|
-
const o = e, y = [
|
|
29
|
+
const o = e, y = [H, o.tbodyClass], x = w(() => {
|
|
30
30
|
var a;
|
|
31
|
-
let t = ((a = o.
|
|
31
|
+
let t = ((a = o.resolvedHeaders) == null ? void 0 : a.length) || 0;
|
|
32
32
|
return o.showSelect && (t += 1), o.showExpand && (t += 1), o.hasActions && (t += 1), t;
|
|
33
33
|
});
|
|
34
34
|
return (t, a) => (d(), l("tbody", {
|
|
@@ -37,10 +37,10 @@ const A = { key: 0 }, $ = ["colspan"], k = "table-auto w-full text-sm text-left"
|
|
|
37
37
|
(d(!0), l(c, null, u(e.items, (s, n) => (d(), l(c, {
|
|
38
38
|
key: e.itemKey(s, n)
|
|
39
39
|
}, [
|
|
40
|
-
b(
|
|
40
|
+
b(v, m({
|
|
41
41
|
item: s,
|
|
42
42
|
index: n,
|
|
43
|
-
|
|
43
|
+
resolvedHeaders: e.resolvedHeaders,
|
|
44
44
|
showExpand: e.showExpand,
|
|
45
45
|
showSelect: e.showSelect,
|
|
46
46
|
"is-selected": e.isSelected(s),
|
|
@@ -48,30 +48,30 @@ const A = { key: 0 }, $ = ["colspan"], k = "table-auto w-full text-sm text-left"
|
|
|
48
48
|
"has-actions": e.hasActions,
|
|
49
49
|
loading: e.actionLoadingMap[s.id] || !1
|
|
50
50
|
}, { ref_for: !0 }, t.$attrs, { customSlots: e.customSlots }), p({ _: 2 }, [
|
|
51
|
-
u(t.$slots, (
|
|
52
|
-
name:
|
|
51
|
+
u(t.$slots, ($, r) => ({
|
|
52
|
+
name: r,
|
|
53
53
|
fn: C((S) => {
|
|
54
|
-
var
|
|
54
|
+
var i;
|
|
55
55
|
return [
|
|
56
|
-
|
|
56
|
+
f(t.$slots, r, m({ ref_for: !0 }, { ...S, item: s, index: n, loading: ((i = e.actionLoadingMap) == null ? void 0 : i[s.id]) || !1 }))
|
|
57
57
|
];
|
|
58
58
|
})
|
|
59
59
|
}))
|
|
60
|
-
]), 1040, ["item", "index", "
|
|
61
|
-
e.isExpanded(s) ? (d(), l("tr",
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
]), 1040, ["item", "index", "resolvedHeaders", "showExpand", "showSelect", "is-selected", "is-expanded", "has-actions", "loading", "customSlots"]),
|
|
61
|
+
e.isExpanded(s) ? (d(), l("tr", B, [
|
|
62
|
+
h("td", { colspan: x.value }, [
|
|
63
|
+
f(t.$slots, "expand", {
|
|
64
64
|
item: s,
|
|
65
65
|
index: n
|
|
66
66
|
}, () => [
|
|
67
|
-
a[0] || (a[0] =
|
|
67
|
+
a[0] || (a[0] = h("div", { class: "text-center opacity-70 text-sm" }, "No hay contenido expandido.", -1))
|
|
68
68
|
])
|
|
69
|
-
], 8,
|
|
69
|
+
], 8, A)
|
|
70
70
|
])) : E("", !0)
|
|
71
71
|
], 64))), 128))
|
|
72
72
|
]));
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
export {
|
|
76
|
-
|
|
76
|
+
L as default
|
|
77
77
|
};
|