adverich-kun-ui 0.1.99 → 0.1.101

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__ */ $(["update:modelValue", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
27
+ emits: /* @__PURE__ */ $(["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 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);
1
+ import { ref as f, computed as A, watch as z } from "vue";
2
+ import { isArray as b, isObject as a } from "../../../../utils/utils.js";
3
+ function J(t, M, u, s, C) {
4
+ const i = f(null), o = f(null), j = f(null), c = f(!1), v = 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);
5
5
  function h(e, n, r) {
6
6
  if (a(e)) {
7
7
  if (n) {
8
- if (g(n))
8
+ if (b(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 d = e;
14
+ let g = e;
15
15
  for (const q of l)
16
- d = d[q];
17
- return d;
16
+ g = g[q];
17
+ return g;
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 g(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 b(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
- 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);
28
+ x.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 ? u.value = e[t.itemValue] : u.value = Object.values(e)[0] : u.value = e, c.value = !1), t.clearOnSelect && T(), x.value = !0;
29
29
  } catch (n) {
30
30
  console.log(n);
31
31
  } finally {
32
32
  O();
33
33
  }
34
34
  }
35
- const x = c(!0);
35
+ const x = f(!0);
36
36
  z(() => u.value, (e) => {
37
- x.value && (i.value = R(e));
37
+ console.log("a"), console.log(u.value), x.value && (i.value = R(e));
38
38
  }, { immediate: !0 });
39
39
  function R(e) {
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;
40
+ return e ? (console.log("b"), console.log(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 I(e) {
42
+ function d(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 y(e) {
47
+ function I(e) {
48
48
  if (t.returnObject) {
49
49
  const n = u.value.find(
50
50
  (l) => l[t.itemValue] === e[t.itemValue]
@@ -58,61 +58,61 @@ function J(t, b, u, s, C) {
58
58
  function D(e) {
59
59
  t.clearSearchOnSelect && (v.value = ""), t.focusOnSelect && O();
60
60
  }
61
- function S() {
62
- f.value || (f.value = !0);
61
+ function y() {
62
+ c.value || (c.value = !0);
63
63
  }
64
64
  function N() {
65
- f.value = !f.value;
65
+ c.value = !c.value;
66
66
  }
67
- function T(e) {
67
+ function S(e) {
68
68
  return e.length === 1 && e.match(/\w/);
69
69
  }
70
70
  function O() {
71
71
  o.value.inputField.focus();
72
72
  }
73
- function E() {
74
- f.value = !0, j.value && o.value.$el.focus();
73
+ function m() {
74
+ c.value = !0, j.value && o.value.$el.focus();
75
75
  }
76
- function K(e) {
76
+ function E(e) {
77
77
  const n = e.key;
78
- (T(n) || n === "Backspace") && (S(), O());
78
+ (S(n) || n === "Backspace") && (y(), O());
79
79
  }
80
- function P() {
81
- f.value = !1, b("createItem");
80
+ function K() {
81
+ c.value = !1, M("createItem");
82
82
  }
83
- function $(e) {
83
+ function P(e) {
84
84
  let n = u.value.indexOf(e);
85
85
  u.value.splice(n, 1);
86
86
  }
87
- function A() {
87
+ function T() {
88
88
  v.value = "", u.value = null, i.value = null;
89
89
  }
90
- function m(e) {
90
+ function $(e) {
91
91
  return !!e.disabledItem;
92
92
  }
93
93
  return {
94
94
  selectedItem: i,
95
95
  textFieldRef: o,
96
96
  listRef: j,
97
- menuModel: f,
97
+ menuModel: c,
98
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: I,
105
- removeFromArray: y,
104
+ checkIfValueExist: d,
105
+ removeFromArray: I,
106
106
  lightReset: D,
107
- openMenu: S,
107
+ openMenu: y,
108
108
  toggleMenu: N,
109
- focusOnMenu: E,
110
- onMenuKeydown: K,
111
- createItem: P,
112
- removeItem: $,
113
- clearSelection: A,
114
- checkDisabled: m,
115
- isAlphanumeric: T
109
+ focusOnMenu: m,
110
+ onMenuKeydown: E,
111
+ createItem: K,
112
+ removeItem: P,
113
+ clearSelection: T,
114
+ checkDisabled: $,
115
+ isAlphanumeric: S
116
116
  };
117
117
  }
118
118
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.99",
3
+ "version": "0.1.101",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",