import type { IObject } from '@newgrand/udp-core'; import { CSSProperties, ReactElement, RefObject } from 'react'; import type { formConfProps } from '../config/interface'; import type { LabelPosition } from '../interface'; import type { CompDefaultPropsInfo } from '../props.dt'; import type { IPanel } from '../../functionalComponent'; export type TitlePropsDefaultType = { show?: boolean; position?: 'left' | 'right'; layIcon?: ReactElement; title?: string; style?: CSSProperties; }; export type TitlePropsType = TitlePropsDefaultType | ReactElement; export type FooterBtnType = { text: string; loading?: boolean; }; export type FooterDefaultPropsType = { save?: FooterBtnType; reset?: FooterBtnType; position?: 'left' | 'right'; }; export type FooterPropsType = FooterDefaultPropsType | ReactElement; export type OptType = 'modifiedRow' | 'newRow' | 'deletedRow'; type rule = Record & { message?: string; }; /** * @description 表单属性 */ export type FormInfo = { form?: any; /** * @description 是否是查看状态 * @default false */ view?: boolean; /** * @description labe宽度 * @default 85 */ labelWidth?: number | string; /** * @description 表格表单 * @default false */ bordered?: boolean; /** * @description 表格启用panel容器包裹时属性或标题,不设置表示不开启 */ panel?: IPanel | string; /** * @description label标签是否显示冒号 * @default true */ colon?: boolean; /** * @description 表单属性 */ value?: object; /** * @description label标签未知 * @default left */ labelPosition?: LabelPosition; /** * @description 表单判断是新增、修改用来格式化数据 */ opt?: OptType; /** * @description 表单主键(判断是新增、修改用来格式化数据) */ busKey?: string; /** * @deprecated 请用busKey替代 */ dataId?: string; /** * @description 表单禁用 * @default false */ disabled?: boolean; /** * @description 表单项label位置 * @default right */ labelAlign?: 'left' | 'center' | 'right'; /** * @description 表单项样式 */ labelStyle?: CSSProperties; /** * @description 表单列数配置 */ colspan?: number | Array | { [propsKey: number]: number; }; /** * @description 表单校验规则 */ rules?: { [propsKey: string]: Array; }; /** * @description 表单值改变事件 */ onValuesChange?: (changeval: Object, allvalues: Object) => void; footerProps?: FooterPropsType; layout?: 'horizontal' | 'vertical' | 'inline'; onSave?: (vals: any, errors: any, formRef?: any) => any; onReset?: () => any; onVertify?: () => any; getPopupContainer?: () => Document; forceRender?: boolean; outRef?: any; design?: boolean; defaultValue?: any; /** * form表单集的ref对象 */ formSetRef?: RefObject; /** * @description 重写对应name的item属性 */ fieldProps?: { [key: string]: IObject | ((item: IObject) => IObject); }; }; export type FormPropsInfo = FormInfo & CompDefaultPropsInfo; export {};