@tmagic/form 1.8.0-manmanyu.13 → 1.8.0-manmanyu.15

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.
@@ -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)]),
@@ -1,15 +1,15 @@
1
+ import { isGlobalFlat } from "../../utils/config.js";
1
2
  import { display, getDataByPage, sortArray } from "../../utils/form.js";
2
3
  import Container_default from "../Container.js";
3
4
  import ActionsColumn_default from "./ActionsColumn.js";
4
5
  import SortColumn_default from "./SortColumn.js";
5
6
  import { computed, h, inject } from "vue";
6
7
  import { cloneDeep } from "lodash-es";
7
- import { TMagicIcon, TMagicTooltip, isMagicAdminTheme } from "@tmagic/design";
8
+ import { TMagicIcon, TMagicTooltip } from "@tmagic/design";
8
9
  import { WarningFilled } from "@element-plus/icons-vue";
9
10
  //#region packages/form/src/containers/table/useTableColumns.ts
10
11
  var useTableColumns = (props, emit, currentPage, pageSize, modelName) => {
11
12
  const mForm = inject("mForm");
12
- const isMagicAdmin = isMagicAdminTheme();
13
13
  const display$1 = (fuc) => display(mForm, fuc, props);
14
14
  const lastData = computed(() => props.config.pagination ? getDataByPage(props.lastValues[modelName.value], currentPage.value, pageSize.value) : props.lastValues[modelName.value] || []);
15
15
  const itemExtra = (fuc, index) => {
@@ -67,10 +67,10 @@ var useTableColumns = (props, emit, currentPage, pageSize, modelName) => {
67
67
  type: "selection",
68
68
  width: 45
69
69
  } });
70
- const defaultFixed = isMagicAdmin.value ? "right" : "left";
70
+ const defaultFixed = isGlobalFlat.value ? "right" : "left";
71
71
  let actionFixed = props.config.fixed === false ? void 0 : defaultFixed;
72
72
  if (typeof props.config.fixed === "string" && ["left", "right"].includes(props.config.fixed)) actionFixed = props.config.fixed;
73
- const actionFlat = props.config.flat === void 0 && isMagicAdmin.value ? true : props.config.flat;
73
+ const actionFlat = props.config.flat === void 0 && isGlobalFlat.value ? true : props.config.flat;
74
74
  const actionColumn = {
75
75
  props: {
76
76
  label: "操作",
@@ -1,7 +1,8 @@
1
1
  import { useAddField } from "../utils/useAddField.js";
2
+ import { isGlobalFlat } from "../utils/config.js";
2
3
  import FormDialog_default from "../FormDialog.js";
3
4
  import { computed, createElementBlock, createTextVNode, createVNode, defineComponent, inject, normalizeStyle, openBlock, readonly, ref, toDisplayString, unref, withCtx } from "vue";
4
- import { TMagicButton, TMagicIcon, isMagicAdminTheme } from "@tmagic/design";
5
+ import { TMagicButton, TMagicIcon } from "@tmagic/design";
5
6
  import { Notebook } from "@element-plus/icons-vue";
6
7
  //#region packages/form/src/fields/Link.vue?vue&type=script&setup=true&lang.ts
7
8
  var _hoisted_1 = ["href"];
@@ -33,7 +34,6 @@ var Link_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
33
34
  setup(__props, { emit: __emit }) {
34
35
  const props = __props;
35
36
  const emit = __emit;
36
- const isMagicAdmin = isMagicAdminTheme(props);
37
37
  useAddField(props.prop);
38
38
  const formValue = ref({});
39
39
  const editor = ref();
@@ -71,7 +71,7 @@ var Link_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
71
71
  editor.value && (editor.value.dialogVisible = false);
72
72
  };
73
73
  return (_ctx, _cache) => {
74
- return unref(isMagicAdmin) && __props.config.href && !__props.disabled ? (openBlock(), createElementBlock("a", {
74
+ return unref(isGlobalFlat) && __props.config.href && !__props.disabled ? (openBlock(), createElementBlock("a", {
75
75
  key: 0,
76
76
  target: "_blank",
77
77
  href: href.value,
@@ -1,6 +1,7 @@
1
1
  import { useAddField } from "../utils/useAddField.js";
2
+ import { isGlobalFlat } from "../utils/config.js";
2
3
  import { createBlock, createCommentVNode, defineComponent, inject, openBlock, ref, unref, watch } from "vue";
3
- import { TMagicInputNumber, isMagicAdminTheme } from "@tmagic/design";
4
+ import { TMagicInputNumber } from "@tmagic/design";
4
5
  //#region packages/form/src/fields/Number.vue?vue&type=script&setup=true&lang.ts
5
6
  var Number_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
6
7
  name: "MFormNumber",
@@ -24,7 +25,6 @@ var Number_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
24
25
  setup(__props, { emit: __emit }) {
25
26
  const props = __props;
26
27
  const emit = __emit;
27
- const isMagicAdmin = isMagicAdminTheme();
28
28
  const value = ref();
29
29
  watch(() => props.model[props.name], (v) => {
30
30
  value.value = v;
@@ -44,7 +44,7 @@ var Number_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
44
44
  modelValue: value.value,
45
45
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
46
46
  clearable: "",
47
- "controls-position": unref(isMagicAdmin) ? "" : "right",
47
+ "controls-position": unref(isGlobalFlat) ? "" : "right",
48
48
  size: __props.size,
49
49
  max: __props.config.max,
50
50
  min: __props.config.min,
@@ -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 stop = watch(() => formRef.value?.initialized, async (initialized) => {
46
- if (!initialized) return;
47
- stop();
52
+ const errorMsg = ref("");
53
+ const doSubmit = async () => {
48
54
  try {
49
55
  await nextTick();
50
- const changeRecords = [...formRef.value.changeRecords ?? []];
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();
@@ -1,7 +1,10 @@
1
+ import { ref } from "vue";
1
2
  //#region packages/form/src/utils/config.ts
2
3
  var $MAGIC_FORM = {};
4
+ var isGlobalFlat = ref(false);
3
5
  var setConfig = (option) => {
4
6
  $MAGIC_FORM = option;
7
+ isGlobalFlat.value = option.flat ?? false;
5
8
  };
6
9
  var getConfig = (key) => $MAGIC_FORM[key];
7
10
  var fieldRegistry = /* @__PURE__ */ new Map();
@@ -12,4 +15,4 @@ var registerField = (tagName, component) => {
12
15
  var getField = (tagName) => fieldRegistry.get(tagName);
13
16
  var deleteField = (tagName) => fieldRegistry.delete(tagName);
14
17
  //#endregion
15
- export { deleteField, getConfig, getField, registerField, setConfig };
18
+ export { deleteField, getConfig, getField, isGlobalFlat, registerField, setConfig };
@@ -2654,8 +2654,10 @@
2654
2654
  //#endregion
2655
2655
  //#region packages/form/src/utils/config.ts
2656
2656
  var $MAGIC_FORM = {};
2657
+ var isGlobalFlat = (0, vue.ref)(false);
2657
2658
  var setConfig = (option) => {
2658
2659
  $MAGIC_FORM = option;
2660
+ isGlobalFlat.value = option.flat ?? false;
2659
2661
  };
2660
2662
  var getConfig = (key) => $MAGIC_FORM[key];
2661
2663
  var fieldRegistry = /* @__PURE__ */ new Map();
@@ -3465,6 +3467,10 @@
3465
3467
  keyProp: { default: "__key" },
3466
3468
  popperClass: {},
3467
3469
  preventSubmitDefault: { type: Boolean },
3470
+ useFieldTextInError: {
3471
+ type: Boolean,
3472
+ default: true
3473
+ },
3468
3474
  extendState: {},
3469
3475
  showDiff: {},
3470
3476
  selfDiffFieldTypes: {},
@@ -3709,7 +3715,7 @@
3709
3715
  Object.entries(invalidFields).forEach(([prop, ValidateError]) => {
3710
3716
  ValidateError.forEach(({ field, message }) => {
3711
3717
  const name = field || prop;
3712
- const text = getTextByName(name, props.config) || name;
3718
+ const text = (props.useFieldTextInError ? getTextByName(name, props.config) : void 0) || name;
3713
3719
  error.push(`${text} -> ${message}`);
3714
3720
  });
3715
3721
  });
@@ -3801,13 +3807,20 @@
3801
3807
  * initValues: { name: 'foo' },
3802
3808
  * returnChangeRecords: true,
3803
3809
  * });
3810
+ *
3811
+ * // 调试模式:可见地渲染表单,点击「确定」才提交:
3812
+ * const values = await submitForm({
3813
+ * config: [...],
3814
+ * initValues: { name: 'foo' },
3815
+ * debug: true,
3816
+ * });
3804
3817
  * ```
3805
3818
  */
3806
3819
  var submitForm = (options) => {
3807
- const { native, appContext, timeout = 1e4, returnChangeRecords, ...formProps } = options;
3820
+ const { native, appContext, timeout = 1e4, returnChangeRecords, debug = false, ...formProps } = options;
3808
3821
  return new Promise((resolve, reject) => {
3809
3822
  const container = document.createElement("div");
3810
- container.style.display = "none";
3823
+ if (!debug) container.style.display = "none";
3811
3824
  document.body.appendChild(container);
3812
3825
  let cleaned = false;
3813
3826
  let timer = null;
@@ -3815,22 +3828,106 @@
3815
3828
  name: "MFormSubmitWrapper",
3816
3829
  setup() {
3817
3830
  const formRef = (0, vue.ref)(null);
3818
- const stop = (0, vue.watch)(() => formRef.value?.initialized, async (initialized) => {
3819
- if (!initialized) return;
3820
- stop();
3831
+ const errorMsg = (0, vue.ref)("");
3832
+ const doSubmit = async () => {
3821
3833
  try {
3822
3834
  await (0, vue.nextTick)();
3823
- const changeRecords = [...formRef.value.changeRecords ?? []];
3835
+ const changeRecords = [...formRef.value?.changeRecords ?? []];
3824
3836
  const result = await formRef.value.submitForm(native);
3825
3837
  resolve(returnChangeRecords ? {
3826
3838
  values: result,
3827
3839
  changeRecords
3828
3840
  } : result);
3841
+ cleanup();
3829
3842
  } catch (err) {
3843
+ if (debug) {
3844
+ errorMsg.value = err instanceof Error ? err.message : String(err);
3845
+ return;
3846
+ }
3830
3847
  reject(err);
3831
- } finally {
3832
3848
  cleanup();
3833
3849
  }
3850
+ };
3851
+ if (debug) {
3852
+ const handleCancel = () => {
3853
+ reject(/* @__PURE__ */ new Error("submitForm canceled in debug mode."));
3854
+ cleanup();
3855
+ };
3856
+ const btnBase = {
3857
+ padding: "8px 20px",
3858
+ fontSize: "14px",
3859
+ lineHeight: "1",
3860
+ border: "1px solid #dcdfe6",
3861
+ borderRadius: "4px",
3862
+ cursor: "pointer"
3863
+ };
3864
+ return () => (0, vue.h)("div", { style: {
3865
+ position: "fixed",
3866
+ inset: "0",
3867
+ zIndex: "10000",
3868
+ display: "flex",
3869
+ alignItems: "center",
3870
+ justifyContent: "center",
3871
+ background: "rgba(0, 0, 0, 0.5)"
3872
+ } }, [(0, vue.h)("div", { style: {
3873
+ display: "flex",
3874
+ flexDirection: "column",
3875
+ width: "600px",
3876
+ maxWidth: "90vw",
3877
+ maxHeight: "85vh",
3878
+ background: "#fff",
3879
+ borderRadius: "8px",
3880
+ boxShadow: "0 8px 24px rgba(0, 0, 0, 0.2)",
3881
+ overflow: "hidden"
3882
+ } }, [
3883
+ (0, vue.h)("div", { style: {
3884
+ padding: "16px 20px",
3885
+ fontSize: "16px",
3886
+ fontWeight: "600",
3887
+ borderBottom: "1px solid #ebeef5"
3888
+ } }, "submitForm 调试"),
3889
+ (0, vue.h)("div", { style: {
3890
+ flex: "1",
3891
+ padding: "20px",
3892
+ overflow: "auto"
3893
+ } }, [(0, vue.h)(Form_default, {
3894
+ ...formProps,
3895
+ ref: formRef
3896
+ }), errorMsg.value ? (0, vue.h)("div", {
3897
+ style: {
3898
+ marginTop: "12px",
3899
+ color: "#f56c6c",
3900
+ fontSize: "13px",
3901
+ lineHeight: "1.5"
3902
+ },
3903
+ innerHTML: errorMsg.value
3904
+ }) : null]),
3905
+ (0, vue.h)("div", { style: {
3906
+ display: "flex",
3907
+ justifyContent: "flex-end",
3908
+ gap: "12px",
3909
+ padding: "12px 20px",
3910
+ borderTop: "1px solid #ebeef5"
3911
+ } }, [(0, vue.h)("button", {
3912
+ type: "button",
3913
+ onClick: handleCancel,
3914
+ style: { ...btnBase }
3915
+ }, "取消"), (0, vue.h)("button", {
3916
+ type: "button",
3917
+ onClick: doSubmit,
3918
+ style: {
3919
+ ...btnBase,
3920
+ color: "#fff",
3921
+ background: "#409eff",
3922
+ borderColor: "#409eff"
3923
+ }
3924
+ }, "确定")])
3925
+ ])]);
3926
+ }
3927
+ const stop = (0, vue.watch)(() => formRef.value?.initialized, (initialized) => {
3928
+ if (!initialized) return;
3929
+ stop();
3930
+ doSubmit();
3834
3931
  }, {
3835
3932
  flush: "post",
3836
3933
  immediate: true
@@ -3854,7 +3951,7 @@
3854
3951
  } catch {}
3855
3952
  container.parentNode?.removeChild(container);
3856
3953
  };
3857
- if (timeout > 0) timer = setTimeout(() => {
3954
+ if (timeout > 0 && !debug) timer = setTimeout(() => {
3858
3955
  if (!cleaned) {
3859
3956
  reject(/* @__PURE__ */ new Error(`submitForm timeout after ${timeout}ms: form is not initialized.`));
3860
3957
  cleanup();
@@ -3911,6 +4008,10 @@
3911
4008
  type: Boolean,
3912
4009
  default: true
3913
4010
  },
4011
+ useFieldTextInError: {
4012
+ type: Boolean,
4013
+ default: true
4014
+ },
3914
4015
  extendState: {},
3915
4016
  theme: {}
3916
4017
  },
@@ -4065,6 +4166,7 @@
4065
4166
  "label-position": __props.labelPosition,
4066
4167
  inline: __props.inline,
4067
4168
  "prevent-submit-default": __props.preventSubmitDefault,
4169
+ "use-field-text-in-error": __props.useFieldTextInError,
4068
4170
  "extend-state": __props.extendState,
4069
4171
  theme: effectiveTheme.value,
4070
4172
  onChange: changeHandler
@@ -4079,6 +4181,7 @@
4079
4181
  "label-position",
4080
4182
  "inline",
4081
4183
  "prevent-submit-default",
4184
+ "use-field-text-in-error",
4082
4185
  "extend-state",
4083
4186
  "theme"
4084
4187
  ]), (0, vue.renderSlot)(_ctx.$slots, "default")], 4)) : (0, vue.createCommentVNode)("v-if", true)]),
@@ -4124,6 +4227,10 @@
4124
4227
  inline: { type: Boolean },
4125
4228
  labelPosition: {},
4126
4229
  preventSubmitDefault: { type: Boolean },
4230
+ useFieldTextInError: {
4231
+ type: Boolean,
4232
+ default: true
4233
+ },
4127
4234
  beforeClose: {},
4128
4235
  extendState: {},
4129
4236
  theme: {}
@@ -4271,6 +4378,7 @@
4271
4378
  "label-position": __props.labelPosition,
4272
4379
  inline: __props.inline,
4273
4380
  "prevent-submit-default": __props.preventSubmitDefault,
4381
+ "use-field-text-in-error": __props.useFieldTextInError,
4274
4382
  "extend-state": __props.extendState,
4275
4383
  theme: effectiveTheme.value,
4276
4384
  onChange: changeHandler
@@ -4284,6 +4392,7 @@
4284
4392
  "label-position",
4285
4393
  "inline",
4286
4394
  "prevent-submit-default",
4395
+ "use-field-text-in-error",
4287
4396
  "extend-state",
4288
4397
  "theme"
4289
4398
  ]), (0, vue.renderSlot)(_ctx.$slots, "default")], 512)) : (0, vue.createCommentVNode)("v-if", true)]),
@@ -4321,6 +4430,10 @@
4321
4430
  inline: { type: Boolean },
4322
4431
  labelPosition: {},
4323
4432
  preventSubmitDefault: { type: Boolean },
4433
+ useFieldTextInError: {
4434
+ type: Boolean,
4435
+ default: true
4436
+ },
4324
4437
  extendState: {}
4325
4438
  },
4326
4439
  emits: [
@@ -4383,6 +4496,7 @@
4383
4496
  "label-position": __props.labelPosition,
4384
4497
  inline: __props.inline,
4385
4498
  "prevent-submit-default": __props.preventSubmitDefault,
4499
+ "use-field-text-in-error": __props.useFieldTextInError,
4386
4500
  "extend-state": __props.extendState,
4387
4501
  onChange: changeHandler
4388
4502
  }, null, 8, [
@@ -4395,6 +4509,7 @@
4395
4509
  "label-position",
4396
4510
  "inline",
4397
4511
  "prevent-submit-default",
4512
+ "use-field-text-in-error",
4398
4513
  "extend-state"
4399
4514
  ]), (0, vue.renderSlot)(_ctx.$slots, "default")]),
4400
4515
  _: 3
@@ -5741,7 +5856,6 @@
5741
5856
  //#region packages/form/src/containers/table/useTableColumns.ts
5742
5857
  var useTableColumns = (props, emit, currentPage, pageSize, modelName) => {
5743
5858
  const mForm = (0, vue.inject)("mForm");
5744
- const isMagicAdmin = (0, _tmagic_design.isMagicAdminTheme)();
5745
5859
  const display$1 = (fuc) => display(mForm, fuc, props);
5746
5860
  const lastData = (0, vue.computed)(() => props.config.pagination ? getDataByPage(props.lastValues[modelName.value], currentPage.value, pageSize.value) : props.lastValues[modelName.value] || []);
5747
5861
  const itemExtra = (fuc, index) => {
@@ -5799,10 +5913,10 @@
5799
5913
  type: "selection",
5800
5914
  width: 45
5801
5915
  } });
5802
- const defaultFixed = isMagicAdmin.value ? "right" : "left";
5916
+ const defaultFixed = isGlobalFlat.value ? "right" : "left";
5803
5917
  let actionFixed = props.config.fixed === false ? void 0 : defaultFixed;
5804
5918
  if (typeof props.config.fixed === "string" && ["left", "right"].includes(props.config.fixed)) actionFixed = props.config.fixed;
5805
- const actionFlat = props.config.flat === void 0 && isMagicAdmin.value ? true : props.config.flat;
5919
+ const actionFlat = props.config.flat === void 0 && isGlobalFlat.value ? true : props.config.flat;
5806
5920
  const actionColumn = {
5807
5921
  props: {
5808
5922
  label: "操作",
@@ -6563,7 +6677,6 @@
6563
6677
  setup(__props, { emit: __emit }) {
6564
6678
  const props = __props;
6565
6679
  const emit = __emit;
6566
- const isMagicAdmin = (0, _tmagic_design.isMagicAdminTheme)();
6567
6680
  const value = (0, vue.ref)();
6568
6681
  (0, vue.watch)(() => props.model[props.name], (v) => {
6569
6682
  value.value = v;
@@ -6583,7 +6696,7 @@
6583
6696
  modelValue: value.value,
6584
6697
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
6585
6698
  clearable: "",
6586
- "controls-position": (0, vue.unref)(isMagicAdmin) ? "" : "right",
6699
+ "controls-position": (0, vue.unref)(isGlobalFlat) ? "" : "right",
6587
6700
  size: __props.size,
6588
6701
  max: __props.config.max,
6589
6702
  min: __props.config.min,
@@ -7459,7 +7572,6 @@
7459
7572
  setup(__props, { emit: __emit }) {
7460
7573
  const props = __props;
7461
7574
  const emit = __emit;
7462
- const isMagicAdmin = (0, _tmagic_design.isMagicAdminTheme)(props);
7463
7575
  useAddField(props.prop);
7464
7576
  const formValue = (0, vue.ref)({});
7465
7577
  const editor = (0, vue.ref)();
@@ -7497,7 +7609,7 @@
7497
7609
  editor.value && (editor.value.dialogVisible = false);
7498
7610
  };
7499
7611
  return (_ctx, _cache) => {
7500
- return (0, vue.unref)(isMagicAdmin) && __props.config.href && !__props.disabled ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
7612
+ return (0, vue.unref)(isGlobalFlat) && __props.config.href && !__props.disabled ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
7501
7613
  key: 0,
7502
7614
  target: "_blank",
7503
7615
  href: href.value,
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.8.0-manmanyu.13",
2
+ "version": "1.8.0-manmanyu.15",
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/form-schema": "1.8.0-manmanyu.13",
56
- "@tmagic/utils": "1.8.0-manmanyu.13",
57
- "@tmagic/design": "1.8.0-manmanyu.13"
55
+ "@tmagic/utils": "1.8.0-manmanyu.15",
56
+ "@tmagic/form-schema": "1.8.0-manmanyu.15",
57
+ "@tmagic/design": "1.8.0-manmanyu.15"
58
58
  },
59
59
  "peerDependenciesMeta": {
60
60
  "typescript": {
@@ -2,10 +2,11 @@ import { computed, h, inject, type Ref } from 'vue';
2
2
  import { WarningFilled } from '@element-plus/icons-vue';
3
3
  import { cloneDeep } from 'lodash-es';
4
4
 
5
- import { isMagicAdminTheme, type TableColumnOptions, TMagicIcon, TMagicTooltip } from '@tmagic/design';
5
+ import { type TableColumnOptions, TMagicIcon, TMagicTooltip } from '@tmagic/design';
6
6
  import type { FormItemConfig, FormState, TableColumnConfig } from '@tmagic/form-schema';
7
7
 
8
8
  import type { ContainerChangeEventData } from '../../schema';
9
+ import { isGlobalFlat } from '../../utils/config';
9
10
  import { display as displayFunc, getDataByPage, sortArray } from '../../utils/form';
10
11
  import Container from '../Container.vue';
11
12
 
@@ -21,9 +22,6 @@ export const useTableColumns = (
21
22
  modelName: Ref<string | number>,
22
23
  ) => {
23
24
  const mForm = inject<FormState | undefined>('mForm');
24
- // magic-admin 主题下「操作列」默认固定在右侧;其它主题保持原默认「左侧」。
25
- // 调用方仍可通过 `config.fixed`('left' | 'right' | false)显式覆盖。
26
- const isMagicAdmin = isMagicAdminTheme();
27
25
 
28
26
  const display = (fuc: any) => displayFunc(mForm, fuc, props);
29
27
 
@@ -114,13 +112,13 @@ export const useTableColumns = (
114
112
  },
115
113
  });
116
114
  }
117
- const defaultFixed: 'left' | 'right' = isMagicAdmin.value ? 'right' : 'left';
115
+ const defaultFixed: 'left' | 'right' = isGlobalFlat.value ? 'right' : 'left';
118
116
  let actionFixed: 'left' | 'right' | undefined = props.config.fixed === false ? undefined : defaultFixed;
119
117
  if (typeof props.config.fixed === 'string' && ['left', 'right'].includes(props.config.fixed)) {
120
118
  actionFixed = props.config.fixed;
121
119
  }
122
120
 
123
- const actionFlat = props.config.flat === undefined && isMagicAdmin.value ? true : props.config.flat;
121
+ const actionFlat = props.config.flat === undefined && isGlobalFlat.value ? true : props.config.flat;
124
122
 
125
123
  const actionColumn = {
126
124
  props: {
@@ -2,7 +2,7 @@
2
2
  <a
3
3
  target="_blank"
4
4
  :href="href"
5
- v-if="isMagicAdmin && config.href && !disabled"
5
+ v-if="isGlobalFlat && config.href && !disabled"
6
6
  class="magic-admin-link"
7
7
  :style="config.css || {}"
8
8
  >
@@ -31,10 +31,11 @@
31
31
  import { computed, inject, readonly, ref } from 'vue';
32
32
  import { Notebook } from '@element-plus/icons-vue';
33
33
 
34
- import { isMagicAdminTheme, TMagicButton, TMagicIcon } from '@tmagic/design';
34
+ import { TMagicButton, TMagicIcon } from '@tmagic/design';
35
35
 
36
36
  import FormDialog from '../FormDialog.vue';
37
37
  import type { FieldProps, FormState, LinkConfig } from '../schema';
38
+ import { isGlobalFlat } from '../utils/config';
38
39
  import { useAddField } from '../utils/useAddField';
39
40
 
40
41
  defineOptions({
@@ -45,8 +46,6 @@ const props = defineProps<FieldProps<LinkConfig> & { theme?: string }>();
45
46
 
46
47
  const emit = defineEmits(['change']);
47
48
 
48
- const isMagicAdmin = isMagicAdminTheme(props);
49
-
50
49
  useAddField(props.prop);
51
50
 
52
51
  const formValue = ref({});
@@ -3,7 +3,7 @@
3
3
  v-if="model"
4
4
  v-model="value"
5
5
  clearable
6
- :controls-position="isMagicAdmin ? '' : 'right'"
6
+ :controls-position="isGlobalFlat ? '' : 'right'"
7
7
  :size="size"
8
8
  :max="config.max"
9
9
  :min="config.min"
@@ -18,9 +18,10 @@
18
18
  <script lang="ts" setup>
19
19
  import { inject, ref, watch } from 'vue';
20
20
 
21
- import { isMagicAdminTheme, TMagicInputNumber } from '@tmagic/design';
21
+ import { TMagicInputNumber } from '@tmagic/design';
22
22
 
23
23
  import type { FieldProps, FormState, NumberConfig } from '../schema';
24
+ import { isGlobalFlat } from '../utils/config';
24
25
  import { useAddField } from '../utils/useAddField';
25
26
 
26
27
  defineOptions({
@@ -34,9 +35,6 @@ const emit = defineEmits<{
34
35
  input: [values: number];
35
36
  }>();
36
37
 
37
- // magic-admin 主题下输入框走"无右侧上下箭头"的极简样式(控件位置置空回到 ElInputNumber 默认两侧布局)
38
- const isMagicAdmin = isMagicAdminTheme();
39
-
40
38
  const value = ref<number>();
41
39
 
42
40
  watch(
package/src/plugin.ts CHANGED
@@ -54,6 +54,7 @@ import FormDrawer from './FormDrawer.vue';
54
54
  import './theme/index.scss';
55
55
 
56
56
  export interface FormInstallOptions {
57
+ flat?: boolean;
57
58
  [key: string]: any;
58
59
  }
59
60
 
@@ -17,11 +17,17 @@
17
17
  */
18
18
 
19
19
  import type { Component } from 'vue';
20
+ import { ref } from 'vue';
20
21
 
21
22
  let $MAGIC_FORM = {} as any;
23
+ // 用 ref 持有 flat 全局开关:const 引用本身不可变,符合 `import/no-mutable-exports`;
24
+ // 通过 `.value` 改值仍保持模块级响应式语义,与 editor/plugin.ts、design/index.ts 里
25
+ // 的同名变量写法对齐。
26
+ const isGlobalFlat = ref(false);
22
27
 
23
28
  const setConfig = (option: any): void => {
24
29
  $MAGIC_FORM = option;
30
+ isGlobalFlat.value = option.flat ?? false;
25
31
  };
26
32
 
27
33
  const getConfig = <T = unknown>(key: string): T => $MAGIC_FORM[key];
@@ -39,4 +45,4 @@ const getField = (tagName: string): Component | undefined => fieldRegistry.get(t
39
45
 
40
46
  const deleteField = (tagName: string): boolean => fieldRegistry.delete(tagName);
41
47
 
42
- export { deleteField, getConfig, getField, registerField, setConfig };
48
+ export { deleteField, getConfig, getField, isGlobalFlat, registerField, setConfig };
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`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
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; /** 关闭前的回调,会暂停 Drawer 的关闭; done 是个 function type 接受一个 boolean 参数, 执行 done 使用 true 参数或不提供参数将会终止关闭 */
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>;
@@ -1957,6 +2022,7 @@ declare const deleteField: (tagName: string) => boolean;
1957
2022
  //#endregion
1958
2023
  //#region temp/packages/form/src/plugin.d.ts
1959
2024
  interface FormInstallOptions {
2025
+ flat?: boolean;
1960
2026
  [key: string]: any;
1961
2027
  }
1962
2028
  declare const _default$31: {