adverich-kun-ui 0.1.538 → 0.1.539
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,5 +1,5 @@
|
|
|
1
|
-
import { computed as o, ref as y, onMounted as
|
|
2
|
-
import { useKunConfig as
|
|
1
|
+
import { computed as o, ref as y, onMounted as A, createElementBlock as i, openBlock as d, createElementVNode as a, createCommentVNode as x, toDisplayString as v, unref as F } from "vue";
|
|
2
|
+
import { useKunConfig as N, resolveConfigValue as h } from "../../../../config/kunConfig.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
const P = {
|
|
5
5
|
class: "flex flex-row items-center",
|
|
@@ -44,17 +44,17 @@ const P = {
|
|
|
44
44
|
},
|
|
45
45
|
emits: ["update:modelValue"],
|
|
46
46
|
setup(r, { emit: g }) {
|
|
47
|
-
const C =
|
|
47
|
+
const C = N(), l = r;
|
|
48
48
|
o(
|
|
49
49
|
() => h(l.locale, "locale", "es-AR")
|
|
50
50
|
);
|
|
51
51
|
const V = o(
|
|
52
|
-
() => l.currency ?? C.currency ?? {
|
|
52
|
+
() => l.currency ?? C.currency ?? { value: "ARS", name: "Pesos Argentinos", symbol: "$" }
|
|
53
53
|
);
|
|
54
54
|
o(
|
|
55
|
-
() => h(l.precision, "
|
|
55
|
+
() => h(l.precision, "precision", 2)
|
|
56
56
|
);
|
|
57
|
-
const
|
|
57
|
+
const c = o(
|
|
58
58
|
() => {
|
|
59
59
|
var t;
|
|
60
60
|
return l.prefix ?? ((t = V.value) == null ? void 0 : t.symbol) ?? "$";
|
|
@@ -64,12 +64,12 @@ const P = {
|
|
|
64
64
|
p.value = t, B("update:modelValue", t);
|
|
65
65
|
}
|
|
66
66
|
const p = y(l.modelValue);
|
|
67
|
-
let
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
let s = null, u = null;
|
|
68
|
+
A(() => {
|
|
69
|
+
s = document.getElementById("hide"), u = document.getElementById("txt"), u.addEventListener("input", f), f();
|
|
70
70
|
});
|
|
71
71
|
function f() {
|
|
72
|
-
|
|
72
|
+
s.textContent = u.value, u.style.width = 6 + s.offsetWidth + "px";
|
|
73
73
|
}
|
|
74
74
|
const I = (t) => {
|
|
75
75
|
const e = t.target.querySelector("input");
|
|
@@ -86,15 +86,15 @@ const P = {
|
|
|
86
86
|
}, m = (t) => {
|
|
87
87
|
document.getElementById("txt").setAttribute("placeholder", t);
|
|
88
88
|
};
|
|
89
|
-
return (t, e) => (
|
|
89
|
+
return (t, e) => (d(), i("div", {
|
|
90
90
|
class: "w-full h-full flex justify-center",
|
|
91
91
|
style: { cursor: "text" },
|
|
92
92
|
onClick: e[1] || (e[1] = (n) => I(n))
|
|
93
93
|
}, [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
e[2] || (e[2] =
|
|
97
|
-
|
|
94
|
+
a("div", P, [
|
|
95
|
+
c.value ? (d(), i("div", j, v(c.value), 1)) : x("", !0),
|
|
96
|
+
e[2] || (e[2] = a("span", { id: "hide" }, null, -1)),
|
|
97
|
+
a("input", {
|
|
98
98
|
id: "txt",
|
|
99
99
|
ref_key: "inputField",
|
|
100
100
|
ref: S,
|
|
@@ -102,12 +102,12 @@ const P = {
|
|
|
102
102
|
class: "text-field-style",
|
|
103
103
|
onFocus: _,
|
|
104
104
|
onBlur: w,
|
|
105
|
-
placeholder:
|
|
105
|
+
placeholder: F(E),
|
|
106
106
|
onInput: e[0] || (e[0] = (n) => k(n)),
|
|
107
107
|
value: p.value,
|
|
108
108
|
autocomplete: "off"
|
|
109
109
|
}, null, 40, D),
|
|
110
|
-
r.suffix ? (
|
|
110
|
+
r.suffix ? (d(), i("div", K, v(r.suffix), 1)) : x("", !0)
|
|
111
111
|
])
|
|
112
112
|
]));
|
|
113
113
|
}
|
package/dist/config/kunConfig.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { inject as l, reactive as
|
|
2
|
-
const
|
|
1
|
+
import { inject as l, reactive as u, readonly as f } from "vue";
|
|
2
|
+
const a = {
|
|
3
3
|
locale: "es-AR",
|
|
4
|
+
precision: 2,
|
|
4
5
|
currency: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
value: "ARS",
|
|
7
|
+
name: "Pesos Argentinos",
|
|
8
|
+
symbol: "$"
|
|
8
9
|
},
|
|
9
10
|
date: {
|
|
10
11
|
dateFormat: {
|
|
@@ -25,21 +26,24 @@ const f = {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
|
-
function
|
|
29
|
-
const
|
|
29
|
+
function s(e, r) {
|
|
30
|
+
const i = { ...e };
|
|
30
31
|
for (const t of Object.keys(r))
|
|
31
|
-
r[t] !== null && typeof r[t] == "object" && !Array.isArray(r[t]) && e[t] !== null && typeof e[t] == "object" && !Array.isArray(e[t]) ?
|
|
32
|
-
return
|
|
32
|
+
r[t] !== null && typeof r[t] == "object" && !Array.isArray(r[t]) && e[t] !== null && typeof e[t] == "object" && !Array.isArray(e[t]) ? i[t] = s(e[t], r[t]) : i[t] = r[t];
|
|
33
|
+
return i;
|
|
33
34
|
}
|
|
34
|
-
const n =
|
|
35
|
+
const n = u({ ...a }), y = Symbol("kunConfig"), d = {
|
|
35
36
|
// Acceso readonly para evitar mutaciones directas
|
|
36
37
|
get current() {
|
|
37
|
-
return
|
|
38
|
+
return f(n);
|
|
38
39
|
},
|
|
39
40
|
// Acceso directo a valores (reactivo)
|
|
40
41
|
get locale() {
|
|
41
42
|
return n.locale;
|
|
42
43
|
},
|
|
44
|
+
get precision() {
|
|
45
|
+
return n.precision;
|
|
46
|
+
},
|
|
43
47
|
get currency() {
|
|
44
48
|
return n.currency;
|
|
45
49
|
},
|
|
@@ -48,40 +52,43 @@ const n = a({ ...f }), d = Symbol("kunConfig"), y = {
|
|
|
48
52
|
},
|
|
49
53
|
// Configurar (merge profundo)
|
|
50
54
|
configure(e = {}) {
|
|
51
|
-
const r =
|
|
55
|
+
const r = s(n, e);
|
|
52
56
|
Object.assign(n, r);
|
|
53
57
|
},
|
|
54
58
|
// Reset a valores por defecto
|
|
55
59
|
reset() {
|
|
56
|
-
Object.assign(n,
|
|
60
|
+
Object.assign(n, s({}, a));
|
|
57
61
|
},
|
|
58
62
|
// Setters individuales para configuración dinámica
|
|
59
63
|
setLocale(e) {
|
|
60
64
|
n.locale = e;
|
|
61
65
|
},
|
|
66
|
+
setPrecision(e) {
|
|
67
|
+
n.precision = e;
|
|
68
|
+
},
|
|
62
69
|
setCurrency(e) {
|
|
63
|
-
typeof e == "string" ? n.currency.
|
|
70
|
+
typeof e == "string" ? n.currency.value = e : typeof e == "object" && Object.assign(n.currency, e);
|
|
64
71
|
}
|
|
65
72
|
};
|
|
66
73
|
function m() {
|
|
67
|
-
const e = l(
|
|
68
|
-
return e ||
|
|
74
|
+
const e = l(y, null);
|
|
75
|
+
return e || d.current;
|
|
69
76
|
}
|
|
70
|
-
function
|
|
77
|
+
function p(e, r, i) {
|
|
71
78
|
if (e != null)
|
|
72
79
|
return e;
|
|
73
80
|
const t = r.split(".");
|
|
74
|
-
let
|
|
75
|
-
for (const
|
|
76
|
-
if (
|
|
77
|
-
|
|
81
|
+
let o = n;
|
|
82
|
+
for (const c of t)
|
|
83
|
+
if (o && typeof o == "object" && c in o)
|
|
84
|
+
o = o[c];
|
|
78
85
|
else
|
|
79
|
-
return
|
|
80
|
-
return
|
|
86
|
+
return i;
|
|
87
|
+
return o ?? i;
|
|
81
88
|
}
|
|
82
89
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
y as KUN_CONFIG_KEY,
|
|
91
|
+
d as kunConfig,
|
|
92
|
+
p as resolveConfigValue,
|
|
86
93
|
m as useKunConfig
|
|
87
94
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { kunConfig as
|
|
2
|
-
function
|
|
1
|
+
import { kunConfig as c } from "../config/kunConfig.js";
|
|
2
|
+
function f(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 = s(n, t.relationPath);
|
|
7
7
|
return u(r);
|
|
8
8
|
}
|
|
9
9
|
if (t.columnType === "function") {
|
|
@@ -13,11 +13,10 @@ function g(t, n) {
|
|
|
13
13
|
const o = n == null ? void 0 : n[t.value];
|
|
14
14
|
return u(o);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
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);
|
|
16
|
+
function d(t, n) {
|
|
17
|
+
return t.columnType === "toComplete" ? "" : n == null ? "Sin datos" : t.columnType === "dateTime" || t.columnType === "date" ? (i[t.columnType] || i.default)(n) : (i[t.columnFormat] || i.default)(n);
|
|
19
18
|
}
|
|
20
|
-
const
|
|
19
|
+
const i = {
|
|
21
20
|
default: (t) => t,
|
|
22
21
|
// TEXTS
|
|
23
22
|
text: (t) => String(t),
|
|
@@ -26,16 +25,16 @@ const c = {
|
|
|
26
25
|
// ya está procesado por getComposedValue
|
|
27
26
|
// NUMBERS - Usa config global directamente
|
|
28
27
|
number: (t) => {
|
|
29
|
-
const n =
|
|
28
|
+
const n = c.locale;
|
|
30
29
|
return Number(t).toLocaleString(n);
|
|
31
30
|
},
|
|
32
31
|
money: (t) => {
|
|
33
|
-
const n =
|
|
32
|
+
const n = c.current, o = n.locale, e = n.precision, r = n.currency;
|
|
34
33
|
return new Intl.NumberFormat(o, {
|
|
35
34
|
style: "currency",
|
|
36
|
-
currency:
|
|
37
|
-
minimumFractionDigits: e
|
|
38
|
-
maximumFractionDigits: e
|
|
35
|
+
currency: r.value,
|
|
36
|
+
minimumFractionDigits: e,
|
|
37
|
+
maximumFractionDigits: e
|
|
39
38
|
}).format(t ?? 0);
|
|
40
39
|
},
|
|
41
40
|
noDecimal: (t) => parseFloat(t ?? 0).toFixed(0),
|
|
@@ -45,7 +44,7 @@ const c = {
|
|
|
45
44
|
date: (t) => {
|
|
46
45
|
var r;
|
|
47
46
|
if (!t || t === "0000-00-00" || !a(t)) return "Nunca";
|
|
48
|
-
const n = new Date(t), o =
|
|
47
|
+
const n = new Date(t), o = c.current, e = o.locale;
|
|
49
48
|
return new Intl.DateTimeFormat(e, {
|
|
50
49
|
weekday: "short",
|
|
51
50
|
day: "2-digit",
|
|
@@ -57,7 +56,7 @@ const c = {
|
|
|
57
56
|
dateTime: (t) => {
|
|
58
57
|
var r;
|
|
59
58
|
if (!t || t === "0000-00-00" || !a(t)) return "Nunca";
|
|
60
|
-
const n = new Date(t), o =
|
|
59
|
+
const n = new Date(t), o = c.current, e = o.locale;
|
|
61
60
|
return new Intl.DateTimeFormat(e, {
|
|
62
61
|
weekday: "short",
|
|
63
62
|
day: "2-digit",
|
|
@@ -70,12 +69,12 @@ const c = {
|
|
|
70
69
|
...(r = o.date) == null ? void 0 : r.dateTimeFormat
|
|
71
70
|
}).format(n);
|
|
72
71
|
},
|
|
73
|
-
secondsToTime: (t) =>
|
|
72
|
+
secondsToTime: (t) => l(t ?? 0)
|
|
74
73
|
};
|
|
75
|
-
function
|
|
74
|
+
function s(t, n) {
|
|
76
75
|
return !t || !n ? t : n.split(".").reduce((o, e) => o == null ? void 0 : o[e], t);
|
|
77
76
|
}
|
|
78
|
-
function
|
|
77
|
+
function l(t) {
|
|
79
78
|
const n = Math.floor(t / 3600), o = Math.floor(t % 3600 / 60), e = t % 60;
|
|
80
79
|
return `${n} horas, ${o} minutos y ${e} segundos`;
|
|
81
80
|
}
|
|
@@ -88,8 +87,8 @@ function a(t) {
|
|
|
88
87
|
return !isNaN(n.getTime());
|
|
89
88
|
}
|
|
90
89
|
export {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
d as formatValue,
|
|
91
|
+
i as formatters,
|
|
92
|
+
s as getNestedValue,
|
|
93
|
+
f as getValue
|
|
95
94
|
};
|