adverich-kun-ui 0.1.536 → 0.1.538
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.
package/dist/config/kunConfig.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { inject as
|
|
2
|
-
const
|
|
1
|
+
import { inject as l, reactive as a, readonly as u } from "vue";
|
|
2
|
+
const f = {
|
|
3
3
|
locale: "es-AR",
|
|
4
4
|
currency: {
|
|
5
5
|
code: "ARS",
|
|
@@ -31,7 +31,7 @@ function c(e, r) {
|
|
|
31
31
|
r[t] !== null && typeof r[t] == "object" && !Array.isArray(r[t]) && e[t] !== null && typeof e[t] == "object" && !Array.isArray(e[t]) ? o[t] = c(e[t], r[t]) : o[t] = r[t];
|
|
32
32
|
return o;
|
|
33
33
|
}
|
|
34
|
-
const n = a({ ...
|
|
34
|
+
const n = a({ ...f }), d = Symbol("kunConfig"), y = {
|
|
35
35
|
// Acceso readonly para evitar mutaciones directas
|
|
36
36
|
get current() {
|
|
37
37
|
return u(n);
|
|
@@ -48,13 +48,12 @@ const n = a({ ...l }), d = Symbol("kunConfig"), y = {
|
|
|
48
48
|
},
|
|
49
49
|
// Configurar (merge profundo)
|
|
50
50
|
configure(e = {}) {
|
|
51
|
-
console.log(e);
|
|
52
51
|
const r = c(n, e);
|
|
53
52
|
Object.assign(n, r);
|
|
54
53
|
},
|
|
55
54
|
// Reset a valores por defecto
|
|
56
55
|
reset() {
|
|
57
|
-
Object.assign(n, c({},
|
|
56
|
+
Object.assign(n, c({}, f));
|
|
58
57
|
},
|
|
59
58
|
// Setters individuales para configuración dinámica
|
|
60
59
|
setLocale(e) {
|
|
@@ -65,7 +64,7 @@ const n = a({ ...l }), d = Symbol("kunConfig"), y = {
|
|
|
65
64
|
}
|
|
66
65
|
};
|
|
67
66
|
function m() {
|
|
68
|
-
const e =
|
|
67
|
+
const e = l(d, null);
|
|
69
68
|
return e || y.current;
|
|
70
69
|
}
|
|
71
70
|
function b(e, r, o) {
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function
|
|
3
|
-
var
|
|
1
|
+
import { kunConfig as i } from "../config/kunConfig.js";
|
|
2
|
+
function g(t, n) {
|
|
3
|
+
var e;
|
|
4
4
|
if (!t || !t.value) return;
|
|
5
5
|
if (t.columnType === "relation") {
|
|
6
|
-
const r =
|
|
7
|
-
return
|
|
6
|
+
const r = l(n, t.relationPath);
|
|
7
|
+
return u(r);
|
|
8
8
|
}
|
|
9
9
|
if (t.columnType === "function") {
|
|
10
|
-
const r = (
|
|
11
|
-
return
|
|
10
|
+
const r = (e = t.columnFunction) == null ? void 0 : e.call(t, n, t);
|
|
11
|
+
return u(r);
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
return
|
|
13
|
+
const o = n == null ? void 0 : n[t.value];
|
|
14
|
+
return u(o);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
16
|
+
function y(t, n) {
|
|
17
|
+
const o = i.current, e = o.locale, r = o.currency;
|
|
18
|
+
return console.log(r), console.log(e), t.columnType === "toComplete" ? "" : n == null ? "Sin datos" : t.columnType === "dateTime" || t.columnType === "date" ? (c[t.columnType] || c.default)(n) : (c[t.columnFormat] || c.default)(n);
|
|
18
19
|
}
|
|
19
|
-
const
|
|
20
|
+
const c = {
|
|
20
21
|
default: (t) => t,
|
|
21
22
|
// TEXTS
|
|
22
23
|
text: (t) => String(t),
|
|
23
24
|
activeOrInactive: (t) => t ? "Activa" : "Inactiva",
|
|
24
25
|
composed: (t) => t,
|
|
25
26
|
// ya está procesado por getComposedValue
|
|
26
|
-
// NUMBERS
|
|
27
|
-
number: (t
|
|
28
|
-
const
|
|
29
|
-
return Number(t).toLocaleString(
|
|
27
|
+
// NUMBERS - Usa config global directamente
|
|
28
|
+
number: (t) => {
|
|
29
|
+
const n = i.locale;
|
|
30
|
+
return Number(t).toLocaleString(n);
|
|
30
31
|
},
|
|
31
|
-
money: (t
|
|
32
|
-
const
|
|
33
|
-
return new Intl.NumberFormat(
|
|
32
|
+
money: (t) => {
|
|
33
|
+
const n = i.current, o = n.locale, e = n.currency;
|
|
34
|
+
return new Intl.NumberFormat(o, {
|
|
34
35
|
style: "currency",
|
|
35
|
-
currency:
|
|
36
|
-
minimumFractionDigits:
|
|
37
|
-
maximumFractionDigits:
|
|
36
|
+
currency: e.code,
|
|
37
|
+
minimumFractionDigits: e.precision,
|
|
38
|
+
maximumFractionDigits: e.precision
|
|
38
39
|
}).format(t ?? 0);
|
|
39
40
|
},
|
|
40
41
|
noDecimal: (t) => parseFloat(t ?? 0).toFixed(0),
|
|
41
42
|
withDecimals: (t, n = 2) => parseFloat(t ?? 0).toFixed(n),
|
|
42
43
|
noCeros: (t) => parseFloat(t ?? 0),
|
|
43
44
|
percentage: (t) => `${parseFloat(t ?? 0)}%`,
|
|
44
|
-
date: (t
|
|
45
|
-
var
|
|
46
|
-
if (!t || t === "0000-00-00" || !
|
|
47
|
-
const
|
|
48
|
-
return new Intl.DateTimeFormat(
|
|
45
|
+
date: (t) => {
|
|
46
|
+
var r;
|
|
47
|
+
if (!t || t === "0000-00-00" || !a(t)) return "Nunca";
|
|
48
|
+
const n = new Date(t), o = i.current, e = o.locale;
|
|
49
|
+
return new Intl.DateTimeFormat(e, {
|
|
49
50
|
weekday: "short",
|
|
50
51
|
day: "2-digit",
|
|
51
52
|
month: "short",
|
|
52
53
|
year: "2-digit",
|
|
53
|
-
...(
|
|
54
|
-
|
|
55
|
-
}).format(e);
|
|
54
|
+
...(r = o.date) == null ? void 0 : r.dateFormat
|
|
55
|
+
}).format(n);
|
|
56
56
|
},
|
|
57
|
-
dateTime: (t
|
|
58
|
-
var
|
|
59
|
-
if (!t || t === "0000-00-00" || !
|
|
60
|
-
const
|
|
61
|
-
return new Intl.DateTimeFormat(
|
|
57
|
+
dateTime: (t) => {
|
|
58
|
+
var r;
|
|
59
|
+
if (!t || t === "0000-00-00" || !a(t)) return "Nunca";
|
|
60
|
+
const n = new Date(t), o = i.current, e = o.locale;
|
|
61
|
+
return new Intl.DateTimeFormat(e, {
|
|
62
62
|
weekday: "short",
|
|
63
63
|
day: "2-digit",
|
|
64
64
|
month: "short",
|
|
@@ -67,30 +67,29 @@ const i = {
|
|
|
67
67
|
minute: "2-digit",
|
|
68
68
|
second: "2-digit",
|
|
69
69
|
hourCycle: "h23",
|
|
70
|
-
...(
|
|
71
|
-
|
|
72
|
-
}).format(e);
|
|
70
|
+
...(r = o.date) == null ? void 0 : r.dateTimeFormat
|
|
71
|
+
}).format(n);
|
|
73
72
|
},
|
|
74
73
|
secondsToTime: (t) => f(t ?? 0)
|
|
75
74
|
};
|
|
76
|
-
function
|
|
77
|
-
return !t || !n ? t : n.split(".").reduce((
|
|
75
|
+
function l(t, n) {
|
|
76
|
+
return !t || !n ? t : n.split(".").reduce((o, e) => o == null ? void 0 : o[e], t);
|
|
78
77
|
}
|
|
79
78
|
function f(t) {
|
|
80
|
-
const n = Math.floor(t / 3600),
|
|
81
|
-
return `${n} horas, ${
|
|
79
|
+
const n = Math.floor(t / 3600), o = Math.floor(t % 3600 / 60), e = t % 60;
|
|
80
|
+
return `${n} horas, ${o} minutos y ${e} segundos`;
|
|
82
81
|
}
|
|
83
|
-
function
|
|
82
|
+
function u(t) {
|
|
84
83
|
if (t != null && !(t === "null" || t === "undefined"))
|
|
85
84
|
return t;
|
|
86
85
|
}
|
|
87
|
-
function
|
|
86
|
+
function a(t) {
|
|
88
87
|
const n = new Date(t);
|
|
89
88
|
return !isNaN(n.getTime());
|
|
90
89
|
}
|
|
91
90
|
export {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
y as formatValue,
|
|
92
|
+
c as formatters,
|
|
93
|
+
l as getNestedValue,
|
|
94
|
+
g as getValue
|
|
96
95
|
};
|