adverich-kun-ui 0.1.380 → 0.1.382
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,9 +1,9 @@
|
|
|
1
1
|
import { mergeModels as R, useModel as S, onMounted as te, ref as _, watch as oe, createElementBlock as C, openBlock as s, createVNode as n, unref as l, isRef as $, createSlots as ie, withCtx as i, createCommentVNode as w, Fragment as ne, renderList as ae, createBlock as m, createElementVNode as re, createTextVNode as V, toDisplayString as A, withModifiers as se } from "vue";
|
|
2
2
|
import { icons as f } from "../../../../icons/index.js";
|
|
3
|
-
import { isNotEmpty as ue, isArray as
|
|
3
|
+
import { isNotEmpty as ue, isArray as x } from "../../../../utils/utils.js";
|
|
4
4
|
import de from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
|
|
5
5
|
import ce from "../../../KunList/src/components/KunList.vue.js";
|
|
6
|
-
import
|
|
6
|
+
import z from "../../../KunListItem/src/components/KunListItem.vue.js";
|
|
7
7
|
import F from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
|
|
8
8
|
import me from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
|
|
9
9
|
import fe from "../../../KunMenu/src/components/KunMenu.vue.js";
|
|
@@ -14,8 +14,8 @@ import ke from "../../../KunChip/src/components/KunChip.vue.js";
|
|
|
14
14
|
import v from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
15
15
|
const ye = {
|
|
16
16
|
key: 0,
|
|
17
|
-
class: "flex
|
|
18
|
-
}, be = { class: "flex
|
|
17
|
+
class: "flex flex-wrap gap-1"
|
|
18
|
+
}, be = { class: "flex items-center" }, ze = {
|
|
19
19
|
__name: "KunAutocomplete",
|
|
20
20
|
props: /* @__PURE__ */ R(he, {
|
|
21
21
|
modelValue: { default: null },
|
|
@@ -38,10 +38,10 @@ const ye = {
|
|
|
38
38
|
toggleMenu: U,
|
|
39
39
|
onMenuKeydown: H,
|
|
40
40
|
getSelectedItem: O,
|
|
41
|
-
textArr:
|
|
42
|
-
getItemText:
|
|
43
|
-
isAlphanumeric:
|
|
44
|
-
checkDisabled:
|
|
41
|
+
textArr: q,
|
|
42
|
+
getItemText: P,
|
|
43
|
+
isAlphanumeric: W,
|
|
44
|
+
checkDisabled: j,
|
|
45
45
|
itemToString: D,
|
|
46
46
|
placeholder: G
|
|
47
47
|
} = pe(u, p, a, I);
|
|
@@ -70,7 +70,7 @@ const ye = {
|
|
|
70
70
|
L();
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
(
|
|
73
|
+
(W(o) || o === "Backspace") && g(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), r.value || g(), console.log("listRef.value", b.value), (d = (t = b.value) == null ? void 0 : t.focusWithKey) == null || d.call(t, o));
|
|
74
74
|
}
|
|
75
75
|
function X(e) {
|
|
76
76
|
p("search", c);
|
|
@@ -106,20 +106,19 @@ const ye = {
|
|
|
106
106
|
rounded: l(r) ? "rounded-t" : "rounded",
|
|
107
107
|
onBlur: ee,
|
|
108
108
|
onKeyDown: Q,
|
|
109
|
-
placeholder: u.multiple && l(
|
|
109
|
+
placeholder: u.multiple && l(x)(a.value) && a.value.length ? "" : l(G),
|
|
110
110
|
error: !!h.value,
|
|
111
111
|
"error-messages": h.value
|
|
112
112
|
}, ie({
|
|
113
113
|
default: i(() => [
|
|
114
|
-
l(
|
|
114
|
+
l(x)(a.value) ? (s(), C("div", ye, [
|
|
115
115
|
(s(!0), C(ne, null, ae(a.value, (t) => (s(), m(ke, {
|
|
116
116
|
key: t.id ?? t.name,
|
|
117
|
-
size: "small"
|
|
118
|
-
class: "ml-1"
|
|
117
|
+
size: "small"
|
|
119
118
|
}, {
|
|
120
119
|
default: i(() => [
|
|
121
120
|
re("div", be, [
|
|
122
|
-
V(A(l(
|
|
121
|
+
V(A(l(P)(t, e.itemTitle)) + " ", 1),
|
|
123
122
|
n(v, {
|
|
124
123
|
color: "error",
|
|
125
124
|
icon: l(f).close,
|
|
@@ -167,11 +166,11 @@ const ye = {
|
|
|
167
166
|
"item-height": 48
|
|
168
167
|
}, {
|
|
169
168
|
default: i(({ item: t, index: d, empty: le }) => [
|
|
170
|
-
!le && t ? (s(), m(
|
|
169
|
+
!le && t ? (s(), m(z, {
|
|
171
170
|
value: t,
|
|
172
171
|
key: `kun-list-${d + 1}`,
|
|
173
172
|
id: `kun-item-${d + 1}`,
|
|
174
|
-
disabled: l(
|
|
173
|
+
disabled: l(j)(t),
|
|
175
174
|
"bg-items": e.bgItemListColor,
|
|
176
175
|
"hover-bg": e.hoverItemListColor,
|
|
177
176
|
activeClass: e.selectedItemListColor,
|
|
@@ -181,7 +180,7 @@ const ye = {
|
|
|
181
180
|
default: i(() => [
|
|
182
181
|
n(F, { class: "text-wrap" }, {
|
|
183
182
|
default: i(() => [
|
|
184
|
-
V(A(l(D)(t, e.itemTitle ?? l(
|
|
183
|
+
V(A(l(D)(t, e.itemTitle ?? l(q), "hasDefault")), 1)
|
|
185
184
|
]),
|
|
186
185
|
_: 2
|
|
187
186
|
}, 1024),
|
|
@@ -190,7 +189,7 @@ const ye = {
|
|
|
190
189
|
}, null, 8, ["text"])
|
|
191
190
|
]),
|
|
192
191
|
_: 2
|
|
193
|
-
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (s(), m(
|
|
192
|
+
}, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (s(), m(z, {
|
|
194
193
|
key: 1,
|
|
195
194
|
disabled: ""
|
|
196
195
|
}, {
|
|
@@ -250,5 +249,5 @@ const ye = {
|
|
|
250
249
|
}
|
|
251
250
|
};
|
|
252
251
|
export {
|
|
253
|
-
|
|
252
|
+
ze as default
|
|
254
253
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getCurrentInstance as U, computed as
|
|
2
|
-
import { icons as
|
|
1
|
+
import { getCurrentInstance as U, computed as d, useSlots as H, ref as q, createElementBlock as n, openBlock as o, createCommentVNode as r, createElementVNode as h, normalizeClass as u, toDisplayString as i, mergeProps as G, unref as t, renderSlot as k, withModifiers as J, createVNode as L } from "vue";
|
|
2
|
+
import { icons as P } from "../../../../icons/index.js";
|
|
3
3
|
import Q from "../composables/KunTextFieldProps.js";
|
|
4
4
|
import W from "../composables/useKunTextFieldComposable.js";
|
|
5
5
|
import X from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
@@ -7,18 +7,18 @@ const Y = {
|
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "mr-2"
|
|
9
9
|
}, Z = ["type", "value", "placeholder", "disabled", "readonly", "maxlength", "aria-invalid", "aria-describedby"], _ = ["disabled"], ee = {
|
|
10
|
-
key:
|
|
10
|
+
key: 3,
|
|
11
11
|
class: "flex items-center justify-center min-w-[32px] h-full px-1"
|
|
12
|
-
}, le = {
|
|
13
|
-
key: 7,
|
|
14
|
-
class: "ml-2"
|
|
15
12
|
}, te = {
|
|
13
|
+
key: 5,
|
|
14
|
+
class: "ml-2"
|
|
15
|
+
}, le = {
|
|
16
16
|
key: 0,
|
|
17
17
|
class: "h-[1.25rem]"
|
|
18
|
-
},
|
|
18
|
+
}, se = ["id"], ne = {
|
|
19
19
|
key: 1,
|
|
20
20
|
class: "text-xs text-center"
|
|
21
|
-
},
|
|
21
|
+
}, oe = {
|
|
22
22
|
key: 2,
|
|
23
23
|
class: "text-xs text-right"
|
|
24
24
|
}, pe = {
|
|
@@ -32,126 +32,121 @@ const Y = {
|
|
|
32
32
|
"keyDown",
|
|
33
33
|
"keyUp"
|
|
34
34
|
],
|
|
35
|
-
setup(
|
|
36
|
-
const
|
|
35
|
+
setup(V, { expose: D, emit: j }) {
|
|
36
|
+
const a = V, p = j, {
|
|
37
37
|
inputField: c,
|
|
38
|
-
inputValue:
|
|
39
|
-
rootRef:
|
|
38
|
+
inputValue: f,
|
|
39
|
+
rootRef: w,
|
|
40
40
|
inputFocused: b,
|
|
41
|
-
validationError:
|
|
41
|
+
validationError: B,
|
|
42
42
|
hasError: y,
|
|
43
|
-
handleInput:
|
|
44
|
-
handleBlur:
|
|
45
|
-
focusInput:
|
|
46
|
-
validate:
|
|
47
|
-
reset:
|
|
48
|
-
resetValidation:
|
|
49
|
-
clearInput:
|
|
50
|
-
} = W(
|
|
43
|
+
handleInput: g,
|
|
44
|
+
handleBlur: C,
|
|
45
|
+
focusInput: I,
|
|
46
|
+
validate: E,
|
|
47
|
+
reset: K,
|
|
48
|
+
resetValidation: S,
|
|
49
|
+
clearInput: $
|
|
50
|
+
} = W(a, p);
|
|
51
51
|
D({
|
|
52
|
-
validate:
|
|
53
|
-
reset:
|
|
54
|
-
resetValidation:
|
|
52
|
+
validate: E,
|
|
53
|
+
reset: K,
|
|
54
|
+
resetValidation: S,
|
|
55
55
|
inputField: c,
|
|
56
|
-
rootRef:
|
|
56
|
+
rootRef: w,
|
|
57
57
|
focus: () => {
|
|
58
58
|
var e;
|
|
59
59
|
return (e = c.value) == null ? void 0 : e.focus();
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
const m = `input-${U().uid}`,
|
|
63
|
-
function
|
|
62
|
+
const m = `input-${U().uid}`, T = d(() => b.value || !!f.value || a.dirty), x = H(), N = d(() => !!x["prepend-inner"]), O = d(() => !!x["append-inner"]), v = q(!1), z = d(() => v.value ? P.eyeOffOutline : P.eyeOutline);
|
|
63
|
+
function A() {
|
|
64
64
|
v.value = !v.value;
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
return (e,
|
|
66
|
+
const M = d(() => a.type === "password" ? v.value ? "text" : "password" : a.type), R = d(() => a.density === "compact" ? "p-1" : a.density === "comfortable" ? "p-2" : "p-3");
|
|
67
|
+
return (e, l) => {
|
|
68
68
|
var F;
|
|
69
69
|
return o(), n("div", {
|
|
70
70
|
class: "w-full flex flex-col relative",
|
|
71
71
|
ref_key: "rootRef",
|
|
72
|
-
ref:
|
|
72
|
+
ref: w
|
|
73
73
|
}, [
|
|
74
74
|
e.label ? (o(), n("label", {
|
|
75
75
|
key: 0,
|
|
76
76
|
for: m,
|
|
77
|
-
class:
|
|
77
|
+
class: u([
|
|
78
78
|
e.labelColor,
|
|
79
79
|
"absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
|
|
80
|
-
|
|
80
|
+
T.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
|
|
81
81
|
])
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
class:
|
|
82
|
+
}, i(e.label), 3)) : r("", !0),
|
|
83
|
+
h("div", G({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
|
|
84
|
+
h("div", {
|
|
85
|
+
class: u(["flex flex-row items-center w-full h-full border", [
|
|
86
86
|
e.bgInput,
|
|
87
87
|
e.rounded,
|
|
88
|
-
|
|
88
|
+
t(b) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
|
|
89
89
|
e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
|
|
90
|
-
|
|
90
|
+
t(y) ? "bg-red-200 dark:bg-red-900" : ""
|
|
91
91
|
]])
|
|
92
92
|
}, [
|
|
93
|
-
e.prefix ? (o(), n("div", Y,
|
|
94
|
-
|
|
93
|
+
e.prefix ? (o(), n("div", Y, i(e.prefix), 1)) : r("", !0),
|
|
94
|
+
N.value ? (o(), n("div", {
|
|
95
95
|
key: 1,
|
|
96
|
-
class:
|
|
96
|
+
class: u([e.prependInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
|
|
97
97
|
}, [
|
|
98
|
-
|
|
98
|
+
k(e.$slots, "prepend-inner")
|
|
99
99
|
], 2)) : r("", !0),
|
|
100
|
-
|
|
101
|
-
key: 2,
|
|
100
|
+
h("input", {
|
|
102
101
|
ref_key: "inputField",
|
|
103
102
|
ref: c,
|
|
104
|
-
type:
|
|
105
|
-
value:
|
|
103
|
+
type: M.value,
|
|
104
|
+
value: t(f),
|
|
106
105
|
id: m,
|
|
107
106
|
placeholder: e.placeholder,
|
|
108
107
|
disabled: e.disabled,
|
|
109
108
|
readonly: e.readonly,
|
|
110
109
|
maxlength: e.maxlength,
|
|
111
110
|
autocomplete: "off",
|
|
112
|
-
class:
|
|
113
|
-
"aria-invalid":
|
|
114
|
-
"aria-describedby":
|
|
115
|
-
onInput:
|
|
116
|
-
onBlur:
|
|
117
|
-
onFocus:
|
|
118
|
-
onClick:
|
|
119
|
-
onKeydown:
|
|
120
|
-
onKeyup:
|
|
121
|
-
}, null, 42, Z)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}, [
|
|
125
|
-
h(e.$slots, "default")
|
|
126
|
-
], 2)),
|
|
127
|
-
e.clearable && l(p) ? (o(), n("button", {
|
|
128
|
-
key: 4,
|
|
111
|
+
class: u(["w-full h-full bg-transparent focus:outline-none", [R.value, e.textColor, e.placeholderColor, e.rounded, e.textCenter ? "text-center" : ""]]),
|
|
112
|
+
"aria-invalid": t(y) ? "true" : "false",
|
|
113
|
+
"aria-describedby": t(y) ? `error-${m}` : null,
|
|
114
|
+
onInput: l[0] || (l[0] = (...s) => t(g) && t(g)(...s)),
|
|
115
|
+
onBlur: l[1] || (l[1] = (...s) => t(C) && t(C)(...s)),
|
|
116
|
+
onFocus: l[2] || (l[2] = (...s) => t(I) && t(I)(...s)),
|
|
117
|
+
onClick: l[3] || (l[3] = J((s) => p("handleClick"), ["stop"])),
|
|
118
|
+
onKeydown: l[4] || (l[4] = (s) => p("keyDown", s)),
|
|
119
|
+
onKeyup: l[5] || (l[5] = (s) => p("keyUp", s))
|
|
120
|
+
}, null, 42, Z),
|
|
121
|
+
e.clearable && t(f) ? (o(), n("button", {
|
|
122
|
+
key: 2,
|
|
129
123
|
type: "button",
|
|
130
|
-
onClick:
|
|
131
|
-
class:
|
|
124
|
+
onClick: l[6] || (l[6] = (...s) => t($) && t($)(...s)),
|
|
125
|
+
class: u(["ml-2", e.textColor]),
|
|
132
126
|
disabled: e.disabled || e.readonly
|
|
133
127
|
}, " × ", 10, _)) : r("", !0),
|
|
128
|
+
k(e.$slots, "default"),
|
|
134
129
|
e.type === "password" && e.showPasswordToggle ? (o(), n("div", ee, [
|
|
135
130
|
L(X, {
|
|
136
|
-
icon:
|
|
137
|
-
onClick:
|
|
131
|
+
icon: z.value,
|
|
132
|
+
onClick: A
|
|
138
133
|
}, null, 8, ["icon"])
|
|
139
134
|
])) : r("", !0),
|
|
140
|
-
|
|
141
|
-
key:
|
|
142
|
-
class:
|
|
135
|
+
O.value ? (o(), n("div", {
|
|
136
|
+
key: 4,
|
|
137
|
+
class: u([e.appendInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
|
|
143
138
|
}, [
|
|
144
|
-
|
|
139
|
+
k(e.$slots, "append-inner")
|
|
145
140
|
], 2)) : r("", !0),
|
|
146
|
-
e.suffix ? (o(), n("div",
|
|
141
|
+
e.suffix ? (o(), n("div", te, i(e.suffix), 1)) : r("", !0)
|
|
147
142
|
], 2),
|
|
148
|
-
e.hideDetails ? r("", !0) : (o(), n("div",
|
|
149
|
-
|
|
143
|
+
e.hideDetails ? r("", !0) : (o(), n("div", le, [
|
|
144
|
+
t(y) ? (o(), n("div", {
|
|
150
145
|
key: 0,
|
|
151
146
|
id: `error-${m}`,
|
|
152
147
|
class: "text-red-500 text-sm text-center"
|
|
153
|
-
},
|
|
154
|
-
e.counter && e.maxlength ? (o(), n("div",
|
|
148
|
+
}, i(t(B) || e.errorMessage), 9, se)) : e.hint && (e.persistentHint || t(b)) ? (o(), n("div", ne, i(e.hint), 1)) : r("", !0),
|
|
149
|
+
e.counter && e.maxlength ? (o(), n("div", oe, i(((F = t(f)) == null ? void 0 : F.length) || 0) + " / " + i(e.maxlength), 1)) : r("", !0)
|
|
155
150
|
]))
|
|
156
151
|
], 16)
|
|
157
152
|
], 512);
|