adverich-kun-ui 0.1.588 → 0.1.589

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 { kunConfig as l } from "../config/kunConfig.js";
2
- import { kunDocumentConfig as _ } from "../config/kunDocumentConfig.js";
1
+ import { kunConfig as d } from "../config/kunConfig.js";
2
+ import { kunDocumentConfig as m } from "../config/kunDocumentConfig.js";
3
3
  const S = {
4
4
  doc_ar: {
5
5
  cuit: { mask: [2, 8, 1] },
@@ -69,75 +69,78 @@ const S = {
69
69
  passaporte: { mask: [1, 8] }
70
70
  }
71
71
  };
72
- function D(t) {
72
+ function h(t) {
73
73
  return String(t || "").toUpperCase().replace(/[^A-Z0-9]/g, "");
74
74
  }
75
- function F(t, n) {
75
+ function T(t, n) {
76
76
  let r = "";
77
77
  for (let o = 0; o < t.length; o++)
78
78
  o > 0 && (t.length - o) % 3 === 0 && (r += n), r += t[o];
79
79
  return r;
80
80
  }
81
- function C(t, n, r) {
81
+ function b(t, n, r) {
82
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] ?? "-" : "-");
83
+ for (let c = 0; c < n.length && e < t.length; c++)
84
+ o += t.substring(e, e + n[c]), e += n[c], c < n.length - 1 && e < t.length && (o += r ? r[c] ?? "-" : "-");
85
85
  return o;
86
86
  }
87
- function h(t, n, r) {
88
- var s;
89
- const o = D(String(t ?? ""));
87
+ function w(t, n, r) {
88
+ var c;
89
+ const o = h(String(t ?? ""));
90
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;
91
+ const e = (c = S[n]) == null ? void 0 : c[r];
92
+ return e ? e.rutFormat ? o.length < 2 ? o : T(o.slice(0, -1), e.thousandsSep || ".") + "-" + o.slice(-1) : e.thousandsSep ? T(o, e.thousandsSep) : e.mask ? b(o, e.mask, e.separators ?? null) : o : o;
93
93
  }
94
- function $(t, n) {
94
+ function L(t, n) {
95
95
  var o;
96
96
  if (!t || !t.value) return;
97
97
  if (t.columnType === "relation") {
98
- const e = x(n, t.relationPath);
99
- return m(e);
98
+ const e = N(n, t.relationPath);
99
+ return p(e);
100
100
  }
101
101
  if (t.columnType === "function") {
102
102
  const e = (o = t.columnFunction) == null ? void 0 : o.call(t, n, t);
103
- return m(e);
103
+ return p(e);
104
104
  }
105
105
  const r = n == null ? void 0 : n[t.value];
106
- return m(r);
106
+ return p(r);
107
107
  }
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()}`);
108
+ function C(t, n, r, o) {
109
+ var g, y, k, _;
110
+ const e = h(String(t ?? ""));
111
+ if (!e) return e;
112
+ if (!n || !(r != null && r.length))
113
+ return console.warn("[KunTable][doc] sin documentTypeId o documentTypes vacío:", { documentTypeId: n, documentTypesLen: r == null ? void 0 : r.length }), e;
114
+ const c = r.find((a) => a.id == n);
115
+ if (!c)
116
+ return console.warn("[KunTable][doc] no se encontró docType con id:", n, "| disponibles:", r.map((a) => a.id)), e;
117
+ const i = c.country_id ?? ((g = c.country) == null ? void 0 : g.id);
118
+ let s = null;
119
+ if (i && (o != null && o.length)) {
120
+ const a = o.find((D) => D.id == i), f = (a == null ? void 0 : a.iso2) || (a == null ? void 0 : a.iso_code) || (a == null ? void 0 : a.code);
121
+ console.log("[KunTable][doc] country_id:", i, "| country:", a, "| iso2:", f), f && (s = `doc_${f.toLowerCase()}`);
122
+ } else
123
+ console.warn("[KunTable][doc] sin countryId o countries vacío:", { countryId: i, countriesLen: o == null ? void 0 : o.length });
124
+ if (!s) {
125
+ const a = c.country_iso2 || ((y = c.country) == null ? void 0 : y.iso2);
126
+ a && (s = `doc_${a.toLowerCase()}`);
119
127
  }
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;
128
+ const u = ((k = c.short_name) == null ? void 0 : k.toLowerCase()) || ((_ = c.name) == null ? void 0 : _.toLowerCase());
129
+ return console.log("[KunTable][doc] docType:", JSON.stringify(c), "| docCode:", s, "| docFormat:", u, "| value:", t), !s || !u ? e : w(t, s, u);
127
130
  }
128
- function L(t, n, r = null) {
129
- var e, s;
131
+ function K(t, n, r = null) {
132
+ var e, c, i, s;
130
133
  if (t.columnType === "toComplete") return "";
131
134
  if (n == null) return "Sin datos";
132
135
  if (t.columnType === "dateTime" || t.columnType === "date")
133
- return (u[t.columnType] || u.default)(n);
136
+ return (l[t.columnType] || l.default)(n);
134
137
  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);
138
+ const u = (r == null ? void 0 : r.document_type_id) ?? ((e = r == null ? void 0 : r.entity) == null ? void 0 : e.document_type_id) ?? null;
139
+ return console.log("[KunTable][doc] formatValue — header.value:", t.value, "| docTypeId:", u, "| value:", n, "| documentTypes len:", (c = m.documentTypes) == null ? void 0 : c.length, "| countries len:", (i = m.countries) == null ? void 0 : i.length), C(n, u, m.documentTypes, m.countries);
137
140
  }
138
- return (s = t.columnType) != null && s.startsWith("doc_") ? h(n, t.columnType, t.columnFormat) : (u[t.columnFormat] || u.default)(n);
141
+ return (s = t.columnType) != null && s.startsWith("doc_") ? w(n, t.columnType, t.columnFormat) : (l[t.columnFormat] || l.default)(n);
139
142
  }
140
- const u = {
143
+ const l = {
141
144
  default: (t) => t,
142
145
  // TEXTS
143
146
  text: (t) => String(t),
@@ -146,11 +149,11 @@ const u = {
146
149
  // ya está procesado por getComposedValue
147
150
  // NUMBERS - Usa config global directamente
148
151
  number: (t) => {
149
- const n = l.locale;
152
+ const n = d.locale;
150
153
  return Number(t).toLocaleString(n);
151
154
  },
152
155
  money: (t) => {
153
- const n = l.current, r = n.locale, o = n.precision, e = n.currency;
156
+ const n = d.current, r = n.locale, o = n.precision, e = n.currency;
154
157
  return new Intl.NumberFormat(r, {
155
158
  style: "currency",
156
159
  currency: e.value,
@@ -163,21 +166,21 @@ const u = {
163
166
  noCeros: (t) => parseFloat(t ?? 0),
164
167
  percentage: (t) => `${parseFloat(t ?? 0)}%`,
165
168
  date: (t) => {
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, {
169
+ var s;
170
+ if (!t || t === "0000-00-00" || !F(t)) return "Nunca";
171
+ const [n, r, o] = t.split("-").map(Number), e = new Date(n, r - 1, o, 12, 0, 0), c = d.current, i = c.locale;
172
+ return new Intl.DateTimeFormat(i, {
170
173
  weekday: "short",
171
174
  day: "2-digit",
172
175
  month: "short",
173
176
  year: "2-digit",
174
- ...(i = s.date) == null ? void 0 : i.dateFormat
177
+ ...(s = c.date) == null ? void 0 : s.dateFormat
175
178
  }).format(e);
176
179
  },
177
180
  dateTime: (t) => {
178
181
  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;
182
+ if (!t || t === "0000-00-00" || !F(t)) return "Nunca";
183
+ const n = new Date(t), r = d.current, o = r.locale;
181
184
  return new Intl.DateTimeFormat(o, {
182
185
  weekday: "short",
183
186
  day: "2-digit",
@@ -192,24 +195,24 @@ const u = {
192
195
  },
193
196
  secondsToTime: (t) => I(t ?? 0)
194
197
  };
195
- function x(t, n) {
198
+ function N(t, n) {
196
199
  return !t || !n ? t : n.split(".").reduce((r, o) => r == null ? void 0 : r[o], t);
197
200
  }
198
201
  function I(t) {
199
202
  const n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), o = t % 60;
200
203
  return `${n} horas, ${r} minutos y ${o} segundos`;
201
204
  }
202
- function m(t) {
205
+ function p(t) {
203
206
  if (t != null && !(t === "null" || t === "undefined"))
204
207
  return t;
205
208
  }
206
- function T(t) {
209
+ function F(t) {
207
210
  const n = new Date(t);
208
211
  return !isNaN(n.getTime());
209
212
  }
210
213
  export {
211
- L as formatValue,
212
- u as formatters,
213
- x as getNestedValue,
214
- $ as getValue
214
+ K as formatValue,
215
+ l as formatters,
216
+ N as getNestedValue,
217
+ L as getValue
215
218
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.588",
3
+ "version": "0.1.589",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",