adverich-kun-ui 0.1.604 → 0.1.606
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,38 +1,38 @@
|
|
|
1
|
-
import { toRefs as Re, useModel as Ee, ref as w, watch as se, computed as te, onMounted as Me, openBlock as l, createElementBlock as a, mergeProps as
|
|
2
|
-
import { isMobile as u } from "../../../../utils/_platform.js";
|
|
1
|
+
import { toRefs as Re, useModel as Ee, ref as w, watch as se, computed as te, onMounted as Me, openBlock as l, createElementBlock as a, mergeProps as L, unref as s, renderSlot as i, createCommentVNode as n, createElementVNode as b, toDisplayString as O, Fragment as oe, createBlock as F, withCtx as z, createVNode as T, normalizeClass as j, withDirectives as le, vModelText as Be, vShow as ae, normalizeProps as d, guardReactiveProps as h, createSlots as ne, renderList as re, isRef as Ve, mergeModels as ie, nextTick as He } from "vue";
|
|
2
|
+
import { isMobile as u, smAndDown as Ke } from "../../../../utils/_platform.js";
|
|
3
3
|
import ce from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
4
|
-
import
|
|
4
|
+
import De from "../../../../icons/IconFilter.vue.js";
|
|
5
5
|
import Le from "../../../../icons/IconSearch.vue.js";
|
|
6
6
|
import Oe from "./KunTableHeaders.vue.js";
|
|
7
7
|
import ze from "./KunTableFooter.vue.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { resolveRowKeyValue as
|
|
17
|
-
import
|
|
18
|
-
const
|
|
8
|
+
import je from "./KunTableRows.vue.js";
|
|
9
|
+
import Ue from "./KunTableIterators.vue.js";
|
|
10
|
+
import xe from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
11
|
+
import Ne from "./KunTableFilter.vue.js";
|
|
12
|
+
import We from "../composables/useExpand.js";
|
|
13
|
+
import Qe from "../composables/useOptions.js";
|
|
14
|
+
import qe from "../composables/useSelect.js";
|
|
15
|
+
import Ge from "../composables/useFilter.js";
|
|
16
|
+
import { resolveRowKeyValue as Je } from "../composables/useRowKey.js";
|
|
17
|
+
import Xe from "../composables/KunTableProps.js";
|
|
18
|
+
const Ye = {
|
|
19
19
|
key: 0,
|
|
20
20
|
class: "p-2 bg-surface print:hidden flex w-full justify-between"
|
|
21
|
-
},
|
|
21
|
+
}, Ze = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "w-full flex items-center"
|
|
24
|
-
},
|
|
24
|
+
}, _e = {
|
|
25
25
|
key: 1,
|
|
26
26
|
class: "inline-flex items-center justify-center whitespace-nowrap"
|
|
27
|
-
},
|
|
27
|
+
}, es = { class: "pr-2" }, ss = { class: "min-w-1/3 flex h-full items-center justify-end" }, ts = ["placeholder"], os = { class: "flex-1 overflow-auto bg-surface" }, ls = { key: 0 }, as = { key: 5 }, ns = {
|
|
28
28
|
key: 1,
|
|
29
29
|
class: "h-full flex justify-center items-center"
|
|
30
|
-
}, rs = { class: "text-center text-4xl" },
|
|
30
|
+
}, rs = { class: "text-center text-4xl" }, is = {
|
|
31
31
|
key: 1,
|
|
32
32
|
class: "sticky bottom-0 z-10 print:hidden"
|
|
33
|
-
},
|
|
33
|
+
}, cs = "overflow-hidden h-full w-full flex flex-col border border-slate-200 dark:border-slate-800 rounded", ds = "table-auto w-full h-fit text-sm text-left", Is = {
|
|
34
34
|
__name: "KunTable",
|
|
35
|
-
props: /* @__PURE__ */ ie(
|
|
35
|
+
props: /* @__PURE__ */ ie(Xe(), {
|
|
36
36
|
selectedItems: { type: Array, default: () => [] },
|
|
37
37
|
selectedItemsModifiers: {}
|
|
38
38
|
}),
|
|
@@ -49,7 +49,7 @@ const Xe = {
|
|
|
49
49
|
tableClass: fe,
|
|
50
50
|
wrapperClass: he,
|
|
51
51
|
pageOptions: ge,
|
|
52
|
-
items:
|
|
52
|
+
items: us,
|
|
53
53
|
searchable: W,
|
|
54
54
|
debounceTime: ye
|
|
55
55
|
} = P, g = w(p.search);
|
|
@@ -60,18 +60,18 @@ const Xe = {
|
|
|
60
60
|
var o;
|
|
61
61
|
const t = { ...e };
|
|
62
62
|
if (e.columnType === "function" && typeof e.columnFunction == "string") {
|
|
63
|
-
const
|
|
64
|
-
typeof
|
|
63
|
+
const r = (o = p.functionMap) == null ? void 0 : o[e.columnFunction];
|
|
64
|
+
typeof r == "function" ? t.columnFunction = r : t.columnFunction = () => "";
|
|
65
65
|
}
|
|
66
66
|
return t;
|
|
67
|
-
})), { filteredItems: y, setSearch: ve, modalFilter: v, applyColumnFilters: we, clearFilters: be, appliedFilters: Se } =
|
|
67
|
+
})), { filteredItems: y, setSearch: ve, modalFilter: v, applyColumnFilters: we, clearFilters: be, appliedFilters: Se } = Ge(P, ye, k);
|
|
68
68
|
se(g, (e) => {
|
|
69
69
|
S("update:search", e), ve(e);
|
|
70
70
|
});
|
|
71
|
-
const { options: c, paginatedItems: m, updateSort: ke } =
|
|
72
|
-
var
|
|
71
|
+
const { options: c, paginatedItems: m, updateSort: ke } = Qe(P, S, y, k), C = (e, t = -1) => Je(e, ue.value, t), Q = (e, t = -1) => C(e, t) ?? `kun-table-row-${t}`, q = (e, t = -1) => {
|
|
72
|
+
var r;
|
|
73
73
|
const o = C(e, t);
|
|
74
|
-
return o === null ? !1 : ((
|
|
74
|
+
return o === null ? !1 : ((r = p.actionLoadingMap) == null ? void 0 : r[o]) || !1;
|
|
75
75
|
}, {
|
|
76
76
|
isSelected: E,
|
|
77
77
|
toggleSelect: M,
|
|
@@ -82,7 +82,7 @@ const Xe = {
|
|
|
82
82
|
moreThanPaginated: Fe,
|
|
83
83
|
clearSelection: X,
|
|
84
84
|
selectCompleteAll: Y
|
|
85
|
-
} =
|
|
85
|
+
} = qe(m, A, y, C), { isExpanded: B, toggleExpand: V } = We(), f = te(() => ({
|
|
86
86
|
items: m.value,
|
|
87
87
|
headers: x.value,
|
|
88
88
|
page: c.page,
|
|
@@ -94,7 +94,7 @@ const Xe = {
|
|
|
94
94
|
sortBy: c.sortBy,
|
|
95
95
|
hasActions: p.hasActions,
|
|
96
96
|
getRowKey: C
|
|
97
|
-
})), Te = [
|
|
97
|
+
})), Te = [cs, he.value], Pe = [ds, fe.value];
|
|
98
98
|
Me(() => _());
|
|
99
99
|
const Z = w(null), H = w(!0), $ = w(!1);
|
|
100
100
|
function Ae() {
|
|
@@ -112,29 +112,29 @@ const Xe = {
|
|
|
112
112
|
u.value && (K.value = "w-full border", $.value = !1, H.value = !0, S("focusOnSearch", !0));
|
|
113
113
|
}
|
|
114
114
|
const K = w("w-full border max-w-sm");
|
|
115
|
-
return (e, t) => (l(), a("div",
|
|
116
|
-
s(W) || e.filterable || e.$slots.prependHeader || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), a("div",
|
|
117
|
-
$.value || !s(u) ? (l(), a("div",
|
|
115
|
+
return (e, t) => (l(), a("div", L({ class: Te }, e.$attrs, { style: { "user-select": "text" } }), [
|
|
116
|
+
s(W) || e.filterable || e.$slots.prependHeader || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), a("div", Ye, [
|
|
117
|
+
$.value || !s(u) ? (l(), a("div", Ze, [
|
|
118
118
|
i(e.$slots, "prependHeader")
|
|
119
|
-
])) :
|
|
120
|
-
A.value.length ? (l(), a("div",
|
|
121
|
-
b("span",
|
|
119
|
+
])) : n("", !0),
|
|
120
|
+
A.value.length && !s(Ke) ? (l(), a("div", _e, [
|
|
121
|
+
b("span", es, "Se han seleccionado " + O(A.value.length) + " registros.", 1),
|
|
122
122
|
s(m).length !== s(y).length ? (l(), a(oe, { key: 0 }, [
|
|
123
123
|
s(G) && !s(J) ? (l(), a("span", {
|
|
124
124
|
key: 0,
|
|
125
125
|
onClick: t[0] || (t[0] = (...o) => s(Y) && s(Y)(...o)),
|
|
126
126
|
class: "bg-secondary hover:!bg-blue-500 rounded cursor-pointer px-2 ml-2"
|
|
127
|
-
}, " Seleccionar todos los " +
|
|
127
|
+
}, " Seleccionar todos los " + O(s(y).length) + " registros ", 1)) : n("", !0),
|
|
128
128
|
s(J) ? (l(), a("span", {
|
|
129
129
|
key: 1,
|
|
130
130
|
onClick: t[1] || (t[1] = (...o) => s(X) && s(X)(...o)),
|
|
131
131
|
class: "bg-secondary hover:!bg-blue-500 rounded cursor-pointer px-2 ml-2"
|
|
132
|
-
}, " Anular selección ")) :
|
|
133
|
-
], 64)) :
|
|
134
|
-
])) :
|
|
135
|
-
b("div",
|
|
132
|
+
}, " Anular selección ")) : n("", !0)
|
|
133
|
+
], 64)) : n("", !0)
|
|
134
|
+
])) : n("", !0),
|
|
135
|
+
b("div", ss, [
|
|
136
136
|
i(e.$slots, "prependSearch"),
|
|
137
|
-
e.filterable && e.filters.length ? (l(), F(
|
|
137
|
+
e.filterable && e.filters.length ? (l(), F(xe, {
|
|
138
138
|
key: 0,
|
|
139
139
|
class: "h-fit",
|
|
140
140
|
onClick: t[2] || (t[2] = (o) => v.value = !0),
|
|
@@ -142,15 +142,15 @@ const Xe = {
|
|
|
142
142
|
size: "xs",
|
|
143
143
|
bgColor: "bg-green-200 dark:bg-green-800"
|
|
144
144
|
}, {
|
|
145
|
-
default:
|
|
145
|
+
default: z(() => [
|
|
146
146
|
T(ce, {
|
|
147
147
|
class: "h-fit",
|
|
148
|
-
icon:
|
|
148
|
+
icon: De,
|
|
149
149
|
size: "text-lg"
|
|
150
150
|
})
|
|
151
151
|
]),
|
|
152
152
|
_: 1
|
|
153
|
-
})) :
|
|
153
|
+
})) : n("", !0),
|
|
154
154
|
s(W) ? (l(), a("div", {
|
|
155
155
|
key: 1,
|
|
156
156
|
class: j(["rounded flex mx-2", [K.value]])
|
|
@@ -164,7 +164,7 @@ const Xe = {
|
|
|
164
164
|
ref: Z,
|
|
165
165
|
onFocus: ee,
|
|
166
166
|
onBlur: _
|
|
167
|
-
}, null, 42,
|
|
167
|
+
}, null, 42, ts), [
|
|
168
168
|
[Be, g.value],
|
|
169
169
|
[ae, H.value]
|
|
170
170
|
]),
|
|
@@ -174,18 +174,18 @@ const Xe = {
|
|
|
174
174
|
}, null, 512), [
|
|
175
175
|
[ae, $.value]
|
|
176
176
|
])
|
|
177
|
-
], 2)) :
|
|
177
|
+
], 2)) : n("", !0),
|
|
178
178
|
i(e.$slots, "appendSearch")
|
|
179
179
|
])
|
|
180
|
-
])) :
|
|
181
|
-
b("div",
|
|
180
|
+
])) : n("", !0),
|
|
181
|
+
b("div", os, [
|
|
182
182
|
s(m).length ? (l(), a("table", {
|
|
183
183
|
key: 0,
|
|
184
184
|
class: j(Pe)
|
|
185
185
|
}, [
|
|
186
|
-
e.$slots.colgroup && !s(u) ? (l(), a("colgroup",
|
|
186
|
+
e.$slots.colgroup && !s(u) ? (l(), a("colgroup", ls, [
|
|
187
187
|
i(e.$slots, "colgroup", d(h(f.value)))
|
|
188
|
-
])) :
|
|
188
|
+
])) : n("", !0),
|
|
189
189
|
!s(me) && !s(u) ? (l(), F(Oe, {
|
|
190
190
|
key: 1,
|
|
191
191
|
headers: s(x),
|
|
@@ -203,8 +203,8 @@ const Xe = {
|
|
|
203
203
|
onSort: s(ke),
|
|
204
204
|
onToggleSelectAll: s(Ce),
|
|
205
205
|
customHeaders: e.customSlots
|
|
206
|
-
}, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "more-than-paginated", "some-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "onSort", "onToggleSelectAll", "customHeaders"])) : i(e.$slots, "thead", d(
|
|
207
|
-
s(u) ? (l(), F(
|
|
206
|
+
}, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "more-than-paginated", "some-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "onSort", "onToggleSelectAll", "customHeaders"])) : i(e.$slots, "thead", d(L({ key: 2 }, f.value))),
|
|
207
|
+
s(u) ? (l(), F(Ue, {
|
|
208
208
|
key: 4,
|
|
209
209
|
items: s(m),
|
|
210
210
|
headers: k.value,
|
|
@@ -221,16 +221,16 @@ const Xe = {
|
|
|
221
221
|
onToggleSelect: s(M),
|
|
222
222
|
customSlots: e.customSlots,
|
|
223
223
|
"get-action-loading": q
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
name:
|
|
227
|
-
fn:
|
|
228
|
-
i(e.$slots,
|
|
224
|
+
}, ne({ _: 2 }, [
|
|
225
|
+
re(e.$slots, (o, r) => ({
|
|
226
|
+
name: r,
|
|
227
|
+
fn: z((D) => [
|
|
228
|
+
i(e.$slots, r, d(h(D)))
|
|
229
229
|
])
|
|
230
230
|
}))
|
|
231
231
|
]), 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(), a(oe, { key: 3 }, [
|
|
232
232
|
i(e.$slots, "body.prepend", d(h(f.value))),
|
|
233
|
-
T(
|
|
233
|
+
T(je, {
|
|
234
234
|
items: s(m),
|
|
235
235
|
headers: k.value,
|
|
236
236
|
"tbody-class": e.tbodyClass,
|
|
@@ -251,25 +251,25 @@ const Xe = {
|
|
|
251
251
|
onToggleSelect: s(M),
|
|
252
252
|
customSlots: e.customSlots,
|
|
253
253
|
"get-action-loading": q
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
name:
|
|
257
|
-
fn:
|
|
258
|
-
i(e.$slots,
|
|
254
|
+
}, ne({ _: 2 }, [
|
|
255
|
+
re(e.$slots, (o, r) => ({
|
|
256
|
+
name: r,
|
|
257
|
+
fn: z((D) => [
|
|
258
|
+
i(e.$slots, r, d(h(D)))
|
|
259
259
|
])
|
|
260
260
|
}))
|
|
261
261
|
]), 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"]),
|
|
262
262
|
i(e.$slots, "body.append", d(h(f.value)))
|
|
263
263
|
], 64)),
|
|
264
|
-
e.$slots.tfoot ? (l(), a("tfoot",
|
|
264
|
+
e.$slots.tfoot ? (l(), a("tfoot", as, [
|
|
265
265
|
i(e.$slots, "tfoot", d(h(f.value)))
|
|
266
|
-
])) :
|
|
267
|
-
])) :
|
|
268
|
-
s(m).length ?
|
|
269
|
-
b("div", rs,
|
|
266
|
+
])) : n("", !0)
|
|
267
|
+
])) : n("", !0),
|
|
268
|
+
s(m).length ? n("", !0) : (l(), a("div", ns, [
|
|
269
|
+
b("div", rs, O(e.noDataText), 1)
|
|
270
270
|
]))
|
|
271
271
|
]),
|
|
272
|
-
s(pe) ? i(e.$slots, "footer", d(
|
|
272
|
+
s(pe) ? i(e.$slots, "footer", d(L({ key: 2 }, f.value))) : (l(), a("div", is, [
|
|
273
273
|
T(ze, {
|
|
274
274
|
"items-length": s(y).length,
|
|
275
275
|
"items-per-page": s(c).itemsPerPage,
|
|
@@ -279,7 +279,7 @@ const Xe = {
|
|
|
279
279
|
"onUpdate:page": t[5] || (t[5] = (o) => s(c).page = o)
|
|
280
280
|
}, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
|
|
281
281
|
])),
|
|
282
|
-
e.filterable && s(v) ? (l(), F(
|
|
282
|
+
e.filterable && s(v) ? (l(), F(Ne, {
|
|
283
283
|
key: 3,
|
|
284
284
|
filters: e.filters,
|
|
285
285
|
modelValue: s(v),
|
|
@@ -287,10 +287,10 @@ const Xe = {
|
|
|
287
287
|
onApplyFilters: s(we),
|
|
288
288
|
onClearFilters: s(be),
|
|
289
289
|
activeFilters: s(Se).byColumn
|
|
290
|
-
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) :
|
|
290
|
+
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : n("", !0)
|
|
291
291
|
], 16));
|
|
292
292
|
}
|
|
293
293
|
};
|
|
294
294
|
export {
|
|
295
|
-
|
|
295
|
+
Is as default
|
|
296
296
|
};
|
package/dist/utils/_platform.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { computed as i, ref as
|
|
2
|
-
const
|
|
1
|
+
import { computed as i, ref as x } from "vue";
|
|
2
|
+
const d = typeof window < "u";
|
|
3
3
|
function f() {
|
|
4
4
|
var t, a, u, r, v;
|
|
5
|
-
if (!
|
|
5
|
+
if (!d)
|
|
6
6
|
return { os: "Server", osVersion: "Unknown" };
|
|
7
|
-
const
|
|
8
|
-
let
|
|
9
|
-
return /Mac/.test(
|
|
7
|
+
const o = window.navigator.userAgent;
|
|
8
|
+
let l = "Unknown OS", s = "Unknown Version";
|
|
9
|
+
return /Mac/.test(o) ? (l = "Mac OS", s = (a = (t = o.match(/Mac OS X (\d+[\._]\d+[\._]\d+)/)) == null ? void 0 : t[1]) == null ? void 0 : a.replace(/_/g, ".")) : /iPhone|iPad|iPod/.test(o) ? (l = "iOS", s = ((u = o.match(/OS (\d+)[._](\d+)[._]?(\d+)?/)) == null ? void 0 : u.slice(1, 4).join(".")) || "Unknown") : /Windows/.test(o) ? (l = "Windows", s = (r = o.match(/Windows NT (\d+\.\d+)/)) == null ? void 0 : r[1]) : /Android/.test(o) ? (l = "Android", s = (v = o.match(/Android (\d+\.\d+)/)) == null ? void 0 : v[1]) : /Linux/.test(o) && (l = "Linux"), { os: l, osVersion: s };
|
|
10
10
|
}
|
|
11
|
-
const e =
|
|
11
|
+
const e = x(d ? window.innerWidth : 1024), m = x(d ? window.innerHeight : 768), w = f(), h = i(
|
|
12
12
|
() => w.os === "iOS" || w.os === "Android" || m.value > e.value
|
|
13
13
|
), n = {
|
|
14
14
|
xs: 475,
|
|
@@ -31,20 +31,21 @@ i(() => e.value >= n.lg);
|
|
|
31
31
|
i(() => e.value >= n.xl);
|
|
32
32
|
i(() => e.value >= n.xxl);
|
|
33
33
|
i(() => e.value < n.sm);
|
|
34
|
-
i(() => e.value < n.md);
|
|
34
|
+
const S = i(() => e.value < n.md);
|
|
35
35
|
i(() => e.value < n.lg);
|
|
36
36
|
i(() => e.value < n.xl);
|
|
37
37
|
i(() => e.value < n.xxl);
|
|
38
38
|
i(() => e.value < n.xxl);
|
|
39
|
-
function
|
|
40
|
-
|
|
39
|
+
function c() {
|
|
40
|
+
d && (e.value = window.innerWidth, m.value = window.innerHeight);
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
window.removeEventListener("resize",
|
|
42
|
+
d && (window.addEventListener("resize", c), window.addEventListener("beforeunload", () => {
|
|
43
|
+
window.removeEventListener("resize", c);
|
|
44
44
|
}));
|
|
45
45
|
export {
|
|
46
46
|
h as isMobile,
|
|
47
47
|
w as kunOS,
|
|
48
48
|
m as screenHeight,
|
|
49
|
-
e as screenWidth
|
|
49
|
+
e as screenWidth,
|
|
50
|
+
S as smAndDown
|
|
50
51
|
};
|