优化FormItemsRenderer类型
parent
f13fb9ec86
commit
2b2cd0e768
|
|
@ -4,12 +4,26 @@ import type { NamePath } from "rc-field-form/lib/interface";
|
||||||
import type { FC, ReactNode } from "react";
|
import type { FC, ReactNode } from "react";
|
||||||
import type { FORM_ITEM_RENDER_ENUM } from "../../enum/formItemRender";
|
import type { FORM_ITEM_RENDER_ENUM } from "../../enum/formItemRender";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义渲染组件的属性
|
||||||
|
*/
|
||||||
|
export interface CustomRenderProps {
|
||||||
|
/** 表单当前值 */
|
||||||
|
formValues: FormValues;
|
||||||
|
/** 字段值 */
|
||||||
|
value: any;
|
||||||
|
/** 值变化回调 */
|
||||||
|
onChange: (value: any) => void;
|
||||||
|
/** 其他属性 */
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单项渲染类型
|
* 表单项渲染类型
|
||||||
*/
|
*/
|
||||||
export type FormItemRenderType
|
export type FormItemRenderType
|
||||||
= | (typeof FORM_ITEM_RENDER_ENUM)[keyof typeof FORM_ITEM_RENDER_ENUM]
|
= | (typeof FORM_ITEM_RENDER_ENUM)[keyof typeof FORM_ITEM_RENDER_ENUM]
|
||||||
| ((props: { formValues: FormValues; value: any; onChange: (value: any) => void; [key: string]: any }) => ReactNode);
|
| ((props: CustomRenderProps) => ReactNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选项项数据类型
|
* 选项项数据类型
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue