adverich-kun-ui 0.1.211 → 0.1.213

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,10 +1,10 @@
1
- import { mergeModels as R, useModel as $, onMounted as ae, ref as B, watch as se, createElementBlock as V, openBlock as s, createVNode as a, unref as l, isRef as F, createSlots as ue, withCtx as i, createCommentVNode as y, Fragment as de, renderList as ce, createBlock as d, createElementVNode as me, createTextVNode as k, toDisplayString as w, normalizeClass as fe, withModifiers as pe } from "vue";
1
+ import { mergeModels as R, useModel as $, onMounted as ae, ref as B, watch as se, createElementBlock as V, openBlock as s, createVNode as a, unref as t, isRef as F, createSlots as ue, withCtx as i, createCommentVNode as v, Fragment as de, renderList as ce, createBlock as d, createElementVNode as me, createTextVNode as y, toDisplayString as w, normalizeClass as fe, withModifiers as pe } from "vue";
2
2
  import { icons as m } from "../../../../icons/index.js";
3
- import { isNotEmpty as ve, isArray as T } from "../../../../utils/utils.js";
4
- import ye from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
- import ke from "../../../KunList/src/components/KunList.vue.js";
3
+ import { isNotEmpty as ke, isArray as T } from "../../../../utils/utils.js";
4
+ import ve from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
+ import ye from "../../../KunList/src/components/KunList.vue.js";
6
6
  import _ from "../../../KunListItem/src/components/KunListItem.vue.js";
7
- import U from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
7
+ import E from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
8
8
  import he from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
9
  import ge from "../../../kunMenu/src/components/kunMenu.vue.js";
10
10
  import { useAutocomplete as Ce } from "../composables/useAutocomplete.js";
@@ -24,15 +24,15 @@ const Ie = {
24
24
  items: { default: [], type: Array, required: !0 },
25
25
  itemsModifiers: {}
26
26
  }),
27
- emits: /* @__PURE__ */ R(["selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
28
- setup(g, { emit: E }) {
29
- const r = $(g, "modelValue"), I = $(g, "items"), n = g, f = E, {
27
+ emits: /* @__PURE__ */ R(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
28
+ setup(g, { emit: L }) {
29
+ const r = $(g, "modelValue"), I = $(g, "items"), n = g, f = L, {
30
30
  textFieldRef: C,
31
31
  listRef: x,
32
32
  menuModel: u,
33
33
  search: c,
34
- removeItem: L,
35
- clearSelection: N,
34
+ removeItem: N,
35
+ clearSelection: U,
36
36
  lightReset: H,
37
37
  openMenu: b,
38
38
  closeMenu: O,
@@ -57,29 +57,29 @@ const Ie = {
57
57
  }
58
58
  const p = B(""), D = (e) => {
59
59
  for (const o of n.rules) {
60
- const t = o(e);
61
- if (t !== !0)
62
- return p.value = t, f("validation", !1), !1;
60
+ const l = o(e);
61
+ if (l !== !0)
62
+ return p.value = l, f("validation", !1), !1;
63
63
  }
64
64
  return p.value = "", f("validation", !0), !0;
65
65
  };
66
66
  se(() => r.value, (e, o) => {
67
- ve(n.rules) && D(e);
67
+ ke(n.rules) && D(e);
68
68
  });
69
69
  function ee() {
70
70
  var e;
71
71
  u.value = !1, (e = C.value.inputField) == null || e.focus();
72
72
  }
73
- function te(e) {
74
- var t, v;
73
+ function le(e) {
74
+ var l, k;
75
75
  const o = e.key;
76
76
  if (o === "Tab" || o === "Shift") {
77
77
  O();
78
78
  return;
79
79
  }
80
- (J(o) || o === "Backspace") && b(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), u.value || b(), (v = (t = x.value) == null ? void 0 : t.focusWithKey) == null || v.call(t, o));
80
+ (J(o) || o === "Backspace") && b(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), u.value || b(), (k = (l = x.value) == null ? void 0 : l.focusWithKey) == null || k.call(l, o));
81
81
  }
82
- function le(e) {
82
+ function te(e) {
83
83
  f("search", c);
84
84
  }
85
85
  function oe() {
@@ -96,10 +96,10 @@ const Ie = {
96
96
  ref: S
97
97
  }, [
98
98
  a(Ve, {
99
- modelValue: l(c),
99
+ modelValue: t(c),
100
100
  "onUpdate:modelValue": [
101
- o[1] || (o[1] = (t) => F(c) ? c.value = t : null),
102
- le
101
+ o[1] || (o[1] = (l) => F(c) ? c.value = l : null),
102
+ te
103
103
  ],
104
104
  label: e.label,
105
105
  dirty: "",
@@ -109,41 +109,41 @@ const Ie = {
109
109
  ref: C,
110
110
  autocomplete: "off",
111
111
  onFocusInput: oe,
112
- onHandleClick: l(j),
113
- rounded: l(u) ? "rounded-t" : "rounded",
112
+ onHandleClick: t(j),
113
+ rounded: t(u) ? "rounded-t" : "rounded",
114
114
  onBlur: ie,
115
- onKeyDown: te,
116
- placeholder: n.multiple && l(T)(r.value) && r.value.length ? "" : l(M),
115
+ onKeyDown: le,
116
+ placeholder: n.multiple && t(T)(r.value) && r.value.length ? "" : t(M),
117
117
  error: !!p.value,
118
118
  "error-messages": p.value
119
119
  }, ue({
120
120
  default: i(() => [
121
- l(T)(r.value) ? (s(), V("div", Ie, [
122
- (s(!0), V(de, null, ce(r.value, (t) => (s(), d(_e, {
123
- key: t.id ?? t.name,
121
+ t(T)(r.value) ? (s(), V("div", Ie, [
122
+ (s(!0), V(de, null, ce(r.value, (l) => (s(), d(_e, {
123
+ key: l.id ?? l.name,
124
124
  size: "small",
125
125
  class: "ml-1"
126
126
  }, {
127
127
  default: i(() => [
128
128
  me("div", xe, [
129
- k(w(l(G)(t, e.itemTitle)) + " ", 1),
129
+ y(w(t(G)(l, e.itemTitle)) + " ", 1),
130
130
  a(h, {
131
131
  color: "error",
132
- icon: l(m).close,
132
+ icon: t(m).close,
133
133
  size: "small",
134
134
  class: "ml-1",
135
- onClick: (v) => l(L)(t)
135
+ onClick: (k) => t(N)(l)
136
136
  }, null, 8, ["icon", "onClick"])
137
137
  ])
138
138
  ]),
139
139
  _: 2
140
140
  }, 1024))), 128))
141
- ])) : y("", !0),
141
+ ])) : v("", !0),
142
142
  a(ge, {
143
143
  transition: "fade",
144
- "onClick:outside": l(H),
145
- modelValue: l(u),
146
- "onUpdate:modelValue": o[0] || (o[0] = (t) => F(u) ? u.value = t : null),
144
+ "onClick:outside": t(H),
145
+ modelValue: t(u),
146
+ "onUpdate:modelValue": o[0] || (o[0] = (l) => F(u) ? u.value = l : null),
147
147
  activator: "parent",
148
148
  "z-index": e.zIndex,
149
149
  "parent-ref": S.value,
@@ -155,58 +155,59 @@ const Ie = {
155
155
  "hide-details": e.hideDetails
156
156
  }, {
157
157
  default: i(() => [
158
- a(ke, {
159
- "onUpdate:selected": l(P),
158
+ a(ye, {
159
+ "onClick:select": t(P),
160
160
  ref_key: "listRef",
161
161
  ref: x,
162
- onKeyDown: ne
162
+ onKeyDown: ne,
163
+ selectable: !0
163
164
  }, {
164
165
  default: i(() => [
165
- l(Y) ? (s(), d(_, { key: 0 }, {
166
+ t(Y) ? (s(), d(_, { key: 0 }, {
166
167
  default: i(() => [
167
168
  a(we, {
168
- onClick: l(Q),
169
+ onClick: t(Q),
169
170
  class: "w-full",
170
171
  color: "bg-green-400"
171
172
  }, {
172
173
  default: i(() => o[2] || (o[2] = [
173
- k(" Crear item ")
174
+ y(" Crear item ")
174
175
  ])),
175
176
  _: 1,
176
177
  __: [2]
177
178
  }, 8, ["onClick"])
178
179
  ]),
179
180
  _: 1
180
- })) : y("", !0),
181
- a(ye, {
181
+ })) : v("", !0),
182
+ a(ve, {
182
183
  items: I.value,
183
- search: l(c),
184
+ search: t(c),
184
185
  "searchable-keys": n.searchableKeys,
185
186
  virtual: !1,
186
187
  "items-per-intersection": 10,
187
- enabled: l(u),
188
+ enabled: t(u),
188
189
  "item-height": 48
189
190
  }, {
190
- default: i(({ item: t, index: v, empty: re }) => {
191
+ default: i(({ item: l, index: k, empty: re }) => {
191
192
  var z, A;
192
193
  return [
193
- !re && t ? (s(), d(_, {
194
- value: t,
195
- key: ((z = t.id) == null ? void 0 : z.toString()) ?? t.name,
196
- disabled: l(X)(t),
197
- class: fe(Z(t)),
194
+ !re && l ? (s(), d(_, {
195
+ value: l,
196
+ key: ((z = l.id) == null ? void 0 : z.toString()) ?? l.name,
197
+ disabled: t(X)(l),
198
+ class: fe(Z(l)),
198
199
  density: e.density,
199
- id: ((A = t.id) == null ? void 0 : A.toString()) ?? t.name
200
+ id: ((A = l.id) == null ? void 0 : A.toString()) ?? l.name
200
201
  }, {
201
202
  default: i(() => [
202
- a(U, { class: "text-wrap" }, {
203
+ a(E, { class: "text-wrap" }, {
203
204
  default: i(() => [
204
- k(w(l(K)(t, e.itemTitle ?? l(W), "hasDefault")), 1)
205
+ y(w(t(K)(l, e.itemTitle ?? t(W), "hasDefault")), 1)
205
206
  ]),
206
207
  _: 2
207
208
  }, 1024),
208
209
  a(he, {
209
- textContent: w(e.itemSubtitle ? l(K)(t, e.itemSubtitle) : "")
210
+ textContent: w(e.itemSubtitle ? t(K)(l, e.itemSubtitle) : "")
210
211
  }, null, 8, ["textContent"])
211
212
  ]),
212
213
  _: 2
@@ -215,9 +216,9 @@ const Ie = {
215
216
  disabled: ""
216
217
  }, {
217
218
  default: i(() => [
218
- a(U, { class: "text-center w-full text-gray-500" }, {
219
+ a(E, { class: "text-center w-full text-gray-500" }, {
219
220
  default: i(() => o[3] || (o[3] = [
220
- k(" No hay elementos disponibles ")
221
+ y(" No hay elementos disponibles ")
221
222
  ])),
222
223
  _: 1,
223
224
  __: [3]
@@ -231,7 +232,7 @@ const Ie = {
231
232
  }, 8, ["items", "search", "searchable-keys", "enabled"])
232
233
  ]),
233
234
  _: 1
234
- }, 8, ["onUpdate:selected"])
235
+ }, 8, ["onClick:select"])
235
236
  ]),
236
237
  _: 1
237
238
  }, 8, ["onClick:outside", "modelValue", "z-index", "parent-ref", "close-on-content-click", "max-height", "hide-details"])
@@ -243,26 +244,26 @@ const Ie = {
243
244
  fn: i(() => [
244
245
  e.clearable && r.value ? (s(), d(h, {
245
246
  key: 0,
246
- onClick: l(N),
247
+ onClick: t(U),
247
248
  size: "small",
248
249
  color: "error",
249
- icon: l(m).close,
250
+ icon: t(m).close,
250
251
  class: "mr-1 mt-1"
251
- }, null, 8, ["onClick", "icon"])) : y("", !0),
252
+ }, null, 8, ["onClick", "icon"])) : v("", !0),
252
253
  a(h, {
253
254
  color: "teal-darken-1",
254
255
  size: "large",
255
256
  class: "cursor-pointer",
256
- icon: l(u) ? l(m).menuUpOutline : l(m).menuDownOutline,
257
- onClick: pe(l(b), ["stop"])
257
+ icon: t(u) ? t(m).menuUpOutline : t(m).menuDownOutline,
258
+ onClick: pe(t(b), ["stop"])
258
259
  }, null, 8, ["icon", "onClick"]),
259
260
  e.required ? (s(), d(h, {
260
261
  key: 1,
261
262
  color: "teal-darken-1",
262
263
  size: "x-small",
263
264
  class: "mb-4",
264
- icon: l(m).asterisk
265
- }, null, 8, ["icon"])) : y("", !0)
265
+ icon: t(m).asterisk
266
+ }, null, 8, ["icon"])) : v("", !0)
266
267
  ]),
267
268
  key: "0"
268
269
  } : void 0
@@ -1,8 +1,8 @@
1
- import { ref as a, computed as M, watch as G, nextTick as H } from "vue";
1
+ import { ref as a, computed as M, watch as H, nextTick as w } from "vue";
2
2
  import { isArray as O, isObject as v, fullCopy as J } from "../../../../utils/utils.js";
3
- function Q(n, g, r, o) {
4
- const i = a(null), s = a(null), j = a(null), c = a(!1), d = a(""), w = (e, t) => t.split(".").reduce((u, l) => u && u[l] !== void 0 ? u[l] : null, e), F = M(() => i.value ? O(i.value) ? i.value.length ? h(i.value, n.itemTitle, "hasDefault") : n.placeholderText : v(i.value) ? h(i.value, n.itemTitle, "hasDefault") : i.value.toString() : o.value.length ? n.placeholderText : n.textNoItems), V = M(() => n.itemText.includes(",") ? n.itemText.split(",") : n.itemText);
5
- function h(e, t, u) {
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), V = M(() => i.value ? O(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), B = M(() => n.itemText.includes(",") ? n.itemText.split(",") : n.itemText);
5
+ function x(e, t, u) {
6
6
  if (v(e)) {
7
7
  if (t) {
8
8
  if (O(t))
@@ -23,37 +23,39 @@ function Q(n, g, r, o) {
23
23
  }
24
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;
25
25
  }
26
- function B(e) {
26
+ function R(e) {
27
27
  try {
28
28
  let t = null;
29
29
  if (i.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);
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 = [...r.value || [], u];
35
+ t = [...c.value || [], u];
36
36
  }
37
- r.value = t, g("selectedItem", i.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
- m(), x();
41
+ w(() => {
42
+ S();
43
+ });
42
44
  }
43
45
  }
44
- G(() => o.value, () => {
45
- i.value = R(r.value);
46
+ H(() => o.value, () => {
47
+ i.value = C(c.value);
46
48
  }, { immediate: !0 });
47
- function R(e) {
49
+ function C(e) {
48
50
  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;
49
51
  }
50
- function y(e) {
51
- return r.value === null ? !1 : e ? r.value.some(
52
+ function j(e) {
53
+ return c.value === null ? !1 : e ? c.value.some(
52
54
  (t) => n.returnObject ? t[n.itemValue] === e[n.itemValue] : t === e[n.itemValue]
53
55
  ) : !0;
54
56
  }
55
- function S(e) {
56
- let t = r.value;
57
+ function y(e) {
58
+ let t = c.value;
57
59
  if (n.returnObject) {
58
60
  const u = t.find(
59
61
  (f) => f[n.itemValue] === e[n.itemValue]
@@ -64,30 +66,30 @@ function Q(n, g, r, o) {
64
66
  t.splice(u, 1);
65
67
  }
66
68
  }
67
- function m(e) {
68
- n.clearSearchOnSelect && (d.value = ""), n.clearOnSelect && A(), n.focusOnSelect && x();
69
+ function S(e) {
70
+ n.clearSearchOnSelect && (d.value = ""), n.clearOnSelect && A(), n.focusOnSelect && m();
69
71
  }
70
72
  function T() {
71
- c.value || (c.value = !0);
72
- }
73
- function C() {
74
- c.value && (c.value = !1);
73
+ r.value || (r.value = !0);
75
74
  }
76
75
  function D() {
77
- c.value = !c.value;
76
+ r.value && (r.value = !1);
77
+ }
78
+ function N() {
79
+ r.value = !r.value;
78
80
  }
79
81
  function I(e) {
80
82
  return e.length === 1 && e.match(/\w/);
81
83
  }
82
- function x() {
84
+ function m() {
83
85
  s.value.inputField.focus();
84
86
  }
85
- function N() {
86
- c.value = !0, j.value && s.value.$el.focus();
87
+ function K() {
88
+ r.value = !0, g.value && s.value.$el.focus();
87
89
  }
88
- function K(e) {
90
+ function $(e) {
89
91
  const t = e.key;
90
- (I(t) || t === "Backspace") && (T(), x(), H(() => {
92
+ (I(t) || t === "Backspace") && (T(), m(), w(() => {
91
93
  var l;
92
94
  const u = (l = s.value) == null ? void 0 : l.inputField;
93
95
  if (u) {
@@ -96,42 +98,42 @@ function Q(n, g, r, o) {
96
98
  }
97
99
  }));
98
100
  }
99
- function $() {
100
- c.value = !1, g("createItem");
101
+ function q() {
102
+ r.value = !1, h("createItem");
101
103
  }
102
- function q(e) {
103
- let t = r.value.indexOf(e);
104
- r.value.splice(t, 1);
104
+ function z(e) {
105
+ let t = c.value.indexOf(e);
106
+ c.value.splice(t, 1);
105
107
  }
106
108
  function A() {
107
- d.value !== "" && (d.value = ""), r.value !== null && (r.value = null), i.value !== null && (i.value = null);
109
+ console.log(c.value), d.value !== "" && (d.value = ""), c.value !== null && (c.value = null), i.value !== null && (i.value = null);
108
110
  }
109
- function z(e) {
111
+ function G(e) {
110
112
  return !!e.disabled;
111
113
  }
112
114
  return {
113
115
  selectedItem: i,
114
116
  textFieldRef: s,
115
- listRef: j,
116
- menuModel: c,
117
+ listRef: g,
118
+ menuModel: r,
117
119
  search: d,
118
- getItemText: w,
119
- placeholder: F,
120
- textArr: V,
121
- itemToString: h,
122
- getSelectedItem: B,
123
- checkIfValueExist: y,
124
- removeFromArray: S,
125
- lightReset: m,
120
+ getItemText: F,
121
+ placeholder: V,
122
+ textArr: B,
123
+ itemToString: x,
124
+ getSelectedItem: R,
125
+ checkIfValueExist: j,
126
+ removeFromArray: y,
127
+ lightReset: S,
126
128
  openMenu: T,
127
- closeMenu: C,
128
- toggleMenu: D,
129
- focusOnMenu: N,
130
- onMenuKeydown: K,
131
- createItem: $,
132
- removeItem: q,
129
+ closeMenu: D,
130
+ toggleMenu: N,
131
+ focusOnMenu: K,
132
+ onMenuKeydown: $,
133
+ createItem: q,
134
+ removeItem: z,
133
135
  clearSelection: A,
134
- checkDisabled: z,
136
+ checkDisabled: G,
135
137
  isAlphanumeric: I
136
138
  };
137
139
  }
@@ -5,7 +5,7 @@ const R = {
5
5
  nav: Boolean,
6
6
  sub: Boolean,
7
7
  dense: Boolean,
8
- selectable: { type: Boolean, default: !0 },
8
+ selectable: { type: Boolean, default: !1 },
9
9
  selectionMode: {
10
10
  type: String,
11
11
  default: "single",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.211",
3
+ "version": "0.1.213",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",