react-ocean-forms
Version:
Forms components for react based on the context api.
61 lines (60 loc) • 2.01 kB
TypeScript
import React from 'react';
import { IValidationState, IValidationWrapperProps } from '../withValidation.types';
/**
* Component that handles validation of the
* wrapped component.
*/
export declare class BaseValidationWrapper extends React.Component<IValidationWrapperProps, IValidationState> {
static displayName: string;
private unmounted;
private asyncTimeout?;
private readonly fullName;
constructor(props: IValidationWrapperProps);
/**
* Unregisters the field from the form
*/
componentWillUnmount(): void;
/**
* Returns the current async timeout
*/
getAsyncTimeout(): number | undefined;
/**
* Creates the initial / default validation
* state of a validated component
*/
private createInitialValidationState;
/**
* Returns true if this component contains
* a required field validator
*/
private checkIsRequired;
/**
* Clears the validation timeout if currently
* running
*/
private clearValidationTimeout;
/**
* Resets the validation state to the default
*/
private reset;
/**
* Updates the validation state
* @param state New state
*/
private updateValidationState;
/**
* Triggers the validation of a field.
* @param value Value of the field
* @param options Validation params @see checkAsync @see immediateAsync
* @param checkAsync True if the async validators should be triggered as well
* @param immediateAsync True if the async validators should fire immediately
*/
private validate;
/**
* Updates the validation state and notifies the form
* @param newState New validation state
*/
private updateAndNotify;
render(): JSX.Element;
}
export declare const ValidationWrapper: React.ComponentType<Pick<IValidationWrapperProps, "render" | "name" | "validators" | "asyncValidators" | "asyncValidationWait">>;