adverich-kun-ui 0.1.98 → 0.1.100

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