@tmagic/form 1.8.0-beta.25 → 1.8.0-beta.27

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 (131) hide show
  1. package/dist/es/Form.vue_vue_type_script_setup_true_lang.js +47 -120
  2. package/dist/es/FormBox.vue_vue_type_script_setup_true_lang.js +3 -3
  3. package/dist/es/FormDialog.vue_vue_type_script_setup_true_lang.js +3 -3
  4. package/dist/es/FormDrawer.vue_vue_type_script_setup_true_lang.js +3 -3
  5. package/dist/es/containers/Col.vue_vue_type_script_setup_true_lang.js +3 -0
  6. package/dist/es/containers/Container.vue_vue_type_script_setup_true_lang.js +36 -51
  7. package/dist/es/containers/Fieldset.vue_vue_type_script_setup_true_lang.js +6 -0
  8. package/dist/es/containers/FlexLayout.vue_vue_type_script_setup_true_lang.js +4 -1
  9. package/dist/es/containers/GroupList.vue_vue_type_script_setup_true_lang.js +37 -15
  10. package/dist/es/containers/GroupListItem.vue_vue_type_script_setup_true_lang.js +109 -97
  11. package/dist/es/containers/Panel.vue_vue_type_script_setup_true_lang.js +7 -2
  12. package/dist/es/containers/Row.vue_vue_type_script_setup_true_lang.js +3 -0
  13. package/dist/es/containers/Step.vue_vue_type_script_setup_true_lang.js +4 -1
  14. package/dist/es/containers/Tabs.vue_vue_type_script_setup_true_lang.js +7 -0
  15. package/dist/es/containers/table/Table.vue_vue_type_script_setup_true_lang.js +7 -5
  16. package/dist/es/containers/table/useTableColumns.js +5 -13
  17. package/dist/es/containers/table-group-list/TableGroupList.vue_vue_type_script_setup_true_lang.js +71 -78
  18. package/dist/es/containers/table-group-list/useAdd.js +26 -16
  19. package/dist/es/containers/table-group-list/useScrollLastItemIntoView.js +72 -0
  20. package/dist/es/fields/Cascader.vue_vue_type_script_setup_true_lang.js +1 -1
  21. package/dist/es/fields/CheckboxGroup/Index.js +5 -0
  22. package/dist/es/fields/{CheckboxGroup.vue_vue_type_script_setup_true_lang.js → CheckboxGroup/Index.vue_vue_type_script_setup_true_lang.js} +6 -7
  23. package/dist/es/fields/CheckboxGroup/effect.js +8 -0
  24. package/dist/es/fields/Date/Index.js +5 -0
  25. package/dist/es/fields/{Date.vue_vue_type_script_setup_true_lang.js → Date/Index.vue_vue_type_script_setup_true_lang.js} +5 -7
  26. package/dist/es/fields/Date/effect.js +10 -0
  27. package/dist/es/fields/DateTime/Index.js +5 -0
  28. package/dist/es/fields/{DateTime.vue_vue_type_script_setup_true_lang.js → DateTime/Index.vue_vue_type_script_setup_true_lang.js} +5 -9
  29. package/dist/es/fields/DateTime/effect.js +15 -0
  30. package/dist/es/fields/Display/Index.js +5 -0
  31. package/dist/es/fields/{Display.vue_vue_type_script_setup_true_lang.js → Display/Index.vue_vue_type_script_setup_true_lang.js} +6 -7
  32. package/dist/es/fields/Display/effect.js +8 -0
  33. package/dist/es/fields/DynamicField/Index.js +5 -0
  34. package/dist/es/fields/{DynamicField.vue_vue_type_script_setup_true_lang.js → DynamicField/Index.vue_vue_type_script_setup_true_lang.js} +11 -15
  35. package/dist/es/fields/DynamicField/effect.js +40 -0
  36. package/dist/es/fields/Link.vue_vue_type_script_setup_true_lang.js +1 -1
  37. package/dist/es/fields/Number.vue_vue_type_script_setup_true_lang.js +1 -1
  38. package/dist/es/fields/NumberRange/Index.js +5 -0
  39. package/dist/es/fields/{NumberRange.vue_vue_type_script_setup_true_lang.js → NumberRange/Index.vue_vue_type_script_setup_true_lang.js} +5 -6
  40. package/dist/es/fields/NumberRange/effect.js +8 -0
  41. package/dist/es/fields/Select.vue_vue_type_script_setup_true_lang.js +13 -6
  42. package/dist/es/fields/Text.vue_vue_type_script_setup_true_lang.js +1 -1
  43. package/dist/es/headless.js +13 -0
  44. package/dist/es/index.js +17 -12
  45. package/dist/es/plugin.js +57 -41
  46. package/dist/es/schema.js +6 -8
  47. package/dist/es/style.css +81 -1
  48. package/dist/es/submitForm.js +44 -194
  49. package/dist/es/utils/builtInFields.js +49 -0
  50. package/dist/es/utils/collectFields.js +407 -0
  51. package/dist/es/utils/config.js +1 -8
  52. package/dist/es/utils/fieldInnerConfig.js +42 -0
  53. package/dist/es/utils/fieldValueEffects.js +80 -0
  54. package/dist/es/utils/form.js +96 -43
  55. package/dist/es/utils/formStateProxy.js +111 -0
  56. package/dist/es/utils/registerField.js +158 -0
  57. package/dist/es/utils/submitHeadless.js +54 -0
  58. package/dist/es/utils/tableGroupList.js +85 -0
  59. package/dist/es/utils/typeMatch.js +17 -19
  60. package/dist/es/utils/validateError.js +57 -0
  61. package/dist/es/utils/validateValues.js +115 -0
  62. package/dist/style.css +81 -1
  63. package/dist/themes/magic-admin.css +83 -7
  64. package/dist/tmagic-form-headless.umd.cjs +4080 -0
  65. package/dist/tmagic-form.umd.cjs +2020 -876
  66. package/package.json +10 -4
  67. package/src/Form.vue +49 -149
  68. package/src/FormBox.vue +5 -4
  69. package/src/FormDialog.vue +5 -5
  70. package/src/FormDrawer.vue +5 -5
  71. package/src/containers/Col.vue +2 -0
  72. package/src/containers/Container.vue +86 -157
  73. package/src/containers/Fieldset.vue +5 -0
  74. package/src/containers/FlexLayout.vue +2 -0
  75. package/src/containers/GroupList.vue +41 -11
  76. package/src/containers/GroupListItem.vue +83 -80
  77. package/src/containers/Panel.vue +3 -0
  78. package/src/containers/Row.vue +2 -0
  79. package/src/containers/Step.vue +2 -0
  80. package/src/containers/Tabs.vue +13 -0
  81. package/src/containers/table/ActionsColumn.vue +1 -1
  82. package/src/containers/table/Table.vue +4 -3
  83. package/src/containers/table/usePagination.ts +1 -1
  84. package/src/containers/table/useSortable.ts +1 -1
  85. package/src/containers/table/useTableColumns.ts +9 -19
  86. package/src/containers/table-group-list/TableGroupList.vue +43 -71
  87. package/src/containers/table-group-list/useAdd.ts +40 -25
  88. package/src/containers/table-group-list/useScrollLastItemIntoView.ts +94 -0
  89. package/src/fields/{CheckboxGroup.vue → CheckboxGroup/Index.vue} +3 -8
  90. package/src/fields/CheckboxGroup/effect.ts +27 -0
  91. package/src/fields/{Date.vue → Date/Index.vue} +2 -5
  92. package/src/fields/Date/effect.ts +29 -0
  93. package/src/fields/{DateTime.vue → DateTime/Index.vue} +2 -16
  94. package/src/fields/DateTime/effect.ts +36 -0
  95. package/src/fields/{Display.vue → Display/Index.vue} +3 -7
  96. package/src/fields/Display/effect.ts +28 -0
  97. package/src/fields/{DynamicField.vue → DynamicField/Index.vue} +11 -11
  98. package/src/fields/DynamicField/effect.ts +74 -0
  99. package/src/fields/{NumberRange.vue → NumberRange/Index.vue} +2 -6
  100. package/src/fields/NumberRange/effect.ts +27 -0
  101. package/src/fields/Select.vue +13 -4
  102. package/src/headless.ts +78 -0
  103. package/src/index.ts +32 -15
  104. package/src/plugin.ts +63 -42
  105. package/src/schema.ts +6 -8
  106. package/src/submitForm.ts +81 -409
  107. package/src/theme/group-list.scss +107 -1
  108. package/src/theme/themes/magic-admin/index.scss +2 -8
  109. package/src/utils/builtInFields.ts +69 -0
  110. package/src/utils/collectFields.ts +561 -0
  111. package/src/utils/config.ts +1 -15
  112. package/src/utils/fieldInnerConfig.ts +127 -0
  113. package/src/utils/fieldValueEffects.ts +140 -0
  114. package/src/utils/form.ts +141 -75
  115. package/src/utils/formStateProxy.ts +149 -0
  116. package/src/utils/registerField.ts +308 -0
  117. package/src/utils/submitHeadless.ts +206 -0
  118. package/src/utils/tableGroupList.ts +120 -0
  119. package/src/utils/typeMatch.ts +19 -15
  120. package/src/utils/validateError.ts +92 -0
  121. package/src/utils/validateValues.ts +177 -0
  122. package/types/headless.d.ts +682 -0
  123. package/types/index.d.ts +631 -272
  124. package/dist/es/fields/CheckboxGroup.js +0 -5
  125. package/dist/es/fields/Date.js +0 -5
  126. package/dist/es/fields/DateTime.js +0 -5
  127. package/dist/es/fields/Display.js +0 -5
  128. package/dist/es/fields/DynamicField.js +0 -5
  129. package/dist/es/fields/NumberRange.js +0 -5
  130. package/dist/es/utils/silentLeafFieldTypes.js +0 -49
  131. package/src/utils/silentLeafFieldTypes.ts +0 -71
package/types/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { App, AppContext, Component, ComputedRef, InjectionKey } from "vue";
2
- import { FlexLayoutConfig, FormItemConfig, GroupListConfig, TableConfig } from "@tmagic/form-schema";
1
+ import { App, AppContext, Component, ComputedRef, InjectionKey, MaybeRef, Ref } from "vue";
2
+ import { FlexLayoutConfig, FormContext, FormItemConfig, GroupListConfig, TableConfig } from "@tmagic/form-schema";
3
3
  export * from "@tmagic/form-schema";
4
4
  declare namespace schema_d_exports {
5
- export { ChangeRecord, ContainerChangeEventData, FORM_DIFF_CONFIG_KEY, FORM_SILENT_MODE_KEY, FORM_TYPE_MATCH_VALID_KEY, FormDiffConfig, FormLabelSlotProps, FormSlots, ValidateError };
5
+ export { ChangeRecord, ContainerChangeEventData, FORM_CONTEXT_KEY, FORM_DIFF_CONFIG_KEY, FORM_TYPE_MATCH_VALID_KEY, FormDiffConfig, FormLabelSlotProps, FormSlots, ValidateError };
6
6
  }
7
7
  import * as import__tmagic_form_schema from "@tmagic/form-schema";
8
8
  /**
@@ -33,16 +33,14 @@ interface FormDiffConfig {
33
33
  declare const FORM_DIFF_CONFIG_KEY: InjectionKey<FormDiffConfig>;
34
34
  declare const FORM_TYPE_MATCH_VALID_KEY: InjectionKey<ComputedRef<boolean>>;
35
35
  /**
36
- * 静默模式标记,由 `submitForm` / `validateForm` 以隐藏方式挂载临时表单时 provide(debug 弹层模式不提供)。
36
+ * 宿主业务上下文,由 `MForm`(或更外层的 Editor)通过 `provide` 下发。
37
37
  *
38
- * Container 会基于该标记,并对照 `getSilentLeafFieldTypes()`(默认 `LEAF_FIELD_TYPES`)
39
- * 跳过叶子字段的渲染,只保留 FormItem:字段校验由 FormItem 基于 model 值完成,与叶子 UI 组件实例无关。
40
- * 重型字段组件(如 vs-code)也可 inject 该标记跳过自身渲染,省去无谓的实例化开销。
38
+ * 嵌套表单(Link 子表单、FormBox、临时校验表单等)会自动继承最近祖先的 context,
39
+ * 无需层层透传。
41
40
  *
42
- * 注意:仅「挂载无值副作用」(不在 onMounted/watch immediate 中 emit change、不依赖 DOM 计算值)的
43
- * 字段组件可以安全跳过,接入前需逐一审计;业务扩展请使用 `registerSilentLeafFieldTypes`。
41
+ * 配置回调统一通过 `mForm.xxx` 读取,由 formState 的读穿 Proxy 落到这里。
44
42
  */
45
- declare const FORM_SILENT_MODE_KEY: InjectionKey<boolean>;
43
+ declare const FORM_CONTEXT_KEY: InjectionKey<ComputedRef<FormContext>>;
46
44
  interface ValidateError {
47
45
  message: string;
48
46
  field: string;
@@ -73,7 +71,68 @@ interface FormSlots {
73
71
  label(_props: FormLabelSlotProps): any;
74
72
  }
75
73
  //#endregion
76
- //#region temp/packages/form/src/submitForm.d.ts
74
+ //#region temp/packages/form/src/utils/validateValues.d.ts
75
+ /** 构造无渲染 formState 所需的参数(与 MForm 的同名 props 对齐) */
76
+ interface HeadlessFormStateOptions {
77
+ config: schema_d_exports.FormConfig;
78
+ initValues?: schema_d_exports.FormValue;
79
+ parentValues?: schema_d_exports.FormValue;
80
+ keyProp?: string;
81
+ popperClass?: string;
82
+ /** 宿主业务上下文,与 MForm 的同名 prop 语义一致 */
83
+ context?: schema_d_exports.FormContext;
84
+ }
85
+ /**
86
+ * 构造一个不依赖组件实例的 `formState`。
87
+ *
88
+ * 字段结构与 `Form.vue` 中 provide 给子树的 `mForm` 保持一致,使配置里的
89
+ * `display` / `rules.validator` / `filter` 等回调拿到的上下文与渲染式校验相同。
90
+ *
91
+ * 差异:没有真实的表单实例,因此 `$emit` 为空实现、`fields` 注册表始终为空
92
+ * (该注册表在整个仓库中只写不读,不参与校验)。
93
+ */
94
+ declare const createHeadlessFormState: (options: HeadlessFormStateOptions) => schema_d_exports.FormState;
95
+ /** `validateValues` 参数 */
96
+ interface ValidateValuesOptions extends HeadlessFormStateOptions {
97
+ /** 是否开启类型匹配校验 */
98
+ typeMatchValid?: boolean;
99
+ /**
100
+ * 校验失败时错误提示前缀是否使用字段的 text 文案。默认 `true`。
101
+ */
102
+ useFieldTextInError?: boolean;
103
+ }
104
+ /** `validateValues` 结果 */
105
+ interface ValidateValuesResult {
106
+ /** 经 `initValue` 初始化并执行字段值初始化写入后的表单值 */
107
+ values: schema_d_exports.FormValue;
108
+ /** 汇总后的错误文案(多条以 `<br>` 拼接),校验通过为空字符串 */
109
+ error: string;
110
+ /** 原始错误映射,形如 `{ [prop]: [{ field, message }] }` */
111
+ invalidFields: Record<string, any>;
112
+ }
113
+ /**
114
+ * 不挂载任何组件,纯逻辑地对「一份 config + 一份值」执行一次完整校验。
115
+ *
116
+ * 流程与渲染式校验一一对应,但不需要 DOM,也不会实例化任何字段组件:
117
+ *
118
+ * 1. 构造 headless `formState` 并挂上 `context` 读穿;
119
+ * 2. `initValue` 初始化表单值(默认值、嵌套结构、`onInitValue` 等);
120
+ * 3. `applyMountValueEffects` 执行字段登记的值初始化写入(与渲染式共用同一份登记表);
121
+ * 4. 遍历 config 树收集所有带规则的字段(等价于渲染出的 FormItem 集合);
122
+ * 5. 逐字段交给 async-validator 执行,汇总错误文案。
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * const { error, values } = await validateValues({
127
+ * config: [...],
128
+ * initValues: { name: '' },
129
+ * typeMatchValid: true,
130
+ * });
131
+ * ```
132
+ */
133
+ declare const validateValues: (options: ValidateValuesOptions) => Promise<ValidateValuesResult>;
134
+ //#endregion
135
+ //#region temp/packages/form/src/utils/submitHeadless.d.ts
77
136
  /**
78
137
  * submitForm 函数参数(与 Form.vue 组件 props 对齐)
79
138
  */
@@ -93,7 +152,7 @@ interface SubmitFormOptions {
93
152
  stepActive?: string | number;
94
153
  size?: 'small' | 'default' | 'large';
95
154
  inline?: boolean;
96
- labelPosition?: string;
155
+ labelPosition?: 'top' | 'left' | 'right';
97
156
  keyProp?: string;
98
157
  popperClass?: string;
99
158
  preventSubmitDefault?: boolean;
@@ -102,7 +161,8 @@ interface SubmitFormOptions {
102
161
  * 默认 `true`,置为 `false` 时直接使用字段 name。
103
162
  */
104
163
  useFieldTextInError?: boolean;
105
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
164
+ /** 宿主业务上下文,与 MForm 的同名 prop 语义一致 */
165
+ context?: schema_d_exports.FormContext;
106
166
  /** 透传给 Form.submitForm 的参数:是否直接返回原始响应式 values */
107
167
  native?: boolean;
108
168
  /**
@@ -112,29 +172,27 @@ interface SubmitFormOptions {
112
172
  returnChangeRecords?: boolean;
113
173
  /**
114
174
  * 父级应用上下文,用于继承全局组件、指令、provide 等。
115
- * 通常通过 `app._context` 或 `getCurrentInstance()?.appContext` 获取。
175
+ * 仅 `dialog: true` 时生效。`@tmagic/form/headless` 不支持弹层。
116
176
  */
117
177
  appContext?: AppContext | null;
118
- /** 等待表单初始化的最长时间(毫秒),超时将以错误 reject。默认 10000ms */
119
- timeout?: number;
120
178
  /**
121
- * 调试模式。默认 `false`。
179
+ * 是否以弹层展示表单。默认 `false`。
122
180
  *
123
- * - `false`:表单以隐藏方式挂载,初始化完成后自动提交(原有行为)。
124
- * - `true`:将表单以弹层形式可见地渲染在页面上,需手动点击「确定」才会触发校验/提交,
125
- * 点击「取消」则以 reject 中断;校验失败时保留弹层并展示错误信息,便于修正后重试。
126
- * 调试模式下 `timeout` 不生效(等待人工操作)。
181
+ * `@tmagic/form/headless` 不支持 `dialog: true`,请从 `@tmagic/form` 引入。
182
+ */
183
+ dialog?: boolean;
184
+ /**
185
+ * 弹层标题,仅 `dialog: true` 时生效。
127
186
  */
128
- debug?: boolean;
187
+ title?: string;
129
188
  typeMatchValid?: boolean;
130
189
  /**
131
- * 外部中断信号。abort 时会立即以 `signal.reason` reject 并卸载临时表单实例、移除容器。
132
- * 主要用于 `debug` 模式(无超时兜底)下取消一个被放弃的表单弹层,避免其无限驻留在页面上。
190
+ * 外部中断信号。abort 时会立即以 `signal.reason` reject。
133
191
  */
134
192
  signal?: AbortSignal;
135
193
  }
136
194
  /**
137
- * 开启 `returnChangeNodes` 时 submitForm 的返回结果
195
+ * 开启 `returnChangeRecords` 时 submitForm 的返回结果
138
196
  */
139
197
  interface SubmitFormResult {
140
198
  /** 校验通过后的表单值 */
@@ -142,43 +200,6 @@ interface SubmitFormResult {
142
200
  /** 表单变更记录 */
143
201
  changeRecords: ChangeRecord[];
144
202
  }
145
- /**
146
- * 以命令式方式调用 Form.vue 完成一次表单校验/提交。
147
- *
148
- * 类似 ElMessage 的用法:传入 props(包含 `config`/`initValues` 等),函数内部会临时挂载
149
- * 一个不可见的 Form 组件实例,等待初始化完成后调用其 `submitForm` 方法,
150
- * 校验通过则 resolve 表单值,校验失败则 reject 错误信息,最后自动卸载实例。
151
- *
152
- * @example
153
- * ```ts
154
- * import { submitForm } from '@tmagic/form';
155
- *
156
- * try {
157
- * const values = await submitForm({
158
- * config: [...],
159
- * initValues: { name: 'foo' },
160
- * });
161
- * console.log(values);
162
- * } catch (e) {
163
- * console.error(e);
164
- * }
165
- *
166
- * // 需要同时获取变更记录时:
167
- * const { values, changeRecords } = await submitForm({
168
- * config: [...],
169
- * initValues: { name: 'foo' },
170
- * returnChangeRecords: true,
171
- * });
172
- *
173
- * // 调试模式:可见地渲染表单,点击「确定」才提交:
174
- * const values = await submitForm({
175
- * config: [...],
176
- * initValues: { name: 'foo' },
177
- * debug: true,
178
- * });
179
- * ```
180
- */
181
- declare const submitForm: (options: SubmitFormOptions) => Promise<any>;
182
203
  /**
183
204
  * validateForm 函数参数(与 Form.vue 组件 props 对齐,取校验所需子集)
184
205
  */
@@ -195,30 +216,30 @@ interface ValidateFormOptions {
195
216
  * 默认 `true`,置为 `false` 时直接使用字段 name。
196
217
  */
197
218
  useFieldTextInError?: boolean;
198
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
219
+ /** 宿主业务上下文,与 MForm 的同名 prop 语义一致 */
220
+ context?: schema_d_exports.FormContext;
199
221
  /**
200
- * 父级应用上下文,用于继承全局组件、指令、provide 等。
201
- * 通常通过 `app._context` 或 `getCurrentInstance()?.appContext` 获取。
222
+ * 父级应用上下文。仅 `dialog: true` 时生效。`@tmagic/form/headless` 不支持弹层。
202
223
  */
203
224
  appContext?: AppContext | null;
204
- /** 等待表单初始化的最长时间(毫秒),超时将以错误 reject。默认 10000ms */
205
- timeout?: number;
206
225
  /**
207
- * 调试模式。默认 `false`。
226
+ * 是否以弹层展示表单。默认 `false`。
208
227
  *
209
- * - `false`:以隐藏方式挂载,初始化完成后自动校验并 resolve 错误文案(原有静默行为)。
210
- * - `true`:将表单以弹层形式可见地渲染在页面上,需手动点击「确定」才会触发校验,
211
- * 点击「取消」则以 reject 中断;校验失败时在弹层内展示错误信息并保留弹层,便于修正后重试,
212
- * 校验通过则 resolve 空字符串。调试模式下 `timeout` 不生效(等待人工操作)。
228
+ * `@tmagic/form/headless` 不支持 `dialog: true`,请从 `@tmagic/form` 引入。
229
+ */
230
+ dialog?: boolean;
231
+ /**
232
+ * 弹层标题,仅 `dialog: true` 时生效。
213
233
  */
214
- debug?: boolean;
234
+ title?: string;
215
235
  typeMatchValid?: boolean;
216
236
  /**
217
- * 外部中断信号。abort 时会立即以 `signal.reason` reject 并卸载临时表单实例、移除容器。
218
- * 主要用于 `debug` 模式(无超时兜底)下取消一个被放弃的表单弹层,避免其无限驻留在页面上。
237
+ * 外部中断信号。abort 时会立即以 `signal.reason` reject。
219
238
  */
220
239
  signal?: AbortSignal;
221
240
  }
241
+ //#endregion
242
+ //#region temp/packages/form/src/submitForm.d.ts
222
243
  /**
223
244
  * 返回一份去除了 tab 标签页 lazy 的配置副本。
224
245
  *
@@ -228,43 +249,39 @@ interface ValidateFormOptions {
228
249
  */
229
250
  declare const stripTabItemsLazy: (config: schema_d_exports.FormConfig) => schema_d_exports.FormConfig;
230
251
  /**
231
- * 以命令式方式对一份「表单配置 + 值」做一次静默校验,**不依赖也不影响任何已渲染的表单**。
252
+ * 以命令式方式对一份「表单配置 + 值」做一次校验并取回表单值。
232
253
  *
233
- * 与 `submitForm` 类似,内部会临时挂载一个不可见的 MForm 实例,等待其初始化完成后调用
234
- * 实例的 `validate` 方法,返回汇总后的错误文案,随后自动卸载实例。
235
- *
236
- * 与 `submitForm` 的区别:
237
- * - 「静默」:校验失败不抛异常、不触发 `error` 事件、不返回表单值;
238
- * - 仅用于「探测」配置是否合法,适合源码保存后校验、批量校验组件配置等场景。
239
- *
240
- * 由于每次都新建一个独立的 MForm 实例,调用方无需持有任何表单 ref,也不会污染
241
- * 页面上正在展示的表单状态。
254
+ * 默认走无渲染实现(见 `@tmagic/form/headless`)。`dialog: true` 会把表单以弹层渲染出来。
255
+ */
256
+ declare const submitForm: (options: SubmitFormOptions) => Promise<any>;
257
+ /**
258
+ * 以命令式方式对一份「表单配置 + 值」做一次静默校验。
242
259
  *
243
- * @returns 校验通过返回空字符串 `''`,否则返回以 `<br>` 拼接的错误文案。
244
- * 仅在初始化超时或挂载失败等异常情况下才会 reject。
260
+ * 默认走无渲染实现。`dialog: true` 的处理详见 `submitForm`。
261
+ */
262
+ declare const validateForm: (options: ValidateFormOptions) => Promise<string>;
263
+ //#endregion
264
+ //#region temp/packages/form/src/utils/formStateProxy.d.ts
265
+ /**
266
+ * 按优先级分层合并上下文,**靠后的层优先**。
245
267
  *
246
- * @example
247
- * ```ts
248
- * import { validateForm } from '@tmagic/form';
268
+ * 用读穿 Proxy 而非 `{ ...a, ...b }`:展开会立即执行 accessor,
269
+ * 而宿主允许用 `{ get stage() { ... } }` 这类读时求值的描述符。
270
+ */
271
+ declare const mergeFormContexts: (...layers: (schema_d_exports.FormContext | undefined | null)[]) => schema_d_exports.FormContext;
272
+ /**
273
+ * 将 coreState 与宿主业务上下文关联:读取时优先 core,miss 再读穿到 context。
249
274
  *
250
- * const error = await validateForm({
251
- * config: [...],
252
- * initValues: { name: 'foo' },
253
- * appContext: getCurrentInstance()?.appContext,
254
- * });
255
- * if (error) {
256
- * // 配置不合法,error 为错误文案
257
- * }
275
+ * - `get` 用属性访问而非 `Reflect.get(t, k, receiver)`,避免破坏 Vue reactive 的 `__v_raw`;
276
+ * - symbol 键一律只走 core,四个 trap 保持一致。context 是业务数据袋,不承载 symbol 键,
277
+ * 把 Vue / 工具链的内部 symbol 隔离在 core 上才能让 `toRaw` / `isReactive` 判定正确;
278
+ * - `ownKeys` + `getOwnPropertyDescriptor` 保证 `Object.entries(formState)` 能枚举到扩展字段
279
+ * (admin-web-next 的 `pickPanelFormStateExtendFields` 依赖此语义);
280
+ * - `set` 写入 coreState,第三方 `formState.xxx = v` 仍生效且优先于 context。
258
281
  *
259
- * // 调试模式:可见地渲染表单,点击「确定」才校验,校验失败保留弹层可修正重试:
260
- * const error = await validateForm({
261
- * config: [...],
262
- * initValues: { name: 'foo' },
263
- * debug: true,
264
- * });
265
- * ```
282
+ * 独立成文件,避免与 `form.ts` ↔ `typeMatch.ts` 形成循环依赖。
266
283
  */
267
- declare const validateForm: (options: ValidateFormOptions) => Promise<string>;
284
+ declare const createFormStateProxy: (coreState: schema_d_exports.FormState, getContext: (() => schema_d_exports.FormContext) | Ref<schema_d_exports.FormContext>) => schema_d_exports.FormState;
268
285
  //#endregion
269
286
  //#region temp/packages/form/src/utils/form.d.ts
270
287
  type AsyncValidatorFn = (rule: any, value: any, callback: Function, source?: any, options?: any) => any;
@@ -274,9 +291,54 @@ type AsyncValidatorFn = (rule: any, value: any, callback: Function, source?: any
274
291
  */
275
292
  declare const adaptFormValidator: (validator: AsyncValidatorFn) => AsyncValidatorFn;
276
293
  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;
294
+ declare const createFormStateBase: (ui?: {
295
+ $message?: any;
296
+ $messageBox?: any;
297
+ }) => {
298
+ fields: Map<string, any>;
299
+ setField: (prop: string, field: any) => Map<string, any>;
300
+ getField: (prop: string) => any;
301
+ deleteField: (prop: string) => boolean;
302
+ $messageBox: any;
303
+ $message: any;
304
+ post: (options: any) => any;
305
+ };
306
+ /**
307
+ * 配置项的 `name` 是否可用于从 model 中下钻取值。
308
+ *
309
+ * 供 `Container.vue` 与无渲染校验(`collectValidatableFields`)共用,两者对「该不该下钻」
310
+ * 的判断必须一致。
311
+ */
312
+ declare const isValidName: (name: unknown) => boolean;
313
+ /**
314
+ * 在 `prop` 后追加一段路径。
315
+ *
316
+ * 用于容器把 `prop` 透传给子级时再拼上索引 / key(如 group-list 的行、table 的行)。
317
+ */
318
+ declare const appendProp: (prop: string | undefined, key: string | number) => string;
319
+ /**
320
+ * 由父级 `prop` 与配置项 `name` 拼出该配置项的完整 `prop`(即 FormItem 的 prop)。
321
+ *
322
+ * 调用方传入的 name 已按 `config.name || ''` 归一化,空 name 表示该配置项不占据值路径上的一层,
323
+ * 此时沿用父级 `prop`。
324
+ */
325
+ declare const getItemProp: (prop?: string | undefined, name?: string | number | undefined) => string;
326
+ /**
327
+ * 归一化配置项的 `type`:求值动态 type、剥离容器语义的 type、驼峰转中划线、补默认值。
328
+ *
329
+ * 供 `Container.vue` 与无渲染校验共用,保证两者分派到的 type 完全一致。
330
+ */
331
+ declare const resolveItemType: (mForm: schema_d_exports.FormState | undefined, config: any, props: any) => string;
277
332
  declare const filterFunction: <T = any>(mForm: schema_d_exports.FormState | undefined, config: T | schema_d_exports.FilterFunction<T> | undefined, props: any) => T | undefined;
278
333
  declare const display: (mForm: schema_d_exports.FormState | undefined, config: any, props: any) => any;
279
- 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[];
334
+ declare const getRules: (mForm: schema_d_exports.FormState | undefined, r: (schema_d_exports.Rule[] | schema_d_exports.Rule) | undefined, props: any, typeMatchValid?: MaybeRef<boolean>) => schema_d_exports.Rule[];
335
+ /**
336
+ * 与 `getRules` 相同,但 validator 保持 async-validator(Element Plus)原生签名,不做 UI 库适配。
337
+ *
338
+ * 供无渲染校验(`validateValues`)使用:它直接把规则交给 async-validator 执行,
339
+ * 不经过 TDesign 的 `validator(val)` 调用约定,因此不能套 `adaptFormValidator`。
340
+ */
341
+ declare const getNativeRules: (mForm: schema_d_exports.FormState | undefined, r: (schema_d_exports.Rule[] | schema_d_exports.Rule) | undefined, props: any, typeMatchValid?: MaybeRef<boolean>) => schema_d_exports.Rule[];
280
342
  declare const initValue: (mForm: schema_d_exports.FormState | undefined, { initValues, config }: {
281
343
  initValues: schema_d_exports.FormValue;
282
344
  config: schema_d_exports.FormConfig;
@@ -285,31 +347,13 @@ declare const datetimeFormatter: (v: string | Date, defaultValue?: string, forma
285
347
  declare const getDataByPage: (data: any[] | undefined, pagecontext: number, pagesize: number) => any[];
286
348
  declare const sortArray: (data: any[], newIndex: number, oldIndex: number, sortKey?: string) => any[];
287
349
  declare const sortChange: (data: any[], { prop, order }: schema_d_exports.SortProp) => void;
288
- /**
289
- * 将 extendState 返回的扩展字段合并进 formState。
290
- *
291
- * - data 描述符(普通字段)通过 `formState[key] = value` 写入,走 reactive proxy 的 set,
292
- * 触发依赖通知;
293
- * - accessor 描述符(`{ get stage() { return ... } }`)按原样 defineProperty,调用方
294
- * 可控制读时求值;强制 `configurable: true` 以便下一次合并可再 define。
295
- *
296
- * 注意:extendState 只能向 formState「新增」字段,不允许覆盖其已有 key。
297
- * 调用方可通过 `reservedKeys` 传入合并前已存在的内置 key 快照(keyProp / popperClass /
298
- * config / initValues / isCompare / lastValues / parentValues / values / $emit / fields /
299
- * post 等),命中这些 key 时统一跳过并告警。
300
- *
301
- * 兜底:未传 `reservedKeys` 时,仍会拦截 props 派生的只读 getter 字段(无 setter),
302
- * 否则以普通字段形式赋值会让 proxy 的 set trap 抛出
303
- * `TypeError: 'set' on proxy: trap returned falsish`。
304
- */
305
- declare const applyExtendState: (formState: schema_d_exports.FormState, state: Record<string, any> | null | undefined, reservedKeys?: Set<string | symbol>) => void;
306
350
  declare const createObjectProp: (prop: string, key: string, name?: string | number) => string;
307
351
  //#endregion
308
352
  //#region temp/packages/form/src/utils/useAddField.d.ts
309
353
  declare const useAddField: (prop?: string) => void;
310
354
  //#endregion
311
355
  //#region temp/packages/form/src/Form.vue.d.ts
312
- type __VLS_Slots$5 = FormSlots;
356
+ type __VLS_Slots$6 = FormSlots;
313
357
  type __VLS_Props$30 = {
314
358
  /** 表单配置 */
315
359
  config: schema_d_exports.FormConfig;
@@ -335,7 +379,7 @@ type __VLS_Props$30 = {
335
379
  stepActive?: string | number;
336
380
  size?: 'small' | 'default' | 'large';
337
381
  inline?: boolean;
338
- labelPosition?: string;
382
+ labelPosition?: 'top' | 'left' | 'right';
339
383
  keyProp?: string;
340
384
  popperClass?: string;
341
385
  preventSubmitDefault?: boolean;
@@ -346,7 +390,12 @@ type __VLS_Props$30 = {
346
390
  * - `false`:跳过查找,直接使用字段 name 作为错误提示前缀(形如 `字段name -> 错误信息`)。
347
391
  */
348
392
  useFieldTextInError?: boolean;
349
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
393
+ /**
394
+ * 宿主业务上下文。也可由祖先 `provide(FORM_CONTEXT_KEY)` 下发,本 prop 覆盖祖先的同名字段。
395
+ *
396
+ * 配置回调通过 `mForm.xxx` 读取,由 formState 的读穿 Proxy 落到这里。
397
+ */
398
+ context?: schema_d_exports.FormContext;
350
399
  /**
351
400
  * 自定义"是否展示对比内容"的判断函数(仅在 `isCompare === true` 时生效)。
352
401
  *
@@ -388,7 +437,7 @@ type __VLS_Props$30 = {
388
437
  */
389
438
  theme?: string;
390
439
  };
391
- declare const __VLS_base$5: import("@vue/runtime-core").DefineComponent<__VLS_Props$30, {
440
+ declare const __VLS_base$6: import("@vue/runtime-core").DefineComponent<__VLS_Props$30, {
392
441
  values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
393
442
  lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
394
443
  formState: schema_d_exports.FormState;
@@ -431,7 +480,7 @@ declare const __VLS_base$5: import("@vue/runtime-core").DefineComponent<__VLS_Pr
431
480
  disabled: boolean;
432
481
  labelWidth: string;
433
482
  inline: boolean;
434
- labelPosition: string;
483
+ labelPosition: "top" | "left" | "right";
435
484
  config: schema_d_exports.FormConfig;
436
485
  height: string;
437
486
  initValues: Record<string, any>;
@@ -439,13 +488,13 @@ declare const __VLS_base$5: import("@vue/runtime-core").DefineComponent<__VLS_Pr
439
488
  isCompare: boolean;
440
489
  keyProp: string;
441
490
  parentValues: Record<string, any>;
491
+ useFieldTextInError: boolean;
442
492
  stepActive: string | number;
443
493
  validateOnInit: boolean;
444
- useFieldTextInError: boolean;
445
494
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
446
- declare const __VLS_export$30: __VLS_WithSlots$5<typeof __VLS_base$5, __VLS_Slots$5>;
495
+ declare const __VLS_export$30: __VLS_WithSlots$6<typeof __VLS_base$6, __VLS_Slots$6>;
447
496
  declare const _default$12: typeof __VLS_export$30;
448
- type __VLS_WithSlots$5<T, S> = T & {
497
+ type __VLS_WithSlots$6<T, S> = T & {
449
498
  new (): {
450
499
  $slots: S;
451
500
  };
@@ -466,7 +515,7 @@ type __VLS_Props$29 = {
466
515
  disabled?: boolean;
467
516
  title?: string;
468
517
  inline?: boolean;
469
- labelPosition?: string;
518
+ labelPosition?: 'top' | 'left' | 'right';
470
519
  zIndex?: number;
471
520
  size?: 'small' | 'default' | 'large';
472
521
  confirmText?: string;
@@ -478,8 +527,8 @@ type __VLS_Props$29 = {
478
527
  showCancel?: boolean;
479
528
  /** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
480
529
  useFieldTextInError?: boolean;
481
- /** 透传给内部 `MForm`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
482
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
530
+ /** 透传给内部 `MForm` 的宿主业务上下文 */
531
+ context?: schema_d_exports.FormContext;
483
532
  /**
484
533
  * 主题名。优先级:传入 `theme` prop > 祖先 `provide(M_THEME_KEY)` > 空串。
485
534
  * 计算结果会再次 `provide` 出去,使得 Dialog 被 Teleport 到 body 后,内部子树
@@ -488,14 +537,14 @@ type __VLS_Props$29 = {
488
537
  theme?: string;
489
538
  };
490
539
  declare var __VLS_19: {}, __VLS_34: {}, __VLS_42: {};
491
- type __VLS_Slots$4 = {} & {
540
+ type __VLS_Slots$5 = {} & {
492
541
  default?: (props: typeof __VLS_19) => any;
493
542
  } & {
494
543
  left?: (props: typeof __VLS_34) => any;
495
544
  } & {
496
545
  footer?: (props: typeof __VLS_42) => any;
497
546
  };
498
- declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Props$29, {
547
+ declare const __VLS_base$5: import("@vue/runtime-core").DefineComponent<__VLS_Props$29, {
499
548
  form: import("@vue/reactivity").Ref<({
500
549
  $: import("@vue/runtime-core").ComponentInternalInstance;
501
550
  $data: {};
@@ -513,12 +562,12 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
513
562
  readonly stepActive?: string | number | undefined;
514
563
  readonly size?: "small" | "default" | "large" | undefined;
515
564
  readonly inline?: boolean | undefined;
516
- readonly labelPosition?: string | undefined;
565
+ readonly labelPosition?: "top" | "left" | "right" | undefined;
517
566
  readonly keyProp?: string | undefined;
518
567
  readonly popperClass?: string | undefined;
519
568
  readonly preventSubmitDefault?: boolean | undefined;
520
569
  readonly useFieldTextInError?: boolean | undefined;
521
- readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
570
+ readonly context?: schema_d_exports.FormContext | undefined;
522
571
  readonly showDiff?: ((_data: {
523
572
  curValue: any;
524
573
  lastValue: any;
@@ -558,12 +607,12 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
558
607
  stepActive?: string | number;
559
608
  size?: "small" | "default" | "large";
560
609
  inline?: boolean;
561
- labelPosition?: string;
610
+ labelPosition?: "top" | "left" | "right";
562
611
  keyProp?: string;
563
612
  popperClass?: string;
564
613
  preventSubmitDefault?: boolean;
565
614
  useFieldTextInError?: boolean;
566
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
615
+ context?: schema_d_exports.FormContext;
567
616
  showDiff?: (_data: {
568
617
  curValue: any;
569
618
  lastValue: any;
@@ -580,7 +629,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
580
629
  }>, {
581
630
  values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
582
631
  lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
583
- formState: schema_d_exports.FormState;
632
+ formState: import("@tmagic/form-schema").FormState;
584
633
  initialized: import("@vue/reactivity").Ref<boolean, boolean>;
585
634
  changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
586
635
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -598,7 +647,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
598
647
  disabled: boolean;
599
648
  labelWidth: string;
600
649
  inline: boolean;
601
- labelPosition: string;
650
+ labelPosition: "top" | "left" | "right";
602
651
  config: schema_d_exports.FormConfig;
603
652
  height: string;
604
653
  initValues: Record<string, any>;
@@ -606,9 +655,9 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
606
655
  isCompare: boolean;
607
656
  keyProp: string;
608
657
  parentValues: Record<string, any>;
658
+ useFieldTextInError: boolean;
609
659
  stepActive: string | number;
610
660
  validateOnInit: boolean;
611
- useFieldTextInError: boolean;
612
661
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
613
662
  beforeCreate?: (() => void) | (() => void)[];
614
663
  created?: (() => void) | (() => void)[];
@@ -633,7 +682,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
633
682
  disabled: boolean;
634
683
  labelWidth: string;
635
684
  inline: boolean;
636
- labelPosition: string;
685
+ labelPosition: "top" | "left" | "right";
637
686
  config: schema_d_exports.FormConfig;
638
687
  height: string;
639
688
  initValues: Record<string, any>;
@@ -641,9 +690,9 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
641
690
  isCompare: boolean;
642
691
  keyProp: string;
643
692
  parentValues: Record<string, any>;
693
+ useFieldTextInError: boolean;
644
694
  stepActive: string | number;
645
695
  validateOnInit: boolean;
646
- useFieldTextInError: boolean;
647
696
  }> & Omit<Readonly<{
648
697
  config: schema_d_exports.FormConfig;
649
698
  initValues: Record<string, any>;
@@ -658,12 +707,12 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
658
707
  stepActive?: string | number;
659
708
  size?: "small" | "default" | "large";
660
709
  inline?: boolean;
661
- labelPosition?: string;
710
+ labelPosition?: "top" | "left" | "right";
662
711
  keyProp?: string;
663
712
  popperClass?: string;
664
713
  preventSubmitDefault?: boolean;
665
714
  useFieldTextInError?: boolean;
666
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
715
+ context?: schema_d_exports.FormContext;
667
716
  showDiff?: (_data: {
668
717
  curValue: any;
669
718
  lastValue: any;
@@ -677,10 +726,10 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
677
726
  "onField-input"?: ((...args: any[]) => any) | undefined;
678
727
  "onField-change"?: ((...args: any[]) => any) | undefined;
679
728
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
680
- }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
729
+ }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
681
730
  values: schema_d_exports.FormValue;
682
731
  lastValuesProcessed: schema_d_exports.FormValue;
683
- formState: schema_d_exports.FormState;
732
+ formState: import("@tmagic/form-schema").FormState;
684
733
  initialized: boolean;
685
734
  changeRecords: import("@tmagic/editor").ChangeRecord[];
686
735
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -707,12 +756,12 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
707
756
  readonly stepActive?: string | number | undefined;
708
757
  readonly size?: "small" | "default" | "large" | undefined;
709
758
  readonly inline?: boolean | undefined;
710
- readonly labelPosition?: string | undefined;
759
+ readonly labelPosition?: "top" | "left" | "right" | undefined;
711
760
  readonly keyProp?: string | undefined;
712
761
  readonly popperClass?: string | undefined;
713
762
  readonly preventSubmitDefault?: boolean | undefined;
714
763
  readonly useFieldTextInError?: boolean | undefined;
715
- readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
764
+ readonly context?: schema_d_exports.FormContext | undefined;
716
765
  readonly showDiff?: ((_data: {
717
766
  curValue: any;
718
767
  lastValue: any;
@@ -752,12 +801,12 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
752
801
  stepActive?: string | number;
753
802
  size?: "small" | "default" | "large";
754
803
  inline?: boolean;
755
- labelPosition?: string;
804
+ labelPosition?: "top" | "left" | "right";
756
805
  keyProp?: string;
757
806
  popperClass?: string;
758
807
  preventSubmitDefault?: boolean;
759
808
  useFieldTextInError?: boolean;
760
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
809
+ context?: schema_d_exports.FormContext;
761
810
  showDiff?: (_data: {
762
811
  curValue: any;
763
812
  lastValue: any;
@@ -774,7 +823,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
774
823
  }>, {
775
824
  values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
776
825
  lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
777
- formState: schema_d_exports.FormState;
826
+ formState: import("@tmagic/form-schema").FormState;
778
827
  initialized: import("@vue/reactivity").Ref<boolean, boolean>;
779
828
  changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
780
829
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -792,7 +841,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
792
841
  disabled: boolean;
793
842
  labelWidth: string;
794
843
  inline: boolean;
795
- labelPosition: string;
844
+ labelPosition: "top" | "left" | "right";
796
845
  config: schema_d_exports.FormConfig;
797
846
  height: string;
798
847
  initValues: Record<string, any>;
@@ -800,9 +849,9 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
800
849
  isCompare: boolean;
801
850
  keyProp: string;
802
851
  parentValues: Record<string, any>;
852
+ useFieldTextInError: boolean;
803
853
  stepActive: string | number;
804
854
  validateOnInit: boolean;
805
- useFieldTextInError: boolean;
806
855
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
807
856
  beforeCreate?: (() => void) | (() => void)[];
808
857
  created?: (() => void) | (() => void)[];
@@ -827,7 +876,7 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
827
876
  disabled: boolean;
828
877
  labelWidth: string;
829
878
  inline: boolean;
830
- labelPosition: string;
879
+ labelPosition: "top" | "left" | "right";
831
880
  config: schema_d_exports.FormConfig;
832
881
  height: string;
833
882
  initValues: Record<string, any>;
@@ -835,9 +884,9 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
835
884
  isCompare: boolean;
836
885
  keyProp: string;
837
886
  parentValues: Record<string, any>;
887
+ useFieldTextInError: boolean;
838
888
  stepActive: string | number;
839
889
  validateOnInit: boolean;
840
- useFieldTextInError: boolean;
841
890
  }> & Omit<Readonly<{
842
891
  config: schema_d_exports.FormConfig;
843
892
  initValues: Record<string, any>;
@@ -852,12 +901,12 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
852
901
  stepActive?: string | number;
853
902
  size?: "small" | "default" | "large";
854
903
  inline?: boolean;
855
- labelPosition?: string;
904
+ labelPosition?: "top" | "left" | "right";
856
905
  keyProp?: string;
857
906
  popperClass?: string;
858
907
  preventSubmitDefault?: boolean;
859
908
  useFieldTextInError?: boolean;
860
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
909
+ context?: schema_d_exports.FormContext;
861
910
  showDiff?: (_data: {
862
911
  curValue: any;
863
912
  lastValue: any;
@@ -871,10 +920,10 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
871
920
  "onField-input"?: ((...args: any[]) => any) | undefined;
872
921
  "onField-change"?: ((...args: any[]) => any) | undefined;
873
922
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
874
- }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
923
+ }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
875
924
  values: schema_d_exports.FormValue;
876
925
  lastValuesProcessed: schema_d_exports.FormValue;
877
- formState: schema_d_exports.FormState;
926
+ formState: import("@tmagic/form-schema").FormState;
878
927
  initialized: boolean;
879
928
  changeRecords: import("@tmagic/editor").ChangeRecord[];
880
929
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -908,14 +957,14 @@ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Pr
908
957
  destroyOnClose: boolean;
909
958
  showClose: boolean;
910
959
  config: schema_d_exports.FormConfig;
911
- validateOnInit: boolean;
912
960
  useFieldTextInError: boolean;
961
+ validateOnInit: boolean;
913
962
  confirmText: string;
914
963
  showCancel: boolean;
915
964
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
916
- declare const __VLS_export$29: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
965
+ declare const __VLS_export$29: __VLS_WithSlots$5<typeof __VLS_base$5, __VLS_Slots$5>;
917
966
  declare const _default$14: typeof __VLS_export$29;
918
- type __VLS_WithSlots$4<T, S> = T & {
967
+ type __VLS_WithSlots$5<T, S> = T & {
919
968
  new (): {
920
969
  $slots: S;
921
970
  };
@@ -939,14 +988,14 @@ type __VLS_Props$28 = {
939
988
  size?: 'small' | 'default' | 'large';
940
989
  confirmText?: string;
941
990
  inline?: boolean;
942
- labelPosition?: string;
991
+ labelPosition?: 'top' | 'left' | 'right';
943
992
  preventSubmitDefault?: boolean;
944
993
  /** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
945
994
  useFieldTextInError?: boolean;
946
995
  /** 关闭前的回调,会暂停 Drawer 的关闭; done 是个 function type 接受一个 boolean 参数, 执行 done 使用 true 参数或不提供参数将会终止关闭 */
947
996
  beforeClose?: (_done: (_cancel?: boolean) => void) => void;
948
- /** 透传给内部 `MForm`,用于扩展 `formState`(如注入 `$message` / `$store` 等) */
949
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
997
+ /** 透传给内部 `MForm` 的宿主业务上下文 */
998
+ context?: schema_d_exports.FormContext;
950
999
  /**
951
1000
  * 主题名。优先级:传入 `theme` prop > 祖先 `provide(M_THEME_KEY)` > 空串。
952
1001
  * 计算结果会再次 `provide` 出去,使得 Drawer 被 Teleport 到 body 后,内部子树
@@ -955,14 +1004,14 @@ type __VLS_Props$28 = {
955
1004
  theme?: string;
956
1005
  };
957
1006
  declare var __VLS_23: {}, __VLS_38: {}, __VLS_46: {};
958
- type __VLS_Slots$3 = {} & {
1007
+ type __VLS_Slots$4 = {} & {
959
1008
  default?: (props: typeof __VLS_23) => any;
960
1009
  } & {
961
1010
  left?: (props: typeof __VLS_38) => any;
962
1011
  } & {
963
1012
  footer?: (props: typeof __VLS_46) => any;
964
1013
  };
965
- declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Props$28, {
1014
+ declare const __VLS_base$4: import("@vue/runtime-core").DefineComponent<__VLS_Props$28, {
966
1015
  form: import("@vue/reactivity").Ref<({
967
1016
  $: import("@vue/runtime-core").ComponentInternalInstance;
968
1017
  $data: {};
@@ -980,12 +1029,12 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
980
1029
  readonly stepActive?: string | number | undefined;
981
1030
  readonly size?: "small" | "default" | "large" | undefined;
982
1031
  readonly inline?: boolean | undefined;
983
- readonly labelPosition?: string | undefined;
1032
+ readonly labelPosition?: "top" | "left" | "right" | undefined;
984
1033
  readonly keyProp?: string | undefined;
985
1034
  readonly popperClass?: string | undefined;
986
1035
  readonly preventSubmitDefault?: boolean | undefined;
987
1036
  readonly useFieldTextInError?: boolean | undefined;
988
- readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
1037
+ readonly context?: schema_d_exports.FormContext | undefined;
989
1038
  readonly showDiff?: ((_data: {
990
1039
  curValue: any;
991
1040
  lastValue: any;
@@ -1025,12 +1074,12 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1025
1074
  stepActive?: string | number;
1026
1075
  size?: "small" | "default" | "large";
1027
1076
  inline?: boolean;
1028
- labelPosition?: string;
1077
+ labelPosition?: "top" | "left" | "right";
1029
1078
  keyProp?: string;
1030
1079
  popperClass?: string;
1031
1080
  preventSubmitDefault?: boolean;
1032
1081
  useFieldTextInError?: boolean;
1033
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1082
+ context?: schema_d_exports.FormContext;
1034
1083
  showDiff?: (_data: {
1035
1084
  curValue: any;
1036
1085
  lastValue: any;
@@ -1047,7 +1096,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1047
1096
  }>, {
1048
1097
  values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
1049
1098
  lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
1050
- formState: schema_d_exports.FormState;
1099
+ formState: import("@tmagic/form-schema").FormState;
1051
1100
  initialized: import("@vue/reactivity").Ref<boolean, boolean>;
1052
1101
  changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
1053
1102
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -1065,7 +1114,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1065
1114
  disabled: boolean;
1066
1115
  labelWidth: string;
1067
1116
  inline: boolean;
1068
- labelPosition: string;
1117
+ labelPosition: "top" | "left" | "right";
1069
1118
  config: schema_d_exports.FormConfig;
1070
1119
  height: string;
1071
1120
  initValues: Record<string, any>;
@@ -1073,9 +1122,9 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1073
1122
  isCompare: boolean;
1074
1123
  keyProp: string;
1075
1124
  parentValues: Record<string, any>;
1125
+ useFieldTextInError: boolean;
1076
1126
  stepActive: string | number;
1077
1127
  validateOnInit: boolean;
1078
- useFieldTextInError: boolean;
1079
1128
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
1080
1129
  beforeCreate?: (() => void) | (() => void)[];
1081
1130
  created?: (() => void) | (() => void)[];
@@ -1100,7 +1149,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1100
1149
  disabled: boolean;
1101
1150
  labelWidth: string;
1102
1151
  inline: boolean;
1103
- labelPosition: string;
1152
+ labelPosition: "top" | "left" | "right";
1104
1153
  config: schema_d_exports.FormConfig;
1105
1154
  height: string;
1106
1155
  initValues: Record<string, any>;
@@ -1108,9 +1157,9 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1108
1157
  isCompare: boolean;
1109
1158
  keyProp: string;
1110
1159
  parentValues: Record<string, any>;
1160
+ useFieldTextInError: boolean;
1111
1161
  stepActive: string | number;
1112
1162
  validateOnInit: boolean;
1113
- useFieldTextInError: boolean;
1114
1163
  }> & Omit<Readonly<{
1115
1164
  config: schema_d_exports.FormConfig;
1116
1165
  initValues: Record<string, any>;
@@ -1125,12 +1174,12 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1125
1174
  stepActive?: string | number;
1126
1175
  size?: "small" | "default" | "large";
1127
1176
  inline?: boolean;
1128
- labelPosition?: string;
1177
+ labelPosition?: "top" | "left" | "right";
1129
1178
  keyProp?: string;
1130
1179
  popperClass?: string;
1131
1180
  preventSubmitDefault?: boolean;
1132
1181
  useFieldTextInError?: boolean;
1133
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1182
+ context?: schema_d_exports.FormContext;
1134
1183
  showDiff?: (_data: {
1135
1184
  curValue: any;
1136
1185
  lastValue: any;
@@ -1144,10 +1193,10 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1144
1193
  "onField-input"?: ((...args: any[]) => any) | undefined;
1145
1194
  "onField-change"?: ((...args: any[]) => any) | undefined;
1146
1195
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
1147
- }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
1196
+ }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
1148
1197
  values: schema_d_exports.FormValue;
1149
1198
  lastValuesProcessed: schema_d_exports.FormValue;
1150
- formState: schema_d_exports.FormState;
1199
+ formState: import("@tmagic/form-schema").FormState;
1151
1200
  initialized: boolean;
1152
1201
  changeRecords: import("@tmagic/editor").ChangeRecord[];
1153
1202
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -1174,12 +1223,12 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1174
1223
  readonly stepActive?: string | number | undefined;
1175
1224
  readonly size?: "small" | "default" | "large" | undefined;
1176
1225
  readonly inline?: boolean | undefined;
1177
- readonly labelPosition?: string | undefined;
1226
+ readonly labelPosition?: "top" | "left" | "right" | undefined;
1178
1227
  readonly keyProp?: string | undefined;
1179
1228
  readonly popperClass?: string | undefined;
1180
1229
  readonly preventSubmitDefault?: boolean | undefined;
1181
1230
  readonly useFieldTextInError?: boolean | undefined;
1182
- readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
1231
+ readonly context?: schema_d_exports.FormContext | undefined;
1183
1232
  readonly showDiff?: ((_data: {
1184
1233
  curValue: any;
1185
1234
  lastValue: any;
@@ -1219,12 +1268,12 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1219
1268
  stepActive?: string | number;
1220
1269
  size?: "small" | "default" | "large";
1221
1270
  inline?: boolean;
1222
- labelPosition?: string;
1271
+ labelPosition?: "top" | "left" | "right";
1223
1272
  keyProp?: string;
1224
1273
  popperClass?: string;
1225
1274
  preventSubmitDefault?: boolean;
1226
1275
  useFieldTextInError?: boolean;
1227
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1276
+ context?: schema_d_exports.FormContext;
1228
1277
  showDiff?: (_data: {
1229
1278
  curValue: any;
1230
1279
  lastValue: any;
@@ -1241,7 +1290,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1241
1290
  }>, {
1242
1291
  values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
1243
1292
  lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
1244
- formState: schema_d_exports.FormState;
1293
+ formState: import("@tmagic/form-schema").FormState;
1245
1294
  initialized: import("@vue/reactivity").Ref<boolean, boolean>;
1246
1295
  changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
1247
1296
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -1259,7 +1308,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1259
1308
  disabled: boolean;
1260
1309
  labelWidth: string;
1261
1310
  inline: boolean;
1262
- labelPosition: string;
1311
+ labelPosition: "top" | "left" | "right";
1263
1312
  config: schema_d_exports.FormConfig;
1264
1313
  height: string;
1265
1314
  initValues: Record<string, any>;
@@ -1267,9 +1316,9 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1267
1316
  isCompare: boolean;
1268
1317
  keyProp: string;
1269
1318
  parentValues: Record<string, any>;
1319
+ useFieldTextInError: boolean;
1270
1320
  stepActive: string | number;
1271
1321
  validateOnInit: boolean;
1272
- useFieldTextInError: boolean;
1273
1322
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
1274
1323
  beforeCreate?: (() => void) | (() => void)[];
1275
1324
  created?: (() => void) | (() => void)[];
@@ -1294,7 +1343,7 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1294
1343
  disabled: boolean;
1295
1344
  labelWidth: string;
1296
1345
  inline: boolean;
1297
- labelPosition: string;
1346
+ labelPosition: "top" | "left" | "right";
1298
1347
  config: schema_d_exports.FormConfig;
1299
1348
  height: string;
1300
1349
  initValues: Record<string, any>;
@@ -1302,9 +1351,9 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1302
1351
  isCompare: boolean;
1303
1352
  keyProp: string;
1304
1353
  parentValues: Record<string, any>;
1354
+ useFieldTextInError: boolean;
1305
1355
  stepActive: string | number;
1306
1356
  validateOnInit: boolean;
1307
- useFieldTextInError: boolean;
1308
1357
  }> & Omit<Readonly<{
1309
1358
  config: schema_d_exports.FormConfig;
1310
1359
  initValues: Record<string, any>;
@@ -1319,12 +1368,12 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1319
1368
  stepActive?: string | number;
1320
1369
  size?: "small" | "default" | "large";
1321
1370
  inline?: boolean;
1322
- labelPosition?: string;
1371
+ labelPosition?: "top" | "left" | "right";
1323
1372
  keyProp?: string;
1324
1373
  popperClass?: string;
1325
1374
  preventSubmitDefault?: boolean;
1326
1375
  useFieldTextInError?: boolean;
1327
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1376
+ context?: schema_d_exports.FormContext;
1328
1377
  showDiff?: (_data: {
1329
1378
  curValue: any;
1330
1379
  lastValue: any;
@@ -1338,10 +1387,10 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1338
1387
  "onField-input"?: ((...args: any[]) => any) | undefined;
1339
1388
  "onField-change"?: ((...args: any[]) => any) | undefined;
1340
1389
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
1341
- }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
1390
+ }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
1342
1391
  values: schema_d_exports.FormValue;
1343
1392
  lastValuesProcessed: schema_d_exports.FormValue;
1344
- formState: schema_d_exports.FormState;
1393
+ formState: import("@tmagic/form-schema").FormState;
1345
1394
  initialized: boolean;
1346
1395
  changeRecords: import("@tmagic/editor").ChangeRecord[];
1347
1396
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -1380,13 +1429,13 @@ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1380
1429
  values: Object;
1381
1430
  closeOnPressEscape: boolean;
1382
1431
  config: schema_d_exports.FormConfig;
1383
- validateOnInit: boolean;
1384
1432
  useFieldTextInError: boolean;
1433
+ validateOnInit: boolean;
1385
1434
  confirmText: string;
1386
1435
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
1387
- declare const __VLS_export$28: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
1436
+ declare const __VLS_export$28: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
1388
1437
  declare const _default$15: typeof __VLS_export$28;
1389
- type __VLS_WithSlots$3<T, S> = T & {
1438
+ type __VLS_WithSlots$4<T, S> = T & {
1390
1439
  new (): {
1391
1440
  $slots: S;
1392
1441
  };
@@ -1408,21 +1457,22 @@ type __VLS_Props$27 = {
1408
1457
  size?: 'small' | 'default' | 'large';
1409
1458
  confirmText?: string;
1410
1459
  inline?: boolean;
1411
- labelPosition?: string;
1460
+ labelPosition?: 'top' | 'left' | 'right';
1412
1461
  preventSubmitDefault?: boolean;
1413
1462
  /** 透传给内部 `MForm`,控制表单校验失败时错误提示前缀是否使用字段的 text 文案 */
1414
1463
  useFieldTextInError?: boolean;
1415
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1464
+ /** 透传给内部 `MForm` 的宿主业务上下文 */
1465
+ context?: schema_d_exports.FormContext;
1416
1466
  };
1417
1467
  declare var __VLS_16$1: {}, __VLS_18$1: {}, __VLS_20: {};
1418
- type __VLS_Slots$2 = {} & {
1468
+ type __VLS_Slots$3 = {} & {
1419
1469
  default?: (props: typeof __VLS_16$1) => any;
1420
1470
  } & {
1421
1471
  left?: (props: typeof __VLS_18$1) => any;
1422
1472
  } & {
1423
1473
  footer?: (props: typeof __VLS_20) => any;
1424
1474
  };
1425
- declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Props$27, {
1475
+ declare const __VLS_base$3: import("@vue/runtime-core").DefineComponent<__VLS_Props$27, {
1426
1476
  form: import("@vue/reactivity").Ref<({
1427
1477
  $: import("@vue/runtime-core").ComponentInternalInstance;
1428
1478
  $data: {};
@@ -1440,12 +1490,12 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1440
1490
  readonly stepActive?: string | number | undefined;
1441
1491
  readonly size?: "small" | "default" | "large" | undefined;
1442
1492
  readonly inline?: boolean | undefined;
1443
- readonly labelPosition?: string | undefined;
1493
+ readonly labelPosition?: "top" | "left" | "right" | undefined;
1444
1494
  readonly keyProp?: string | undefined;
1445
1495
  readonly popperClass?: string | undefined;
1446
1496
  readonly preventSubmitDefault?: boolean | undefined;
1447
1497
  readonly useFieldTextInError?: boolean | undefined;
1448
- readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
1498
+ readonly context?: schema_d_exports.FormContext | undefined;
1449
1499
  readonly showDiff?: ((_data: {
1450
1500
  curValue: any;
1451
1501
  lastValue: any;
@@ -1485,12 +1535,12 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1485
1535
  stepActive?: string | number;
1486
1536
  size?: "small" | "default" | "large";
1487
1537
  inline?: boolean;
1488
- labelPosition?: string;
1538
+ labelPosition?: "top" | "left" | "right";
1489
1539
  keyProp?: string;
1490
1540
  popperClass?: string;
1491
1541
  preventSubmitDefault?: boolean;
1492
1542
  useFieldTextInError?: boolean;
1493
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1543
+ context?: schema_d_exports.FormContext;
1494
1544
  showDiff?: (_data: {
1495
1545
  curValue: any;
1496
1546
  lastValue: any;
@@ -1507,7 +1557,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1507
1557
  }>, {
1508
1558
  values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
1509
1559
  lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
1510
- formState: schema_d_exports.FormState;
1560
+ formState: import("@tmagic/form-schema").FormState;
1511
1561
  initialized: import("@vue/reactivity").Ref<boolean, boolean>;
1512
1562
  changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
1513
1563
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -1525,7 +1575,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1525
1575
  disabled: boolean;
1526
1576
  labelWidth: string;
1527
1577
  inline: boolean;
1528
- labelPosition: string;
1578
+ labelPosition: "top" | "left" | "right";
1529
1579
  config: schema_d_exports.FormConfig;
1530
1580
  height: string;
1531
1581
  initValues: Record<string, any>;
@@ -1533,9 +1583,9 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1533
1583
  isCompare: boolean;
1534
1584
  keyProp: string;
1535
1585
  parentValues: Record<string, any>;
1586
+ useFieldTextInError: boolean;
1536
1587
  stepActive: string | number;
1537
1588
  validateOnInit: boolean;
1538
- useFieldTextInError: boolean;
1539
1589
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
1540
1590
  beforeCreate?: (() => void) | (() => void)[];
1541
1591
  created?: (() => void) | (() => void)[];
@@ -1560,7 +1610,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1560
1610
  disabled: boolean;
1561
1611
  labelWidth: string;
1562
1612
  inline: boolean;
1563
- labelPosition: string;
1613
+ labelPosition: "top" | "left" | "right";
1564
1614
  config: schema_d_exports.FormConfig;
1565
1615
  height: string;
1566
1616
  initValues: Record<string, any>;
@@ -1568,9 +1618,9 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1568
1618
  isCompare: boolean;
1569
1619
  keyProp: string;
1570
1620
  parentValues: Record<string, any>;
1621
+ useFieldTextInError: boolean;
1571
1622
  stepActive: string | number;
1572
1623
  validateOnInit: boolean;
1573
- useFieldTextInError: boolean;
1574
1624
  }> & Omit<Readonly<{
1575
1625
  config: schema_d_exports.FormConfig;
1576
1626
  initValues: Record<string, any>;
@@ -1585,12 +1635,12 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1585
1635
  stepActive?: string | number;
1586
1636
  size?: "small" | "default" | "large";
1587
1637
  inline?: boolean;
1588
- labelPosition?: string;
1638
+ labelPosition?: "top" | "left" | "right";
1589
1639
  keyProp?: string;
1590
1640
  popperClass?: string;
1591
1641
  preventSubmitDefault?: boolean;
1592
1642
  useFieldTextInError?: boolean;
1593
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1643
+ context?: schema_d_exports.FormContext;
1594
1644
  showDiff?: (_data: {
1595
1645
  curValue: any;
1596
1646
  lastValue: any;
@@ -1604,10 +1654,10 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1604
1654
  "onField-input"?: ((...args: any[]) => any) | undefined;
1605
1655
  "onField-change"?: ((...args: any[]) => any) | undefined;
1606
1656
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
1607
- }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
1657
+ }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
1608
1658
  values: schema_d_exports.FormValue;
1609
1659
  lastValuesProcessed: schema_d_exports.FormValue;
1610
- formState: schema_d_exports.FormState;
1660
+ formState: import("@tmagic/form-schema").FormState;
1611
1661
  initialized: boolean;
1612
1662
  changeRecords: import("@tmagic/editor").ChangeRecord[];
1613
1663
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -1634,12 +1684,12 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1634
1684
  readonly stepActive?: string | number | undefined;
1635
1685
  readonly size?: "small" | "default" | "large" | undefined;
1636
1686
  readonly inline?: boolean | undefined;
1637
- readonly labelPosition?: string | undefined;
1687
+ readonly labelPosition?: "top" | "left" | "right" | undefined;
1638
1688
  readonly keyProp?: string | undefined;
1639
1689
  readonly popperClass?: string | undefined;
1640
1690
  readonly preventSubmitDefault?: boolean | undefined;
1641
1691
  readonly useFieldTextInError?: boolean | undefined;
1642
- readonly extendState?: ((_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
1692
+ readonly context?: schema_d_exports.FormContext | undefined;
1643
1693
  readonly showDiff?: ((_data: {
1644
1694
  curValue: any;
1645
1695
  lastValue: any;
@@ -1679,12 +1729,12 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1679
1729
  stepActive?: string | number;
1680
1730
  size?: "small" | "default" | "large";
1681
1731
  inline?: boolean;
1682
- labelPosition?: string;
1732
+ labelPosition?: "top" | "left" | "right";
1683
1733
  keyProp?: string;
1684
1734
  popperClass?: string;
1685
1735
  preventSubmitDefault?: boolean;
1686
1736
  useFieldTextInError?: boolean;
1687
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1737
+ context?: schema_d_exports.FormContext;
1688
1738
  showDiff?: (_data: {
1689
1739
  curValue: any;
1690
1740
  lastValue: any;
@@ -1701,7 +1751,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1701
1751
  }>, {
1702
1752
  values: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
1703
1753
  lastValuesProcessed: import("@vue/reactivity").Ref<schema_d_exports.FormValue, schema_d_exports.FormValue>;
1704
- formState: schema_d_exports.FormState;
1754
+ formState: import("@tmagic/form-schema").FormState;
1705
1755
  initialized: import("@vue/reactivity").Ref<boolean, boolean>;
1706
1756
  changeRecords: import("@vue/reactivity").ShallowRef<import("@tmagic/editor").ChangeRecord[], import("@tmagic/editor").ChangeRecord[]>;
1707
1757
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -1719,7 +1769,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1719
1769
  disabled: boolean;
1720
1770
  labelWidth: string;
1721
1771
  inline: boolean;
1722
- labelPosition: string;
1772
+ labelPosition: "top" | "left" | "right";
1723
1773
  config: schema_d_exports.FormConfig;
1724
1774
  height: string;
1725
1775
  initValues: Record<string, any>;
@@ -1727,9 +1777,9 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1727
1777
  isCompare: boolean;
1728
1778
  keyProp: string;
1729
1779
  parentValues: Record<string, any>;
1780
+ useFieldTextInError: boolean;
1730
1781
  stepActive: string | number;
1731
1782
  validateOnInit: boolean;
1732
- useFieldTextInError: boolean;
1733
1783
  }, {}, string, {}, import("@vue/runtime-core").GlobalComponents, import("@vue/runtime-core").GlobalDirectives, string, import("@vue/runtime-core").ComponentProvideOptions> & {
1734
1784
  beforeCreate?: (() => void) | (() => void)[];
1735
1785
  created?: (() => void) | (() => void)[];
@@ -1754,7 +1804,7 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1754
1804
  disabled: boolean;
1755
1805
  labelWidth: string;
1756
1806
  inline: boolean;
1757
- labelPosition: string;
1807
+ labelPosition: "top" | "left" | "right";
1758
1808
  config: schema_d_exports.FormConfig;
1759
1809
  height: string;
1760
1810
  initValues: Record<string, any>;
@@ -1762,9 +1812,9 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1762
1812
  isCompare: boolean;
1763
1813
  keyProp: string;
1764
1814
  parentValues: Record<string, any>;
1815
+ useFieldTextInError: boolean;
1765
1816
  stepActive: string | number;
1766
1817
  validateOnInit: boolean;
1767
- useFieldTextInError: boolean;
1768
1818
  }> & Omit<Readonly<{
1769
1819
  config: schema_d_exports.FormConfig;
1770
1820
  initValues: Record<string, any>;
@@ -1779,12 +1829,12 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1779
1829
  stepActive?: string | number;
1780
1830
  size?: "small" | "default" | "large";
1781
1831
  inline?: boolean;
1782
- labelPosition?: string;
1832
+ labelPosition?: "top" | "left" | "right";
1783
1833
  keyProp?: string;
1784
1834
  popperClass?: string;
1785
1835
  preventSubmitDefault?: boolean;
1786
1836
  useFieldTextInError?: boolean;
1787
- extendState?: (_state: schema_d_exports.FormState) => Record<string, any> | Promise<Record<string, any>>;
1837
+ context?: schema_d_exports.FormContext;
1788
1838
  showDiff?: (_data: {
1789
1839
  curValue: any;
1790
1840
  lastValue: any;
@@ -1798,10 +1848,10 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1798
1848
  "onField-input"?: ((...args: any[]) => any) | undefined;
1799
1849
  "onField-change"?: ((...args: any[]) => any) | undefined;
1800
1850
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
1801
- }>, "values" | "changeHandler" | "validate" | "initialized" | "lastValuesProcessed" | "formState" | "changeRecords" | "resetForm" | "submitForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "stepActive" | "validateOnInit" | "useFieldTextInError")> & {
1851
+ }>, "values" | "changeHandler" | "validate" | "lastValuesProcessed" | "submitForm" | "changeRecords" | "initialized" | "formState" | "resetForm" | "getTextByName" | ("disabled" | "labelWidth" | "inline" | "labelPosition" | "config" | "height" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "useFieldTextInError" | "stepActive" | "validateOnInit")> & {
1802
1852
  values: schema_d_exports.FormValue;
1803
1853
  lastValuesProcessed: schema_d_exports.FormValue;
1804
- formState: schema_d_exports.FormState;
1854
+ formState: import("@tmagic/form-schema").FormState;
1805
1855
  initialized: boolean;
1806
1856
  changeRecords: import("@tmagic/editor").ChangeRecord[];
1807
1857
  changeHandler: (v: schema_d_exports.FormValue, eventData: ContainerChangeEventData) => void;
@@ -1826,20 +1876,20 @@ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1826
1876
  }>, {
1827
1877
  values: Object;
1828
1878
  config: schema_d_exports.FormConfig;
1829
- validateOnInit: boolean;
1830
1879
  useFieldTextInError: boolean;
1880
+ validateOnInit: boolean;
1831
1881
  confirmText: string;
1832
1882
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
1833
- declare const __VLS_export$27: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
1883
+ declare const __VLS_export$27: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
1834
1884
  declare const _default$13: typeof __VLS_export$27;
1835
- type __VLS_WithSlots$2<T, S> = T & {
1885
+ type __VLS_WithSlots$3<T, S> = T & {
1836
1886
  new (): {
1837
1887
  $slots: S;
1838
1888
  };
1839
1889
  };
1840
1890
  //#endregion
1841
1891
  //#region temp/packages/form/src/containers/Container.vue.d.ts
1842
- type __VLS_Slots$1 = FormSlots;
1892
+ type __VLS_Slots$2 = FormSlots;
1843
1893
  type __VLS_Props$26 = {
1844
1894
  /** 表单值 */
1845
1895
  model: schema_d_exports.FormValue;
@@ -1849,6 +1899,7 @@ type __VLS_Props$26 = {
1849
1899
  prop?: string;
1850
1900
  disabled?: boolean;
1851
1901
  labelWidth?: string | number;
1902
+ labelPosition?: 'top' | 'left' | 'right';
1852
1903
  expandMore?: boolean;
1853
1904
  stepActive?: string | number;
1854
1905
  size?: string;
@@ -1857,7 +1908,7 @@ type __VLS_Props$26 = {
1857
1908
  /** 是否在行容器中 */
1858
1909
  isInRow?: boolean;
1859
1910
  };
1860
- declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Props$26, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
1911
+ declare const __VLS_base$2: import("@vue/runtime-core").DefineComponent<__VLS_Props$26, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
1861
1912
  change: (v: any, eventData: ContainerChangeEventData) => any;
1862
1913
  addDiffCount: () => any;
1863
1914
  }, string, import("@vue/runtime-core").PublicProps, Readonly<__VLS_Props$26> & Readonly<{
@@ -1870,9 +1921,9 @@ declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Pr
1870
1921
  isCompare: boolean;
1871
1922
  expandMore: boolean;
1872
1923
  }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
1873
- declare const __VLS_export$26: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
1924
+ declare const __VLS_export$26: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
1874
1925
  declare const _default$4: typeof __VLS_export$26;
1875
- type __VLS_WithSlots$1<T, S> = T & {
1926
+ type __VLS_WithSlots$2<T, S> = T & {
1876
1927
  new (): {
1877
1928
  $slots: S;
1878
1929
  };
@@ -1881,6 +1932,7 @@ type __VLS_WithSlots$1<T, S> = T & {
1881
1932
  //#region temp/packages/form/src/containers/Fieldset.vue.d.ts
1882
1933
  type __VLS_Props$25 = {
1883
1934
  labelWidth?: string;
1935
+ labelPosition?: 'top' | 'left' | 'right';
1884
1936
  prop: string;
1885
1937
  size?: string;
1886
1938
  model: Record<string, any>;
@@ -1912,6 +1964,7 @@ type __VLS_Props$24 = {
1912
1964
  config: FlexLayoutConfig;
1913
1965
  name?: string;
1914
1966
  labelWidth?: string;
1967
+ labelPosition?: 'top' | 'left' | 'right';
1915
1968
  prop?: string;
1916
1969
  size?: string;
1917
1970
  disabled?: boolean;
@@ -1933,18 +1986,19 @@ type __VLS_Props$23 = {
1933
1986
  config: schema_d_exports.PanelConfig;
1934
1987
  name?: string;
1935
1988
  labelWidth?: string;
1989
+ labelPosition?: 'top' | 'left' | 'right';
1936
1990
  prop?: string;
1937
1991
  size?: string;
1938
1992
  disabled?: boolean;
1939
1993
  hideExpand?: boolean;
1940
1994
  };
1941
1995
  declare var __VLS_16: {}, __VLS_18: {};
1942
- type __VLS_Slots = {} & {
1996
+ type __VLS_Slots$1 = {} & {
1943
1997
  header?: (props: typeof __VLS_16) => any;
1944
1998
  } & {
1945
1999
  default?: (props: typeof __VLS_18) => any;
1946
2000
  };
1947
- declare const __VLS_base: import("@vue/runtime-core").DefineComponent<__VLS_Props$23, {
2001
+ declare const __VLS_base$1: import("@vue/runtime-core").DefineComponent<__VLS_Props$23, {
1948
2002
  getExpand: () => boolean;
1949
2003
  setExpand: (v: boolean) => void;
1950
2004
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
@@ -1954,9 +2008,9 @@ declare const __VLS_base: import("@vue/runtime-core").DefineComponent<__VLS_Prop
1954
2008
  onChange?: ((v: any, eventData: ContainerChangeEventData) => any) | undefined;
1955
2009
  onAddDiffCount?: (() => any) | undefined;
1956
2010
  }>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
1957
- declare const __VLS_export$23: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
2011
+ declare const __VLS_export$23: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
1958
2012
  declare const _default$21: typeof __VLS_export$23;
1959
- type __VLS_WithSlots<T, S> = T & {
2013
+ type __VLS_WithSlots$1<T, S> = T & {
1960
2014
  new (): {
1961
2015
  $slots: S;
1962
2016
  };
@@ -1970,6 +2024,7 @@ type __VLS_Props$22 = {
1970
2024
  config: schema_d_exports.RowConfig;
1971
2025
  name: string;
1972
2026
  labelWidth?: string;
2027
+ labelPosition?: 'top' | 'left' | 'right';
1973
2028
  prop?: string;
1974
2029
  size?: string;
1975
2030
  expandMore?: boolean;
@@ -1993,6 +2048,7 @@ type __VLS_Props$21 = {
1993
2048
  name: string;
1994
2049
  size?: string;
1995
2050
  labelWidth?: string;
2051
+ labelPosition?: 'top' | 'left' | 'right';
1996
2052
  prop?: string;
1997
2053
  expandMore?: boolean;
1998
2054
  disabled?: boolean;
@@ -2019,6 +2075,7 @@ type __VLS_Props$20 = {
2019
2075
  name: string;
2020
2076
  prop?: string;
2021
2077
  labelWidth?: string;
2078
+ labelPosition?: 'top' | 'left' | 'right';
2022
2079
  disabled?: boolean;
2023
2080
  size?: string;
2024
2081
  enableToggleMode?: true;
@@ -2026,7 +2083,11 @@ type __VLS_Props$20 = {
2026
2083
  sortKey?: string;
2027
2084
  sort?: boolean;
2028
2085
  };
2029
- declare const __VLS_export$20: import("@vue/runtime-core").DefineComponent<__VLS_Props$20, {
2086
+ declare var __VLS_33: any;
2087
+ type __VLS_Slots = {} & {
2088
+ title?: (props: typeof __VLS_33) => any;
2089
+ };
2090
+ declare const __VLS_base: import("@vue/runtime-core").DefineComponent<__VLS_Props$20, {
2030
2091
  toggleRowSelection: (row: any, selected: boolean) => void | undefined;
2031
2092
  }, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
2032
2093
  change: (...args: any[]) => void;
@@ -2037,7 +2098,13 @@ declare const __VLS_export$20: import("@vue/runtime-core").DefineComponent<__VLS
2037
2098
  onSelect?: ((...args: any[]) => any) | undefined;
2038
2099
  onAddDiffCount?: ((...args: any[]) => any) | undefined;
2039
2100
  }>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
2101
+ declare const __VLS_export$20: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
2040
2102
  declare const _default$16: typeof __VLS_export$20;
2103
+ type __VLS_WithSlots<T, S> = T & {
2104
+ new (): {
2105
+ $slots: S;
2106
+ };
2107
+ };
2041
2108
  //#endregion
2042
2109
  //#region temp/packages/form/src/fields/Text.vue.d.ts
2043
2110
  type __VLS_Props$19 = schema_d_exports.FieldProps<schema_d_exports.TextConfig>;
@@ -2061,7 +2128,7 @@ declare const __VLS_export$18: import("@vue/runtime-core").DefineComponent<__VLS
2061
2128
  }>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
2062
2129
  declare const _default$19: typeof __VLS_export$18;
2063
2130
  //#endregion
2064
- //#region temp/packages/form/src/fields/NumberRange.vue.d.ts
2131
+ //#region temp/packages/form/src/fields/NumberRange/Index.vue.d.ts
2065
2132
  type __VLS_Props$17 = schema_d_exports.FieldProps<schema_d_exports.NumberRangeConfig>;
2066
2133
  declare const __VLS_export$17: import("@vue/runtime-core").DefineComponent<__VLS_Props$17, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
2067
2134
  change: (values: [number, number]) => any;
@@ -2090,7 +2157,7 @@ type __VLS_Props$15 = {
2090
2157
  declare const __VLS_export$15: import("@vue/runtime-core").DefineComponent<__VLS_Props$15, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<__VLS_Props$15> & Readonly<{}>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
2091
2158
  declare const _default$17: typeof __VLS_export$15;
2092
2159
  //#endregion
2093
- //#region temp/packages/form/src/fields/Date.vue.d.ts
2160
+ //#region temp/packages/form/src/fields/Date/Index.vue.d.ts
2094
2161
  type __VLS_Props$14 = schema_d_exports.FieldProps<schema_d_exports.DateConfig>;
2095
2162
  declare const __VLS_export$14: import("@vue/runtime-core").DefineComponent<__VLS_Props$14, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
2096
2163
  change: (value: string) => any;
@@ -2099,7 +2166,7 @@ declare const __VLS_export$14: import("@vue/runtime-core").DefineComponent<__VLS
2099
2166
  }>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
2100
2167
  declare const _default$5: typeof __VLS_export$14;
2101
2168
  //#endregion
2102
- //#region temp/packages/form/src/fields/DateTime.vue.d.ts
2169
+ //#region temp/packages/form/src/fields/DateTime/Index.vue.d.ts
2103
2170
  type __VLS_Props$13 = schema_d_exports.FieldProps<schema_d_exports.DateTimeConfig>;
2104
2171
  declare const __VLS_export$13: import("@vue/runtime-core").DefineComponent<__VLS_Props$13, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
2105
2172
  change: (value: string) => any;
@@ -2162,7 +2229,7 @@ declare const __VLS_export$7: import("@vue/runtime-core").DefineComponent<__VLS_
2162
2229
  }>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
2163
2230
  declare const _default$3: typeof __VLS_export$7;
2164
2231
  //#endregion
2165
- //#region temp/packages/form/src/fields/CheckboxGroup.vue.d.ts
2232
+ //#region temp/packages/form/src/fields/CheckboxGroup/Index.vue.d.ts
2166
2233
  type __VLS_Props$6 = schema_d_exports.FieldProps<schema_d_exports.CheckboxGroupConfig>;
2167
2234
  declare const __VLS_export$6: import("@vue/runtime-core").DefineComponent<__VLS_Props$6, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
2168
2235
  change: (...args: any[]) => void;
@@ -2180,7 +2247,7 @@ declare const __VLS_export$5: import("@vue/runtime-core").DefineComponent<__VLS_
2180
2247
  }>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
2181
2248
  declare const _default$22: typeof __VLS_export$5;
2182
2249
  //#endregion
2183
- //#region temp/packages/form/src/fields/Display.vue.d.ts
2250
+ //#region temp/packages/form/src/fields/Display/Index.vue.d.ts
2184
2251
  type __VLS_Props$4 = schema_d_exports.FieldProps<schema_d_exports.DisplayConfig>;
2185
2252
  declare const __VLS_export$4: import("@vue/runtime-core").DefineComponent<__VLS_Props$4, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<__VLS_Props$4> & Readonly<{}>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
2186
2253
  declare const _default$8: typeof __VLS_export$4;
@@ -2243,7 +2310,7 @@ declare const __VLS_export$1: import("@vue/runtime-core").DefineComponent<__VLS_
2243
2310
  }>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
2244
2311
  declare const _default: typeof __VLS_export$1;
2245
2312
  //#endregion
2246
- //#region temp/packages/form/src/fields/DynamicField.vue.d.ts
2313
+ //#region temp/packages/form/src/fields/DynamicField/Index.vue.d.ts
2247
2314
  type __VLS_Props = schema_d_exports.FieldProps<schema_d_exports.DynamicFieldConfig>;
2248
2315
  declare const __VLS_export: import("@vue/runtime-core").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
2249
2316
  change: (...args: any[]) => void;
@@ -2252,22 +2319,179 @@ declare const __VLS_export: import("@vue/runtime-core").DefineComponent<__VLS_Pr
2252
2319
  }>, {}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, false, {}, any>;
2253
2320
  declare const _default$9: typeof __VLS_export;
2254
2321
  //#endregion
2255
- //#region temp/packages/form/src/utils/config.d.ts
2256
- declare const registerField: (tagName: string, component: Component) => void;
2257
- declare const getField: (tagName: string) => Component | undefined;
2258
- declare const deleteField: (tagName: string) => boolean;
2322
+ //#region temp/packages/form/src/utils/collectFields.d.ts
2323
+ /** 一个参与校验的字段:与渲染式校验中「一个带 rules 的 TMagicFormItem」一一对应 */
2324
+ interface CollectedField {
2325
+ /** 字段的完整 prop 路径(从表单根 values 起算,与 FormItem 的 prop 一致) */
2326
+ prop: string;
2327
+ /** 经 `getNativeRules` 处理后的规则(validator 为 async-validator 原生签名) */
2328
+ rules: schema_d_exports.Rule[];
2329
+ /** 字段配置 */
2330
+ config: schema_d_exports.FormItemConfig;
2331
+ /** 字段所在层级的 model 切片 */
2332
+ model: schema_d_exports.FormValue;
2333
+ }
2334
+ /** 已登记的 innerConfig 回调自身抛错时抛出(机制故障,不是漏登记) */
2335
+ declare class FieldInnerConfigError extends Error {
2336
+ readonly code = "FIELD_INNER_CONFIG";
2337
+ readonly type: string;
2338
+ readonly prop: string;
2339
+ constructor(type: string, prop: string, cause: unknown);
2340
+ }
2341
+ declare const isFieldInnerConfigError: (error: unknown) => error is FieldInnerConfigError;
2342
+ /**
2343
+ * 遍历模式。同一套遍历规则服务两个用途,避免两条链路各写一份而产生偏差:
2344
+ *
2345
+ * - `collect`:收集带 rules 的字段,按 `display` 过滤(对应「渲染出来的 FormItem 集合」);
2346
+ * - `effects`:执行字段登记的值初始化写入,不收集字段,且不看 `display`
2347
+ * (`display: false` 的字段同样要规整;`type: 'hidden'` 在该节点停止,不往下分派)。
2348
+ */
2349
+ type WalkMode = 'collect' | 'effects';
2350
+ interface WalkContext {
2351
+ mForm: schema_d_exports.FormState | undefined;
2352
+ /**
2353
+ * 是否自动给字段注入 typeMatch 规则,对应 MForm 的 `typeMatchValid`。
2354
+ *
2355
+ * 只在 `collect` 模式下有用:`addField` 把它交给 `getNativeRules`。为 true 且字段
2356
+ * rules 尚未显式声明 `typeMatch`(true / false)时,自动补一条 `{ typeMatch: true }`,
2357
+ * 按字段 `type` 校验当前值形态是否合法(空值放行,必填仍靠 `required`)。
2358
+ * 单字段可在 rules 里写 `typeMatch: false` 关闭自动注入。
2359
+ *
2360
+ * `effects` 模式不收集规则,无需传入。
2361
+ */
2362
+ typeMatchValid?: boolean;
2363
+ fields: CollectedField[];
2364
+ /** 本次遍历处理的表单值根对象(对比模式下为 lastValues 那一份) */
2365
+ values: schema_d_exports.FormValue;
2366
+ mode: WalkMode;
2367
+ }
2368
+ interface WalkNode {
2369
+ config: schema_d_exports.FormItemConfig;
2370
+ /** 所在层级的 model 切片(对应 Container 的 `props.model`) */
2371
+ model: schema_d_exports.FormValue;
2372
+ /** 父级 prop(对应 Container 的 `props.prop`) */
2373
+ prop: string;
2374
+ }
2375
+ type ContainerWalker = (_ctx: WalkContext, _node: WalkNode, _itemProp: string) => void;
2376
+ /**
2377
+ * 纯逻辑收集「一份 config + 一份 values」中所有参与校验的字段。
2378
+ *
2379
+ * 遍历规则与 `Container.vue` 及各容器组件的模板一一对应,因此产出的 prop / rules
2380
+ * 与渲染式校验(挂载 MForm 后调用 `validate()`)等价,无需任何 DOM 或组件实例。
2381
+ *
2382
+ * 本函数只读不写。字段的值初始化副作用由 `applyMountValueEffects` 负责,
2383
+ * 调用方需在初始化表单值之后、收集字段之前执行一次(`validateValues` 已经这么做)。
2384
+ *
2385
+ * @param mForm - 表单状态;无渲染时由 `createHeadlessFormState` 构造
2386
+ * @param config - 表单配置
2387
+ * @param values - 表单值
2388
+ * @param [typeMatchValid] - 是否自动注入 typeMatch 规则;为 true 时,未显式声明
2389
+ * `typeMatch` 的字段会补上 `{ typeMatch: true }`,按字段 type 校验值形态
2390
+ * @returns 带规则的字段列表
2391
+ */
2392
+ declare const collectValidatableFields: (mForm: schema_d_exports.FormState | undefined, config: schema_d_exports.FormConfig, values: schema_d_exports.FormValue, typeMatchValid?: boolean) => CollectedField[];
2393
+ /**
2394
+ * 执行「一份 config + 一份 values」中所有叶子字段登记的值初始化写入,就地改写 `values`。
2395
+ *
2396
+ * 渲染与无渲染两条链路共用的唯一执行点:字段组件自身不再在 setup 里改写 model,
2397
+ * 由持有完整表单值的一方(`Form.vue` / `validateValues`)在表单值初始化完成、
2398
+ * 且已挂到 `mForm.values` 之后调用一次。这样 effect 与动态 `type` 回调读到的
2399
+ * `formValue` 就是最新值,而不是上一轮的旧值。
2400
+ *
2401
+ * 与 `collectValidatableFields` 的差异:不看 `display`(`display: false` 的字段也会规整)。
2402
+ * `type: 'hidden'` 会在该节点停止遍历,内部字段不执行 effect。
2403
+ *
2404
+ * `prop` 与 `values` 都以传入的 `values` 为根,因此也可以用于 tab / table 新增行这类
2405
+ * 「先构造一份子树的值,再挂到表单上」的场景:传入子树配置与该行的值即可。
2406
+ *
2407
+ * @param mForm - 表单状态;无渲染时由 `createHeadlessFormState` 构造
2408
+ * @param config - 表单配置
2409
+ * @param values - 表单值(会被就地修改)
2410
+ */
2411
+ declare const applyMountValueEffects: (mForm: schema_d_exports.FormState | undefined, config: schema_d_exports.FormConfig, values: schema_d_exports.FormValue) => void;
2259
2412
  //#endregion
2260
- //#region temp/packages/form/src/utils/silentLeafFieldTypes.d.ts
2413
+ //#region temp/packages/form/src/utils/fieldInnerConfig.d.ts
2414
+ /** innerConfig 回调的入参:字段自身的配置、所在层级的 model、完整字段路径与表单状态 */
2415
+ interface FieldInnerConfigContext {
2416
+ /** 字段自身的配置(已经过 filterFunction 之外的原样配置) */
2417
+ config: schema_d_exports.FormItemConfig;
2418
+ /** 字段所在层级的 model 切片 */
2419
+ model: schema_d_exports.FormValue;
2420
+ /** 字段的完整 prop 路径(含父级前缀),即字段组件拿到的 `props.prop` */
2421
+ prop: string;
2422
+ /** 字段所在层级的 prop 基准(父级 Container 的 `props.prop`),即 `prop` 去掉自身 name 的部分 */
2423
+ parentProp: string;
2424
+ /** 表单状态 */
2425
+ mForm: schema_d_exports.FormState | undefined;
2426
+ }
2427
+ /** innerConfig 回调的返回值:需要继续遍历的内部配置及其 model / prop 基准 */
2428
+ interface FieldInnerConfigResult {
2429
+ /** 内部配置(对应字段组件内部渲染的 `MContainer` 的 `config`) */
2430
+ config: schema_d_exports.FormItemConfig | schema_d_exports.FormItemConfig[];
2431
+ /**
2432
+ * 内部配置对应的 model 切片,默认沿用字段所在层级的 `model`。
2433
+ *
2434
+ * 例如 `code-select` 内部是 `:model="model[name]"`,就应返回 `model[config.name]`。
2435
+ */
2436
+ model?: schema_d_exports.FormValue;
2437
+ /**
2438
+ * 内部配置对应的 prop 基准,默认沿用字段自身的 `prop`。
2439
+ *
2440
+ * 返回的 config 的 `name` 会被追加到这个基准上。所以当内部配置复用了字段自身的 `name`
2441
+ * (如 `display-conds` 内部的 group-list 就叫 `props.name`)时,要返回 `parentProp`,
2442
+ * 否则 name 会被拼两次。
2443
+ */
2444
+ prop?: string;
2445
+ }
2261
2446
  /**
2262
- * 注册可在静默校验中跳过渲染的叶子字段 type(追加到默认 `LEAF_FIELD_TYPES` 之上)。
2447
+ * 复合字段的内部配置回调。
2448
+ *
2449
+ * 有一类字段组件会在自身内部再渲染 `MContainer` 并传入组件内部临时算出来的 config
2450
+ * (如编辑器的 `code-select` / `event-select` / `style-setter`),这些内部字段同样会向
2451
+ * 父级表单注册 FormItem、参与父表单校验。无渲染校验(`validateValues`)只遍历调用方
2452
+ * 传入的 config 树,看不到这些运行期才产生的配置,因此需要字段作者通过
2453
+ * `registerField(type, { innerConfig })` 把内部配置交出来。
2263
2454
  *
2264
- * 仅应纳入「无嵌套 FormItem、无挂载值副作用」的字段;复合 / 动态子表单不可加入。
2455
+ * 返回 `null` / `undefined` 表示该字段本次没有内部配置(例如某些分支下不渲染子表单)。
2456
+ *
2457
+ * 既未登记 innerConfig、也不在叶子字段表里的 type:配置里有 `items` 会下钻子项,
2458
+ * 自身有 `rules` 会校验自身。
2265
2459
  */
2266
- declare const registerSilentLeafFieldTypes: (types: Iterable<string>) => void;
2267
- /** 当前生效的静默叶子字段集合:内置默认 ∪ 已注册扩展 */
2268
- declare const getSilentLeafFieldTypes: () => ReadonlySet<string>;
2269
- /** 清空业务侧追加的静默叶子字段(不影响内置默认集合;主要用于单测) */
2270
- declare const clearSilentLeafFieldTypes: () => void;
2460
+ type FieldInnerConfig = (_ctx: FieldInnerConfigContext) => FieldInnerConfigResult | null | undefined | void;
2461
+ //#endregion
2462
+ //#region temp/packages/form/src/utils/fieldValueEffects.d.ts
2463
+ /** effect 的入参:字段自身的配置、所在层级的 model、完整字段路径、表单值根对象与表单状态 */
2464
+ interface FieldMountValueEffectContext {
2465
+ /** 字段自身的配置 */
2466
+ config: schema_d_exports.FormItemConfig;
2467
+ /** 字段所在层级的 model 切片 */
2468
+ model: schema_d_exports.FormValue;
2469
+ /** 字段的完整 prop 路径(含父级前缀),对应 Container 的 `itemProp` */
2470
+ prop: string;
2471
+ /**
2472
+ * 本次处理的表单值根对象,`prop` 即以它为根。
2473
+ *
2474
+ * 需要按路径跨层级写值时用它,不要用 `mForm.values`:对比模式下处理的是 lastValues 那一份,
2475
+ * tab / table 新增行处理的则是还没挂到表单上的一行值,两者都与 `mForm.values` 不是同一个对象。
2476
+ */
2477
+ values: schema_d_exports.FormValue;
2478
+ /** 表单状态 */
2479
+ mForm: schema_d_exports.FormState | undefined;
2480
+ }
2481
+ /**
2482
+ * 字段对表单值的初始化写入(如 `display` 的 `initValue`、`date` 的格式归一化)。
2483
+ *
2484
+ * 由 `applyMountValueEffects` 在表单值初始化完成后统一执行一次,渲染与无渲染共用。
2485
+ * 因为可能对同一份值重复执行(如 `initValues` 变化后重新初始化),实现必须幂等。
2486
+ */
2487
+ type FieldMountValueEffect = (_ctx: FieldMountValueEffectContext) => void;
2488
+ /**
2489
+ * 是否为叶子字段 type(内置 ∪ 已登记)。
2490
+ *
2491
+ * @param type - 字段 type
2492
+ * @returns 是否为叶子
2493
+ */
2494
+ declare const isLeafFieldType: (type: string) => boolean;
2271
2495
  //#endregion
2272
2496
  //#region temp/packages/form/src/utils/typeMatch.d.ts
2273
2497
  interface TypeMatchValidateContext {
@@ -2282,15 +2506,11 @@ interface TypeMatchValidateContext {
2282
2506
  * 支持返回 Promise,用于需要异步确认取值是否合法的场景(如请求接口校验 id 是否存在)。
2283
2507
  */
2284
2508
  type TypeMatchValidator = (value: any, context: TypeMatchValidateContext) => string | undefined | Promise<string | undefined>;
2285
- /** 注册或覆盖某个字段 type 的 typeMatch 校验规则 */
2286
- declare const registerTypeMatchRule: (type: string, validator: TypeMatchValidator) => void;
2287
- /** 批量注册 typeMatch 校验规则 */
2288
- declare const registerTypeMatchRules: (rules: Record<string, TypeMatchValidator>) => void;
2289
- /** 获取某个字段 type 的自定义 typeMatch 校验规则 */
2509
+ /** 获取某个字段 type 的 typeMatch 校验规则(业务侧优先于内置) */
2290
2510
  declare const getTypeMatchRule: (type: string) => TypeMatchValidator | undefined;
2291
- /** 删除某个字段 type 的自定义 typeMatch 校验规则 */
2511
+ /** 删除业务侧 typeMatch 校验规则(不影响内置) */
2292
2512
  declare const deleteTypeMatchRule: (type: string) => boolean;
2293
- /** 清空所有自定义 typeMatch 校验规则 */
2513
+ /** 清空业务侧 typeMatch 校验规则(不影响内置) */
2294
2514
  declare const clearTypeMatchRules: () => void;
2295
2515
  /**
2296
2516
  * 将值格式化为可读的参考示例字符串。
@@ -2310,19 +2530,158 @@ declare const optionSuggestion: (optionValues: any[]) => string;
2310
2530
  */
2311
2531
  declare const validateTypeMatch: (value: any, mForm: schema_d_exports.FormState | undefined, props: any, message?: string) => string | undefined | Promise<string | undefined>;
2312
2532
  //#endregion
2533
+ //#region temp/packages/form/src/utils/registerField.d.ts
2534
+ /**
2535
+ * 自定义字段 type 的登记项。
2536
+ *
2537
+ * 不传或只传空对象:当作叶子,不再下钻 `items`。
2538
+ */
2539
+ interface FieldOptions {
2540
+ /**
2541
+ * 渲染用的 Vue 组件,写入字段注册表。
2542
+ * 传入 `app` 时同时 `app.component('m-fields-*')`。
2543
+ */
2544
+ component?: Component;
2545
+ /**
2546
+ * 容器组件,写入字段注册表。
2547
+ * 传入 `app` 时同时 `app.component('m-form-*')`。
2548
+ */
2549
+ container?: Component;
2550
+ /** 字段挂载时改写 model 的副作用。可与 `innerConfig` 同时登记。 */
2551
+ effect?: FieldMountValueEffect;
2552
+ /**
2553
+ * 按容器模板遍历(tab / table 等)。
2554
+ * 与 `innerConfig` / `effect` 同时传入时 `walk` 优先。
2555
+ */
2556
+ walk?: ContainerWalker;
2557
+ /**
2558
+ * 把内部会挂到父表单的配置交出来。
2559
+ * 可与 `effect` 同时传入:`effect` 负责本字段的值初始化,`innerConfig` 只做配置派生。
2560
+ */
2561
+ innerConfig?: FieldInnerConfig;
2562
+ /** 该 type 的 typeMatch 校验;可与叶子、walk 或 innerConfig 同时登记。 */
2563
+ typeMatch?: TypeMatchValidator;
2564
+ }
2565
+ /**
2566
+ * 无渲染校验用的登记项,不含 Vue 组件。
2567
+ *
2568
+ * 给 Node / `validateForm` / `submitForm` 用。
2569
+ */
2570
+ type HeadlessFieldOptions = Omit<FieldOptions, 'component' | 'container'>;
2571
+ /**
2572
+ * 把多份字段登记表按 type 浅合并。后一份只覆盖自己带了的 key,未出现的 key 保留前一份。
2573
+ *
2574
+ * 安装插件时用:Node 侧只登记 `headless`,浏览器再补 `component` / `container`。
2575
+ *
2576
+ * @param tables - 待合并的登记表,`undefined` 会被跳过
2577
+ * @returns 合并后的登记表
2578
+ */
2579
+ declare const mergeFieldOptions: (...tables: Array<Record<string, HeadlessFieldOptions | FieldOptions> | undefined>) => Record<string, FieldOptions>;
2580
+ /**
2581
+ * 按字段 type 取已登记的渲染组件(`codeSelect` 与 `code-select` 等价)。
2582
+ *
2583
+ * @param type - 字段 type
2584
+ * @returns 已登记的 Vue 组件;未登记则为 `undefined`
2585
+ */
2586
+ declare const getField: (type: string) => Component | undefined;
2587
+ /**
2588
+ * 登记一个字段 type 在无渲染校验里的行为,以及可选的渲染组件。
2589
+ *
2590
+ * `type` 会按 Container 的规则归一化为中划线形式(`codeSelect` 与 `code-select` 等价)。
2591
+ * 对同一 type 重复登记按字段浅合并:后一次只覆盖自己传入的 key,未传入的 key 保留。
2592
+ * 传入 `app` 且带了 `component` / `container` 时,会同步 `app.component('m-fields-*'` / `'m-form-*')`。
2593
+ *
2594
+ * @param type - 字段 type
2595
+ * @param [options] - 登记项;省略或空对象视为叶子
2596
+ * @param [app] - Vue 应用;省略则不调用 `app.component`
2597
+ */
2598
+ declare const registerField: (type: string, options?: FieldOptions, app?: App) => void;
2599
+ /**
2600
+ * 批量登记字段。
2601
+ *
2602
+ * @param fields - type 到登记项的映射
2603
+ * @param [app] - Vue 应用;省略则不调用 `app.component`
2604
+ */
2605
+ declare const registerFields: (fields: Record<string, FieldOptions>, app?: App) => void;
2606
+ /**
2607
+ * 登记内置字段(`clearFields` / `unregisterField` 不会清掉)。
2608
+ *
2609
+ * @param fields - type 到登记项的映射
2610
+ * @param [app] - Vue 应用;省略则不调用 `app.component`
2611
+ */
2612
+ declare const registerBuiltInFields: (fields: Record<string, FieldOptions>, app?: App) => void;
2613
+ /**
2614
+ * 删除业务侧对指定 type 的登记(不影响内置;主要用于单测)。
2615
+ *
2616
+ * @param type - 字段 type
2617
+ */
2618
+ declare const unregisterField: (type: string) => void;
2619
+ /** 清空业务侧登记(不影响内置;主要用于单测)。 */
2620
+ declare const clearFields: () => void;
2621
+ //#endregion
2622
+ //#region temp/packages/form/src/utils/builtInFields.d.ts
2623
+ /**
2624
+ * 内置字段的无渲染登记表(不含 Vue 组件)。
2625
+ *
2626
+ * 本模块只导出数据,不登记。调用方自行 `registerBuiltInFields(builtInFields)`,
2627
+ * 或 `app.use(MagicForm)`(install 里会登记叠上 Vue 组件后的表)。
2628
+ */
2629
+ declare const builtInFields: Record<string, HeadlessFieldOptions>;
2630
+ //#endregion
2631
+ //#region temp/packages/form/src/utils/validateError.d.ts
2632
+ /**
2633
+ * 通过 name 从 config 中查找对应的 text
2634
+ *
2635
+ * @param name - 字段名,支持点分隔的路径格式,如 'a.b.c'
2636
+ * @param config - 表单配置数组
2637
+ * @returns 找到的 text 值,如果未找到则返回 undefined
2638
+ */
2639
+ declare const getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
2640
+ /**
2641
+ * 将校验返回的 invalidFields 汇总为可读的错误文案(多条以 `<br>` 拼接)。
2642
+ *
2643
+ * `useFieldTextInError` 为 `true`(默认)时用字段的 text 文案作为错误前缀,找不到则回退为字段 name。
2644
+ *
2645
+ * 由渲染式校验(Form.vue 的 `submitForm` / `validate`)与无渲染校验(`validateValues`)共用,
2646
+ * 保证两条校验链路产出的错误文案格式完全一致。
2647
+ *
2648
+ * @param invalidFields - async-validator 产出的字段错误表
2649
+ * @param [options] - 文案选项
2650
+ * @param [options.config] - 用于查找 text 的表单配置
2651
+ * @param [options.useFieldTextInError=true] - 错误前缀是否使用字段 text
2652
+ * @returns 拼接后的错误文案;无错误时为空串
2653
+ */
2654
+ declare const formatValidateError: (invalidFields: Record<string, any>, { config, useFieldTextInError }?: {
2655
+ config?: schema_d_exports.FormConfig;
2656
+ useFieldTextInError?: boolean;
2657
+ }) => string;
2658
+ //#endregion
2313
2659
  //#region temp/packages/form/src/plugin.d.ts
2660
+ /**
2661
+ * `@tmagic/form` 插件安装选项。
2662
+ */
2314
2663
  interface FormInstallOptions {
2664
+ /** 是否启用全局 flat 模式。 */
2315
2665
  flat?: boolean;
2316
- /** 自定义字段 type 的 typeMatch 校验规则,可覆盖内置规则或扩展业务字段 */
2317
- typeMatchRules?: Record<string, TypeMatchValidator>;
2666
+ /**
2667
+ * 自定义字段 type 的登记(叶子 / innerConfig / walk / typeMatch / component / container)。
2668
+ * 与 `registerFields` 相同。
2669
+ */
2670
+ fields?: Record<string, FieldOptions>;
2318
2671
  [key: string]: any;
2319
2672
  }
2320
2673
  declare const _default$31: {
2674
+ /**
2675
+ * 安装 `@tmagic/form`:登记内置字段、挂载 `m-form` / `m-form-dialog` / `m-form-drawer`。
2676
+ *
2677
+ * @param app - Vue 应用
2678
+ * @param [opt] - 安装选项
2679
+ */
2321
2680
  install(app: App, opt?: FormInstallOptions): void;
2322
2681
  };
2323
2682
  declare namespace index_d_exports {
2324
- export { ChangeRecord, ContainerChangeEventData, FORM_DIFF_CONFIG_KEY, FORM_SILENT_MODE_KEY, FORM_TYPE_MATCH_VALID_KEY, FormDiffConfig, FormInstallOptions, FormLabelSlotProps, FormSlots, MAX_SUGGESTION_OPTIONS, _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, clearSilentLeafFieldTypes, clearTypeMatchRules, createForm, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteField as deleteFormField, deleteTypeMatchRule, display, filterFunction, getDataByPage, getField as getFormField, getRules, getSilentLeafFieldTypes, getTypeMatchRule, initValue, optionSuggestion, registerField as registerFormField, registerSilentLeafFieldTypes, registerTypeMatchRule, registerTypeMatchRules, sortArray, sortChange, stringifyExampleValue, stripTabItemsLazy, submitForm, useAddField, validateForm, validateTypeMatch };
2683
+ export { ChangeRecord, CollectedField, ContainerChangeEventData, FORM_CONTEXT_KEY, FORM_DIFF_CONFIG_KEY, FORM_TYPE_MATCH_VALID_KEY, FieldInnerConfig, FieldInnerConfigContext, FieldInnerConfigError, FieldInnerConfigResult, FieldMountValueEffect, FieldMountValueEffectContext, FieldOptions, FormDiffConfig, FormInstallOptions, FormLabelSlotProps, FormSlots, HeadlessFieldOptions, HeadlessFormStateOptions, MAX_SUGGESTION_OPTIONS, _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, ValidateValuesOptions, ValidateValuesResult, adaptFormValidator, appendProp, applyMountValueEffects, builtInFields, clearFields, clearTypeMatchRules, collectValidatableFields, createForm, createFormStateBase, createFormStateProxy, createHeadlessFormState, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteTypeMatchRule, display, filterFunction, formatValidateError, getDataByPage, getField as getFormField, getItemProp, getNativeRules, getRules, getTextByName, getTypeMatchRule, initValue, isFieldInnerConfigError, isLeafFieldType, isValidName, mergeFieldOptions, mergeFormContexts, optionSuggestion, registerBuiltInFields, registerField, registerFields, resolveItemType, sortArray, sortChange, stringifyExampleValue, stripTabItemsLazy, submitForm, unregisterField, useAddField, validateForm, validateTypeMatch, validateValues };
2325
2684
  }
2326
2685
  declare const createForm: <T extends [] = []>(config: schema_d_exports.FormConfig | T) => schema_d_exports.FormConfig | T;
2327
2686
  //#endregion
2328
- export { ChangeRecord, ContainerChangeEventData, FORM_DIFF_CONFIG_KEY, FORM_SILENT_MODE_KEY, FORM_TYPE_MATCH_VALID_KEY, FormDiffConfig, type FormInstallOptions, FormLabelSlotProps, FormSlots, MAX_SUGGESTION_OPTIONS, _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, clearSilentLeafFieldTypes, clearTypeMatchRules, createForm, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteField as deleteFormField, deleteTypeMatchRule, display, filterFunction, getDataByPage, getField as getFormField, getRules, getSilentLeafFieldTypes, getTypeMatchRule, initValue, optionSuggestion, registerField as registerFormField, registerSilentLeafFieldTypes, registerTypeMatchRule, registerTypeMatchRules, sortArray, sortChange, stringifyExampleValue, stripTabItemsLazy, submitForm, useAddField, validateForm, validateTypeMatch };
2687
+ export { ChangeRecord, type CollectedField, ContainerChangeEventData, FORM_CONTEXT_KEY, FORM_DIFF_CONFIG_KEY, FORM_TYPE_MATCH_VALID_KEY, type FieldInnerConfig, type FieldInnerConfigContext, FieldInnerConfigError, type FieldInnerConfigResult, type FieldMountValueEffect, type FieldMountValueEffectContext, type FieldOptions, FormDiffConfig, type FormInstallOptions, FormLabelSlotProps, FormSlots, type HeadlessFieldOptions, type HeadlessFormStateOptions, MAX_SUGGESTION_OPTIONS, _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, type SubmitFormOptions, type SubmitFormResult, type TypeMatchValidateContext, type TypeMatchValidator, ValidateError, type ValidateFormOptions, type ValidateValuesOptions, type ValidateValuesResult, adaptFormValidator, appendProp, applyMountValueEffects, builtInFields, clearFields, clearTypeMatchRules, collectValidatableFields, createForm, createFormStateBase, createFormStateProxy, createHeadlessFormState, createObjectProp, createValues, datetimeFormatter, _default$31 as default, deleteTypeMatchRule, display, filterFunction, formatValidateError, getDataByPage, getField as getFormField, getItemProp, getNativeRules, getRules, getTextByName, getTypeMatchRule, initValue, isFieldInnerConfigError, isLeafFieldType, isValidName, mergeFieldOptions, mergeFormContexts, optionSuggestion, registerBuiltInFields, registerField, registerFields, resolveItemType, sortArray, sortChange, stringifyExampleValue, stripTabItemsLazy, submitForm, unregisterField, useAddField, validateForm, validateTypeMatch, validateValues };