adverich-kun-ui 0.1.435 → 0.1.436

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