/** * @author yaoxue * @date 2024/08/19 * @description 表单项 */ import { ReactNode, ReactElement, CSSProperties } from 'react'; import type { FieldProps } from 'rc-field-form/lib/Field'; import type { Meta } from 'rc-field-form/lib/interface'; import type { FormInstance, FormItemLayout } from '../Form'; import type { FormItemInputProps } from '../FormItemInput'; import type { FormItemLabelProps } from '../FormItemLabel'; import type { ReportMetaChange } from '../context'; import useFormItemStatus from '../hooks/useFormItemStatus'; type RenderChildren = (form: FormInstance) => ReactNode; type RcFieldProps = Omit, 'children'>; type ChildrenType = RenderChildren | ReactNode; declare const ValidateStatuses: readonly ["success", "warning", "error", "validating", ""]; export type ValidateStatus = (typeof ValidateStatuses)[number]; export type FeedbackIcons = (itemStatus: { status: ValidateStatus; errors?: ReactNode[]; warnings?: ReactNode[]; }) => { [key in ValidateStatus]?: ReactNode; }; export interface FormItemProps extends FormItemLabelProps, FormItemInputProps, RcFieldProps { noStyle?: boolean; style?: CSSProperties; className?: string; children?: ChildrenType; id?: string; hasFeedback?: boolean; validateStatus?: ValidateStatus; required?: boolean; hidden?: boolean; initialValue?: any; messageVariables?: Record; layout?: FormItemLayout; hideError?: boolean; disabled?: boolean; size?: 'small' | 'medium' | 'large'; noSpacing?: boolean; } export interface ItemHolderProps extends FormItemProps { errors: ReactNode[]; warnings: ReactNode[]; meta: Meta; children?: ReactNode; fieldId?: string; isRequired?: boolean; onSubItemMetaChange: ReportMetaChange; } declare function InternalFormItem(props: FormItemProps): ReactElement; type InternalFormItemType = typeof InternalFormItem; type CompoundedComponent = InternalFormItemType & { useStatus: typeof useFormItemStatus; }; declare const FieldFormItem: CompoundedComponent; export default FieldFormItem;