adverich-kun-ui 0.1.530 → 0.1.531

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