adverich-kun-ui 0.1.104 → 0.1.105

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,42 +1,42 @@
1
1
  import { ref as c, computed as M, watch as m } from "vue";
2
- import { isArray as b, isObject as v } from "../../../../utils/utils.js";
2
+ import { isArray as d, isObject as s } from "../../../../utils/utils.js";
3
3
  function J(t, w, u, a, C) {
4
- const l = c(null), o = c(null), j = c(null), f = c(!1), h = c(""), F = (e, n) => n.split(".").reduce((r, i) => r && r[i] !== void 0 ? r[i] : null, e), k = M(() => l.value ? b(l.value) ? l.value.length ? x(l.value, t.itemTitle, "hasDefault") : t.placeholderText : v(l.value) ? x(l.value, t.itemTitle, "hasDefault") : l.value.toString() : a.value.length ? t.placeholderText : t.textNoItems), B = M(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
5
- function x(e, n, r) {
6
- if (v(e)) {
4
+ const l = c(null), v = c(null), j = c(null), f = c(!1), o = c(""), F = (e, n) => n.split(".").reduce((r, i) => r && r[i] !== void 0 ? r[i] : null, e), k = M(() => l.value ? d(l.value) ? l.value.length ? h(l.value, t.itemTitle, "hasDefault") : t.placeholderText : s(l.value) ? h(l.value, t.itemTitle, "hasDefault") : l.value.toString() : a.value.length ? t.placeholderText : t.textNoItems), B = M(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
5
+ function h(e, n, r) {
6
+ if (s(e)) {
7
7
  if (n) {
8
- if (b(n))
8
+ if (d(n))
9
9
  return n.map((i) => e[i] ?? "No definido").join(" - ");
10
10
  if (n.includes(","))
11
11
  return n.split(",").map((i) => e[i]).join(" - ");
12
12
  if (n.includes(".")) {
13
13
  const i = n.split(".");
14
- let d = e;
14
+ let b = e;
15
15
  for (const z of i)
16
- d = d[z];
17
- return d;
16
+ b = b[z];
17
+ return b;
18
18
  }
19
19
  return !t.returnObject && typeof e[n] == "number" || e[n] ? e[n].toString() : "";
20
20
  }
21
21
  if (r)
22
22
  return Object.values(e)[0];
23
23
  }
24
- return b(e) ? t.returnObject ? e.map((i) => i[n]).join(" - ") : e.map((i) => i).join(" - ") : r && typeof e != "number" && e.includes(",") ? e.split(",") : e;
24
+ return d(e) ? t.returnObject ? e.map((i) => i[n]).join(" - ") : e.map((i) => i).join(" - ") : r && typeof e != "number" && e.includes(",") ? e.split(",") : e;
25
25
  }
26
26
  function R(e) {
27
27
  try {
28
- s.value = !1, l.value = e, t.multiple ? (u.value || (u.value = []), I(e) ? e && y(e) : t.returnObject ? u.value.push(e) : v(e) ? t.itemValue ? u.value.push(e[t.itemValue]) : u.value.push(Object.values(e)[0]) : u.value.push(e)) : (t.returnObject ? u.value = e : v(e) ? t.itemValue ? u.value = e[t.itemValue] : u.value = Object.values(e)[0] : u.value = e, f.value = !1), t.clearOnSelect && A(), s.value = !0;
28
+ x.value = !1, l.value = e, t.multiple ? (u.value || (u.value = []), I(e) ? e && y(e) : t.returnObject ? u.value.push(e) : s(e) ? t.itemValue ? u.value.push(e[t.itemValue]) : u.value.push(Object.values(e)[0]) : u.value.push(e)) : (t.returnObject ? u.value = e : s(e) ? t.itemValue ? u.value = e[t.itemValue] : u.value = Object.values(e)[0] : u.value = e, f.value = !1), t.clearOnSelect && A(), x.value = !0;
29
29
  } catch (n) {
30
30
  console.log(n);
31
31
  } finally {
32
32
  O();
33
33
  }
34
34
  }
35
- const s = c(!0);
35
+ const x = c(!0);
36
36
  m(() => u.value, (e) => {
37
- s.value && (l.value = g(e));
38
- }, { immediate: !0 }), m(() => a.value, (e) => {
39
- s.value && (l.value = g(e));
37
+ x.value && (l.value = g(e));
38
+ }, { immediate: !0 }), m(() => a.value, () => {
39
+ l.value = g(u.value);
40
40
  }, { immediate: !0 });
41
41
  function g(e) {
42
42
  return e ? t.returnObject ? e : t.multiple && Array.isArray(e) ? e.map((r) => a.value.find((i) => i[t.itemValue] === r)).filter(Boolean) : a.value.find((r) => r[t.itemValue] === e) || null : null;
@@ -58,7 +58,7 @@ function J(t, w, u, a, C) {
58
58
  }
59
59
  }
60
60
  function D(e) {
61
- t.clearSearchOnSelect && (h.value = ""), t.focusOnSelect && O();
61
+ t.clearSearchOnSelect && (o.value = ""), t.focusOnSelect && O();
62
62
  }
63
63
  function S() {
64
64
  f.value || (f.value = !0);
@@ -70,10 +70,10 @@ function J(t, w, u, a, C) {
70
70
  return e.length === 1 && e.match(/\w/);
71
71
  }
72
72
  function O() {
73
- o.value.inputField.focus();
73
+ v.value.inputField.focus();
74
74
  }
75
75
  function E() {
76
- f.value = !0, j.value && o.value.$el.focus();
76
+ f.value = !0, j.value && v.value.$el.focus();
77
77
  }
78
78
  function K(e) {
79
79
  const n = e.key;
@@ -87,21 +87,21 @@ function J(t, w, u, a, C) {
87
87
  u.value.splice(n, 1);
88
88
  }
89
89
  function A() {
90
- h.value = "", u.value = null, l.value = null;
90
+ o.value = "", u.value = null, l.value = null;
91
91
  }
92
92
  function q(e) {
93
93
  return !!e.disabledItem;
94
94
  }
95
95
  return {
96
96
  selectedItem: l,
97
- textFieldRef: o,
97
+ textFieldRef: v,
98
98
  listRef: j,
99
99
  menuModel: f,
100
- search: h,
100
+ search: o,
101
101
  getItemText: F,
102
102
  placeholder: k,
103
103
  textArr: B,
104
- itemToString: x,
104
+ itemToString: h,
105
105
  getSelectedItem: R,
106
106
  checkIfValueExist: I,
107
107
  removeFromArray: y,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.104",
3
+ "version": "0.1.105",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",