adverich-kun-ui 0.1.82 → 0.1.83
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 E, useModel as L, onMounted as te, ref as le, watch as oe, createBlock as
|
|
1
|
+
import { mergeModels as E, useModel as L, onMounted as te, ref as le, watch as oe, createBlock as d, openBlock as i, unref as e, isRef as R, createSlots as ne, withCtx as r, createElementBlock as U, createCommentVNode as h, createVNode as a, Fragment as re, renderList as ie, createElementVNode as ae, createTextVNode as b, toDisplayString as V, normalizeClass as se, withModifiers as ue } from "vue";
|
|
2
2
|
import { icons as f } from "../../../../icons/index.js";
|
|
3
|
-
import { isNotEmpty as
|
|
4
|
-
import
|
|
3
|
+
import { isNotEmpty as de, isArray as z } from "../../../../utils/utils.js";
|
|
4
|
+
import ce from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
|
|
5
5
|
import me from "../../../KunList/src/components/KunList.vue.js";
|
|
6
6
|
import B from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
7
|
import fe from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
8
8
|
import pe from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
9
|
import ke from "../../../kunMenu/src/components/kunMenu.vue.js";
|
|
10
10
|
import { useAutocomplete as ye } from "../composables/useAutocomplete.js";
|
|
11
|
-
import { KunAutocompleteProps as
|
|
12
|
-
import
|
|
11
|
+
import { KunAutocompleteProps as he } from "../composables/KunAutocompleteProps.js";
|
|
12
|
+
import ve from "../../../KunTextField/src/components/KunTextField.vue.js";
|
|
13
13
|
import Ce from "../../../KunBtn/src/components/KunBtn.vue.js";
|
|
14
14
|
import ge from "../../../KunChip/src/components/KunChip.vue.js";
|
|
15
|
-
import
|
|
15
|
+
import v from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
16
16
|
const be = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "flex justify-center align-center"
|
|
19
19
|
}, Ve = { class: "flex justify-center align-center" }, Be = {
|
|
20
20
|
__name: "KunAutocomplete",
|
|
21
|
-
props: /* @__PURE__ */ E(
|
|
21
|
+
props: /* @__PURE__ */ E(he, {
|
|
22
22
|
modelValue: { default: null },
|
|
23
23
|
modelModifiers: {},
|
|
24
24
|
items: { default: [], type: Array, required: !0 },
|
|
@@ -27,7 +27,7 @@ const be = {
|
|
|
27
27
|
emits: /* @__PURE__ */ E(["createItem", "validation", "search"], ["update:modelValue", "update:items"]),
|
|
28
28
|
setup(C, { emit: F }) {
|
|
29
29
|
const u = L(C, "modelValue"), I = L(C, "items"), n = C, p = F, {
|
|
30
|
-
selectedItem:
|
|
30
|
+
selectedItem: c,
|
|
31
31
|
textFieldRef: k,
|
|
32
32
|
listRef: g,
|
|
33
33
|
menuModel: s,
|
|
@@ -35,24 +35,24 @@ const be = {
|
|
|
35
35
|
removeItem: N,
|
|
36
36
|
clearSelection: T,
|
|
37
37
|
lightReset: w,
|
|
38
|
-
openMenu:
|
|
39
|
-
onMenuKeydown:
|
|
38
|
+
openMenu: K,
|
|
39
|
+
onMenuKeydown: _,
|
|
40
40
|
getSelectedItem: H,
|
|
41
41
|
textArr: O,
|
|
42
42
|
getItemText: j,
|
|
43
43
|
createItem: q,
|
|
44
44
|
checkDisabled: P,
|
|
45
45
|
itemToString: S,
|
|
46
|
-
placeholder:
|
|
46
|
+
placeholder: D,
|
|
47
47
|
hasCreateItem: W
|
|
48
48
|
} = ye(n, p, u, I);
|
|
49
49
|
te(() => {
|
|
50
50
|
n.focusOnRender && k.value.focus();
|
|
51
51
|
});
|
|
52
52
|
function G(t) {
|
|
53
|
-
return u.value === null || u.value === void 0 ? n.bgItemListColor : n.multiple ? u.value.find((o) => o[n.itemValue] === t[n.itemValue]) ? n.selectedColor : n.bgItemListColor :
|
|
53
|
+
return u.value === null || u.value === void 0 ? n.bgItemListColor : n.multiple ? u.value.find((o) => o[n.itemValue] === t[n.itemValue]) ? n.selectedColor : n.bgItemListColor : D.value === t[n.itemTitle] ? n.selectedColor : n.bgItemListColor;
|
|
54
54
|
}
|
|
55
|
-
const y = le(""),
|
|
55
|
+
const y = le(""), M = (t) => {
|
|
56
56
|
for (const o of n.rules) {
|
|
57
57
|
const l = o(t);
|
|
58
58
|
if (l !== !0)
|
|
@@ -61,9 +61,9 @@ const be = {
|
|
|
61
61
|
return y.value = "", p("validation", !0), !0;
|
|
62
62
|
};
|
|
63
63
|
oe(() => u.value, (t, o) => {
|
|
64
|
-
|
|
64
|
+
de(n.rules) && M(t);
|
|
65
65
|
});
|
|
66
|
-
function
|
|
66
|
+
function $() {
|
|
67
67
|
var t;
|
|
68
68
|
s.value = !1, (t = k.value.inputField) == null || t.focus();
|
|
69
69
|
}
|
|
@@ -71,12 +71,12 @@ const be = {
|
|
|
71
71
|
p("search", m);
|
|
72
72
|
}
|
|
73
73
|
function Q() {
|
|
74
|
-
|
|
74
|
+
M(u);
|
|
75
75
|
}
|
|
76
76
|
function X(t) {
|
|
77
77
|
const o = t.key;
|
|
78
78
|
if (o === "Escape") {
|
|
79
|
-
|
|
79
|
+
$();
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
if (["ArrowDown", "ArrowUp"].includes(o)) {
|
|
@@ -84,15 +84,15 @@ const be = {
|
|
|
84
84
|
g.value.focusWithKey(o);
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
_(t);
|
|
88
88
|
}
|
|
89
89
|
function Y(t) {
|
|
90
|
-
|
|
90
|
+
_(t);
|
|
91
91
|
}
|
|
92
92
|
function Z() {
|
|
93
93
|
s.value = !1;
|
|
94
94
|
}
|
|
95
|
-
return (t, o) => (i(),
|
|
95
|
+
return (t, o) => (i(), d(ve, {
|
|
96
96
|
modelValue: e(m),
|
|
97
97
|
"onUpdate:modelValue": [
|
|
98
98
|
o[2] || (o[2] = (l) => R(m) ? m.value = l : null),
|
|
@@ -107,15 +107,15 @@ const be = {
|
|
|
107
107
|
autocomplete: "off",
|
|
108
108
|
onKeyDown: X,
|
|
109
109
|
onFocusInput: Q,
|
|
110
|
-
onHandleClick: e(
|
|
110
|
+
onHandleClick: e(K),
|
|
111
111
|
onBlurInput: Z,
|
|
112
|
-
placeholder: n.multiple && e(z)(e(
|
|
112
|
+
placeholder: n.multiple && e(z)(e(c)) && e(c).length ? "" : e(D),
|
|
113
113
|
error: !!y.value,
|
|
114
114
|
"error-messages": y.value
|
|
115
115
|
}, ne({
|
|
116
116
|
default: r(() => [
|
|
117
|
-
e(z)(e(
|
|
118
|
-
(i(!0), U(re, null, ie(e(
|
|
117
|
+
e(z)(e(c)) ? (i(), U("div", be, [
|
|
118
|
+
(i(!0), U(re, null, ie(e(c), (l) => (i(), d(ge, {
|
|
119
119
|
key: l.id ?? l.name,
|
|
120
120
|
size: "small",
|
|
121
121
|
class: "ml-1"
|
|
@@ -123,7 +123,7 @@ const be = {
|
|
|
123
123
|
default: r(() => [
|
|
124
124
|
ae("div", Ve, [
|
|
125
125
|
b(V(e(j)(l, t.itemTitle)) + " ", 1),
|
|
126
|
-
a(
|
|
126
|
+
a(v, {
|
|
127
127
|
color: "error",
|
|
128
128
|
icon: e(f).close,
|
|
129
129
|
size: "small",
|
|
@@ -134,7 +134,7 @@ const be = {
|
|
|
134
134
|
]),
|
|
135
135
|
_: 2
|
|
136
136
|
}, 1024))), 128))
|
|
137
|
-
])) :
|
|
137
|
+
])) : h("", !0),
|
|
138
138
|
a(ke, {
|
|
139
139
|
transition: "fade",
|
|
140
140
|
"onClick:outside": e(w),
|
|
@@ -142,9 +142,10 @@ const be = {
|
|
|
142
142
|
"onUpdate:modelValue": o[1] || (o[1] = (l) => R(s) ? s.value = l : null),
|
|
143
143
|
activator: "parent",
|
|
144
144
|
"parent-ref": e(k),
|
|
145
|
-
onHandleEscape:
|
|
145
|
+
onHandleEscape: $,
|
|
146
146
|
"close-on-content-click": t.closeOnSelect,
|
|
147
|
-
"max-height": t.maxHeight
|
|
147
|
+
"max-height": t.maxHeight,
|
|
148
|
+
"hide-details": t.hideDetails
|
|
148
149
|
}, {
|
|
149
150
|
default: r(() => [
|
|
150
151
|
a(me, {
|
|
@@ -155,7 +156,7 @@ const be = {
|
|
|
155
156
|
onKeyDown: Y
|
|
156
157
|
}, {
|
|
157
158
|
default: r(() => [
|
|
158
|
-
e(W) ? (i(),
|
|
159
|
+
e(W) ? (i(), d(B, { key: 0 }, {
|
|
159
160
|
default: r(() => [
|
|
160
161
|
a(Ce, {
|
|
161
162
|
onClick: e(q),
|
|
@@ -170,8 +171,8 @@ const be = {
|
|
|
170
171
|
}, 8, ["onClick"])
|
|
171
172
|
]),
|
|
172
173
|
_: 1
|
|
173
|
-
})) :
|
|
174
|
-
a(
|
|
174
|
+
})) : h("", !0),
|
|
175
|
+
a(ce, {
|
|
175
176
|
items: I.value,
|
|
176
177
|
search: e(m),
|
|
177
178
|
"searchable-keys": n.searchableKeys,
|
|
@@ -181,11 +182,11 @@ const be = {
|
|
|
181
182
|
"item-height": 48
|
|
182
183
|
}, {
|
|
183
184
|
default: r(({ item: l, index: ee }) => {
|
|
184
|
-
var
|
|
185
|
+
var x, A;
|
|
185
186
|
return [
|
|
186
|
-
(i(),
|
|
187
|
+
(i(), d(B, {
|
|
187
188
|
value: l,
|
|
188
|
-
key: ((
|
|
189
|
+
key: ((x = l.id) == null ? void 0 : x.toString()) ?? l.name,
|
|
189
190
|
disabled: e(P)(l),
|
|
190
191
|
class: se(G(l)),
|
|
191
192
|
density: t.density,
|
|
@@ -213,35 +214,35 @@ const be = {
|
|
|
213
214
|
}, 8, ["onUpdate:selected"])
|
|
214
215
|
]),
|
|
215
216
|
_: 1
|
|
216
|
-
}, 8, ["onClick:outside", "modelValue", "parent-ref", "close-on-content-click", "max-height"])
|
|
217
|
+
}, 8, ["onClick:outside", "modelValue", "parent-ref", "close-on-content-click", "max-height", "hide-details"])
|
|
217
218
|
]),
|
|
218
219
|
_: 2
|
|
219
220
|
}, [
|
|
220
221
|
t.hasIcons ? {
|
|
221
222
|
name: "append-inner",
|
|
222
223
|
fn: r(() => [
|
|
223
|
-
t.clearable && e(
|
|
224
|
+
t.clearable && e(c) ? (i(), d(v, {
|
|
224
225
|
key: 0,
|
|
225
226
|
onClick: e(T),
|
|
226
227
|
size: "small",
|
|
227
228
|
color: "error",
|
|
228
229
|
icon: e(f).close,
|
|
229
230
|
class: "mr-1 mt-1"
|
|
230
|
-
}, null, 8, ["onClick", "icon"])) :
|
|
231
|
-
a(
|
|
231
|
+
}, null, 8, ["onClick", "icon"])) : h("", !0),
|
|
232
|
+
a(v, {
|
|
232
233
|
color: "teal-darken-1",
|
|
233
234
|
size: "large",
|
|
234
235
|
class: "cursor-pointer",
|
|
235
236
|
icon: e(s) ? e(f).menuUpOutline : e(f).menuDownOutline,
|
|
236
|
-
onClick: ue(e(
|
|
237
|
+
onClick: ue(e(K), ["stop"])
|
|
237
238
|
}, null, 8, ["icon", "onClick"]),
|
|
238
|
-
t.required ? (i(),
|
|
239
|
+
t.required ? (i(), d(v, {
|
|
239
240
|
key: 1,
|
|
240
241
|
color: "teal-darken-1",
|
|
241
242
|
size: "x-small",
|
|
242
243
|
class: "mb-4",
|
|
243
244
|
icon: e(f).asterisk
|
|
244
|
-
}, null, 8, ["icon"])) :
|
|
245
|
+
}, null, 8, ["icon"])) : h("", !0)
|
|
245
246
|
]),
|
|
246
247
|
key: "0"
|
|
247
248
|
} : void 0
|
|
@@ -19,7 +19,7 @@ function L(e, d, u, g) {
|
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
let o = n.bottom;
|
|
22
|
-
!e.hideDetails && ((l = e.parentRef) != null && l.$el) && (o -= 15), a.value = {
|
|
22
|
+
!e.hideDetails && ((l = e.parentRef) != null && l.$el) && (console.log("iuii"), o -= 15), a.value = {
|
|
23
23
|
position: "absolute",
|
|
24
24
|
top: `${o + window.scrollY}px`,
|
|
25
25
|
left: `${n.left + window.scrollX}px`,
|