FormBuilder类型优化
parent
39c7ddbddf
commit
b26cf73667
|
|
@ -209,33 +209,46 @@ export type FormOptionCustomRender<
|
||||||
formListUniqueProps?: never;
|
formListUniqueProps?: never;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 render 类型映射生成表单项联合类型
|
||||||
|
*/
|
||||||
|
export type FormOptionByRenderUnion<
|
||||||
|
Values = any,
|
||||||
|
AllValues = Values,
|
||||||
|
IsOnlyForLabel extends boolean = false,
|
||||||
|
IsCustomizeRender extends boolean = false,
|
||||||
|
Name = NamePath<Values>,
|
||||||
|
Dependencies = NamePath<Values>,
|
||||||
|
> = { [K in keyof FORM_ITEM_RENDER_TYPE_MAP]: FormOptionByRender<K, Values, AllValues, IsOnlyForLabel, IsCustomizeRender, Name, Dependencies> }[keyof FORM_ITEM_RENDER_TYPE_MAP];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单配置项联合类型组合
|
||||||
|
*/
|
||||||
|
export type FormOptionGroup<
|
||||||
|
Values = any,
|
||||||
|
AllValues = Values,
|
||||||
|
Name = NamePath<Values>,
|
||||||
|
Dependencies = NamePath<Values>,
|
||||||
|
>
|
||||||
|
= | FormOptionDefault<Values, AllValues, false, false, Name, Dependencies>
|
||||||
|
| FormOptionDefault<Values, AllValues, false, true, Name, Dependencies>
|
||||||
|
| FormOptionDefault<Values, AllValues, true, false, Name, Dependencies>
|
||||||
|
| FormOptionByRenderUnion<Values, AllValues, false, false, Name, Dependencies>
|
||||||
|
| FormOptionByRenderUnion<Values, AllValues, false, true, Name, Dependencies>
|
||||||
|
| FormOptionByRenderUnion<Values, AllValues, true, false, Name, Dependencies>
|
||||||
|
| FormOptionCustomRender<Values, AllValues, false, false, Name, Dependencies>
|
||||||
|
| FormOptionCustomRender<Values, AllValues, false, true, Name, Dependencies>
|
||||||
|
| FormOptionCustomRender<Values, AllValues, true, false, Name, Dependencies>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 普通表单配置项
|
* 普通表单配置项
|
||||||
*/
|
*/
|
||||||
export type FormOption<Values = any, AllValues = Values>
|
export type FormOption<Values = any, AllValues = Values> = FormOptionGroup<Values, AllValues>;
|
||||||
= | FormOptionDefault<Values, AllValues, false, false>
|
|
||||||
| FormOptionDefault<Values, AllValues, false, true>
|
|
||||||
| FormOptionDefault<Values, AllValues, true, false>
|
|
||||||
| { [K in keyof FORM_ITEM_RENDER_TYPE_MAP]: FormOptionByRender<K, Values, AllValues, false, false> }[keyof FORM_ITEM_RENDER_TYPE_MAP]
|
|
||||||
| { [K in keyof FORM_ITEM_RENDER_TYPE_MAP]: FormOptionByRender<K, Values, AllValues, false, true> }[keyof FORM_ITEM_RENDER_TYPE_MAP]
|
|
||||||
| { [K in keyof FORM_ITEM_RENDER_TYPE_MAP]: FormOptionByRender<K, Values, AllValues, true, false> }[keyof FORM_ITEM_RENDER_TYPE_MAP]
|
|
||||||
| FormOptionCustomRender<Values, AllValues, false, false>
|
|
||||||
| FormOptionCustomRender<Values, AllValues, false, true>
|
|
||||||
| FormOptionCustomRender<Values, AllValues, true, false>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form.List 子项表单配置项
|
* Form.List 子项表单配置项
|
||||||
*/
|
*/
|
||||||
export type FormListOption<Values = any, AllValues = Values>
|
export type FormListOption<Values = any, AllValues = Values> = FormOptionGroup<Values, AllValues, FormListOptionName<Values>, FormListOptionDependencies<AllValues>>;
|
||||||
= | FormOptionDefault<Values, AllValues, false, false, FormListOptionName<Values>, FormListOptionDependencies<AllValues>>
|
|
||||||
| FormOptionDefault<Values, AllValues, false, true, FormListOptionName<Values>, FormListOptionDependencies<AllValues>>
|
|
||||||
| FormOptionDefault<Values, AllValues, true, false, FormListOptionName<Values>, FormListOptionDependencies<AllValues>>
|
|
||||||
| { [K in keyof FORM_ITEM_RENDER_TYPE_MAP]: FormOptionByRender<K, Values, AllValues, false, false, FormListOptionName<Values>, FormListOptionDependencies<AllValues>> }[keyof FORM_ITEM_RENDER_TYPE_MAP]
|
|
||||||
| { [K in keyof FORM_ITEM_RENDER_TYPE_MAP]: FormOptionByRender<K, Values, AllValues, false, true, FormListOptionName<Values>, FormListOptionDependencies<AllValues>> }[keyof FORM_ITEM_RENDER_TYPE_MAP]
|
|
||||||
| { [K in keyof FORM_ITEM_RENDER_TYPE_MAP]: FormOptionByRender<K, Values, AllValues, true, false, FormListOptionName<Values>, FormListOptionDependencies<AllValues>> }[keyof FORM_ITEM_RENDER_TYPE_MAP]
|
|
||||||
| FormOptionCustomRender<Values, AllValues, false, false, FormListOptionName<Values>, FormListOptionDependencies<AllValues>>
|
|
||||||
| FormOptionCustomRender<Values, AllValues, false, true, FormListOptionName<Values>, FormListOptionDependencies<AllValues>>
|
|
||||||
| FormOptionCustomRender<Values, AllValues, true, false, FormListOptionName<Values>, FormListOptionDependencies<AllValues>>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FormItemsRenderer 组件属性
|
* FormItemsRenderer 组件属性
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue