@tmagic/form 1.8.0-manmanyu.11 → 1.8.0-manmanyu.12
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/dist/es/Form.vue_vue_type_script_setup_true_lang.js +5 -1
- package/dist/es/FormBox.vue_vue_type_script_setup_true_lang.js +6 -0
- package/dist/es/FormDialog.vue_vue_type_script_setup_true_lang.js +6 -0
- package/dist/es/FormDrawer.vue_vue_type_script_setup_true_lang.js +6 -0
- package/dist/es/submitForm.js +99 -8
- package/dist/tmagic-form.umd.cjs +122 -9
- package/package.json +4 -4
- package/src/Form.vue +9 -1
- package/src/FormBox.vue +4 -0
- package/src/FormDialog.vue +4 -0
- package/src/FormDrawer.vue +4 -0
- package/src/submitForm.ts +171 -17
- package/types/index.d.ts +74 -9
|
@@ -35,6 +35,10 @@ var Form_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
35
35
|
keyProp: { default: "__key" },
|
|
36
36
|
popperClass: {},
|
|
37
37
|
preventSubmitDefault: { type: Boolean },
|
|
38
|
+
useFieldTextInError: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: true
|
|
41
|
+
},
|
|
38
42
|
extendState: {},
|
|
39
43
|
showDiff: {},
|
|
40
44
|
selfDiffFieldTypes: {},
|
|
@@ -279,7 +283,7 @@ var Form_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
279
283
|
Object.entries(invalidFields).forEach(([prop, ValidateError]) => {
|
|
280
284
|
ValidateError.forEach(({ field, message }) => {
|
|
281
285
|
const name = field || prop;
|
|
282
|
-
const text = getTextByName(name, props.config) || name;
|
|
286
|
+
const text = (props.useFieldTextInError ? getTextByName(name, props.config) : void 0) || name;
|
|
283
287
|
error.push(`${text} -> ${message}`);
|
|
284
288
|
});
|
|
285
289
|
});
|
|
@@ -19,6 +19,10 @@ var FormBox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
19
19
|
inline: { type: Boolean },
|
|
20
20
|
labelPosition: {},
|
|
21
21
|
preventSubmitDefault: { type: Boolean },
|
|
22
|
+
useFieldTextInError: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: true
|
|
25
|
+
},
|
|
22
26
|
extendState: {}
|
|
23
27
|
},
|
|
24
28
|
emits: [
|
|
@@ -81,6 +85,7 @@ var FormBox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
81
85
|
"label-position": __props.labelPosition,
|
|
82
86
|
inline: __props.inline,
|
|
83
87
|
"prevent-submit-default": __props.preventSubmitDefault,
|
|
88
|
+
"use-field-text-in-error": __props.useFieldTextInError,
|
|
84
89
|
"extend-state": __props.extendState,
|
|
85
90
|
onChange: changeHandler
|
|
86
91
|
}, null, 8, [
|
|
@@ -93,6 +98,7 @@ var FormBox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCo
|
|
|
93
98
|
"label-position",
|
|
94
99
|
"inline",
|
|
95
100
|
"prevent-submit-default",
|
|
101
|
+
"use-field-text-in-error",
|
|
96
102
|
"extend-state"
|
|
97
103
|
]), renderSlot(_ctx.$slots, "default")]),
|
|
98
104
|
_: 3
|
|
@@ -41,6 +41,10 @@ var FormDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
41
41
|
type: Boolean,
|
|
42
42
|
default: true
|
|
43
43
|
},
|
|
44
|
+
useFieldTextInError: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: true
|
|
47
|
+
},
|
|
44
48
|
extendState: {},
|
|
45
49
|
theme: {}
|
|
46
50
|
},
|
|
@@ -195,6 +199,7 @@ var FormDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
195
199
|
"label-position": __props.labelPosition,
|
|
196
200
|
inline: __props.inline,
|
|
197
201
|
"prevent-submit-default": __props.preventSubmitDefault,
|
|
202
|
+
"use-field-text-in-error": __props.useFieldTextInError,
|
|
198
203
|
"extend-state": __props.extendState,
|
|
199
204
|
theme: effectiveTheme.value,
|
|
200
205
|
onChange: changeHandler
|
|
@@ -209,6 +214,7 @@ var FormDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
209
214
|
"label-position",
|
|
210
215
|
"inline",
|
|
211
216
|
"prevent-submit-default",
|
|
217
|
+
"use-field-text-in-error",
|
|
212
218
|
"extend-state",
|
|
213
219
|
"theme"
|
|
214
220
|
]), renderSlot(_ctx.$slots, "default")], 4)) : createCommentVNode("v-if", true)]),
|
|
@@ -24,6 +24,10 @@ var FormDrawer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
24
24
|
inline: { type: Boolean },
|
|
25
25
|
labelPosition: {},
|
|
26
26
|
preventSubmitDefault: { type: Boolean },
|
|
27
|
+
useFieldTextInError: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: true
|
|
30
|
+
},
|
|
27
31
|
beforeClose: {},
|
|
28
32
|
extendState: {},
|
|
29
33
|
theme: {}
|
|
@@ -171,6 +175,7 @@ var FormDrawer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
171
175
|
"label-position": __props.labelPosition,
|
|
172
176
|
inline: __props.inline,
|
|
173
177
|
"prevent-submit-default": __props.preventSubmitDefault,
|
|
178
|
+
"use-field-text-in-error": __props.useFieldTextInError,
|
|
174
179
|
"extend-state": __props.extendState,
|
|
175
180
|
theme: effectiveTheme.value,
|
|
176
181
|
onChange: changeHandler
|
|
@@ -184,6 +189,7 @@ var FormDrawer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
184
189
|
"label-position",
|
|
185
190
|
"inline",
|
|
186
191
|
"prevent-submit-default",
|
|
192
|
+
"use-field-text-in-error",
|
|
187
193
|
"extend-state",
|
|
188
194
|
"theme"
|
|
189
195
|
]), renderSlot(_ctx.$slots, "default")], 512)) : createCommentVNode("v-if", true)]),
|
package/dist/es/submitForm.js
CHANGED
|
@@ -28,13 +28,20 @@ import { createApp, defineComponent, h, nextTick, ref, watch } from "vue";
|
|
|
28
28
|
* initValues: { name: 'foo' },
|
|
29
29
|
* returnChangeRecords: true,
|
|
30
30
|
* });
|
|
31
|
+
*
|
|
32
|
+
* // 调试模式:可见地渲染表单,点击「确定」才提交:
|
|
33
|
+
* const values = await submitForm({
|
|
34
|
+
* config: [...],
|
|
35
|
+
* initValues: { name: 'foo' },
|
|
36
|
+
* debug: true,
|
|
37
|
+
* });
|
|
31
38
|
* ```
|
|
32
39
|
*/
|
|
33
40
|
var submitForm = (options) => {
|
|
34
|
-
const { native, appContext, timeout = 1e4, returnChangeRecords, ...formProps } = options;
|
|
41
|
+
const { native, appContext, timeout = 1e4, returnChangeRecords, debug = false, ...formProps } = options;
|
|
35
42
|
return new Promise((resolve, reject) => {
|
|
36
43
|
const container = document.createElement("div");
|
|
37
|
-
container.style.display = "none";
|
|
44
|
+
if (!debug) container.style.display = "none";
|
|
38
45
|
document.body.appendChild(container);
|
|
39
46
|
let cleaned = false;
|
|
40
47
|
let timer = null;
|
|
@@ -42,22 +49,106 @@ var submitForm = (options) => {
|
|
|
42
49
|
name: "MFormSubmitWrapper",
|
|
43
50
|
setup() {
|
|
44
51
|
const formRef = ref(null);
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
stop();
|
|
52
|
+
const errorMsg = ref("");
|
|
53
|
+
const doSubmit = async () => {
|
|
48
54
|
try {
|
|
49
55
|
await nextTick();
|
|
50
|
-
const changeRecords = [...formRef.value
|
|
56
|
+
const changeRecords = [...formRef.value?.changeRecords ?? []];
|
|
51
57
|
const result = await formRef.value.submitForm(native);
|
|
52
58
|
resolve(returnChangeRecords ? {
|
|
53
59
|
values: result,
|
|
54
60
|
changeRecords
|
|
55
61
|
} : result);
|
|
62
|
+
cleanup();
|
|
56
63
|
} catch (err) {
|
|
64
|
+
if (debug) {
|
|
65
|
+
errorMsg.value = err instanceof Error ? err.message : String(err);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
57
68
|
reject(err);
|
|
58
|
-
} finally {
|
|
59
69
|
cleanup();
|
|
60
70
|
}
|
|
71
|
+
};
|
|
72
|
+
if (debug) {
|
|
73
|
+
const handleCancel = () => {
|
|
74
|
+
reject(/* @__PURE__ */ new Error("submitForm canceled in debug mode."));
|
|
75
|
+
cleanup();
|
|
76
|
+
};
|
|
77
|
+
const btnBase = {
|
|
78
|
+
padding: "8px 20px",
|
|
79
|
+
fontSize: "14px",
|
|
80
|
+
lineHeight: "1",
|
|
81
|
+
border: "1px solid #dcdfe6",
|
|
82
|
+
borderRadius: "4px",
|
|
83
|
+
cursor: "pointer"
|
|
84
|
+
};
|
|
85
|
+
return () => h("div", { style: {
|
|
86
|
+
position: "fixed",
|
|
87
|
+
inset: "0",
|
|
88
|
+
zIndex: "10000",
|
|
89
|
+
display: "flex",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
justifyContent: "center",
|
|
92
|
+
background: "rgba(0, 0, 0, 0.5)"
|
|
93
|
+
} }, [h("div", { style: {
|
|
94
|
+
display: "flex",
|
|
95
|
+
flexDirection: "column",
|
|
96
|
+
width: "600px",
|
|
97
|
+
maxWidth: "90vw",
|
|
98
|
+
maxHeight: "85vh",
|
|
99
|
+
background: "#fff",
|
|
100
|
+
borderRadius: "8px",
|
|
101
|
+
boxShadow: "0 8px 24px rgba(0, 0, 0, 0.2)",
|
|
102
|
+
overflow: "hidden"
|
|
103
|
+
} }, [
|
|
104
|
+
h("div", { style: {
|
|
105
|
+
padding: "16px 20px",
|
|
106
|
+
fontSize: "16px",
|
|
107
|
+
fontWeight: "600",
|
|
108
|
+
borderBottom: "1px solid #ebeef5"
|
|
109
|
+
} }, "submitForm 调试"),
|
|
110
|
+
h("div", { style: {
|
|
111
|
+
flex: "1",
|
|
112
|
+
padding: "20px",
|
|
113
|
+
overflow: "auto"
|
|
114
|
+
} }, [h(Form_default, {
|
|
115
|
+
...formProps,
|
|
116
|
+
ref: formRef
|
|
117
|
+
}), errorMsg.value ? h("div", {
|
|
118
|
+
style: {
|
|
119
|
+
marginTop: "12px",
|
|
120
|
+
color: "#f56c6c",
|
|
121
|
+
fontSize: "13px",
|
|
122
|
+
lineHeight: "1.5"
|
|
123
|
+
},
|
|
124
|
+
innerHTML: errorMsg.value
|
|
125
|
+
}) : null]),
|
|
126
|
+
h("div", { style: {
|
|
127
|
+
display: "flex",
|
|
128
|
+
justifyContent: "flex-end",
|
|
129
|
+
gap: "12px",
|
|
130
|
+
padding: "12px 20px",
|
|
131
|
+
borderTop: "1px solid #ebeef5"
|
|
132
|
+
} }, [h("button", {
|
|
133
|
+
type: "button",
|
|
134
|
+
onClick: handleCancel,
|
|
135
|
+
style: { ...btnBase }
|
|
136
|
+
}, "取消"), h("button", {
|
|
137
|
+
type: "button",
|
|
138
|
+
onClick: doSubmit,
|
|
139
|
+
style: {
|
|
140
|
+
...btnBase,
|
|
141
|
+
color: "#fff",
|
|
142
|
+
background: "#409eff",
|
|
143
|
+
borderColor: "#409eff"
|
|
144
|
+
}
|
|
145
|
+
}, "确定")])
|
|
146
|
+
])]);
|
|
147
|
+
}
|
|
148
|
+
const stop = watch(() => formRef.value?.initialized, (initialized) => {
|
|
149
|
+
if (!initialized) return;
|
|
150
|
+
stop();
|
|
151
|
+
doSubmit();
|
|
61
152
|
}, {
|
|
62
153
|
flush: "post",
|
|
63
154
|
immediate: true
|
|
@@ -81,7 +172,7 @@ var submitForm = (options) => {
|
|
|
81
172
|
} catch {}
|
|
82
173
|
container.parentNode?.removeChild(container);
|
|
83
174
|
};
|
|
84
|
-
if (timeout > 0) timer = setTimeout(() => {
|
|
175
|
+
if (timeout > 0 && !debug) timer = setTimeout(() => {
|
|
85
176
|
if (!cleaned) {
|
|
86
177
|
reject(/* @__PURE__ */ new Error(`submitForm timeout after ${timeout}ms: form is not initialized.`));
|
|
87
178
|
cleanup();
|
package/dist/tmagic-form.umd.cjs
CHANGED
|
@@ -3465,6 +3465,10 @@
|
|
|
3465
3465
|
keyProp: { default: "__key" },
|
|
3466
3466
|
popperClass: {},
|
|
3467
3467
|
preventSubmitDefault: { type: Boolean },
|
|
3468
|
+
useFieldTextInError: {
|
|
3469
|
+
type: Boolean,
|
|
3470
|
+
default: true
|
|
3471
|
+
},
|
|
3468
3472
|
extendState: {},
|
|
3469
3473
|
showDiff: {},
|
|
3470
3474
|
selfDiffFieldTypes: {},
|
|
@@ -3709,7 +3713,7 @@
|
|
|
3709
3713
|
Object.entries(invalidFields).forEach(([prop, ValidateError]) => {
|
|
3710
3714
|
ValidateError.forEach(({ field, message }) => {
|
|
3711
3715
|
const name = field || prop;
|
|
3712
|
-
const text = getTextByName(name, props.config) || name;
|
|
3716
|
+
const text = (props.useFieldTextInError ? getTextByName(name, props.config) : void 0) || name;
|
|
3713
3717
|
error.push(`${text} -> ${message}`);
|
|
3714
3718
|
});
|
|
3715
3719
|
});
|
|
@@ -3801,13 +3805,20 @@
|
|
|
3801
3805
|
* initValues: { name: 'foo' },
|
|
3802
3806
|
* returnChangeRecords: true,
|
|
3803
3807
|
* });
|
|
3808
|
+
*
|
|
3809
|
+
* // 调试模式:可见地渲染表单,点击「确定」才提交:
|
|
3810
|
+
* const values = await submitForm({
|
|
3811
|
+
* config: [...],
|
|
3812
|
+
* initValues: { name: 'foo' },
|
|
3813
|
+
* debug: true,
|
|
3814
|
+
* });
|
|
3804
3815
|
* ```
|
|
3805
3816
|
*/
|
|
3806
3817
|
var submitForm = (options) => {
|
|
3807
|
-
const { native, appContext, timeout = 1e4, returnChangeRecords, ...formProps } = options;
|
|
3818
|
+
const { native, appContext, timeout = 1e4, returnChangeRecords, debug = false, ...formProps } = options;
|
|
3808
3819
|
return new Promise((resolve, reject) => {
|
|
3809
3820
|
const container = document.createElement("div");
|
|
3810
|
-
container.style.display = "none";
|
|
3821
|
+
if (!debug) container.style.display = "none";
|
|
3811
3822
|
document.body.appendChild(container);
|
|
3812
3823
|
let cleaned = false;
|
|
3813
3824
|
let timer = null;
|
|
@@ -3815,22 +3826,106 @@
|
|
|
3815
3826
|
name: "MFormSubmitWrapper",
|
|
3816
3827
|
setup() {
|
|
3817
3828
|
const formRef = (0, vue.ref)(null);
|
|
3818
|
-
const
|
|
3819
|
-
|
|
3820
|
-
stop();
|
|
3829
|
+
const errorMsg = (0, vue.ref)("");
|
|
3830
|
+
const doSubmit = async () => {
|
|
3821
3831
|
try {
|
|
3822
3832
|
await (0, vue.nextTick)();
|
|
3823
|
-
const changeRecords = [...formRef.value
|
|
3833
|
+
const changeRecords = [...formRef.value?.changeRecords ?? []];
|
|
3824
3834
|
const result = await formRef.value.submitForm(native);
|
|
3825
3835
|
resolve(returnChangeRecords ? {
|
|
3826
3836
|
values: result,
|
|
3827
3837
|
changeRecords
|
|
3828
3838
|
} : result);
|
|
3839
|
+
cleanup();
|
|
3829
3840
|
} catch (err) {
|
|
3841
|
+
if (debug) {
|
|
3842
|
+
errorMsg.value = err instanceof Error ? err.message : String(err);
|
|
3843
|
+
return;
|
|
3844
|
+
}
|
|
3830
3845
|
reject(err);
|
|
3831
|
-
} finally {
|
|
3832
3846
|
cleanup();
|
|
3833
3847
|
}
|
|
3848
|
+
};
|
|
3849
|
+
if (debug) {
|
|
3850
|
+
const handleCancel = () => {
|
|
3851
|
+
reject(/* @__PURE__ */ new Error("submitForm canceled in debug mode."));
|
|
3852
|
+
cleanup();
|
|
3853
|
+
};
|
|
3854
|
+
const btnBase = {
|
|
3855
|
+
padding: "8px 20px",
|
|
3856
|
+
fontSize: "14px",
|
|
3857
|
+
lineHeight: "1",
|
|
3858
|
+
border: "1px solid #dcdfe6",
|
|
3859
|
+
borderRadius: "4px",
|
|
3860
|
+
cursor: "pointer"
|
|
3861
|
+
};
|
|
3862
|
+
return () => (0, vue.h)("div", { style: {
|
|
3863
|
+
position: "fixed",
|
|
3864
|
+
inset: "0",
|
|
3865
|
+
zIndex: "10000",
|
|
3866
|
+
display: "flex",
|
|
3867
|
+
alignItems: "center",
|
|
3868
|
+
justifyContent: "center",
|
|
3869
|
+
background: "rgba(0, 0, 0, 0.5)"
|
|
3870
|
+
} }, [(0, vue.h)("div", { style: {
|
|
3871
|
+
display: "flex",
|
|
3872
|
+
flexDirection: "column",
|
|
3873
|
+
width: "600px",
|
|
3874
|
+
maxWidth: "90vw",
|
|
3875
|
+
maxHeight: "85vh",
|
|
3876
|
+
background: "#fff",
|
|
3877
|
+
borderRadius: "8px",
|
|
3878
|
+
boxShadow: "0 8px 24px rgba(0, 0, 0, 0.2)",
|
|
3879
|
+
overflow: "hidden"
|
|
3880
|
+
} }, [
|
|
3881
|
+
(0, vue.h)("div", { style: {
|
|
3882
|
+
padding: "16px 20px",
|
|
3883
|
+
fontSize: "16px",
|
|
3884
|
+
fontWeight: "600",
|
|
3885
|
+
borderBottom: "1px solid #ebeef5"
|
|
3886
|
+
} }, "submitForm 调试"),
|
|
3887
|
+
(0, vue.h)("div", { style: {
|
|
3888
|
+
flex: "1",
|
|
3889
|
+
padding: "20px",
|
|
3890
|
+
overflow: "auto"
|
|
3891
|
+
} }, [(0, vue.h)(Form_default, {
|
|
3892
|
+
...formProps,
|
|
3893
|
+
ref: formRef
|
|
3894
|
+
}), errorMsg.value ? (0, vue.h)("div", {
|
|
3895
|
+
style: {
|
|
3896
|
+
marginTop: "12px",
|
|
3897
|
+
color: "#f56c6c",
|
|
3898
|
+
fontSize: "13px",
|
|
3899
|
+
lineHeight: "1.5"
|
|
3900
|
+
},
|
|
3901
|
+
innerHTML: errorMsg.value
|
|
3902
|
+
}) : null]),
|
|
3903
|
+
(0, vue.h)("div", { style: {
|
|
3904
|
+
display: "flex",
|
|
3905
|
+
justifyContent: "flex-end",
|
|
3906
|
+
gap: "12px",
|
|
3907
|
+
padding: "12px 20px",
|
|
3908
|
+
borderTop: "1px solid #ebeef5"
|
|
3909
|
+
} }, [(0, vue.h)("button", {
|
|
3910
|
+
type: "button",
|
|
3911
|
+
onClick: handleCancel,
|
|
3912
|
+
style: { ...btnBase }
|
|
3913
|
+
}, "取消"), (0, vue.h)("button", {
|
|
3914
|
+
type: "button",
|
|
3915
|
+
onClick: doSubmit,
|
|
3916
|
+
style: {
|
|
3917
|
+
...btnBase,
|
|
3918
|
+
color: "#fff",
|
|
3919
|
+
background: "#409eff",
|
|
3920
|
+
borderColor: "#409eff"
|
|
3921
|
+
}
|
|
3922
|
+
}, "确定")])
|
|
3923
|
+
])]);
|
|
3924
|
+
}
|
|
3925
|
+
const stop = (0, vue.watch)(() => formRef.value?.initialized, (initialized) => {
|
|
3926
|
+
if (!initialized) return;
|
|
3927
|
+
stop();
|
|
3928
|
+
doSubmit();
|
|
3834
3929
|
}, {
|
|
3835
3930
|
flush: "post",
|
|
3836
3931
|
immediate: true
|
|
@@ -3854,7 +3949,7 @@
|
|
|
3854
3949
|
} catch {}
|
|
3855
3950
|
container.parentNode?.removeChild(container);
|
|
3856
3951
|
};
|
|
3857
|
-
if (timeout > 0) timer = setTimeout(() => {
|
|
3952
|
+
if (timeout > 0 && !debug) timer = setTimeout(() => {
|
|
3858
3953
|
if (!cleaned) {
|
|
3859
3954
|
reject(/* @__PURE__ */ new Error(`submitForm timeout after ${timeout}ms: form is not initialized.`));
|
|
3860
3955
|
cleanup();
|
|
@@ -3911,6 +4006,10 @@
|
|
|
3911
4006
|
type: Boolean,
|
|
3912
4007
|
default: true
|
|
3913
4008
|
},
|
|
4009
|
+
useFieldTextInError: {
|
|
4010
|
+
type: Boolean,
|
|
4011
|
+
default: true
|
|
4012
|
+
},
|
|
3914
4013
|
extendState: {},
|
|
3915
4014
|
theme: {}
|
|
3916
4015
|
},
|
|
@@ -4065,6 +4164,7 @@
|
|
|
4065
4164
|
"label-position": __props.labelPosition,
|
|
4066
4165
|
inline: __props.inline,
|
|
4067
4166
|
"prevent-submit-default": __props.preventSubmitDefault,
|
|
4167
|
+
"use-field-text-in-error": __props.useFieldTextInError,
|
|
4068
4168
|
"extend-state": __props.extendState,
|
|
4069
4169
|
theme: effectiveTheme.value,
|
|
4070
4170
|
onChange: changeHandler
|
|
@@ -4079,6 +4179,7 @@
|
|
|
4079
4179
|
"label-position",
|
|
4080
4180
|
"inline",
|
|
4081
4181
|
"prevent-submit-default",
|
|
4182
|
+
"use-field-text-in-error",
|
|
4082
4183
|
"extend-state",
|
|
4083
4184
|
"theme"
|
|
4084
4185
|
]), (0, vue.renderSlot)(_ctx.$slots, "default")], 4)) : (0, vue.createCommentVNode)("v-if", true)]),
|
|
@@ -4124,6 +4225,10 @@
|
|
|
4124
4225
|
inline: { type: Boolean },
|
|
4125
4226
|
labelPosition: {},
|
|
4126
4227
|
preventSubmitDefault: { type: Boolean },
|
|
4228
|
+
useFieldTextInError: {
|
|
4229
|
+
type: Boolean,
|
|
4230
|
+
default: true
|
|
4231
|
+
},
|
|
4127
4232
|
beforeClose: {},
|
|
4128
4233
|
extendState: {},
|
|
4129
4234
|
theme: {}
|
|
@@ -4271,6 +4376,7 @@
|
|
|
4271
4376
|
"label-position": __props.labelPosition,
|
|
4272
4377
|
inline: __props.inline,
|
|
4273
4378
|
"prevent-submit-default": __props.preventSubmitDefault,
|
|
4379
|
+
"use-field-text-in-error": __props.useFieldTextInError,
|
|
4274
4380
|
"extend-state": __props.extendState,
|
|
4275
4381
|
theme: effectiveTheme.value,
|
|
4276
4382
|
onChange: changeHandler
|
|
@@ -4284,6 +4390,7 @@
|
|
|
4284
4390
|
"label-position",
|
|
4285
4391
|
"inline",
|
|
4286
4392
|
"prevent-submit-default",
|
|
4393
|
+
"use-field-text-in-error",
|
|
4287
4394
|
"extend-state",
|
|
4288
4395
|
"theme"
|
|
4289
4396
|
]), (0, vue.renderSlot)(_ctx.$slots, "default")], 512)) : (0, vue.createCommentVNode)("v-if", true)]),
|
|
@@ -4321,6 +4428,10 @@
|
|
|
4321
4428
|
inline: { type: Boolean },
|
|
4322
4429
|
labelPosition: {},
|
|
4323
4430
|
preventSubmitDefault: { type: Boolean },
|
|
4431
|
+
useFieldTextInError: {
|
|
4432
|
+
type: Boolean,
|
|
4433
|
+
default: true
|
|
4434
|
+
},
|
|
4324
4435
|
extendState: {}
|
|
4325
4436
|
},
|
|
4326
4437
|
emits: [
|
|
@@ -4383,6 +4494,7 @@
|
|
|
4383
4494
|
"label-position": __props.labelPosition,
|
|
4384
4495
|
inline: __props.inline,
|
|
4385
4496
|
"prevent-submit-default": __props.preventSubmitDefault,
|
|
4497
|
+
"use-field-text-in-error": __props.useFieldTextInError,
|
|
4386
4498
|
"extend-state": __props.extendState,
|
|
4387
4499
|
onChange: changeHandler
|
|
4388
4500
|
}, null, 8, [
|
|
@@ -4395,6 +4507,7 @@
|
|
|
4395
4507
|
"label-position",
|
|
4396
4508
|
"inline",
|
|
4397
4509
|
"prevent-submit-default",
|
|
4510
|
+
"use-field-text-in-error",
|
|
4398
4511
|
"extend-state"
|
|
4399
4512
|
]), (0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
4400
4513
|
_: 3
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.8.0-manmanyu.
|
|
2
|
+
"version": "1.8.0-manmanyu.12",
|
|
3
3
|
"name": "@tmagic/form",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"vue": "^3.5.38",
|
|
54
54
|
"typescript": "^6.0.3",
|
|
55
|
-
"@tmagic/design": "1.8.0-manmanyu.
|
|
56
|
-
"@tmagic/utils": "1.8.0-manmanyu.
|
|
57
|
-
"@tmagic/form-schema": "1.8.0-manmanyu.
|
|
55
|
+
"@tmagic/design": "1.8.0-manmanyu.12",
|
|
56
|
+
"@tmagic/utils": "1.8.0-manmanyu.12",
|
|
57
|
+
"@tmagic/form-schema": "1.8.0-manmanyu.12"
|
|
58
58
|
},
|
|
59
59
|
"peerDependenciesMeta": {
|
|
60
60
|
"typescript": {
|
package/src/Form.vue
CHANGED
|
@@ -83,6 +83,13 @@ const props = withDefaults(
|
|
|
83
83
|
keyProp?: string;
|
|
84
84
|
popperClass?: string;
|
|
85
85
|
preventSubmitDefault?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* 表单校验失败时,错误提示前缀是否使用字段的 text 文案(通过 `getTextByName` 从 config 中查找)。
|
|
88
|
+
*
|
|
89
|
+
* - `true`(默认):错误提示形如 `字段文案 -> 错误信息`,找不到 text 时回退为字段 name;
|
|
90
|
+
* - `false`:跳过查找,直接使用字段 name 作为错误提示前缀(形如 `字段name -> 错误信息`)。
|
|
91
|
+
*/
|
|
92
|
+
useFieldTextInError?: boolean;
|
|
86
93
|
extendState?: (_state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
87
94
|
/**
|
|
88
95
|
* 自定义"是否展示对比内容"的判断函数(仅在 `isCompare === true` 时生效)。
|
|
@@ -134,6 +141,7 @@ const props = withDefaults(
|
|
|
134
141
|
inline: false,
|
|
135
142
|
labelPosition: 'right',
|
|
136
143
|
keyProp: '__key',
|
|
144
|
+
useFieldTextInError: true,
|
|
137
145
|
},
|
|
138
146
|
);
|
|
139
147
|
|
|
@@ -433,7 +441,7 @@ defineExpose({
|
|
|
433
441
|
Object.entries(invalidFields).forEach(([prop, ValidateError]) => {
|
|
434
442
|
(ValidateError as ValidateError[]).forEach(({ field, message }) => {
|
|
435
443
|
const name = field || prop;
|
|
436
|
-
const text = getTextByName(name, props.config) || name;
|
|
444
|
+
const text = (props.useFieldTextInError ? getTextByName(name, props.config) : undefined) || name;
|
|
437
445
|
|
|
438
446
|
error.push(`${text} -> ${message}`);
|
|
439
447
|
});
|
package/src/FormBox.vue
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
:label-position="labelPosition"
|
|
14
14
|
:inline="inline"
|
|
15
15
|
:prevent-submit-default="preventSubmitDefault"
|
|
16
|
+
:use-field-text-in-error="useFieldTextInError"
|
|
16
17
|
:extend-state="extendState"
|
|
17
18
|
@change="changeHandler"
|
|
18
19
|
></Form>
|
|
@@ -61,12 +62,15 @@ const props = withDefaults(
|
|
|
61
62
|
inline?: boolean;
|
|
62
63
|
labelPosition?: string;
|
|
63
64
|
preventSubmitDefault?: boolean;
|
|
65
|
+
/** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
|
|
66
|
+
useFieldTextInError?: boolean;
|
|
64
67
|
extendState?: (_state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
65
68
|
}>(),
|
|
66
69
|
{
|
|
67
70
|
config: () => [],
|
|
68
71
|
values: () => ({}),
|
|
69
72
|
confirmText: '确定',
|
|
73
|
+
useFieldTextInError: true,
|
|
70
74
|
},
|
|
71
75
|
);
|
|
72
76
|
|
package/src/FormDialog.vue
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
:label-position="labelPosition"
|
|
32
32
|
:inline="inline"
|
|
33
33
|
:prevent-submit-default="preventSubmitDefault"
|
|
34
|
+
:use-field-text-in-error="useFieldTextInError"
|
|
34
35
|
:extend-state="extendState"
|
|
35
36
|
:theme="effectiveTheme"
|
|
36
37
|
@change="changeHandler"
|
|
@@ -97,6 +98,8 @@ const props = withDefaults(
|
|
|
97
98
|
destroyOnClose?: boolean;
|
|
98
99
|
showClose?: boolean;
|
|
99
100
|
showCancel?: boolean;
|
|
101
|
+
/** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
|
|
102
|
+
useFieldTextInError?: boolean;
|
|
100
103
|
/** 透传给内部 `MForm`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
|
|
101
104
|
extendState?: (_state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
102
105
|
/**
|
|
@@ -115,6 +118,7 @@ const props = withDefaults(
|
|
|
115
118
|
destroyOnClose: false,
|
|
116
119
|
showClose: true,
|
|
117
120
|
showCancel: true,
|
|
121
|
+
useFieldTextInError: true,
|
|
118
122
|
},
|
|
119
123
|
);
|
|
120
124
|
|
package/src/FormDrawer.vue
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
:label-position="labelPosition"
|
|
29
29
|
:inline="inline"
|
|
30
30
|
:prevent-submit-default="preventSubmitDefault"
|
|
31
|
+
:use-field-text-in-error="useFieldTextInError"
|
|
31
32
|
:extend-state="extendState"
|
|
32
33
|
:theme="effectiveTheme"
|
|
33
34
|
@change="changeHandler"
|
|
@@ -83,6 +84,8 @@ const props = withDefaults(
|
|
|
83
84
|
inline?: boolean;
|
|
84
85
|
labelPosition?: string;
|
|
85
86
|
preventSubmitDefault?: boolean;
|
|
87
|
+
/** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
|
|
88
|
+
useFieldTextInError?: boolean;
|
|
86
89
|
/** 关闭前的回调,会暂停 Drawer 的关闭; done 是个 function type 接受一个 boolean 参数, 执行 done 使用 true 参数或不提供参数将会终止关闭 */
|
|
87
90
|
beforeClose?: (_done: (_cancel?: boolean) => void) => void;
|
|
88
91
|
/** 透传给内部 `MForm`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
|
|
@@ -99,6 +102,7 @@ const props = withDefaults(
|
|
|
99
102
|
config: () => [],
|
|
100
103
|
values: () => ({}),
|
|
101
104
|
confirmText: '确定',
|
|
105
|
+
useFieldTextInError: true,
|
|
102
106
|
},
|
|
103
107
|
);
|
|
104
108
|
|
package/src/submitForm.ts
CHANGED
|
@@ -45,6 +45,11 @@ export interface SubmitFormOptions {
|
|
|
45
45
|
keyProp?: string;
|
|
46
46
|
popperClass?: string;
|
|
47
47
|
preventSubmitDefault?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* 表单校验失败时,错误提示前缀是否使用字段的 text 文案(通过 `getTextByName` 从 config 中查找)。
|
|
50
|
+
* 默认 `true`,置为 `false` 时直接使用字段 name。
|
|
51
|
+
*/
|
|
52
|
+
useFieldTextInError?: boolean;
|
|
48
53
|
extendState?: (_state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
49
54
|
/** 透传给 Form.submitForm 的参数:是否直接返回原始响应式 values */
|
|
50
55
|
native?: boolean;
|
|
@@ -60,6 +65,15 @@ export interface SubmitFormOptions {
|
|
|
60
65
|
appContext?: AppContext | null;
|
|
61
66
|
/** 等待表单初始化的最长时间(毫秒),超时将以错误 reject。默认 10000ms */
|
|
62
67
|
timeout?: number;
|
|
68
|
+
/**
|
|
69
|
+
* 调试模式。默认 `false`。
|
|
70
|
+
*
|
|
71
|
+
* - `false`:表单以隐藏方式挂载,初始化完成后自动提交(原有行为)。
|
|
72
|
+
* - `true`:将表单以弹层形式可见地渲染在页面上,需手动点击「确定」才会触发校验/提交,
|
|
73
|
+
* 点击「取消」则以 reject 中断;校验失败时保留弹层并展示错误信息,便于修正后重试。
|
|
74
|
+
* 调试模式下 `timeout` 不生效(等待人工操作)。
|
|
75
|
+
*/
|
|
76
|
+
debug?: boolean;
|
|
63
77
|
}
|
|
64
78
|
// #endregion SubmitFormOptions
|
|
65
79
|
|
|
@@ -102,14 +116,24 @@ export interface SubmitFormResult {
|
|
|
102
116
|
* initValues: { name: 'foo' },
|
|
103
117
|
* returnChangeRecords: true,
|
|
104
118
|
* });
|
|
119
|
+
*
|
|
120
|
+
* // 调试模式:可见地渲染表单,点击「确定」才提交:
|
|
121
|
+
* const values = await submitForm({
|
|
122
|
+
* config: [...],
|
|
123
|
+
* initValues: { name: 'foo' },
|
|
124
|
+
* debug: true,
|
|
125
|
+
* });
|
|
105
126
|
* ```
|
|
106
127
|
*/
|
|
107
128
|
export const submitForm = (options: SubmitFormOptions): Promise<any> => {
|
|
108
|
-
const { native, appContext, timeout = 10000, returnChangeRecords, ...formProps } = options;
|
|
129
|
+
const { native, appContext, timeout = 10000, returnChangeRecords, debug = false, ...formProps } = options;
|
|
109
130
|
|
|
110
131
|
return new Promise((resolve, reject) => {
|
|
111
132
|
const container = document.createElement('div');
|
|
112
|
-
|
|
133
|
+
// 调试模式下需要把表单展示出来,普通模式则隐藏挂载
|
|
134
|
+
if (!debug) {
|
|
135
|
+
container.style.display = 'none';
|
|
136
|
+
}
|
|
113
137
|
document.body.appendChild(container);
|
|
114
138
|
|
|
115
139
|
let cleaned = false;
|
|
@@ -119,25 +143,154 @@ export const submitForm = (options: SubmitFormOptions): Promise<any> => {
|
|
|
119
143
|
name: 'MFormSubmitWrapper',
|
|
120
144
|
setup() {
|
|
121
145
|
const formRef = ref<any>(null);
|
|
146
|
+
// 调试模式下用于展示校验失败信息
|
|
147
|
+
const errorMsg = ref('');
|
|
122
148
|
|
|
149
|
+
const doSubmit = async () => {
|
|
150
|
+
try {
|
|
151
|
+
// 等待子组件(FormItem 等)完成首次渲染,确保 validate 能拿到所有字段
|
|
152
|
+
await nextTick();
|
|
153
|
+
// submitForm 校验通过后会清空 changeRecords,需在调用前先做快照
|
|
154
|
+
const changeRecords: ChangeRecord[] = [...(formRef.value?.changeRecords ?? [])];
|
|
155
|
+
const result = await formRef.value.submitForm(native);
|
|
156
|
+
resolve(returnChangeRecords ? { values: result, changeRecords } : result);
|
|
157
|
+
cleanup();
|
|
158
|
+
} catch (err) {
|
|
159
|
+
// 调试模式下校验失败时保留弹层并展示错误,便于修正后重新提交
|
|
160
|
+
if (debug) {
|
|
161
|
+
errorMsg.value = err instanceof Error ? err.message : String(err);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
reject(err);
|
|
165
|
+
cleanup();
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// 调试模式:可见地渲染表单,点击「确定」才提交,点击「取消」则中断
|
|
170
|
+
if (debug) {
|
|
171
|
+
const handleCancel = () => {
|
|
172
|
+
reject(new Error('submitForm canceled in debug mode.'));
|
|
173
|
+
cleanup();
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const btnBase = {
|
|
177
|
+
padding: '8px 20px',
|
|
178
|
+
fontSize: '14px',
|
|
179
|
+
lineHeight: '1',
|
|
180
|
+
border: '1px solid #dcdfe6',
|
|
181
|
+
borderRadius: '4px',
|
|
182
|
+
cursor: 'pointer',
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
return () =>
|
|
186
|
+
h(
|
|
187
|
+
'div',
|
|
188
|
+
{
|
|
189
|
+
style: {
|
|
190
|
+
position: 'fixed',
|
|
191
|
+
inset: '0',
|
|
192
|
+
zIndex: '10000',
|
|
193
|
+
display: 'flex',
|
|
194
|
+
alignItems: 'center',
|
|
195
|
+
justifyContent: 'center',
|
|
196
|
+
background: 'rgba(0, 0, 0, 0.5)',
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
[
|
|
200
|
+
h(
|
|
201
|
+
'div',
|
|
202
|
+
{
|
|
203
|
+
style: {
|
|
204
|
+
display: 'flex',
|
|
205
|
+
flexDirection: 'column',
|
|
206
|
+
width: '600px',
|
|
207
|
+
maxWidth: '90vw',
|
|
208
|
+
maxHeight: '85vh',
|
|
209
|
+
background: '#fff',
|
|
210
|
+
borderRadius: '8px',
|
|
211
|
+
boxShadow: '0 8px 24px rgba(0, 0, 0, 0.2)',
|
|
212
|
+
overflow: 'hidden',
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
[
|
|
216
|
+
h(
|
|
217
|
+
'div',
|
|
218
|
+
{
|
|
219
|
+
style: {
|
|
220
|
+
padding: '16px 20px',
|
|
221
|
+
fontSize: '16px',
|
|
222
|
+
fontWeight: '600',
|
|
223
|
+
borderBottom: '1px solid #ebeef5',
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
'submitForm 调试',
|
|
227
|
+
),
|
|
228
|
+
h(
|
|
229
|
+
'div',
|
|
230
|
+
{
|
|
231
|
+
style: {
|
|
232
|
+
flex: '1',
|
|
233
|
+
padding: '20px',
|
|
234
|
+
overflow: 'auto',
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
[
|
|
238
|
+
h(Form as Component, { ...formProps, ref: formRef }),
|
|
239
|
+
errorMsg.value
|
|
240
|
+
? h('div', {
|
|
241
|
+
style: {
|
|
242
|
+
marginTop: '12px',
|
|
243
|
+
color: '#f56c6c',
|
|
244
|
+
fontSize: '13px',
|
|
245
|
+
lineHeight: '1.5',
|
|
246
|
+
},
|
|
247
|
+
innerHTML: errorMsg.value,
|
|
248
|
+
})
|
|
249
|
+
: null,
|
|
250
|
+
],
|
|
251
|
+
),
|
|
252
|
+
h(
|
|
253
|
+
'div',
|
|
254
|
+
{
|
|
255
|
+
style: {
|
|
256
|
+
display: 'flex',
|
|
257
|
+
justifyContent: 'flex-end',
|
|
258
|
+
gap: '12px',
|
|
259
|
+
padding: '12px 20px',
|
|
260
|
+
borderTop: '1px solid #ebeef5',
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
[
|
|
264
|
+
h('button', { type: 'button', onClick: handleCancel, style: { ...btnBase } }, '取消'),
|
|
265
|
+
h(
|
|
266
|
+
'button',
|
|
267
|
+
{
|
|
268
|
+
type: 'button',
|
|
269
|
+
onClick: doSubmit,
|
|
270
|
+
style: {
|
|
271
|
+
...btnBase,
|
|
272
|
+
color: '#fff',
|
|
273
|
+
background: '#409eff',
|
|
274
|
+
borderColor: '#409eff',
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
'确定',
|
|
278
|
+
),
|
|
279
|
+
],
|
|
280
|
+
),
|
|
281
|
+
],
|
|
282
|
+
),
|
|
283
|
+
],
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// 普通模式:表单初始化完成后自动提交
|
|
123
288
|
const stop = watch(
|
|
124
289
|
() => formRef.value?.initialized,
|
|
125
|
-
|
|
290
|
+
(initialized) => {
|
|
126
291
|
if (!initialized) return;
|
|
127
292
|
stop();
|
|
128
|
-
|
|
129
|
-
try {
|
|
130
|
-
// 等待子组件(FormItem 等)完成首次渲染,确保 validate 能拿到所有字段
|
|
131
|
-
await nextTick();
|
|
132
|
-
// submitForm 校验通过后会清空 changeRecords,需在调用前先做快照
|
|
133
|
-
const changeRecords: ChangeRecord[] = [...(formRef.value.changeRecords ?? [])];
|
|
134
|
-
const result = await formRef.value.submitForm(native);
|
|
135
|
-
resolve(returnChangeRecords ? { values: result, changeRecords } : result);
|
|
136
|
-
} catch (err) {
|
|
137
|
-
reject(err);
|
|
138
|
-
} finally {
|
|
139
|
-
cleanup();
|
|
140
|
-
}
|
|
293
|
+
doSubmit();
|
|
141
294
|
},
|
|
142
295
|
{ flush: 'post', immediate: true },
|
|
143
296
|
);
|
|
@@ -168,7 +321,8 @@ export const submitForm = (options: SubmitFormOptions): Promise<any> => {
|
|
|
168
321
|
container.parentNode?.removeChild(container);
|
|
169
322
|
};
|
|
170
323
|
|
|
171
|
-
|
|
324
|
+
// 调试模式等待人工操作,不应用超时
|
|
325
|
+
if (timeout > 0 && !debug) {
|
|
172
326
|
timer = setTimeout(() => {
|
|
173
327
|
if (!cleaned) {
|
|
174
328
|
reject(new Error(`submitForm timeout after ${timeout}ms: form is not initialized.`));
|
package/types/index.d.ts
CHANGED
|
@@ -87,6 +87,11 @@ interface SubmitFormOptions {
|
|
|
87
87
|
keyProp?: string;
|
|
88
88
|
popperClass?: string;
|
|
89
89
|
preventSubmitDefault?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* 表单校验失败时,错误提示前缀是否使用字段的 text 文案(通过 `getTextByName` 从 config 中查找)。
|
|
92
|
+
* 默认 `true`,置为 `false` 时直接使用字段 name。
|
|
93
|
+
*/
|
|
94
|
+
useFieldTextInError?: boolean;
|
|
90
95
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
91
96
|
/** 透传给 Form.submitForm 的参数:是否直接返回原始响应式 values */
|
|
92
97
|
native?: boolean;
|
|
@@ -102,6 +107,15 @@ interface SubmitFormOptions {
|
|
|
102
107
|
appContext?: AppContext | null;
|
|
103
108
|
/** 等待表单初始化的最长时间(毫秒),超时将以错误 reject。默认 10000ms */
|
|
104
109
|
timeout?: number;
|
|
110
|
+
/**
|
|
111
|
+
* 调试模式。默认 `false`。
|
|
112
|
+
*
|
|
113
|
+
* - `false`:表单以隐藏方式挂载,初始化完成后自动提交(原有行为)。
|
|
114
|
+
* - `true`:将表单以弹层形式可见地渲染在页面上,需手动点击「确定」才会触发校验/提交,
|
|
115
|
+
* 点击「取消」则以 reject 中断;校验失败时保留弹层并展示错误信息,便于修正后重试。
|
|
116
|
+
* 调试模式下 `timeout` 不生效(等待人工操作)。
|
|
117
|
+
*/
|
|
118
|
+
debug?: boolean;
|
|
105
119
|
}
|
|
106
120
|
/**
|
|
107
121
|
* 开启 `returnChangeRecords` 时 submitForm 的返回结果
|
|
@@ -139,6 +153,13 @@ interface SubmitFormResult {
|
|
|
139
153
|
* initValues: { name: 'foo' },
|
|
140
154
|
* returnChangeRecords: true,
|
|
141
155
|
* });
|
|
156
|
+
*
|
|
157
|
+
* // 调试模式:可见地渲染表单,点击「确定」才提交:
|
|
158
|
+
* const values = await submitForm({
|
|
159
|
+
* config: [...],
|
|
160
|
+
* initValues: { name: 'foo' },
|
|
161
|
+
* debug: true,
|
|
162
|
+
* });
|
|
142
163
|
* ```
|
|
143
164
|
*/
|
|
144
165
|
declare const submitForm: (options: SubmitFormOptions) => Promise<any>;
|
|
@@ -185,6 +206,13 @@ type __VLS_Props$30 = {
|
|
|
185
206
|
keyProp?: string;
|
|
186
207
|
popperClass?: string;
|
|
187
208
|
preventSubmitDefault?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* 表单校验失败时,错误提示前缀是否使用字段的 text 文案(通过 `getTextByName` 从 config 中查找)。
|
|
211
|
+
*
|
|
212
|
+
* - `true`(默认):错误提示形如 `字段文案 -> 错误信息`,找不到 text 时回退为字段 name;
|
|
213
|
+
* - `false`:跳过查找,直接使用字段 name 作为错误提示前缀(形如 `字段name -> 错误信息`)。
|
|
214
|
+
*/
|
|
215
|
+
useFieldTextInError?: boolean;
|
|
188
216
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
189
217
|
/**
|
|
190
218
|
* 自定义"是否展示对比内容"的判断函数(仅在 `isCompare === true` 时生效)。
|
|
@@ -262,6 +290,7 @@ declare const __VLS_base$5: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
262
290
|
keyProp: string;
|
|
263
291
|
parentValues: Record<string, any>;
|
|
264
292
|
stepActive: string | number;
|
|
293
|
+
useFieldTextInError: boolean;
|
|
265
294
|
}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
|
|
266
295
|
declare const __VLS_export$30: __VLS_WithSlots$5<typeof __VLS_base$5, __VLS_Slots$5>;
|
|
267
296
|
declare const _default$12: typeof __VLS_export$30;
|
|
@@ -291,7 +320,8 @@ type __VLS_Props$29 = {
|
|
|
291
320
|
closeOnPressEscape?: boolean;
|
|
292
321
|
destroyOnClose?: boolean;
|
|
293
322
|
showClose?: boolean;
|
|
294
|
-
showCancel?: boolean; /** 透传给内部 `MForm
|
|
323
|
+
showCancel?: boolean; /** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
|
|
324
|
+
useFieldTextInError?: boolean; /** 透传给内部 `MForm`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
|
|
295
325
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
296
326
|
/**
|
|
297
327
|
* 主题名。优先级:传入 `theme` prop > 祖先 `provide(M_THEME_KEY)` > 空串。
|
|
@@ -328,6 +358,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
328
358
|
readonly keyProp?: string | undefined;
|
|
329
359
|
readonly popperClass?: string | undefined;
|
|
330
360
|
readonly preventSubmitDefault?: boolean | undefined;
|
|
361
|
+
readonly useFieldTextInError?: boolean | undefined;
|
|
331
362
|
readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
332
363
|
readonly showDiff?: ((_data: {
|
|
333
364
|
curValue: any;
|
|
@@ -370,6 +401,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
370
401
|
keyProp?: string;
|
|
371
402
|
popperClass?: string;
|
|
372
403
|
preventSubmitDefault?: boolean;
|
|
404
|
+
useFieldTextInError?: boolean;
|
|
373
405
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
374
406
|
showDiff?: (_data: {
|
|
375
407
|
curValue: any;
|
|
@@ -413,6 +445,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
413
445
|
keyProp: string;
|
|
414
446
|
parentValues: Record<string, any>;
|
|
415
447
|
stepActive: string | number;
|
|
448
|
+
useFieldTextInError: boolean;
|
|
416
449
|
}, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
|
|
417
450
|
beforeCreate?: (() => void) | (() => void)[];
|
|
418
451
|
created?: (() => void) | (() => void)[];
|
|
@@ -446,6 +479,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
446
479
|
keyProp: string;
|
|
447
480
|
parentValues: Record<string, any>;
|
|
448
481
|
stepActive: string | number;
|
|
482
|
+
useFieldTextInError: boolean;
|
|
449
483
|
}> & Omit<Readonly<{
|
|
450
484
|
config: schema_d_exports.FormConfig;
|
|
451
485
|
initValues: Record<string, any>;
|
|
@@ -462,6 +496,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
462
496
|
keyProp?: string;
|
|
463
497
|
popperClass?: string;
|
|
464
498
|
preventSubmitDefault?: boolean;
|
|
499
|
+
useFieldTextInError?: boolean;
|
|
465
500
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
466
501
|
showDiff?: (_data: {
|
|
467
502
|
curValue: any;
|
|
@@ -476,7 +511,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
476
511
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
477
512
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
478
513
|
"onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
|
|
479
|
-
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
|
|
514
|
+
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "useFieldTextInError")> & {
|
|
480
515
|
values: schema_d_exports.FormValue;
|
|
481
516
|
lastValuesProcessed: schema_d_exports.FormValue;
|
|
482
517
|
formState: schema_d_exports.FormState;
|
|
@@ -507,6 +542,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
507
542
|
readonly keyProp?: string | undefined;
|
|
508
543
|
readonly popperClass?: string | undefined;
|
|
509
544
|
readonly preventSubmitDefault?: boolean | undefined;
|
|
545
|
+
readonly useFieldTextInError?: boolean | undefined;
|
|
510
546
|
readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
511
547
|
readonly showDiff?: ((_data: {
|
|
512
548
|
curValue: any;
|
|
@@ -549,6 +585,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
549
585
|
keyProp?: string;
|
|
550
586
|
popperClass?: string;
|
|
551
587
|
preventSubmitDefault?: boolean;
|
|
588
|
+
useFieldTextInError?: boolean;
|
|
552
589
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
553
590
|
showDiff?: (_data: {
|
|
554
591
|
curValue: any;
|
|
@@ -592,6 +629,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
592
629
|
keyProp: string;
|
|
593
630
|
parentValues: Record<string, any>;
|
|
594
631
|
stepActive: string | number;
|
|
632
|
+
useFieldTextInError: boolean;
|
|
595
633
|
}, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
|
|
596
634
|
beforeCreate?: (() => void) | (() => void)[];
|
|
597
635
|
created?: (() => void) | (() => void)[];
|
|
@@ -625,6 +663,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
625
663
|
keyProp: string;
|
|
626
664
|
parentValues: Record<string, any>;
|
|
627
665
|
stepActive: string | number;
|
|
666
|
+
useFieldTextInError: boolean;
|
|
628
667
|
}> & Omit<Readonly<{
|
|
629
668
|
config: schema_d_exports.FormConfig;
|
|
630
669
|
initValues: Record<string, any>;
|
|
@@ -641,6 +680,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
641
680
|
keyProp?: string;
|
|
642
681
|
popperClass?: string;
|
|
643
682
|
preventSubmitDefault?: boolean;
|
|
683
|
+
useFieldTextInError?: boolean;
|
|
644
684
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
645
685
|
showDiff?: (_data: {
|
|
646
686
|
curValue: any;
|
|
@@ -655,7 +695,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
655
695
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
656
696
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
657
697
|
"onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
|
|
658
|
-
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
|
|
698
|
+
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "useFieldTextInError")> & {
|
|
659
699
|
values: schema_d_exports.FormValue;
|
|
660
700
|
lastValuesProcessed: schema_d_exports.FormValue;
|
|
661
701
|
formState: schema_d_exports.FormState;
|
|
@@ -691,6 +731,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
691
731
|
destroyOnClose: boolean;
|
|
692
732
|
showClose: boolean;
|
|
693
733
|
config: schema_d_exports.FormConfig;
|
|
734
|
+
useFieldTextInError: boolean;
|
|
694
735
|
confirmText: string;
|
|
695
736
|
showCancel: boolean;
|
|
696
737
|
}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
|
|
@@ -717,7 +758,8 @@ type __VLS_Props$28 = {
|
|
|
717
758
|
confirmText?: string;
|
|
718
759
|
inline?: boolean;
|
|
719
760
|
labelPosition?: string;
|
|
720
|
-
preventSubmitDefault?: boolean; /**
|
|
761
|
+
preventSubmitDefault?: boolean; /** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
|
|
762
|
+
useFieldTextInError?: boolean; /** 关闭前的回调,会暂停 Drawer 的关闭; done 是个 function type 接受一个 boolean 参数, 执行 done 使用 true 参数或不提供参数将会终止关闭 */
|
|
721
763
|
beforeClose?: (_done: (_cancel?: boolean) => void) => void; /** 透传给内部 `MForm`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
|
|
722
764
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
723
765
|
/**
|
|
@@ -755,6 +797,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
755
797
|
readonly keyProp?: string | undefined;
|
|
756
798
|
readonly popperClass?: string | undefined;
|
|
757
799
|
readonly preventSubmitDefault?: boolean | undefined;
|
|
800
|
+
readonly useFieldTextInError?: boolean | undefined;
|
|
758
801
|
readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
759
802
|
readonly showDiff?: ((_data: {
|
|
760
803
|
curValue: any;
|
|
@@ -797,6 +840,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
797
840
|
keyProp?: string;
|
|
798
841
|
popperClass?: string;
|
|
799
842
|
preventSubmitDefault?: boolean;
|
|
843
|
+
useFieldTextInError?: boolean;
|
|
800
844
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
801
845
|
showDiff?: (_data: {
|
|
802
846
|
curValue: any;
|
|
@@ -840,6 +884,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
840
884
|
keyProp: string;
|
|
841
885
|
parentValues: Record<string, any>;
|
|
842
886
|
stepActive: string | number;
|
|
887
|
+
useFieldTextInError: boolean;
|
|
843
888
|
}, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
|
|
844
889
|
beforeCreate?: (() => void) | (() => void)[];
|
|
845
890
|
created?: (() => void) | (() => void)[];
|
|
@@ -873,6 +918,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
873
918
|
keyProp: string;
|
|
874
919
|
parentValues: Record<string, any>;
|
|
875
920
|
stepActive: string | number;
|
|
921
|
+
useFieldTextInError: boolean;
|
|
876
922
|
}> & Omit<Readonly<{
|
|
877
923
|
config: schema_d_exports.FormConfig;
|
|
878
924
|
initValues: Record<string, any>;
|
|
@@ -889,6 +935,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
889
935
|
keyProp?: string;
|
|
890
936
|
popperClass?: string;
|
|
891
937
|
preventSubmitDefault?: boolean;
|
|
938
|
+
useFieldTextInError?: boolean;
|
|
892
939
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
893
940
|
showDiff?: (_data: {
|
|
894
941
|
curValue: any;
|
|
@@ -903,7 +950,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
903
950
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
904
951
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
905
952
|
"onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
|
|
906
|
-
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
|
|
953
|
+
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "useFieldTextInError")> & {
|
|
907
954
|
values: schema_d_exports.FormValue;
|
|
908
955
|
lastValuesProcessed: schema_d_exports.FormValue;
|
|
909
956
|
formState: schema_d_exports.FormState;
|
|
@@ -934,6 +981,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
934
981
|
readonly keyProp?: string | undefined;
|
|
935
982
|
readonly popperClass?: string | undefined;
|
|
936
983
|
readonly preventSubmitDefault?: boolean | undefined;
|
|
984
|
+
readonly useFieldTextInError?: boolean | undefined;
|
|
937
985
|
readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
938
986
|
readonly showDiff?: ((_data: {
|
|
939
987
|
curValue: any;
|
|
@@ -976,6 +1024,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
976
1024
|
keyProp?: string;
|
|
977
1025
|
popperClass?: string;
|
|
978
1026
|
preventSubmitDefault?: boolean;
|
|
1027
|
+
useFieldTextInError?: boolean;
|
|
979
1028
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
980
1029
|
showDiff?: (_data: {
|
|
981
1030
|
curValue: any;
|
|
@@ -1019,6 +1068,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1019
1068
|
keyProp: string;
|
|
1020
1069
|
parentValues: Record<string, any>;
|
|
1021
1070
|
stepActive: string | number;
|
|
1071
|
+
useFieldTextInError: boolean;
|
|
1022
1072
|
}, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
|
|
1023
1073
|
beforeCreate?: (() => void) | (() => void)[];
|
|
1024
1074
|
created?: (() => void) | (() => void)[];
|
|
@@ -1052,6 +1102,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1052
1102
|
keyProp: string;
|
|
1053
1103
|
parentValues: Record<string, any>;
|
|
1054
1104
|
stepActive: string | number;
|
|
1105
|
+
useFieldTextInError: boolean;
|
|
1055
1106
|
}> & Omit<Readonly<{
|
|
1056
1107
|
config: schema_d_exports.FormConfig;
|
|
1057
1108
|
initValues: Record<string, any>;
|
|
@@ -1068,6 +1119,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1068
1119
|
keyProp?: string;
|
|
1069
1120
|
popperClass?: string;
|
|
1070
1121
|
preventSubmitDefault?: boolean;
|
|
1122
|
+
useFieldTextInError?: boolean;
|
|
1071
1123
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
1072
1124
|
showDiff?: (_data: {
|
|
1073
1125
|
curValue: any;
|
|
@@ -1082,7 +1134,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1082
1134
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
1083
1135
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
1084
1136
|
"onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
|
|
1085
|
-
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
|
|
1137
|
+
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "useFieldTextInError")> & {
|
|
1086
1138
|
values: schema_d_exports.FormValue;
|
|
1087
1139
|
lastValuesProcessed: schema_d_exports.FormValue;
|
|
1088
1140
|
formState: schema_d_exports.FormState;
|
|
@@ -1123,6 +1175,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1123
1175
|
values: Object;
|
|
1124
1176
|
closeOnPressEscape: boolean;
|
|
1125
1177
|
config: schema_d_exports.FormConfig;
|
|
1178
|
+
useFieldTextInError: boolean;
|
|
1126
1179
|
confirmText: string;
|
|
1127
1180
|
}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
|
|
1128
1181
|
declare const __VLS_export$28: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
|
|
@@ -1146,7 +1199,8 @@ type __VLS_Props$27 = {
|
|
|
1146
1199
|
confirmText?: string;
|
|
1147
1200
|
inline?: boolean;
|
|
1148
1201
|
labelPosition?: string;
|
|
1149
|
-
preventSubmitDefault?: boolean;
|
|
1202
|
+
preventSubmitDefault?: boolean; /** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
|
|
1203
|
+
useFieldTextInError?: boolean;
|
|
1150
1204
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
1151
1205
|
};
|
|
1152
1206
|
declare var __VLS_16$1: {}, __VLS_18$1: {}, __VLS_20: {};
|
|
@@ -1177,6 +1231,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1177
1231
|
readonly keyProp?: string | undefined;
|
|
1178
1232
|
readonly popperClass?: string | undefined;
|
|
1179
1233
|
readonly preventSubmitDefault?: boolean | undefined;
|
|
1234
|
+
readonly useFieldTextInError?: boolean | undefined;
|
|
1180
1235
|
readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
1181
1236
|
readonly showDiff?: ((_data: {
|
|
1182
1237
|
curValue: any;
|
|
@@ -1219,6 +1274,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1219
1274
|
keyProp?: string;
|
|
1220
1275
|
popperClass?: string;
|
|
1221
1276
|
preventSubmitDefault?: boolean;
|
|
1277
|
+
useFieldTextInError?: boolean;
|
|
1222
1278
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
1223
1279
|
showDiff?: (_data: {
|
|
1224
1280
|
curValue: any;
|
|
@@ -1262,6 +1318,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1262
1318
|
keyProp: string;
|
|
1263
1319
|
parentValues: Record<string, any>;
|
|
1264
1320
|
stepActive: string | number;
|
|
1321
|
+
useFieldTextInError: boolean;
|
|
1265
1322
|
}, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
|
|
1266
1323
|
beforeCreate?: (() => void) | (() => void)[];
|
|
1267
1324
|
created?: (() => void) | (() => void)[];
|
|
@@ -1295,6 +1352,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1295
1352
|
keyProp: string;
|
|
1296
1353
|
parentValues: Record<string, any>;
|
|
1297
1354
|
stepActive: string | number;
|
|
1355
|
+
useFieldTextInError: boolean;
|
|
1298
1356
|
}> & Omit<Readonly<{
|
|
1299
1357
|
config: schema_d_exports.FormConfig;
|
|
1300
1358
|
initValues: Record<string, any>;
|
|
@@ -1311,6 +1369,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1311
1369
|
keyProp?: string;
|
|
1312
1370
|
popperClass?: string;
|
|
1313
1371
|
preventSubmitDefault?: boolean;
|
|
1372
|
+
useFieldTextInError?: boolean;
|
|
1314
1373
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
1315
1374
|
showDiff?: (_data: {
|
|
1316
1375
|
curValue: any;
|
|
@@ -1325,7 +1384,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1325
1384
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
1326
1385
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
1327
1386
|
"onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
|
|
1328
|
-
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
|
|
1387
|
+
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "useFieldTextInError")> & {
|
|
1329
1388
|
values: schema_d_exports.FormValue;
|
|
1330
1389
|
lastValuesProcessed: schema_d_exports.FormValue;
|
|
1331
1390
|
formState: schema_d_exports.FormState;
|
|
@@ -1356,6 +1415,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1356
1415
|
readonly keyProp?: string | undefined;
|
|
1357
1416
|
readonly popperClass?: string | undefined;
|
|
1358
1417
|
readonly preventSubmitDefault?: boolean | undefined;
|
|
1418
|
+
readonly useFieldTextInError?: boolean | undefined;
|
|
1359
1419
|
readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
1360
1420
|
readonly showDiff?: ((_data: {
|
|
1361
1421
|
curValue: any;
|
|
@@ -1398,6 +1458,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1398
1458
|
keyProp?: string;
|
|
1399
1459
|
popperClass?: string;
|
|
1400
1460
|
preventSubmitDefault?: boolean;
|
|
1461
|
+
useFieldTextInError?: boolean;
|
|
1401
1462
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
1402
1463
|
showDiff?: (_data: {
|
|
1403
1464
|
curValue: any;
|
|
@@ -1441,6 +1502,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1441
1502
|
keyProp: string;
|
|
1442
1503
|
parentValues: Record<string, any>;
|
|
1443
1504
|
stepActive: string | number;
|
|
1505
|
+
useFieldTextInError: boolean;
|
|
1444
1506
|
}, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
|
|
1445
1507
|
beforeCreate?: (() => void) | (() => void)[];
|
|
1446
1508
|
created?: (() => void) | (() => void)[];
|
|
@@ -1474,6 +1536,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1474
1536
|
keyProp: string;
|
|
1475
1537
|
parentValues: Record<string, any>;
|
|
1476
1538
|
stepActive: string | number;
|
|
1539
|
+
useFieldTextInError: boolean;
|
|
1477
1540
|
}> & Omit<Readonly<{
|
|
1478
1541
|
config: schema_d_exports.FormConfig;
|
|
1479
1542
|
initValues: Record<string, any>;
|
|
@@ -1490,6 +1553,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1490
1553
|
keyProp?: string;
|
|
1491
1554
|
popperClass?: string;
|
|
1492
1555
|
preventSubmitDefault?: boolean;
|
|
1556
|
+
useFieldTextInError?: boolean;
|
|
1493
1557
|
extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
1494
1558
|
showDiff?: (_data: {
|
|
1495
1559
|
curValue: any;
|
|
@@ -1504,7 +1568,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1504
1568
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
1505
1569
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
1506
1570
|
"onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
|
|
1507
|
-
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
|
|
1571
|
+
}>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "useFieldTextInError")> & {
|
|
1508
1572
|
values: schema_d_exports.FormValue;
|
|
1509
1573
|
lastValuesProcessed: schema_d_exports.FormValue;
|
|
1510
1574
|
formState: schema_d_exports.FormState;
|
|
@@ -1531,6 +1595,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
|
|
|
1531
1595
|
}>, {
|
|
1532
1596
|
values: Object;
|
|
1533
1597
|
config: schema_d_exports.FormConfig;
|
|
1598
|
+
useFieldTextInError: boolean;
|
|
1534
1599
|
confirmText: string;
|
|
1535
1600
|
}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
|
|
1536
1601
|
declare const __VLS_export$27: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
|