UNPKG

tdesign-react

Version:
26 lines (25 loc) 1.3 kB
import React from 'react'; import type { StyledProps } from '../common'; import type { FieldData, FormInstanceFunctions, FormItemValidateMessage, NamePath, TdFormItemProps, TdFormProps, ValidateTriggerType } from './type'; export interface FormItemProps extends TdFormItemProps, StyledProps { children?: React.ReactNode | React.ReactNode[] | ((form: FormInstanceFunctions) => React.ReactElement); } export interface FormItemInstance { name?: NamePath; fullPath?: NamePath[]; value?: any; initialData?: any; isFormList?: boolean; formListMapRef?: React.MutableRefObject<Map<any, any>>; getValue?: () => any; setValue?: (newVal: any) => void; setField?: (field: Omit<FieldData, 'name'>) => void; validate?: (trigger?: ValidateTriggerType, showErrorMessage?: boolean) => Promise<Record<string, any>>; validateOnly?: (trigger?: ValidateTriggerType) => Promise<Record<string, any>>; resetField?: (type?: TdFormProps['resetType']) => void; setValidateMessage?: (message: FormItemValidateMessage[]) => void; getValidateMessage?: FormInstanceFunctions['getValidateMessage']; resetValidate?: () => void; } declare const FormItem: React.ForwardRefExoticComponent<FormItemProps & React.RefAttributes<FormItemInstance>>; export default FormItem;