@tmagic/form 1.8.0-beta.2 → 1.8.0-beta.21

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.
Files changed (91) hide show
  1. package/dist/es/Form.vue_vue_type_script_setup_true_lang.js +120 -27
  2. package/dist/es/FormBox.vue_vue_type_script_setup_true_lang.js +19 -3
  3. package/dist/es/FormDialog.vue_vue_type_script_setup_true_lang.js +30 -7
  4. package/dist/es/FormDrawer.vue_vue_type_script_setup_true_lang.js +56 -14
  5. package/dist/es/containers/Col.vue_vue_type_script_setup_true_lang.js +3 -2
  6. package/dist/es/containers/Container.vue_vue_type_script_setup_true_lang.js +51 -36
  7. package/dist/es/containers/Fieldset.vue_vue_type_script_setup_true_lang.js +5 -3
  8. package/dist/es/containers/FlexLayout.vue_vue_type_script_setup_true_lang.js +1 -1
  9. package/dist/es/containers/FormLabel.vue_vue_type_script_setup_true_lang.js +1 -1
  10. package/dist/es/containers/GroupList.vue_vue_type_script_setup_true_lang.js +7 -6
  11. package/dist/es/containers/GroupListItem.vue_vue_type_script_setup_true_lang.js +42 -32
  12. package/dist/es/containers/Panel.vue_vue_type_script_setup_true_lang.js +17 -11
  13. package/dist/es/containers/Row.vue_vue_type_script_setup_true_lang.js +1 -1
  14. package/dist/es/containers/Step.vue_vue_type_script_setup_true_lang.js +1 -1
  15. package/dist/es/containers/Tabs.vue_vue_type_script_setup_true_lang.js +1 -1
  16. package/dist/es/containers/table/ActionsColumn.vue_vue_type_script_setup_true_lang.js +14 -7
  17. package/dist/es/containers/table/SortColumn.vue_vue_type_script_setup_true_lang.js +1 -1
  18. package/dist/es/containers/table/Table.vue_vue_type_script_setup_true_lang.js +7 -5
  19. package/dist/es/containers/table/useTableColumns.js +5 -1
  20. package/dist/es/containers/table-group-list/TableGroupList.vue_vue_type_script_setup_true_lang.js +3 -2
  21. package/dist/es/fields/Cascader.vue_vue_type_script_setup_true_lang.js +6 -3
  22. package/dist/es/fields/Checkbox.vue_vue_type_script_setup_true_lang.js +5 -2
  23. package/dist/es/fields/CheckboxGroup.vue_vue_type_script_setup_true_lang.js +6 -3
  24. package/dist/es/fields/ColorPicker.vue_vue_type_script_setup_true_lang.js +5 -2
  25. package/dist/es/fields/Date.vue_vue_type_script_setup_true_lang.js +6 -3
  26. package/dist/es/fields/DateTime.vue_vue_type_script_setup_true_lang.js +6 -3
  27. package/dist/es/fields/Daterange.vue_vue_type_script_setup_true_lang.js +6 -3
  28. package/dist/es/fields/Display.vue_vue_type_script_setup_true_lang.js +6 -3
  29. package/dist/es/fields/DynamicField.vue_vue_type_script_setup_true_lang.js +5 -2
  30. package/dist/es/fields/Hidden.vue_vue_type_script_setup_true_lang.js +1 -1
  31. package/dist/es/fields/Link.vue_vue_type_script_setup_true_lang.js +30 -8
  32. package/dist/es/fields/Number.vue_vue_type_script_setup_true_lang.js +8 -3
  33. package/dist/es/fields/NumberRange.vue_vue_type_script_setup_true_lang.js +5 -2
  34. package/dist/es/fields/RadioGroup.vue_vue_type_script_setup_true_lang.js +21 -10
  35. package/dist/es/fields/Select.vue_vue_type_script_setup_true_lang.js +7 -3
  36. package/dist/es/fields/Switch.vue_vue_type_script_setup_true_lang.js +5 -2
  37. package/dist/es/fields/Text.vue_vue_type_script_setup_true_lang.js +113 -78
  38. package/dist/es/fields/Textarea.vue_vue_type_script_setup_true_lang.js +5 -2
  39. package/dist/es/fields/Time.vue_vue_type_script_setup_true_lang.js +5 -2
  40. package/dist/es/fields/Timerange.vue_vue_type_script_setup_true_lang.js +7 -4
  41. package/dist/es/index.js +5 -4
  42. package/dist/es/plugin.js +4 -0
  43. package/dist/es/schema.js +12 -1
  44. package/dist/es/style.css +133 -11
  45. package/dist/es/submitForm.js +415 -56
  46. package/dist/es/utils/config.js +4 -1
  47. package/dist/es/utils/form.js +84 -9
  48. package/dist/es/utils/typeMatch.js +487 -0
  49. package/dist/style.css +133 -11
  50. package/dist/themes/magic-admin.css +509 -0
  51. package/dist/tmagic-form.umd.cjs +1773 -399
  52. package/package.json +5 -5
  53. package/src/Form.vue +163 -30
  54. package/src/FormBox.vue +11 -0
  55. package/src/FormDialog.vue +25 -3
  56. package/src/FormDrawer.vue +51 -12
  57. package/src/containers/Col.vue +1 -0
  58. package/src/containers/Container.vue +32 -11
  59. package/src/containers/Fieldset.vue +5 -2
  60. package/src/containers/GroupList.vue +1 -1
  61. package/src/containers/GroupListItem.vue +28 -22
  62. package/src/containers/Panel.vue +10 -3
  63. package/src/containers/table/ActionsColumn.vue +10 -4
  64. package/src/containers/table/Table.vue +1 -0
  65. package/src/containers/table/useTableColumns.ts +7 -3
  66. package/src/containers/table-group-list/TableGroupList.vue +7 -1
  67. package/src/fields/Link.vue +16 -3
  68. package/src/fields/Number.vue +2 -1
  69. package/src/fields/RadioGroup.vue +24 -6
  70. package/src/fields/Text.vue +43 -19
  71. package/src/index.ts +11 -0
  72. package/src/plugin.ts +12 -0
  73. package/src/schema.ts +13 -1
  74. package/src/submitForm.ts +699 -66
  75. package/src/theme/container.scss +3 -0
  76. package/src/theme/fieldset.scss +51 -0
  77. package/src/theme/form-dialog.scss +1 -1
  78. package/src/theme/form.scss +6 -0
  79. package/src/theme/group-list.scss +19 -8
  80. package/src/theme/index.scss +1 -0
  81. package/src/theme/link.scss +17 -0
  82. package/src/theme/panel.scss +1 -1
  83. package/src/theme/radio-group.scss +23 -0
  84. package/src/theme/table.scss +11 -1
  85. package/src/theme/tabs.scss +2 -2
  86. package/src/theme/text.scss +38 -0
  87. package/src/theme/themes/magic-admin/index.scss +106 -0
  88. package/src/utils/config.ts +7 -1
  89. package/src/utils/form.ts +144 -22
  90. package/src/utils/typeMatch.ts +870 -0
  91. package/types/index.d.ts +408 -21
package/types/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { App, AppContext, Component, InjectionKey } from "vue";
1
+ import { App, AppContext, Component, ComputedRef, InjectionKey } from "vue";
2
2
  import { FlexLayoutConfig, FormItemConfig, GroupListConfig, TableConfig } from "@tmagic/form-schema";
3
3
  export * from "@tmagic/form-schema";
4
4
 
5
5
  //#region \0rolldown/runtime.js
6
6
  declare namespace schema_d_exports {
7
- export { ChangeRecord, ContainerChangeEventData, FORM_DIFF_CONFIG_KEY, FormDiffConfig, FormLabelSlotProps, FormSlots, ValidateError };
7
+ export { ChangeRecord, ContainerChangeEventData, FORM_DIFF_CONFIG_KEY, FORM_SILENT_MODE_KEY, FORM_TYPE_MATCH_VALID_KEY, FormDiffConfig, FormLabelSlotProps, FormSlots, ValidateError };
8
8
  }
9
9
  import * as import__tmagic_form_schema from "@tmagic/form-schema";
10
10
  /**
@@ -33,6 +33,17 @@ interface FormDiffConfig {
33
33
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
34
34
  }
35
35
  declare const FORM_DIFF_CONFIG_KEY: InjectionKey<FormDiffConfig>;
36
+ declare const FORM_TYPE_MATCH_VALID_KEY: InjectionKey<ComputedRef<boolean>>;
37
+ /**
38
+ * 静默模式标记,由 `submitForm` / `validateForm` 以隐藏方式挂载临时表单时 provide(debug 弹层模式不提供)。
39
+ *
40
+ * 重型字段组件(如 vs-code)可 inject 该标记并跳过自身渲染:字段校验由 FormItem 基于 model 值完成,
41
+ * 与叶子 UI 组件实例无关,跳过可省去无谓的实例化开销(如 monaco worker / model 的创建)。
42
+ *
43
+ * 注意:仅「挂载无值副作用」(不在 onMounted/watch immediate 中 emit change、不依赖 DOM 计算值)的
44
+ * 字段组件可以安全跳过,接入前需逐一审计。
45
+ */
46
+ declare const FORM_SILENT_MODE_KEY: InjectionKey<boolean>;
36
47
  interface ValidateError {
37
48
  message: string;
38
49
  field: string;
@@ -87,9 +98,19 @@ interface SubmitFormOptions {
87
98
  keyProp?: string;
88
99
  popperClass?: string;
89
100
  preventSubmitDefault?: boolean;
101
+ /**
102
+ * 表单校验失败时,错误提示前缀是否使用字段的 text 文案(通过 `getTextByName` 从 config 中查找)。
103
+ * 默认 `true`,置为 `false` 时直接使用字段 name。
104
+ */
105
+ useFieldTextInError?: boolean;
90
106
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
91
107
  /** 透传给 Form.submitForm 的参数:是否直接返回原始响应式 values */
92
108
  native?: boolean;
109
+ /**
110
+ * 是否在 resolve 结果中携带 changeRecords(变更记录)。
111
+ * 开启后 resolve 的结果为 `{ values, changeRecords }`,否则仅 resolve values。
112
+ */
113
+ returnChangeRecords?: boolean;
93
114
  /**
94
115
  * 父级应用上下文,用于继承全局组件、指令、provide 等。
95
116
  * 通常通过 `app._context` 或 `getCurrentInstance()?.appContext` 获取。
@@ -97,6 +118,30 @@ interface SubmitFormOptions {
97
118
  appContext?: AppContext | null;
98
119
  /** 等待表单初始化的最长时间(毫秒),超时将以错误 reject。默认 10000ms */
99
120
  timeout?: number;
121
+ /**
122
+ * 调试模式。默认 `false`。
123
+ *
124
+ * - `false`:表单以隐藏方式挂载,初始化完成后自动提交(原有行为)。
125
+ * - `true`:将表单以弹层形式可见地渲染在页面上,需手动点击「确定」才会触发校验/提交,
126
+ * 点击「取消」则以 reject 中断;校验失败时保留弹层并展示错误信息,便于修正后重试。
127
+ * 调试模式下 `timeout` 不生效(等待人工操作)。
128
+ */
129
+ debug?: boolean;
130
+ typeMatchValid?: boolean;
131
+ /**
132
+ * 外部中断信号。abort 时会立即以 `signal.reason` reject 并卸载临时表单实例、移除容器。
133
+ * 主要用于 `debug` 模式(无超时兜底)下取消一个被放弃的表单弹层,避免其无限驻留在页面上。
134
+ */
135
+ signal?: AbortSignal;
136
+ }
137
+ /**
138
+ * 开启 `returnChangeNodes` 时 submitForm 的返回结果
139
+ */
140
+ interface SubmitFormResult {
141
+ /** 校验通过后的表单值 */
142
+ values: any;
143
+ /** 表单变更记录 */
144
+ changeRecords: ChangeRecord[];
100
145
  }
101
146
  /**
102
147
  * 以命令式方式调用 Form.vue 完成一次表单校验/提交。
@@ -118,15 +163,121 @@ interface SubmitFormOptions {
118
163
  * } catch (e) {
119
164
  * console.error(e);
120
165
  * }
166
+ *
167
+ * // 需要同时获取变更记录时:
168
+ * const { values, changeRecords } = await submitForm({
169
+ * config: [...],
170
+ * initValues: { name: 'foo' },
171
+ * returnChangeRecords: true,
172
+ * });
173
+ *
174
+ * // 调试模式:可见地渲染表单,点击「确定」才提交:
175
+ * const values = await submitForm({
176
+ * config: [...],
177
+ * initValues: { name: 'foo' },
178
+ * debug: true,
179
+ * });
121
180
  * ```
122
181
  */
123
182
  declare const submitForm: (options: SubmitFormOptions) => Promise<any>;
183
+ /**
184
+ * validateForm 函数参数(与 Form.vue 组件 props 对齐,取校验所需子集)
185
+ */
186
+ interface ValidateFormOptions {
187
+ /** 表单配置 */
188
+ config: schema_d_exports.FormConfig;
189
+ /** 待校验的表单值 */
190
+ initValues?: Record<string, any>;
191
+ parentValues?: Record<string, any>;
192
+ labelWidth?: string;
193
+ keyProp?: string;
194
+ /**
195
+ * 校验失败时,错误提示前缀是否使用字段的 text 文案(通过 `getTextByName` 从 config 中查找)。
196
+ * 默认 `true`,置为 `false` 时直接使用字段 name。
197
+ */
198
+ useFieldTextInError?: boolean;
199
+ extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
200
+ /**
201
+ * 父级应用上下文,用于继承全局组件、指令、provide 等。
202
+ * 通常通过 `app._context` 或 `getCurrentInstance()?.appContext` 获取。
203
+ */
204
+ appContext?: AppContext | null;
205
+ /** 等待表单初始化的最长时间(毫秒),超时将以错误 reject。默认 10000ms */
206
+ timeout?: number;
207
+ /**
208
+ * 调试模式。默认 `false`。
209
+ *
210
+ * - `false`:以隐藏方式挂载,初始化完成后自动校验并 resolve 错误文案(原有静默行为)。
211
+ * - `true`:将表单以弹层形式可见地渲染在页面上,需手动点击「确定」才会触发校验,
212
+ * 点击「取消」则以 reject 中断;校验失败时在弹层内展示错误信息并保留弹层,便于修正后重试,
213
+ * 校验通过则 resolve 空字符串。调试模式下 `timeout` 不生效(等待人工操作)。
214
+ */
215
+ debug?: boolean;
216
+ typeMatchValid?: boolean;
217
+ /**
218
+ * 外部中断信号。abort 时会立即以 `signal.reason` reject 并卸载临时表单实例、移除容器。
219
+ * 主要用于 `debug` 模式(无超时兜底)下取消一个被放弃的表单弹层,避免其无限驻留在页面上。
220
+ */
221
+ signal?: AbortSignal;
222
+ }
223
+ /**
224
+ * 返回一份去除了 tab 标签页 lazy 的配置副本。
225
+ *
226
+ * tab 容器开启 lazy 时,非激活标签页的内容不会渲染,导致 validateForm 静默挂载后
227
+ * 无法校验到这些标签页内的字段。校验场景需要一次性渲染全部字段,故在此统一去除 lazy。
228
+ * 处理基于深拷贝,不会污染调用方传入的原始 config。
229
+ */
230
+ declare const stripTabItemsLazy: (config: schema_d_exports.FormConfig) => schema_d_exports.FormConfig;
231
+ /**
232
+ * 以命令式方式对一份「表单配置 + 值」做一次静默校验,**不依赖也不影响任何已渲染的表单**。
233
+ *
234
+ * 与 `submitForm` 类似,内部会临时挂载一个不可见的 MForm 实例,等待其初始化完成后调用
235
+ * 实例的 `validate` 方法,返回汇总后的错误文案,随后自动卸载实例。
236
+ *
237
+ * 与 `submitForm` 的区别:
238
+ * - 「静默」:校验失败不抛异常、不触发 `error` 事件、不返回表单值;
239
+ * - 仅用于「探测」配置是否合法,适合源码保存后校验、批量校验组件配置等场景。
240
+ *
241
+ * 由于每次都新建一个独立的 MForm 实例,调用方无需持有任何表单 ref,也不会污染
242
+ * 页面上正在展示的表单状态。
243
+ *
244
+ * @returns 校验通过返回空字符串 `''`,否则返回以 `<br>` 拼接的错误文案。
245
+ * 仅在初始化超时或挂载失败等异常情况下才会 reject。
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * import { validateForm } from '@tmagic/form';
250
+ *
251
+ * const error = await validateForm({
252
+ * config: [...],
253
+ * initValues: { name: 'foo' },
254
+ * appContext: getCurrentInstance()?.appContext,
255
+ * });
256
+ * if (error) {
257
+ * // 配置不合法,error 为错误文案
258
+ * }
259
+ *
260
+ * // 调试模式:可见地渲染表单,点击「确定」才校验,校验失败保留弹层可修正重试:
261
+ * const error = await validateForm({
262
+ * config: [...],
263
+ * initValues: { name: 'foo' },
264
+ * debug: true,
265
+ * });
266
+ * ```
267
+ */
268
+ declare const validateForm: (options: ValidateFormOptions) => Promise<string>;
124
269
  //#endregion
125
270
  //#region temp/packages/form/src/utils/form.d.ts
271
+ type AsyncValidatorFn = (rule: any, value: any, callback: Function, source?: any, options?: any) => any;
272
+ /**
273
+ * 将 async-validator(Element Plus)风格的 validator 适配到当前 UI 库。
274
+ * TDesign 调用签名为 `(val) => boolean | CustomValidateObj | Promise`,无 callback。
275
+ */
276
+ declare const adaptFormValidator: (validator: AsyncValidatorFn) => AsyncValidatorFn;
126
277
  declare const createValues: (mForm: schema_d_exports.FormState | undefined, config?: schema_d_exports.FormConfig | schema_d_exports.TabPaneConfig[], initValue?: schema_d_exports.FormValue, value?: schema_d_exports.FormValue) => schema_d_exports.FormValue;
127
278
  declare const filterFunction: <T = any>(mForm: schema_d_exports.FormState | undefined, config: T | schema_d_exports.FilterFunction<T> | undefined, props: any) => T | undefined;
128
279
  declare const display: (mForm: schema_d_exports.FormState | undefined, config: any, props: any) => any;
129
- declare const getRules: (mForm: schema_d_exports.FormState | undefined, rules: (schema_d_exports.Rule[] | schema_d_exports.Rule) | undefined, props: any) => schema_d_exports.Rule[];
280
+ declare const getRules: (mForm: schema_d_exports.FormState | undefined, r: (schema_d_exports.Rule[] | schema_d_exports.Rule) | undefined, props: any, typeMatchValid?: ComputedRef<boolean>) => schema_d_exports.Rule[];
130
281
  declare const initValue: (mForm: schema_d_exports.FormState | undefined, {
131
282
  initValues,
132
283
  config
@@ -141,6 +292,24 @@ declare const sortChange: (data: any[], {
141
292
  prop,
142
293
  order
143
294
  }: schema_d_exports.SortProp) => void;
295
+ /**
296
+ * 将 extendState 返回的扩展字段合并进 formState。
297
+ *
298
+ * - data 描述符(普通字段)通过 `formState[key] = value` 写入,走 reactive proxy 的 set,
299
+ * 触发依赖通知;
300
+ * - accessor 描述符(`{ get stage() { return ... } }`)按原样 defineProperty,调用方
301
+ * 可控制读时求值;强制 `configurable: true` 以便下一次合并可再 define。
302
+ *
303
+ * 注意:extendState 只能向 formState「新增」字段,不允许覆盖其已有 key。
304
+ * 调用方可通过 `reservedKeys` 传入合并前已存在的内置 key 快照(keyProp / popperClass /
305
+ * config / initValues / isCompare / lastValues / parentValues / values / $emit / fields /
306
+ * post 等),命中这些 key 时统一跳过并告警。
307
+ *
308
+ * 兜底:未传 `reservedKeys` 时,仍会拦截 props 派生的只读 getter 字段(无 setter),
309
+ * 否则以普通字段形式赋值会让 proxy 的 set trap 抛出
310
+ * `TypeError: 'set' on proxy: trap returned falsish`。
311
+ */
312
+ declare const applyExtendState: (formState: schema_d_exports.FormState, state: Record<string, any> | null | undefined, reservedKeys?: Set<string | symbol>) => void;
144
313
  declare const createObjectProp: (prop: string, key: string, name?: string | number) => string;
145
314
  //#endregion
146
315
  //#region temp/packages/form/src/utils/useAddField.d.ts
@@ -154,7 +323,15 @@ type __VLS_Props$30 = {
154
323
  lastValues?: Record<string, any>; /** 是否开启对比模式 */
155
324
  isCompare?: boolean;
156
325
  parentValues?: Record<string, any>;
157
- labelWidth?: string;
326
+ labelWidth?: string; /** 是否开启类型匹配校验 */
327
+ typeMatchValid?: boolean;
328
+ /**
329
+ * 初始化(`config` / `initValues` 就绪)后是否立即执行一次表单校验。
330
+ *
331
+ * - `false`(默认):不自动校验,避免打开表单时就展示错误态;
332
+ * - `true`:初始化完成后在 `nextTick` 中调用 `validate()`。
333
+ */
334
+ validateOnInit?: boolean;
158
335
  disabled?: boolean;
159
336
  height?: string;
160
337
  stepActive?: string | number;
@@ -164,6 +341,13 @@ type __VLS_Props$30 = {
164
341
  keyProp?: string;
165
342
  popperClass?: string;
166
343
  preventSubmitDefault?: boolean;
344
+ /**
345
+ * 表单校验失败时,错误提示前缀是否使用字段的 text 文案(通过 `getTextByName` 从 config 中查找)。
346
+ *
347
+ * - `true`(默认):错误提示形如 `字段文案 -> 错误信息`,找不到 text 时回退为字段 name;
348
+ * - `false`:跳过查找,直接使用字段 name 作为错误提示前缀(形如 `字段name -> 错误信息`)。
349
+ */
350
+ useFieldTextInError?: boolean;
167
351
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
168
352
  /**
169
353
  * 自定义"是否展示对比内容"的判断函数(仅在 `isCompare === true` 时生效)。
@@ -196,6 +380,15 @@ type __VLS_Props$30 = {
196
380
  * 通过 provide 下发,对整棵表单的所有层级 Container 生效,只需在 MForm 这一层传一次。
197
381
  */
198
382
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
383
+ /**
384
+ * 主题名称:对应 `packages/form/src/theme/themes/<theme>/index.scss` 的目录名。
385
+ *
386
+ * 设置后会在表单根元素上追加 `m-form--<theme>` 修饰类,配合按需引入
387
+ * `@tmagic/form/dist/themes/<theme>.css` 即可启用主题样式。
388
+ *
389
+ * 例如:`<MForm theme="magic-admin" />` + `import '@tmagic/form/dist/themes/magic-admin.css'`。
390
+ */
391
+ theme?: string;
199
392
  };
200
393
  declare const __VLS_base$5: import("@vue/runtime-core").DefineComponent<__VLS_Props$30, {
201
394
  values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
@@ -206,6 +399,23 @@ declare const __VLS_base$5: import("@vue/runtime-core").DefineComponent<__VLS_Pr
206
399
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
207
400
  resetForm: () => void;
208
401
  submitForm: (native?: boolean) => Promise<any>;
402
+ /**
403
+ * 校验:对表单当前值执行校验,返回汇总后的错误文案。
404
+ *
405
+ * 与 `submitForm` 的区别:
406
+ * - 校验失败时不抛异常、不触发 `error` 事件,而是以返回值形式给出错误文案;
407
+ * - 不重置 `changeRecords`,不改变提交语义,仅用于「探测」当前配置是否合法。
408
+ *
409
+ * 注意:本方法只改变「校验结果的返回方式」,并不负责「不污染页面表单状态」——
410
+ * 若需对一份独立的「配置 + 值」做完全不影响页面上已渲染表单的校验,请使用 `validateForm`
411
+ * (内部会新建一个隐藏的 MForm 实例,通过 `initValues` 传入待校验值,用完即卸载)。
412
+ *
413
+ * 典型用途:作为 `validateForm` 内部复用的校验实现;也可在已渲染的表单实例上主动调用,
414
+ * 根据返回的错误文案自行决定后续处理(如记录节点错误状态)。
415
+ *
416
+ * @returns 校验通过返回空字符串 `''`,否则返回以 `<br>` 拼接的错误文案。
417
+ */
418
+ validate: () => Promise<string>;
209
419
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
210
420
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
211
421
  error: (...args: any[]) => void;
@@ -232,6 +442,8 @@ declare const __VLS_base$5: import("@vue/runtime-core").DefineComponent<__VLS_Pr
232
442
  keyProp: string;
233
443
  parentValues: Record<string, any>;
234
444
  stepActive: string | number;
445
+ validateOnInit: boolean;
446
+ useFieldTextInError: boolean;
235
447
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
236
448
  declare const __VLS_export$30: __VLS_WithSlots$5<typeof __VLS_base$5, __VLS_Slots$5>;
237
449
  declare const _default$12: typeof __VLS_export$30;
@@ -247,7 +459,9 @@ type __VLS_Props$29 = {
247
459
  values?: Object;
248
460
  parentValues?: Object;
249
461
  width?: string | number;
250
- labelWidth?: string;
462
+ labelWidth?: string; /** 是否开启类型匹配校验 */
463
+ typeMatchValid?: boolean; /** 透传给内部 `MForm`,初始化完成后是否立即校验(默认 `false`) */
464
+ validateOnInit?: boolean;
251
465
  fullscreen?: boolean;
252
466
  disabled?: boolean;
253
467
  title?: string;
@@ -261,8 +475,15 @@ type __VLS_Props$29 = {
261
475
  closeOnPressEscape?: boolean;
262
476
  destroyOnClose?: boolean;
263
477
  showClose?: boolean;
264
- showCancel?: boolean; /** 透传给内部 `MForm`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
478
+ showCancel?: boolean; /** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
479
+ useFieldTextInError?: boolean; /** 透传给内部 `MForm`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
265
480
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
481
+ /**
482
+ * 主题名。优先级:传入 `theme` prop > 祖先 `provide(M_THEME_KEY)` > 空串。
483
+ * 计算结果会再次 `provide` 出去,使得 Dialog 被 Teleport 到 body 后,内部子树
484
+ * (包括 `MForm` 以及更深的 popover / dropdown)仍能拿到主题。
485
+ */
486
+ theme?: string;
266
487
  };
267
488
  declare var __VLS_19: {}, __VLS_34: {}, __VLS_42: {};
268
489
  type __VLS_Slots$4 = {} & {
@@ -283,6 +504,8 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
283
504
  readonly isCompare?: boolean | undefined;
284
505
  readonly parentValues?: Record<string, any> | undefined;
285
506
  readonly labelWidth?: string | undefined;
507
+ readonly typeMatchValid?: boolean | undefined;
508
+ readonly validateOnInit?: boolean | undefined;
286
509
  readonly disabled?: boolean | undefined;
287
510
  readonly height?: string | undefined;
288
511
  readonly stepActive?: string | number | undefined;
@@ -292,6 +515,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
292
515
  readonly keyProp?: string | undefined;
293
516
  readonly popperClass?: string | undefined;
294
517
  readonly preventSubmitDefault?: boolean | undefined;
518
+ readonly useFieldTextInError?: boolean | undefined;
295
519
  readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
296
520
  readonly showDiff?: ((_data: {
297
521
  curValue: any;
@@ -299,6 +523,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
299
523
  config: any;
300
524
  }) => boolean) | undefined;
301
525
  readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
526
+ readonly theme?: string | undefined;
302
527
  readonly onError?: ((...args: any[]) => any) | undefined;
303
528
  readonly onChange?: ((...args: any[]) => any) | undefined;
304
529
  readonly "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -324,6 +549,8 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
324
549
  isCompare?: boolean;
325
550
  parentValues?: Record<string, any>;
326
551
  labelWidth?: string;
552
+ typeMatchValid?: boolean;
553
+ validateOnInit?: boolean;
327
554
  disabled?: boolean;
328
555
  height?: string;
329
556
  stepActive?: string | number;
@@ -333,6 +560,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
333
560
  keyProp?: string;
334
561
  popperClass?: string;
335
562
  preventSubmitDefault?: boolean;
563
+ useFieldTextInError?: boolean;
336
564
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
337
565
  showDiff?: (_data: {
338
566
  curValue: any;
@@ -340,6 +568,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
340
568
  config: any;
341
569
  }) => boolean;
342
570
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
571
+ theme?: string;
343
572
  }> & Readonly<{
344
573
  onError?: ((...args: any[]) => any) | undefined;
345
574
  onChange?: ((...args: any[]) => any) | undefined;
@@ -355,6 +584,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
355
584
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
356
585
  resetForm: () => void;
357
586
  submitForm: (native?: boolean) => Promise<any>;
587
+ validate: () => Promise<string>;
358
588
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
359
589
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
360
590
  error: (...args: any[]) => void;
@@ -375,6 +605,8 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
375
605
  keyProp: string;
376
606
  parentValues: Record<string, any>;
377
607
  stepActive: string | number;
608
+ validateOnInit: boolean;
609
+ useFieldTextInError: boolean;
378
610
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
379
611
  beforeCreate?: (() => void) | (() => void)[];
380
612
  created?: (() => void) | (() => void)[];
@@ -408,6 +640,8 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
408
640
  keyProp: string;
409
641
  parentValues: Record<string, any>;
410
642
  stepActive: string | number;
643
+ validateOnInit: boolean;
644
+ useFieldTextInError: boolean;
411
645
  }> & Omit<Readonly<{
412
646
  config: schema_d_exports.FormConfig;
413
647
  initValues: Record<string, any>;
@@ -415,6 +649,8 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
415
649
  isCompare?: boolean;
416
650
  parentValues?: Record<string, any>;
417
651
  labelWidth?: string;
652
+ typeMatchValid?: boolean;
653
+ validateOnInit?: boolean;
418
654
  disabled?: boolean;
419
655
  height?: string;
420
656
  stepActive?: string | number;
@@ -424,6 +660,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
424
660
  keyProp?: string;
425
661
  popperClass?: string;
426
662
  preventSubmitDefault?: boolean;
663
+ useFieldTextInError?: boolean;
427
664
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
428
665
  showDiff?: (_data: {
429
666
  curValue: any;
@@ -431,13 +668,14 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
431
668
  config: any;
432
669
  }) => boolean;
433
670
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
671
+ theme?: string;
434
672
  }> & Readonly<{
435
673
  onError?: ((...args: any[]) => any) | undefined;
436
674
  onChange?: ((...args: any[]) => any) | undefined;
437
675
  "onField-input"?: ((...args: any[]) => any) | undefined;
438
676
  "onField-change"?: ((...args: any[]) => any) | undefined;
439
677
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
440
- }>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
678
+ }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
441
679
  values: schema_d_exports.FormValue;
442
680
  lastValuesProcessed: schema_d_exports.FormValue;
443
681
  formState: schema_d_exports.FormState;
@@ -446,6 +684,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
446
684
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
447
685
  resetForm: () => void;
448
686
  submitForm: (native?: boolean) => Promise<any>;
687
+ validate: () => Promise<string>;
449
688
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
450
689
  } & {} & import("@vue/runtime-core").ComponentCustomProperties & {} & {
451
690
  $slots: import("@tmagic/editor").FormSlots;
@@ -459,6 +698,8 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
459
698
  readonly isCompare?: boolean | undefined;
460
699
  readonly parentValues?: Record<string, any> | undefined;
461
700
  readonly labelWidth?: string | undefined;
701
+ readonly typeMatchValid?: boolean | undefined;
702
+ readonly validateOnInit?: boolean | undefined;
462
703
  readonly disabled?: boolean | undefined;
463
704
  readonly height?: string | undefined;
464
705
  readonly stepActive?: string | number | undefined;
@@ -468,6 +709,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
468
709
  readonly keyProp?: string | undefined;
469
710
  readonly popperClass?: string | undefined;
470
711
  readonly preventSubmitDefault?: boolean | undefined;
712
+ readonly useFieldTextInError?: boolean | undefined;
471
713
  readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
472
714
  readonly showDiff?: ((_data: {
473
715
  curValue: any;
@@ -475,6 +717,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
475
717
  config: any;
476
718
  }) => boolean) | undefined;
477
719
  readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
720
+ readonly theme?: string | undefined;
478
721
  readonly onError?: ((...args: any[]) => any) | undefined;
479
722
  readonly onChange?: ((...args: any[]) => any) | undefined;
480
723
  readonly "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -500,6 +743,8 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
500
743
  isCompare?: boolean;
501
744
  parentValues?: Record<string, any>;
502
745
  labelWidth?: string;
746
+ typeMatchValid?: boolean;
747
+ validateOnInit?: boolean;
503
748
  disabled?: boolean;
504
749
  height?: string;
505
750
  stepActive?: string | number;
@@ -509,6 +754,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
509
754
  keyProp?: string;
510
755
  popperClass?: string;
511
756
  preventSubmitDefault?: boolean;
757
+ useFieldTextInError?: boolean;
512
758
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
513
759
  showDiff?: (_data: {
514
760
  curValue: any;
@@ -516,6 +762,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
516
762
  config: any;
517
763
  }) => boolean;
518
764
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
765
+ theme?: string;
519
766
  }> & Readonly<{
520
767
  onError?: ((...args: any[]) => any) | undefined;
521
768
  onChange?: ((...args: any[]) => any) | undefined;
@@ -531,6 +778,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
531
778
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
532
779
  resetForm: () => void;
533
780
  submitForm: (native?: boolean) => Promise<any>;
781
+ validate: () => Promise<string>;
534
782
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
535
783
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
536
784
  error: (...args: any[]) => void;
@@ -551,6 +799,8 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
551
799
  keyProp: string;
552
800
  parentValues: Record<string, any>;
553
801
  stepActive: string | number;
802
+ validateOnInit: boolean;
803
+ useFieldTextInError: boolean;
554
804
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
555
805
  beforeCreate?: (() => void) | (() => void)[];
556
806
  created?: (() => void) | (() => void)[];
@@ -584,6 +834,8 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
584
834
  keyProp: string;
585
835
  parentValues: Record<string, any>;
586
836
  stepActive: string | number;
837
+ validateOnInit: boolean;
838
+ useFieldTextInError: boolean;
587
839
  }> & Omit<Readonly<{
588
840
  config: schema_d_exports.FormConfig;
589
841
  initValues: Record<string, any>;
@@ -591,6 +843,8 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
591
843
  isCompare?: boolean;
592
844
  parentValues?: Record<string, any>;
593
845
  labelWidth?: string;
846
+ typeMatchValid?: boolean;
847
+ validateOnInit?: boolean;
594
848
  disabled?: boolean;
595
849
  height?: string;
596
850
  stepActive?: string | number;
@@ -600,6 +854,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
600
854
  keyProp?: string;
601
855
  popperClass?: string;
602
856
  preventSubmitDefault?: boolean;
857
+ useFieldTextInError?: boolean;
603
858
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
604
859
  showDiff?: (_data: {
605
860
  curValue: any;
@@ -607,13 +862,14 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
607
862
  config: any;
608
863
  }) => boolean;
609
864
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
865
+ theme?: string;
610
866
  }> & Readonly<{
611
867
  onError?: ((...args: any[]) => any) | undefined;
612
868
  onChange?: ((...args: any[]) => any) | undefined;
613
869
  "onField-input"?: ((...args: any[]) => any) | undefined;
614
870
  "onField-change"?: ((...args: any[]) => any) | undefined;
615
871
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
616
- }>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
872
+ }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
617
873
  values: schema_d_exports.FormValue;
618
874
  lastValuesProcessed: schema_d_exports.FormValue;
619
875
  formState: schema_d_exports.FormState;
@@ -622,6 +878,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
622
878
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
623
879
  resetForm: () => void;
624
880
  submitForm: (native?: boolean) => Promise<any>;
881
+ validate: () => Promise<string>;
625
882
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
626
883
  } & {} & import("@vue/runtime-core").ComponentCustomProperties & {} & {
627
884
  $slots: import("@tmagic/editor").FormSlots;
@@ -649,6 +906,8 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
649
906
  destroyOnClose: boolean;
650
907
  showClose: boolean;
651
908
  config: schema_d_exports.FormConfig;
909
+ validateOnInit: boolean;
910
+ useFieldTextInError: boolean;
652
911
  confirmText: string;
653
912
  showCancel: boolean;
654
913
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
@@ -666,7 +925,9 @@ type __VLS_Props$28 = {
666
925
  values?: Object;
667
926
  parentValues?: Object;
668
927
  width?: string | number;
669
- labelWidth?: string;
928
+ labelWidth?: string; /** 是否开启类型匹配校验 */
929
+ typeMatchValid?: boolean; /** 透传给内部 `MForm`,初始化完成后是否立即校验(默认 `false`) */
930
+ validateOnInit?: boolean;
670
931
  disabled?: boolean;
671
932
  closeOnPressEscape?: boolean;
672
933
  title?: string;
@@ -675,9 +936,16 @@ type __VLS_Props$28 = {
675
936
  confirmText?: string;
676
937
  inline?: boolean;
677
938
  labelPosition?: string;
678
- preventSubmitDefault?: boolean; /** 关闭前的回调,会暂停 Drawer 的关闭; done 是个 function type 接受一个 boolean 参数, 执行 done 使用 true 参数或不提供参数将会终止关闭 */
939
+ preventSubmitDefault?: boolean; /** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
940
+ useFieldTextInError?: boolean; /** 关闭前的回调,会暂停 Drawer 的关闭; done 是个 function type 接受一个 boolean 参数, 执行 done 使用 true 参数或不提供参数将会终止关闭 */
679
941
  beforeClose?: (_done: (_cancel?: boolean) => void) => void; /** 透传给内部 `MForm`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
680
942
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
943
+ /**
944
+ * 主题名。优先级:传入 `theme` prop > 祖先 `provide(M_THEME_KEY)` > 空串。
945
+ * 计算结果会再次 `provide` 出去,使得 Drawer 被 Teleport 到 body 后,内部子树
946
+ * (包括 `MForm` 以及更深的 popover / dropdown)仍能拿到主题。
947
+ */
948
+ theme?: string;
681
949
  };
682
950
  declare var __VLS_23: {}, __VLS_38: {}, __VLS_46: {};
683
951
  type __VLS_Slots$3 = {} & {
@@ -698,6 +966,8 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
698
966
  readonly isCompare?: boolean | undefined;
699
967
  readonly parentValues?: Record<string, any> | undefined;
700
968
  readonly labelWidth?: string | undefined;
969
+ readonly typeMatchValid?: boolean | undefined;
970
+ readonly validateOnInit?: boolean | undefined;
701
971
  readonly disabled?: boolean | undefined;
702
972
  readonly height?: string | undefined;
703
973
  readonly stepActive?: string | number | undefined;
@@ -707,6 +977,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
707
977
  readonly keyProp?: string | undefined;
708
978
  readonly popperClass?: string | undefined;
709
979
  readonly preventSubmitDefault?: boolean | undefined;
980
+ readonly useFieldTextInError?: boolean | undefined;
710
981
  readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
711
982
  readonly showDiff?: ((_data: {
712
983
  curValue: any;
@@ -714,6 +985,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
714
985
  config: any;
715
986
  }) => boolean) | undefined;
716
987
  readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
988
+ readonly theme?: string | undefined;
717
989
  readonly onError?: ((...args: any[]) => any) | undefined;
718
990
  readonly onChange?: ((...args: any[]) => any) | undefined;
719
991
  readonly "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -739,6 +1011,8 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
739
1011
  isCompare?: boolean;
740
1012
  parentValues?: Record<string, any>;
741
1013
  labelWidth?: string;
1014
+ typeMatchValid?: boolean;
1015
+ validateOnInit?: boolean;
742
1016
  disabled?: boolean;
743
1017
  height?: string;
744
1018
  stepActive?: string | number;
@@ -748,6 +1022,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
748
1022
  keyProp?: string;
749
1023
  popperClass?: string;
750
1024
  preventSubmitDefault?: boolean;
1025
+ useFieldTextInError?: boolean;
751
1026
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
752
1027
  showDiff?: (_data: {
753
1028
  curValue: any;
@@ -755,6 +1030,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
755
1030
  config: any;
756
1031
  }) => boolean;
757
1032
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
1033
+ theme?: string;
758
1034
  }> & Readonly<{
759
1035
  onError?: ((...args: any[]) => any) | undefined;
760
1036
  onChange?: ((...args: any[]) => any) | undefined;
@@ -770,6 +1046,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
770
1046
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
771
1047
  resetForm: () => void;
772
1048
  submitForm: (native?: boolean) => Promise<any>;
1049
+ validate: () => Promise<string>;
773
1050
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
774
1051
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
775
1052
  error: (...args: any[]) => void;
@@ -790,6 +1067,8 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
790
1067
  keyProp: string;
791
1068
  parentValues: Record<string, any>;
792
1069
  stepActive: string | number;
1070
+ validateOnInit: boolean;
1071
+ useFieldTextInError: boolean;
793
1072
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
794
1073
  beforeCreate?: (() => void) | (() => void)[];
795
1074
  created?: (() => void) | (() => void)[];
@@ -823,6 +1102,8 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
823
1102
  keyProp: string;
824
1103
  parentValues: Record<string, any>;
825
1104
  stepActive: string | number;
1105
+ validateOnInit: boolean;
1106
+ useFieldTextInError: boolean;
826
1107
  }> & Omit<Readonly<{
827
1108
  config: schema_d_exports.FormConfig;
828
1109
  initValues: Record<string, any>;
@@ -830,6 +1111,8 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
830
1111
  isCompare?: boolean;
831
1112
  parentValues?: Record<string, any>;
832
1113
  labelWidth?: string;
1114
+ typeMatchValid?: boolean;
1115
+ validateOnInit?: boolean;
833
1116
  disabled?: boolean;
834
1117
  height?: string;
835
1118
  stepActive?: string | number;
@@ -839,6 +1122,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
839
1122
  keyProp?: string;
840
1123
  popperClass?: string;
841
1124
  preventSubmitDefault?: boolean;
1125
+ useFieldTextInError?: boolean;
842
1126
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
843
1127
  showDiff?: (_data: {
844
1128
  curValue: any;
@@ -846,13 +1130,14 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
846
1130
  config: any;
847
1131
  }) => boolean;
848
1132
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
1133
+ theme?: string;
849
1134
  }> & Readonly<{
850
1135
  onError?: ((...args: any[]) => any) | undefined;
851
1136
  onChange?: ((...args: any[]) => any) | undefined;
852
1137
  "onField-input"?: ((...args: any[]) => any) | undefined;
853
1138
  "onField-change"?: ((...args: any[]) => any) | undefined;
854
1139
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
855
- }>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
1140
+ }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
856
1141
  values: schema_d_exports.FormValue;
857
1142
  lastValuesProcessed: schema_d_exports.FormValue;
858
1143
  formState: schema_d_exports.FormState;
@@ -861,6 +1146,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
861
1146
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
862
1147
  resetForm: () => void;
863
1148
  submitForm: (native?: boolean) => Promise<any>;
1149
+ validate: () => Promise<string>;
864
1150
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
865
1151
  } & {} & import("@vue/runtime-core").ComponentCustomProperties & {} & {
866
1152
  $slots: import("@tmagic/editor").FormSlots;
@@ -874,6 +1160,8 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
874
1160
  readonly isCompare?: boolean | undefined;
875
1161
  readonly parentValues?: Record<string, any> | undefined;
876
1162
  readonly labelWidth?: string | undefined;
1163
+ readonly typeMatchValid?: boolean | undefined;
1164
+ readonly validateOnInit?: boolean | undefined;
877
1165
  readonly disabled?: boolean | undefined;
878
1166
  readonly height?: string | undefined;
879
1167
  readonly stepActive?: string | number | undefined;
@@ -883,6 +1171,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
883
1171
  readonly keyProp?: string | undefined;
884
1172
  readonly popperClass?: string | undefined;
885
1173
  readonly preventSubmitDefault?: boolean | undefined;
1174
+ readonly useFieldTextInError?: boolean | undefined;
886
1175
  readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
887
1176
  readonly showDiff?: ((_data: {
888
1177
  curValue: any;
@@ -890,6 +1179,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
890
1179
  config: any;
891
1180
  }) => boolean) | undefined;
892
1181
  readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
1182
+ readonly theme?: string | undefined;
893
1183
  readonly onError?: ((...args: any[]) => any) | undefined;
894
1184
  readonly onChange?: ((...args: any[]) => any) | undefined;
895
1185
  readonly "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -915,6 +1205,8 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
915
1205
  isCompare?: boolean;
916
1206
  parentValues?: Record<string, any>;
917
1207
  labelWidth?: string;
1208
+ typeMatchValid?: boolean;
1209
+ validateOnInit?: boolean;
918
1210
  disabled?: boolean;
919
1211
  height?: string;
920
1212
  stepActive?: string | number;
@@ -924,6 +1216,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
924
1216
  keyProp?: string;
925
1217
  popperClass?: string;
926
1218
  preventSubmitDefault?: boolean;
1219
+ useFieldTextInError?: boolean;
927
1220
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
928
1221
  showDiff?: (_data: {
929
1222
  curValue: any;
@@ -931,6 +1224,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
931
1224
  config: any;
932
1225
  }) => boolean;
933
1226
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
1227
+ theme?: string;
934
1228
  }> & Readonly<{
935
1229
  onError?: ((...args: any[]) => any) | undefined;
936
1230
  onChange?: ((...args: any[]) => any) | undefined;
@@ -946,6 +1240,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
946
1240
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
947
1241
  resetForm: () => void;
948
1242
  submitForm: (native?: boolean) => Promise<any>;
1243
+ validate: () => Promise<string>;
949
1244
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
950
1245
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
951
1246
  error: (...args: any[]) => void;
@@ -966,6 +1261,8 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
966
1261
  keyProp: string;
967
1262
  parentValues: Record<string, any>;
968
1263
  stepActive: string | number;
1264
+ validateOnInit: boolean;
1265
+ useFieldTextInError: boolean;
969
1266
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
970
1267
  beforeCreate?: (() => void) | (() => void)[];
971
1268
  created?: (() => void) | (() => void)[];
@@ -999,6 +1296,8 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
999
1296
  keyProp: string;
1000
1297
  parentValues: Record<string, any>;
1001
1298
  stepActive: string | number;
1299
+ validateOnInit: boolean;
1300
+ useFieldTextInError: boolean;
1002
1301
  }> & Omit<Readonly<{
1003
1302
  config: schema_d_exports.FormConfig;
1004
1303
  initValues: Record<string, any>;
@@ -1006,6 +1305,8 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1006
1305
  isCompare?: boolean;
1007
1306
  parentValues?: Record<string, any>;
1008
1307
  labelWidth?: string;
1308
+ typeMatchValid?: boolean;
1309
+ validateOnInit?: boolean;
1009
1310
  disabled?: boolean;
1010
1311
  height?: string;
1011
1312
  stepActive?: string | number;
@@ -1015,6 +1316,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1015
1316
  keyProp?: string;
1016
1317
  popperClass?: string;
1017
1318
  preventSubmitDefault?: boolean;
1319
+ useFieldTextInError?: boolean;
1018
1320
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1019
1321
  showDiff?: (_data: {
1020
1322
  curValue: any;
@@ -1022,13 +1324,14 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1022
1324
  config: any;
1023
1325
  }) => boolean;
1024
1326
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
1327
+ theme?: string;
1025
1328
  }> & Readonly<{
1026
1329
  onError?: ((...args: any[]) => any) | undefined;
1027
1330
  onChange?: ((...args: any[]) => any) | undefined;
1028
1331
  "onField-input"?: ((...args: any[]) => any) | undefined;
1029
1332
  "onField-change"?: ((...args: any[]) => any) | undefined;
1030
1333
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
1031
- }>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
1334
+ }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
1032
1335
  values: schema_d_exports.FormValue;
1033
1336
  lastValuesProcessed: schema_d_exports.FormValue;
1034
1337
  formState: schema_d_exports.FormState;
@@ -1037,14 +1340,18 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1037
1340
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
1038
1341
  resetForm: () => void;
1039
1342
  submitForm: (native?: boolean) => Promise<any>;
1343
+ validate: () => Promise<string>;
1040
1344
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
1041
1345
  } & {} & import("@vue/runtime-core").ComponentCustomProperties & {} & {
1042
1346
  $slots: import("@tmagic/editor").FormSlots;
1043
1347
  }) | undefined>;
1044
1348
  saveFetch: import("@vue/reactivity").Ref<boolean, boolean>;
1045
1349
  bodyHeight: import("@vue/reactivity").Ref<number, number>;
1350
+ close: () => void;
1046
1351
  show: () => void;
1047
1352
  hide: () => void;
1353
+ save: () => Promise<void>;
1354
+ cancel: () => void;
1048
1355
  handleClose: () => void;
1049
1356
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
1050
1357
  error: (...args: any[]) => void;
@@ -1066,6 +1373,8 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1066
1373
  values: Object;
1067
1374
  closeOnPressEscape: boolean;
1068
1375
  config: schema_d_exports.FormConfig;
1376
+ validateOnInit: boolean;
1377
+ useFieldTextInError: boolean;
1069
1378
  confirmText: string;
1070
1379
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
1071
1380
  declare const __VLS_export$28: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
@@ -1083,16 +1392,19 @@ type __VLS_Props$27 = {
1083
1392
  parentValues?: Object;
1084
1393
  width?: number;
1085
1394
  height?: number;
1086
- labelWidth?: string;
1395
+ labelWidth?: string; /** 是否开启类型匹配校验 */
1396
+ typeMatchValid?: boolean; /** 透传给内部 `MForm`,初始化完成后是否立即校验(默认 `false`) */
1397
+ validateOnInit?: boolean;
1087
1398
  disabled?: boolean;
1088
1399
  size?: 'small' | 'default' | 'large';
1089
1400
  confirmText?: string;
1090
1401
  inline?: boolean;
1091
1402
  labelPosition?: string;
1092
- preventSubmitDefault?: boolean;
1403
+ preventSubmitDefault?: boolean; /** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
1404
+ useFieldTextInError?: boolean;
1093
1405
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1094
1406
  };
1095
- declare var __VLS_16$1: {}, __VLS_18$1: {}, __VLS_20: {};
1407
+ declare var __VLS_16$1: {}, __VLS_18: {}, __VLS_20: {};
1096
1408
  type __VLS_Slots$2 = {} & {
1097
1409
  default?: (props: typeof __VLS_16$1) => any;
1098
1410
  } & {
@@ -1111,6 +1423,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1111
1423
  readonly isCompare?: boolean | undefined;
1112
1424
  readonly parentValues?: Record<string, any> | undefined;
1113
1425
  readonly labelWidth?: string | undefined;
1426
+ readonly typeMatchValid?: boolean | undefined;
1427
+ readonly validateOnInit?: boolean | undefined;
1114
1428
  readonly disabled?: boolean | undefined;
1115
1429
  readonly height?: string | undefined;
1116
1430
  readonly stepActive?: string | number | undefined;
@@ -1120,6 +1434,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1120
1434
  readonly keyProp?: string | undefined;
1121
1435
  readonly popperClass?: string | undefined;
1122
1436
  readonly preventSubmitDefault?: boolean | undefined;
1437
+ readonly useFieldTextInError?: boolean | undefined;
1123
1438
  readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
1124
1439
  readonly showDiff?: ((_data: {
1125
1440
  curValue: any;
@@ -1127,6 +1442,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1127
1442
  config: any;
1128
1443
  }) => boolean) | undefined;
1129
1444
  readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
1445
+ readonly theme?: string | undefined;
1130
1446
  readonly onError?: ((...args: any[]) => any) | undefined;
1131
1447
  readonly onChange?: ((...args: any[]) => any) | undefined;
1132
1448
  readonly "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -1152,6 +1468,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1152
1468
  isCompare?: boolean;
1153
1469
  parentValues?: Record<string, any>;
1154
1470
  labelWidth?: string;
1471
+ typeMatchValid?: boolean;
1472
+ validateOnInit?: boolean;
1155
1473
  disabled?: boolean;
1156
1474
  height?: string;
1157
1475
  stepActive?: string | number;
@@ -1161,6 +1479,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1161
1479
  keyProp?: string;
1162
1480
  popperClass?: string;
1163
1481
  preventSubmitDefault?: boolean;
1482
+ useFieldTextInError?: boolean;
1164
1483
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1165
1484
  showDiff?: (_data: {
1166
1485
  curValue: any;
@@ -1168,6 +1487,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1168
1487
  config: any;
1169
1488
  }) => boolean;
1170
1489
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
1490
+ theme?: string;
1171
1491
  }> & Readonly<{
1172
1492
  onError?: ((...args: any[]) => any) | undefined;
1173
1493
  onChange?: ((...args: any[]) => any) | undefined;
@@ -1183,6 +1503,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1183
1503
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
1184
1504
  resetForm: () => void;
1185
1505
  submitForm: (native?: boolean) => Promise<any>;
1506
+ validate: () => Promise<string>;
1186
1507
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
1187
1508
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
1188
1509
  error: (...args: any[]) => void;
@@ -1203,6 +1524,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1203
1524
  keyProp: string;
1204
1525
  parentValues: Record<string, any>;
1205
1526
  stepActive: string | number;
1527
+ validateOnInit: boolean;
1528
+ useFieldTextInError: boolean;
1206
1529
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
1207
1530
  beforeCreate?: (() => void) | (() => void)[];
1208
1531
  created?: (() => void) | (() => void)[];
@@ -1236,6 +1559,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1236
1559
  keyProp: string;
1237
1560
  parentValues: Record<string, any>;
1238
1561
  stepActive: string | number;
1562
+ validateOnInit: boolean;
1563
+ useFieldTextInError: boolean;
1239
1564
  }> & Omit<Readonly<{
1240
1565
  config: schema_d_exports.FormConfig;
1241
1566
  initValues: Record<string, any>;
@@ -1243,6 +1568,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1243
1568
  isCompare?: boolean;
1244
1569
  parentValues?: Record<string, any>;
1245
1570
  labelWidth?: string;
1571
+ typeMatchValid?: boolean;
1572
+ validateOnInit?: boolean;
1246
1573
  disabled?: boolean;
1247
1574
  height?: string;
1248
1575
  stepActive?: string | number;
@@ -1252,6 +1579,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1252
1579
  keyProp?: string;
1253
1580
  popperClass?: string;
1254
1581
  preventSubmitDefault?: boolean;
1582
+ useFieldTextInError?: boolean;
1255
1583
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1256
1584
  showDiff?: (_data: {
1257
1585
  curValue: any;
@@ -1259,13 +1587,14 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1259
1587
  config: any;
1260
1588
  }) => boolean;
1261
1589
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
1590
+ theme?: string;
1262
1591
  }> & Readonly<{
1263
1592
  onError?: ((...args: any[]) => any) | undefined;
1264
1593
  onChange?: ((...args: any[]) => any) | undefined;
1265
1594
  "onField-input"?: ((...args: any[]) => any) | undefined;
1266
1595
  "onField-change"?: ((...args: any[]) => any) | undefined;
1267
1596
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
1268
- }>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
1597
+ }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
1269
1598
  values: schema_d_exports.FormValue;
1270
1599
  lastValuesProcessed: schema_d_exports.FormValue;
1271
1600
  formState: schema_d_exports.FormState;
@@ -1274,6 +1603,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1274
1603
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
1275
1604
  resetForm: () => void;
1276
1605
  submitForm: (native?: boolean) => Promise<any>;
1606
+ validate: () => Promise<string>;
1277
1607
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
1278
1608
  } & {} & import("@vue/runtime-core").ComponentCustomProperties & {} & {
1279
1609
  $slots: import("@tmagic/editor").FormSlots;
@@ -1287,6 +1617,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1287
1617
  readonly isCompare?: boolean | undefined;
1288
1618
  readonly parentValues?: Record<string, any> | undefined;
1289
1619
  readonly labelWidth?: string | undefined;
1620
+ readonly typeMatchValid?: boolean | undefined;
1621
+ readonly validateOnInit?: boolean | undefined;
1290
1622
  readonly disabled?: boolean | undefined;
1291
1623
  readonly height?: string | undefined;
1292
1624
  readonly stepActive?: string | number | undefined;
@@ -1296,6 +1628,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1296
1628
  readonly keyProp?: string | undefined;
1297
1629
  readonly popperClass?: string | undefined;
1298
1630
  readonly preventSubmitDefault?: boolean | undefined;
1631
+ readonly useFieldTextInError?: boolean | undefined;
1299
1632
  readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
1300
1633
  readonly showDiff?: ((_data: {
1301
1634
  curValue: any;
@@ -1303,6 +1636,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1303
1636
  config: any;
1304
1637
  }) => boolean) | undefined;
1305
1638
  readonly selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]) | undefined;
1639
+ readonly theme?: string | undefined;
1306
1640
  readonly onError?: ((...args: any[]) => any) | undefined;
1307
1641
  readonly onChange?: ((...args: any[]) => any) | undefined;
1308
1642
  readonly "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -1328,6 +1662,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1328
1662
  isCompare?: boolean;
1329
1663
  parentValues?: Record<string, any>;
1330
1664
  labelWidth?: string;
1665
+ typeMatchValid?: boolean;
1666
+ validateOnInit?: boolean;
1331
1667
  disabled?: boolean;
1332
1668
  height?: string;
1333
1669
  stepActive?: string | number;
@@ -1337,6 +1673,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1337
1673
  keyProp?: string;
1338
1674
  popperClass?: string;
1339
1675
  preventSubmitDefault?: boolean;
1676
+ useFieldTextInError?: boolean;
1340
1677
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1341
1678
  showDiff?: (_data: {
1342
1679
  curValue: any;
@@ -1344,6 +1681,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1344
1681
  config: any;
1345
1682
  }) => boolean;
1346
1683
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
1684
+ theme?: string;
1347
1685
  }> & Readonly<{
1348
1686
  onError?: ((...args: any[]) => any) | undefined;
1349
1687
  onChange?: ((...args: any[]) => any) | undefined;
@@ -1359,6 +1697,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1359
1697
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
1360
1698
  resetForm: () => void;
1361
1699
  submitForm: (native?: boolean) => Promise<any>;
1700
+ validate: () => Promise<string>;
1362
1701
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
1363
1702
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
1364
1703
  error: (...args: any[]) => void;
@@ -1379,6 +1718,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1379
1718
  keyProp: string;
1380
1719
  parentValues: Record<string, any>;
1381
1720
  stepActive: string | number;
1721
+ validateOnInit: boolean;
1722
+ useFieldTextInError: boolean;
1382
1723
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
1383
1724
  beforeCreate?: (() => void) | (() => void)[];
1384
1725
  created?: (() => void) | (() => void)[];
@@ -1412,6 +1753,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1412
1753
  keyProp: string;
1413
1754
  parentValues: Record<string, any>;
1414
1755
  stepActive: string | number;
1756
+ validateOnInit: boolean;
1757
+ useFieldTextInError: boolean;
1415
1758
  }> & Omit<Readonly<{
1416
1759
  config: schema_d_exports.FormConfig;
1417
1760
  initValues: Record<string, any>;
@@ -1419,6 +1762,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1419
1762
  isCompare?: boolean;
1420
1763
  parentValues?: Record<string, any>;
1421
1764
  labelWidth?: string;
1765
+ typeMatchValid?: boolean;
1766
+ validateOnInit?: boolean;
1422
1767
  disabled?: boolean;
1423
1768
  height?: string;
1424
1769
  stepActive?: string | number;
@@ -1428,6 +1773,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1428
1773
  keyProp?: string;
1429
1774
  popperClass?: string;
1430
1775
  preventSubmitDefault?: boolean;
1776
+ useFieldTextInError?: boolean;
1431
1777
  extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1432
1778
  showDiff?: (_data: {
1433
1779
  curValue: any;
@@ -1435,13 +1781,14 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1435
1781
  config: any;
1436
1782
  }) => boolean;
1437
1783
  selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
1784
+ theme?: string;
1438
1785
  }> & Readonly<{
1439
1786
  onError?: ((...args: any[]) => any) | undefined;
1440
1787
  onChange?: ((...args: any[]) => any) | undefined;
1441
1788
  "onField-input"?: ((...args: any[]) => any) | undefined;
1442
1789
  "onField-change"?: ((...args: any[]) => any) | undefined;
1443
1790
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
1444
- }>, "values" | "changeHandler" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive")> & {
1791
+ }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
1445
1792
  values: schema_d_exports.FormValue;
1446
1793
  lastValuesProcessed: schema_d_exports.FormValue;
1447
1794
  formState: schema_d_exports.FormState;
@@ -1450,6 +1797,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1450
1797
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
1451
1798
  resetForm: () => void;
1452
1799
  submitForm: (native?: boolean) => Promise<any>;
1800
+ validate: () => Promise<string>;
1453
1801
  getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
1454
1802
  } & {} & import("@vue/runtime-core").ComponentCustomProperties & {} & {
1455
1803
  $slots: import("@tmagic/editor").FormSlots;
@@ -1468,6 +1816,8 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1468
1816
  }>, {
1469
1817
  values: Object;
1470
1818
  config: schema_d_exports.FormConfig;
1819
+ validateOnInit: boolean;
1820
+ useFieldTextInError: boolean;
1471
1821
  confirmText: string;
1472
1822
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
1473
1823
  declare const __VLS_export$27: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
@@ -1490,7 +1840,8 @@ type __VLS_Props$26 = {
1490
1840
  expandMore?: boolean;
1491
1841
  stepActive?: string | number;
1492
1842
  size?: string; /** 是否开启对比模式 */
1493
- isCompare?: boolean;
1843
+ isCompare?: boolean; /** 是否在行容器中 */
1844
+ isInRow?: boolean;
1494
1845
  };
1495
1846
  declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Props$26, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
1496
1847
  change: (v: any, eventData: ContainerChangeEventData) => any;
@@ -1571,6 +1922,7 @@ type __VLS_Props$23 = {
1571
1922
  prop?: string;
1572
1923
  size?: string;
1573
1924
  disabled?: boolean;
1925
+ hideExpand?: boolean;
1574
1926
  };
1575
1927
  declare var __VLS_16: {}, __VLS_18: {};
1576
1928
  type __VLS_Slots = {} & {
@@ -1820,7 +2172,9 @@ declare const __VLS_export$4: import("@vue/runtime-core").DefineComponent<__VLS_
1820
2172
  declare const _default$8: typeof __VLS_export$4;
1821
2173
  //#endregion
1822
2174
  //#region temp/packages/form/src/fields/Link.vue.d.ts
1823
- type __VLS_Props$3 = schema_d_exports.FieldProps<schema_d_exports.LinkConfig>;
2175
+ type __VLS_Props$3 = schema_d_exports.FieldProps<schema_d_exports.LinkConfig> & {
2176
+ theme?: string;
2177
+ };
1824
2178
  declare const __VLS_export$3: import("@vue/runtime-core").DefineComponent<__VLS_Props$3, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
1825
2179
  change: (...args: any[]) => void;
1826
2180
  }, string, import("@vue/runtime-core").PublicProps, Readonly<__VLS_Props$3> & Readonly<{
@@ -1889,16 +2243,49 @@ declare const registerField: (tagName: string, component: Component) => void;
1889
2243
  declare const getField: (tagName: string) => Component | undefined;
1890
2244
  declare const deleteField: (tagName: string) => boolean;
1891
2245
  //#endregion
2246
+ //#region temp/packages/form/src/utils/typeMatch.d.ts
2247
+ interface TypeMatchValidateContext {
2248
+ fieldType: string;
2249
+ mForm: schema_d_exports.FormState | undefined;
2250
+ props: any;
2251
+ message?: string;
2252
+ }
2253
+ /**
2254
+ * 自定义 type 校验器:返回错误文案;通过则返回 undefined。
2255
+ *
2256
+ * 支持返回 Promise,用于需要异步确认取值是否合法的场景(如请求接口校验 id 是否存在)。
2257
+ */
2258
+ type TypeMatchValidator = (value: any, context: TypeMatchValidateContext) => string | undefined | Promise<string | undefined>;
2259
+ /** 注册或覆盖某个字段 type 的 typeMatch 校验规则 */
2260
+ declare const registerTypeMatchRule: (type: string, validator: TypeMatchValidator) => void;
2261
+ /** 批量注册 typeMatch 校验规则 */
2262
+ declare const registerTypeMatchRules: (rules: Record<string, TypeMatchValidator>) => void;
2263
+ /** 获取某个字段 type 的自定义 typeMatch 校验规则 */
2264
+ declare const getTypeMatchRule: (type: string) => TypeMatchValidator | undefined;
2265
+ /** 删除某个字段 type 的自定义 typeMatch 校验规则 */
2266
+ declare const deleteTypeMatchRule: (type: string) => boolean;
2267
+ /** 清空所有自定义 typeMatch 校验规则 */
2268
+ declare const clearTypeMatchRules: () => void;
2269
+ /**
2270
+ * 校验取值与字段 type 是否匹配;通过返回 undefined,否则返回错误文案。
2271
+ *
2272
+ * 命中的自定义规则是异步校验器时返回 Promise,内置规则始终同步返回。
2273
+ */
2274
+ declare const validateTypeMatch: (value: any, mForm: schema_d_exports.FormState | undefined, props: any, message?: string) => string | undefined | Promise<string | undefined>;
2275
+ //#endregion
1892
2276
  //#region temp/packages/form/src/plugin.d.ts
1893
2277
  interface FormInstallOptions {
2278
+ flat?: boolean;
2279
+ /** 自定义字段 type 的 typeMatch 校验规则,可覆盖内置规则或扩展业务字段 */
2280
+ typeMatchRules?: Record<string, TypeMatchValidator>;
1894
2281
  [key: string]: any;
1895
2282
  }
1896
2283
  declare const _default$31: {
1897
2284
  install(app: App, opt?: FormInstallOptions): void;
1898
2285
  };
1899
2286
  declare namespace index_d_exports {
1900
- export { ChangeRecord, ContainerChangeEventData, FORM_DIFF_CONFIG_KEY, FormDiffConfig, FormInstallOptions, FormLabelSlotProps, FormSlots, _default as MCascader, _default$1 as MCheckbox, _default$2 as MCheckboxGroup, _default$3 as MColorPicker, _default$4 as MContainer, _default$5 as MDate, _default$6 as MDateTime, _default$7 as MDaterange, _default$8 as MDisplay, _default$9 as MDynamicField, _default$10 as MFieldset, _default$11 as MFlexLayout, _default$12 as MForm, _default$13 as MFormBox, _default$14 as MFormDialog, _default$15 as MFormDrawer, _default$16 as MGroupList, _default$17 as MHidden, _default$18 as MLink, _default$19 as MNumber, _default$20 as MNumberRange, _default$21 as MPanel, _default$22 as MRadioGroup, _default$23 as MRow, _default$24 as MSelect, _default$25 as MSwitch, _default$16 as MTable, _default$16 as MTableGroupList, _default$26 as MTabs, _default$27 as MText, _default$28 as MTextarea, _default$29 as MTime, _default$30 as MTimerange, SubmitFormOptions, ValidateError, createForm, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteField as deleteFormField, display, filterFunction, getDataByPage, getField as getFormField, getRules, initValue, registerField as registerFormField, sortArray, sortChange, submitForm, useAddField };
2287
+ export { ChangeRecord, ContainerChangeEventData, FORM_DIFF_CONFIG_KEY, FORM_SILENT_MODE_KEY, FORM_TYPE_MATCH_VALID_KEY, FormDiffConfig, FormInstallOptions, FormLabelSlotProps, FormSlots, _default as MCascader, _default$1 as MCheckbox, _default$2 as MCheckboxGroup, _default$3 as MColorPicker, _default$4 as MContainer, _default$5 as MDate, _default$6 as MDateTime, _default$7 as MDaterange, _default$8 as MDisplay, _default$9 as MDynamicField, _default$10 as MFieldset, _default$11 as MFlexLayout, _default$12 as MForm, _default$13 as MFormBox, _default$14 as MFormDialog, _default$15 as MFormDrawer, _default$16 as MGroupList, _default$17 as MHidden, _default$18 as MLink, _default$19 as MNumber, _default$20 as MNumberRange, _default$21 as MPanel, _default$22 as MRadioGroup, _default$23 as MRow, _default$24 as MSelect, _default$25 as MSwitch, _default$16 as MTable, _default$16 as MTableGroupList, _default$26 as MTabs, _default$27 as MText, _default$28 as MTextarea, _default$29 as MTime, _default$30 as MTimerange, SubmitFormOptions, SubmitFormResult, TypeMatchValidateContext, TypeMatchValidator, ValidateError, ValidateFormOptions, adaptFormValidator, applyExtendState, clearTypeMatchRules, createForm, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteField as deleteFormField, deleteTypeMatchRule, display, filterFunction, getDataByPage, getField as getFormField, getRules, getTypeMatchRule, initValue, registerField as registerFormField, registerTypeMatchRule, registerTypeMatchRules, sortArray, sortChange, stripTabItemsLazy, submitForm, useAddField, validateForm, validateTypeMatch };
1901
2288
  }
1902
2289
  declare const createForm: <T extends [] = []>(config: schema_d_exports.FormConfig | T) => schema_d_exports.FormConfig | T;
1903
2290
  //#endregion
1904
- export { ChangeRecord, ContainerChangeEventData, FORM_DIFF_CONFIG_KEY, FormDiffConfig, type FormInstallOptions, FormLabelSlotProps, FormSlots, _default as MCascader, _default$1 as MCheckbox, _default$2 as MCheckboxGroup, _default$3 as MColorPicker, _default$4 as MContainer, _default$5 as MDate, _default$6 as MDateTime, _default$7 as MDaterange, _default$8 as MDisplay, _default$9 as MDynamicField, _default$10 as MFieldset, _default$11 as MFlexLayout, _default$12 as MForm, _default$13 as MFormBox, _default$14 as MFormDialog, _default$15 as MFormDrawer, _default$16 as MGroupList, _default$16 as MTable, _default$16 as MTableGroupList, _default$17 as MHidden, _default$18 as MLink, _default$19 as MNumber, _default$20 as MNumberRange, _default$21 as MPanel, _default$22 as MRadioGroup, _default$23 as MRow, _default$24 as MSelect, _default$25 as MSwitch, _default$26 as MTabs, _default$27 as MText, _default$28 as MTextarea, _default$29 as MTime, _default$30 as MTimerange, SubmitFormOptions, ValidateError, createForm, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteField as deleteFormField, display, filterFunction, getDataByPage, getField as getFormField, getRules, initValue, registerField as registerFormField, sortArray, sortChange, submitForm, useAddField };
2291
+ export { ChangeRecord, ContainerChangeEventData, FORM_DIFF_CONFIG_KEY, FORM_SILENT_MODE_KEY, FORM_TYPE_MATCH_VALID_KEY, FormDiffConfig, type FormInstallOptions, FormLabelSlotProps, FormSlots, _default as MCascader, _default$1 as MCheckbox, _default$2 as MCheckboxGroup, _default$3 as MColorPicker, _default$4 as MContainer, _default$5 as MDate, _default$6 as MDateTime, _default$7 as MDaterange, _default$8 as MDisplay, _default$9 as MDynamicField, _default$10 as MFieldset, _default$11 as MFlexLayout, _default$12 as MForm, _default$13 as MFormBox, _default$14 as MFormDialog, _default$15 as MFormDrawer, _default$16 as MGroupList, _default$16 as MTable, _default$16 as MTableGroupList, _default$17 as MHidden, _default$18 as MLink, _default$19 as MNumber, _default$20 as MNumberRange, _default$21 as MPanel, _default$22 as MRadioGroup, _default$23 as MRow, _default$24 as MSelect, _default$25 as MSwitch, _default$26 as MTabs, _default$27 as MText, _default$28 as MTextarea, _default$29 as MTime, _default$30 as MTimerange, SubmitFormOptions, SubmitFormResult, type TypeMatchValidateContext, type TypeMatchValidator, ValidateError, ValidateFormOptions, adaptFormValidator, applyExtendState, clearTypeMatchRules, createForm, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteField as deleteFormField, deleteTypeMatchRule, display, filterFunction, getDataByPage, getField as getFormField, getRules, getTypeMatchRule, initValue, registerField as registerFormField, registerTypeMatchRule, registerTypeMatchRules, sortArray, sortChange, stripTabItemsLazy, submitForm, useAddField, validateForm, validateTypeMatch };