/// <reference types="react" />
import { FieldModel, IValidators, IMaybeError, BasicModel, ValidateOption, ModelRef, IModel, INormalizeBeforeSubmit } from './formulr';
import { Optional } from 'utility-types';
import { IFormControlProps } from './Control';
import { SingleDate, RangeDate } from '../date-picker';
export interface IRenderError<T> {
    (error: IMaybeError<T>): React.ReactNode;
}
export interface IFormFieldViewDrivenProps<T> {
    name: string;
    defaultValue: T | (() => T);
    initialValue?: T;
    validators?: IValidators<T>;
    destroyOnUnmount?: boolean;
    normalizeBeforeSubmit?: INormalizeBeforeSubmit<T, any>;
}
export interface IFormFieldModelDrivenProps<T> {
    model: FieldModel<T> | ModelRef<T, IModel<any>, FieldModel<T>>;
    validators?: IValidators<T>;
    defaultValue: T | (() => T);
    initialValue?: T;
}
export declare type IFormFieldModelProps<T> = IFormFieldViewDrivenProps<T> | IFormFieldModelDrivenProps<T>;
export declare function isViewDrivenProps<T>(props: IFormFieldModelProps<T>): props is IFormFieldViewDrivenProps<T>;
export declare enum ValidateOccasion {
    None = 0,
    Change = 1,
    Blur = 2,
    Default = 3
}
export declare enum TouchWhen {
    Change = 0,
    Blur = 1
}
export interface IFormFieldPropsBase<Value> extends Omit<IFormControlProps, 'required' | 'invalid'>, Partial<Omit<IFormFieldChildProps<Value>, 'value'>> {
    renderError?: IRenderError<Value>;
    helpDesc?: React.ReactNode;
    notice?: React.ReactNode;
    withoutError?: boolean;
    before?: React.ReactNode;
    after?: React.ReactNode;
    required?: boolean | string;
    validateOccasion?: ValidateOccasion;
    normalize?: (value: Value, prevValue: Value) => Value;
    normalizeBeforeBlur?: (value: Value) => Value;
    format?: (value: Value) => Value;
    getValidateOption?: (source: 'blur' | 'change') => ValidateOption | undefined;
    modelRef?: React.RefObject<FieldModel<Value>>;
    touchWhen?: TouchWhen;
}
export declare type IFormFieldProps<Value> = IFormFieldPropsBase<Value> & IFormFieldModelProps<Value> & {
    children(props: IFormFieldChildProps<Value>): React.ReactNode;
};
export declare type IFormComponentProps<Value, Props, OmitKeys extends keyof IFormFieldPropsBase<Value> = never> = (Omit<IFormFieldPropsBase<Value>, 'touchWhen' | OmitKeys> & {
    props?: Partial<Props>;
}) & (Optional<IFormFieldViewDrivenProps<Value>, 'defaultValue'> | Optional<IFormFieldModelDrivenProps<Value>, 'defaultValue'>);
export declare function dateDefaultValueFactory(): SingleDate;
export declare function dateRangeDefaultValueFactory(): RangeDate;
export declare function dateDefaultTimeFactory(): string;
export declare function dateRangeDefaultTimeFactory(): [string, string];
export declare function defaultRenderError<T>(error: IMaybeError<T>): JSX.Element;
export declare function useFormChild<Value>(model: BasicModel<Value>, scrollAnchorRef?: React.RefObject<Element | null | undefined>): void;
export interface IFormFieldChildProps<Value> {
    value: Value;
    onChange(e: Value): void;
    onBlur: React.FocusEventHandler;
    onCompositionStart: React.CompositionEventHandler;
    onCompositionEnd: React.CompositionEventHandler;
}
