adverich-kun-ui 0.1.367 → 0.1.368

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,20 +1,20 @@
1
1
  import { ref as o, computed as M, watch as H, nextTick as F } from "vue";
2
- import { isArray as j, isObject as b, fullCopy as L } from "../../../../utils/utils.js";
3
- function U(t, h, c, s) {
4
- const l = o(null), d = o(null), y = o(null), f = o(!1), v = o(""), N = (e, n) => n.split(".").reduce((u, r) => u && u[r] !== void 0 ? u[r] : null, e), V = M(() => l.value ? j(l.value) ? l.value.length ? x(l.value, t.itemTitle, "hasDefault") : t.placeholderText : b(l.value) ? x(l.value, t.itemTitle, "hasDefault") : l.value.toString() : s.value.length ? t.placeholderText : t.textNoItems), B = M(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
5
- function x(e, n, u) {
2
+ import { isArray as j, isObject as h, fullCopy as L } from "../../../../utils/utils.js";
3
+ function U(t, x, i, s) {
4
+ const l = o(null), d = o(null), y = o(null), f = o(!1), v = o(""), N = (e, n) => n.split(".").reduce((u, r) => u && u[r] !== void 0 ? u[r] : null, e), B = M(() => l.value ? j(l.value) ? l.value.length ? O(l.value, t.itemTitle, "hasDefault") : t.placeholderText : h(l.value) ? O(l.value, t.itemTitle, "hasDefault") : l.value.toString() : s.value.length ? t.placeholderText : t.textNoItems), R = M(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
5
+ function O(e, n, u) {
6
6
  var r;
7
- if (b(e)) {
7
+ if (h(e)) {
8
8
  if (n) {
9
9
  if (j(n))
10
- return n.map((i) => e[i] ?? "No definido").join(" - ");
10
+ return n.map((c) => e[c] ?? "No definido").join(" - ");
11
11
  if (n.includes(","))
12
- return n.split(",").map((i) => e[i]).join(" - ");
12
+ return n.split(",").map((c) => e[c]).join(" - ");
13
13
  if (n.includes(".")) {
14
- const i = n.split(".");
14
+ const c = n.split(".");
15
15
  let a = e;
16
- for (const O of i)
17
- a = a[O];
16
+ for (const b of c)
17
+ a = a[b];
18
18
  return a;
19
19
  }
20
20
  return !t.returnObject && typeof e[n] == "number" || e[n] !== void 0 && e[n] !== null ? e[n].toString() : "";
@@ -22,30 +22,30 @@ function U(t, h, c, s) {
22
22
  if (u)
23
23
  return Object.values(e)[0];
24
24
  }
25
- return j(e) ? t.returnObject ? e.map((i) => i[n]).join(" - ") : e.map((i) => i).join(" - ") : u && typeof e != "number" ? e.includes(",") ? e.split(",") : e : ((r = e == null ? void 0 : e.toString) == null ? void 0 : r.call(e)) ?? "";
25
+ return j(e) ? t.returnObject ? e.map((c) => c[n]).join(" - ") : e.map((c) => c).join(" - ") : u && typeof e != "number" ? e.includes(",") ? e.split(",") : e : ((r = e == null ? void 0 : e.toString) == null ? void 0 : r.call(e)) ?? "";
26
26
  }
27
- function R(e) {
27
+ function V(e) {
28
28
  try {
29
29
  let n = null;
30
30
  if (l.value = L(e), !t.multiple)
31
- t.returnObject ? n = e : b(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, f.value = !1, g();
31
+ t.returnObject ? n = e : h(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, f.value = !1, g();
32
32
  else if (S(e))
33
- e && T(e);
33
+ e && I(e);
34
34
  else {
35
- const u = t.returnObject ? e : b(e) ? t.itemValue ? e[t.itemValue] : Object.values(e)[0] : e;
36
- n = [...c.value || [], u];
35
+ const u = t.returnObject ? e : h(e) ? t.itemValue ? e[t.itemValue] : Object.values(e)[0] : e;
36
+ n = [...i.value || [], u];
37
37
  }
38
- c.value === n ? h("update:modelValue", n) : c.value = n, h("selectedItem", l.value);
38
+ i.value === n ? x("update:modelValue", n) : i.value = n, x("selectedItem", l.value);
39
39
  } catch (n) {
40
40
  console.log(n);
41
41
  } finally {
42
42
  F(() => {
43
- I();
43
+ T();
44
44
  });
45
45
  }
46
46
  }
47
47
  H(
48
- [() => c.value, () => s.value],
48
+ [() => i.value, () => s.value],
49
49
  ([e]) => {
50
50
  const n = C(e);
51
51
  JSON.stringify(l.value) !== JSON.stringify(n) && (l.value = n);
@@ -58,23 +58,24 @@ function U(t, h, c, s) {
58
58
  ) ?? e;
59
59
  }
60
60
  function S(e) {
61
- return c.value === null ? !1 : e ? c.value.some(
61
+ return i.value === null ? !1 : e ? i.value.some(
62
62
  (n) => t.returnObject ? n[t.itemValue] === e[t.itemValue] : n === e[t.itemValue]
63
63
  ) : !0;
64
64
  }
65
- function T(e) {
66
- let n = c.value;
65
+ function I(e) {
66
+ let n = [...i.value];
67
67
  if (t.returnObject) {
68
- const u = n.find(
69
- (i) => i[t.itemValue] === e[t.itemValue]
70
- ), r = n.indexOf(u);
71
- n.splice(r, 1);
68
+ const u = n.findIndex(
69
+ (r) => r[t.itemValue] === e[t.itemValue]
70
+ );
71
+ u !== -1 && n.splice(u, 1);
72
72
  } else {
73
73
  const u = n.indexOf(e[t.itemValue]);
74
- n.splice(u, 1);
74
+ u !== -1 && n.splice(u, 1);
75
75
  }
76
+ i.value = n;
76
77
  }
77
- function I(e) {
78
+ function T(e) {
78
79
  t.clearSearchOnSelect && (v.value = ""), t.clearOnSelect && w(), t.focusOnSelect && g();
79
80
  }
80
81
  function A() {
@@ -101,20 +102,20 @@ function U(t, h, c, s) {
101
102
  var r;
102
103
  const u = (r = d.value) == null ? void 0 : r.inputField;
103
104
  if (u) {
104
- const i = u.selectionStart, a = u.selectionEnd, O = u.value, E = e.key.length === 1 ? e.key : "";
105
- u.value = O.slice(0, i) + E + O.slice(a), u.selectionStart = u.selectionEnd = i + E.length, u.dispatchEvent(new Event("input", { bubbles: !0 }));
105
+ const c = u.selectionStart, a = u.selectionEnd, b = u.value, E = e.key.length === 1 ? e.key : "";
106
+ u.value = b.slice(0, c) + E + b.slice(a), u.selectionStart = u.selectionEnd = c + E.length, u.dispatchEvent(new Event("input", { bubbles: !0 }));
106
107
  }
107
108
  }));
108
109
  }
109
110
  function q() {
110
- f.value = !1, h("createItem");
111
+ f.value = !1, x("createItem");
111
112
  }
112
113
  function z(e) {
113
- let n = c.value.indexOf(e);
114
- c.value.splice(n, 1);
114
+ let n = i.value.indexOf(e);
115
+ i.value.splice(n, 1);
115
116
  }
116
117
  function w() {
117
- console.log(c.value), v.value !== "" && (v.value = ""), c.value !== null && (c.value = null), l.value !== null && (l.value = null);
118
+ console.log(i.value), v.value !== "" && (v.value = ""), i.value !== null && (i.value = null), l.value !== null && (l.value = null);
118
119
  }
119
120
  function G(e) {
120
121
  return !!e.disabled;
@@ -126,13 +127,13 @@ function U(t, h, c, s) {
126
127
  menuModel: f,
127
128
  search: v,
128
129
  getItemText: N,
129
- placeholder: V,
130
- textArr: B,
131
- itemToString: x,
132
- getSelectedItem: R,
130
+ placeholder: B,
131
+ textArr: R,
132
+ itemToString: O,
133
+ getSelectedItem: V,
133
134
  checkIfValueExist: S,
134
- removeFromArray: T,
135
- lightReset: I,
135
+ removeFromArray: I,
136
+ lightReset: T,
136
137
  openMenu: A,
137
138
  closeMenu: D,
138
139
  toggleMenu: J,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.367",
3
+ "version": "0.1.368",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",