import { FormProps } from '@ant-design/compatible/es/form'; import { IFormCreator } from './FormCreator'; import { IFormItem, IFormItemLayout } from './declare'; import { FormLifecycle } from './FormLifecycle'; export interface IFormProps extends FormProps { } export interface EntityFormLifecycle { onFormCreated?: (form: IFormProps['form']) => void; onFormMount?: () => void; onFormDestroy?: () => void; } declare type FormCreateOptionMessagesCallback = (...args: any[]) => string; interface FormCreateOptionMessages { [messageId: string]: string | FormCreateOptionMessagesCallback | FormCreateOptionMessages; } export interface IFormPresenterProps extends EntityFormLifecycle, IFormCreator { onFieldsChange?: (props: FormProps, fields: any, allFields: any) => void; onValuesChange?: (props: FormProps, changedValues: any, allValues: any) => void; mapPropsToFields?: (props: FormProps) => void; validateMessages?: FormCreateOptionMessages; withRef?: boolean; name?: string; } export interface IformLayout extends IFormItemLayout { type: string; col?: number; } export default class FormPresenter extends FormLifecycle { protected HOCFormComponent: any; protected form: IFormProps['form']; private formItems; private initFormValues; private rest; private formLayout; constructor(options: IFormPresenterProps); protected initForm: (formItems: IFormItem[], initFormValues: any, rest?: any) => void; setInitFormValues: (initFormValues: any) => void; getFormComponent: () => Function; getForm: () => IFormProps['form']; getFormItems: () => IFormItem[]; getFormItemIndex: (key: string) => number; addFormItem: (formItem: IFormItem, index?: number) => void; removeFormItem: (key: string) => void; addFormList: (formItemList: any[]) => void; replaceFormList: (formItemList: any[], formValues: any) => void; updateFormItem: (formItem: IFormItem) => void; hasField: (key: string) => boolean; resetFields: () => void; } export {};