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