adverich-kun-ui 0.1.124 → 0.1.126

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