adverich-kun-ui 0.1.292 → 0.1.293

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