adverich-kun-ui 0.1.585 → 0.1.586
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,39 +1,42 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
function
|
|
3
|
-
const
|
|
1
|
+
import { ref as u, computed as R } from "vue";
|
|
2
|
+
function K(e, $, d, y) {
|
|
3
|
+
const v = u({}), f = u(null), x = u(null), c = u(null), w = u("bottom"), B = {
|
|
4
4
|
top: { class: "origin-bottom" },
|
|
5
5
|
bottom: { class: "origin-top" },
|
|
6
6
|
left: { class: "origin-right" },
|
|
7
7
|
right: { class: "origin-left" }
|
|
8
|
-
},
|
|
8
|
+
}, F = R(() => {
|
|
9
9
|
var t;
|
|
10
|
-
return ((t =
|
|
10
|
+
return w.value === "top" ? "origin-bottom" : ((t = B[e.location]) == null ? void 0 : t.class) || "origin-top";
|
|
11
11
|
});
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
if (!(
|
|
15
|
-
const
|
|
16
|
-
if ((
|
|
17
|
-
requestAnimationFrame(() =>
|
|
12
|
+
function m(t = 0) {
|
|
13
|
+
const l = e.parentRef || x.value, o = f.value;
|
|
14
|
+
if (!(l instanceof HTMLElement) || !(o instanceof HTMLElement)) return;
|
|
15
|
+
const n = l.getBoundingClientRect();
|
|
16
|
+
if ((n.width < 1 || n.height < 1) && t < 10) {
|
|
17
|
+
requestAnimationFrame(() => m(t + 1));
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
requestAnimationFrame(() => {
|
|
21
|
-
const
|
|
22
|
-
if ((
|
|
23
|
-
requestAnimationFrame(() =>
|
|
21
|
+
const b = o.getBoundingClientRect();
|
|
22
|
+
if ((b.width < 1 || b.height < 1) && t < 10) {
|
|
23
|
+
requestAnimationFrame(() => m(t + 1));
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const H = window.innerHeight, M = window.innerWidth, a = 8, E = e.hideDetails ? 0 : 19, s = o.offsetWidth, p = o.offsetHeight, g = H - n.bottom + E - a, h = n.top - a, S = g >= p, T = h >= p, L = !S && (T || h > g);
|
|
27
|
+
w.value = L ? "top" : "bottom";
|
|
28
|
+
const z = e.origin && e.origin !== "auto" ? e.origin : W(e.location), [, A] = z.split(" ");
|
|
29
|
+
let i = 0;
|
|
30
|
+
A === "right" ? i = n.right - s : A === "center" ? i = n.left + n.width / 2 - s / 2 : i = n.left, i + s > M - a && (i = M - s - a), i < a && (i = a);
|
|
31
|
+
const r = {
|
|
29
32
|
position: "fixed",
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
width: n.width === "w-full" ? `${e.width}px` : void 0
|
|
33
|
+
left: `${i}px`,
|
|
34
|
+
width: e.width === "w-full" ? `${n.width}px` : void 0
|
|
33
35
|
};
|
|
36
|
+
L ? (r.top = "auto", r.bottom = `${H - n.top}px`, c.value = h) : (r.top = `${n.bottom - E}px`, r.bottom = "auto", c.value = g), v.value = r;
|
|
34
37
|
});
|
|
35
38
|
}
|
|
36
|
-
function
|
|
39
|
+
function W(t) {
|
|
37
40
|
switch (t) {
|
|
38
41
|
case "top":
|
|
39
42
|
return "top left";
|
|
@@ -47,26 +50,29 @@ function q(n, p, u, w) {
|
|
|
47
50
|
return "bottom left";
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
|
-
function
|
|
51
|
-
var
|
|
52
|
-
const t = ((
|
|
53
|
+
function q() {
|
|
54
|
+
var l, o;
|
|
55
|
+
const t = ((l = e.parentRef) == null ? void 0 : l.$el) || ((o = f.value) == null ? void 0 : o.parentElement);
|
|
53
56
|
if (!(t instanceof HTMLElement)) {
|
|
54
57
|
console.warn("[KunMenu] Activator no válido:", t);
|
|
55
58
|
return;
|
|
56
59
|
}
|
|
57
|
-
t.addEventListener("click",
|
|
60
|
+
t.addEventListener("click", $), t.addEventListener("mouseenter", () => d("enter")), t.addEventListener("mouseleave", () => d("leave")), t.addEventListener("focus", y);
|
|
58
61
|
}
|
|
59
|
-
const
|
|
62
|
+
const C = R(() => {
|
|
63
|
+
const t = typeof e.maxHeight == "number" ? e.maxHeight : e.maxHeight ? parseInt(e.maxHeight) : null;
|
|
64
|
+
return c.value !== null ? `${t ? Math.min(t, c.value) : c.value}px` : typeof e.maxHeight == "number" ? e.maxHeight + "px" : e.maxHeight;
|
|
65
|
+
});
|
|
60
66
|
return {
|
|
61
|
-
initializeMenu:
|
|
62
|
-
repositionMenu:
|
|
63
|
-
contentEl:
|
|
64
|
-
activatorEl:
|
|
65
|
-
originClass:
|
|
66
|
-
computedMaxHeight:
|
|
67
|
-
menuPositionStyle:
|
|
67
|
+
initializeMenu: q,
|
|
68
|
+
repositionMenu: m,
|
|
69
|
+
contentEl: f,
|
|
70
|
+
activatorEl: x,
|
|
71
|
+
originClass: F,
|
|
72
|
+
computedMaxHeight: C,
|
|
73
|
+
menuPositionStyle: v
|
|
68
74
|
};
|
|
69
75
|
}
|
|
70
76
|
export {
|
|
71
|
-
|
|
77
|
+
K as useKunMenuStyles
|
|
72
78
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed as i, openBlock as l, createElementBlock as o, normalizeClass as a, renderSlot as u, createCommentVNode as p, createVNode as $, Fragment as S, renderList as T, createBlock as V, resolveDynamicComponent as h, unref as r, createTextVNode as
|
|
1
|
+
import { computed as i, openBlock as l, createElementBlock as o, normalizeClass as a, renderSlot as u, createCommentVNode as p, createVNode as $, Fragment as S, renderList as T, createBlock as V, resolveDynamicComponent as h, unref as r, createTextVNode as R, toDisplayString as x } from "vue";
|
|
2
2
|
import B from "../../../KunCheckbox/src/components/KunCheckbox.vue.js";
|
|
3
3
|
import { getValue as c, formatValue as E } from "../../../../utils/tableFormatters.js";
|
|
4
4
|
import { kunTableRowProps as N } from "../composables/kunTableRowProps.js";
|
|
@@ -73,7 +73,7 @@ const A = { key: 0 }, D = { key: 1 }, j = "px-1 py-2 whitespace-normal word-brea
|
|
|
73
73
|
index: e.index,
|
|
74
74
|
header: t
|
|
75
75
|
}, () => [
|
|
76
|
-
x(
|
|
76
|
+
R(x(r(E)(t, r(c)(t, e.item), e.item)), 1)
|
|
77
77
|
])
|
|
78
78
|
], 2);
|
|
79
79
|
}), 128)),
|
|
@@ -1,22 +1,143 @@
|
|
|
1
|
-
import { kunConfig as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { kunConfig as l } from "../config/kunConfig.js";
|
|
2
|
+
import { kunDocumentConfig as _ } from "../config/kunDocumentConfig.js";
|
|
3
|
+
const S = {
|
|
4
|
+
doc_ar: {
|
|
5
|
+
cuit: { mask: [2, 8, 1] },
|
|
6
|
+
cuil: { mask: [2, 8, 1] },
|
|
7
|
+
dni: { thousandsSep: "." }
|
|
8
|
+
},
|
|
9
|
+
doc_bo: {
|
|
10
|
+
nit: { mask: null },
|
|
11
|
+
ci: { mask: null }
|
|
12
|
+
},
|
|
13
|
+
doc_br: {
|
|
14
|
+
cpf: { mask: [3, 3, 3, 2], separators: [".", ".", "-"] },
|
|
15
|
+
cnpj: { mask: [2, 3, 3, 4, 2], separators: [".", ".", "/", "-"] }
|
|
16
|
+
},
|
|
17
|
+
doc_cl: {
|
|
18
|
+
rut: { rutFormat: !0, thousandsSep: "." },
|
|
19
|
+
run: { rutFormat: !0, thousandsSep: "." }
|
|
20
|
+
},
|
|
21
|
+
doc_co: {
|
|
22
|
+
nit: { mask: [9, 1] }
|
|
23
|
+
},
|
|
24
|
+
doc_cr: {
|
|
25
|
+
cedula: { mask: [1, 4, 5] },
|
|
26
|
+
dimex: { mask: [1, 4, 5] },
|
|
27
|
+
nite: { mask: [1, 3, 6] }
|
|
28
|
+
},
|
|
29
|
+
doc_do: {
|
|
30
|
+
cedula: { mask: [3, 7, 1] }
|
|
31
|
+
},
|
|
32
|
+
doc_es: {
|
|
33
|
+
dni: { mask: [8, 1] },
|
|
34
|
+
nie: { mask: [1, 7, 1] }
|
|
35
|
+
},
|
|
36
|
+
doc_gb: {
|
|
37
|
+
vat: { mask: [2, 3, 4, 2], separators: [" ", " ", " "] },
|
|
38
|
+
ni: { mask: [2, 2, 2, 2, 1], separators: [" ", " ", " ", " "] }
|
|
39
|
+
},
|
|
40
|
+
doc_de: {
|
|
41
|
+
stnr: { mask: [2, 3, 5], separators: ["/", "/"] }
|
|
42
|
+
},
|
|
43
|
+
doc_fr: {
|
|
44
|
+
siret: { mask: [3, 3, 3, 5], separators: [" ", " ", " "] },
|
|
45
|
+
siren: { mask: [3, 3, 3], separators: [" ", " "] },
|
|
46
|
+
tva: { mask: [4, 9], separators: [" "] }
|
|
47
|
+
},
|
|
48
|
+
doc_gt: {
|
|
49
|
+
nit: { mask: [8, 1] }
|
|
50
|
+
},
|
|
51
|
+
doc_hn: {
|
|
52
|
+
dni: { mask: [4, 4, 5] }
|
|
53
|
+
},
|
|
54
|
+
doc_ni: {
|
|
55
|
+
cedula: { mask: [9, 1] }
|
|
56
|
+
},
|
|
57
|
+
doc_pa: {
|
|
58
|
+
cedula: { mask: [1, 3, 4] },
|
|
59
|
+
ruc: { mask: [7, 1, 2] }
|
|
60
|
+
},
|
|
61
|
+
doc_py: {
|
|
62
|
+
ruc: { mask: [7, 1] }
|
|
63
|
+
},
|
|
64
|
+
doc_ve: {
|
|
65
|
+
cedula: { mask: [1, 8] },
|
|
66
|
+
rif: { mask: [1, 8, 1] }
|
|
67
|
+
},
|
|
68
|
+
doc_pt: {
|
|
69
|
+
passaporte: { mask: [1, 8] }
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function D(t) {
|
|
73
|
+
return String(t || "").toUpperCase().replace(/[^A-Z0-9]/g, "");
|
|
74
|
+
}
|
|
75
|
+
function F(t, n) {
|
|
76
|
+
let r = "";
|
|
77
|
+
for (let o = 0; o < t.length; o++)
|
|
78
|
+
o > 0 && (t.length - o) % 3 === 0 && (r += n), r += t[o];
|
|
79
|
+
return r;
|
|
80
|
+
}
|
|
81
|
+
function C(t, n, r) {
|
|
82
|
+
let o = "", e = 0;
|
|
83
|
+
for (let s = 0; s < n.length && e < t.length; s++)
|
|
84
|
+
o += t.substring(e, e + n[s]), e += n[s], s < n.length - 1 && e < t.length && (o += r ? r[s] ?? "-" : "-");
|
|
85
|
+
return o;
|
|
86
|
+
}
|
|
87
|
+
function h(t, n, r) {
|
|
88
|
+
var s;
|
|
89
|
+
const o = D(String(t ?? ""));
|
|
90
|
+
if (!o) return t ?? "";
|
|
91
|
+
const e = (s = S[n]) == null ? void 0 : s[r];
|
|
92
|
+
return e ? e.rutFormat ? o.length < 2 ? o : F(o.slice(0, -1), e.thousandsSep || ".") + "-" + o.slice(-1) : e.thousandsSep ? F(o, e.thousandsSep) : e.mask ? C(o, e.mask, e.separators ?? null) : o : o;
|
|
93
|
+
}
|
|
94
|
+
function $(t, n) {
|
|
95
|
+
var o;
|
|
4
96
|
if (!t || !t.value) return;
|
|
5
97
|
if (t.columnType === "relation") {
|
|
6
|
-
const
|
|
7
|
-
return
|
|
98
|
+
const e = x(n, t.relationPath);
|
|
99
|
+
return m(e);
|
|
8
100
|
}
|
|
9
101
|
if (t.columnType === "function") {
|
|
10
|
-
const
|
|
11
|
-
return
|
|
102
|
+
const e = (o = t.columnFunction) == null ? void 0 : o.call(t, n, t);
|
|
103
|
+
return m(e);
|
|
12
104
|
}
|
|
13
|
-
const
|
|
14
|
-
return
|
|
105
|
+
const r = n == null ? void 0 : n[t.value];
|
|
106
|
+
return m(r);
|
|
15
107
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
108
|
+
function N(t, n, r, o) {
|
|
109
|
+
var d, p, g, k;
|
|
110
|
+
const e = D(String(t ?? ""));
|
|
111
|
+
if (!e || !n || !(r != null && r.length)) return e;
|
|
112
|
+
const s = r.find((c) => c.id == n);
|
|
113
|
+
if (!s) return e;
|
|
114
|
+
const a = s.country_id ?? ((d = s.country) == null ? void 0 : d.id);
|
|
115
|
+
let i = null;
|
|
116
|
+
if (a && (o != null && o.length)) {
|
|
117
|
+
const c = o.find((w) => w.id == a), y = (c == null ? void 0 : c.iso2) || (c == null ? void 0 : c.iso_code) || (c == null ? void 0 : c.code);
|
|
118
|
+
y && (i = `doc_${y.toLowerCase()}`);
|
|
119
|
+
}
|
|
120
|
+
if (!i) {
|
|
121
|
+
const c = s.country_iso2 || ((p = s.country) == null ? void 0 : p.iso2);
|
|
122
|
+
c && (i = `doc_${c.toLowerCase()}`);
|
|
123
|
+
}
|
|
124
|
+
if (!i) return e;
|
|
125
|
+
const f = ((g = s.short_name) == null ? void 0 : g.toLowerCase()) || ((k = s.name) == null ? void 0 : k.toLowerCase());
|
|
126
|
+
return f ? h(t, i, f) : e;
|
|
18
127
|
}
|
|
19
|
-
|
|
128
|
+
function L(t, n, r = null) {
|
|
129
|
+
var e, s;
|
|
130
|
+
if (t.columnType === "toComplete") return "";
|
|
131
|
+
if (n == null) return "Sin datos";
|
|
132
|
+
if (t.columnType === "dateTime" || t.columnType === "date")
|
|
133
|
+
return (u[t.columnType] || u.default)(n);
|
|
134
|
+
if (t.columnType === "document") {
|
|
135
|
+
const a = (r == null ? void 0 : r.document_type_id) ?? ((e = r == null ? void 0 : r.entity) == null ? void 0 : e.document_type_id) ?? null;
|
|
136
|
+
return N(n, a, _.documentTypes, _.countries);
|
|
137
|
+
}
|
|
138
|
+
return (s = t.columnType) != null && s.startsWith("doc_") ? h(n, t.columnType, t.columnFormat) : (u[t.columnFormat] || u.default)(n);
|
|
139
|
+
}
|
|
140
|
+
const u = {
|
|
20
141
|
default: (t) => t,
|
|
21
142
|
// TEXTS
|
|
22
143
|
text: (t) => String(t),
|
|
@@ -25,16 +146,16 @@ const i = {
|
|
|
25
146
|
// ya está procesado por getComposedValue
|
|
26
147
|
// NUMBERS - Usa config global directamente
|
|
27
148
|
number: (t) => {
|
|
28
|
-
const n =
|
|
149
|
+
const n = l.locale;
|
|
29
150
|
return Number(t).toLocaleString(n);
|
|
30
151
|
},
|
|
31
152
|
money: (t) => {
|
|
32
|
-
const n =
|
|
33
|
-
return new Intl.NumberFormat(
|
|
153
|
+
const n = l.current, r = n.locale, o = n.precision, e = n.currency;
|
|
154
|
+
return new Intl.NumberFormat(r, {
|
|
34
155
|
style: "currency",
|
|
35
|
-
currency:
|
|
36
|
-
minimumFractionDigits:
|
|
37
|
-
maximumFractionDigits:
|
|
156
|
+
currency: e.value,
|
|
157
|
+
minimumFractionDigits: o,
|
|
158
|
+
maximumFractionDigits: o
|
|
38
159
|
}).format(t ?? 0);
|
|
39
160
|
},
|
|
40
161
|
noDecimal: (t) => parseFloat(t ?? 0).toFixed(0),
|
|
@@ -42,22 +163,22 @@ const i = {
|
|
|
42
163
|
noCeros: (t) => parseFloat(t ?? 0),
|
|
43
164
|
percentage: (t) => `${parseFloat(t ?? 0)}%`,
|
|
44
165
|
date: (t) => {
|
|
45
|
-
var
|
|
46
|
-
if (!t || t === "0000-00-00" || !
|
|
47
|
-
const [n,
|
|
48
|
-
return new Intl.DateTimeFormat(
|
|
166
|
+
var i;
|
|
167
|
+
if (!t || t === "0000-00-00" || !T(t)) return "Nunca";
|
|
168
|
+
const [n, r, o] = t.split("-").map(Number), e = new Date(n, r - 1, o, 12, 0, 0), s = l.current, a = s.locale;
|
|
169
|
+
return new Intl.DateTimeFormat(a, {
|
|
49
170
|
weekday: "short",
|
|
50
171
|
day: "2-digit",
|
|
51
172
|
month: "short",
|
|
52
173
|
year: "2-digit",
|
|
53
|
-
...(
|
|
54
|
-
}).format(
|
|
174
|
+
...(i = s.date) == null ? void 0 : i.dateFormat
|
|
175
|
+
}).format(e);
|
|
55
176
|
},
|
|
56
177
|
dateTime: (t) => {
|
|
57
|
-
var
|
|
58
|
-
if (!t || t === "0000-00-00" || !
|
|
59
|
-
const n = new Date(t),
|
|
60
|
-
return new Intl.DateTimeFormat(
|
|
178
|
+
var e;
|
|
179
|
+
if (!t || t === "0000-00-00" || !T(t)) return "Nunca";
|
|
180
|
+
const n = new Date(t), r = l.current, o = r.locale;
|
|
181
|
+
return new Intl.DateTimeFormat(o, {
|
|
61
182
|
weekday: "short",
|
|
62
183
|
day: "2-digit",
|
|
63
184
|
month: "short",
|
|
@@ -66,29 +187,29 @@ const i = {
|
|
|
66
187
|
minute: "2-digit",
|
|
67
188
|
second: "2-digit",
|
|
68
189
|
hourCycle: "h23",
|
|
69
|
-
...(
|
|
190
|
+
...(e = r.date) == null ? void 0 : e.dateTimeFormat
|
|
70
191
|
}).format(n);
|
|
71
192
|
},
|
|
72
|
-
secondsToTime: (t) =>
|
|
193
|
+
secondsToTime: (t) => I(t ?? 0)
|
|
73
194
|
};
|
|
74
|
-
function
|
|
75
|
-
return !t || !n ? t : n.split(".").reduce((
|
|
195
|
+
function x(t, n) {
|
|
196
|
+
return !t || !n ? t : n.split(".").reduce((r, o) => r == null ? void 0 : r[o], t);
|
|
76
197
|
}
|
|
77
|
-
function
|
|
78
|
-
const n = Math.floor(t / 3600),
|
|
79
|
-
return `${n} horas, ${
|
|
198
|
+
function I(t) {
|
|
199
|
+
const n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), o = t % 60;
|
|
200
|
+
return `${n} horas, ${r} minutos y ${o} segundos`;
|
|
80
201
|
}
|
|
81
|
-
function
|
|
202
|
+
function m(t) {
|
|
82
203
|
if (t != null && !(t === "null" || t === "undefined"))
|
|
83
204
|
return t;
|
|
84
205
|
}
|
|
85
|
-
function
|
|
206
|
+
function T(t) {
|
|
86
207
|
const n = new Date(t);
|
|
87
208
|
return !isNaN(n.getTime());
|
|
88
209
|
}
|
|
89
210
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
211
|
+
L as formatValue,
|
|
212
|
+
u as formatters,
|
|
213
|
+
x as getNestedValue,
|
|
214
|
+
$ as getValue
|
|
94
215
|
};
|