adverich-kun-ui 0.1.432 → 0.1.434

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,24 +1,24 @@
1
- import { mergeModels as z, useModel as R, onMounted as oe, ref as S, watch as ie, createElementBlock as v, openBlock as r, createVNode as n, unref as l, isRef as A, createSlots as ne, withCtx as i, createCommentVNode as k, Fragment as re, renderList as ae, createBlock as m, createElementVNode as se, createTextVNode as y, toDisplayString as I, normalizeClass as ue, withModifiers as de } from "vue";
1
+ import { mergeModels as z, useModel as R, onMounted as ie, ref as S, watch as ne, createElementBlock as v, openBlock as a, createVNode as n, unref as l, isRef as A, createSlots as re, withCtx as i, createCommentVNode as k, Fragment as ae, renderList as se, createBlock as m, createElementVNode as ue, createTextVNode as b, toDisplayString as I, normalizeClass as de, withModifiers as ce } from "vue";
2
2
  import { icons as f } from "../../../../icons/index.js";
3
- import { isNotEmpty as ce, isArray as _ } from "../../../../utils/utils.js";
3
+ import { isNotEmpty as _, isArray as B } from "../../../../utils/utils.js";
4
4
  import me from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
5
  import fe from "../../../KunList/src/components/KunList.vue.js";
6
- import B from "../../../KunListItem/src/components/KunListItem.vue.js";
7
- import F from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
6
+ import F from "../../../KunListItem/src/components/KunListItem.vue.js";
7
+ import T from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
8
8
  import pe from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
9
  import he from "../../../KunMenu/src/components/KunMenu.vue.js";
10
10
  import { useAutocomplete as ve } from "../composables/useAutocomplete.js";
11
11
  import { KunAutocompleteProps as ke } from "../composables/KunAutocompleteProps.js";
12
- import ye from "../../../KunTextField/src/components/KunTextField.vue.js";
13
- import be from "../../../KunBtn/src/components/KunBtn.vue.js";
12
+ import be from "../../../KunTextField/src/components/KunTextField.vue.js";
13
+ import ye from "../../../KunBtn/src/components/KunBtn.vue.js";
14
14
  import ge from "../../../KunChip/src/components/KunChip.vue.js";
15
- import b from "../../../KunIcon/src/components/KunIcon.vue.js";
15
+ import y from "../../../KunIcon/src/components/KunIcon.vue.js";
16
16
  const Ce = {
17
17
  key: 0,
18
18
  class: "w-full flex overflow-x-auto whitespace-nowrap space-x-1"
19
19
  }, we = { class: "flex items-center" }, Ve = {
20
20
  key: 0,
21
- class: "sticky top-0 z-10 p-2 border-b"
21
+ class: "sticky top-0 z-10 p-2 border-b bg-select-background"
22
22
  }, Le = {
23
23
  __name: "KunAutocomplete",
24
24
  props: /* @__PURE__ */ z(ke, {
@@ -28,29 +28,29 @@ const Ce = {
28
28
  itemsModifiers: {}
29
29
  }),
30
30
  emits: /* @__PURE__ */ z(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
31
- setup(g, { emit: T }) {
32
- const a = R(g, "modelValue"), M = R(g, "items"), u = g, p = T, {
31
+ setup(g, { emit: E }) {
32
+ const r = R(g, "modelValue"), M = R(g, "items"), u = g, p = E, {
33
33
  textFieldRef: C,
34
34
  listRef: w,
35
35
  menuModel: s,
36
36
  search: c,
37
- removeItem: E,
38
- clearSelection: N,
39
- lightReset: L,
37
+ removeItem: N,
38
+ clearSelection: L,
39
+ lightReset: O,
40
40
  openMenu: V,
41
- closeMenu: O,
42
- toggleMenu: U,
43
- onMenuKeydown: x,
44
- getSelectedItem: H,
45
- textArr: q,
46
- getItemText: P,
47
- isAlphanumeric: W,
48
- createItem: j,
49
- checkDisabled: G,
41
+ closeMenu: U,
42
+ toggleMenu: x,
43
+ onMenuKeydown: H,
44
+ getSelectedItem: q,
45
+ textArr: P,
46
+ getItemText: W,
47
+ isAlphanumeric: j,
48
+ createItem: G,
49
+ checkDisabled: J,
50
50
  itemToString: D,
51
- placeholder: J
52
- } = ve(u, p, a, M);
53
- oe(() => {
51
+ placeholder: Q
52
+ } = ve(u, p, r, M);
53
+ ie(() => {
54
54
  u.focusOnRender && C.value.focus();
55
55
  });
56
56
  const K = S(null), h = S(""), $ = (e) => {
@@ -61,43 +61,43 @@ const Ce = {
61
61
  }
62
62
  return h.value = "", p("validation", !0), !0;
63
63
  };
64
- ie(() => a.value, (e, o) => {
65
- ce(u.rules) && $(e);
64
+ ne(() => r.value, (e, o) => {
65
+ _(u.rules) && $(e);
66
66
  });
67
- function Q() {
67
+ function X() {
68
68
  var e;
69
69
  s.value = !1, (e = C.value.inputField) == null || e.focus();
70
70
  }
71
- function X(e) {
71
+ function Y(e) {
72
72
  var t, d;
73
73
  const o = e.key;
74
74
  if (o === "Tab" || o === "Shift") {
75
- O();
75
+ U();
76
76
  return;
77
77
  }
78
- (W(o) || o === "Backspace") && V(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), s.value || V(), console.log("listRef.value", w.value), (d = (t = w.value) == null ? void 0 : t.focusWithKey) == null || d.call(t, o));
78
+ (j(o) || o === "Backspace") && V(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), s.value || V(), console.log("listRef.value", w.value), (d = (t = w.value) == null ? void 0 : t.focusWithKey) == null || d.call(t, o));
79
79
  }
80
- function Y(e) {
80
+ function Z(e) {
81
81
  p("search", c);
82
82
  }
83
- function Z() {
84
- $(a);
83
+ function ee() {
84
+ $(r);
85
85
  }
86
- function ee(e) {
87
- x(e);
86
+ function le(e) {
87
+ H(e);
88
88
  }
89
- function le() {
89
+ function te() {
90
90
  }
91
- return (e, o) => (r(), v("div", {
91
+ return (e, o) => (a(), v("div", {
92
92
  class: "w-full h-fit",
93
93
  ref_key: "parentRef",
94
94
  ref: K
95
95
  }, [
96
- n(ye, {
96
+ n(be, {
97
97
  modelValue: l(c),
98
98
  "onUpdate:modelValue": [
99
99
  o[1] || (o[1] = (t) => A(c) ? c.value = t : null),
100
- Y
100
+ Z
101
101
  ],
102
102
  label: e.label,
103
103
  dirty: "",
@@ -106,30 +106,30 @@ const Ce = {
106
106
  ref_key: "textFieldRef",
107
107
  ref: C,
108
108
  autocomplete: "off",
109
- onFocusInput: Z,
110
- onHandleClick: l(U),
109
+ onFocusInput: ee,
110
+ onHandleClick: l(x),
111
111
  rounded: l(s) ? "rounded-t" : "rounded",
112
- onBlur: le,
113
- onKeyDown: X,
114
- placeholder: u.multiple && l(_)(a.value) && a.value.length ? "" : l(J),
112
+ onBlur: te,
113
+ onKeyDown: Y,
114
+ placeholder: u.multiple && l(B)(r.value) && r.value.length ? "" : l(Q),
115
115
  error: !!h.value,
116
116
  "error-messages": h.value
117
- }, ne({
117
+ }, re({
118
118
  default: i(() => [
119
- l(_)(a.value) ? (r(), v("div", Ce, [
120
- (r(!0), v(re, null, ae(a.value, (t) => (r(), m(ge, {
119
+ l(B)(r.value) && l(_)(r.value) ? (a(), v("div", Ce, [
120
+ (a(!0), v(ae, null, se(r.value, (t) => (a(), m(ge, {
121
121
  key: t.id ?? t.name,
122
122
  size: "small"
123
123
  }, {
124
124
  default: i(() => [
125
- se("div", we, [
126
- y(I(l(P)(t, e.itemTitle)) + " ", 1),
127
- n(b, {
125
+ ue("div", we, [
126
+ b(I(l(W)(t, e.itemTitle)) + " ", 1),
127
+ n(y, {
128
128
  color: "error",
129
129
  icon: l(f).close,
130
130
  size: "small",
131
131
  class: "ml-1",
132
- onClick: (d) => l(E)(t)
132
+ onClick: (d) => l(N)(t)
133
133
  }, null, 8, ["icon", "onClick"])
134
134
  ])
135
135
  ]),
@@ -138,14 +138,14 @@ const Ce = {
138
138
  ])) : k("", !0),
139
139
  n(he, {
140
140
  transition: "fade",
141
- "onClick:outside": l(L),
141
+ "onClick:outside": l(O),
142
142
  modelValue: l(s),
143
143
  "onUpdate:modelValue": o[0] || (o[0] = (t) => A(s) ? s.value = t : null),
144
144
  activator: "parent",
145
145
  "z-index": e.zIndex,
146
146
  "parent-ref": K.value,
147
147
  origin: e.menuOrigin,
148
- onHandleEscape: Q,
148
+ onHandleEscape: X,
149
149
  bgColor: e.bgMenuColor,
150
150
  "close-on-content-click": e.closeOnSelect,
151
151
  width: "w-full",
@@ -153,23 +153,23 @@ const Ce = {
153
153
  "hide-details": e.hideDetails
154
154
  }, {
155
155
  default: i(() => [
156
- e.hasCreateItem ? (r(), v("div", Ve, [
157
- n(be, {
158
- onClick: l(j),
156
+ e.hasCreateItem ? (a(), v("div", Ve, [
157
+ n(ye, {
158
+ onClick: l(G),
159
159
  bgColor: e.btnCreateBg,
160
- class: ue(e.btnCreateClass)
160
+ class: de(e.btnCreateClass)
161
161
  }, {
162
162
  default: i(() => [
163
- y(I(e.btnCreateText), 1)
163
+ b(I(e.btnCreateText), 1)
164
164
  ]),
165
165
  _: 1
166
166
  }, 8, ["onClick", "bgColor", "class"])
167
167
  ])) : k("", !0),
168
168
  n(fe, {
169
- "onClick:select": l(H),
169
+ "onClick:select": l(q),
170
170
  ref_key: "listRef",
171
171
  ref: w,
172
- onKeyDown: ee,
172
+ onKeyDown: le,
173
173
  selectable: !0
174
174
  }, {
175
175
  default: i(() => [
@@ -182,12 +182,12 @@ const Ce = {
182
182
  enabled: l(s),
183
183
  "item-height": 48
184
184
  }, {
185
- default: i(({ item: t, index: d, empty: te }) => [
186
- !te && t != null ? (r(), m(B, {
185
+ default: i(({ item: t, index: d, empty: oe }) => [
186
+ !oe && t != null ? (a(), m(F, {
187
187
  value: t,
188
188
  key: `kun-list-${d + 1}`,
189
189
  id: `kun-item-${d + 1}`,
190
- disabled: l(G)(t),
190
+ disabled: l(J)(t),
191
191
  "bg-items": e.bgItemListColor,
192
192
  "hover-bg": e.hoverItemListColor,
193
193
  activeClass: e.selectedItemListColor,
@@ -195,9 +195,9 @@ const Ce = {
195
195
  selectable: !0
196
196
  }, {
197
197
  default: i(() => [
198
- n(F, { class: "text-wrap" }, {
198
+ n(T, { class: "text-wrap" }, {
199
199
  default: i(() => [
200
- y(I(l(D)(t, e.itemTitle ?? l(q), "hasDefault")), 1)
200
+ b(I(l(D)(t, e.itemTitle ?? l(P), "hasDefault")), 1)
201
201
  ]),
202
202
  _: 2
203
203
  }, 1024),
@@ -206,14 +206,14 @@ const Ce = {
206
206
  }, null, 8, ["text"])
207
207
  ]),
208
208
  _: 2
209
- }, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (r(), m(B, {
209
+ }, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (a(), m(F, {
210
210
  key: 1,
211
211
  disabled: ""
212
212
  }, {
213
213
  default: i(() => [
214
- n(F, { class: "text-center w-full text-gray-500" }, {
214
+ n(T, { class: "text-center w-full text-gray-500" }, {
215
215
  default: i(() => o[2] || (o[2] = [
216
- y(" No hay elementos disponibles ")
216
+ b(" No hay elementos disponibles ")
217
217
  ])),
218
218
  _: 1,
219
219
  __: [2]
@@ -236,22 +236,22 @@ const Ce = {
236
236
  e.hasIcons ? {
237
237
  name: "append-inner",
238
238
  fn: i(() => [
239
- e.clearable && a.value ? (r(), m(b, {
239
+ e.clearable && r.value ? (a(), m(y, {
240
240
  key: 0,
241
- onClick: l(N),
241
+ onClick: l(L),
242
242
  size: "small",
243
243
  color: "error",
244
244
  icon: l(f).close,
245
245
  class: "mr-1 mt-1"
246
246
  }, null, 8, ["onClick", "icon"])) : k("", !0),
247
- n(b, {
247
+ n(y, {
248
248
  color: "teal-darken-1",
249
249
  size: "large",
250
250
  class: "cursor-pointer",
251
251
  icon: l(s) ? l(f).menuUpOutline : l(f).menuDownOutline,
252
- onClick: de(l(V), ["stop"])
252
+ onClick: ce(l(V), ["stop"])
253
253
  }, null, 8, ["icon", "onClick"]),
254
- e.required ? (r(), m(b, {
254
+ e.required ? (a(), m(y, {
255
255
  key: 1,
256
256
  color: "teal-darken-1",
257
257
  size: "x-small",
@@ -4,19 +4,19 @@ const e = {
4
4
  },
5
5
  itemValue: {
6
6
  type: String,
7
- default: ""
7
+ default: null
8
8
  },
9
9
  itemTitle: {
10
- type: String,
11
- default: ""
10
+ type: [String, Array],
11
+ default: null
12
12
  },
13
13
  itemText: {
14
- type: String,
15
- default: ""
14
+ type: [String, Array],
15
+ default: null
16
16
  },
17
17
  itemSubtitle: {
18
- type: String,
19
- default: ""
18
+ type: [String, Array],
19
+ default: null
20
20
  },
21
21
  returnObject: {
22
22
  type: Boolean,
@@ -1,76 +1,85 @@
1
- import { ref as o, computed as M, watch as H, nextTick as F } from "vue";
2
- import { isArray as x, isObject as O, fullCopy as L } from "../../../../utils/utils.js";
3
- function U(n, h, i, s) {
4
- const l = o(null), d = o(null), y = o(null), f = o(!1), v = o(""), N = (e, t) => t.split(".").reduce((u, r) => u && u[r] !== void 0 ? u[r] : null, e), B = M(() => l.value !== null && l.value !== void 0 ? x(l.value) ? l.value.length ? j(l.value, n.itemTitle, "hasDefault") : n.placeholderText : O(l.value) ? j(l.value, n.itemTitle, "hasDefault") : l.value.toString() : s.value.length ? n.placeholderText : n.textNoItems), R = M(() => n.itemText.includes(",") ? n.itemText.split(",") : n.itemText);
5
- function j(e, t, u) {
6
- var r;
7
- if (O(e)) {
8
- if (t) {
9
- if (x(t))
10
- return t.map((c) => e[c] ?? "No definido").join(" - ");
11
- if (t.includes(","))
12
- return t.split(",").map((c) => e[c]).join(" - ");
13
- if (t.includes(".")) {
14
- const c = t.split(".");
15
- let a = e;
16
- for (const b of c)
17
- a = a[b];
18
- return a;
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(t, g, i, d) {
4
+ const l = s(null), v = s(null), S = 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 ? y(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(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
5
+ function j(e, n, u) {
6
+ var c;
7
+ if (h(e)) {
8
+ if (n) {
9
+ if (y(n))
10
+ return n.map((r) => {
11
+ if (r.includes(".")) {
12
+ const o = r.split(".");
13
+ let a = e;
14
+ for (const O of o)
15
+ a = a != null ? a[O] : void 0;
16
+ return a ?? "No definido";
17
+ }
18
+ return e[r] ?? "No definido";
19
+ }).join(" - ");
20
+ if (n.includes(","))
21
+ return n.split(",").map((r) => e[r]).join(" - ");
22
+ if (n.includes(".")) {
23
+ const r = n.split(".");
24
+ let o = e;
25
+ for (const a of r)
26
+ o = o != null ? o[a] : void 0;
27
+ return o;
19
28
  }
20
- return !n.returnObject && typeof e[t] == "number" || e[t] !== void 0 && e[t] !== null ? e[t].toString() : "";
29
+ return !t.returnObject && typeof e[n] == "number" ? e[n].toString() : e[n] !== void 0 && e[n] !== null ? (console.log(n), e[n].toString()) : "";
21
30
  }
22
31
  if (u)
23
32
  return Object.values(e)[0];
24
33
  }
25
- return x(e) ? n.returnObject ? e.map((c) => c[t]).join(" - ") : e.map((c) => c).join(" - ") : u && typeof e != "number" ? e.includes(",") ? e.split(",") : e : ((r = e == null ? void 0 : e.toString) == null ? void 0 : r.call(e)) ?? "";
34
+ return y(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)) ?? "";
26
35
  }
27
36
  function V(e) {
28
37
  try {
29
- let t = null;
30
- if (l.value = L(e), !n.multiple)
31
- n.returnObject ? t = e : O(e) ? n.itemValue ? t = e[n.itemValue] : t = Object.values(e)[0] : t = e, f.value = !1, g();
32
- else if (S(e)) {
33
- e && T(e);
38
+ let n = null;
39
+ if (l.value = L(e), !t.multiple)
40
+ t.returnObject ? n = e : h(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, f.value = !1, x();
41
+ else if (T(e)) {
42
+ e && I(e);
34
43
  return;
35
44
  } else {
36
- const u = n.returnObject ? e : O(e) ? n.itemValue ? e[n.itemValue] : Object.values(e)[0] : e;
37
- t = [...i.value || [], u];
45
+ const u = t.returnObject ? e : h(e) ? t.itemValue ? e[t.itemValue] : Object.values(e)[0] : e;
46
+ n = [...i.value || [], u];
38
47
  }
39
- i.value === t ? h("update:modelValue", t) : i.value = t, h("selectedItem", l.value);
40
- } catch (t) {
41
- console.log(t);
48
+ i.value === n ? g("update:modelValue", n) : i.value = n, g("selectedItem", l.value);
49
+ } catch (n) {
50
+ console.log(n);
42
51
  } finally {
43
52
  F(() => {
44
- I();
53
+ A();
45
54
  });
46
55
  }
47
56
  }
48
57
  H(
49
- [() => i.value, () => s.value],
58
+ [() => i.value, () => d.value],
50
59
  ([e]) => {
51
- const t = C(e);
52
- JSON.stringify(l.value) !== JSON.stringify(t) && (l.value = t);
60
+ const n = C(e);
61
+ JSON.stringify(l.value) !== JSON.stringify(n) && (l.value = n);
53
62
  },
54
63
  { immediate: !0 }
55
64
  );
56
65
  function C(e) {
57
- return e == null ? null : n.multiple && Array.isArray(e) ? n.returnObject ? e : e.map((u) => s.value.find((r) => r[n.itemValue] === u)).filter(Boolean) : n.returnObject ? e : s.value.find(
58
- (u) => typeof u == "object" ? u[n.itemValue] === e : u === e
66
+ 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(
67
+ (u) => typeof u == "object" ? u[t.itemValue] === e : u === e
59
68
  ) ?? e;
60
69
  }
61
- function S(e) {
70
+ function T(e) {
62
71
  if (!i.value || !e) return !1;
63
- const t = n.returnObject ? e[n.itemValue] : e;
64
- return i.value.some((u) => (n.returnObject ? u[n.itemValue] : u) === t);
72
+ const n = t.returnObject ? e[t.itemValue] : e;
73
+ return i.value.some((u) => (t.returnObject ? u[t.itemValue] : u) === n);
65
74
  }
66
- function T(e) {
67
- const t = n.returnObject ? e[n.itemValue] : e, u = i.value.filter((r) => (n.returnObject ? r[n.itemValue] : r) !== t);
75
+ function I(e) {
76
+ const n = t.returnObject ? e[t.itemValue] : e, u = i.value.filter((c) => (t.returnObject ? c[t.itemValue] : c) !== n);
68
77
  i.value = u;
69
78
  }
70
- function I(e) {
71
- n.clearSearchOnSelect && (v.value = ""), n.clearOnSelect && w(), n.focusOnSelect && g();
79
+ function A(e) {
80
+ t.clearSearchOnSelect && (b.value = ""), t.clearOnSelect && E(), t.focusOnSelect && x();
72
81
  }
73
- function A() {
82
+ function k() {
74
83
  f.value || (f.value = !0);
75
84
  }
76
85
  function D() {
@@ -79,63 +88,63 @@ function U(n, h, i, s) {
79
88
  function J() {
80
89
  f.value = !f.value;
81
90
  }
82
- function k(e) {
91
+ function w(e) {
83
92
  return e.length === 1 && e.match(/\w/);
84
93
  }
85
- function g() {
86
- d.value.inputField.focus();
94
+ function x() {
95
+ v.value.inputField.focus();
87
96
  }
88
97
  function K() {
89
- f.value = !0, y.value && d.value.$el.focus();
98
+ f.value = !0, S.value && v.value.$el.focus();
90
99
  }
91
100
  function $(e) {
92
- const t = e.key;
93
- (k(t) || t === "Backspace") && (A(), g(), F(() => {
94
- var r;
95
- const u = (r = d.value) == null ? void 0 : r.inputField;
101
+ const n = e.key;
102
+ (w(n) || n === "Backspace") && (k(), x(), F(() => {
103
+ var c;
104
+ const u = (c = v.value) == null ? void 0 : c.inputField;
96
105
  if (u) {
97
- const c = u.selectionStart, a = u.selectionEnd, b = u.value, E = e.key.length === 1 ? e.key : "";
98
- u.value = b.slice(0, c) + E + b.slice(a), u.selectionStart = u.selectionEnd = c + E.length, u.dispatchEvent(new Event("input", { bubbles: !0 }));
106
+ const r = u.selectionStart, o = u.selectionEnd, a = u.value, O = e.key.length === 1 ? e.key : "";
107
+ u.value = a.slice(0, r) + O + a.slice(o), u.selectionStart = u.selectionEnd = r + O.length, u.dispatchEvent(new Event("input", { bubbles: !0 }));
99
108
  }
100
109
  }));
101
110
  }
102
111
  function q() {
103
- f.value = !1, h("createItem");
112
+ f.value = !1, g("createItem");
104
113
  }
105
114
  function z(e) {
106
- let t = i.value.indexOf(e);
107
- i.value.splice(t, 1);
115
+ let n = i.value.indexOf(e);
116
+ i.value.splice(n, 1);
108
117
  }
109
- function w() {
110
- v.value !== "" && (v.value = ""), i.value !== null && (i.value = null), l.value !== null && (l.value = null);
118
+ function E() {
119
+ b.value !== "" && (b.value = ""), i.value !== null && (i.value = null), l.value !== null && (l.value = null);
111
120
  }
112
121
  function G(e) {
113
122
  return !!e.disabled;
114
123
  }
115
124
  return {
116
125
  selectedItem: l,
117
- textFieldRef: d,
118
- listRef: y,
126
+ textFieldRef: v,
127
+ listRef: S,
119
128
  menuModel: f,
120
- search: v,
129
+ search: b,
121
130
  getItemText: N,
122
131
  placeholder: B,
123
132
  textArr: R,
124
133
  itemToString: j,
125
134
  getSelectedItem: V,
126
- checkIfValueExist: S,
127
- removeFromArray: T,
128
- lightReset: I,
129
- openMenu: A,
135
+ checkIfValueExist: T,
136
+ removeFromArray: I,
137
+ lightReset: A,
138
+ openMenu: k,
130
139
  closeMenu: D,
131
140
  toggleMenu: J,
132
141
  focusOnMenu: K,
133
142
  onMenuKeydown: $,
134
143
  createItem: q,
135
144
  removeItem: z,
136
- clearSelection: w,
145
+ clearSelection: E,
137
146
  checkDisabled: G,
138
- isAlphanumeric: k
147
+ isAlphanumeric: w
139
148
  };
140
149
  }
141
150
  export {
@@ -1,57 +1,59 @@
1
- import { ref as I, computed as t, watch as A, nextTick as L } from "vue";
1
+ import { ref as I, computed as t, watch as b, nextTick as k } from "vue";
2
2
  function q({
3
- items: d,
3
+ items: g,
4
4
  search: i,
5
5
  searchableKeys: v = [],
6
6
  itemsPerIntersection: r = 20
7
7
  }) {
8
- const l = I(1), f = I(null), h = t(
8
+ const l = I(1), f = I(null), n = t(
9
9
  () => Array.isArray(v) ? v : []
10
- ), y = t(
10
+ ), w = t(
11
11
  () => typeof r == "number" && r > 0 ? r : 20
12
- ), n = t(() => {
13
- var u;
14
- const e = d.value || [], a = (u = i.value) == null ? void 0 : u.trim().toLowerCase();
15
- return !a || !h.value.length ? e : e.filter((S) => h.value.some((C) => {
16
- const g = C.split(".").reduce((o, T) => o == null ? void 0 : o[T], S);
17
- return typeof g == "string" && g.toLowerCase().includes(a);
12
+ ), u = t(() => {
13
+ var d;
14
+ const e = g.value || [], a = (d = i.value) == null ? void 0 : d.trim().toLowerCase();
15
+ if (!a || !n.value) return e;
16
+ const o = Array.isArray(n.value) ? n.value : [n.value];
17
+ return e.filter((A) => o.some((C) => {
18
+ const p = C.split(".").reduce((y, T) => y != null ? y[T] : void 0, A);
19
+ return p == null ? !1 : String(p).toLowerCase().includes(a);
18
20
  }));
19
- }), w = t(() => n.value.length), c = t(
20
- () => n.value.slice(
21
+ }), x = t(() => u.value.length), s = t(
22
+ () => u.value.slice(
21
23
  0,
22
- l.value * y.value
24
+ l.value * w.value
23
25
  )
24
- ), s = t(
25
- () => c.value.length >= n.value.length
26
- ), x = t(() => l.value === 1);
27
- function m() {
28
- s.value || l.value++;
26
+ ), c = t(
27
+ () => s.value.length >= u.value.length
28
+ ), B = t(() => l.value === 1);
29
+ function h() {
30
+ c.value || l.value++;
29
31
  }
30
- function p() {
32
+ function m() {
31
33
  l.value = 1;
32
34
  }
33
- A(
35
+ b(
34
36
  () => i.value,
35
37
  () => {
36
- p();
38
+ m();
37
39
  },
38
40
  { flush: "pre" }
39
41
  );
40
- async function B(e) {
42
+ async function S(e) {
41
43
  if (typeof e != "number" || e < 0) return;
42
44
  f.value = e;
43
- const a = n.value.length - 1, u = Math.min(e, a);
44
- for (; u >= c.value.length && !s.value; )
45
- m(), await L();
45
+ const a = u.value.length - 1, o = Math.min(e, a);
46
+ for (; o >= s.value.length && !c.value; )
47
+ h(), await k();
46
48
  }
47
49
  return {
48
- visibleItems: c,
49
- loadNextBatch: m,
50
- resetCurrentBatchStep: p,
51
- lastBatchReached: s,
52
- isFirstBatch: x,
53
- totalItems: w,
54
- setScrollToIndex: B,
50
+ visibleItems: s,
51
+ loadNextBatch: h,
52
+ resetCurrentBatchStep: m,
53
+ lastBatchReached: c,
54
+ isFirstBatch: B,
55
+ totalItems: x,
56
+ setScrollToIndex: S,
55
57
  scrollToIndex: f
56
58
  // opcional, si lo necesitás desde el componente padre
57
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.432",
3
+ "version": "0.1.434",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",