adverich-kun-ui 0.1.368 → 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,82 +1,74 @@
1
1
  import { ref as o, computed as M, watch as H, nextTick as F } from "vue";
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) {
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 (h(e)) {
8
- if (n) {
9
- if (j(n))
10
- return n.map((c) => e[c] ?? "No definido").join(" - ");
11
- if (n.includes(","))
12
- return n.split(",").map((c) => e[c]).join(" - ");
13
- if (n.includes(".")) {
14
- const c = 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
16
  for (const b of c)
17
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((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)) ?? "";
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
27
  function V(e) {
28
28
  try {
29
- let n = null;
30
- if (l.value = L(e), !t.multiple)
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
- else if (S(e))
33
- e && I(e);
34
- else {
35
- const u = t.returnObject ? e : h(e) ? t.itemValue ? e[t.itemValue] : Object.values(e)[0] : e;
36
- n = [...i.value || [], u];
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
+ e && T(e);
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
- i.value === n ? x("update:modelValue", n) : i.value = n, x("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
- T();
44
+ I();
44
45
  });
45
46
  }
46
47
  }
47
48
  H(
48
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 i.value === null ? !1 : e ? i.value.some(
62
- (n) => t.returnObject ? n[t.itemValue] === e[t.itemValue] : n === e[t.itemValue]
63
- ) : !0;
64
- }
65
- function I(e) {
66
- let n = [...i.value];
67
- if (t.returnObject) {
68
- const u = n.findIndex(
69
- (r) => r[t.itemValue] === e[t.itemValue]
70
- );
71
- u !== -1 && n.splice(u, 1);
72
- } else {
73
- const u = n.indexOf(e[t.itemValue]);
74
- u !== -1 && n.splice(u, 1);
75
- }
76
- i.value = n;
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);
77
65
  }
78
66
  function T(e) {
79
- t.clearSearchOnSelect && (v.value = ""), t.clearOnSelect && w(), t.focusOnSelect && g();
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;
69
+ }
70
+ function I(e) {
71
+ n.clearSearchOnSelect && (v.value = ""), n.clearOnSelect && w(), n.focusOnSelect && g();
80
72
  }
81
73
  function A() {
82
74
  f.value || (f.value = !0);
@@ -97,8 +89,8 @@ function U(t, x, i, s) {
97
89
  f.value = !0, y.value && d.value.$el.focus();
98
90
  }
99
91
  function $(e) {
100
- const n = e.key;
101
- (k(n) || n === "Backspace") && (A(), g(), F(() => {
92
+ const t = e.key;
93
+ (k(t) || t === "Backspace") && (A(), g(), F(() => {
102
94
  var r;
103
95
  const u = (r = d.value) == null ? void 0 : r.inputField;
104
96
  if (u) {
@@ -108,14 +100,14 @@ function U(t, x, i, s) {
108
100
  }));
109
101
  }
110
102
  function q() {
111
- f.value = !1, x("createItem");
103
+ f.value = !1, h("createItem");
112
104
  }
113
105
  function z(e) {
114
- let n = i.value.indexOf(e);
115
- i.value.splice(n, 1);
106
+ let t = i.value.indexOf(e);
107
+ i.value.splice(t, 1);
116
108
  }
117
109
  function w() {
118
- console.log(i.value), v.value !== "" && (v.value = ""), i.value !== null && (i.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);
119
111
  }
120
112
  function G(e) {
121
113
  return !!e.disabled;
@@ -129,11 +121,11 @@ function U(t, x, i, s) {
129
121
  getItemText: N,
130
122
  placeholder: B,
131
123
  textArr: R,
132
- itemToString: O,
124
+ itemToString: j,
133
125
  getSelectedItem: V,
134
126
  checkIfValueExist: S,
135
- removeFromArray: I,
136
- lightReset: T,
127
+ removeFromArray: T,
128
+ lightReset: I,
137
129
  openMenu: A,
138
130
  closeMenu: D,
139
131
  toggleMenu: J,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.368",
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",