@tmagic/form 1.8.0-beta.27 → 1.8.0-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/containers/GroupList.vue_vue_type_script_setup_true_lang.js +26 -12
- package/dist/es/fields/Text.vue_vue_type_script_setup_true_lang.js +11 -8
- package/dist/es/style.css +40 -14
- package/dist/es/utils/form.js +14 -10
- package/dist/es/utils/tableGroupList.js +20 -1
- package/dist/es/utils/typeMatch.js +53 -24
- package/dist/style.css +40 -14
- package/dist/themes/magic-admin.css +40 -14
- package/dist/tmagic-form-headless.umd.cjs +71 -36
- package/dist/tmagic-form.umd.cjs +132 -63
- package/package.json +7 -7
- package/src/containers/GroupList.vue +23 -2
- package/src/theme/group-list.scss +52 -27
- package/src/utils/form.ts +4 -1
- package/src/utils/tableGroupList.ts +28 -1
- package/src/utils/typeMatch.ts +48 -17
- package/types/headless.d.ts +54 -54
- package/types/index.d.ts +57 -57
package/types/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import * as import__tmagic_form_schema from "@tmagic/form-schema";
|
|
|
10
10
|
* 所有层级的 Container(含嵌套在 fieldset / panel 等容器组件内部的 Container)通过 `inject` 获取,
|
|
11
11
|
* 无需逐层透传 prop。
|
|
12
12
|
*/
|
|
13
|
-
interface FormDiffConfig {
|
|
13
|
+
export interface FormDiffConfig {
|
|
14
14
|
/**
|
|
15
15
|
* 自定义"是否展示对比内容"的判断函数(仅在对比模式下生效)。
|
|
16
16
|
*
|
|
@@ -30,8 +30,8 @@ interface FormDiffConfig {
|
|
|
30
30
|
*/
|
|
31
31
|
selfDiffFieldTypes?: string[] | ((_defaultTypes: string[]) => string[]);
|
|
32
32
|
}
|
|
33
|
-
declare const FORM_DIFF_CONFIG_KEY: InjectionKey<FormDiffConfig>;
|
|
34
|
-
declare const FORM_TYPE_MATCH_VALID_KEY: InjectionKey<ComputedRef<boolean>>;
|
|
33
|
+
export declare const FORM_DIFF_CONFIG_KEY: InjectionKey<FormDiffConfig>;
|
|
34
|
+
export declare const FORM_TYPE_MATCH_VALID_KEY: InjectionKey<ComputedRef<boolean>>;
|
|
35
35
|
/**
|
|
36
36
|
* 宿主业务上下文,由 `MForm`(或更外层的 Editor)通过 `provide` 下发。
|
|
37
37
|
*
|
|
@@ -40,21 +40,21 @@ declare const FORM_TYPE_MATCH_VALID_KEY: InjectionKey<ComputedRef<boolean>>;
|
|
|
40
40
|
*
|
|
41
41
|
* 配置回调统一通过 `mForm.xxx` 读取,由 formState 的读穿 Proxy 落到这里。
|
|
42
42
|
*/
|
|
43
|
-
declare const FORM_CONTEXT_KEY: InjectionKey<ComputedRef<FormContext>>;
|
|
44
|
-
interface ValidateError {
|
|
43
|
+
export declare const FORM_CONTEXT_KEY: InjectionKey<ComputedRef<FormContext>>;
|
|
44
|
+
export interface ValidateError {
|
|
45
45
|
message: string;
|
|
46
46
|
field: string;
|
|
47
47
|
}
|
|
48
|
-
interface ChangeRecord {
|
|
48
|
+
export interface ChangeRecord {
|
|
49
49
|
propPath?: string;
|
|
50
50
|
value: any;
|
|
51
51
|
}
|
|
52
|
-
interface ContainerChangeEventData {
|
|
52
|
+
export interface ContainerChangeEventData {
|
|
53
53
|
modifyKey?: string;
|
|
54
54
|
changeRecords?: ChangeRecord[];
|
|
55
55
|
}
|
|
56
56
|
/** 自定义 label slot 的作用域参数 */
|
|
57
|
-
interface FormLabelSlotProps {
|
|
57
|
+
export interface FormLabelSlotProps {
|
|
58
58
|
/** 当前表单项配置 */
|
|
59
59
|
config: FormItemConfig;
|
|
60
60
|
/** 经处理后的类型 */
|
|
@@ -67,7 +67,7 @@ interface FormLabelSlotProps {
|
|
|
67
67
|
disabled?: boolean;
|
|
68
68
|
}
|
|
69
69
|
/** Form / Container 暴露的具名 slot 定义 */
|
|
70
|
-
interface FormSlots {
|
|
70
|
+
export interface FormSlots {
|
|
71
71
|
label(_props: FormLabelSlotProps): any;
|
|
72
72
|
}
|
|
73
73
|
//#endregion
|
|
@@ -91,7 +91,7 @@ interface HeadlessFormStateOptions {
|
|
|
91
91
|
* 差异:没有真实的表单实例,因此 `$emit` 为空实现、`fields` 注册表始终为空
|
|
92
92
|
* (该注册表在整个仓库中只写不读,不参与校验)。
|
|
93
93
|
*/
|
|
94
|
-
declare const createHeadlessFormState: (options: HeadlessFormStateOptions) => schema_d_exports.FormState;
|
|
94
|
+
export declare const createHeadlessFormState: (options: HeadlessFormStateOptions) => schema_d_exports.FormState;
|
|
95
95
|
/** `validateValues` 参数 */
|
|
96
96
|
interface ValidateValuesOptions extends HeadlessFormStateOptions {
|
|
97
97
|
/** 是否开启类型匹配校验 */
|
|
@@ -130,7 +130,7 @@ interface ValidateValuesResult {
|
|
|
130
130
|
* });
|
|
131
131
|
* ```
|
|
132
132
|
*/
|
|
133
|
-
declare const validateValues: (options: ValidateValuesOptions) => Promise<ValidateValuesResult>;
|
|
133
|
+
export declare const validateValues: (options: ValidateValuesOptions) => Promise<ValidateValuesResult>;
|
|
134
134
|
//#endregion
|
|
135
135
|
//#region temp/packages/form/src/utils/submitHeadless.d.ts
|
|
136
136
|
/**
|
|
@@ -247,19 +247,19 @@ interface ValidateFormOptions {
|
|
|
247
247
|
* 无法校验到这些标签页内的字段。校验场景需要一次性渲染全部字段,故在此统一去除 lazy。
|
|
248
248
|
* 处理基于深拷贝,不会污染调用方传入的原始 config。
|
|
249
249
|
*/
|
|
250
|
-
declare const stripTabItemsLazy: (config: schema_d_exports.FormConfig) => schema_d_exports.FormConfig;
|
|
250
|
+
export declare const stripTabItemsLazy: (config: schema_d_exports.FormConfig) => schema_d_exports.FormConfig;
|
|
251
251
|
/**
|
|
252
252
|
* 以命令式方式对一份「表单配置 + 值」做一次校验并取回表单值。
|
|
253
253
|
*
|
|
254
254
|
* 默认走无渲染实现(见 `@tmagic/form/headless`)。`dialog: true` 会把表单以弹层渲染出来。
|
|
255
255
|
*/
|
|
256
|
-
declare const submitForm: (options: SubmitFormOptions) => Promise<any>;
|
|
256
|
+
export declare const submitForm: (options: SubmitFormOptions) => Promise<any>;
|
|
257
257
|
/**
|
|
258
258
|
* 以命令式方式对一份「表单配置 + 值」做一次静默校验。
|
|
259
259
|
*
|
|
260
260
|
* 默认走无渲染实现。`dialog: true` 的处理详见 `submitForm`。
|
|
261
261
|
*/
|
|
262
|
-
declare const validateForm: (options: ValidateFormOptions) => Promise<string>;
|
|
262
|
+
export declare const validateForm: (options: ValidateFormOptions) => Promise<string>;
|
|
263
263
|
//#endregion
|
|
264
264
|
//#region temp/packages/form/src/utils/formStateProxy.d.ts
|
|
265
265
|
/**
|
|
@@ -268,7 +268,7 @@ declare const validateForm: (options: ValidateFormOptions) => Promise<string>;
|
|
|
268
268
|
* 用读穿 Proxy 而非 `{ ...a, ...b }`:展开会立即执行 accessor,
|
|
269
269
|
* 而宿主允许用 `{ get stage() { ... } }` 这类读时求值的描述符。
|
|
270
270
|
*/
|
|
271
|
-
declare const mergeFormContexts: (...layers: (schema_d_exports.FormContext | undefined | null)[]) => schema_d_exports.FormContext;
|
|
271
|
+
export declare const mergeFormContexts: (...layers: (schema_d_exports.FormContext | undefined | null)[]) => schema_d_exports.FormContext;
|
|
272
272
|
/**
|
|
273
273
|
* 将 coreState 与宿主业务上下文关联:读取时优先 core,miss 再读穿到 context。
|
|
274
274
|
*
|
|
@@ -281,7 +281,7 @@ declare const mergeFormContexts: (...layers: (schema_d_exports.FormContext | und
|
|
|
281
281
|
*
|
|
282
282
|
* 独立成文件,避免与 `form.ts` ↔ `typeMatch.ts` 形成循环依赖。
|
|
283
283
|
*/
|
|
284
|
-
declare const createFormStateProxy: (coreState: schema_d_exports.FormState, getContext: (() => schema_d_exports.FormContext) | Ref<schema_d_exports.FormContext>) => schema_d_exports.FormState;
|
|
284
|
+
export declare const createFormStateProxy: (coreState: schema_d_exports.FormState, getContext: (() => schema_d_exports.FormContext) | Ref<schema_d_exports.FormContext>) => schema_d_exports.FormState;
|
|
285
285
|
//#endregion
|
|
286
286
|
//#region temp/packages/form/src/utils/form.d.ts
|
|
287
287
|
type AsyncValidatorFn = (rule: any, value: any, callback: Function, source?: any, options?: any) => any;
|
|
@@ -289,9 +289,9 @@ type AsyncValidatorFn = (rule: any, value: any, callback: Function, source?: any
|
|
|
289
289
|
* 将 async-validator(Element Plus)风格的 validator 适配到当前 UI 库。
|
|
290
290
|
* TDesign 调用签名为 `(val) => boolean | CustomValidateObj | Promise`,无 callback。
|
|
291
291
|
*/
|
|
292
|
-
declare const adaptFormValidator: (validator: AsyncValidatorFn) => AsyncValidatorFn;
|
|
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?: {
|
|
292
|
+
export declare const adaptFormValidator: (validator: AsyncValidatorFn) => AsyncValidatorFn;
|
|
293
|
+
export 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
|
+
export declare const createFormStateBase: (ui?: {
|
|
295
295
|
$message?: any;
|
|
296
296
|
$messageBox?: any;
|
|
297
297
|
}) => {
|
|
@@ -309,48 +309,48 @@ declare const createFormStateBase: (ui?: {
|
|
|
309
309
|
* 供 `Container.vue` 与无渲染校验(`collectValidatableFields`)共用,两者对「该不该下钻」
|
|
310
310
|
* 的判断必须一致。
|
|
311
311
|
*/
|
|
312
|
-
declare const isValidName: (name: unknown) => boolean;
|
|
312
|
+
export declare const isValidName: (name: unknown) => boolean;
|
|
313
313
|
/**
|
|
314
314
|
* 在 `prop` 后追加一段路径。
|
|
315
315
|
*
|
|
316
316
|
* 用于容器把 `prop` 透传给子级时再拼上索引 / key(如 group-list 的行、table 的行)。
|
|
317
317
|
*/
|
|
318
|
-
declare const appendProp: (prop: string | undefined, key: string | number) => string;
|
|
318
|
+
export declare const appendProp: (prop: string | undefined, key: string | number) => string;
|
|
319
319
|
/**
|
|
320
320
|
* 由父级 `prop` 与配置项 `name` 拼出该配置项的完整 `prop`(即 FormItem 的 prop)。
|
|
321
321
|
*
|
|
322
322
|
* 调用方传入的 name 已按 `config.name || ''` 归一化,空 name 表示该配置项不占据值路径上的一层,
|
|
323
323
|
* 此时沿用父级 `prop`。
|
|
324
324
|
*/
|
|
325
|
-
declare const getItemProp: (prop?: string | undefined, name?: string | number | undefined) => string;
|
|
325
|
+
export declare const getItemProp: (prop?: string | undefined, name?: string | number | undefined) => string;
|
|
326
326
|
/**
|
|
327
327
|
* 归一化配置项的 `type`:求值动态 type、剥离容器语义的 type、驼峰转中划线、补默认值。
|
|
328
328
|
*
|
|
329
329
|
* 供 `Container.vue` 与无渲染校验共用,保证两者分派到的 type 完全一致。
|
|
330
330
|
*/
|
|
331
|
-
declare const resolveItemType: (mForm: schema_d_exports.FormState | undefined, config: any, props: any) => string;
|
|
332
|
-
declare const filterFunction: <T = any>(mForm: schema_d_exports.FormState | undefined, config: T | schema_d_exports.FilterFunction<T> | undefined, props: any) => T | undefined;
|
|
333
|
-
declare const display: (mForm: schema_d_exports.FormState | undefined, config: any, props: any) => any;
|
|
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[];
|
|
331
|
+
export declare const resolveItemType: (mForm: schema_d_exports.FormState | undefined, config: any, props: any) => string;
|
|
332
|
+
export declare const filterFunction: <T = any>(mForm: schema_d_exports.FormState | undefined, config: T | schema_d_exports.FilterFunction<T> | undefined, props: any) => T | undefined;
|
|
333
|
+
export declare const display: (mForm: schema_d_exports.FormState | undefined, config: any, props: any) => any;
|
|
334
|
+
export 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
335
|
/**
|
|
336
336
|
* 与 `getRules` 相同,但 validator 保持 async-validator(Element Plus)原生签名,不做 UI 库适配。
|
|
337
337
|
*
|
|
338
338
|
* 供无渲染校验(`validateValues`)使用:它直接把规则交给 async-validator 执行,
|
|
339
339
|
* 不经过 TDesign 的 `validator(val)` 调用约定,因此不能套 `adaptFormValidator`。
|
|
340
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[];
|
|
342
|
-
declare const initValue: (mForm: schema_d_exports.FormState | undefined, { initValues, config }: {
|
|
341
|
+
export 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[];
|
|
342
|
+
export declare const initValue: (mForm: schema_d_exports.FormState | undefined, { initValues, config }: {
|
|
343
343
|
initValues: schema_d_exports.FormValue;
|
|
344
344
|
config: schema_d_exports.FormConfig;
|
|
345
345
|
}) => Promise<schema_d_exports.FormValue>;
|
|
346
|
-
declare const datetimeFormatter: (v: string | Date, defaultValue?: string, format?: string) => string | number;
|
|
347
|
-
declare const getDataByPage: (data: any[] | undefined, pagecontext: number, pagesize: number) => any[];
|
|
348
|
-
declare const sortArray: (data: any[], newIndex: number, oldIndex: number, sortKey?: string) => any[];
|
|
349
|
-
declare const sortChange: (data: any[], { prop, order }: schema_d_exports.SortProp) => void;
|
|
350
|
-
declare const createObjectProp: (prop: string, key: string, name?: string | number) => string;
|
|
346
|
+
export declare const datetimeFormatter: (v: string | Date, defaultValue?: string, format?: string) => string | number;
|
|
347
|
+
export declare const getDataByPage: (data: any[] | undefined, pagecontext: number, pagesize: number) => any[];
|
|
348
|
+
export declare const sortArray: (data: any[], newIndex: number, oldIndex: number, sortKey?: string) => any[];
|
|
349
|
+
export declare const sortChange: (data: any[], { prop, order }: schema_d_exports.SortProp) => void;
|
|
350
|
+
export declare const createObjectProp: (prop: string, key: string, name?: string | number) => string;
|
|
351
351
|
//#endregion
|
|
352
352
|
//#region temp/packages/form/src/utils/useAddField.d.ts
|
|
353
|
-
declare const useAddField: (prop?: string) => void;
|
|
353
|
+
export declare const useAddField: (prop?: string) => void;
|
|
354
354
|
//#endregion
|
|
355
355
|
//#region temp/packages/form/src/Form.vue.d.ts
|
|
356
356
|
type __VLS_Slots$6 = FormSlots;
|
|
@@ -2332,13 +2332,13 @@ interface CollectedField {
|
|
|
2332
2332
|
model: schema_d_exports.FormValue;
|
|
2333
2333
|
}
|
|
2334
2334
|
/** 已登记的 innerConfig 回调自身抛错时抛出(机制故障,不是漏登记) */
|
|
2335
|
-
declare class FieldInnerConfigError extends Error {
|
|
2335
|
+
export declare class FieldInnerConfigError extends Error {
|
|
2336
2336
|
readonly code = "FIELD_INNER_CONFIG";
|
|
2337
2337
|
readonly type: string;
|
|
2338
2338
|
readonly prop: string;
|
|
2339
2339
|
constructor(type: string, prop: string, cause: unknown);
|
|
2340
2340
|
}
|
|
2341
|
-
declare const isFieldInnerConfigError: (error: unknown) => error is FieldInnerConfigError;
|
|
2341
|
+
export declare const isFieldInnerConfigError: (error: unknown) => error is FieldInnerConfigError;
|
|
2342
2342
|
/**
|
|
2343
2343
|
* 遍历模式。同一套遍历规则服务两个用途,避免两条链路各写一份而产生偏差:
|
|
2344
2344
|
*
|
|
@@ -2389,7 +2389,7 @@ type ContainerWalker = (_ctx: WalkContext, _node: WalkNode, _itemProp: string) =
|
|
|
2389
2389
|
* `typeMatch` 的字段会补上 `{ typeMatch: true }`,按字段 type 校验值形态
|
|
2390
2390
|
* @returns 带规则的字段列表
|
|
2391
2391
|
*/
|
|
2392
|
-
declare const collectValidatableFields: (mForm: schema_d_exports.FormState | undefined, config: schema_d_exports.FormConfig, values: schema_d_exports.FormValue, typeMatchValid?: boolean) => CollectedField[];
|
|
2392
|
+
export declare const collectValidatableFields: (mForm: schema_d_exports.FormState | undefined, config: schema_d_exports.FormConfig, values: schema_d_exports.FormValue, typeMatchValid?: boolean) => CollectedField[];
|
|
2393
2393
|
/**
|
|
2394
2394
|
* 执行「一份 config + 一份 values」中所有叶子字段登记的值初始化写入,就地改写 `values`。
|
|
2395
2395
|
*
|
|
@@ -2408,7 +2408,7 @@ declare const collectValidatableFields: (mForm: schema_d_exports.FormState | und
|
|
|
2408
2408
|
* @param config - 表单配置
|
|
2409
2409
|
* @param values - 表单值(会被就地修改)
|
|
2410
2410
|
*/
|
|
2411
|
-
declare const applyMountValueEffects: (mForm: schema_d_exports.FormState | undefined, config: schema_d_exports.FormConfig, values: schema_d_exports.FormValue) => void;
|
|
2411
|
+
export declare const applyMountValueEffects: (mForm: schema_d_exports.FormState | undefined, config: schema_d_exports.FormConfig, values: schema_d_exports.FormValue) => void;
|
|
2412
2412
|
//#endregion
|
|
2413
2413
|
//#region temp/packages/form/src/utils/fieldInnerConfig.d.ts
|
|
2414
2414
|
/** innerConfig 回调的入参:字段自身的配置、所在层级的 model、完整字段路径与表单状态 */
|
|
@@ -2491,7 +2491,7 @@ type FieldMountValueEffect = (_ctx: FieldMountValueEffectContext) => void;
|
|
|
2491
2491
|
* @param type - 字段 type
|
|
2492
2492
|
* @returns 是否为叶子
|
|
2493
2493
|
*/
|
|
2494
|
-
declare const isLeafFieldType: (type: string) => boolean;
|
|
2494
|
+
export declare const isLeafFieldType: (type: string) => boolean;
|
|
2495
2495
|
//#endregion
|
|
2496
2496
|
//#region temp/packages/form/src/utils/typeMatch.d.ts
|
|
2497
2497
|
interface TypeMatchValidateContext {
|
|
@@ -2507,28 +2507,28 @@ interface TypeMatchValidateContext {
|
|
|
2507
2507
|
*/
|
|
2508
2508
|
type TypeMatchValidator = (value: any, context: TypeMatchValidateContext) => string | undefined | Promise<string | undefined>;
|
|
2509
2509
|
/** 获取某个字段 type 的 typeMatch 校验规则(业务侧优先于内置) */
|
|
2510
|
-
declare const getTypeMatchRule: (type: string) => TypeMatchValidator | undefined;
|
|
2510
|
+
export declare const getTypeMatchRule: (type: string) => TypeMatchValidator | undefined;
|
|
2511
2511
|
/** 删除业务侧 typeMatch 校验规则(不影响内置) */
|
|
2512
|
-
declare const deleteTypeMatchRule: (type: string) => boolean;
|
|
2512
|
+
export declare const deleteTypeMatchRule: (type: string) => boolean;
|
|
2513
2513
|
/** 清空业务侧 typeMatch 校验规则(不影响内置) */
|
|
2514
|
-
declare const clearTypeMatchRules: () => void;
|
|
2514
|
+
export declare const clearTypeMatchRules: () => void;
|
|
2515
2515
|
/**
|
|
2516
2516
|
* 将值格式化为可读的参考示例字符串。
|
|
2517
2517
|
*/
|
|
2518
|
-
declare const stringifyExampleValue: (value: any) => string;
|
|
2518
|
+
export declare const stringifyExampleValue: (value: any) => string;
|
|
2519
2519
|
/** 参考建议中可选值全量展示上限;超出时仅举例 EXAMPLE_SUGGESTION_COUNT 个并标明总数。 */
|
|
2520
|
-
declare const MAX_SUGGESTION_OPTIONS = 20;
|
|
2520
|
+
export declare const MAX_SUGGESTION_OPTIONS = 20;
|
|
2521
2521
|
/**
|
|
2522
2522
|
* 生成可选项参考建议;无可选值时返回空字符串(不追加建议)。
|
|
2523
2523
|
* 未超过 MAX_SUGGESTION_OPTIONS 时全部列举;超过时仅举例前 EXAMPLE_SUGGESTION_COUNT 个并标明总数,避免 AI 误以为仅有举例值合法。
|
|
2524
2524
|
*/
|
|
2525
|
-
declare const optionSuggestion: (optionValues: any[]) => string;
|
|
2525
|
+
export declare const optionSuggestion: (optionValues: any[]) => string;
|
|
2526
2526
|
/**
|
|
2527
2527
|
* 校验取值与字段 type 是否匹配;通过返回 undefined,否则返回错误文案。
|
|
2528
2528
|
*
|
|
2529
2529
|
* 命中的自定义规则是异步校验器时返回 Promise,内置规则始终同步返回。
|
|
2530
2530
|
*/
|
|
2531
|
-
declare const validateTypeMatch: (value: any, mForm: schema_d_exports.FormState | undefined, props: any, message?: string) => string | undefined | Promise<string | undefined>;
|
|
2531
|
+
export declare const validateTypeMatch: (value: any, mForm: schema_d_exports.FormState | undefined, props: any, message?: string) => string | undefined | Promise<string | undefined>;
|
|
2532
2532
|
//#endregion
|
|
2533
2533
|
//#region temp/packages/form/src/utils/registerField.d.ts
|
|
2534
2534
|
/**
|
|
@@ -2576,7 +2576,7 @@ type HeadlessFieldOptions = Omit<FieldOptions, 'component' | 'container'>;
|
|
|
2576
2576
|
* @param tables - 待合并的登记表,`undefined` 会被跳过
|
|
2577
2577
|
* @returns 合并后的登记表
|
|
2578
2578
|
*/
|
|
2579
|
-
declare const mergeFieldOptions: (...tables: Array<Record<string, HeadlessFieldOptions | FieldOptions> | undefined>) => Record<string, FieldOptions>;
|
|
2579
|
+
export declare const mergeFieldOptions: (...tables: Array<Record<string, HeadlessFieldOptions | FieldOptions> | undefined>) => Record<string, FieldOptions>;
|
|
2580
2580
|
/**
|
|
2581
2581
|
* 按字段 type 取已登记的渲染组件(`codeSelect` 与 `code-select` 等价)。
|
|
2582
2582
|
*
|
|
@@ -2595,29 +2595,29 @@ declare const getField: (type: string) => Component | undefined;
|
|
|
2595
2595
|
* @param [options] - 登记项;省略或空对象视为叶子
|
|
2596
2596
|
* @param [app] - Vue 应用;省略则不调用 `app.component`
|
|
2597
2597
|
*/
|
|
2598
|
-
declare const registerField: (type: string, options?: FieldOptions, app?: App) => void;
|
|
2598
|
+
export declare const registerField: (type: string, options?: FieldOptions, app?: App) => void;
|
|
2599
2599
|
/**
|
|
2600
2600
|
* 批量登记字段。
|
|
2601
2601
|
*
|
|
2602
2602
|
* @param fields - type 到登记项的映射
|
|
2603
2603
|
* @param [app] - Vue 应用;省略则不调用 `app.component`
|
|
2604
2604
|
*/
|
|
2605
|
-
declare const registerFields: (fields: Record<string, FieldOptions>, app?: App) => void;
|
|
2605
|
+
export declare const registerFields: (fields: Record<string, FieldOptions>, app?: App) => void;
|
|
2606
2606
|
/**
|
|
2607
2607
|
* 登记内置字段(`clearFields` / `unregisterField` 不会清掉)。
|
|
2608
2608
|
*
|
|
2609
2609
|
* @param fields - type 到登记项的映射
|
|
2610
2610
|
* @param [app] - Vue 应用;省略则不调用 `app.component`
|
|
2611
2611
|
*/
|
|
2612
|
-
declare const registerBuiltInFields: (fields: Record<string, FieldOptions>, app?: App) => void;
|
|
2612
|
+
export declare const registerBuiltInFields: (fields: Record<string, FieldOptions>, app?: App) => void;
|
|
2613
2613
|
/**
|
|
2614
2614
|
* 删除业务侧对指定 type 的登记(不影响内置;主要用于单测)。
|
|
2615
2615
|
*
|
|
2616
2616
|
* @param type - 字段 type
|
|
2617
2617
|
*/
|
|
2618
|
-
declare const unregisterField: (type: string) => void;
|
|
2618
|
+
export declare const unregisterField: (type: string) => void;
|
|
2619
2619
|
/** 清空业务侧登记(不影响内置;主要用于单测)。 */
|
|
2620
|
-
declare const clearFields: () => void;
|
|
2620
|
+
export declare const clearFields: () => void;
|
|
2621
2621
|
//#endregion
|
|
2622
2622
|
//#region temp/packages/form/src/utils/builtInFields.d.ts
|
|
2623
2623
|
/**
|
|
@@ -2626,7 +2626,7 @@ declare const clearFields: () => void;
|
|
|
2626
2626
|
* 本模块只导出数据,不登记。调用方自行 `registerBuiltInFields(builtInFields)`,
|
|
2627
2627
|
* 或 `app.use(MagicForm)`(install 里会登记叠上 Vue 组件后的表)。
|
|
2628
2628
|
*/
|
|
2629
|
-
declare const builtInFields: Record<string, HeadlessFieldOptions>;
|
|
2629
|
+
export declare const builtInFields: Record<string, HeadlessFieldOptions>;
|
|
2630
2630
|
//#endregion
|
|
2631
2631
|
//#region temp/packages/form/src/utils/validateError.d.ts
|
|
2632
2632
|
/**
|
|
@@ -2636,7 +2636,7 @@ declare const builtInFields: Record<string, HeadlessFieldOptions>;
|
|
|
2636
2636
|
* @param config - 表单配置数组
|
|
2637
2637
|
* @returns 找到的 text 值,如果未找到则返回 undefined
|
|
2638
2638
|
*/
|
|
2639
|
-
declare const getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
|
|
2639
|
+
export declare const getTextByName: (name: string, config?: schema_d_exports.FormConfig) => string | undefined;
|
|
2640
2640
|
/**
|
|
2641
2641
|
* 将校验返回的 invalidFields 汇总为可读的错误文案(多条以 `<br>` 拼接)。
|
|
2642
2642
|
*
|
|
@@ -2651,7 +2651,7 @@ declare const getTextByName: (name: string, config?: schema_d_exports.FormConfig
|
|
|
2651
2651
|
* @param [options.useFieldTextInError=true] - 错误前缀是否使用字段 text
|
|
2652
2652
|
* @returns 拼接后的错误文案;无错误时为空串
|
|
2653
2653
|
*/
|
|
2654
|
-
declare const formatValidateError: (invalidFields: Record<string, any>, { config, useFieldTextInError }?: {
|
|
2654
|
+
export declare const formatValidateError: (invalidFields: Record<string, any>, { config, useFieldTextInError }?: {
|
|
2655
2655
|
config?: schema_d_exports.FormConfig;
|
|
2656
2656
|
useFieldTextInError?: boolean;
|
|
2657
2657
|
}) => string;
|
|
@@ -2682,6 +2682,6 @@ declare const _default$31: {
|
|
|
2682
2682
|
declare namespace index_d_exports {
|
|
2683
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 };
|
|
2684
2684
|
}
|
|
2685
|
-
declare const createForm: <T extends [] = []>(config: schema_d_exports.FormConfig | T) => schema_d_exports.FormConfig | T;
|
|
2685
|
+
export declare const createForm: <T extends [] = []>(config: schema_d_exports.FormConfig | T) => schema_d_exports.FormConfig | T;
|
|
2686
2686
|
//#endregion
|
|
2687
|
-
export {
|
|
2687
|
+
export { type CollectedField, type FieldInnerConfig, type FieldInnerConfigContext, type FieldInnerConfigResult, type FieldMountValueEffect, type FieldMountValueEffectContext, type FieldOptions, type FormInstallOptions, type HeadlessFieldOptions, type HeadlessFormStateOptions, _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, type ValidateFormOptions, type ValidateValuesOptions, type ValidateValuesResult, _default$31 as default, getField as getFormField };
|