import { Component } from 'react'; import * as React from 'react'; import FormContext from './FormContext'; import { IValidation } from './validationRules'; export interface IFieldEventHandlerOptions { merge: boolean; value?: any; } export interface IFieldProps { ref?: (ref: any) => void; name: string; component: React.ElementType; value?: any; normalize?: (value: any, previousValue: any, nextValues: any, previousValues: any) => void; format?: (value: any, previousValue?: any, nextValues?: any, previousValues?: any) => void; onChange?: (value: any, previousValue: any, nextValues: any, previousValues: any) => void; onBlur?: (value: any, previousValue: any, nextValues: any, previousValues: any) => void; onFocus?: React.FocusEventHandler; validations?: IValidation & Record; validationError?: string; validationErrors?: { [key: string]: any; }; validateOnChange?: boolean; validateOnBlur?: boolean; asyncValidation?: (values: any, value: any) => Promise; displayError?: boolean; clearErrorOnFocus?: boolean; relatedFields?: string[]; [key: string]: any; } export interface IFieldState { _isDirty?: boolean; _isValid?: boolean; _value?: any; _isValidating?: boolean; _initialValue?: any; _active?: boolean; _validationError?: string[]; _externalError?: string[]; _asyncValidated?: boolean; } declare class Field extends Component { _name: string; _validations: IValidation; wrappedComponent: React.ReactInstance; static defaultProps: { value: string; validationError: string; validationErrors: {}; validateOnBlur: boolean; validateOnChange: boolean; clearErrorOnFocus: boolean; }; static contextType: React.Context; context: React.ContextType; constructor(props: any, context: any); shouldComponentUpdate(nextProps: any, nextState: any): boolean; componentWillMount(): void; componentWillReceiveProps(nextProps: any): void; componentDidUpdate(prevProps: any): void; componentWillUnmount(): void; isDirty: () => boolean; isValid: () => boolean; isValidating: () => boolean; isActive: () => boolean; getInitialValue: () => any; getValue: () => any; getName: () => string; isAsyncValidated: () => boolean; setValue: (value: any, needValidate?: boolean) => void; resetValue: (value: any) => void; setInitialValue: (value: any) => void; getWrappedComponent: () => React.ReactInstance; getErrorMessage: () => string; getErrorMessages: () => string[]; normalize: (value: any) => any; format: (value: any) => any; handleChange: (event: any, options?: IFieldEventHandlerOptions) => void; handleFocus: (event: any) => void; handleBlur: (event: any, options?: IFieldEventHandlerOptions) => void; processProps: (props: any) => any; render(): React.ReactElement>; } export default Field;