uniforms
Version:
Core package of uniforms.
144 lines • 7.87 kB
TypeScript
import { BaseForm } from './BaseForm';
import { Quick, QuickFormProps, QuickFormState } from './QuickForm';
import { Validated, ValidatedFormProps, ValidatedFormState } from './ValidatedForm';
import { UnknownObject } from './types';
export type ValidatedQuickFormProps<Model extends UnknownObject> = QuickFormProps<Model> & ValidatedFormProps<Model>;
export type ValidatedQuickFormState<Model extends UnknownObject> = QuickFormState<Model> & ValidatedFormState<Model>;
export declare const ValidatedQuickForm: {
new <Model extends UnknownObject, Props extends ValidatedFormProps<Model> = ValidatedFormProps<Model>, State extends ValidatedFormState<Model> = ValidatedFormState<Model>>(props: Props): {
validate: (key?: string, value?: unknown) => Promise<unknown>;
validateModel: (originalModel: any) => Promise<unknown>;
getContextError(): import("./types").Context<Model>["error"];
getContext(): import("./types").Context<Model>;
getNativeFormProps(): {
[key: string]: unknown;
children?: import("react").ReactNode;
id?: string;
key: string;
noValidate: boolean;
onSubmit: (event?: import("react").SyntheticEvent) => Promise<unknown>;
};
componentDidUpdate(prevProps: Props, prevState: State, snapshot: never): void;
onChange(key: string, value: unknown): void;
__reset(state: State): Partial<State>;
onSubmit(event?: import("react").SyntheticEvent): Promise<unknown>;
onValidate(key?: string, value?: unknown): Promise<unknown>;
onValidateModel(originalModel: Props["model"]): Promise<unknown>;
componentDidMount(): void;
componentWillUnmount(): void;
delayId?: ReturnType<typeof setTimeout> | undefined;
mounted: boolean;
reset: () => void;
change: (key: string, value: unknown) => void;
submit: (event?: import("react").SyntheticEvent) => Promise<unknown>;
randomId: () => string;
getContextName(): import("./types").Context<Model>["name"];
getContextModel(): Model;
getContextState(): import("./types").Context<Model>["state"];
getContextSchema(): import("./types").Context<Model>["schema"];
getContextOnChange(): import("./types").Context<Model>["onChange"];
getContextOnSubmit(): import("./types").Context<Model>["onSubmit"];
getModel(mode?: import("./types").ModelTransformMode, model?: Model): Model;
onReset(): void;
render(): import("react").JSX.Element;
context: unknown;
setState<K extends keyof State>(state: State | ((prevState: Readonly<State>, props: Readonly<Props>) => State | Pick<State, K> | null) | Pick<State, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly<Props>;
state: Readonly<State>;
refs: {
[key: string]: import("react").ReactInstance;
};
shouldComponentUpdate?(nextProps: Readonly<Props>, nextState: Readonly<State>, nextContext: any): boolean;
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<Props>, prevState: Readonly<State>): any;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<Props>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Props>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<Props>, nextState: Readonly<State>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<Props>, nextState: Readonly<State>, nextContext: any): void;
};
Validated: typeof Validated;
displayName: string;
defaultProps: {
onValidate(model: unknown, error: unknown): unknown;
validate: string;
autosave: boolean;
autosaveDelay: number;
error: null;
model: any;
noValidate: boolean;
onSubmit(): void;
};
contextType?: import("react").Context<any> | undefined;
} & {
new <Model extends UnknownObject, Props extends QuickFormProps<Model> = QuickFormProps<Model>, State extends QuickFormState<Model> = QuickFormState<Model>>(props: Props): {
getNativeFormProps(): {
[key: string]: unknown;
children?: import("react").ReactNode;
id?: string;
key: string;
noValidate: boolean;
onSubmit: (event?: import("react").SyntheticEvent) => Promise<unknown>;
};
getAutoField(): import("react").ComponentType<{
name: string;
}>;
getErrorsField(): import("react").ComponentType;
getSubmitField(): import("react").ComponentType;
componentDidMount(): void;
componentDidUpdate(prevProps: Props, prevState: State, snapshot: never): void;
componentWillUnmount(): void;
delayId?: ReturnType<typeof setTimeout> | undefined;
mounted: boolean;
reset: () => void;
change: (key: string, value: unknown) => void;
submit: (event?: import("react").SyntheticEvent) => Promise<unknown>;
randomId: () => string;
getContext(): import("./types").Context<Model>;
getContextName(): import("./types").Context<Model>["name"];
getContextError(): import("./types").Context<Model>["error"];
getContextModel(): Model;
getContextState(): import("./types").Context<Model>["state"];
getContextSchema(): import("./types").Context<Model>["schema"];
getContextOnChange(): import("./types").Context<Model>["onChange"];
getContextOnSubmit(): import("./types").Context<Model>["onSubmit"];
getModel(mode?: import("./types").ModelTransformMode, model?: Model): Model;
onChange(key: string, value: unknown): void;
__reset(state: State): Partial<State>;
onReset(): void;
onSubmit(event?: import("react").SyntheticEvent): Promise<unknown>;
render(): import("react").JSX.Element;
context: unknown;
setState<K extends keyof State>(state: State | ((prevState: Readonly<State>, props: Readonly<Props>) => State | Pick<State, K> | null) | Pick<State, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly<Props>;
state: Readonly<State>;
refs: {
[key: string]: import("react").ReactInstance;
};
shouldComponentUpdate?(nextProps: Readonly<Props>, nextState: Readonly<State>, nextContext: any): boolean;
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<Props>, prevState: Readonly<State>): any;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<Props>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Props>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<Props>, nextState: Readonly<State>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<Props>, nextState: Readonly<State>, nextContext: any): void;
};
Quick: typeof Quick;
displayName: string;
defaultProps: {
autosave: boolean;
autosaveDelay: number;
error: null;
model: any;
noValidate: boolean;
onSubmit(): void;
};
contextType?: import("react").Context<any> | undefined;
} & typeof BaseForm;
export type ValidatedQuickForm = typeof ValidatedQuickForm;
//# sourceMappingURL=ValidatedQuickForm.d.ts.map