adverich-kun-ui 0.1.604 → 0.1.605
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,44 +1,44 @@
|
|
|
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 O, unref as s, renderSlot as i, createCommentVNode as r, createElementVNode as b, toDisplayString as z, Fragment as oe, createBlock as F, withCtx as D, createVNode as T, normalizeClass 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 O, unref as s, renderSlot as i, createCommentVNode as r, createElementVNode as b, toDisplayString as z, Fragment as oe, createBlock as F, withCtx as D, createVNode as T, normalizeClass as U, withDirectives as le, vModelText as Be, vShow as ae, normalizeProps as d, guardReactiveProps as h, createSlots as re, renderList as ne, isRef as Ve, mergeModels as ie, nextTick as He } from "vue";
|
|
2
|
+
import { isMobile as u, smAndUp as Ke } from "../../../../utils/_platform.js";
|
|
3
3
|
import ce from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
4
|
+
import Le from "../../../../icons/IconFilter.vue.js";
|
|
5
|
+
import Oe from "../../../../icons/IconSearch.vue.js";
|
|
6
|
+
import ze from "./KunTableHeaders.vue.js";
|
|
7
|
+
import De from "./KunTableFooter.vue.js";
|
|
8
|
+
import Ue from "./KunTableRows.vue.js";
|
|
9
9
|
import je from "./KunTableIterators.vue.js";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { resolveRowKeyValue as
|
|
17
|
-
import
|
|
18
|
-
const
|
|
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 }, rs = {
|
|
28
28
|
key: 1,
|
|
29
29
|
class: "h-full flex justify-center items-center"
|
|
30
|
-
},
|
|
30
|
+
}, ns = { 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
|
}),
|
|
39
39
|
emits: /* @__PURE__ */ ie(["update:page", "update:itemsPerPage", "update:sortBy", "update:search", "focusOnSearch"], ["update:selectedItems"]),
|
|
40
|
-
setup(
|
|
41
|
-
const S = de, p =
|
|
40
|
+
setup(j, { emit: de }) {
|
|
41
|
+
const S = de, p = j, P = Re(p), A = Ee(j, "selectedItems"), {
|
|
42
42
|
headers: x,
|
|
43
43
|
showExpand: I,
|
|
44
44
|
showSelect: R,
|
|
@@ -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);
|
|
@@ -64,11 +64,11 @@ const Xe = {
|
|
|
64
64
|
typeof n == "function" ? t.columnFunction = n : 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 } =
|
|
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
72
|
var n;
|
|
73
73
|
const o = C(e, t);
|
|
74
74
|
return o === null ? !1 : ((n = p.actionLoadingMap) == null ? void 0 : n[o]) || !1;
|
|
@@ -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() {
|
|
@@ -113,12 +113,12 @@ const Xe = {
|
|
|
113
113
|
}
|
|
114
114
|
const K = w("w-full border max-w-sm");
|
|
115
115
|
return (e, t) => (l(), a("div", O({ 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",
|
|
117
|
-
$.value || !s(u) ? (l(), a("div",
|
|
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
119
|
])) : r("", !0),
|
|
120
|
-
A.value.length ? (l(), a("div",
|
|
121
|
-
b("span",
|
|
120
|
+
A.value.length && s(Ke) ? (l(), a("div", _e, [
|
|
121
|
+
b("span", es, "Se han seleccionado " + z(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,
|
|
@@ -132,9 +132,9 @@ const Xe = {
|
|
|
132
132
|
}, " Anular selección ")) : r("", !0)
|
|
133
133
|
], 64)) : r("", !0)
|
|
134
134
|
])) : r("", !0),
|
|
135
|
-
b("div",
|
|
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),
|
|
@@ -145,7 +145,7 @@ const Xe = {
|
|
|
145
145
|
default: D(() => [
|
|
146
146
|
T(ce, {
|
|
147
147
|
class: "h-fit",
|
|
148
|
-
icon:
|
|
148
|
+
icon: Le,
|
|
149
149
|
size: "text-lg"
|
|
150
150
|
})
|
|
151
151
|
]),
|
|
@@ -153,23 +153,23 @@ const Xe = {
|
|
|
153
153
|
})) : r("", !0),
|
|
154
154
|
s(W) ? (l(), a("div", {
|
|
155
155
|
key: 1,
|
|
156
|
-
class:
|
|
156
|
+
class: U(["rounded flex mx-2", [K.value]])
|
|
157
157
|
}, [
|
|
158
158
|
le(b("input", {
|
|
159
159
|
"onUpdate:modelValue": t[3] || (t[3] = (o) => g.value = o),
|
|
160
160
|
type: "text",
|
|
161
161
|
placeholder: e.searchPlaceholder,
|
|
162
|
-
class:
|
|
162
|
+
class: U(["w-full text-sm", s(u) ? "px-1" : "px-2 py-1"]),
|
|
163
163
|
ref_key: "searchRef",
|
|
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
|
]),
|
|
171
171
|
le(T(ce, {
|
|
172
|
-
icon:
|
|
172
|
+
icon: Oe,
|
|
173
173
|
onClick: Ae
|
|
174
174
|
}, null, 512), [
|
|
175
175
|
[ae, $.value]
|
|
@@ -178,15 +178,15 @@ const Xe = {
|
|
|
178
178
|
i(e.$slots, "appendSearch")
|
|
179
179
|
])
|
|
180
180
|
])) : r("", !0),
|
|
181
|
-
b("div",
|
|
181
|
+
b("div", os, [
|
|
182
182
|
s(m).length ? (l(), a("table", {
|
|
183
183
|
key: 0,
|
|
184
|
-
class:
|
|
184
|
+
class: U(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
|
])) : r("", !0),
|
|
189
|
-
!s(me) && !s(u) ? (l(), F(
|
|
189
|
+
!s(me) && !s(u) ? (l(), F(ze, {
|
|
190
190
|
key: 1,
|
|
191
191
|
headers: s(x),
|
|
192
192
|
"sort-by": s(c).sortBy,
|
|
@@ -230,7 +230,7 @@ const Xe = {
|
|
|
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(Ue, {
|
|
234
234
|
items: s(m),
|
|
235
235
|
headers: k.value,
|
|
236
236
|
"tbody-class": e.tbodyClass,
|
|
@@ -261,16 +261,16 @@ const Xe = {
|
|
|
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
266
|
])) : r("", !0)
|
|
267
267
|
])) : r("", !0),
|
|
268
|
-
s(m).length ? r("", !0) : (l(), a("div",
|
|
269
|
-
b("div",
|
|
268
|
+
s(m).length ? r("", !0) : (l(), a("div", rs, [
|
|
269
|
+
b("div", ns, z(e.noDataText), 1)
|
|
270
270
|
]))
|
|
271
271
|
]),
|
|
272
|
-
s(pe) ? i(e.$slots, "footer", d(O({ key: 2 }, f.value))) : (l(), a("div",
|
|
273
|
-
T(
|
|
272
|
+
s(pe) ? i(e.$slots, "footer", d(O({ key: 2 }, f.value))) : (l(), a("div", is, [
|
|
273
|
+
T(De, {
|
|
274
274
|
"items-length": s(y).length,
|
|
275
275
|
"items-per-page": s(c).itemsPerPage,
|
|
276
276
|
"current-page": s(c).page,
|
|
@@ -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),
|
|
@@ -292,5 +292,5 @@ const Xe = {
|
|
|
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
7
|
const l = window.navigator.userAgent;
|
|
8
|
-
let o = "Unknown OS",
|
|
9
|
-
return /Mac/.test(l) ? (o = "Mac OS",
|
|
8
|
+
let o = "Unknown OS", s = "Unknown Version";
|
|
9
|
+
return /Mac/.test(l) ? (o = "Mac OS", s = (a = (t = l.match(/Mac OS X (\d+[\._]\d+[\._]\d+)/)) == null ? void 0 : t[1]) == null ? void 0 : a.replace(/_/g, ".")) : /iPhone|iPad|iPod/.test(l) ? (o = "iOS", s = ((u = l.match(/OS (\d+)[._](\d+)[._]?(\d+)?/)) == null ? void 0 : u.slice(1, 4).join(".")) || "Unknown") : /Windows/.test(l) ? (o = "Windows", s = (r = l.match(/Windows NT (\d+\.\d+)/)) == null ? void 0 : r[1]) : /Android/.test(l) ? (o = "Android", s = (v = l.match(/Android (\d+\.\d+)/)) == null ? void 0 : v[1]) : /Linux/.test(l) && (o = "Linux"), { os: o, 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,
|
|
@@ -25,7 +25,7 @@ i(() => e.value >= n.lg && e.value < n.xl);
|
|
|
25
25
|
i(() => e.value >= n.xl && e.value < n.xxl);
|
|
26
26
|
i(() => e.value >= n.xxl);
|
|
27
27
|
i(() => e.value >= n.xs);
|
|
28
|
-
i(() => e.value >= n.sm);
|
|
28
|
+
const S = i(() => e.value >= n.sm);
|
|
29
29
|
i(() => e.value >= n.md);
|
|
30
30
|
i(() => e.value >= n.lg);
|
|
31
31
|
i(() => e.value >= n.xl);
|
|
@@ -36,15 +36,16 @@ 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 smAndUp
|
|
50
51
|
};
|