adverich-kun-ui 0.1.606 → 0.1.608
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 { toRefs as
|
|
2
|
-
import { isMobile as u
|
|
1
|
+
import { toRefs as Ee, useModel as Me, ref as w, watch as se, computed as te, onMounted as Be, openBlock as l, createElementBlock as a, mergeProps as O, unref as s, renderSlot as i, createCommentVNode as r, createElementVNode as S, toDisplayString as z, Fragment as oe, createBlock as F, withCtx as D, createVNode as T, normalizeClass as j, withDirectives as le, vModelText as Ve, vShow as ae, normalizeProps as d, guardReactiveProps as h, createSlots as re, renderList as ne, isRef as He, mergeModels as ie, nextTick as Ke } from "vue";
|
|
2
|
+
import { isMobile as u } from "../../../../utils/_platform.js";
|
|
3
3
|
import ce from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
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
8
|
import je from "./KunTableRows.vue.js";
|
|
9
9
|
import Ue from "./KunTableIterators.vue.js";
|
|
10
10
|
import xe from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
@@ -24,10 +24,10 @@ const Ye = {
|
|
|
24
24
|
}, _e = {
|
|
25
25
|
key: 1,
|
|
26
26
|
class: "inline-flex items-center justify-center whitespace-nowrap"
|
|
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 },
|
|
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 = {
|
|
@@ -38,7 +38,7 @@ const Ye = {
|
|
|
38
38
|
}),
|
|
39
39
|
emits: /* @__PURE__ */ ie(["update:page", "update:itemsPerPage", "update:sortBy", "update:search", "focusOnSearch"], ["update:selectedItems"]),
|
|
40
40
|
setup(U, { emit: de }) {
|
|
41
|
-
const
|
|
41
|
+
const b = de, p = U, P = Ee(p), A = Me(U, "selectedItems"), {
|
|
42
42
|
headers: x,
|
|
43
43
|
showExpand: I,
|
|
44
44
|
showSelect: R,
|
|
@@ -51,7 +51,8 @@ const Ye = {
|
|
|
51
51
|
pageOptions: ge,
|
|
52
52
|
items: us,
|
|
53
53
|
searchable: W,
|
|
54
|
-
debounceTime: ye
|
|
54
|
+
debounceTime: ye,
|
|
55
|
+
hideSelected: ve
|
|
55
56
|
} = P, g = w(p.search);
|
|
56
57
|
se(() => p.search, (e) => {
|
|
57
58
|
e !== g.value && (g.value = e);
|
|
@@ -60,26 +61,26 @@ const Ye = {
|
|
|
60
61
|
var o;
|
|
61
62
|
const t = { ...e };
|
|
62
63
|
if (e.columnType === "function" && typeof e.columnFunction == "string") {
|
|
63
|
-
const
|
|
64
|
-
typeof
|
|
64
|
+
const n = (o = p.functionMap) == null ? void 0 : o[e.columnFunction];
|
|
65
|
+
typeof n == "function" ? t.columnFunction = n : t.columnFunction = () => "";
|
|
65
66
|
}
|
|
66
67
|
return t;
|
|
67
|
-
})), { filteredItems: y, setSearch:
|
|
68
|
+
})), { filteredItems: y, setSearch: we, modalFilter: v, applyColumnFilters: Se, clearFilters: be, appliedFilters: ke } = Ge(P, ye, k);
|
|
68
69
|
se(g, (e) => {
|
|
69
|
-
|
|
70
|
+
b("update:search", e), we(e);
|
|
70
71
|
});
|
|
71
|
-
const { options: c, paginatedItems: m, updateSort:
|
|
72
|
-
var
|
|
72
|
+
const { options: c, paginatedItems: m, updateSort: Ce } = Qe(P, b, 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) => {
|
|
73
|
+
var n;
|
|
73
74
|
const o = C(e, t);
|
|
74
|
-
return o === null ? !1 : ((
|
|
75
|
+
return o === null ? !1 : ((n = p.actionLoadingMap) == null ? void 0 : n[o]) || !1;
|
|
75
76
|
}, {
|
|
76
77
|
isSelected: E,
|
|
77
78
|
toggleSelect: M,
|
|
78
|
-
toggleSelectAll:
|
|
79
|
+
toggleSelectAll: $e,
|
|
79
80
|
allSelected: G,
|
|
80
81
|
allFilteredSelected: J,
|
|
81
|
-
someSelected:
|
|
82
|
-
moreThanPaginated:
|
|
82
|
+
someSelected: Fe,
|
|
83
|
+
moreThanPaginated: Te,
|
|
83
84
|
clearSelection: X,
|
|
84
85
|
selectCompleteAll: Y
|
|
85
86
|
} = qe(m, A, y, C), { isExpanded: B, toggleExpand: V } = We(), f = te(() => ({
|
|
@@ -94,45 +95,45 @@ const Ye = {
|
|
|
94
95
|
sortBy: c.sortBy,
|
|
95
96
|
hasActions: p.hasActions,
|
|
96
97
|
getRowKey: C
|
|
97
|
-
})),
|
|
98
|
-
|
|
98
|
+
})), Pe = [cs, he.value], Ae = [ds, fe.value];
|
|
99
|
+
Be(() => _());
|
|
99
100
|
const Z = w(null), H = w(!0), $ = w(!1);
|
|
100
|
-
function Ae() {
|
|
101
|
-
Ie();
|
|
102
|
-
}
|
|
103
101
|
function Ie() {
|
|
104
|
-
|
|
102
|
+
Re();
|
|
103
|
+
}
|
|
104
|
+
function Re() {
|
|
105
|
+
u.value && (ee(), Ke(() => {
|
|
105
106
|
Z.value.focus();
|
|
106
107
|
}));
|
|
107
108
|
}
|
|
108
109
|
function _() {
|
|
109
|
-
u.value && (K.value = "w-fit", H.value = !1, $.value = !0,
|
|
110
|
+
u.value && (K.value = "w-fit", H.value = !1, $.value = !0, b("focusOnSearch", !1));
|
|
110
111
|
}
|
|
111
112
|
function ee() {
|
|
112
|
-
u.value && (K.value = "w-full border", $.value = !1, H.value = !0,
|
|
113
|
+
u.value && (K.value = "w-full border", $.value = !1, H.value = !0, b("focusOnSearch", !0));
|
|
113
114
|
}
|
|
114
115
|
const K = w("w-full border max-w-sm");
|
|
115
|
-
return (e, t) => (l(), a("div",
|
|
116
|
+
return (e, t) => (l(), a("div", O({ class: Pe }, e.$attrs, { style: { "user-select": "text" } }), [
|
|
116
117
|
s(W) || e.filterable || e.$slots.prependHeader || e.$slots.prependSearch || e.$slots.appendSearch ? (l(), a("div", Ye, [
|
|
117
118
|
$.value || !s(u) ? (l(), a("div", Ze, [
|
|
118
119
|
i(e.$slots, "prependHeader")
|
|
119
|
-
])) :
|
|
120
|
-
A.value.length && !s(
|
|
121
|
-
|
|
120
|
+
])) : r("", !0),
|
|
121
|
+
A.value.length && !s(ve) ? (l(), a("div", _e, [
|
|
122
|
+
S("span", es, "Se han seleccionado " + z(A.value.length) + " registros.", 1),
|
|
122
123
|
s(m).length !== s(y).length ? (l(), a(oe, { key: 0 }, [
|
|
123
124
|
s(G) && !s(J) ? (l(), a("span", {
|
|
124
125
|
key: 0,
|
|
125
126
|
onClick: t[0] || (t[0] = (...o) => s(Y) && s(Y)(...o)),
|
|
126
127
|
class: "bg-secondary hover:!bg-blue-500 rounded cursor-pointer px-2 ml-2"
|
|
127
|
-
}, " Seleccionar todos los " +
|
|
128
|
+
}, " Seleccionar todos los " + z(s(y).length) + " registros ", 1)) : r("", !0),
|
|
128
129
|
s(J) ? (l(), a("span", {
|
|
129
130
|
key: 1,
|
|
130
131
|
onClick: t[1] || (t[1] = (...o) => s(X) && s(X)(...o)),
|
|
131
132
|
class: "bg-secondary hover:!bg-blue-500 rounded cursor-pointer px-2 ml-2"
|
|
132
|
-
}, " Anular selección ")) :
|
|
133
|
-
], 64)) :
|
|
134
|
-
])) :
|
|
135
|
-
|
|
133
|
+
}, " Anular selección ")) : r("", !0)
|
|
134
|
+
], 64)) : r("", !0)
|
|
135
|
+
])) : r("", !0),
|
|
136
|
+
S("div", ss, [
|
|
136
137
|
i(e.$slots, "prependSearch"),
|
|
137
138
|
e.filterable && e.filters.length ? (l(), F(xe, {
|
|
138
139
|
key: 0,
|
|
@@ -142,20 +143,20 @@ const Ye = {
|
|
|
142
143
|
size: "xs",
|
|
143
144
|
bgColor: "bg-green-200 dark:bg-green-800"
|
|
144
145
|
}, {
|
|
145
|
-
default:
|
|
146
|
+
default: D(() => [
|
|
146
147
|
T(ce, {
|
|
147
148
|
class: "h-fit",
|
|
148
|
-
icon:
|
|
149
|
+
icon: Le,
|
|
149
150
|
size: "text-lg"
|
|
150
151
|
})
|
|
151
152
|
]),
|
|
152
153
|
_: 1
|
|
153
|
-
})) :
|
|
154
|
+
})) : r("", !0),
|
|
154
155
|
s(W) ? (l(), a("div", {
|
|
155
156
|
key: 1,
|
|
156
157
|
class: j(["rounded flex mx-2", [K.value]])
|
|
157
158
|
}, [
|
|
158
|
-
le(
|
|
159
|
+
le(S("input", {
|
|
159
160
|
"onUpdate:modelValue": t[3] || (t[3] = (o) => g.value = o),
|
|
160
161
|
type: "text",
|
|
161
162
|
placeholder: e.searchPlaceholder,
|
|
@@ -165,45 +166,45 @@ const Ye = {
|
|
|
165
166
|
onFocus: ee,
|
|
166
167
|
onBlur: _
|
|
167
168
|
}, null, 42, ts), [
|
|
168
|
-
[
|
|
169
|
+
[Ve, g.value],
|
|
169
170
|
[ae, H.value]
|
|
170
171
|
]),
|
|
171
172
|
le(T(ce, {
|
|
172
|
-
icon:
|
|
173
|
-
onClick:
|
|
173
|
+
icon: Oe,
|
|
174
|
+
onClick: Ie
|
|
174
175
|
}, null, 512), [
|
|
175
176
|
[ae, $.value]
|
|
176
177
|
])
|
|
177
|
-
], 2)) :
|
|
178
|
+
], 2)) : r("", !0),
|
|
178
179
|
i(e.$slots, "appendSearch")
|
|
179
180
|
])
|
|
180
|
-
])) :
|
|
181
|
-
|
|
181
|
+
])) : r("", !0),
|
|
182
|
+
S("div", os, [
|
|
182
183
|
s(m).length ? (l(), a("table", {
|
|
183
184
|
key: 0,
|
|
184
|
-
class: j(
|
|
185
|
+
class: j(Ae)
|
|
185
186
|
}, [
|
|
186
187
|
e.$slots.colgroup && !s(u) ? (l(), a("colgroup", ls, [
|
|
187
188
|
i(e.$slots, "colgroup", d(h(f.value)))
|
|
188
|
-
])) :
|
|
189
|
-
!s(me) && !s(u) ? (l(), F(
|
|
189
|
+
])) : r("", !0),
|
|
190
|
+
!s(me) && !s(u) ? (l(), F(ze, {
|
|
190
191
|
key: 1,
|
|
191
192
|
headers: s(x),
|
|
192
193
|
"sort-by": s(c).sortBy,
|
|
193
194
|
"show-select": s(R),
|
|
194
195
|
"show-expand": s(I),
|
|
195
196
|
"all-selected": s(G),
|
|
196
|
-
"more-than-paginated": s(
|
|
197
|
-
"some-selected": s(
|
|
197
|
+
"more-than-paginated": s(Te),
|
|
198
|
+
"some-selected": s(Fe),
|
|
198
199
|
"thead-class": e.theadClass,
|
|
199
200
|
"tr-class": e.trClass,
|
|
200
201
|
"th-class": e.thClass,
|
|
201
202
|
"has-actions": e.hasActions,
|
|
202
203
|
"action-label": e.actionLabel,
|
|
203
|
-
onSort: s(
|
|
204
|
-
onToggleSelectAll: s(
|
|
204
|
+
onSort: s(Ce),
|
|
205
|
+
onToggleSelectAll: s($e),
|
|
205
206
|
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
|
+
}, 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(O({ key: 2 }, f.value))),
|
|
207
208
|
s(u) ? (l(), F(Ue, {
|
|
208
209
|
key: 4,
|
|
209
210
|
items: s(m),
|
|
@@ -221,11 +222,11 @@ const Ye = {
|
|
|
221
222
|
onToggleSelect: s(M),
|
|
222
223
|
customSlots: e.customSlots,
|
|
223
224
|
"get-action-loading": q
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
name:
|
|
227
|
-
fn:
|
|
228
|
-
i(e.$slots,
|
|
225
|
+
}, re({ _: 2 }, [
|
|
226
|
+
ne(e.$slots, (o, n) => ({
|
|
227
|
+
name: n,
|
|
228
|
+
fn: D((L) => [
|
|
229
|
+
i(e.$slots, n, d(h(L)))
|
|
229
230
|
])
|
|
230
231
|
}))
|
|
231
232
|
]), 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 }, [
|
|
@@ -251,11 +252,11 @@ const Ye = {
|
|
|
251
252
|
onToggleSelect: s(M),
|
|
252
253
|
customSlots: e.customSlots,
|
|
253
254
|
"get-action-loading": q
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
name:
|
|
257
|
-
fn:
|
|
258
|
-
i(e.$slots,
|
|
255
|
+
}, re({ _: 2 }, [
|
|
256
|
+
ne(e.$slots, (o, n) => ({
|
|
257
|
+
name: n,
|
|
258
|
+
fn: D((L) => [
|
|
259
|
+
i(e.$slots, n, d(h(L)))
|
|
259
260
|
])
|
|
260
261
|
}))
|
|
261
262
|
]), 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"]),
|
|
@@ -263,14 +264,14 @@ const Ye = {
|
|
|
263
264
|
], 64)),
|
|
264
265
|
e.$slots.tfoot ? (l(), a("tfoot", as, [
|
|
265
266
|
i(e.$slots, "tfoot", d(h(f.value)))
|
|
266
|
-
])) :
|
|
267
|
-
])) :
|
|
268
|
-
s(m).length ?
|
|
269
|
-
|
|
267
|
+
])) : r("", !0)
|
|
268
|
+
])) : r("", !0),
|
|
269
|
+
s(m).length ? r("", !0) : (l(), a("div", rs, [
|
|
270
|
+
S("div", ns, z(e.noDataText), 1)
|
|
270
271
|
]))
|
|
271
272
|
]),
|
|
272
|
-
s(pe) ? i(e.$slots, "footer", d(
|
|
273
|
-
T(
|
|
273
|
+
s(pe) ? i(e.$slots, "footer", d(O({ key: 2 }, f.value))) : (l(), a("div", is, [
|
|
274
|
+
T(De, {
|
|
274
275
|
"items-length": s(y).length,
|
|
275
276
|
"items-per-page": s(c).itemsPerPage,
|
|
276
277
|
"current-page": s(c).page,
|
|
@@ -283,11 +284,11 @@ const Ye = {
|
|
|
283
284
|
key: 3,
|
|
284
285
|
filters: e.filters,
|
|
285
286
|
modelValue: s(v),
|
|
286
|
-
"onUpdate:modelValue": t[6] || (t[6] = (o) =>
|
|
287
|
-
onApplyFilters: s(
|
|
287
|
+
"onUpdate:modelValue": t[6] || (t[6] = (o) => He(v) ? v.value = o : null),
|
|
288
|
+
onApplyFilters: s(Se),
|
|
288
289
|
onClearFilters: s(be),
|
|
289
|
-
activeFilters: s(
|
|
290
|
-
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) :
|
|
290
|
+
activeFilters: s(ke).byColumn
|
|
291
|
+
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : r("", !0)
|
|
291
292
|
], 16));
|
|
292
293
|
}
|
|
293
294
|
};
|
|
@@ -63,6 +63,7 @@ const t = () => ({
|
|
|
63
63
|
// --- Visualización y Estilos ---
|
|
64
64
|
hideDefaultHeader: { type: Boolean, default: !1 },
|
|
65
65
|
hideDefaultFooter: { type: Boolean, default: !1 },
|
|
66
|
+
hideSelected: { type: Boolean, default: !1 },
|
|
66
67
|
// Clases personalizadas
|
|
67
68
|
wrapperClass: { type: String, default: "" },
|
|
68
69
|
tableClass: { type: String, default: "" },
|
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 c } from "vue";
|
|
2
|
+
const s = typeof window < "u";
|
|
3
3
|
function f() {
|
|
4
4
|
var t, a, u, r, v;
|
|
5
|
-
if (!
|
|
5
|
+
if (!s)
|
|
6
6
|
return { os: "Server", osVersion: "Unknown" };
|
|
7
|
-
const
|
|
8
|
-
let
|
|
9
|
-
return /Mac/.test(
|
|
7
|
+
const l = window.navigator.userAgent;
|
|
8
|
+
let o = "Unknown OS", d = "Unknown Version";
|
|
9
|
+
return /Mac/.test(l) ? (o = "Mac OS", d = (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", d = ((u = l.match(/OS (\d+)[._](\d+)[._]?(\d+)?/)) == null ? void 0 : u.slice(1, 4).join(".")) || "Unknown") : /Windows/.test(l) ? (o = "Windows", d = (r = l.match(/Windows NT (\d+\.\d+)/)) == null ? void 0 : r[1]) : /Android/.test(l) ? (o = "Android", d = (v = l.match(/Android (\d+\.\d+)/)) == null ? void 0 : v[1]) : /Linux/.test(l) && (o = "Linux"), { os: o, osVersion: d };
|
|
10
10
|
}
|
|
11
|
-
const e =
|
|
11
|
+
const e = c(s ? window.innerWidth : 1024), m = c(s ? 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,21 +31,20 @@ 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
|
-
|
|
34
|
+
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 x() {
|
|
40
|
+
s && (e.value = window.innerWidth, m.value = window.innerHeight);
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
window.removeEventListener("resize",
|
|
42
|
+
s && (window.addEventListener("resize", x), window.addEventListener("beforeunload", () => {
|
|
43
|
+
window.removeEventListener("resize", x);
|
|
44
44
|
}));
|
|
45
45
|
export {
|
|
46
46
|
h as isMobile,
|
|
47
47
|
w as kunOS,
|
|
48
48
|
m as screenHeight,
|
|
49
|
-
e as screenWidth
|
|
50
|
-
S as smAndDown
|
|
49
|
+
e as screenWidth
|
|
51
50
|
};
|