adverich-kun-ui 0.1.329 → 0.1.331
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,10 +1,10 @@
|
|
|
1
|
-
import { ref as D, watch as E, computed as f, createElementBlock as r, openBlock as o,
|
|
1
|
+
import { ref as D, watch as E, computed as f, createElementBlock as r, openBlock as o, mergeProps as F, unref as t, createCommentVNode as a, createElementVNode as $, withDirectives as M, renderSlot as s, createBlock as w, withKeys as j, normalizeClass as C, withModifiers as H, createVNode as K, createTextVNode as V, toDisplayString as g, Fragment as R, renderList as T } from "vue";
|
|
2
2
|
import h from "../../../KunIcon/src/components/KunIcon.vue.js";
|
|
3
3
|
import { useCheckboxModel as L } from "../composables/useCheckboxModel.js";
|
|
4
|
-
import { useValidation as
|
|
5
|
-
import { vRipple as
|
|
6
|
-
import { icons as
|
|
7
|
-
const
|
|
4
|
+
import { useValidation as P } from "../composables/useValidation.js";
|
|
5
|
+
import { vRipple as q } from "../../../../directives/ripple.js";
|
|
6
|
+
import { icons as y } from "../../../../icons/index.js";
|
|
7
|
+
const G = ["name", "checked", "value"], J = ["aria-checked", "aria-disabled", "tabindex"], Q = {
|
|
8
8
|
key: 1,
|
|
9
9
|
class: "cursor-pointer"
|
|
10
10
|
}, U = {
|
|
@@ -60,49 +60,49 @@ const J = ["name", "checked", "value"], P = ["aria-checked", "aria-disabled", "t
|
|
|
60
60
|
"click:append",
|
|
61
61
|
"click:prepend"
|
|
62
62
|
],
|
|
63
|
-
setup(
|
|
64
|
-
const c = N, e =
|
|
65
|
-
E(() => e.focused, (
|
|
63
|
+
setup(v, { expose: I, emit: N }) {
|
|
64
|
+
const c = N, e = v, d = D(e.focused ?? !1);
|
|
65
|
+
E(() => e.focused, (n) => d.value = n);
|
|
66
66
|
const {
|
|
67
67
|
isChecked: p,
|
|
68
68
|
toggle: u,
|
|
69
69
|
internalValue: W
|
|
70
70
|
} = L(e, c), {
|
|
71
71
|
errorMessages: m,
|
|
72
|
-
isValid:
|
|
73
|
-
validate:
|
|
72
|
+
isValid: b,
|
|
73
|
+
validate: k,
|
|
74
74
|
resetValidation: z
|
|
75
|
-
} =
|
|
76
|
-
I({ validate:
|
|
77
|
-
const O = f(() => e.indeterminate ? e.indeterminateIcon ||
|
|
75
|
+
} = P(e, W);
|
|
76
|
+
I({ validate: k, resetValidation: z });
|
|
77
|
+
const O = f(() => e.indeterminate ? e.indeterminateIcon || y.checkboxIndeterminate : p.value ? e.trueIcon || y.checkboxOn : e.falseIcon || y.checkboxBlank), A = f(() => [
|
|
78
78
|
typeof e.iconColor == "string" ? `text-${e.iconColor}` : "",
|
|
79
79
|
e.glow && d.value ? "opacity-100" : "opacity-70"
|
|
80
|
-
]),
|
|
80
|
+
]), x = f(() => ({
|
|
81
81
|
sm: "w-4 h-4 text-sm",
|
|
82
82
|
md: "w-5 h-5 text-base",
|
|
83
83
|
lg: "w-6 h-6 text-lg"
|
|
84
84
|
})[e.size] || e.size);
|
|
85
|
-
return (
|
|
86
|
-
var
|
|
87
|
-
return o(), r("div", {
|
|
88
|
-
class:
|
|
85
|
+
return (n, i) => {
|
|
86
|
+
var S;
|
|
87
|
+
return o(), r("div", F({
|
|
88
|
+
class: [
|
|
89
89
|
"kun-checkbox",
|
|
90
90
|
"flex",
|
|
91
|
-
|
|
91
|
+
v.direction === "vertical" ? "flex-col items-start" : "flex-row items-center",
|
|
92
92
|
"gap-2",
|
|
93
93
|
e.color && `text-${e.color}`,
|
|
94
94
|
{
|
|
95
95
|
"opacity-50 pointer-events-none": e.disabled || e.readonly,
|
|
96
|
-
"text-red-600": e.error || !t(
|
|
96
|
+
"text-red-600": e.error || !t(b),
|
|
97
97
|
"focus-within:ring-2 ring-primary-500": d.value
|
|
98
98
|
}
|
|
99
|
-
]
|
|
100
|
-
style:
|
|
99
|
+
],
|
|
100
|
+
style: {
|
|
101
101
|
width: e.width && `${e.width}px`,
|
|
102
102
|
minWidth: e.minWidth && `${e.minWidth}px`,
|
|
103
103
|
maxWidth: e.maxWidth && `${e.maxWidth}px`
|
|
104
|
-
}
|
|
105
|
-
}, [
|
|
104
|
+
}
|
|
105
|
+
}, n.$attrs), [
|
|
106
106
|
e.name ? (o(), r("input", {
|
|
107
107
|
key: 0,
|
|
108
108
|
type: "checkbox",
|
|
@@ -110,71 +110,71 @@ const J = ["name", "checked", "value"], P = ["aria-checked", "aria-disabled", "t
|
|
|
110
110
|
checked: t(p),
|
|
111
111
|
value: e.value ?? e.trueValue,
|
|
112
112
|
class: "hidden"
|
|
113
|
-
}, null, 8,
|
|
114
|
-
|
|
113
|
+
}, null, 8, G)) : a("", !0),
|
|
114
|
+
$("div", {
|
|
115
115
|
class: "flex items-center gap-2",
|
|
116
|
-
onClick:
|
|
116
|
+
onClick: i[0] || (i[0] = (l) => n.$emit("click:prepend"))
|
|
117
117
|
}, [
|
|
118
|
-
s(
|
|
119
|
-
e.prependIcon ? (o(),
|
|
118
|
+
s(n.$slots, "prepend"),
|
|
119
|
+
e.prependIcon ? (o(), w(h, {
|
|
120
120
|
key: 0,
|
|
121
121
|
icon: e.prependIcon
|
|
122
122
|
}, null, 8, ["icon"])) : a("", !0)
|
|
123
123
|
]),
|
|
124
124
|
M((o(), r("div", {
|
|
125
|
-
class:
|
|
125
|
+
class: C(["relative inline-flex items-center justify-center cursor-pointer", [x.value]]),
|
|
126
126
|
role: "checkbox",
|
|
127
127
|
"aria-checked": e.indeterminate ? "mixed" : t(p),
|
|
128
128
|
"aria-disabled": e.disabled,
|
|
129
129
|
tabindex: e.disabled ? -1 : 0,
|
|
130
|
-
onClick:
|
|
131
|
-
onFocus:
|
|
130
|
+
onClick: i[1] || (i[1] = (...l) => t(u) && t(u)(...l)),
|
|
131
|
+
onFocus: i[2] || (i[2] = () => {
|
|
132
132
|
d.value = !0, c("update:focused", !0);
|
|
133
133
|
}),
|
|
134
|
-
onBlur:
|
|
134
|
+
onBlur: i[3] || (i[3] = () => {
|
|
135
135
|
var l;
|
|
136
|
-
d.value = !1, c("update:focused", !1), (l = e.validateOn) != null && l.includes("blur") && t(
|
|
136
|
+
d.value = !1, c("update:focused", !1), (l = e.validateOn) != null && l.includes("blur") && t(k)();
|
|
137
137
|
}),
|
|
138
|
-
onKeydown:
|
|
138
|
+
onKeydown: i[4] || (i[4] = j(H((...l) => t(u) && t(u)(...l), ["prevent"]), ["space"]))
|
|
139
139
|
}, [
|
|
140
140
|
K(h, {
|
|
141
141
|
icon: O.value,
|
|
142
|
-
class:
|
|
142
|
+
class: C([...A.value, x.value])
|
|
143
143
|
}, null, 8, ["icon", "class"]),
|
|
144
|
-
s(
|
|
145
|
-
], 42,
|
|
146
|
-
[t(
|
|
144
|
+
s(n.$slots, "input")
|
|
145
|
+
], 42, J)), [
|
|
146
|
+
[t(q), e.ripple]
|
|
147
147
|
]),
|
|
148
|
-
e.label ||
|
|
149
|
-
s(
|
|
148
|
+
e.label || n.$slots.label ? (o(), r("div", Q, [
|
|
149
|
+
s(n.$slots, "label", {
|
|
150
150
|
label: e.label
|
|
151
151
|
}, () => [
|
|
152
152
|
V(g(e.label), 1)
|
|
153
153
|
])
|
|
154
154
|
])) : a("", !0),
|
|
155
|
-
|
|
155
|
+
$("div", {
|
|
156
156
|
class: "flex items-center gap-2",
|
|
157
|
-
onClick:
|
|
157
|
+
onClick: i[5] || (i[5] = (l) => n.$emit("click:append"))
|
|
158
158
|
}, [
|
|
159
|
-
s(
|
|
160
|
-
e.appendIcon ? (o(),
|
|
159
|
+
s(n.$slots, "append"),
|
|
160
|
+
e.appendIcon ? (o(), w(h, {
|
|
161
161
|
key: 0,
|
|
162
162
|
icon: e.appendIcon
|
|
163
163
|
}, null, 8, ["icon"])) : a("", !0)
|
|
164
164
|
]),
|
|
165
|
-
!e.hideDetails && ((
|
|
166
|
-
s(
|
|
165
|
+
!e.hideDetails && ((S = t(m)) != null && S.length || e.hint || e.persistentHint) ? (o(), r("div", U, [
|
|
166
|
+
s(n.$slots, "details", {}, () => {
|
|
167
167
|
var l;
|
|
168
168
|
return [
|
|
169
|
-
(e.error || !t(
|
|
170
|
-
(o(!0), r(R, null, T(t(m).slice(0, Number(e.maxErrors)), (
|
|
171
|
-
V(g(
|
|
169
|
+
(e.error || !t(b)) && ((l = t(m)) != null && l.length) ? (o(), r("div", X, [
|
|
170
|
+
(o(!0), r(R, null, T(t(m).slice(0, Number(e.maxErrors)), (B) => s(n.$slots, "message", { message: B }, () => [
|
|
171
|
+
V(g(B), 1)
|
|
172
172
|
])), 256))
|
|
173
173
|
])) : e.hint || e.persistentHint ? (o(), r("div", Y, g(e.hint), 1)) : a("", !0)
|
|
174
174
|
];
|
|
175
175
|
})
|
|
176
176
|
])) : a("", !0)
|
|
177
|
-
],
|
|
177
|
+
], 16);
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
180
|
};
|
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { kunTextareaProps as
|
|
3
|
-
import { useKunTextarea as
|
|
1
|
+
import { ref as q, computed as p, createElementBlock as l, openBlock as s, normalizeClass as m, renderSlot as i, createElementVNode as a, normalizeProps as y, guardReactiveProps as k, unref as t, createCommentVNode as d, toDisplayString as b, createBlock as h, resolveDynamicComponent as C, Fragment as J, renderList as O, withDirectives as Q, vShow as U, createTextVNode as W } from "vue";
|
|
2
|
+
import { kunTextareaProps as X } from "../composables/KunTextareaProps.js";
|
|
3
|
+
import { useKunTextarea as Y } from "../composables/useKunTextareaComposable.js";
|
|
4
4
|
import { renderIconSlot as $ } from "../../../../utils/renderIcon.js";
|
|
5
|
-
const
|
|
5
|
+
const Z = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "block text-sm font-medium mb-1"
|
|
8
|
-
},
|
|
8
|
+
}, x = { class: "relative" }, _ = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "absolute left-2 top-2 flex items-center"
|
|
11
|
-
},
|
|
11
|
+
}, ee = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "absolute left-2 top-2 ml-1"
|
|
14
|
-
},
|
|
14
|
+
}, oe = ["value", "rows", "disabled", "readonly", "placeholder"], re = {
|
|
15
15
|
key: 3,
|
|
16
16
|
class: "absolute right-2 top-2 mr-1"
|
|
17
|
-
},
|
|
17
|
+
}, te = {
|
|
18
18
|
key: 4,
|
|
19
19
|
class: "absolute right-2 top-2 flex items-center"
|
|
20
20
|
}, ne = {
|
|
21
21
|
key: 5,
|
|
22
22
|
class: "mt-1"
|
|
23
|
-
},
|
|
23
|
+
}, se = { class: "h-1 w-full bg-gray-200 rounded overflow-hidden" }, le = {
|
|
24
24
|
key: 7,
|
|
25
25
|
class: "text-xs text-right mt-1 text-gray-400"
|
|
26
|
-
},
|
|
26
|
+
}, ae = { key: 0 }, ce = {
|
|
27
27
|
__name: "KunTextarea",
|
|
28
|
-
props:
|
|
28
|
+
props: X,
|
|
29
29
|
emits: ["update:modelValue", "click:clear", "click:control", "update:focused", "mousedown:control"],
|
|
30
|
-
setup(B, { expose:
|
|
31
|
-
const
|
|
30
|
+
setup(B, { expose: S, emit: D }) {
|
|
31
|
+
const o = B, R = D, u = q(null), {
|
|
32
32
|
isFocused: v,
|
|
33
33
|
internalValue: c,
|
|
34
|
-
|
|
34
|
+
rootRef: V,
|
|
35
|
+
updateValue: F,
|
|
35
36
|
handleClear: z,
|
|
36
|
-
adjustHeight:
|
|
37
|
-
validate:
|
|
38
|
-
reset:
|
|
39
|
-
resetValidation:
|
|
37
|
+
adjustHeight: M,
|
|
38
|
+
validate: T,
|
|
39
|
+
reset: A,
|
|
40
|
+
resetValidation: E,
|
|
40
41
|
hasError: f,
|
|
41
42
|
displayedMessages: w
|
|
42
|
-
} =
|
|
43
|
-
const e = !!
|
|
44
|
-
switch (
|
|
43
|
+
} = Y(o, R, u), G = p(() => {
|
|
44
|
+
const e = !!o.bgColor;
|
|
45
|
+
switch (o.variant) {
|
|
45
46
|
case "filled":
|
|
46
47
|
return [
|
|
47
48
|
e ? "" : "bg-gray-100 dark:bg-gray-900",
|
|
@@ -59,8 +60,8 @@ const Y = {
|
|
|
59
60
|
default:
|
|
60
61
|
return "";
|
|
61
62
|
}
|
|
62
|
-
}),
|
|
63
|
-
switch (
|
|
63
|
+
}), N = p(() => {
|
|
64
|
+
switch (o.density) {
|
|
64
65
|
case "comfortable":
|
|
65
66
|
return "py-2";
|
|
66
67
|
case "compact":
|
|
@@ -68,108 +69,115 @@ const Y = {
|
|
|
68
69
|
default:
|
|
69
70
|
return "";
|
|
70
71
|
}
|
|
71
|
-
}),
|
|
72
|
+
}), P = p(() => [
|
|
72
73
|
"w-full resize-none p-2 transition-colors duration-150",
|
|
73
|
-
|
|
74
|
+
o.inputClass,
|
|
74
75
|
{
|
|
75
|
-
"rounded-md": !
|
|
76
|
-
"rounded-none":
|
|
77
|
-
[`rounded-${
|
|
78
|
-
"shadow-md":
|
|
79
|
-
"shadow-none":
|
|
80
|
-
[`text-${
|
|
81
|
-
[`${
|
|
82
|
-
"text-gray-500 bg-gray-200":
|
|
83
|
-
"focus:outline-none focus:ring-2": !
|
|
84
|
-
[`focus:ring-${
|
|
76
|
+
"rounded-md": !o.tile,
|
|
77
|
+
"rounded-none": o.tile,
|
|
78
|
+
[`rounded-${o.rounded}`]: typeof o.rounded == "string" || typeof o.rounded == "number",
|
|
79
|
+
"shadow-md": o.variant === "solo" && !o.flat,
|
|
80
|
+
"shadow-none": o.flat,
|
|
81
|
+
[`text-${o.textColor}`]: o.textColor,
|
|
82
|
+
[`${o.bgColor}`]: o.bgColor,
|
|
83
|
+
"text-gray-500 bg-gray-200": o.disabled,
|
|
84
|
+
"focus:outline-none focus:ring-2": !o.disabled,
|
|
85
|
+
[`focus:ring-${o.color}`]: o.color && !o.disabled && !f.value,
|
|
85
86
|
"border-red-500 ring-red-500 focus:ring-red-500": f.value,
|
|
86
|
-
"resize-none":
|
|
87
|
-
resize: !
|
|
87
|
+
"resize-none": o.noResize || o.autoGrow,
|
|
88
|
+
resize: !o.noResize && !o.autoGrow
|
|
88
89
|
}
|
|
89
|
-
]),
|
|
90
|
+
]), H = p(() => [
|
|
90
91
|
"relative w-full",
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
]), I = p(() =>
|
|
94
|
-
function g(e,
|
|
95
|
-
|
|
92
|
+
o.class,
|
|
93
|
+
o.wrapperClass
|
|
94
|
+
]), I = p(() => o.counter === !0 ? 25 : typeof o.counter == "number" || typeof o.counter == "string" ? o.counter : null), K = p(() => o.persistentCounter ? !0 : !!o.counter && v.value), j = p(() => typeof o.clearIcon == "string" ? o.clearIcon : "i-heroicons-x-mark-20-solid");
|
|
95
|
+
function g(e, n) {
|
|
96
|
+
R(`click:${n}`, e);
|
|
96
97
|
}
|
|
97
|
-
return
|
|
98
|
-
validate:
|
|
99
|
-
reset:
|
|
100
|
-
resetValidation:
|
|
98
|
+
return S({
|
|
99
|
+
validate: T,
|
|
100
|
+
reset: A,
|
|
101
|
+
resetValidation: E,
|
|
101
102
|
errorMessages: w,
|
|
102
|
-
isValid: p(() => !f.value)
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
isValid: p(() => !f.value),
|
|
104
|
+
rootRef: V,
|
|
105
|
+
focus: () => {
|
|
106
|
+
var e;
|
|
107
|
+
return (e = u.value) == null ? void 0 : e.focus();
|
|
108
|
+
}
|
|
109
|
+
}), (e, n) => (s(), l("div", {
|
|
110
|
+
class: m(H.value),
|
|
111
|
+
ref_key: "rootRef",
|
|
112
|
+
ref: V
|
|
105
113
|
}, [
|
|
106
|
-
i(e.$slots, "label", y(k({ label: e.label, isFocused:
|
|
107
|
-
var
|
|
108
|
-
return (
|
|
114
|
+
i(e.$slots, "label", y(k({ label: e.label, isFocused: t(v), isActive: !!t(c), controlRef: u.value, focus: () => {
|
|
115
|
+
var r;
|
|
116
|
+
return (r = u.value) == null ? void 0 : r.focus();
|
|
109
117
|
}, blur: () => {
|
|
110
|
-
var
|
|
111
|
-
return (
|
|
112
|
-
}, props:
|
|
113
|
-
e.label ? (s(), l("label",
|
|
118
|
+
var r;
|
|
119
|
+
return (r = u.value) == null ? void 0 : r.blur();
|
|
120
|
+
}, props: o })), () => [
|
|
121
|
+
e.label ? (s(), l("label", Z, b(e.label), 1)) : d("", !0)
|
|
114
122
|
]),
|
|
115
|
-
a("div",
|
|
116
|
-
e.prependIcon || e.$slots.prepend ? (s(), l("div",
|
|
123
|
+
a("div", x, [
|
|
124
|
+
e.prependIcon || e.$slots.prepend ? (s(), l("div", _, [
|
|
117
125
|
i(e.$slots, "prepend", y(k(e.prependSlotBindings)), () => [
|
|
118
126
|
a("div", {
|
|
119
|
-
onClick:
|
|
127
|
+
onClick: n[0] || (n[0] = (r) => g(r, "prepend"))
|
|
120
128
|
}, [
|
|
121
|
-
(s(), h(C(
|
|
129
|
+
(s(), h(C(t($)(e.prependIcon))))
|
|
122
130
|
])
|
|
123
131
|
])
|
|
124
132
|
])) : d("", !0),
|
|
125
|
-
e.prependInnerIcon || e.$slots["prepend-inner"] ? (s(), l("div",
|
|
133
|
+
e.prependInnerIcon || e.$slots["prepend-inner"] ? (s(), l("div", ee, [
|
|
126
134
|
i(e.$slots, "prepend-inner", {}, () => [
|
|
127
135
|
a("div", {
|
|
128
|
-
onClick:
|
|
136
|
+
onClick: n[1] || (n[1] = (r) => g(r, "prependInner"))
|
|
129
137
|
}, [
|
|
130
|
-
(s(), h(C(
|
|
138
|
+
(s(), h(C(t($)(e.prependInnerIcon))))
|
|
131
139
|
])
|
|
132
140
|
])
|
|
133
141
|
])) : d("", !0),
|
|
134
142
|
a("textarea", {
|
|
135
143
|
ref_key: "textareaRef",
|
|
136
144
|
ref: u,
|
|
137
|
-
value:
|
|
145
|
+
value: t(c),
|
|
138
146
|
rows: e.rows,
|
|
139
147
|
disabled: e.disabled,
|
|
140
148
|
readonly: e.readonly,
|
|
141
149
|
placeholder: e.placeholder,
|
|
142
|
-
onInput:
|
|
143
|
-
|
|
150
|
+
onInput: n[2] || (n[2] = (r) => {
|
|
151
|
+
t(F)(r.target.value), e.autoGrow && t(M)();
|
|
144
152
|
}),
|
|
145
|
-
onFocus:
|
|
153
|
+
onFocus: n[3] || (n[3] = (r) => {
|
|
146
154
|
v.value = !0, e.$emit("update:focused", !0);
|
|
147
155
|
}),
|
|
148
|
-
onBlur:
|
|
156
|
+
onBlur: n[4] || (n[4] = (r) => {
|
|
149
157
|
v.value = !1, e.$emit("update:focused", !1);
|
|
150
158
|
}),
|
|
151
|
-
onClick:
|
|
152
|
-
onMousedown:
|
|
153
|
-
class: m([
|
|
154
|
-
}, null, 42,
|
|
155
|
-
e.clearable &&
|
|
159
|
+
onClick: n[5] || (n[5] = (r) => e.$emit("click:control", r)),
|
|
160
|
+
onMousedown: n[6] || (n[6] = (r) => e.$emit("mousedown:control", r)),
|
|
161
|
+
class: m([G.value, N.value, P.value])
|
|
162
|
+
}, null, 42, oe),
|
|
163
|
+
e.clearable && t(c) ? (s(), l("div", {
|
|
156
164
|
key: 2,
|
|
157
165
|
class: m(["absolute right-2 top-2", { "opacity-100": e.persistentClear, "hover:opacity-100 opacity-0 transition-opacity duration-200": !e.persistentClear }])
|
|
158
166
|
}, [
|
|
159
|
-
i(e.$slots, "clear", y(k({ isActive: !!
|
|
160
|
-
var
|
|
161
|
-
return (
|
|
167
|
+
i(e.$slots, "clear", y(k({ isActive: !!t(c), isFocused: t(v), controlRef: u.value, focus: () => {
|
|
168
|
+
var r;
|
|
169
|
+
return (r = u.value) == null ? void 0 : r.focus();
|
|
162
170
|
}, blur: () => {
|
|
163
|
-
var
|
|
164
|
-
return (
|
|
165
|
-
}, props:
|
|
171
|
+
var r;
|
|
172
|
+
return (r = u.value) == null ? void 0 : r.blur();
|
|
173
|
+
}, props: o })), () => [
|
|
166
174
|
a("button", {
|
|
167
175
|
type: "button",
|
|
168
|
-
onClick:
|
|
176
|
+
onClick: n[7] || (n[7] = (...r) => t(z) && t(z)(...r)),
|
|
169
177
|
class: "text-gray-500 hover:text-gray-700"
|
|
170
178
|
}, [
|
|
171
179
|
a("span", {
|
|
172
|
-
class: m(
|
|
180
|
+
class: m(j.value)
|
|
173
181
|
}, null, 2)
|
|
174
182
|
])
|
|
175
183
|
])
|
|
@@ -177,18 +185,18 @@ const Y = {
|
|
|
177
185
|
e.appendInnerIcon || e.$slots["append-inner"] ? (s(), l("div", re, [
|
|
178
186
|
i(e.$slots, "append-inner", {}, () => [
|
|
179
187
|
a("div", {
|
|
180
|
-
onClick:
|
|
188
|
+
onClick: n[8] || (n[8] = (r) => g(r, "appendInner"))
|
|
181
189
|
}, [
|
|
182
|
-
(s(), h(C(
|
|
190
|
+
(s(), h(C(t($)(e.appendInnerIcon))))
|
|
183
191
|
])
|
|
184
192
|
])
|
|
185
193
|
])) : d("", !0),
|
|
186
|
-
e.appendIcon || e.$slots.append ? (s(), l("div",
|
|
194
|
+
e.appendIcon || e.$slots.append ? (s(), l("div", te, [
|
|
187
195
|
i(e.$slots, "append", y(k(e.appendSlotBindings)), () => [
|
|
188
196
|
a("div", {
|
|
189
|
-
onClick:
|
|
197
|
+
onClick: n[9] || (n[9] = (r) => g(r, "append"))
|
|
190
198
|
}, [
|
|
191
|
-
(s(), h(C(
|
|
199
|
+
(s(), h(C(t($)(e.appendIcon))))
|
|
192
200
|
])
|
|
193
201
|
])
|
|
194
202
|
])) : d("", !0),
|
|
@@ -197,7 +205,7 @@ const Y = {
|
|
|
197
205
|
color: e.loadingColor,
|
|
198
206
|
isActive: !0
|
|
199
207
|
}, () => [
|
|
200
|
-
a("div",
|
|
208
|
+
a("div", se, [
|
|
201
209
|
a("div", {
|
|
202
210
|
class: m(["h-full transition-all duration-300", [`${e.loadingColor}`]]),
|
|
203
211
|
style: { width: "100%" }
|
|
@@ -205,34 +213,34 @@ const Y = {
|
|
|
205
213
|
])
|
|
206
214
|
])
|
|
207
215
|
])) : d("", !0),
|
|
208
|
-
!e.hideDetails || e.hideDetails === "auto" && (
|
|
216
|
+
!e.hideDetails || e.hideDetails === "auto" && (t(w).length || e.hint) ? (s(), l("div", {
|
|
209
217
|
key: 6,
|
|
210
|
-
class: m(["text-xs mt-1 space-y-1", { "text-red-500":
|
|
218
|
+
class: m(["text-xs mt-1 space-y-1", { "text-red-500": t(f), "text-gray-500": !t(f) }])
|
|
211
219
|
}, [
|
|
212
220
|
i(e.$slots, "details", {}, () => [
|
|
213
|
-
|
|
214
|
-
key:
|
|
215
|
-
message:
|
|
221
|
+
t(f) ? (s(!0), l(J, { key: 0 }, O(t(w), (r, L) => i(e.$slots, "message", {
|
|
222
|
+
key: L,
|
|
223
|
+
message: r
|
|
216
224
|
}, () => [
|
|
217
|
-
a("div", null, b(
|
|
225
|
+
a("div", null, b(r), 1)
|
|
218
226
|
])), 128)) : e.hint ? i(e.$slots, "hint", {
|
|
219
227
|
key: 1,
|
|
220
228
|
hint: e.hint
|
|
221
229
|
}, () => [
|
|
222
|
-
|
|
223
|
-
[
|
|
230
|
+
Q(a("div", null, b(e.hint), 513), [
|
|
231
|
+
[U, e.persistentHint || t(v)]
|
|
224
232
|
])
|
|
225
233
|
]) : d("", !0)
|
|
226
234
|
])
|
|
227
235
|
], 2)) : d("", !0),
|
|
228
|
-
|
|
236
|
+
K.value ? (s(), l("div", le, [
|
|
229
237
|
i(e.$slots, "counter", {
|
|
230
|
-
counter:
|
|
238
|
+
counter: t(c).length,
|
|
231
239
|
max: I.value,
|
|
232
|
-
value:
|
|
240
|
+
value: t(c).length
|
|
233
241
|
}, () => [
|
|
234
|
-
|
|
235
|
-
I.value ? (s(), l("span",
|
|
242
|
+
W(b(t(c).length), 1),
|
|
243
|
+
I.value ? (s(), l("span", ae, " / " + b(I.value), 1)) : d("", !0)
|
|
236
244
|
])
|
|
237
245
|
])) : d("", !0)
|
|
238
246
|
])
|
|
@@ -240,5 +248,5 @@ const Y = {
|
|
|
240
248
|
}
|
|
241
249
|
};
|
|
242
250
|
export {
|
|
243
|
-
|
|
251
|
+
ce as default
|
|
244
252
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
function
|
|
3
|
-
const h =
|
|
1
|
+
import { ref as o, watch as T, nextTick as M, onMounted as b, computed as V } from "vue";
|
|
2
|
+
function A(t, s, a) {
|
|
3
|
+
const h = o(!1), w = o(t.modelValue), H = o(null), g = (e) => {
|
|
4
4
|
if (t.formatModel === "raw") return String(e ?? "");
|
|
5
5
|
if ((t.formatModel === "json" || t.formatModel === "auto") && typeof e == "object" && e !== null)
|
|
6
6
|
try {
|
|
@@ -12,65 +12,66 @@ function k(t, s, l) {
|
|
|
12
12
|
}, m = (e) => {
|
|
13
13
|
if (t.formatModel === "raw") return e;
|
|
14
14
|
try {
|
|
15
|
-
const
|
|
15
|
+
const l = JSON.parse(e);
|
|
16
16
|
if (t.formatModel === "json" || t.formatModel === "auto")
|
|
17
|
-
return
|
|
17
|
+
return l;
|
|
18
18
|
} catch {
|
|
19
19
|
}
|
|
20
20
|
return e;
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
w.value = e,
|
|
21
|
+
}, u = o(g(t.modelValue));
|
|
22
|
+
T(() => t.modelValue, (e) => {
|
|
23
|
+
w.value = e, u.value = g(e), t.autoGrow && M(c);
|
|
24
24
|
});
|
|
25
25
|
const v = (e) => {
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
s("update:modelValue",
|
|
29
|
-
},
|
|
26
|
+
u.value = e;
|
|
27
|
+
const l = m(e);
|
|
28
|
+
s("update:modelValue", l);
|
|
29
|
+
}, S = () => {
|
|
30
30
|
v(""), s("click:clear");
|
|
31
31
|
}, c = () => {
|
|
32
|
-
if (!
|
|
33
|
-
|
|
34
|
-
const e =
|
|
32
|
+
if (!a.value) return;
|
|
33
|
+
a.value.style.height = "auto", a.value.style.overflowY = "hidden";
|
|
34
|
+
const e = a.value.scrollHeight, l = parseFloat(getComputedStyle(a.value).lineHeight || "24"), i = Number(t.maxRows || 0);
|
|
35
35
|
if (t.maxRows && i > 0) {
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const n = i * l;
|
|
37
|
+
a.value.style.height = Math.min(e, n) + "px";
|
|
38
38
|
} else
|
|
39
|
-
|
|
39
|
+
a.value.style.height = e + "px";
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
b(() => {
|
|
42
42
|
t.autoGrow && M(c);
|
|
43
43
|
});
|
|
44
|
-
const r =
|
|
45
|
-
const
|
|
44
|
+
const r = o([]), j = o(!0), x = (e = !1) => {
|
|
45
|
+
const l = t.validationValue ?? m(u.value), i = t.rules ?? [], n = [];
|
|
46
46
|
for (const d of i) {
|
|
47
|
-
const f = typeof d == "function" ? d(
|
|
48
|
-
typeof f == "string" ?
|
|
47
|
+
const f = typeof d == "function" ? d(l) : d;
|
|
48
|
+
typeof f == "string" ? n.push(f) : f === !1 && n.push("Campo inválido");
|
|
49
49
|
}
|
|
50
|
-
return r.value =
|
|
50
|
+
return r.value = n.slice(0, t.maxErrors ?? 1), e || s("update:focused", h.value), r.value;
|
|
51
51
|
}, y = () => {
|
|
52
52
|
r.value = [];
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
},
|
|
53
|
+
}, C = () => {
|
|
54
|
+
u.value = "", y(), s("update:modelValue", "");
|
|
55
|
+
}, E = V(() => t.error || r.value.length > 0), N = V(() => {
|
|
56
56
|
var e;
|
|
57
57
|
return (e = t.errorMessages) != null && e.length ? Array.isArray(t.errorMessages) ? t.errorMessages : [t.errorMessages] : r.value;
|
|
58
58
|
});
|
|
59
59
|
return {
|
|
60
60
|
isFocused: h,
|
|
61
|
-
internalValue:
|
|
61
|
+
internalValue: u,
|
|
62
|
+
rootRef: H,
|
|
62
63
|
updateValue: v,
|
|
63
|
-
handleClear:
|
|
64
|
+
handleClear: S,
|
|
64
65
|
adjustHeight: c,
|
|
65
|
-
isPristine:
|
|
66
|
-
validate:
|
|
67
|
-
reset:
|
|
66
|
+
isPristine: j,
|
|
67
|
+
validate: x,
|
|
68
|
+
reset: C,
|
|
68
69
|
resetValidation: y,
|
|
69
70
|
validationErrors: r,
|
|
70
|
-
hasError:
|
|
71
|
-
displayedMessages:
|
|
71
|
+
hasError: E,
|
|
72
|
+
displayedMessages: N
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
75
|
export {
|
|
75
|
-
|
|
76
|
+
A as useKunTextarea
|
|
76
77
|
};
|