adverich-kun-ui 0.1.291 → 0.1.293

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,19 +1,19 @@
1
- import { ref as a, computed as M, watch as H, nextTick as w } from "vue";
2
- import { isArray as O, isObject as v, fullCopy as J } from "../../../../utils/utils.js";
1
+ import { ref as a, computed as E, watch as G, nextTick as M } from "vue";
2
+ import { isArray as b, isObject as v, fullCopy as H } from "../../../../utils/utils.js";
3
3
  function Q(n, h, c, o) {
4
- const i = a(null), s = a(null), g = a(null), r = a(!1), d = a(""), F = (e, t) => t.split(".").reduce((u, l) => u && u[l] !== void 0 ? u[l] : null, e), V = M(() => i.value ? O(i.value) ? i.value.length ? x(i.value, n.itemTitle, "hasDefault") : n.placeholderText : v(i.value) ? x(i.value, n.itemTitle, "hasDefault") : i.value.toString() : o.value.length ? n.placeholderText : n.textNoItems), B = M(() => n.itemText.includes(",") ? n.itemText.split(",") : n.itemText);
4
+ const i = a(null), s = a(null), g = a(null), r = a(!1), d = a(""), F = (e, t) => t.split(".").reduce((u, l) => u && u[l] !== void 0 ? u[l] : null, e), N = E(() => i.value ? b(i.value) ? i.value.length ? x(i.value, n.itemTitle, "hasDefault") : n.placeholderText : v(i.value) ? x(i.value, n.itemTitle, "hasDefault") : i.value.toString() : o.value.length ? n.placeholderText : n.textNoItems), V = E(() => n.itemText.includes(",") ? n.itemText.split(",") : n.itemText);
5
5
  function x(e, t, u) {
6
6
  if (v(e)) {
7
7
  if (t) {
8
- if (O(t))
8
+ if (b(t))
9
9
  return t.map((l) => e[l] ?? "No definido").join(" - ");
10
10
  if (t.includes(","))
11
11
  return t.split(",").map((l) => e[l]).join(" - ");
12
12
  if (t.includes(".")) {
13
13
  const l = t.split(".");
14
14
  let f = e;
15
- for (const b of l)
16
- f = f[b];
15
+ for (const O of l)
16
+ f = f[O];
17
17
  return f;
18
18
  }
19
19
  return !n.returnObject && typeof e[t] == "number" || e[t] !== void 0 && e[t] !== null ? e[t].toString() : "";
@@ -21,12 +21,12 @@ function Q(n, h, c, o) {
21
21
  if (u)
22
22
  return Object.values(e)[0];
23
23
  }
24
- return O(e) ? n.returnObject ? e.map((l) => l[t]).join(" - ") : e.map((l) => l).join(" - ") : u && typeof e != "number" && e.includes(",") ? e.split(",") : e;
24
+ return b(e) ? n.returnObject ? e.map((l) => l[t]).join(" - ") : e.map((l) => l).join(" - ") : u && typeof e != "number" && e.includes(",") ? e.split(",") : e;
25
25
  }
26
- function R(e) {
26
+ function B(e) {
27
27
  try {
28
28
  let t = null;
29
- if (i.value = J(e), !n.multiple)
29
+ if (i.value = H(e), !n.multiple)
30
30
  n.returnObject ? t = e : v(e) ? n.itemValue ? t = e[n.itemValue] : t = Object.values(e)[0] : t = e, r.value = !1;
31
31
  else if (j(e))
32
32
  e && y(e);
@@ -38,15 +38,20 @@ function Q(n, h, c, o) {
38
38
  } catch (t) {
39
39
  console.log(t);
40
40
  } finally {
41
- w(() => {
41
+ M(() => {
42
42
  S();
43
43
  });
44
44
  }
45
45
  }
46
- H(() => o.value, () => {
47
- i.value = C(c.value);
48
- }, { immediate: !0 });
49
- function C(e) {
46
+ G(
47
+ [() => c.value, () => o.value],
48
+ ([e]) => {
49
+ const t = R(e);
50
+ JSON.stringify(i.value) !== JSON.stringify(t) && (i.value = t);
51
+ },
52
+ { immediate: !0 }
53
+ );
54
+ function R(e) {
50
55
  return e == null ? null : n.returnObject ? e : n.multiple && Array.isArray(e) ? e.map((u) => o.value.find((l) => l[n.itemValue] === u)).filter(Boolean) : o.value.find((u) => u[n.itemValue] === e) || null;
51
56
  }
52
57
  function j(e) {
@@ -72,10 +77,10 @@ function Q(n, h, c, o) {
72
77
  function T() {
73
78
  r.value || (r.value = !0);
74
79
  }
75
- function D() {
80
+ function C() {
76
81
  r.value && (r.value = !1);
77
82
  }
78
- function N() {
83
+ function D() {
79
84
  r.value = !r.value;
80
85
  }
81
86
  function I(e) {
@@ -84,31 +89,31 @@ function Q(n, h, c, o) {
84
89
  function m() {
85
90
  s.value.inputField.focus();
86
91
  }
87
- function K() {
92
+ function J() {
88
93
  r.value = !0, g.value && s.value.$el.focus();
89
94
  }
90
- function $(e) {
95
+ function K(e) {
91
96
  const t = e.key;
92
- (I(t) || t === "Backspace") && (T(), m(), w(() => {
97
+ (I(t) || t === "Backspace") && (T(), m(), M(() => {
93
98
  var l;
94
99
  const u = (l = s.value) == null ? void 0 : l.inputField;
95
100
  if (u) {
96
- const f = u.selectionStart, b = u.selectionEnd, k = u.value, E = e.key.length === 1 ? e.key : "";
97
- u.value = k.slice(0, f) + E + k.slice(b), u.selectionStart = u.selectionEnd = f + E.length, u.dispatchEvent(new Event("input", { bubbles: !0 }));
101
+ const f = u.selectionStart, O = u.selectionEnd, k = u.value, w = e.key.length === 1 ? e.key : "";
102
+ u.value = k.slice(0, f) + w + k.slice(O), u.selectionStart = u.selectionEnd = f + w.length, u.dispatchEvent(new Event("input", { bubbles: !0 }));
98
103
  }
99
104
  }));
100
105
  }
101
- function q() {
106
+ function $() {
102
107
  r.value = !1, h("createItem");
103
108
  }
104
- function z(e) {
109
+ function q(e) {
105
110
  let t = c.value.indexOf(e);
106
111
  c.value.splice(t, 1);
107
112
  }
108
113
  function A() {
109
114
  console.log(c.value), d.value !== "" && (d.value = ""), c.value !== null && (c.value = null), i.value !== null && (i.value = null);
110
115
  }
111
- function G(e) {
116
+ function z(e) {
112
117
  return !!e.disabled;
113
118
  }
114
119
  return {
@@ -118,22 +123,22 @@ function Q(n, h, c, o) {
118
123
  menuModel: r,
119
124
  search: d,
120
125
  getItemText: F,
121
- placeholder: V,
122
- textArr: B,
126
+ placeholder: N,
127
+ textArr: V,
123
128
  itemToString: x,
124
- getSelectedItem: R,
129
+ getSelectedItem: B,
125
130
  checkIfValueExist: j,
126
131
  removeFromArray: y,
127
132
  lightReset: S,
128
133
  openMenu: T,
129
- closeMenu: D,
130
- toggleMenu: N,
131
- focusOnMenu: K,
132
- onMenuKeydown: $,
133
- createItem: q,
134
- removeItem: z,
134
+ closeMenu: C,
135
+ toggleMenu: D,
136
+ focusOnMenu: J,
137
+ onMenuKeydown: K,
138
+ createItem: $,
139
+ removeItem: q,
135
140
  clearSelection: A,
136
- checkDisabled: G,
141
+ checkDisabled: z,
137
142
  isAlphanumeric: I
138
143
  };
139
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.291",
3
+ "version": "0.1.293",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",