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