adverich-kun-ui 0.1.502 → 0.1.503
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,4 +1,4 @@
|
|
|
1
|
-
import { mergeModels as Q, toRefs as Se, useModel as be, ref as
|
|
1
|
+
import { mergeModels as Q, toRefs as Se, useModel as be, ref as y, watch as q, computed as G, onMounted as Ce, createElementBlock as r, openBlock as l, mergeProps as O, createCommentVNode as u, createElementVNode as b, renderSlot as a, createBlock as C, unref as s, normalizeClass as T, withCtx as j, createVNode as F, withDirectives as J, vModelText as Te, vShow as X, normalizeProps as d, guardReactiveProps as g, Fragment as Fe, createSlots as Y, renderList as Z, toDisplayString as $e, isRef as ke, nextTick as Pe } from "vue";
|
|
2
2
|
import { isMobile as m } from "../../../../utils/_platform.js";
|
|
3
3
|
import _ from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
4
4
|
import Me from "../../../../icons/IconFilter.vue.js";
|
|
@@ -8,19 +8,19 @@ import Re from "./KunTableFooter.vue.js";
|
|
|
8
8
|
import Ee from "./KunTableRows.vue.js";
|
|
9
9
|
import Be from "./KunTableIterators.vue.js";
|
|
10
10
|
import Ve from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
11
|
+
import xe from "./KunTableFilter.vue.js";
|
|
12
|
+
import Oe from "../composables/useExpand.js";
|
|
13
|
+
import je from "../composables/useOptions.js";
|
|
14
14
|
import ze from "../composables/useSelect.js";
|
|
15
15
|
import De from "../composables/useFilter.js";
|
|
16
16
|
import He from "../composables/KunTableProps.js";
|
|
17
|
-
const Ne = ["placeholder"],
|
|
17
|
+
const Ne = { class: "w-full flex items-left" }, Ke = ["placeholder"], Le = { class: "flex-1 overflow-auto bg-surface" }, Ue = { key: 0 }, We = { key: 5 }, Qe = {
|
|
18
18
|
key: 1,
|
|
19
19
|
class: "h-full flex justify-center items-center"
|
|
20
|
-
},
|
|
20
|
+
}, qe = { class: "text-center text-4xl" }, Ge = {
|
|
21
21
|
key: 1,
|
|
22
22
|
class: "sticky bottom-0 z-10 print:hidden"
|
|
23
|
-
},
|
|
23
|
+
}, Je = "overflow-hidden h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", Xe = "table-auto w-full h-fit text-sm text-left", fs = {
|
|
24
24
|
__name: "KunTable",
|
|
25
25
|
props: /* @__PURE__ */ Q(He(), {
|
|
26
26
|
selectedItems: { type: Array, default: () => [] },
|
|
@@ -28,24 +28,24 @@ const Ne = ["placeholder"], Ke = { class: "flex-1 overflow-auto bg-surface" }, L
|
|
|
28
28
|
}),
|
|
29
29
|
emits: /* @__PURE__ */ Q(["update:page", "update:itemsPerPage", "update:sortBy", "update:search", "focusOnSearch"], ["update:selectedItems"]),
|
|
30
30
|
setup(z, { emit: ee }) {
|
|
31
|
-
const S = ee, p = z,
|
|
31
|
+
const S = ee, p = z, $ = Se(p), se = be(z, "selectedItems"), {
|
|
32
32
|
headers: D,
|
|
33
|
-
showExpand:
|
|
34
|
-
showSelect:
|
|
33
|
+
showExpand: k,
|
|
34
|
+
showSelect: P,
|
|
35
35
|
rowClass: H,
|
|
36
36
|
hideDefaultFooter: oe,
|
|
37
37
|
hideDefaultHeader: te,
|
|
38
38
|
tableClass: le,
|
|
39
39
|
wrapperClass: ae,
|
|
40
40
|
pageOptions: ne,
|
|
41
|
-
items:
|
|
41
|
+
items: Ye,
|
|
42
42
|
searchable: N,
|
|
43
43
|
debounceTime: re
|
|
44
|
-
} =
|
|
44
|
+
} = $, w = y(p.search);
|
|
45
45
|
q(() => p.search, (e) => {
|
|
46
46
|
e !== w.value && (w.value = e);
|
|
47
47
|
});
|
|
48
|
-
const
|
|
48
|
+
const M = G(() => p.headers.map((e) => {
|
|
49
49
|
var t, c;
|
|
50
50
|
const o = { ...e };
|
|
51
51
|
if ((e.columnType === "function" || e.columnType == "objectFunction" || e.columnType == "simpleFunction") && typeof e.columnFunction == "string") {
|
|
@@ -61,59 +61,61 @@ const Ne = ["placeholder"], Ke = { class: "flex-1 overflow-auto bg-surface" }, L
|
|
|
61
61
|
), o.columnRowText = () => "");
|
|
62
62
|
}
|
|
63
63
|
return o;
|
|
64
|
-
})), { filteredItems: K, setSearch: ie, modalFilter:
|
|
64
|
+
})), { filteredItems: K, setSearch: ie, modalFilter: v, applyColumnFilters: ce, clearFilters: ue, appliedFilters: de } = De($, re, M);
|
|
65
65
|
q(w, (e) => {
|
|
66
66
|
S("update:search", e), ie(e);
|
|
67
67
|
});
|
|
68
|
-
const { options: i, paginatedItems: f, updateSort: pe } =
|
|
68
|
+
const { options: i, paginatedItems: f, updateSort: pe } = je($, S, K), { isSelected: A, toggleSelect: I, toggleSelectAll: me, allSelected: fe, someSelected: he } = ze(f, se), { isExpanded: R, toggleExpand: E } = Oe(), h = G(() => ({
|
|
69
69
|
items: f.value,
|
|
70
70
|
headers: D.value,
|
|
71
71
|
page: i.page,
|
|
72
72
|
itemsPerPage: i.itemsPerPage,
|
|
73
|
-
toggleSelect:
|
|
74
|
-
isSelected:
|
|
75
|
-
toggleExpand:
|
|
76
|
-
isExpanded:
|
|
73
|
+
toggleSelect: I,
|
|
74
|
+
isSelected: A,
|
|
75
|
+
toggleExpand: E,
|
|
76
|
+
isExpanded: R,
|
|
77
77
|
sortBy: i.sortBy,
|
|
78
78
|
hasActions: p.hasActions
|
|
79
|
-
})), ge = [
|
|
79
|
+
})), ge = [Je, ae.value], we = [Xe, le.value];
|
|
80
80
|
Ce(() => U());
|
|
81
|
-
const L =
|
|
82
|
-
function ye() {
|
|
83
|
-
ve();
|
|
84
|
-
}
|
|
81
|
+
const L = y(null), B = y(!0), V = y(!1);
|
|
85
82
|
function ve() {
|
|
83
|
+
ye();
|
|
84
|
+
}
|
|
85
|
+
function ye() {
|
|
86
86
|
m.value && (W(), Pe(() => {
|
|
87
87
|
L.value.focus();
|
|
88
88
|
}));
|
|
89
89
|
}
|
|
90
90
|
function U() {
|
|
91
|
-
m.value && (
|
|
91
|
+
m.value && (x.value = "w-fit", B.value = !1, V.value = !0, S("focusOnSearch", !1));
|
|
92
92
|
}
|
|
93
93
|
function W() {
|
|
94
|
-
m.value && (
|
|
94
|
+
m.value && (x.value = "w-full border", V.value = !1, B.value = !0, S("focusOnSearch", !0));
|
|
95
95
|
}
|
|
96
|
-
const
|
|
96
|
+
const x = y("w-full border max-w-sm");
|
|
97
97
|
return (e, o) => (l(), r("div", O({ class: ge }, e.$attrs, { style: { "user-select": "text" } }), [
|
|
98
98
|
s(N) || e.filterable || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), r("div", {
|
|
99
99
|
key: 0,
|
|
100
|
-
class:
|
|
100
|
+
class: T(["p-2 bg-surface print:hidden", {
|
|
101
101
|
"justify-start flex": e.searchPosition === "start",
|
|
102
102
|
"justify-center flex": e.searchPosition === "center",
|
|
103
103
|
"justify-end flex": e.searchPosition === "end"
|
|
104
104
|
}])
|
|
105
105
|
}, [
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
b("div", Ne, [
|
|
107
|
+
a(e.$slots, "prependSearch")
|
|
108
|
+
]),
|
|
109
|
+
e.filterable && e.filters.length ? (l(), C(Ve, {
|
|
108
110
|
key: 0,
|
|
109
111
|
class: "h-fit",
|
|
110
|
-
onClick: o[0] || (o[0] = (t) =>
|
|
112
|
+
onClick: o[0] || (o[0] = (t) => v.value = !0),
|
|
111
113
|
rounded: "rounded-full",
|
|
112
114
|
size: "xs",
|
|
113
115
|
bgColor: "bg-green-200 dark:bg-green-800"
|
|
114
116
|
}, {
|
|
115
|
-
default:
|
|
116
|
-
|
|
117
|
+
default: j(() => [
|
|
118
|
+
F(_, {
|
|
117
119
|
class: "h-fit",
|
|
118
120
|
icon: Me,
|
|
119
121
|
size: "text-lg"
|
|
@@ -123,44 +125,44 @@ const Ne = ["placeholder"], Ke = { class: "flex-1 overflow-auto bg-surface" }, L
|
|
|
123
125
|
})) : u("", !0),
|
|
124
126
|
s(N) ? (l(), r("div", {
|
|
125
127
|
key: 1,
|
|
126
|
-
class:
|
|
128
|
+
class: T(["rounded flex mx-2", [x.value]])
|
|
127
129
|
}, [
|
|
128
|
-
J(
|
|
130
|
+
J(b("input", {
|
|
129
131
|
"onUpdate:modelValue": o[1] || (o[1] = (t) => w.value = t),
|
|
130
132
|
type: "text",
|
|
131
133
|
placeholder: e.searchPlaceholder,
|
|
132
|
-
class:
|
|
134
|
+
class: T(["w-full text-sm", s(m) ? "px-1" : "px-2 py-1"]),
|
|
133
135
|
ref_key: "searchRef",
|
|
134
136
|
ref: L,
|
|
135
137
|
onFocus: W,
|
|
136
138
|
onBlur: U
|
|
137
|
-
}, null, 42,
|
|
139
|
+
}, null, 42, Ke), [
|
|
138
140
|
[Te, w.value],
|
|
139
|
-
[X,
|
|
141
|
+
[X, B.value]
|
|
140
142
|
]),
|
|
141
|
-
J(
|
|
143
|
+
J(F(_, {
|
|
142
144
|
icon: Ae,
|
|
143
|
-
onClick:
|
|
145
|
+
onClick: ve
|
|
144
146
|
}, null, 512), [
|
|
145
|
-
[X,
|
|
147
|
+
[X, V.value]
|
|
146
148
|
])
|
|
147
149
|
], 2)) : u("", !0),
|
|
148
150
|
a(e.$slots, "appendSearch")
|
|
149
151
|
], 2)) : u("", !0),
|
|
150
|
-
|
|
152
|
+
b("div", Le, [
|
|
151
153
|
s(f).length ? (l(), r("table", {
|
|
152
154
|
key: 0,
|
|
153
|
-
class:
|
|
155
|
+
class: T(we)
|
|
154
156
|
}, [
|
|
155
|
-
e.$slots.colgroup && !s(m) ? (l(), r("colgroup",
|
|
157
|
+
e.$slots.colgroup && !s(m) ? (l(), r("colgroup", Ue, [
|
|
156
158
|
a(e.$slots, "colgroup", d(g(h.value)))
|
|
157
159
|
])) : u("", !0),
|
|
158
|
-
!s(te) && !s(m) ? (l(),
|
|
160
|
+
!s(te) && !s(m) ? (l(), C(Ie, {
|
|
159
161
|
key: 1,
|
|
160
162
|
headers: s(D),
|
|
161
163
|
"sort-by": s(i).sortBy,
|
|
162
|
-
"show-select": s(
|
|
163
|
-
"show-expand": s(
|
|
164
|
+
"show-select": s(P),
|
|
165
|
+
"show-expand": s(k),
|
|
164
166
|
"all-selected": s(fe),
|
|
165
167
|
"some-selected": s(he),
|
|
166
168
|
"thead-class": e.theadClass,
|
|
@@ -172,33 +174,33 @@ const Ne = ["placeholder"], Ke = { class: "flex-1 overflow-auto bg-surface" }, L
|
|
|
172
174
|
onToggleSelectAll: s(me),
|
|
173
175
|
customHeaders: e.customSlots
|
|
174
176
|
}, 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", "customHeaders"])) : a(e.$slots, "thead", d(O({ key: 2 }, h.value))),
|
|
175
|
-
s(m) ? (l(),
|
|
177
|
+
s(m) ? (l(), C(Be, {
|
|
176
178
|
key: 4,
|
|
177
179
|
items: s(f),
|
|
178
|
-
headers:
|
|
180
|
+
headers: M.value,
|
|
179
181
|
"row-class": s(H),
|
|
180
182
|
"row-class-condition": e.rowClassCondition,
|
|
181
|
-
"is-selected": s(
|
|
182
|
-
"is-expanded": s(
|
|
183
|
-
"show-select": s(
|
|
184
|
-
"show-expand": s(
|
|
183
|
+
"is-selected": s(A),
|
|
184
|
+
"is-expanded": s(R),
|
|
185
|
+
"show-select": s(P),
|
|
186
|
+
"show-expand": s(k),
|
|
185
187
|
"has-actions": e.hasActions,
|
|
186
188
|
"action-loading-map": e.actionLoadingMap,
|
|
187
|
-
onToggleExpand: s(
|
|
188
|
-
onToggleSelect: s(
|
|
189
|
+
onToggleExpand: s(E),
|
|
190
|
+
onToggleSelect: s(I),
|
|
189
191
|
customSlots: e.customSlots
|
|
190
192
|
}, Y({ _: 2 }, [
|
|
191
193
|
Z(e.$slots, (t, c) => ({
|
|
192
194
|
name: c,
|
|
193
|
-
fn:
|
|
195
|
+
fn: j((n) => [
|
|
194
196
|
a(e.$slots, c, d(g(n)))
|
|
195
197
|
])
|
|
196
198
|
}))
|
|
197
199
|
]), 1032, ["items", "headers", "row-class", "row-class-condition", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect", "customSlots"])) : (l(), r(Fe, { key: 3 }, [
|
|
198
200
|
a(e.$slots, "body.prepend", d(g(h.value))),
|
|
199
|
-
|
|
201
|
+
F(Ee, {
|
|
200
202
|
items: s(f),
|
|
201
|
-
headers:
|
|
203
|
+
headers: M.value,
|
|
202
204
|
"tbody-class": e.tbodyClass,
|
|
203
205
|
"row-class": s(H),
|
|
204
206
|
"row-class-condition": e.rowClassCondition,
|
|
@@ -206,35 +208,35 @@ const Ne = ["placeholder"], Ke = { class: "flex-1 overflow-auto bg-surface" }, L
|
|
|
206
208
|
"td-class": e.tdClass,
|
|
207
209
|
"selected-class": e.selectedClass,
|
|
208
210
|
"striped-class": e.stripedClass,
|
|
209
|
-
"is-selected": s(
|
|
210
|
-
"is-expanded": s(
|
|
211
|
-
"show-select": s(
|
|
212
|
-
"show-expand": s(
|
|
211
|
+
"is-selected": s(A),
|
|
212
|
+
"is-expanded": s(R),
|
|
213
|
+
"show-select": s(P),
|
|
214
|
+
"show-expand": s(k),
|
|
213
215
|
"has-actions": e.hasActions,
|
|
214
216
|
"action-loading-map": e.actionLoadingMap,
|
|
215
|
-
onToggleExpand: s(
|
|
216
|
-
onToggleSelect: s(
|
|
217
|
+
onToggleExpand: s(E),
|
|
218
|
+
onToggleSelect: s(I),
|
|
217
219
|
customSlots: e.customSlots
|
|
218
220
|
}, Y({ _: 2 }, [
|
|
219
221
|
Z(e.$slots, (t, c) => ({
|
|
220
222
|
name: c,
|
|
221
|
-
fn:
|
|
223
|
+
fn: j((n) => [
|
|
222
224
|
a(e.$slots, c, d(g(n)))
|
|
223
225
|
])
|
|
224
226
|
}))
|
|
225
227
|
]), 1032, ["items", "headers", "tbody-class", "row-class", "row-class-condition", "tr-class", "td-class", "selected-class", "striped-class", "is-selected", "is-expanded", "show-select", "show-expand", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect", "customSlots"]),
|
|
226
228
|
a(e.$slots, "body.append", d(g(h.value)))
|
|
227
229
|
], 64)),
|
|
228
|
-
e.$slots.tfoot ? (l(), r("tfoot",
|
|
230
|
+
e.$slots.tfoot ? (l(), r("tfoot", We, [
|
|
229
231
|
a(e.$slots, "tfoot", d(g(h.value)))
|
|
230
232
|
])) : u("", !0)
|
|
231
233
|
])) : u("", !0),
|
|
232
|
-
s(f).length ? u("", !0) : (l(), r("div",
|
|
233
|
-
|
|
234
|
+
s(f).length ? u("", !0) : (l(), r("div", Qe, [
|
|
235
|
+
b("div", qe, $e(e.noDataText), 1)
|
|
234
236
|
]))
|
|
235
237
|
]),
|
|
236
|
-
s(oe) ? a(e.$slots, "footer", d(O({ key: 2 }, h.value))) : (l(), r("div",
|
|
237
|
-
|
|
238
|
+
s(oe) ? a(e.$slots, "footer", d(O({ key: 2 }, h.value))) : (l(), r("div", Ge, [
|
|
239
|
+
F(Re, {
|
|
238
240
|
"items-length": s(K).length,
|
|
239
241
|
"items-per-page": s(i).itemsPerPage,
|
|
240
242
|
"current-page": s(i).page,
|
|
@@ -243,11 +245,11 @@ const Ne = ["placeholder"], Ke = { class: "flex-1 overflow-auto bg-surface" }, L
|
|
|
243
245
|
"onUpdate:page": o[3] || (o[3] = (t) => s(i).page = t)
|
|
244
246
|
}, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
|
|
245
247
|
])),
|
|
246
|
-
e.filterable && s(
|
|
248
|
+
e.filterable && s(v) ? (l(), C(xe, {
|
|
247
249
|
key: 3,
|
|
248
250
|
filters: e.filters,
|
|
249
|
-
modelValue: s(
|
|
250
|
-
"onUpdate:modelValue": o[4] || (o[4] = (t) => ke(
|
|
251
|
+
modelValue: s(v),
|
|
252
|
+
"onUpdate:modelValue": o[4] || (o[4] = (t) => ke(v) ? v.value = t : null),
|
|
251
253
|
onApplyFilters: s(ce),
|
|
252
254
|
onClearFilters: s(ue),
|
|
253
255
|
activeFilters: s(de).byColumn
|
|
@@ -256,5 +258,5 @@ const Ne = ["placeholder"], Ke = { class: "flex-1 overflow-auto bg-surface" }, L
|
|
|
256
258
|
}
|
|
257
259
|
};
|
|
258
260
|
export {
|
|
259
|
-
|
|
261
|
+
fs as default
|
|
260
262
|
};
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
function
|
|
2
|
-
var
|
|
1
|
+
function f(t, n) {
|
|
2
|
+
var o;
|
|
3
3
|
if (!t || !t.value) return;
|
|
4
4
|
if (t.columnType === "relation") {
|
|
5
|
-
const i =
|
|
5
|
+
const i = a(n, t.relationPath);
|
|
6
6
|
return u(i);
|
|
7
7
|
}
|
|
8
8
|
if (t.columnType === "function") {
|
|
9
|
-
const i = (
|
|
10
|
-
return u(i);
|
|
11
|
-
}
|
|
12
|
-
if (t.columnFormat === "function") {
|
|
13
|
-
const i = (c = t.columnFunction) == null ? void 0 : c.call(t, n, t);
|
|
9
|
+
const i = (o = t.columnFunction) == null ? void 0 : o.call(t, n, t);
|
|
14
10
|
return u(i);
|
|
15
11
|
}
|
|
16
|
-
const
|
|
17
|
-
return u(
|
|
12
|
+
const e = n == null ? void 0 : n[t.value];
|
|
13
|
+
return u(e);
|
|
18
14
|
}
|
|
19
|
-
function
|
|
20
|
-
return t.columnType === "toComplete" ? "" : n == null ? "Sin datos" : t.columnType === "dateTime" || t.columnType === "date" ? (
|
|
15
|
+
function m(t, n) {
|
|
16
|
+
return t.columnType === "toComplete" ? "" : n == null ? "Sin datos" : t.columnType === "dateTime" || t.columnType === "date" ? (r[t.columnType] || r.default)(n) : (r[t.columnFormat] || r.default)(n);
|
|
21
17
|
}
|
|
22
|
-
const
|
|
18
|
+
const r = {
|
|
23
19
|
default: (t) => t,
|
|
24
20
|
// TEXTS
|
|
25
21
|
text: (t) => String(t),
|
|
@@ -61,14 +57,14 @@ const e = {
|
|
|
61
57
|
hourCycle: "h23"
|
|
62
58
|
}).format(n);
|
|
63
59
|
},
|
|
64
|
-
secondsToTime: (t) =>
|
|
60
|
+
secondsToTime: (t) => c(t ?? 0)
|
|
65
61
|
};
|
|
66
|
-
function
|
|
67
|
-
return !t || !n ? t : n.split(".").reduce((
|
|
62
|
+
function a(t, n) {
|
|
63
|
+
return !t || !n ? t : n.split(".").reduce((e, o) => e == null ? void 0 : e[o], t);
|
|
68
64
|
}
|
|
69
|
-
function
|
|
70
|
-
const n = Math.floor(t / 3600),
|
|
71
|
-
return `${n} horas, ${
|
|
65
|
+
function c(t) {
|
|
66
|
+
const n = Math.floor(t / 3600), e = Math.floor(t % 3600 / 60), o = t % 60;
|
|
67
|
+
return `${n} horas, ${e} minutos y ${o} segundos`;
|
|
72
68
|
}
|
|
73
69
|
function u(t) {
|
|
74
70
|
if (t != null && !(t === "null" || t === "undefined"))
|
|
@@ -79,8 +75,8 @@ function s(t) {
|
|
|
79
75
|
return !isNaN(n.getTime());
|
|
80
76
|
}
|
|
81
77
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
m as formatValue,
|
|
79
|
+
r as formatters,
|
|
80
|
+
a as getNestedValue,
|
|
81
|
+
f as getValue
|
|
86
82
|
};
|