adverich-kun-ui 0.1.607 → 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,12 +1,12 @@
|
|
|
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
4
|
import Le from "../../../../icons/IconFilter.vue.js";
|
|
5
5
|
import Oe from "../../../../icons/IconSearch.vue.js";
|
|
6
6
|
import ze from "./KunTableHeaders.vue.js";
|
|
7
7
|
import De from "./KunTableFooter.vue.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import je from "./KunTableRows.vue.js";
|
|
9
|
+
import Ue from "./KunTableIterators.vue.js";
|
|
10
10
|
import xe from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
11
11
|
import Ne from "./KunTableFilter.vue.js";
|
|
12
12
|
import We from "../composables/useExpand.js";
|
|
@@ -37,8 +37,8 @@ const Ye = {
|
|
|
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
|
|
40
|
+
setup(U, { emit: de }) {
|
|
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);
|
|
@@ -64,22 +65,22 @@ const Ye = {
|
|
|
64
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
|
+
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) => {
|
|
72
73
|
var n;
|
|
73
74
|
const o = C(e, t);
|
|
74
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,31 +95,31 @@ 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", O({ class:
|
|
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
|
])) : r("", !0),
|
|
120
|
-
A.value.length && s(
|
|
121
|
-
|
|
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,
|
|
@@ -132,7 +133,7 @@ const Ye = {
|
|
|
132
133
|
}, " Anular selección ")) : r("", !0)
|
|
133
134
|
], 64)) : r("", !0)
|
|
134
135
|
])) : r("", !0),
|
|
135
|
-
|
|
136
|
+
S("div", ss, [
|
|
136
137
|
i(e.$slots, "prependSearch"),
|
|
137
138
|
e.filterable && e.filters.length ? (l(), F(xe, {
|
|
138
139
|
key: 0,
|
|
@@ -153,24 +154,24 @@ const Ye = {
|
|
|
153
154
|
})) : r("", !0),
|
|
154
155
|
s(W) ? (l(), a("div", {
|
|
155
156
|
key: 1,
|
|
156
|
-
class:
|
|
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,
|
|
162
|
-
class:
|
|
163
|
+
class: j(["w-full text-sm", s(u) ? "px-1" : "px-2 py-1"]),
|
|
163
164
|
ref_key: "searchRef",
|
|
164
165
|
ref: Z,
|
|
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
173
|
icon: Oe,
|
|
173
|
-
onClick:
|
|
174
|
+
onClick: Ie
|
|
174
175
|
}, null, 512), [
|
|
175
176
|
[ae, $.value]
|
|
176
177
|
])
|
|
@@ -178,10 +179,10 @@ const Ye = {
|
|
|
178
179
|
i(e.$slots, "appendSearch")
|
|
179
180
|
])
|
|
180
181
|
])) : r("", !0),
|
|
181
|
-
|
|
182
|
+
S("div", os, [
|
|
182
183
|
s(m).length ? (l(), a("table", {
|
|
183
184
|
key: 0,
|
|
184
|
-
class:
|
|
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)))
|
|
@@ -193,18 +194,18 @@ const Ye = {
|
|
|
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
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
|
-
s(u) ? (l(), F(
|
|
208
|
+
s(u) ? (l(), F(Ue, {
|
|
208
209
|
key: 4,
|
|
209
210
|
items: s(m),
|
|
210
211
|
headers: k.value,
|
|
@@ -230,7 +231,7 @@ const Ye = {
|
|
|
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 }, [
|
|
232
233
|
i(e.$slots, "body.prepend", d(h(f.value))),
|
|
233
|
-
T(
|
|
234
|
+
T(je, {
|
|
234
235
|
items: s(m),
|
|
235
236
|
headers: k.value,
|
|
236
237
|
"tbody-class": e.tbodyClass,
|
|
@@ -266,7 +267,7 @@ const Ye = {
|
|
|
266
267
|
])) : r("", !0)
|
|
267
268
|
])) : r("", !0),
|
|
268
269
|
s(m).length ? r("", !0) : (l(), a("div", rs, [
|
|
269
|
-
|
|
270
|
+
S("div", ns, z(e.noDataText), 1)
|
|
270
271
|
]))
|
|
271
272
|
]),
|
|
272
273
|
s(pe) ? i(e.$slots, "footer", d(O({ key: 2 }, f.value))) : (l(), a("div", is, [
|
|
@@ -283,10 +284,10 @@ 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
|
+
activeFilters: s(ke).byColumn
|
|
290
291
|
}, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : r("", !0)
|
|
291
292
|
], 16));
|
|
292
293
|
}
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import { computed as i, ref as
|
|
1
|
+
import { computed as i, ref as c } from "vue";
|
|
2
2
|
const s = typeof window < "u";
|
|
3
3
|
function f() {
|
|
4
4
|
var t, a, u, r, v;
|
|
@@ -8,7 +8,7 @@ function f() {
|
|
|
8
8
|
let o = "Unknown OS", d = "Unknown Version";
|
|
9
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,
|
|
@@ -26,7 +26,7 @@ i(() => e.value >= n.xl && e.value < n.xxl);
|
|
|
26
26
|
i(() => e.value >= n.xxl);
|
|
27
27
|
i(() => e.value >= n.xs);
|
|
28
28
|
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);
|
|
32
32
|
i(() => e.value >= n.xxl);
|
|
@@ -36,16 +36,15 @@ 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
|
|
39
|
+
function x() {
|
|
40
40
|
s && (e.value = window.innerWidth, m.value = window.innerHeight);
|
|
41
41
|
}
|
|
42
|
-
s && (window.addEventListener("resize",
|
|
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
|
-
S as mdAndUp,
|
|
49
48
|
m as screenHeight,
|
|
50
49
|
e as screenWidth
|
|
51
50
|
};
|