adverich-kun-ui 0.1.367 → 0.1.369

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,43 +1,44 @@
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 x, isObject as O, fullCopy as L } from "../../../../utils/utils.js";
3
+ function U(n, h, i, s) {
4
+ const l = o(null), d = o(null), y = o(null), f = o(!1), v = o(""), N = (e, t) => t.split(".").reduce((u, r) => u && u[r] !== void 0 ? u[r] : null, e), B = M(() => l.value ? x(l.value) ? l.value.length ? j(l.value, n.itemTitle, "hasDefault") : n.placeholderText : O(l.value) ? j(l.value, n.itemTitle, "hasDefault") : l.value.toString() : s.value.length ? n.placeholderText : n.textNoItems), R = M(() => n.itemText.includes(",") ? n.itemText.split(",") : n.itemText);
5
+ function j(e, t, u) {
6
6
  var r;
7
- if (b(e)) {
8
- if (n) {
9
- if (j(n))
10
- return n.map((i) => e[i] ?? "No definido").join(" - ");
11
- if (n.includes(","))
12
- return n.split(",").map((i) => e[i]).join(" - ");
13
- if (n.includes(".")) {
14
- const i = n.split(".");
7
+ if (O(e)) {
8
+ if (t) {
9
+ if (x(t))
10
+ return t.map((c) => e[c] ?? "No definido").join(" - ");
11
+ if (t.includes(","))
12
+ return t.split(",").map((c) => e[c]).join(" - ");
13
+ if (t.includes(".")) {
14
+ const c = t.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
- return !t.returnObject && typeof e[n] == "number" || e[n] !== void 0 && e[n] !== null ? e[n].toString() : "";
20
+ return !n.returnObject && typeof e[t] == "number" || e[t] !== void 0 && e[t] !== null ? e[t].toString() : "";
21
21
  }
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 x(e) ? n.returnObject ? e.map((c) => c[t]).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
- let n = null;
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();
32
- else if (S(e))
29
+ let t = null;
30
+ if (l.value = L(e), !n.multiple)
31
+ n.returnObject ? t = e : O(e) ? n.itemValue ? t = e[n.itemValue] : t = Object.values(e)[0] : t = e, f.value = !1, g();
32
+ else if (S(e)) {
33
33
  e && T(e);
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];
34
+ return;
35
+ } else {
36
+ const u = n.returnObject ? e : O(e) ? n.itemValue ? e[n.itemValue] : Object.values(e)[0] : e;
37
+ t = [...i.value || [], u];
37
38
  }
38
- c.value === n ? h("update:modelValue", n) : c.value = n, h("selectedItem", l.value);
39
- } catch (n) {
40
- console.log(n);
39
+ i.value === t ? h("update:modelValue", t) : i.value = t, h("selectedItem", l.value);
40
+ } catch (t) {
41
+ console.log(t);
41
42
  } finally {
42
43
  F(() => {
43
44
  I();
@@ -45,37 +46,29 @@ function U(t, h, c, s) {
45
46
  }
46
47
  }
47
48
  H(
48
- [() => c.value, () => s.value],
49
+ [() => i.value, () => s.value],
49
50
  ([e]) => {
50
- const n = C(e);
51
- JSON.stringify(l.value) !== JSON.stringify(n) && (l.value = n);
51
+ const t = C(e);
52
+ JSON.stringify(l.value) !== JSON.stringify(t) && (l.value = t);
52
53
  },
53
54
  { immediate: !0 }
54
55
  );
55
56
  function C(e) {
56
- return e == null ? null : t.multiple && Array.isArray(e) ? t.returnObject ? e : e.map((u) => s.value.find((r) => r[t.itemValue] === u)).filter(Boolean) : t.returnObject ? e : s.value.find(
57
- (u) => typeof u == "object" ? u[t.itemValue] === e : u === e
57
+ return e == null ? null : n.multiple && Array.isArray(e) ? n.returnObject ? e : e.map((u) => s.value.find((r) => r[n.itemValue] === u)).filter(Boolean) : n.returnObject ? e : s.value.find(
58
+ (u) => typeof u == "object" ? u[n.itemValue] === e : u === e
58
59
  ) ?? e;
59
60
  }
60
61
  function S(e) {
61
- return c.value === null ? !1 : e ? c.value.some(
62
- (n) => t.returnObject ? n[t.itemValue] === e[t.itemValue] : n === e[t.itemValue]
63
- ) : !0;
62
+ if (!i.value || !e) return !1;
63
+ const t = n.returnObject ? e[n.itemValue] : e;
64
+ return i.value.some((u) => (n.returnObject ? u[n.itemValue] : u) === t);
64
65
  }
65
66
  function T(e) {
66
- let n = c.value;
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);
72
- } else {
73
- const u = n.indexOf(e[t.itemValue]);
74
- n.splice(u, 1);
75
- }
67
+ const t = n.returnObject ? e[n.itemValue] : e, u = i.value.filter((r) => (n.returnObject ? r[n.itemValue] : r) !== t);
68
+ i.value = u;
76
69
  }
77
70
  function I(e) {
78
- t.clearSearchOnSelect && (v.value = ""), t.clearOnSelect && w(), t.focusOnSelect && g();
71
+ n.clearSearchOnSelect && (v.value = ""), n.clearOnSelect && w(), n.focusOnSelect && g();
79
72
  }
80
73
  function A() {
81
74
  f.value || (f.value = !0);
@@ -96,13 +89,13 @@ function U(t, h, c, s) {
96
89
  f.value = !0, y.value && d.value.$el.focus();
97
90
  }
98
91
  function $(e) {
99
- const n = e.key;
100
- (k(n) || n === "Backspace") && (A(), g(), F(() => {
92
+ const t = e.key;
93
+ (k(t) || t === "Backspace") && (A(), g(), F(() => {
101
94
  var r;
102
95
  const u = (r = d.value) == null ? void 0 : r.inputField;
103
96
  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 }));
97
+ const c = u.selectionStart, a = u.selectionEnd, b = u.value, E = e.key.length === 1 ? e.key : "";
98
+ 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
99
  }
107
100
  }));
108
101
  }
@@ -110,11 +103,11 @@ function U(t, h, c, s) {
110
103
  f.value = !1, h("createItem");
111
104
  }
112
105
  function z(e) {
113
- let n = c.value.indexOf(e);
114
- c.value.splice(n, 1);
106
+ let t = i.value.indexOf(e);
107
+ i.value.splice(t, 1);
115
108
  }
116
109
  function w() {
117
- console.log(c.value), v.value !== "" && (v.value = ""), c.value !== null && (c.value = null), l.value !== null && (l.value = null);
110
+ v.value !== "" && (v.value = ""), i.value !== null && (i.value = null), l.value !== null && (l.value = null);
118
111
  }
119
112
  function G(e) {
120
113
  return !!e.disabled;
@@ -126,10 +119,10 @@ function U(t, h, c, s) {
126
119
  menuModel: f,
127
120
  search: v,
128
121
  getItemText: N,
129
- placeholder: V,
130
- textArr: B,
131
- itemToString: x,
132
- getSelectedItem: R,
122
+ placeholder: B,
123
+ textArr: R,
124
+ itemToString: j,
125
+ getSelectedItem: V,
133
126
  checkIfValueExist: S,
134
127
  removeFromArray: T,
135
128
  lightReset: I,
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.369",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",