@dazhicheng/ui 1.5.158 → 1.5.160
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/components/tt-form/index.d.ts +4 -2
- package/dist/components/tt-form/src/form-render/FormArrayRegister.d.ts +14 -3
- package/dist/components/tt-form/src/formApi.d.ts +21 -11
- package/dist/components/tt-form/src/group-form/groupFormApi.d.ts +1 -1
- package/dist/components/tt-form/src/hooks/useArrayRegistry.d.ts +2 -2
- package/dist/components/tt-form/src/hooks/useFieldArray.d.ts +2 -2
- package/dist/components/tt-form/src/index.vue.d.ts +2 -2
- package/dist/components/tt-form/src/types/forms.d.ts +27 -18
- package/dist/components/tt-form/src/types.d.ts +30 -6
- package/dist/components/tt-form/src/utils/array-path.d.ts +11 -1
- package/dist/index.js +6356 -6310
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseFormComponentType, ExtendedFormApi, FormRenderProps, FormSchema, TtFormProps } from './src/types';
|
|
3
3
|
import { COMPONENT_MAP } from './src/config';
|
|
4
4
|
import { useForm } from './src/useForm';
|
|
5
5
|
declare function setConfig(rules?: Record<string, (value: any, params: any, ctx: Record<string, any>) => boolean | string>, modelPropNameMap?: Partial<Record<BaseFormComponentType, string>>): void;
|
|
@@ -9,7 +9,9 @@ export { COMPONENT_MAP, useForm };
|
|
|
9
9
|
type TtFormSchema = FormSchema<BaseFormComponentType>;
|
|
10
10
|
type TtFormRenderProps = FormRenderProps<BaseFormComponentType>;
|
|
11
11
|
type TtExtendedFormApi = ExtendedFormApi;
|
|
12
|
-
export type { BaseFormComponentMap, BaseFormComponentType, FormSlotSchema, InferredComponentPropsType,
|
|
12
|
+
export type { ArraySchemaContext, BaseFormComponentMap, BaseFormComponentType, FormArrayActions, FormSlotSchema, InferredComponentPropsType, NestedArrayHandle, } from './src/types';
|
|
13
|
+
export type { FieldArrayContext, FieldEntry, ReadonlyFieldEntry, ResolvedFieldArrayContext } from './src/types/forms';
|
|
14
|
+
export type { TtExtendedFormApi, TtFormProps, TtFormRenderProps, TtFormSchema };
|
|
13
15
|
export * as z from 'zod';
|
|
14
16
|
export { useGroupForm } from './src/group-form';
|
|
15
17
|
export type { FormGroupSchema, GroupFormNavAnchorProps, GroupFormSchema, UseGroupFormNavAnchorProps, UseGroupFormOptions, UseGroupFormOptionsWithGroupSchema, UseGroupFormOptionsWithLegacySchema, } from './src/group-form';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
2
|
import { Recordable } from '../../../../../../utils/src';
|
|
3
3
|
import { FieldEntry } from '../types/forms';
|
|
4
|
-
import { FormSchema } from '../types';
|
|
5
|
-
type ArraySchemaProp = FormSchema[] | ((entry: FieldEntry<Recordable>, currentIndex: number) => FormSchema[]);
|
|
4
|
+
import { ArraySchemaContext, FormSchema } from '../types';
|
|
5
|
+
type ArraySchemaProp = FormSchema[] | ((entry: FieldEntry<Recordable>, currentIndex: number, ctx?: ArraySchemaContext) => FormSchema[]);
|
|
6
6
|
declare const FormArrayRegister: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
7
7
|
fieldName: {
|
|
8
8
|
type: PropType<string>;
|
|
@@ -24,9 +24,14 @@ declare const FormArrayRegister: import('vue').DefineComponent<import('vue').Ext
|
|
|
24
24
|
type: BooleanConstructor;
|
|
25
25
|
default: boolean;
|
|
26
26
|
};
|
|
27
|
+
/** useArraySchema 时:每一行数组项的外层容器 class(边框、间距等) */
|
|
28
|
+
wrapperClass: {
|
|
29
|
+
type: PropType<NonNullable<FormSchema["wrapperClass"]>>;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
27
32
|
}>, () => (import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
28
33
|
[key: string]: any;
|
|
29
|
-
}>[] | undefined)[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
34
|
+
}>[] | import("vue/jsx-runtime").JSX.Element | undefined)[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
30
35
|
fieldName: {
|
|
31
36
|
type: PropType<string>;
|
|
32
37
|
required: true;
|
|
@@ -47,7 +52,13 @@ declare const FormArrayRegister: import('vue').DefineComponent<import('vue').Ext
|
|
|
47
52
|
type: BooleanConstructor;
|
|
48
53
|
default: boolean;
|
|
49
54
|
};
|
|
55
|
+
/** useArraySchema 时:每一行数组项的外层容器 class(边框、间距等) */
|
|
56
|
+
wrapperClass: {
|
|
57
|
+
type: PropType<NonNullable<FormSchema["wrapperClass"]>>;
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
50
60
|
}>> & Readonly<{}>, {
|
|
61
|
+
wrapperClass: string;
|
|
51
62
|
rules: import('../types').FormSchemaRuleType | undefined;
|
|
52
63
|
arraySchema: ArraySchemaProp;
|
|
53
64
|
formItemClass: NonNullable<string | (() => string) | undefined>;
|
|
@@ -2,10 +2,10 @@ import { FormState, GenericObject, ResetFormOpts, ValidationOptions } from 'vee-
|
|
|
2
2
|
import { ComponentPublicInstance } from 'vue';
|
|
3
3
|
import { Recordable, StateHandler } from '../../../../../utils/src';
|
|
4
4
|
import { FormActions, FormArrayActions, FormSchema, NestedArrayHandle, TtFormProps } from './types';
|
|
5
|
-
import { FieldArrayContext } from './types/forms';
|
|
5
|
+
import { FieldArrayContext, ResolvedFieldArrayContext } from './types/forms';
|
|
6
6
|
import { Store } from './shared/store';
|
|
7
7
|
export type { ArrayPathSegment } from './utils/array-path';
|
|
8
|
-
export { buildArrayFieldPath } from './utils/array-path';
|
|
8
|
+
export { buildArrayFieldPath, collectArrayFieldPathAliases, normalizeArrayFieldPath } from './utils/array-path';
|
|
9
9
|
export declare class FormApi {
|
|
10
10
|
form: FormActions;
|
|
11
11
|
isMounted: boolean;
|
|
@@ -147,7 +147,7 @@ export declare class FormApi {
|
|
|
147
147
|
* @param name 需要注册的数组字段
|
|
148
148
|
* @param actions 操作方法
|
|
149
149
|
*/
|
|
150
|
-
registerArrayField(name: string, actions:
|
|
150
|
+
registerArrayField(name: string, actions: ResolvedFieldArrayContext): void;
|
|
151
151
|
unregisterArrayField(name: string): void;
|
|
152
152
|
/** @description 数组字段操作集合 */
|
|
153
153
|
get arrayAction(): {
|
|
@@ -162,27 +162,27 @@ export declare class FormApi {
|
|
|
162
162
|
* @param name 数组字段名(例如 `fieldName的值 数组下才生效`)
|
|
163
163
|
* @param value 要追加的数组项值
|
|
164
164
|
*/
|
|
165
|
-
push: <TValue = unknown>(name: string, value: TValue) => void
|
|
165
|
+
push: <TValue = unknown>(name: string, value: TValue) => void;
|
|
166
166
|
/**
|
|
167
167
|
* @description 删除指定索引的项
|
|
168
168
|
* @param name 数组字段名(例如 `fieldName的值 数组下才生效`)
|
|
169
169
|
* @param idx 要删除的索引位置
|
|
170
170
|
*/
|
|
171
|
-
remove: (name: string, idx: number) => void
|
|
171
|
+
remove: (name: string, idx: number) => void;
|
|
172
172
|
/**
|
|
173
173
|
* @description 整体替换数组值
|
|
174
174
|
* @template TValue 数组项类型
|
|
175
175
|
* @param name 数组字段名(例如 `fieldName的值 数组下才生效`)
|
|
176
176
|
* @param values 新的完整数组字段
|
|
177
177
|
*/
|
|
178
|
-
replace: <TValue = unknown>(name: string, values: TValue[]) => void
|
|
178
|
+
replace: <TValue = unknown>(name: string, values: TValue[]) => void;
|
|
179
179
|
/**
|
|
180
180
|
* @description更新指定索引的项
|
|
181
181
|
* @param name 数组字段名(例如 `fieldName的值 数组下才生效`)
|
|
182
182
|
* @param idx 要更新的索引位置
|
|
183
183
|
* @param value 更新后的数组项值
|
|
184
184
|
*/
|
|
185
|
-
update: <TValue = unknown>(name: string, idx: number, value: TValue) => void
|
|
185
|
+
update: <TValue = unknown>(name: string, idx: number, value: TValue) => void;
|
|
186
186
|
/**
|
|
187
187
|
* @description 在指定索引插入一项
|
|
188
188
|
* @template TValue 数组项类型
|
|
@@ -190,28 +190,28 @@ export declare class FormApi {
|
|
|
190
190
|
* @param idx 插入位置索引
|
|
191
191
|
* @param value 要插入的数组项值
|
|
192
192
|
*/
|
|
193
|
-
insert: <TValue = unknown>(name: string, idx: number, value: TValue) => void
|
|
193
|
+
insert: <TValue = unknown>(name: string, idx: number, value: TValue) => void;
|
|
194
194
|
/**
|
|
195
195
|
* @description 在数组头部新增一项
|
|
196
196
|
* @template TValue 数组项类型
|
|
197
197
|
* @param name 数组字段名(例如 `fieldName的值 数组下才生效`)
|
|
198
198
|
* @param value 要插入到头部的数组项值
|
|
199
199
|
*/
|
|
200
|
-
prepend: <TValue = unknown>(name: string, value: TValue) => void
|
|
200
|
+
prepend: <TValue = unknown>(name: string, value: TValue) => void;
|
|
201
201
|
/**
|
|
202
202
|
* @description 将项从旧索引移动到新索引
|
|
203
203
|
* @param name 数组字段名(例如 `fieldName的值 数组下才生效`)
|
|
204
204
|
* @param oldIdx 原索引位置
|
|
205
205
|
* @param newIdx 新索引位置
|
|
206
206
|
*/
|
|
207
|
-
move: (name: string, oldIdx: number, newIdx: number) => void
|
|
207
|
+
move: (name: string, oldIdx: number, newIdx: number) => void;
|
|
208
208
|
/**
|
|
209
209
|
* @description 交换两个索引位置的项
|
|
210
210
|
* @param name 数组字段名(例如 `fieldName的值 数组下才生效`)
|
|
211
211
|
* @param indexA 第一个索引位置
|
|
212
212
|
* @param indexB 第二个索引位置
|
|
213
213
|
*/
|
|
214
|
-
swap: (name: string, indexA: number, indexB: number) => void
|
|
214
|
+
swap: (name: string, indexA: number, indexB: number) => void;
|
|
215
215
|
/**
|
|
216
216
|
* @description 获取嵌套数组路径下的操作器
|
|
217
217
|
* @param parentPath 父数组路径(如 actions.data),或完整路径(仅传 path)
|
|
@@ -220,7 +220,17 @@ export declare class FormApi {
|
|
|
220
220
|
*/
|
|
221
221
|
at: FormArrayActions["at"];
|
|
222
222
|
};
|
|
223
|
+
/**
|
|
224
|
+
* @description 将业务传入路径规范化为数组注册表键
|
|
225
|
+
*/
|
|
226
|
+
protected _resolveArrayFieldPath(name: string): string;
|
|
227
|
+
private _getRegisteredArrayField;
|
|
223
228
|
private _getArrayFieldActions;
|
|
229
|
+
/**
|
|
230
|
+
* @description 开发环境:数组字段未注册时输出告警与相近路径提示
|
|
231
|
+
*/
|
|
232
|
+
private _warnUnregisteredArrayField;
|
|
233
|
+
private _mutateArrayField;
|
|
224
234
|
/**
|
|
225
235
|
* @description 创建嵌套数组操作器(在原 inline 实现基础上支持链式 `.at`)
|
|
226
236
|
*/
|
|
@@ -271,7 +271,7 @@ export declare class GroupFormApi extends FormApi {
|
|
|
271
271
|
* @description 卸载分组表单时恢复初始schema
|
|
272
272
|
*/
|
|
273
273
|
get arrayAction(): {
|
|
274
|
-
get: <TValue = unknown>(name: string) => Readonly<import('
|
|
274
|
+
get: <TValue = unknown>(name: string) => Readonly<import('../..').FieldArrayContext<TValue>> | undefined;
|
|
275
275
|
push: <TValue = unknown>(name: string, value: TValue) => void;
|
|
276
276
|
remove: (name: string, idx: number) => void;
|
|
277
277
|
replace: <TValue = unknown>(name: string, values: TValue[]) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function useArrayRegistry(name: string): readonly [(actions?:
|
|
1
|
+
import { ResolvedFieldArrayContext } from '../types/forms';
|
|
2
|
+
export declare function useArrayRegistry(name: string): readonly [(actions?: ResolvedFieldArrayContext) => void, () => void];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { ResolvedFieldArrayContext } from '../types/forms';
|
|
3
3
|
/**
|
|
4
4
|
* 与 vee-validate `useFieldArray` API 对齐:稳定 `key`、`entry.value` 可写(支持 v-model),
|
|
5
5
|
* 外部 `resetForm` / `setValues` 时同步行列表;不使用官方 `computedDeep` 与易递归的深拷贝双向 watch。
|
|
6
6
|
*/
|
|
7
|
-
export declare function useFieldArray<TValue extends Record<string, unknown> = Record<string, unknown>>(arrayPath: MaybeRefOrGetter<string>):
|
|
7
|
+
export declare function useFieldArray<TValue extends Record<string, unknown> = Record<string, unknown>>(arrayPath: MaybeRefOrGetter<string>): ResolvedFieldArrayContext<TValue>;
|
|
@@ -26,7 +26,7 @@ declare function __VLS_template(): {
|
|
|
26
26
|
readonly componentBindEventMap?: Partial<Record<import('./types').BaseFormComponentType, string>> | undefined;
|
|
27
27
|
readonly componentMap: Record<import('./types').BaseFormComponentType, import('vue').Component>;
|
|
28
28
|
readonly fieldMappingTime?: import('./types').FieldMappingTime | undefined;
|
|
29
|
-
readonly form?: import('
|
|
29
|
+
readonly form?: import('./types').FormActions | undefined;
|
|
30
30
|
readonly layout?: import('./types').FormLayout | undefined;
|
|
31
31
|
readonly schema?: (FormSchema<keyof import('./types').BaseFormComponentMap> | import('./types').FormSlotSchema)[] | undefined;
|
|
32
32
|
readonly showCollapseButton?: boolean | undefined;
|
|
@@ -113,7 +113,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
113
113
|
readonly componentBindEventMap?: Partial<Record<import('./types').BaseFormComponentType, string>> | undefined;
|
|
114
114
|
readonly componentMap: Record<import('./types').BaseFormComponentType, import('vue').Component>;
|
|
115
115
|
readonly fieldMappingTime?: import('./types').FieldMappingTime | undefined;
|
|
116
|
-
readonly form?: import('
|
|
116
|
+
readonly form?: import('./types').FormActions | undefined;
|
|
117
117
|
readonly layout?: import('./types').FormLayout | undefined;
|
|
118
118
|
readonly schema?: (FormSchema<keyof import('./types').BaseFormComponentMap> | import('./types').FormSlotSchema)[] | undefined;
|
|
119
119
|
readonly showCollapseButton?: boolean | undefined;
|
|
@@ -4,7 +4,7 @@ import { ComputedRef, MaybeRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
|
4
4
|
import { FlattenAndSetPathsType, GenericObject, MapValuesPathsToRefs, MaybeArray, MaybePromise } from './common';
|
|
5
5
|
import { Path, PathValue } from './paths';
|
|
6
6
|
import { FieldValidationMetaInfo } from './shared';
|
|
7
|
-
import {
|
|
7
|
+
import { FieldArrayContext as VeeFieldArrayContext, FieldEntry } from 'vee-validate';
|
|
8
8
|
export type ValidationResult<TValue = unknown> = {
|
|
9
9
|
errors: string[];
|
|
10
10
|
valid: boolean;
|
|
@@ -87,27 +87,37 @@ export type PathState<TInput = unknown, TOutput = TInput> = {
|
|
|
87
87
|
};
|
|
88
88
|
validate?: FieldValidator<TOutput>;
|
|
89
89
|
};
|
|
90
|
-
export type FieldEntry
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
export type { FieldEntry };
|
|
91
|
+
/** 递归只读,用于 `arrayAction.get()` 返回的 `fields[].value` */
|
|
92
|
+
export type DeepReadonly<T> = T extends (...args: never[]) => unknown ? T : T extends readonly (infer U)[] ? readonly DeepReadonly<U>[] : T extends object ? {
|
|
93
|
+
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
94
|
+
} : T;
|
|
95
|
+
/** `arrayAction.get()` 返回的数组项(只读快照,不可改 `value` 及其嵌套字段) */
|
|
96
|
+
export type ReadonlyFieldEntry<TValue = unknown> = {
|
|
97
|
+
readonly value: DeepReadonly<TValue>;
|
|
98
|
+
readonly key: string | number;
|
|
99
|
+
readonly isFirst: boolean;
|
|
100
|
+
readonly isLast: boolean;
|
|
95
101
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
move: (oldIdx: number, newIdx: number) => void;
|
|
102
|
+
/** vee-validate 原始数组上下文(`fields` 为 Ref,用于 `useFieldArray` / 注册表) */
|
|
103
|
+
export type ResolvedFieldArrayContext<TValue = unknown> = VeeFieldArrayContext<TValue>;
|
|
104
|
+
/**
|
|
105
|
+
* 经 FormApi `reactive(Map)` 读取时的数组上下文。
|
|
106
|
+
* `fields` 在运行时由 Vue reactive 自动解包,用法与 vee-validate `<FieldArray>` 插槽一致(`fields.length` / `v-for`)。
|
|
107
|
+
* `fields` 为只读快照:不可 `push/splice`,也不可改 `fields[i].value` 及其嵌套字段;增删改请用 `arrayAction` / `arrayHandle`。
|
|
108
|
+
*/
|
|
109
|
+
export type FieldArrayContext<TValue = unknown> = Omit<ResolvedFieldArrayContext<TValue>, "fields"> & {
|
|
110
|
+
readonly fields: ReadonlyArray<ReadonlyFieldEntry<TValue>>;
|
|
106
111
|
};
|
|
112
|
+
/**
|
|
113
|
+
* 将注册表中的 `ResolvedFieldArrayContext` 转为对外 `FieldArrayContext`。
|
|
114
|
+
* 注册表为 `reactive(Map)`,运行时 `fields` 已自动解包,需经 `unknown` 断言以匹配类型。
|
|
115
|
+
*/
|
|
116
|
+
export declare function asFieldArrayContext<TValue = unknown>(ctx: ResolvedFieldArrayContext): Readonly<FieldArrayContext<TValue>>;
|
|
107
117
|
export type PrivateFieldArrayContext<TValue = unknown> = {
|
|
108
118
|
reset: () => void;
|
|
109
119
|
path: MaybeRefOrGetter<string>;
|
|
110
|
-
} &
|
|
120
|
+
} & ResolvedFieldArrayContext<TValue>;
|
|
111
121
|
export type PrivateFieldContext<TInput = unknown, TOutput = TInput> = {
|
|
112
122
|
id: number;
|
|
113
123
|
name: MaybeRef<string>;
|
|
@@ -278,4 +288,3 @@ export interface FormContext<TValues extends GenericObject = GenericObject, TOut
|
|
|
278
288
|
handleReset: () => void;
|
|
279
289
|
submitForm: (e?: unknown) => Promise<void>;
|
|
280
290
|
}
|
|
281
|
-
export {};
|
|
@@ -99,7 +99,26 @@ export type NestedArrayHandle<TValue = unknown> = {
|
|
|
99
99
|
at: (index: number, childField: string) => NestedArrayHandle<TValue>;
|
|
100
100
|
};
|
|
101
101
|
export type { ArrayPathSegment } from './utils/array-path';
|
|
102
|
-
export { buildArrayFieldPath } from './utils/array-path';
|
|
102
|
+
export { buildArrayFieldPath, collectArrayFieldPathAliases, normalizeArrayFieldPath } from './utils/array-path';
|
|
103
|
+
/**
|
|
104
|
+
* `useArraySchema` 的 `arraySchema` 回调第三参数:当前数组上下文
|
|
105
|
+
*/
|
|
106
|
+
export interface ArraySchemaContext {
|
|
107
|
+
/** 当前数组字段完整路径(已规范化,与 arrayAction 注册键一致) */
|
|
108
|
+
arrayPath: string;
|
|
109
|
+
/** 当前行路径,如 `feeTickets[0]` */
|
|
110
|
+
itemPath: string;
|
|
111
|
+
/** 当前行索引 */
|
|
112
|
+
index: number;
|
|
113
|
+
/** 当前行 entry */
|
|
114
|
+
entry: FieldEntry<Recordable>;
|
|
115
|
+
/** 表单 arrayAction API */
|
|
116
|
+
arrayAction?: FormArrayActions;
|
|
117
|
+
/** 绑定 {@link arrayPath} 的操作器,可直接 `.push()` / `.remove()` */
|
|
118
|
+
arrayHandle?: NestedArrayHandle;
|
|
119
|
+
/** 表单值代理) */
|
|
120
|
+
form?: Record<string, unknown>;
|
|
121
|
+
}
|
|
103
122
|
export type FormActions = FormContext<GenericObject> & {
|
|
104
123
|
arrayAction?: FormArrayActions;
|
|
105
124
|
};
|
|
@@ -272,8 +291,11 @@ export interface FormSchema<T extends BaseFormComponentType = BaseFormComponentT
|
|
|
272
291
|
* @description 支持直接传入配置数组 或 动态函数生成
|
|
273
292
|
* @example arraySchema: []
|
|
274
293
|
* @example arraySchema: (entry, index) => []
|
|
294
|
+
* @example arraySchema: (entry, index, ctx) => { ctx.arrayHandle?.push({}); return []; }
|
|
275
295
|
*/
|
|
276
|
-
arraySchema?: FormSchema[] | ((entry: FieldEntry<Recordable>, currentIndex: number
|
|
296
|
+
arraySchema?: FormSchema[] | ((entry: FieldEntry<Recordable>, currentIndex: number,
|
|
297
|
+
/** 第三参数由 FormArrayRegister 注入;旧写法可忽略 */
|
|
298
|
+
ctx: ArraySchemaContext) => FormSchema[]);
|
|
277
299
|
}
|
|
278
300
|
/** 插槽 scope 参数,传递给渲染函数或具名插槽 */
|
|
279
301
|
export interface FormSlotScope {
|
|
@@ -286,8 +308,10 @@ export interface FormSlotScope {
|
|
|
286
308
|
* Extra slot props exposed for `useArraySchema: true` fields.
|
|
287
309
|
*/
|
|
288
310
|
export interface FormArraySlotScope extends FormSlotScope {
|
|
289
|
-
arrayEntry?:
|
|
290
|
-
arrayAction?:
|
|
311
|
+
arrayEntry?: FieldEntry<Recordable>;
|
|
312
|
+
arrayAction?: FormArrayActions;
|
|
313
|
+
arrayHandle?: NestedArrayHandle;
|
|
314
|
+
arrayPath?: string;
|
|
291
315
|
arrayIndex?: number;
|
|
292
316
|
fieldName?: string;
|
|
293
317
|
}
|
|
@@ -356,9 +380,9 @@ export interface FormRenderProps<T extends BaseFormComponentType = BaseFormCompo
|
|
|
356
380
|
*/
|
|
357
381
|
fieldMappingTime?: FieldMappingTime;
|
|
358
382
|
/**
|
|
359
|
-
*
|
|
383
|
+
* 表单实例(vee-validate FormContext;数组操作请使用 injectFormProps 中的 formApi.arrayAction)
|
|
360
384
|
*/
|
|
361
|
-
form?:
|
|
385
|
+
form?: FormActions;
|
|
362
386
|
/**
|
|
363
387
|
* 表单项布局
|
|
364
388
|
*/
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
/** 一层嵌套:父路径 + 行索引 + 子字段名 */
|
|
2
2
|
export type ArrayPathSegment = readonly [index: number, field: string];
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* 规范化为数组字段注册键:将标识符后的 `.[数字]` 折叠为 `[数字]`。
|
|
5
|
+
* 与 {@link FormArrayRegister} 中 `fieldName[index]` 的拼接方式对齐。
|
|
6
|
+
* @example normalizeArrayFieldPath('feeTickets.[0].feeDetails') => 'feeTickets[0].feeDetails'
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeArrayFieldPath(path: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* 生成同一数组字段的等价路径别名(注册 / 查找时共用)
|
|
11
|
+
*/
|
|
12
|
+
export declare function collectArrayFieldPathAliases(path: string): string[];
|
|
13
|
+
/**
|
|
14
|
+
* 拼接数组子路径;仅传 parentPath 时原样返回(完整路径,会规范化)
|
|
5
15
|
* @returns 如 `actions.data[0].skills`
|
|
6
16
|
*/
|
|
7
17
|
export declare function childArrayPath(parentPath: string, index?: number, childField?: string): string;
|