vft 0.0.337 → 0.0.339
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.
- package/es/components/carousel/use-carousel.js +1 -1
- package/es/components/form/form-item.vue.d.ts +3 -0
- package/es/components/form/form-item.vue2.js +101 -95
- package/es/components/form/index.d.ts +48 -0
- package/es/components/form/types.d.ts +2 -0
- package/es/components/input/input.vue2.js +4 -4
- package/es/components/input-tag/composables/use-input-tag.js +1 -1
- package/es/components/super-form/super-form-item.vue2.js +1 -1
- package/es/components/super-form/use/helper.js +19 -39
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/es/utils/vue/vnode.js +1 -1
- package/lib/components/form/form-item.vue.d.ts +3 -0
- package/lib/components/form/form-item.vue2.cjs +1 -1
- package/lib/components/form/index.d.ts +48 -0
- package/lib/components/form/types.d.ts +2 -0
- package/lib/components/input/input.vue2.cjs +1 -1
- package/lib/components/super-form/use/helper.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +5 -5
- package/web-types.json +1 -1
|
@@ -10,7 +10,7 @@ import "../../hooks/use-model-toggle/index.js";
|
|
|
10
10
|
import { useOrderedChildren as Ie } from "../../hooks/use-ordered-children/index.js";
|
|
11
11
|
import "@popperjs/core";
|
|
12
12
|
import "../../hooks/use-z-index/index.js";
|
|
13
|
-
import {
|
|
13
|
+
import { CAROUSEL_ITEM_NAME as H, carouselContextKey as ge } from "./constants.js";
|
|
14
14
|
const L = 300, _e = (t, O, M) => {
|
|
15
15
|
const {
|
|
16
16
|
children: o,
|
|
@@ -13,6 +13,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
13
13
|
inlineMessage: string;
|
|
14
14
|
labelWidth: string;
|
|
15
15
|
showMessage: boolean;
|
|
16
|
+
hideLabel: boolean;
|
|
16
17
|
}>>, {
|
|
17
18
|
size: import("vue").ComputedRef<import("vft/es/constants").ComponentSize>;
|
|
18
19
|
validateMessage: import("vue").Ref<string, string>;
|
|
@@ -27,6 +28,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
27
28
|
inlineMessage: string;
|
|
28
29
|
labelWidth: string;
|
|
29
30
|
showMessage: boolean;
|
|
31
|
+
hideLabel: boolean;
|
|
30
32
|
}>>> & Readonly<{
|
|
31
33
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
32
34
|
}>, {
|
|
@@ -34,6 +36,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
34
36
|
labelWidth: string | number;
|
|
35
37
|
inlineMessage: string | boolean;
|
|
36
38
|
showMessage: boolean;
|
|
39
|
+
hideLabel: boolean;
|
|
37
40
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
38
41
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
39
42
|
export default _default;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as Y, useSlots as ye, inject as
|
|
2
|
-
import { refDebounced as
|
|
3
|
-
import { isBoolean as
|
|
1
|
+
import { defineComponent as Y, useSlots as ye, inject as D, ref as b, computed as a, watch as E, reactive as Se, toRefs as ke, provide as qe, onMounted as Ie, onBeforeUnmount as Ve, createElementBlock as _e, openBlock as F, unref as f, normalizeClass as g, createBlock as T, createCommentVNode as R, createElementVNode as G, withCtx as B, resolveDynamicComponent as we, normalizeStyle as K, renderSlot as M, createTextVNode as Ce, toDisplayString as U, createVNode as Fe, TransitionGroup as Re, nextTick as Be } from "vue";
|
|
2
|
+
import { refDebounced as Me } from "@vueuse/core";
|
|
3
|
+
import { isBoolean as We, getProp as W, isFunction as ze } from "@vft/utils";
|
|
4
4
|
import { addUnit as O, castArray as H } from "../../utils/helper.js";
|
|
5
5
|
import { isArray as J, clone as Q } from "lodash-es";
|
|
6
6
|
import { useId as $e } from "../../hooks/use-id/index.js";
|
|
7
|
-
import { useNamespace as
|
|
7
|
+
import { useNamespace as xe } from "../../hooks/use-namespace/index.js";
|
|
8
8
|
import "../../hooks/use-model-toggle/index.js";
|
|
9
9
|
import "@popperjs/core";
|
|
10
10
|
import "../../hooks/use-z-index/index.js";
|
|
11
11
|
import Pe from "async-validator";
|
|
12
|
-
import { formContextKey as
|
|
13
|
-
import
|
|
14
|
-
import { useFormSize as
|
|
15
|
-
const
|
|
12
|
+
import { formContextKey as Ae, formItemContextKey as X } from "./constants.js";
|
|
13
|
+
import Ne from "./form-label-wrap.js";
|
|
14
|
+
import { useFormSize as Le } from "./hooks/use-form-common-props.js";
|
|
15
|
+
const je = ["role", "aria-labelledby"], De = Y({
|
|
16
16
|
name: "vft-form-item"
|
|
17
17
|
}), rt = /* @__PURE__ */ Y({
|
|
18
|
-
...
|
|
18
|
+
...De,
|
|
19
19
|
props: {
|
|
20
20
|
label: {},
|
|
21
21
|
labelWidth: { default: "" },
|
|
@@ -28,26 +28,28 @@ const De = ["role", "aria-labelledby"], Ee = Y({
|
|
|
28
28
|
validateStatus: {},
|
|
29
29
|
inlineMessage: { type: [String, Boolean], default: "" },
|
|
30
30
|
showMessage: { type: Boolean, default: !0 },
|
|
31
|
-
size: {}
|
|
31
|
+
size: {},
|
|
32
|
+
hideRequiredAsterisk: { type: Boolean },
|
|
33
|
+
hideLabel: { type: Boolean, default: !1 }
|
|
32
34
|
},
|
|
33
35
|
emits: ["update:error"],
|
|
34
36
|
setup(Z, { expose: ee, emit: te }) {
|
|
35
|
-
const t = Z, re = te,
|
|
36
|
-
let
|
|
37
|
-
const
|
|
37
|
+
const t = Z, re = te, z = ye(), o = D(Ae, void 0), oe = D(X, void 0), y = Le(void 0, { formItem: !1 }), s = xe("form-item"), S = $e().value, d = b([]), c = b(""), le = Me(c, 100), n = b(""), $ = b();
|
|
38
|
+
let x, v = !1;
|
|
39
|
+
const h = a(
|
|
38
40
|
() => t.labelPosition || o?.labelPosition
|
|
39
|
-
),
|
|
40
|
-
if (
|
|
41
|
+
), P = a(() => {
|
|
42
|
+
if (h.value === "top")
|
|
41
43
|
return {};
|
|
42
44
|
const e = O(t.labelWidth || o?.labelWidth || "");
|
|
43
45
|
return e ? { width: e } : {};
|
|
44
46
|
}), ae = a(() => {
|
|
45
|
-
if (
|
|
47
|
+
if (h.value === "top" || o?.inline)
|
|
46
48
|
return {};
|
|
47
49
|
if (!t.label && !t.labelWidth && ue)
|
|
48
50
|
return {};
|
|
49
51
|
const e = O(t.labelWidth || o?.labelWidth || "");
|
|
50
|
-
return !t.label && !
|
|
52
|
+
return !t.label && !z.label ? { marginLeft: e } : {};
|
|
51
53
|
}), se = a(() => [
|
|
52
54
|
s.b(),
|
|
53
55
|
s.m(y.value),
|
|
@@ -55,174 +57,178 @@ const De = ["role", "aria-labelledby"], Ee = Y({
|
|
|
55
57
|
s.is("validating", c.value === "validating"),
|
|
56
58
|
s.is("success", c.value === "success"),
|
|
57
59
|
s.is("required", fe.value || t.required),
|
|
58
|
-
s.is(
|
|
60
|
+
s.is(
|
|
61
|
+
"no-asterisk",
|
|
62
|
+
t?.hideRequiredAsterisk || o?.hideRequiredAsterisk
|
|
63
|
+
),
|
|
59
64
|
o?.requireAsteriskPosition === "right" ? "asterisk-right" : "asterisk-left",
|
|
60
65
|
{
|
|
61
66
|
[s.m("feedback")]: o?.statusIcon,
|
|
62
|
-
[s.m(`label-${
|
|
67
|
+
[s.m(`label-${h.value}`)]: h.value
|
|
63
68
|
}
|
|
64
69
|
]), ie = a(
|
|
65
|
-
() =>
|
|
70
|
+
() => We(t.inlineMessage) ? t.inlineMessage : o?.inlineMessage || !1
|
|
66
71
|
), ne = a(() => [
|
|
67
72
|
s.e("error"),
|
|
68
73
|
{ [s.em("error", "inline")]: ie.value }
|
|
69
|
-
]),
|
|
74
|
+
]), A = a(() => t.prop ? J(t.prop) ? t.prop.join(".") : t.prop : ""), k = a(() => !!(t.label || z.label)), q = a(() => t.for ?? (d.value.length === 1 ? d.value[0] : void 0)), I = a(() => !q.value && k.value), ue = !!oe, V = a(() => {
|
|
70
75
|
const e = o?.model;
|
|
71
76
|
if (!(!e || !t.prop))
|
|
72
|
-
return
|
|
73
|
-
}),
|
|
77
|
+
return W(e, t.prop).value;
|
|
78
|
+
}), _ = a(() => {
|
|
74
79
|
const { required: e } = t, r = [];
|
|
75
80
|
t.rules && r.push(
|
|
76
81
|
...H(t.rules).map((l) => (l.trigger = l.trigger || "blur", l))
|
|
77
82
|
);
|
|
78
83
|
const i = o?.rules;
|
|
79
84
|
if (i && t.prop) {
|
|
80
|
-
const l =
|
|
85
|
+
const l = W(
|
|
81
86
|
i,
|
|
82
87
|
t.prop
|
|
83
88
|
).value;
|
|
84
89
|
l && r.push(...H(l));
|
|
85
90
|
}
|
|
86
91
|
if (e !== void 0) {
|
|
87
|
-
const l = r.map((u,
|
|
92
|
+
const l = r.map((u, m) => [u, m]).filter(([u]) => Object.keys(u).includes("required"));
|
|
88
93
|
if (l.length > 0)
|
|
89
|
-
for (const [u,
|
|
90
|
-
u.required !== e && (r[
|
|
94
|
+
for (const [u, m] of l)
|
|
95
|
+
u.required !== e && (r[m] = { ...u, required: e });
|
|
91
96
|
else
|
|
92
97
|
r.push({ required: e });
|
|
93
98
|
}
|
|
94
99
|
return r;
|
|
95
|
-
}), de = a(() =>
|
|
96
|
-
() =>
|
|
97
|
-
),
|
|
100
|
+
}), de = a(() => _.value.length > 0), ce = (e) => _.value.filter((i) => !i.trigger || !e ? !0 : J(i.trigger) ? i.trigger.includes(e) : i.trigger === e).map(({ trigger: i, ...l }) => l), fe = a(
|
|
101
|
+
() => _.value.some((e) => e.required)
|
|
102
|
+
), pe = a(
|
|
98
103
|
() => le.value === "error" && t.showMessage && (o?.showMessage ?? !0)
|
|
99
|
-
),
|
|
104
|
+
), N = a(
|
|
100
105
|
() => `${t.label || ""}${o?.labelSuffix || ""}`
|
|
101
|
-
),
|
|
106
|
+
), p = (e) => {
|
|
102
107
|
c.value = e;
|
|
103
|
-
},
|
|
108
|
+
}, me = (e) => {
|
|
104
109
|
const { errors: r, fields: i } = e;
|
|
105
|
-
(!r || !i) && console.error(e),
|
|
110
|
+
(!r || !i) && console.error(e), p("error"), n.value = r ? r?.[0]?.message ?? `${t.prop} is required` : "", o?.emit("validate", t.prop, !1, n.value);
|
|
106
111
|
}, ve = () => {
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
const r =
|
|
112
|
+
p("success"), o?.emit("validate", t.prop, !0, "");
|
|
113
|
+
}, he = async (e) => {
|
|
114
|
+
const r = A.value;
|
|
110
115
|
return new Pe({
|
|
111
116
|
[r]: e
|
|
112
|
-
}).validate({ [r]:
|
|
113
|
-
},
|
|
117
|
+
}).validate({ [r]: V.value }, { firstFields: !0 }).then(() => (ve(), !0)).catch((l) => (me(l), Promise.reject(l)));
|
|
118
|
+
}, L = async (e, r) => {
|
|
114
119
|
if (v || !t.prop)
|
|
115
120
|
return !1;
|
|
116
121
|
const i = ze(r);
|
|
117
122
|
if (!de.value)
|
|
118
123
|
return r?.(!1), !1;
|
|
119
124
|
const l = ce(e);
|
|
120
|
-
return l.length === 0 ? (r?.(!0), !0) : (
|
|
121
|
-
const { fields:
|
|
122
|
-
return r?.(!1,
|
|
125
|
+
return l.length === 0 ? (r?.(!0), !0) : (p("validating"), he(l).then(() => (r?.(!0), !0)).catch((u) => {
|
|
126
|
+
const { fields: m } = u;
|
|
127
|
+
return r?.(!1, m), i ? !1 : Promise.reject(m);
|
|
123
128
|
}));
|
|
124
|
-
},
|
|
125
|
-
t.error && re("update:error", ""),
|
|
129
|
+
}, w = () => {
|
|
130
|
+
t.error && re("update:error", ""), p(""), n.value = "", v = !1;
|
|
126
131
|
}, j = async () => {
|
|
127
132
|
const e = o?.model;
|
|
128
133
|
if (!e || !t.prop) return;
|
|
129
|
-
const r =
|
|
130
|
-
v = !0, r.value = Q(
|
|
131
|
-
},
|
|
134
|
+
const r = W(e, t.prop);
|
|
135
|
+
v = !0, r.value = Q(x), await Be(), w(), v = !1;
|
|
136
|
+
}, be = (e) => {
|
|
132
137
|
d.value.includes(e) || d.value.push(e);
|
|
133
|
-
},
|
|
138
|
+
}, ge = (e) => {
|
|
134
139
|
d.value = d.value.filter((r) => r !== e);
|
|
135
140
|
};
|
|
136
|
-
|
|
141
|
+
E(
|
|
137
142
|
() => t.error,
|
|
138
143
|
(e) => {
|
|
139
|
-
n.value = e || "",
|
|
144
|
+
n.value = e || "", p(e ? "error" : "");
|
|
140
145
|
},
|
|
141
146
|
{ immediate: !0 }
|
|
142
|
-
),
|
|
147
|
+
), E(
|
|
143
148
|
() => t.validateStatus,
|
|
144
|
-
(e) =>
|
|
149
|
+
(e) => p(e || "")
|
|
145
150
|
);
|
|
146
|
-
const
|
|
147
|
-
...
|
|
148
|
-
$el:
|
|
151
|
+
const C = Se({
|
|
152
|
+
...ke(t),
|
|
153
|
+
$el: $,
|
|
149
154
|
size: y,
|
|
150
155
|
validateMessage: n,
|
|
151
156
|
validateState: c,
|
|
152
157
|
labelId: S,
|
|
153
158
|
inputIds: d,
|
|
154
|
-
isGroup:
|
|
155
|
-
hasLabel:
|
|
156
|
-
fieldValue:
|
|
157
|
-
addInputId:
|
|
158
|
-
removeInputId:
|
|
159
|
+
isGroup: I,
|
|
160
|
+
hasLabel: k,
|
|
161
|
+
fieldValue: V,
|
|
162
|
+
addInputId: be,
|
|
163
|
+
removeInputId: ge,
|
|
159
164
|
resetField: j,
|
|
160
|
-
clearValidate:
|
|
161
|
-
validate:
|
|
162
|
-
propString:
|
|
165
|
+
clearValidate: w,
|
|
166
|
+
validate: L,
|
|
167
|
+
propString: A
|
|
163
168
|
});
|
|
164
|
-
return
|
|
165
|
-
t.prop && (o?.addField(
|
|
166
|
-
}),
|
|
167
|
-
o?.removeField(
|
|
169
|
+
return qe(X, C), Ie(() => {
|
|
170
|
+
t.prop && (o?.addField(C), x = Q(V.value));
|
|
171
|
+
}), Ve(() => {
|
|
172
|
+
o?.removeField(C);
|
|
168
173
|
}), ee({
|
|
169
174
|
size: y,
|
|
170
175
|
validateMessage: n,
|
|
171
176
|
validateState: c,
|
|
172
|
-
validate:
|
|
173
|
-
clearValidate:
|
|
177
|
+
validate: L,
|
|
178
|
+
clearValidate: w,
|
|
174
179
|
resetField: j
|
|
175
|
-
}), (e, r) => (
|
|
180
|
+
}), (e, r) => (F(), _e("div", {
|
|
176
181
|
ref_key: "formItemRef",
|
|
177
|
-
ref:
|
|
178
|
-
class:
|
|
179
|
-
role:
|
|
180
|
-
"aria-labelledby":
|
|
182
|
+
ref: $,
|
|
183
|
+
class: g(se.value),
|
|
184
|
+
role: I.value ? "group" : void 0,
|
|
185
|
+
"aria-labelledby": I.value ? f(S) : void 0
|
|
181
186
|
}, [
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
e.hideLabel ? R("", !0) : (F(), T(f(Ne), {
|
|
188
|
+
key: 0,
|
|
189
|
+
"is-auto-width": P.value.width === "auto",
|
|
184
190
|
"update-all": f(o)?.labelWidth === "auto"
|
|
185
191
|
}, {
|
|
186
|
-
default:
|
|
187
|
-
|
|
192
|
+
default: B(() => [
|
|
193
|
+
k.value ? (F(), T(we(q.value ? "label" : "div"), {
|
|
188
194
|
key: 0,
|
|
189
195
|
id: f(S),
|
|
190
|
-
for:
|
|
191
|
-
class:
|
|
192
|
-
style: K(
|
|
196
|
+
for: q.value,
|
|
197
|
+
class: g(f(s).e("label")),
|
|
198
|
+
style: K(P.value)
|
|
193
199
|
}, {
|
|
194
|
-
default:
|
|
195
|
-
M(e.$slots, "label", { label:
|
|
196
|
-
|
|
200
|
+
default: B(() => [
|
|
201
|
+
M(e.$slots, "label", { label: N.value }, () => [
|
|
202
|
+
Ce(U(N.value), 1)
|
|
197
203
|
])
|
|
198
204
|
]),
|
|
199
205
|
_: 3
|
|
200
|
-
}, 8, ["id", "for", "class", "style"])) :
|
|
206
|
+
}, 8, ["id", "for", "class", "style"])) : R("", !0)
|
|
201
207
|
]),
|
|
202
208
|
_: 3
|
|
203
|
-
}, 8, ["is-auto-width", "update-all"]),
|
|
204
|
-
|
|
205
|
-
class:
|
|
209
|
+
}, 8, ["is-auto-width", "update-all"])),
|
|
210
|
+
G("div", {
|
|
211
|
+
class: g(f(s).e("content")),
|
|
206
212
|
style: K(ae.value)
|
|
207
213
|
}, [
|
|
208
214
|
M(e.$slots, "default"),
|
|
209
|
-
|
|
215
|
+
Fe(Re, {
|
|
210
216
|
name: `${f(s).namespace.value}-zoom-in-top`
|
|
211
217
|
}, {
|
|
212
|
-
default:
|
|
213
|
-
|
|
218
|
+
default: B(() => [
|
|
219
|
+
pe.value ? M(e.$slots, "error", {
|
|
214
220
|
key: 0,
|
|
215
221
|
error: n.value
|
|
216
222
|
}, () => [
|
|
217
|
-
|
|
218
|
-
class:
|
|
223
|
+
G("div", {
|
|
224
|
+
class: g(ne.value)
|
|
219
225
|
}, U(n.value), 3)
|
|
220
|
-
]) :
|
|
226
|
+
]) : R("", !0)
|
|
221
227
|
]),
|
|
222
228
|
_: 3
|
|
223
229
|
}, 8, ["name"])
|
|
224
230
|
], 6)
|
|
225
|
-
], 10,
|
|
231
|
+
], 10, je));
|
|
226
232
|
}
|
|
227
233
|
});
|
|
228
234
|
export {
|
|
@@ -228,12 +228,19 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
228
228
|
type: import("vue").PropType<boolean>;
|
|
229
229
|
default: boolean;
|
|
230
230
|
};
|
|
231
|
+
hideRequiredAsterisk: {
|
|
232
|
+
type: import("vue").PropType<boolean>;
|
|
233
|
+
};
|
|
231
234
|
for: {
|
|
232
235
|
type: import("vue").PropType<string>;
|
|
233
236
|
};
|
|
234
237
|
validateStatus: {
|
|
235
238
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
236
239
|
};
|
|
240
|
+
hideLabel: {
|
|
241
|
+
type: import("vue").PropType<boolean>;
|
|
242
|
+
default: boolean;
|
|
243
|
+
};
|
|
237
244
|
}>> & Readonly<{
|
|
238
245
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
239
246
|
}>, {
|
|
@@ -250,6 +257,7 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
250
257
|
labelWidth: string | number;
|
|
251
258
|
inlineMessage: string | boolean;
|
|
252
259
|
showMessage: boolean;
|
|
260
|
+
hideLabel: boolean;
|
|
253
261
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
254
262
|
P: {};
|
|
255
263
|
B: {};
|
|
@@ -292,12 +300,19 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
292
300
|
type: import("vue").PropType<boolean>;
|
|
293
301
|
default: boolean;
|
|
294
302
|
};
|
|
303
|
+
hideRequiredAsterisk: {
|
|
304
|
+
type: import("vue").PropType<boolean>;
|
|
305
|
+
};
|
|
295
306
|
for: {
|
|
296
307
|
type: import("vue").PropType<string>;
|
|
297
308
|
};
|
|
298
309
|
validateStatus: {
|
|
299
310
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
300
311
|
};
|
|
312
|
+
hideLabel: {
|
|
313
|
+
type: import("vue").PropType<boolean>;
|
|
314
|
+
default: boolean;
|
|
315
|
+
};
|
|
301
316
|
}>> & Readonly<{
|
|
302
317
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
303
318
|
}>, {
|
|
@@ -312,6 +327,7 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
312
327
|
labelWidth: string | number;
|
|
313
328
|
inlineMessage: string | boolean;
|
|
314
329
|
showMessage: boolean;
|
|
330
|
+
hideLabel: boolean;
|
|
315
331
|
}>;
|
|
316
332
|
__isFragment?: never;
|
|
317
333
|
__isTeleport?: never;
|
|
@@ -351,12 +367,19 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
351
367
|
type: import("vue").PropType<boolean>;
|
|
352
368
|
default: boolean;
|
|
353
369
|
};
|
|
370
|
+
hideRequiredAsterisk: {
|
|
371
|
+
type: import("vue").PropType<boolean>;
|
|
372
|
+
};
|
|
354
373
|
for: {
|
|
355
374
|
type: import("vue").PropType<string>;
|
|
356
375
|
};
|
|
357
376
|
validateStatus: {
|
|
358
377
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
359
378
|
};
|
|
379
|
+
hideLabel: {
|
|
380
|
+
type: import("vue").PropType<boolean>;
|
|
381
|
+
default: boolean;
|
|
382
|
+
};
|
|
360
383
|
}>> & Readonly<{
|
|
361
384
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
362
385
|
}>, {
|
|
@@ -373,6 +396,7 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
373
396
|
labelWidth: string | number;
|
|
374
397
|
inlineMessage: string | boolean;
|
|
375
398
|
showMessage: boolean;
|
|
399
|
+
hideLabel: boolean;
|
|
376
400
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
377
401
|
$slots: {
|
|
378
402
|
label?(_: {
|
|
@@ -421,12 +445,19 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
421
445
|
type: import("vue").PropType<boolean>;
|
|
422
446
|
default: boolean;
|
|
423
447
|
};
|
|
448
|
+
hideRequiredAsterisk: {
|
|
449
|
+
type: import("vue").PropType<boolean>;
|
|
450
|
+
};
|
|
424
451
|
for: {
|
|
425
452
|
type: import("vue").PropType<string>;
|
|
426
453
|
};
|
|
427
454
|
validateStatus: {
|
|
428
455
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
429
456
|
};
|
|
457
|
+
hideLabel: {
|
|
458
|
+
type: import("vue").PropType<boolean>;
|
|
459
|
+
default: boolean;
|
|
460
|
+
};
|
|
430
461
|
}>> & Readonly<{
|
|
431
462
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
432
463
|
}>, {
|
|
@@ -443,6 +474,7 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
443
474
|
labelWidth: string | number;
|
|
444
475
|
inlineMessage: string | boolean;
|
|
445
476
|
showMessage: boolean;
|
|
477
|
+
hideLabel: boolean;
|
|
446
478
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
447
479
|
P: {};
|
|
448
480
|
B: {};
|
|
@@ -485,12 +517,19 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
485
517
|
type: import("vue").PropType<boolean>;
|
|
486
518
|
default: boolean;
|
|
487
519
|
};
|
|
520
|
+
hideRequiredAsterisk: {
|
|
521
|
+
type: import("vue").PropType<boolean>;
|
|
522
|
+
};
|
|
488
523
|
for: {
|
|
489
524
|
type: import("vue").PropType<string>;
|
|
490
525
|
};
|
|
491
526
|
validateStatus: {
|
|
492
527
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
493
528
|
};
|
|
529
|
+
hideLabel: {
|
|
530
|
+
type: import("vue").PropType<boolean>;
|
|
531
|
+
default: boolean;
|
|
532
|
+
};
|
|
494
533
|
}>> & Readonly<{
|
|
495
534
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
496
535
|
}>, {
|
|
@@ -505,6 +544,7 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
505
544
|
labelWidth: string | number;
|
|
506
545
|
inlineMessage: string | boolean;
|
|
507
546
|
showMessage: boolean;
|
|
547
|
+
hideLabel: boolean;
|
|
508
548
|
}>;
|
|
509
549
|
__isFragment?: never;
|
|
510
550
|
__isTeleport?: never;
|
|
@@ -544,12 +584,19 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
544
584
|
type: import("vue").PropType<boolean>;
|
|
545
585
|
default: boolean;
|
|
546
586
|
};
|
|
587
|
+
hideRequiredAsterisk: {
|
|
588
|
+
type: import("vue").PropType<boolean>;
|
|
589
|
+
};
|
|
547
590
|
for: {
|
|
548
591
|
type: import("vue").PropType<string>;
|
|
549
592
|
};
|
|
550
593
|
validateStatus: {
|
|
551
594
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
552
595
|
};
|
|
596
|
+
hideLabel: {
|
|
597
|
+
type: import("vue").PropType<boolean>;
|
|
598
|
+
default: boolean;
|
|
599
|
+
};
|
|
553
600
|
}>> & Readonly<{
|
|
554
601
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
555
602
|
}>, {
|
|
@@ -566,6 +613,7 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
566
613
|
labelWidth: string | number;
|
|
567
614
|
inlineMessage: string | boolean;
|
|
568
615
|
showMessage: boolean;
|
|
616
|
+
hideLabel: boolean;
|
|
569
617
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
570
618
|
$slots: {
|
|
571
619
|
label?(_: {
|
|
@@ -13,8 +13,8 @@ import "../../hooks/use-z-index/index.js";
|
|
|
13
13
|
import { UPDATE_MODEL_EVENT as Q } from "@vft/constants";
|
|
14
14
|
import { useAttrs as Ze, useCursor as _e } from "@vft/use";
|
|
15
15
|
import { calcTextareaHeight as ye } from "./utils.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { useFormSize as et, useFormDisabled as tt } from "../form/hooks/use-form-common-props.js";
|
|
17
|
+
import { useFormItem as at, useFormItemInputId as ot } from "../form/hooks/use-form-item.js";
|
|
18
18
|
const nt = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"], st = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"], It = /* @__PURE__ */ Oe({
|
|
19
19
|
__name: "input",
|
|
20
20
|
props: {
|
|
@@ -85,9 +85,9 @@ const nt = ["role"], lt = ["id", "type", "disabled", "formatter", "parser", "rea
|
|
|
85
85
|
o.is("focus", v.value)
|
|
86
86
|
]), d = Ze({
|
|
87
87
|
excludeKeys: l(() => Object.keys(X.value))
|
|
88
|
-
}), { form: Ce, formItem: F } =
|
|
88
|
+
}), { form: Ce, formItem: F } = at(), { inputId: Y } = ot(xe.props, {
|
|
89
89
|
formItemContext: F
|
|
90
|
-
}), ke =
|
|
90
|
+
}), ke = et(), h = tt(), o = pe("input"), Z = pe("textarea"), M = H(), b = H(), v = S(!1), N = S(!1), C = S(!1), K = S(!1), _ = S(), O = H(e.inputStyle), k = l(() => M.value || b.value), T = l(() => G(e.prefixIcon, "icon", { size: 16 })), ee = l(() => G(e.suffixIcon, "icon", { size: 16 })), Ie = l(() => G(e.clearIcon, "icon", {
|
|
91
91
|
icon: "icon-circle-close",
|
|
92
92
|
size: 16
|
|
93
93
|
})), te = l(() => Ce?.statusIcon ?? !1), I = l(() => F?.validateState || ""), ae = l(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { shallowRef as B, ref as L, computed as c, watch as G } from "vue";
|
|
2
2
|
import { EVENT_CODE as g } from "../../../constants/aria.js";
|
|
3
|
-
import { CHANGE_EVENT as i,
|
|
3
|
+
import { CHANGE_EVENT as i, INPUT_EVENT as H, UPDATE_MODEL_EVENT as d } from "../../../constants/event.js";
|
|
4
4
|
import "@vueuse/core";
|
|
5
5
|
import { isUndefined as K } from "@vft/utils";
|
|
6
6
|
import { debugWarn as C } from "../../../utils/error.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as $, computed as v, ref as ee, unref as u, useSlots as te, createVNode as f, mergeProps as L, withDirectives as re, vShow as ne,
|
|
1
|
+
import { defineComponent as $, computed as v, ref as ee, unref as u, useSlots as te, createVNode as f, mergeProps as L, withDirectives as re, vShow as ne, isVNode as oe, createTextVNode as G, resolveComponent as q } from "vue";
|
|
2
2
|
import { VftCol as J } from "../col/index.js";
|
|
3
3
|
import { VftDivider as le } from "../divider/index.js";
|
|
4
4
|
import { VftFormItem as se } from "../form/index.js";
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { isNumber as n } from "@vft/utils";
|
|
2
|
-
import {
|
|
3
|
-
function
|
|
4
|
-
|
|
2
|
+
import { FormCompEnum as e, isInput as u } from "../component-map.js";
|
|
3
|
+
function T(r, E = "") {
|
|
4
|
+
return E = (E || "").replace(":", "") || "", [
|
|
5
5
|
e.INPUT,
|
|
6
6
|
e.INPUT_NUMBER,
|
|
7
7
|
e.TEXTAREA,
|
|
8
8
|
e.AUTOCOMPLETE
|
|
9
|
-
].includes(r))
|
|
10
|
-
return "请输入" + E;
|
|
11
|
-
if ([e.PASSWORD].includes(r))
|
|
12
|
-
return "请输入密码";
|
|
13
|
-
if ([
|
|
9
|
+
].includes(r) ? "请输入" + E : [e.PASSWORD].includes(r) ? "请输入密码" : [
|
|
14
10
|
e.SELECT,
|
|
15
11
|
e.RADIO,
|
|
16
12
|
e.RADIO_SINGLE,
|
|
@@ -19,39 +15,23 @@ function s(r, E = "") {
|
|
|
19
15
|
e.ColorPicker,
|
|
20
16
|
e.CHECKBOX,
|
|
21
17
|
e.CHECKBOX_BUTTON
|
|
22
|
-
].includes(r))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return "请拖动滑块";
|
|
35
|
-
if ([
|
|
36
|
-
e.TIME_PICKER,
|
|
37
|
-
e.YEAR_PICKER,
|
|
38
|
-
e.MONTH_PICKER,
|
|
39
|
-
e.DATE_PICKER,
|
|
40
|
-
e.DATES_PICKER,
|
|
41
|
-
e.DATETIME_PICKER,
|
|
42
|
-
e.WEEK_PICKER,
|
|
43
|
-
e.DATETIMERANGE_PICKER,
|
|
44
|
-
e.DATERANGE_PICKER,
|
|
45
|
-
e.MONTHRANGE_PICKER
|
|
46
|
-
].includes(r))
|
|
47
|
-
return "请选择时间";
|
|
48
|
-
}
|
|
49
|
-
return "";
|
|
18
|
+
].includes(r) ? "请选择" + E : [e.CHECKBOX_SINGLE].includes(r) ? "请勾选" + E : [e.SEARCH].includes(r) ? "请输入要搜索的内容" : [e.INPUT_TAG].includes(r) ? "请输入标签内容" : [e.Upload].includes(r) ? "请选择上传文件" : [e.Slider].includes(r) ? "请拖动滑块" : [
|
|
19
|
+
e.TIME_PICKER,
|
|
20
|
+
e.YEAR_PICKER,
|
|
21
|
+
e.MONTH_PICKER,
|
|
22
|
+
e.DATE_PICKER,
|
|
23
|
+
e.DATES_PICKER,
|
|
24
|
+
e.DATETIME_PICKER,
|
|
25
|
+
e.WEEK_PICKER,
|
|
26
|
+
e.DATETIMERANGE_PICKER,
|
|
27
|
+
e.DATERANGE_PICKER,
|
|
28
|
+
e.MONTHRANGE_PICKER
|
|
29
|
+
].includes(r) ? "请选择时间" : "";
|
|
50
30
|
}
|
|
51
|
-
function
|
|
31
|
+
function s(r, E) {
|
|
52
32
|
return r && u(r) && E && n(E) ? `${E}` : E;
|
|
53
33
|
}
|
|
54
34
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
35
|
+
T as createPlaceholderMessage,
|
|
36
|
+
s as handleInputNumberValue
|
|
57
37
|
};
|
package/es/package.json.d.ts
CHANGED
package/es/package.json.js
CHANGED
package/es/utils/vue/vnode.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isArray as E, hasOwn as m, camelize as N } from "@vft/utils";
|
|
2
2
|
import { isVNode as o, Fragment as S, Comment as A, Text as s, createCommentVNode as L, createBlock as _, openBlock as C } from "vue";
|
|
3
3
|
import { debugWarn as O } from "../error.js";
|
|
4
4
|
const R = "utils/vue/vnode";
|
|
@@ -13,6 +13,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
13
13
|
inlineMessage: string;
|
|
14
14
|
labelWidth: string;
|
|
15
15
|
showMessage: boolean;
|
|
16
|
+
hideLabel: boolean;
|
|
16
17
|
}>>, {
|
|
17
18
|
size: import("vue").ComputedRef<import("vft/es/constants").ComponentSize>;
|
|
18
19
|
validateMessage: import("vue").Ref<string, string>;
|
|
@@ -27,6 +28,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
27
28
|
inlineMessage: string;
|
|
28
29
|
labelWidth: string;
|
|
29
30
|
showMessage: boolean;
|
|
31
|
+
hideLabel: boolean;
|
|
30
32
|
}>>> & Readonly<{
|
|
31
33
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
32
34
|
}>, {
|
|
@@ -34,6 +36,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
34
36
|
labelWidth: string | number;
|
|
35
37
|
inlineMessage: string | boolean;
|
|
36
38
|
showMessage: boolean;
|
|
39
|
+
hideLabel: boolean;
|
|
37
40
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
38
41
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
39
42
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),oe=require("@vueuse/core"),m=require("@vft/utils"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),oe=require("@vueuse/core"),m=require("@vft/utils"),b=require("../../utils/helper.cjs"),g=require("lodash-es"),le=require("../../hooks/use-id/index.cjs"),ae=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const se=require("async-validator"),z=require("./constants.cjs"),ie=require("./form-label-wrap.cjs"),ne=require("./hooks/use-form-common-props.cjs"),ue=["role","aria-labelledby"],de=e.defineComponent({name:"vft-form-item"}),ce=e.defineComponent({...de,props:{label:{},labelWidth:{default:""},labelPosition:{},prop:{},required:{type:Boolean,default:void 0},rules:{},error:{},for:{},validateStatus:{},inlineMessage:{type:[String,Boolean],default:""},showMessage:{type:Boolean,default:!0},size:{},hideRequiredAsterisk:{type:Boolean},hideLabel:{type:Boolean,default:!1}},emits:["update:error"],setup($,{expose:A,emit:j}){const r=$,E=j,B=e.useSlots(),l=e.inject(z.formContextKey,void 0),L=e.inject(z.formItemContextKey,void 0),y=ne.useFormSize(void 0,{formItem:!1}),s=ae.useNamespace("form-item"),q=le.useId().value,d=e.ref([]),c=e.ref(""),D=oe.refDebounced(c,100),n=e.ref(""),x=e.ref();let F,v=!1;const h=e.computed(()=>r.labelPosition||l?.labelPosition),M=e.computed(()=>{if(h.value==="top")return{};const t=b.addUnit(r.labelWidth||l?.labelWidth||"");return t?{width:t}:{}}),T=e.computed(()=>{if(h.value==="top"||l?.inline)return{};if(!r.label&&!r.labelWidth&&O)return{};const t=b.addUnit(r.labelWidth||l?.labelWidth||"");return!r.label&&!B.label?{marginLeft:t}:{}}),K=e.computed(()=>[s.b(),s.m(y.value),s.is("error",c.value==="error"),s.is("validating",c.value==="validating"),s.is("success",c.value==="success"),s.is("required",Q.value||r.required),s.is("no-asterisk",r?.hideRequiredAsterisk||l?.hideRequiredAsterisk),l?.requireAsteriskPosition==="right"?"asterisk-right":"asterisk-left",{[s.m("feedback")]:l?.statusIcon,[s.m(`label-${h.value}`)]:h.value}]),U=e.computed(()=>m.isBoolean(r.inlineMessage)?r.inlineMessage:l?.inlineMessage||!1),G=e.computed(()=>[s.e("error"),{[s.em("error","inline")]:U.value}]),P=e.computed(()=>r.prop?g.isArray(r.prop)?r.prop.join("."):r.prop:""),S=e.computed(()=>!!(r.label||B.label)),C=e.computed(()=>r.for??(d.value.length===1?d.value[0]:void 0)),k=e.computed(()=>!C.value&&S.value),O=!!L,V=e.computed(()=>{const t=l?.model;if(!(!t||!r.prop))return m.getProp(t,r.prop).value}),w=e.computed(()=>{const{required:t}=r,o=[];r.rules&&o.push(...b.castArray(r.rules).map(a=>(a.trigger=a.trigger||"blur",a)));const i=l?.rules;if(i&&r.prop){const a=m.getProp(i,r.prop).value;a&&o.push(...b.castArray(a))}if(t!==void 0){const a=o.map((u,f)=>[u,f]).filter(([u])=>Object.keys(u).includes("required"));if(a.length>0)for(const[u,f]of a)u.required!==t&&(o[f]={...u,required:t});else o.push({required:t})}return o}),H=e.computed(()=>w.value.length>0),J=t=>w.value.filter(i=>!i.trigger||!t?!0:g.isArray(i.trigger)?i.trigger.includes(t):i.trigger===t).map(({trigger:i,...a})=>a),Q=e.computed(()=>w.value.some(t=>t.required)),X=e.computed(()=>D.value==="error"&&r.showMessage&&(l?.showMessage??!0)),R=e.computed(()=>`${r.label||""}${l?.labelSuffix||""}`),p=t=>{c.value=t},Y=t=>{const{errors:o,fields:i}=t;(!o||!i)&&console.error(t),p("error"),n.value=o?o?.[0]?.message??`${r.prop} is required`:"",l?.emit("validate",r.prop,!1,n.value)},Z=()=>{p("success"),l?.emit("validate",r.prop,!0,"")},ee=async t=>{const o=P.value;return new se({[o]:t}).validate({[o]:V.value},{firstFields:!0}).then(()=>(Z(),!0)).catch(a=>(Y(a),Promise.reject(a)))},N=async(t,o)=>{if(v||!r.prop)return!1;const i=m.isFunction(o);if(!H.value)return o?.(!1),!1;const a=J(t);return a.length===0?(o?.(!0),!0):(p("validating"),ee(a).then(()=>(o?.(!0),!0)).catch(u=>{const{fields:f}=u;return o?.(!1,f),i?!1:Promise.reject(f)}))},I=()=>{r.error&&E("update:error",""),p(""),n.value="",v=!1},W=async()=>{const t=l?.model;if(!t||!r.prop)return;const o=m.getProp(t,r.prop);v=!0,o.value=g.clone(F),await e.nextTick(),I(),v=!1},te=t=>{d.value.includes(t)||d.value.push(t)},re=t=>{d.value=d.value.filter(o=>o!==t)};e.watch(()=>r.error,t=>{n.value=t||"",p(t?"error":"")},{immediate:!0}),e.watch(()=>r.validateStatus,t=>p(t||""));const _=e.reactive({...e.toRefs(r),$el:x,size:y,validateMessage:n,validateState:c,labelId:q,inputIds:d,isGroup:k,hasLabel:S,fieldValue:V,addInputId:te,removeInputId:re,resetField:W,clearValidate:I,validate:N,propString:P});return e.provide(z.formItemContextKey,_),e.onMounted(()=>{r.prop&&(l?.addField(_),F=g.clone(V.value))}),e.onBeforeUnmount(()=>{l?.removeField(_)}),A({size:y,validateMessage:n,validateState:c,validate:N,clearValidate:I,resetField:W}),(t,o)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"formItemRef",ref:x,class:e.normalizeClass(K.value),role:k.value?"group":void 0,"aria-labelledby":k.value?e.unref(q):void 0},[t.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(ie.default),{key:0,"is-auto-width":M.value.width==="auto","update-all":e.unref(l)?.labelWidth==="auto"},{default:e.withCtx(()=>[S.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(C.value?"label":"div"),{key:0,id:e.unref(q),for:C.value,class:e.normalizeClass(e.unref(s).e("label")),style:e.normalizeStyle(M.value)},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"label",{label:R.value},()=>[e.createTextVNode(e.toDisplayString(R.value),1)])]),_:3},8,["id","for","class","style"])):e.createCommentVNode("",!0)]),_:3},8,["is-auto-width","update-all"])),e.createElementVNode("div",{class:e.normalizeClass(e.unref(s).e("content")),style:e.normalizeStyle(T.value)},[e.renderSlot(t.$slots,"default"),e.createVNode(e.TransitionGroup,{name:`${e.unref(s).namespace.value}-zoom-in-top`},{default:e.withCtx(()=>[X.value?e.renderSlot(t.$slots,"error",{key:0,error:n.value},()=>[e.createElementVNode("div",{class:e.normalizeClass(G.value)},e.toDisplayString(n.value),3)]):e.createCommentVNode("",!0)]),_:3},8,["name"])],6)],10,ue))}});exports.default=ce;
|
|
@@ -228,12 +228,19 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
228
228
|
type: import("vue").PropType<boolean>;
|
|
229
229
|
default: boolean;
|
|
230
230
|
};
|
|
231
|
+
hideRequiredAsterisk: {
|
|
232
|
+
type: import("vue").PropType<boolean>;
|
|
233
|
+
};
|
|
231
234
|
for: {
|
|
232
235
|
type: import("vue").PropType<string>;
|
|
233
236
|
};
|
|
234
237
|
validateStatus: {
|
|
235
238
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
236
239
|
};
|
|
240
|
+
hideLabel: {
|
|
241
|
+
type: import("vue").PropType<boolean>;
|
|
242
|
+
default: boolean;
|
|
243
|
+
};
|
|
237
244
|
}>> & Readonly<{
|
|
238
245
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
239
246
|
}>, {
|
|
@@ -250,6 +257,7 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
250
257
|
labelWidth: string | number;
|
|
251
258
|
inlineMessage: string | boolean;
|
|
252
259
|
showMessage: boolean;
|
|
260
|
+
hideLabel: boolean;
|
|
253
261
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
254
262
|
P: {};
|
|
255
263
|
B: {};
|
|
@@ -292,12 +300,19 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
292
300
|
type: import("vue").PropType<boolean>;
|
|
293
301
|
default: boolean;
|
|
294
302
|
};
|
|
303
|
+
hideRequiredAsterisk: {
|
|
304
|
+
type: import("vue").PropType<boolean>;
|
|
305
|
+
};
|
|
295
306
|
for: {
|
|
296
307
|
type: import("vue").PropType<string>;
|
|
297
308
|
};
|
|
298
309
|
validateStatus: {
|
|
299
310
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
300
311
|
};
|
|
312
|
+
hideLabel: {
|
|
313
|
+
type: import("vue").PropType<boolean>;
|
|
314
|
+
default: boolean;
|
|
315
|
+
};
|
|
301
316
|
}>> & Readonly<{
|
|
302
317
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
303
318
|
}>, {
|
|
@@ -312,6 +327,7 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
312
327
|
labelWidth: string | number;
|
|
313
328
|
inlineMessage: string | boolean;
|
|
314
329
|
showMessage: boolean;
|
|
330
|
+
hideLabel: boolean;
|
|
315
331
|
}>;
|
|
316
332
|
__isFragment?: never;
|
|
317
333
|
__isTeleport?: never;
|
|
@@ -351,12 +367,19 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
351
367
|
type: import("vue").PropType<boolean>;
|
|
352
368
|
default: boolean;
|
|
353
369
|
};
|
|
370
|
+
hideRequiredAsterisk: {
|
|
371
|
+
type: import("vue").PropType<boolean>;
|
|
372
|
+
};
|
|
354
373
|
for: {
|
|
355
374
|
type: import("vue").PropType<string>;
|
|
356
375
|
};
|
|
357
376
|
validateStatus: {
|
|
358
377
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
359
378
|
};
|
|
379
|
+
hideLabel: {
|
|
380
|
+
type: import("vue").PropType<boolean>;
|
|
381
|
+
default: boolean;
|
|
382
|
+
};
|
|
360
383
|
}>> & Readonly<{
|
|
361
384
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
362
385
|
}>, {
|
|
@@ -373,6 +396,7 @@ export declare const VftForm: import("vft/es/utils").SFCWithInstall<{
|
|
|
373
396
|
labelWidth: string | number;
|
|
374
397
|
inlineMessage: string | boolean;
|
|
375
398
|
showMessage: boolean;
|
|
399
|
+
hideLabel: boolean;
|
|
376
400
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
377
401
|
$slots: {
|
|
378
402
|
label?(_: {
|
|
@@ -421,12 +445,19 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
421
445
|
type: import("vue").PropType<boolean>;
|
|
422
446
|
default: boolean;
|
|
423
447
|
};
|
|
448
|
+
hideRequiredAsterisk: {
|
|
449
|
+
type: import("vue").PropType<boolean>;
|
|
450
|
+
};
|
|
424
451
|
for: {
|
|
425
452
|
type: import("vue").PropType<string>;
|
|
426
453
|
};
|
|
427
454
|
validateStatus: {
|
|
428
455
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
429
456
|
};
|
|
457
|
+
hideLabel: {
|
|
458
|
+
type: import("vue").PropType<boolean>;
|
|
459
|
+
default: boolean;
|
|
460
|
+
};
|
|
430
461
|
}>> & Readonly<{
|
|
431
462
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
432
463
|
}>, {
|
|
@@ -443,6 +474,7 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
443
474
|
labelWidth: string | number;
|
|
444
475
|
inlineMessage: string | boolean;
|
|
445
476
|
showMessage: boolean;
|
|
477
|
+
hideLabel: boolean;
|
|
446
478
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
447
479
|
P: {};
|
|
448
480
|
B: {};
|
|
@@ -485,12 +517,19 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
485
517
|
type: import("vue").PropType<boolean>;
|
|
486
518
|
default: boolean;
|
|
487
519
|
};
|
|
520
|
+
hideRequiredAsterisk: {
|
|
521
|
+
type: import("vue").PropType<boolean>;
|
|
522
|
+
};
|
|
488
523
|
for: {
|
|
489
524
|
type: import("vue").PropType<string>;
|
|
490
525
|
};
|
|
491
526
|
validateStatus: {
|
|
492
527
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
493
528
|
};
|
|
529
|
+
hideLabel: {
|
|
530
|
+
type: import("vue").PropType<boolean>;
|
|
531
|
+
default: boolean;
|
|
532
|
+
};
|
|
494
533
|
}>> & Readonly<{
|
|
495
534
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
496
535
|
}>, {
|
|
@@ -505,6 +544,7 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
505
544
|
labelWidth: string | number;
|
|
506
545
|
inlineMessage: string | boolean;
|
|
507
546
|
showMessage: boolean;
|
|
547
|
+
hideLabel: boolean;
|
|
508
548
|
}>;
|
|
509
549
|
__isFragment?: never;
|
|
510
550
|
__isTeleport?: never;
|
|
@@ -544,12 +584,19 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
544
584
|
type: import("vue").PropType<boolean>;
|
|
545
585
|
default: boolean;
|
|
546
586
|
};
|
|
587
|
+
hideRequiredAsterisk: {
|
|
588
|
+
type: import("vue").PropType<boolean>;
|
|
589
|
+
};
|
|
547
590
|
for: {
|
|
548
591
|
type: import("vue").PropType<string>;
|
|
549
592
|
};
|
|
550
593
|
validateStatus: {
|
|
551
594
|
type: import("vue").PropType<"" | "error" | "validating" | "success">;
|
|
552
595
|
};
|
|
596
|
+
hideLabel: {
|
|
597
|
+
type: import("vue").PropType<boolean>;
|
|
598
|
+
default: boolean;
|
|
599
|
+
};
|
|
553
600
|
}>> & Readonly<{
|
|
554
601
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
555
602
|
}>, {
|
|
@@ -566,6 +613,7 @@ export declare const VftFormItem: import("vft/es/utils").SFCWithInstall<{
|
|
|
566
613
|
labelWidth: string | number;
|
|
567
614
|
inlineMessage: string | boolean;
|
|
568
615
|
showMessage: boolean;
|
|
616
|
+
hideLabel: boolean;
|
|
569
617
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
570
618
|
$slots: {
|
|
571
619
|
label?(_: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../form/index.cjs");const k=require("../icon/index.cjs"),Y=require("@vueuse/core"),s=require("@vft/utils"),T=require("../../utils/error.cjs");require("../config-provider/hooks/use-global-config.cjs");const Be=require("lodash-es"),Z=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const q=require("@vft/constants"),_=require("@vft/use"),ee=require("./utils.cjs"),te=require("../form/hooks/use-form-item.cjs"),oe=require("../form/hooks/use-form-common-props.cjs"),Ve=["role"],Ie=["id","type","disabled","formatter","parser","readonly","autocomplete","tabindex","aria-label","placeholder","form"],Se=["id","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form"],ze=e.defineComponent({__name:"input",props:{id:{},size:{default:""},disabled:{type:Boolean},modelValue:{},type:{default:"text"},resize:{},autosize:{type:[Object,Boolean],default:!1},autocomplete:{default:"off"},formatter:{},parser:{},placeholder:{},form:{},readonly:{type:Boolean},clearable:{type:Boolean},showPassword:{type:Boolean},showWordLimit:{type:Boolean},suffixIcon:{},prefixIcon:{},clearIcon:{},containerRole:{},label:{},tabindex:{default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:[Boolean,null,String,Object,Array]}},emits:{[q.UPDATE_MODEL_EVENT]:t=>s.isString(t),input:t=>s.isString(t),change:t=>s.isString(t),suffixClick:t=>s.isString(t),prefixClick:t=>s.isString(t),focus:t=>t instanceof FocusEvent,blur:t=>t instanceof FocusEvent,clear:()=>!0,enter:()=>!0,mouseleave:t=>t instanceof MouseEvent,mouseenter:t=>t instanceof MouseEvent,keydown:t=>t instanceof Event,compositionstart:t=>t instanceof CompositionEvent,compositionupdate:t=>t instanceof CompositionEvent,compositionend:t=>t instanceof CompositionEvent},setup(t,{expose:ne,emit:ae}){const l=ae,v=e.useAttrs(),i=e.useSlots(),M=e.computed(()=>{const o={};return t.containerRole==="combobox"&&(o["aria-haspopup"]=v["aria-haspopup"],o["aria-owns"]=v["aria-owns"],o["aria-expanded"]=v["aria-expanded"]),o}),le=e.computed(()=>[t.type==="textarea"?A.b():n.b(),n.m(ie.value),n.is("disabled",m.value),n.is("exceed",fe.value),n.is("focus",c.value),{[n.b("group")]:i.prepend||i.append,[n.bm("group","append")]:i.append,[n.bm("group","prepend")]:i.prepend,[n.m("prefix")]:i.prefix||t.prefixIcon,[n.m("suffix")]:i.suffix||t.suffixIcon||t.clearable||t.showPassword,[n.bm("suffix","password-clear")]:E.value&&z.value},v.class]),se=e.getCurrentInstance(),re=e.computed(()=>[n.e("wrapper"),n.is("focus",c.value)]),r=_.useAttrs({excludeKeys:e.computed(()=>Object.keys(M.value))}),{form:ue,formItem:C}=te.useFormItem(),{inputId:F}=te.useFormItemInputId(se.props,{formItemContext:C}),ie=oe.useFormSize(),m=oe.useFormDisabled(),n=Z.useNamespace("input"),A=Z.useNamespace("textarea"),w=e.shallowRef(),f=e.shallowRef(),c=e.ref(!1),V=e.ref(!1),y=e.ref(!1),x=e.ref(!1),D=e.ref(),I=e.shallowRef(t.inputStyle),h=e.computed(()=>w.value||f.value),S=e.computed(()=>s.singleAttrToObj(t.prefixIcon,"icon",{size:16})),O=e.computed(()=>s.singleAttrToObj(t.suffixIcon,"icon",{size:16})),ce=e.computed(()=>s.singleAttrToObj(t.clearIcon,"icon",{icon:"icon-circle-close",size:16})),R=e.computed(()=>ue?.statusIcon??!1),g=e.computed(()=>C?.validateState||""),K=e.computed(()=>g.value&&{validating:"icon-loading",success:"icon-circle-check",error:"icon-circle-close"}[g.value]),de=e.computed(()=>x.value?{icon:"icon-view",size:16}:{icon:"icon-hide",size:16}),me=e.computed(()=>[v.style,t.inputStyle]),$=e.computed(()=>[t.inputStyle,I.value,{resize:t.resize}]),u=e.computed(()=>Be.isNil(t.modelValue)?"":String(t.modelValue)),E=e.computed(()=>t.clearable&&!m.value&&!t.readonly&&!!u.value&&(c.value||V.value)),z=e.computed(()=>t.showPassword&&!m.value&&!t.readonly&&!!u.value&&(!!u.value||c.value)),p=e.computed(()=>t.showWordLimit&&!!r.value.maxlength&&(t.type==="text"||t.type==="textarea")&&!m.value&&!t.readonly&&!t.showPassword),N=e.computed(()=>Array.from(u.value).length),fe=e.computed(()=>!!p.value&&N.value>Number(r.value.maxlength)),pe=e.computed(()=>!!i.suffix||!!t.suffixIcon||E.value||t.showPassword||p.value||!!g.value&&R.value),[ve,ye]=_.useCursor(w);Y.useResizeObserver(f,o=>{if(!p.value||t.resize!=="both")return;const a=o[0],{width:d}=a.contentRect;D.value={right:`calc(100% - ${d+15+6}px)`}});const B=()=>{if(!(!Y.isClient||t.type!=="textarea"))if(t.autosize){const o=s.isObject(t.autosize)?t.autosize.minRows:void 0,a=s.isObject(t.autosize)?t.autosize.maxRows:void 0;I.value={...ee.calcTextareaHeight(f.value,o,a)}}else I.value={minHeight:ee.calcTextareaHeight(f.value).minHeight}},b=()=>{const o=h.value;!o||o.value===u.value||(o.value=u.value)},P=async o=>{ve();let{value:a}=o.target;if(r.value.maxlength&&a.length>=r.value.maxlength&&(a=a.slice(0,Number(r.value.maxlength))),t.formatter&&(a=t.parser?t.parser(a):a,a=t.formatter(a)),!y.value){if(a===u.value){b();return}l(q.UPDATE_MODEL_EVENT,a),l("input",a),await e.nextTick(),b(),ye()}},j=o=>{l("change",o.target.value)},he=()=>{l("suffixClick",t.modelValue)},ge=()=>{l("prefixClick",t.modelValue)},L=o=>{l("compositionstart",o),y.value=!0},be=o=>/([(\uAC00-\uD7AF)|\u3130-\u318F])+/.test(o),W=o=>{l("compositionupdate",o);const a=o.target?.value,d=a[a.length-1]||"";y.value=!be(d)},H=o=>{l("compositionend",o),y.value&&(y.value=!1,P(o))},ke=()=>{x.value=!x.value,U()},U=async()=>{await e.nextTick(),h.value?.focus()},Ce=()=>h.value?.blur(),G=o=>{c.value=!0,l("focus",o)},J=o=>{c.value=!1,l("blur",o),t.validateEvent&&C?.validate?.("blur").catch(a=>T.debugWarn(a))},we=o=>{V.value=!1,l("mouseleave",o)},xe=o=>{V.value=!0,l("mouseenter",o)},Q=o=>{let a=o.key;if(o.target.type==="number"&&["e","+","-0","E"].includes(a))return o.returnValue=!1,!1;l("keydown",o)},Ee=()=>{h.value?.select()},X=()=>{l(q.UPDATE_MODEL_EVENT,""),l("change",""),l("clear"),l("input","")};return e.watch(()=>t.modelValue,()=>{e.nextTick(()=>B()),t.validateEvent&&C?.validate?.("change").catch(o=>T.debugWarn(o))}),e.watch(u,()=>b()),e.watch(()=>t.type,async()=>{await e.nextTick(),b(),B()}),e.onMounted(()=>{!t.formatter&&t.parser&&T.debugWarn("VftInput","If you set the parser, you also need to set the formatter."),b(),e.nextTick(B)}),ne({input:w,textarea:f,ref:h,textareaStyle:$,autosize:t.autosize,focus:U,blur:Ce,select:Ee,clear:X,resizeTextarea:B}),(o,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",e.mergeProps(M.value,{class:le.value,style:me.value,role:o.containerRole,onMouseenter:xe,onMouseleave:we,onMousewheel:a[1]||(a[1]=d=>o.type==="number"&&c.value?d.preventDefault():null)}),[o.type!=="textarea"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.$slots.prepend?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).be("group","prepend"))},[e.renderSlot(o.$slots,"prepend")],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(re.value)},[o.$slots.prefix||S.value?.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("prefix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("prefix-inner")),onClick:ge},[e.renderSlot(o.$slots,"prefix"),S.value?.icon?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:0,pointer:""},S.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(F),ref_key:"input",ref:w,class:e.unref(n).e("inner")},e.unref(r),{type:o.showPassword?x.value?"text":"password":o.type,disabled:e.unref(m),formatter:o.formatter,parser:o.parser,readonly:o.readonly,autocomplete:o.autocomplete,tabindex:o.tabindex,"aria-label":o.label,placeholder:o.placeholder,style:o.inputStyle,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q,onKeyup:a[0]||(a[0]=e.withKeys(d=>l("enter"),["enter"]))}),null,16,Ie),pe.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n).e("suffix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("suffix-inner")),onClick:he},[!E.value||!z.value||!p.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(o.$slots,"suffix"),O.value?.icon?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:0},O.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:1,pointer:"",class:[e.unref(n).e("icon"),e.unref(n).e("clear")]},ce.value,{onMousedown:e.withModifiers(e.unref(s.noop),["prevent"]),onClick:e.withModifiers(X,["stop"])}),null,16,["class","onMousedown"])):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:2},de.value,{class:[e.unref(n).e("icon"),e.unref(n).e("password")],onClick:ke}),null,16,["class"])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(e.unref(n).e("count"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("count-inner"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),3)],2)):e.createCommentVNode("",!0),g.value&&K.value&&R.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),{key:4,icon:K.value,class:e.normalizeClass([e.unref(n).e("icon"),e.unref(n).e("validateIcon"),e.unref(n).is("loading",g.value==="validating")])},null,8,["icon","class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0)],2),o.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).be("group","append"))},[e.renderSlot(o.$slots,"append")],2)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("textarea",e.mergeProps({id:e.unref(F),ref_key:"textarea",ref:f,class:e.unref(A).e("inner")},e.unref(r),{tabindex:o.tabindex,disabled:e.unref(m),readonly:o.readonly,autocomplete:o.autocomplete,style:$.value,"aria-label":o.label,placeholder:o.placeholder,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q}),null,16,Se),p.value?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(D.value),class:e.normalizeClass(e.unref(n).e("count"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),7)):e.createCommentVNode("",!0)],64))],16,Ve)),[[e.vShow,o.type!=="hidden"]])}});exports.default=ze;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../form/index.cjs");const k=require("../icon/index.cjs"),Y=require("@vueuse/core"),s=require("@vft/utils"),T=require("../../utils/error.cjs");require("../config-provider/hooks/use-global-config.cjs");const Be=require("lodash-es"),Z=require("../../hooks/use-namespace/index.cjs");require("../../hooks/use-model-toggle/index.cjs");require("@popperjs/core");require("../../hooks/use-z-index/index.cjs");const q=require("@vft/constants"),_=require("@vft/use"),ee=require("./utils.cjs"),te=require("../form/hooks/use-form-common-props.cjs"),oe=require("../form/hooks/use-form-item.cjs"),Ve=["role"],Ie=["id","type","disabled","formatter","parser","readonly","autocomplete","tabindex","aria-label","placeholder","form"],Se=["id","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form"],ze=e.defineComponent({__name:"input",props:{id:{},size:{default:""},disabled:{type:Boolean},modelValue:{},type:{default:"text"},resize:{},autosize:{type:[Object,Boolean],default:!1},autocomplete:{default:"off"},formatter:{},parser:{},placeholder:{},form:{},readonly:{type:Boolean},clearable:{type:Boolean},showPassword:{type:Boolean},showWordLimit:{type:Boolean},suffixIcon:{},prefixIcon:{},clearIcon:{},containerRole:{},label:{},tabindex:{default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:[Boolean,null,String,Object,Array]}},emits:{[q.UPDATE_MODEL_EVENT]:t=>s.isString(t),input:t=>s.isString(t),change:t=>s.isString(t),suffixClick:t=>s.isString(t),prefixClick:t=>s.isString(t),focus:t=>t instanceof FocusEvent,blur:t=>t instanceof FocusEvent,clear:()=>!0,enter:()=>!0,mouseleave:t=>t instanceof MouseEvent,mouseenter:t=>t instanceof MouseEvent,keydown:t=>t instanceof Event,compositionstart:t=>t instanceof CompositionEvent,compositionupdate:t=>t instanceof CompositionEvent,compositionend:t=>t instanceof CompositionEvent},setup(t,{expose:ne,emit:ae}){const l=ae,v=e.useAttrs(),i=e.useSlots(),M=e.computed(()=>{const o={};return t.containerRole==="combobox"&&(o["aria-haspopup"]=v["aria-haspopup"],o["aria-owns"]=v["aria-owns"],o["aria-expanded"]=v["aria-expanded"]),o}),le=e.computed(()=>[t.type==="textarea"?A.b():n.b(),n.m(ie.value),n.is("disabled",m.value),n.is("exceed",fe.value),n.is("focus",c.value),{[n.b("group")]:i.prepend||i.append,[n.bm("group","append")]:i.append,[n.bm("group","prepend")]:i.prepend,[n.m("prefix")]:i.prefix||t.prefixIcon,[n.m("suffix")]:i.suffix||t.suffixIcon||t.clearable||t.showPassword,[n.bm("suffix","password-clear")]:E.value&&z.value},v.class]),se=e.getCurrentInstance(),re=e.computed(()=>[n.e("wrapper"),n.is("focus",c.value)]),r=_.useAttrs({excludeKeys:e.computed(()=>Object.keys(M.value))}),{form:ue,formItem:C}=oe.useFormItem(),{inputId:F}=oe.useFormItemInputId(se.props,{formItemContext:C}),ie=te.useFormSize(),m=te.useFormDisabled(),n=Z.useNamespace("input"),A=Z.useNamespace("textarea"),w=e.shallowRef(),f=e.shallowRef(),c=e.ref(!1),V=e.ref(!1),y=e.ref(!1),x=e.ref(!1),D=e.ref(),I=e.shallowRef(t.inputStyle),h=e.computed(()=>w.value||f.value),S=e.computed(()=>s.singleAttrToObj(t.prefixIcon,"icon",{size:16})),O=e.computed(()=>s.singleAttrToObj(t.suffixIcon,"icon",{size:16})),ce=e.computed(()=>s.singleAttrToObj(t.clearIcon,"icon",{icon:"icon-circle-close",size:16})),R=e.computed(()=>ue?.statusIcon??!1),g=e.computed(()=>C?.validateState||""),K=e.computed(()=>g.value&&{validating:"icon-loading",success:"icon-circle-check",error:"icon-circle-close"}[g.value]),de=e.computed(()=>x.value?{icon:"icon-view",size:16}:{icon:"icon-hide",size:16}),me=e.computed(()=>[v.style,t.inputStyle]),$=e.computed(()=>[t.inputStyle,I.value,{resize:t.resize}]),u=e.computed(()=>Be.isNil(t.modelValue)?"":String(t.modelValue)),E=e.computed(()=>t.clearable&&!m.value&&!t.readonly&&!!u.value&&(c.value||V.value)),z=e.computed(()=>t.showPassword&&!m.value&&!t.readonly&&!!u.value&&(!!u.value||c.value)),p=e.computed(()=>t.showWordLimit&&!!r.value.maxlength&&(t.type==="text"||t.type==="textarea")&&!m.value&&!t.readonly&&!t.showPassword),N=e.computed(()=>Array.from(u.value).length),fe=e.computed(()=>!!p.value&&N.value>Number(r.value.maxlength)),pe=e.computed(()=>!!i.suffix||!!t.suffixIcon||E.value||t.showPassword||p.value||!!g.value&&R.value),[ve,ye]=_.useCursor(w);Y.useResizeObserver(f,o=>{if(!p.value||t.resize!=="both")return;const a=o[0],{width:d}=a.contentRect;D.value={right:`calc(100% - ${d+15+6}px)`}});const B=()=>{if(!(!Y.isClient||t.type!=="textarea"))if(t.autosize){const o=s.isObject(t.autosize)?t.autosize.minRows:void 0,a=s.isObject(t.autosize)?t.autosize.maxRows:void 0;I.value={...ee.calcTextareaHeight(f.value,o,a)}}else I.value={minHeight:ee.calcTextareaHeight(f.value).minHeight}},b=()=>{const o=h.value;!o||o.value===u.value||(o.value=u.value)},P=async o=>{ve();let{value:a}=o.target;if(r.value.maxlength&&a.length>=r.value.maxlength&&(a=a.slice(0,Number(r.value.maxlength))),t.formatter&&(a=t.parser?t.parser(a):a,a=t.formatter(a)),!y.value){if(a===u.value){b();return}l(q.UPDATE_MODEL_EVENT,a),l("input",a),await e.nextTick(),b(),ye()}},j=o=>{l("change",o.target.value)},he=()=>{l("suffixClick",t.modelValue)},ge=()=>{l("prefixClick",t.modelValue)},L=o=>{l("compositionstart",o),y.value=!0},be=o=>/([(\uAC00-\uD7AF)|\u3130-\u318F])+/.test(o),W=o=>{l("compositionupdate",o);const a=o.target?.value,d=a[a.length-1]||"";y.value=!be(d)},H=o=>{l("compositionend",o),y.value&&(y.value=!1,P(o))},ke=()=>{x.value=!x.value,U()},U=async()=>{await e.nextTick(),h.value?.focus()},Ce=()=>h.value?.blur(),G=o=>{c.value=!0,l("focus",o)},J=o=>{c.value=!1,l("blur",o),t.validateEvent&&C?.validate?.("blur").catch(a=>T.debugWarn(a))},we=o=>{V.value=!1,l("mouseleave",o)},xe=o=>{V.value=!0,l("mouseenter",o)},Q=o=>{let a=o.key;if(o.target.type==="number"&&["e","+","-0","E"].includes(a))return o.returnValue=!1,!1;l("keydown",o)},Ee=()=>{h.value?.select()},X=()=>{l(q.UPDATE_MODEL_EVENT,""),l("change",""),l("clear"),l("input","")};return e.watch(()=>t.modelValue,()=>{e.nextTick(()=>B()),t.validateEvent&&C?.validate?.("change").catch(o=>T.debugWarn(o))}),e.watch(u,()=>b()),e.watch(()=>t.type,async()=>{await e.nextTick(),b(),B()}),e.onMounted(()=>{!t.formatter&&t.parser&&T.debugWarn("VftInput","If you set the parser, you also need to set the formatter."),b(),e.nextTick(B)}),ne({input:w,textarea:f,ref:h,textareaStyle:$,autosize:t.autosize,focus:U,blur:Ce,select:Ee,clear:X,resizeTextarea:B}),(o,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",e.mergeProps(M.value,{class:le.value,style:me.value,role:o.containerRole,onMouseenter:xe,onMouseleave:we,onMousewheel:a[1]||(a[1]=d=>o.type==="number"&&c.value?d.preventDefault():null)}),[o.type!=="textarea"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.$slots.prepend?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).be("group","prepend"))},[e.renderSlot(o.$slots,"prepend")],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(re.value)},[o.$slots.prefix||S.value?.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("prefix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("prefix-inner")),onClick:ge},[e.renderSlot(o.$slots,"prefix"),S.value?.icon?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:0,pointer:""},S.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(F),ref_key:"input",ref:w,class:e.unref(n).e("inner")},e.unref(r),{type:o.showPassword?x.value?"text":"password":o.type,disabled:e.unref(m),formatter:o.formatter,parser:o.parser,readonly:o.readonly,autocomplete:o.autocomplete,tabindex:o.tabindex,"aria-label":o.label,placeholder:o.placeholder,style:o.inputStyle,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q,onKeyup:a[0]||(a[0]=e.withKeys(d=>l("enter"),["enter"]))}),null,16,Ie),pe.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n).e("suffix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("suffix-inner")),onClick:he},[!E.value||!z.value||!p.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(o.$slots,"suffix"),O.value?.icon?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:0},O.value,{class:e.unref(n).e("icon")}),null,16,["class"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:1,pointer:"",class:[e.unref(n).e("icon"),e.unref(n).e("clear")]},ce.value,{onMousedown:e.withModifiers(e.unref(s.noop),["prevent"]),onClick:e.withModifiers(X,["stop"])}),null,16,["class","onMousedown"])):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),e.mergeProps({key:2},de.value,{class:[e.unref(n).e("icon"),e.unref(n).e("password")],onClick:ke}),null,16,["class"])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(e.unref(n).e("count"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("count-inner"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),3)],2)):e.createCommentVNode("",!0),g.value&&K.value&&R.value?(e.openBlock(),e.createBlock(e.unref(k.VftIcon),{key:4,icon:K.value,class:e.normalizeClass([e.unref(n).e("icon"),e.unref(n).e("validateIcon"),e.unref(n).is("loading",g.value==="validating")])},null,8,["icon","class"])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0)],2),o.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).be("group","append"))},[e.renderSlot(o.$slots,"append")],2)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("textarea",e.mergeProps({id:e.unref(F),ref_key:"textarea",ref:f,class:e.unref(A).e("inner")},e.unref(r),{tabindex:o.tabindex,disabled:e.unref(m),readonly:o.readonly,autocomplete:o.autocomplete,style:$.value,"aria-label":o.label,placeholder:o.placeholder,form:o.form,onCompositionstart:L,onCompositionupdate:W,onCompositionend:H,onInput:P,onFocus:G,onBlur:J,onChange:j,onKeydown:Q}),null,16,Se),p.value?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(D.value),class:e.normalizeClass(e.unref(n).e("count"))},e.toDisplayString(N.value)+" / "+e.toDisplayString(e.unref(r).maxlength),7)):e.createCommentVNode("",!0)],64))],16,Ve)),[[e.vShow,o.type!=="hidden"]])}});exports.default=ze;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@vft/utils"),m=require("../component-map.cjs");function n(r,o=""){
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@vft/utils"),m=require("../component-map.cjs");function n(r,o=""){return o=(o||"").replace(":","")||"",[m.FormCompEnum.INPUT,m.FormCompEnum.INPUT_NUMBER,m.FormCompEnum.TEXTAREA,m.FormCompEnum.AUTOCOMPLETE].includes(r)?"请输入"+o:[m.FormCompEnum.PASSWORD].includes(r)?"请输入密码":[m.FormCompEnum.SELECT,m.FormCompEnum.RADIO,m.FormCompEnum.RADIO_SINGLE,m.FormCompEnum.RADIO_BUTTON,m.FormCompEnum.Cascader,m.FormCompEnum.ColorPicker,m.FormCompEnum.CHECKBOX,m.FormCompEnum.CHECKBOX_BUTTON].includes(r)?"请选择"+o:[m.FormCompEnum.CHECKBOX_SINGLE].includes(r)?"请勾选"+o:[m.FormCompEnum.SEARCH].includes(r)?"请输入要搜索的内容":[m.FormCompEnum.INPUT_TAG].includes(r)?"请输入标签内容":[m.FormCompEnum.Upload].includes(r)?"请选择上传文件":[m.FormCompEnum.Slider].includes(r)?"请拖动滑块":[m.FormCompEnum.TIME_PICKER,m.FormCompEnum.YEAR_PICKER,m.FormCompEnum.MONTH_PICKER,m.FormCompEnum.DATE_PICKER,m.FormCompEnum.DATES_PICKER,m.FormCompEnum.DATETIME_PICKER,m.FormCompEnum.WEEK_PICKER,m.FormCompEnum.DATETIMERANGE_PICKER,m.FormCompEnum.DATERANGE_PICKER,m.FormCompEnum.MONTHRANGE_PICKER].includes(r)?"请选择时间":""}function E(r,o){return r&&m.isInput(r)&&o&&u.isNumber(o)?`${o}`:o}exports.createPlaceholderMessage=n;exports.handleInputNumberValue=E;
|
package/lib/package.json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.339";exports.version=e;
|
package/lib/package.json.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.339",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
"resize-detector": "0.3.0",
|
|
56
56
|
"sortablejs": "1.15.0",
|
|
57
57
|
"photoswipe": "5.4.4",
|
|
58
|
-
"@vft/
|
|
59
|
-
"@vft/store": "0.0.54",
|
|
60
|
-
"@vft/router": "0.0.65",
|
|
58
|
+
"@vft/directives": "0.0.33",
|
|
61
59
|
"@vft/utils": "0.0.128",
|
|
60
|
+
"@vft/router": "0.0.65",
|
|
61
|
+
"@vft/store": "0.0.54",
|
|
62
62
|
"@vft/constants": "0.0.72",
|
|
63
|
-
"@vft/
|
|
63
|
+
"@vft/use": "0.0.76"
|
|
64
64
|
},
|
|
65
65
|
"vetur": {
|
|
66
66
|
"tags": "tags.json",
|
package/web-types.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"http://json.schemastore.org/web-types","framework":"vue","name":"vft","version":"0.0.
|
|
1
|
+
{"$schema":"http://json.schemastore.org/web-types","framework":"vue","name":"vft","version":"0.0.339","js-types-syntax":"typescript","description-markup":"markdown","contributions":{"html":{}}}
|