import React, { ReactElement } from 'react'; import { FormProps, useForm, FormProvider, Field, List } from 'rc-field-form'; import { Props as ShadowProps } from '../shadow'; import { FieldProps } from 'rc-field-form/es/Field'; import { Property } from 'csstype'; import { ViewProps } from 'remax/one'; import { RuleType, ValidatorRule, RuleRender, StoreValue, Meta, FormInstance, FieldData } from 'rc-field-form/es/interface'; export declare const FormStore: import("parsec-hooks/lib/createContainer").Container & { formItemNatives: React.MutableRefObject; }, unknown>; interface BaseRule { enum?: StoreValue[]; len?: number; max?: number; message?: string | ReactElement; min?: number; pattern?: RegExp; required?: boolean; transform?: (value: StoreValue) => StoreValue; type?: RuleType | 'phone' | 'idCard' | 'password'; whitespace?: boolean; /** Customize rule level `validateTrigger`. Must be subset of Field `validateTrigger` */ validateTrigger?: string | string[]; } type AggregationRule = BaseRule & Partial; interface ArrayRule extends Omit { type: 'array'; defaultField?: RuleObject; } export type RuleObject = AggregationRule | ArrayRule; export type Rule = RuleObject | RuleRender; type FormItemNativeInstance = { setFieldData: (data: Partial) => void; name?: string; id: string; }; interface BaseItemProps { style?: React.CSSProperties; /** * 校验规则 */ rules?: Rule[]; label?: React.ReactNode; /** * 后面的节点 */ after?: React.ReactNode; className?: string; /** * 是否垂直 */ vertical?: boolean; /** * 显示必填*号 * @default true */ requiredMark?: boolean; /** * 只读模式 */ readOnly?: boolean; /** * 不需要样式 */ noStyle?: boolean; /** * label类名 */ labelCls?: string; /** * label样式 */ labelStyle?: React.CSSProperties; /** * children样式 */ childrenStyle?: React.CSSProperties; /** * 子元素类别 */ childrenCls?: string; /** * 必填标记类名 */ requiredMarkCls?: string; afterCls?: string; /** * 字符串的label,用于提示 * @default label */ strLabel?: string; /** * label的对齐 * @default right */ labelJustify?: Property.TextAlign; /** * children的对齐 * @default right */ childrenAlign?: Property.TextAlign; cell?: boolean; /** * 显示冒号 */ colon?: React.ReactNode; /** * 冒号的类名 */ colonCls?: string; /** * label的宽度,建议使用em单位 */ labelWidth?: number | string; /** * 渲染只读时的值 */ renderReadOnlyValue?: (value: any, values: any) => React.ReactNode; /** * 适老模式,开启后尺寸会变大 */ elderly?: boolean; /** * 校验状态,设为false后不会红框提示 * @default true */ verifyStatus?: boolean; /** * nativeRef优化性能 */ nativeRef?: React.Ref; } export interface ItemProps extends Omit, BaseItemProps, ViewProps { children?: React.ReactNode | ((control: any, meta: Meta, form: FormInstance) => React.ReactNode); } export interface Props extends FormProps, Omit, keyof BaseItemProps>, 'strLabel' | 'label' | 'renderReadOnlyValue'> { /** * 子项的类名 */ itemCls?: string; /** * 子项的样式 */ itemStyle?: React.CSSProperties; /** * 子项children的样式 */ itemChildrenStyle?: React.CSSProperties; /** * 卡片模式 * @default true */ card?: boolean; /** * shadow组件的props */ shadowProps?: Omit | false; /** * 绑定的数据 */ values?: Values; /** * 支持嵌套表单统一管理 * @default true */ nestedForm?: boolean; /** * 设置后会自动缓存表单数据 */ autoCacheKey?: string; /** * 提交后自动清空缓存 * @default true */ autoClearCache?: boolean; } declare const ReForm: React.ForwardRefExoticComponent & React.RefAttributes | undefined>, "ref"> & React.RefAttributes>; declare const Form: typeof ReForm & { useForm: typeof useForm; FormProvider: typeof FormProvider; Field: typeof Field; List: typeof List; }; export default Form;