adverich-kun-ui 0.1.537 → 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/utils/tableFormatters.js +18 -17
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { kunConfig as
|
|
2
|
-
function
|
|
1
|
+
import { kunConfig as i } from "../config/kunConfig.js";
|
|
2
|
+
function g(t, n) {
|
|
3
3
|
var e;
|
|
4
4
|
if (!t || !t.value) return;
|
|
5
5
|
if (t.columnType === "relation") {
|
|
6
|
-
const r =
|
|
6
|
+
const r = l(n, t.relationPath);
|
|
7
7
|
return u(r);
|
|
8
8
|
}
|
|
9
9
|
if (t.columnType === "function") {
|
|
@@ -13,10 +13,11 @@ function f(t, n) {
|
|
|
13
13
|
const o = n == null ? void 0 : n[t.value];
|
|
14
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),
|
|
@@ -25,11 +26,11 @@ const i = {
|
|
|
25
26
|
// ya está procesado por getComposedValue
|
|
26
27
|
// NUMBERS - Usa config global directamente
|
|
27
28
|
number: (t) => {
|
|
28
|
-
const n =
|
|
29
|
+
const n = i.locale;
|
|
29
30
|
return Number(t).toLocaleString(n);
|
|
30
31
|
},
|
|
31
32
|
money: (t) => {
|
|
32
|
-
const n =
|
|
33
|
+
const n = i.current, o = n.locale, e = n.currency;
|
|
33
34
|
return new Intl.NumberFormat(o, {
|
|
34
35
|
style: "currency",
|
|
35
36
|
currency: e.code,
|
|
@@ -44,7 +45,7 @@ const i = {
|
|
|
44
45
|
date: (t) => {
|
|
45
46
|
var r;
|
|
46
47
|
if (!t || t === "0000-00-00" || !a(t)) return "Nunca";
|
|
47
|
-
const n = new Date(t), o =
|
|
48
|
+
const n = new Date(t), o = i.current, e = o.locale;
|
|
48
49
|
return new Intl.DateTimeFormat(e, {
|
|
49
50
|
weekday: "short",
|
|
50
51
|
day: "2-digit",
|
|
@@ -56,7 +57,7 @@ const i = {
|
|
|
56
57
|
dateTime: (t) => {
|
|
57
58
|
var r;
|
|
58
59
|
if (!t || t === "0000-00-00" || !a(t)) return "Nunca";
|
|
59
|
-
const n = new Date(t), o =
|
|
60
|
+
const n = new Date(t), o = i.current, e = o.locale;
|
|
60
61
|
return new Intl.DateTimeFormat(e, {
|
|
61
62
|
weekday: "short",
|
|
62
63
|
day: "2-digit",
|
|
@@ -69,12 +70,12 @@ const i = {
|
|
|
69
70
|
...(r = o.date) == null ? void 0 : r.dateTimeFormat
|
|
70
71
|
}).format(n);
|
|
71
72
|
},
|
|
72
|
-
secondsToTime: (t) =>
|
|
73
|
+
secondsToTime: (t) => f(t ?? 0)
|
|
73
74
|
};
|
|
74
|
-
function
|
|
75
|
+
function l(t, n) {
|
|
75
76
|
return !t || !n ? t : n.split(".").reduce((o, e) => o == null ? void 0 : o[e], t);
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function f(t) {
|
|
78
79
|
const n = Math.floor(t / 3600), o = Math.floor(t % 3600 / 60), e = t % 60;
|
|
79
80
|
return `${n} horas, ${o} minutos y ${e} segundos`;
|
|
80
81
|
}
|
|
@@ -87,8 +88,8 @@ function a(t) {
|
|
|
87
88
|
return !isNaN(n.getTime());
|
|
88
89
|
}
|
|
89
90
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
y as formatValue,
|
|
92
|
+
c as formatters,
|
|
93
|
+
l as getNestedValue,
|
|
94
|
+
g as getValue
|
|
94
95
|
};
|