adverich-kun-ui 0.1.97 → 0.1.99

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