UNPKG

@volverjs/form-vue

Version:

Vue 3 Forms with @volverjs/ui-vue

135 lines (134 loc) 7.46 kB
import { Component, InjectionKey, PropType, SlotsType, UnwrapRef } from 'vue'; import { FormComponentOptions, FormSchema, FormTemplate, InjectedFormData, InjectedFormWrapperData, Path, InferSchema, InferFormattedError, RefinementCtx } from './types'; import { FormStatus } from './enums'; export declare function defineForm<Schema extends FormSchema, Type, FormTemplateComponent extends Component>(schema: Schema, provideKey: InjectionKey<InjectedFormData<Schema, Type>>, options: FormComponentOptions<Schema, Type>, VvFormTemplate: FormTemplateComponent, wrappers: Map<string, InjectedFormWrapperData<Schema>>): { clear: () => void; errors: import('vue').Ref<InferFormattedError<Schema> | undefined, InferFormattedError<Schema> | undefined>; formData: import('vue').Ref<(undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined>; ignoreUpdates: import('@vueuse/shared').IgnoredUpdater; invalid: import('vue').ComputedRef<boolean>; readonly: import('vue').Ref<boolean, boolean>; reset: () => void; status: import('vue').Ref<FormStatus | undefined, FormStatus | undefined>; wrappers: Map<string, InjectedFormWrapperData<Schema>>; stopUpdatesWatch: import('vue').WatchStopHandle; submit: (options?: { fields?: Set<Path<InferSchema<Schema>>>; superRefine?: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>; }) => Promise<boolean>; validate: (value?: (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, options?: { fields?: Set<Path<InferSchema<Schema>>>; superRefine?: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>; }) => Promise<boolean>; VvForm: import('vue').DefineComponent<import('vue').ExtractPropTypes<{ continuousValidation: { type: BooleanConstructor; default: boolean; }; modelValue: { type: ObjectConstructor; default: () => {}; }; readonly: { type: BooleanConstructor; default: boolean | undefined; }; tag: { type: StringConstructor; default: string; }; template: { type: PropType<FormTemplate<Schema, Type>>; default: undefined; }; superRefine: { type: PropType<(arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>>; default: undefined; }; validateFields: { type: PropType<Path<InferSchema<Schema>>[]>; default: undefined; }; }>, { clear: () => void; errors: Readonly<import('vue').Ref<import('vue').DeepReadonly<InferFormattedError<Schema>> | undefined, import('vue').DeepReadonly<InferFormattedError<Schema>> | undefined>>; formData: import('vue').Ref<(undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined>; ignoreUpdates: import('@vueuse/shared').IgnoredUpdater; invalid: import('vue').ComputedRef<boolean>; isReadonly: import('vue').Ref<boolean, boolean>; reset: () => void; status: Readonly<import('vue').Ref<FormStatus | undefined, FormStatus | undefined>>; stopUpdatesWatch: import('vue').WatchStopHandle; submit: () => Promise<boolean>; validate: (value?: (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, options?: { fields?: Set<Path<InferSchema<Schema>>>; superRefine?: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>; }) => Promise<boolean>; wrappers: Map<string, InjectedFormWrapperData<Schema>>; }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("invalid" | "valid" | "reset" | "submit" | "update:modelValue" | "update:readonly")[], "invalid" | "valid" | "reset" | "submit" | "update:modelValue" | "update:readonly", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{ continuousValidation: { type: BooleanConstructor; default: boolean; }; modelValue: { type: ObjectConstructor; default: () => {}; }; readonly: { type: BooleanConstructor; default: boolean | undefined; }; tag: { type: StringConstructor; default: string; }; template: { type: PropType<FormTemplate<Schema, Type>>; default: undefined; }; superRefine: { type: PropType<(arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>>; default: undefined; }; validateFields: { type: PropType<Path<InferSchema<Schema>>[]>; default: undefined; }; }>> & Readonly<{ onInvalid?: ((...args: any[]) => any) | undefined; onValid?: ((...args: any[]) => any) | undefined; onReset?: ((...args: any[]) => any) | undefined; onSubmit?: ((...args: any[]) => any) | undefined; "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined; "onUpdate:readonly"?: ((...args: any[]) => any) | undefined; }>, { readonly: boolean; superRefine: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>; tag: string; template: FormTemplate<Schema, Type>; continuousValidation: boolean; modelValue: Record<string, any>; validateFields: Path<InferSchema<Schema>>[]; }, SlotsType<{ default: { errors: UnwrapRef<Readonly<import('vue').Ref<import('vue').DeepReadonly<InferFormattedError<Schema>> | undefined, import('vue').DeepReadonly<InferFormattedError<Schema>> | undefined>>>; formData: UnwrapRef<import('vue').Ref<(undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined>>; invalid: UnwrapRef<import('vue').ComputedRef<boolean>>; readonly: UnwrapRef<import('vue').Ref<boolean, boolean>>; status: UnwrapRef<Readonly<import('vue').Ref<FormStatus | undefined, FormStatus | undefined>>>; wrappers: typeof wrappers; clear: () => void; ignoreUpdates: import('@vueuse/shared').IgnoredUpdater; reset: () => void; stopUpdatesWatch: import('vue').WatchStopHandle; submit: (options?: { fields?: Set<Path<InferSchema<Schema>>>; superRefine?: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>; }) => Promise<boolean>; validate: (value?: (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, options?: { fields?: Set<Path<InferSchema<Schema>>>; superRefine?: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>; }) => Promise<boolean>; }; }>, {}, {}, "invalid" | "valid" | "reset" | "status" | "readonly" | "clear" | "errors" | "validate" | "submit" | "tag" | "template", import('vue').ComponentProvideOptions, true, {}, any>; };