import { ComponentType } from './index'; import type { CSSProperties } from 'vue'; import type { ButtonProps } from 'ant-design-vue/lib/button'; import type { ColEx } from '../types'; import type { RowProps } from 'ant-design-vue/lib/grid/Row'; export interface RenderReturnParams { schema: FormSchema; values: Recordable; model: Recordable; field: string; } export interface componentProps { options?: any[]; placeholder?: string; showButton?: boolean; onInput?: () => Recordable; onChange?: () => Recordable; } export interface FormSchema { name: string; label: string; labelMessage?: string; labelMessageStyle?: object | string; defaultValue?: any; component?: ComponentType; componentProps?: any; slot?: string; rules?: object | object[]; colProps?: Partial; isFull?: boolean; suffix?: string; showFeedback?: boolean; showLabel?: boolean; requireMarkPlacement?: string; hidden?: boolean | ((renderCallbackParams: RenderReturnParams) => boolean); } export interface FormProps { model?: Recordable; labelCol?: Partial; schemas?: FormSchema[]; inline: boolean; layout?: string; size: string; labelPlacement: string; isFull: boolean; actInheritLabelCol?: boolean; showActionButtonGroup?: boolean; showResetButton?: boolean; resetButtonOptions?: Partial; showSubmitButton?: boolean; showAdvancedButton?: boolean; submitButtonOptions?: Partial; submitButtonText?: string; resetButtonText?: string; rowProps?: Partial; colProps?: Partial; resetFunc?: () => Promise; submitFunc?: () => Promise; submitOnReset?: boolean; baseRowStyle?: CSSProperties; actionStyle?: CSSProperties; draggable?: boolean; } export interface FormActionType { submit: () => Promise; setProps: (formProps: Partial) => Promise; setSchema: (schemaProps: Partial) => Promise; setFieldsValue: (values: Recordable) => void; clearValidate: (name?: string | string[]) => Promise; getFieldsValue: () => Recordable; resetFields: () => Promise; validate: (nameList?: any[]) => Promise; mergeValidateInfo: (items: any[]) => object; validateInfos: object; setLoadingSub: (status: boolean) => void; } export type RegisterFn = (formInstance: FormActionType) => void; export type UseFormReturnType = [RegisterFn, FormActionType];