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