UNPKG

uniforms

Version:
146 lines 7.4 kB
import React, { ComponentType } from 'react'; import { BaseForm, BaseFormProps, BaseFormState } from './BaseForm'; import { UnknownObject } from './types'; export type QuickFormProps<Model extends UnknownObject> = BaseFormProps<Model> & { errorsField?: ComponentType; submitField?: ComponentType; }; export type QuickFormState<Model extends UnknownObject> = BaseFormState<Model>; export declare function Quick<Base extends typeof BaseForm>(Base: Base): { new <Model extends UnknownObject, Props extends QuickFormProps<Model> = QuickFormProps<Model>, State extends QuickFormState<Model> = QuickFormState<Model>>(props: Props): { getNativeFormProps(): { [key: string]: unknown; children?: React.ReactNode; id?: string; key: string; noValidate: boolean; onSubmit: (event?: React.SyntheticEvent) => Promise<unknown>; }; getAutoField(): ComponentType<{ name: string; }>; getErrorsField(): ComponentType; getSubmitField(): 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?: 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?: React.SyntheticEvent): Promise<unknown>; render(): 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]: React.ReactInstance; }; shouldComponentUpdate?(nextProps: Readonly<Props>, nextState: Readonly<State>, nextContext: any): boolean; componentDidCatch?(error: Error, errorInfo: 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?: React.Context<any> | undefined; } & Base; export declare const QuickForm: { new <Model extends UnknownObject, Props extends QuickFormProps<Model> = QuickFormProps<Model>, State extends QuickFormState<Model> = QuickFormState<Model>>(props: Props): { getNativeFormProps(): { [key: string]: unknown; children?: React.ReactNode; id?: string; key: string; noValidate: boolean; onSubmit: (event?: React.SyntheticEvent) => Promise<unknown>; }; getAutoField(): React.ComponentType<{ name: string; }>; getErrorsField(): ComponentType; getSubmitField(): 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?: 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?: React.SyntheticEvent): Promise<unknown>; render(): 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]: React.ReactInstance; }; shouldComponentUpdate?(nextProps: Readonly<Props>, nextState: Readonly<State>, nextContext: any): boolean; componentDidCatch?(error: Error, errorInfo: 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?: React.Context<any> | undefined; } & typeof BaseForm; export type QuickForm = typeof QuickForm; //# sourceMappingURL=QuickForm.d.ts.map