import { ErrorInfo, FieldErrors, NamePath, NodeData, ValidateOptions } from './type'; import { Validator, ValidateMessages } from './Validator'; import { FormNode } from './useNode'; export declare const HOOK_KEY: unique symbol; export type FormStore = ReturnType; export interface FormCallbacks { onSuccess?: (values: Record) => void; onFail?: (errorInfo: ErrorInfo) => void; onReset?: () => void; } export default function createFormStore(): { getError: (name: NamePath) => string[]; getErrors: (name?: NamePath[]) => FieldErrors[]; getValue: (name: NamePath) => any; getValues: (name?: NamePath[]) => any; scrollToField: (name: NamePath, options?: ScrollIntoViewOptions) => void; setNodeData: (data: NodeData[]) => void; setValues: (values: any) => void; setValue: (name: NamePath, value: any) => void; validate: (name?: NamePath[] | ValidateOptions, options?: ValidateOptions) => Promise; submit: () => Promise; reset: (name?: NamePath[]) => void; getInternalHooks: (hookKey: K) => K extends typeof HOOK_KEY ? { relateFormNode: (node: FormNode) => void; setInitialValues: (values: Record, onlyCacheValues: boolean) => void; setCallbacks: (cbs: FormCallbacks) => void; getFormInitialValues: () => Record; setValidateMessages: (validateMessages: ValidateMessages) => void; validator: Validator; store: { getState: () => any; dispatch: (action: any) => void; subscribe: (listener: any) => () => void; }; } : null; };