adverich-kun-ui 0.1.296 → 0.1.298
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 +53 -50
- package/package.json +1 -1
|
@@ -1,56 +1,55 @@
|
|
|
1
|
-
function
|
|
2
|
-
var r,
|
|
3
|
-
if (!
|
|
4
|
-
if (
|
|
5
|
-
const
|
|
6
|
-
return u
|
|
1
|
+
function a(t, n) {
|
|
2
|
+
var r, c;
|
|
3
|
+
if (!t || !t.value) return;
|
|
4
|
+
if (t.columnType === "relation") {
|
|
5
|
+
const u = m(n, t.relationPath);
|
|
6
|
+
return i(u);
|
|
7
7
|
}
|
|
8
|
-
if (
|
|
9
|
-
const
|
|
10
|
-
return u
|
|
8
|
+
if (t.columnType === "function") {
|
|
9
|
+
const u = (r = t.columnFunction) == null ? void 0 : r.call(t, n, t);
|
|
10
|
+
return i(u);
|
|
11
11
|
}
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
return u
|
|
12
|
+
if (t.columnFormat === "function") {
|
|
13
|
+
const u = (c = t.columnFunction) == null ? void 0 : c.call(t, n, t);
|
|
14
|
+
return i(u);
|
|
15
15
|
}
|
|
16
|
-
const o =
|
|
17
|
-
return
|
|
16
|
+
const o = n == null ? void 0 : n[t.value];
|
|
17
|
+
return i(o);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
19
|
+
function l(t, n) {
|
|
20
|
+
return n == null ? "Sin datos" : t.columnType === "dateTime" || t.columnType === "date" ? (e[t.columnType] || e.default)(n) : (e[t.columnFormat] || e.default)(n);
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
default: (
|
|
22
|
+
const e = {
|
|
23
|
+
default: (t) => t,
|
|
24
24
|
// TEXTS
|
|
25
|
-
text: (
|
|
26
|
-
activeOrInactive: (
|
|
27
|
-
composed: (
|
|
25
|
+
text: (t) => String(t),
|
|
26
|
+
activeOrInactive: (t) => t ? "Activa" : "Inactiva",
|
|
27
|
+
composed: (t) => t,
|
|
28
28
|
// ya está procesado por getComposedValue
|
|
29
29
|
// NUMBERS
|
|
30
|
-
number: (
|
|
31
|
-
money: (
|
|
30
|
+
number: (t) => Number(t).toLocaleString("es-AR"),
|
|
31
|
+
money: (t) => new Intl.NumberFormat("es-CL", {
|
|
32
32
|
style: "currency",
|
|
33
33
|
currency: "CLP",
|
|
34
34
|
minimumFractionDigits: 2
|
|
35
|
-
}).format(
|
|
36
|
-
noDecimal: (
|
|
37
|
-
withDecimals: (
|
|
38
|
-
noCeros: (
|
|
39
|
-
percentage: (
|
|
40
|
-
date: (
|
|
41
|
-
if (!
|
|
42
|
-
const
|
|
35
|
+
}).format(t ?? 0),
|
|
36
|
+
noDecimal: (t) => parseFloat(t ?? 0).toFixed(0),
|
|
37
|
+
withDecimals: (t, n = 2) => parseFloat(t ?? 0).toFixed(n),
|
|
38
|
+
noCeros: (t) => parseFloat(t ?? 0),
|
|
39
|
+
percentage: (t) => `${parseFloat(t ?? 0)}%`,
|
|
40
|
+
date: (t) => {
|
|
41
|
+
if (!t || t === "0000-00-00" || !s(t)) return "Nunca";
|
|
42
|
+
const n = new Date(t);
|
|
43
43
|
return new Intl.DateTimeFormat("es-MX", {
|
|
44
|
-
locale: "es-ES",
|
|
45
44
|
weekday: "short",
|
|
46
45
|
day: "numeric",
|
|
47
46
|
month: "short",
|
|
48
47
|
year: "2-digit"
|
|
49
|
-
}).format(
|
|
48
|
+
}).format(n);
|
|
50
49
|
},
|
|
51
|
-
dateTime: (
|
|
52
|
-
if (!
|
|
53
|
-
const
|
|
50
|
+
dateTime: (t) => {
|
|
51
|
+
if (!t || t === "0000-00-00" || !s(t)) return "Nunca";
|
|
52
|
+
const n = new Date(t);
|
|
54
53
|
return new Intl.DateTimeFormat("es-MX", {
|
|
55
54
|
day: "numeric",
|
|
56
55
|
month: "short",
|
|
@@ -58,24 +57,28 @@ const s = {
|
|
|
58
57
|
hour: "numeric",
|
|
59
58
|
minute: "numeric",
|
|
60
59
|
second: "numeric"
|
|
61
|
-
}).format(
|
|
60
|
+
}).format(n);
|
|
62
61
|
},
|
|
63
|
-
secondsToTime: (
|
|
62
|
+
secondsToTime: (t) => f(t ?? 0)
|
|
64
63
|
};
|
|
65
|
-
function
|
|
66
|
-
return !
|
|
64
|
+
function m(t, n) {
|
|
65
|
+
return !t || !n ? t : n.split(".").reduce((o, r) => o == null ? void 0 : o[r], t);
|
|
67
66
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
return `${
|
|
67
|
+
function f(t) {
|
|
68
|
+
const n = Math.floor(t / 3600), o = Math.floor(t % 3600 / 60), r = t % 60;
|
|
69
|
+
return `${n} horas, ${o} minutos y ${r} segundos`;
|
|
71
70
|
}
|
|
72
|
-
function
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
71
|
+
function i(t) {
|
|
72
|
+
if (t != null && !(t === "null" || t === "undefined"))
|
|
73
|
+
return t;
|
|
74
|
+
}
|
|
75
|
+
function s(t) {
|
|
76
|
+
const n = new Date(t);
|
|
77
|
+
return !isNaN(n.getTime());
|
|
75
78
|
}
|
|
76
79
|
export {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
l as formatValue,
|
|
81
|
+
e as formatters,
|
|
82
|
+
m as getNestedValue,
|
|
83
|
+
a as getValue
|
|
81
84
|
};
|