vee-validate
- Version 4.14.6
- Published
- 855 kB
- 2 dependencies
- MIT license
Install
npm i vee-validate
yarn add vee-validate
pnpm add vee-validate
Overview
Painless forms for Vue.js
Index
Variables
Functions
- cleanupNonNestedPath()
- configure()
- defineRule()
- isNotNestedPath()
- normalizeRules()
- useField()
- useFieldArray()
- useFieldError()
- useFieldValue()
- useForm()
- useFormContext()
- useFormErrors()
- useFormValues()
- useIsFieldDirty()
- useIsFieldTouched()
- useIsFieldValid()
- useIsFormDirty()
- useIsFormTouched()
- useIsFormValid()
- useIsSubmitting()
- useIsValidating()
- useResetForm()
- useSetFieldError()
- useSetFieldTouched()
- useSetFieldValue()
- useSetFormErrors()
- useSetFormTouched()
- useSetFormValues()
- useSubmitCount()
- useSubmitForm()
- useValidateField()
- useValidateForm()
- validate()
- validateObject()
Interfaces
PrivateFormContext
- controlledValues
- createPathState()
- defineComponentBinds()
- defineField()
- defineInputBinds()
- destroyPath()
- errorBag
- errors
- fieldArrays
- formId
- getAllPathStates()
- getPathState()
- handleSubmit
- initialValues
- isFieldDirty()
- isFieldTouched()
- isFieldValid()
- isSubmitting
- isValidating
- keepValuesOnUnmount
- meta
- removePathState()
- schema
- setFieldInitialValue()
- stageInitialValue()
- submitCount
- unsetInitialValue()
- unsetPathValue()
- useFieldModel()
- validate()
- validateField()
- validateSchema
- values
Type Aliases
- BaseComponentBinds
- ComponentModelBinds
- FieldContext
- FieldPathLookup
- FieldValidator
- FlattenAndMapPathsValidationResult
- FlattenAndSetPathsType
- FormErrorBag
- FormErrors
- FormSlotProps
- GenericObject
- GenericValidateFunction
- InferInput
- InferOutput
- InputType
- InvalidSubmissionHandler
- IsAny
- IsEqual
- LazyComponentBindsConfig
- LazyInputBindsConfig
- Locator
- MapValuesPathsToRefs
- MaybeArray
- MaybePromise
- Path
- PathValue
- PublicPathState
- RawFormSchema
- RuleExpression
- SchemaValidationMode
- SubmissionHandler
- YupSchema
Variables
variable ErrorMessage
const ErrorMessage: any;
variable Field
const Field: any;
variable FieldArray
const FieldArray: any;
variable FieldContextKey
const FieldContextKey: InjectionKey<PrivateFieldContext<unknown, unknown>>;
variable Form
const Form: any;
variable FormContextKey
const FormContextKey: InjectionKey<PrivateFormContext<GenericObject, GenericObject>>;
variable IS_ABSENT
const IS_ABSENT: Symbol;
variable PublicFormContextKey
const PublicFormContextKey: InjectionKey<FormContext<GenericObject, GenericObject>>;
Functions
function cleanupNonNestedPath
cleanupNonNestedPath: (path: string) => string;
function configure
configure: (newConf: Partial<VeeValidateConfig>) => void;
function defineRule
defineRule: <TValue = unknown, TParams = any[] | Record<string, any>>( id: string, validator: | ValidationRuleFunction<TValue, TParams> | SimpleValidationRuleFunction<TValue, TParams>) => void;
Adds a custom validator to the list of validation rules.
function isNotNestedPath
isNotNestedPath: (path: string) => boolean;
Checks if the path opted out of nested fields using
[fieldName]
syntax
function normalizeRules
normalizeRules: ( rules: | undefined | string | Record<string, unknown | unknown[] | Record<string, unknown>>) => Record<string, unknown[] | Record<string, unknown>>;
Normalizes the given rules expression.
function useField
useField: <TValue = unknown>( path: MaybeRefOrGetter<string>, rules?: MaybeRef<RuleExpression<TValue>>, opts?: Partial<FieldOptions<TValue>>) => FieldContext<TValue>;
Creates a field composite.
function useFieldArray
useFieldArray: <TValue = unknown>( arrayPath: MaybeRefOrGetter<string>) => FieldArrayContext<TValue>;
function useFieldError
useFieldError: (path?: MaybeRefOrGetter<string>) => vue.ComputedRef<string>;
Gives access to a single field error
function useFieldValue
useFieldValue: <TValue = unknown>( path?: MaybeRefOrGetter<string>) => vue.ComputedRef<TValue>;
Gives access to a field's current value
function useForm
useForm: < TValues extends GenericObject = GenericObject, TOutput extends GenericObject = TValues, TSchema extends | FlattenAndSetPathsType< TValues, string | GenericObject | GenericValidateFunction<unknown> > | TypedSchema<TValues, TOutput> = | FlattenAndSetPathsType< TValues, string | GenericObject | GenericValidateFunction<unknown> > | TypedSchema<TValues, TOutput>>( opts?: FormOptions<TValues, TOutput, TSchema>) => FormContext<TValues, TOutput>;
function useFormContext
useFormContext: < TValues extends GenericObject = GenericObject, TOutput extends GenericObject = TValues>() => FormContext<TValues, TOutput>;
function useFormErrors
useFormErrors: < TValues extends Record<string, unknown> = Record<string, unknown>>() => vue.ComputedRef<Partial<Record<Path<TValues>, string>>>;
Gives access to all form errors
function useFormValues
useFormValues: < TValues extends Record<string, any> = Record<string, any>>() => vue.ComputedRef<Partial<TValues>>;
Gives access to a form's values
function useIsFieldDirty
useIsFieldDirty: (path?: MaybeRefOrGetter<string>) => vue.ComputedRef<boolean>;
If a field is dirty or not
function useIsFieldTouched
useIsFieldTouched: (path?: MaybeRefOrGetter<string>) => vue.ComputedRef<boolean>;
If a field is touched or not
function useIsFieldValid
useIsFieldValid: (path?: MaybeRefOrGetter<string>) => vue.ComputedRef<boolean>;
If a field is validated and is valid
function useIsFormDirty
useIsFormDirty: () => vue.ComputedRef<boolean>;
If the form is dirty or not
function useIsFormTouched
useIsFormTouched: () => vue.ComputedRef<boolean>;
If the form is touched or not
function useIsFormValid
useIsFormValid: () => vue.ComputedRef<boolean>;
If the form has been validated and is valid
function useIsSubmitting
useIsSubmitting: () => vue.ComputedRef<boolean>;
If the form is submitting or not
function useIsValidating
useIsValidating: () => vue.ComputedRef<boolean>;
If the form is validating or not
function useResetForm
useResetForm: < TValues extends Record<string, unknown> = Record<string, unknown>>() => (state?: Partial<FormState<TValues>>, opts?: ResetFormOpts) => void;
function useSetFieldError
useSetFieldError: ( path?: MaybeRefOrGetter<string>) => (message: string | string[] | undefined) => void;
Sets a field's error message
function useSetFieldTouched
useSetFieldTouched: ( path?: MaybeRefOrGetter<string>) => (touched: boolean) => void;
Sets a field's touched meta state
function useSetFieldValue
useSetFieldValue: <TValue = unknown>( path?: MaybeRefOrGetter<string>) => (value: TValue, shouldValidate?: boolean) => void;
Sets a field's value
function useSetFormErrors
useSetFormErrors: () => ( fields: Record<string, string | string[] | undefined>) => void;
Sets multiple fields errors
function useSetFormTouched
useSetFormTouched: () => (fields: Record<string, boolean> | boolean) => void;
Sets multiple fields touched or all fields in the form
function useSetFormValues
useSetFormValues: < TValues extends Record<string, unknown> = Record<string, unknown>>() => (fields: TValues, shouldValidate?: boolean) => void;
Sets multiple fields values
function useSubmitCount
useSubmitCount: () => vue.ComputedRef<number>;
The number of form's submission count
function useSubmitForm
useSubmitForm: < TValues extends Record<string, unknown> = Record<string, unknown>>( cb: SubmissionHandler<TValues>) => (e?: Event) => Promise<unknown>;
function useValidateField
useValidateField: <TOutput>( path?: MaybeRefOrGetter<string>) => () => Promise<ValidationResult<TOutput>>;
Validates a single field
function useValidateForm
useValidateForm: < TValues extends Record<string, unknown> = Record<string, unknown>>() => () => Promise<FormValidationResult<TValues>>;
Validate multiple fields
function validate
validate: <TInput, TOutput>( value: TInput, rules: | string | Record<string, unknown | unknown[]> | GenericValidateFunction<TInput> | GenericValidateFunction<TInput>[] | TypedSchema<TInput, TOutput>, options?: ValidationOptions) => Promise<ValidationResult<TOutput>>;
Validates a value against the rules.
function validateObject
validateObject: <TValues extends GenericObject, TOutput extends GenericObject>( schema: RawFormSchema<TValues>, values: TValues | undefined, opts?: Partial<{ names: Record<string, { name: string; label: string }>; bailsMap: Record<string, boolean>; }>) => Promise<FormValidationResult<TValues, TOutput>>;
Interfaces
interface BaseFieldProps
interface BaseFieldProps {}
interface BaseInputBinds
interface BaseInputBinds<TValue = unknown> {}
interface ComponentBindsConfig
interface ComponentBindsConfig< TValue = unknown, TExtraProps extends GenericObject = GenericObject, TModel extends string = 'modelValue'> {}
property mapProps
mapProps: (state: PublicPathState<TValue>) => TExtraProps;
property model
model: TModel;
property validateOnBlur
validateOnBlur: boolean;
property validateOnModelUpdate
validateOnModelUpdate: boolean;
interface ComponentFieldBindingObject
interface ComponentFieldBindingObject<TValue = any> extends SharedBindingObject<TValue> {}
property modelValue
modelValue?: TValue;
interface ComponentModellessBinds
interface ComponentModellessBinds {}
property onBlur
onBlur: () => void;
interface DevtoolsPluginFieldState
interface DevtoolsPluginFieldState {}
property errors
errors: string[];
property initialValue
initialValue: any;
property meta
meta: FieldMeta<any>;
property name
name: string;
property value
value: any;
interface DevtoolsPluginFormState
interface DevtoolsPluginFormState {}
property errors
errors: FormErrors<Record<string, any>>;
property isSubmitting
isSubmitting: boolean;
property isValidating
isValidating: boolean;
property meta
meta: FormMeta<Record<string, any>>;
property submitCount
submitCount: number;
property values
values: Record<string, any>;
interface FieldArrayContext
interface FieldArrayContext<TValue = unknown> {}
property fields
fields: Ref<FieldEntry<TValue>[]>;
method insert
insert: (idx: number, value: TValue) => void;
method move
move: (oldIdx: number, newIdx: number) => void;
method prepend
prepend: (value: TValue) => void;
method push
push: (value: TValue) => void;
method remove
remove: (idx: number) => void;
method replace
replace: (newArray: TValue[]) => void;
method swap
swap: (indexA: number, indexB: number) => void;
method update
update: (idx: number, value: TValue) => void;
interface FieldBindingObject
interface FieldBindingObject<TValue = any> extends SharedBindingObject<TValue> {}
interface FieldEntry
interface FieldEntry<TValue = unknown> {}
interface FieldMeta
interface FieldMeta<TValue> {}
interface FieldOptions
interface FieldOptions<TValue = unknown> {}
property bails
bails?: boolean;
property checkedValue
checkedValue?: MaybeRefOrGetter<TValue>;
property controlled
controlled?: boolean;
property form
form?: FormContext;
property initialValue
initialValue?: MaybeRef<TValue>;
property keepValueOnUnmount
keepValueOnUnmount?: MaybeRefOrGetter<boolean | undefined>;
property label
label?: MaybeRefOrGetter<string | undefined>;
property modelPropName
modelPropName?: string;
Deprecated
Pass the model prop name to
syncVModel
instead.
property standalone
standalone?: boolean;
Deprecated
Use
controlled
instead, controlled is opposite of standalone.
property syncVModel
syncVModel?: boolean | string;
property type
type?: InputType;
property uncheckedValue
uncheckedValue?: MaybeRefOrGetter<TValue>;
property validateOnMount
validateOnMount?: boolean;
property validateOnValueUpdate
validateOnValueUpdate: boolean;
property valueProp
valueProp?: MaybeRefOrGetter<TValue>;
Deprecated
Use
checkedValue
instead.
interface FieldSlotProps
interface FieldSlotProps<TValue = unknown> extends Pick< FieldContext, | 'validate' | 'resetField' | 'handleChange' | 'handleReset' | 'handleBlur' | 'setTouched' | 'setErrors' | 'setValue' > {}
property componentField
componentField: ComponentFieldBindingObject<TValue>;
property errorMessage
errorMessage: string | undefined;
property errors
errors: string[];
property field
field: FieldBindingObject<TValue>;
property handleInput
handleInput: FieldContext['handleChange'];
property meta
meta: FieldMeta<TValue>;
property value
value: TValue;
interface FieldState
interface FieldState<TValue = unknown> {}
interface FormActions
interface FormActions<TValues extends GenericObject, TOutput = TValues> {}
method resetField
resetField: (field: Path<TValues>, state?: Partial<FieldState>) => void;
method resetForm
resetForm: ( state?: Partial<FormState<TValues>>, opts?: Partial<ResetFormOpts>) => void;
method setErrors
setErrors: ( fields: Partial< FlattenAndSetPathsType<TValues, string | string[] | undefined> >) => void;
method setFieldError
setFieldError: ( field: Path<TValues>, message: string | string[] | undefined) => void;
method setFieldTouched
setFieldTouched: (field: Path<TValues>, isTouched: boolean) => void;
method setFieldValue
setFieldValue: <T extends Path<TValues>>( field: T, value: PathValue<TValues, T>, shouldValidate?: boolean) => void;
method setTouched
setTouched: (fields: Partial<Record<Path<TValues>, boolean>> | boolean) => void;
method setValues
setValues: (fields: PartialDeep<TValues>, shouldValidate?: boolean) => void;
interface FormContext
interface FormContext< TValues extends GenericObject = GenericObject, TOutput extends GenericObject = TValues> extends Omit< PrivateFormContext<TValues, TOutput>, | 'formId' | 'schema' | 'initialValues' | 'getPathState' | 'getAllPathStates' | 'removePathState' | 'unsetPathValue' | 'validateSchema' | 'stageInitialValue' | 'setFieldInitialValue' | 'unsetInitialValue' | 'fieldArrays' | 'markForUnmount' | 'keepValuesOnUnmount' | 'values' > {}
property handleReset
handleReset: () => void;
property submitForm
submitForm: (e?: unknown) => Promise<void>;
property values
values: TValues;
interface FormMeta
interface FormMeta<TValues extends GenericObject> {}
property dirty
dirty: boolean;
property initialValues
initialValues?: Partial<TValues>;
property pending
pending: boolean;
property touched
touched: boolean;
property valid
valid: boolean;
interface FormOptions
interface FormOptions< TValues extends GenericObject, TOutput = TValues, TSchema extends TypedSchema<TValues, TOutput> | FormSchema<TValues> = | FormSchema<TValues> | TypedSchema<TValues, TOutput>> {}
property initialErrors
initialErrors?: FlattenAndSetPathsType<TValues, string | undefined>;
property initialTouched
initialTouched?: FlattenAndSetPathsType<TValues, boolean>;
property initialValues
initialValues?: PartialDeep<TValues> | undefined | null;
property keepValuesOnUnmount
keepValuesOnUnmount?: MaybeRef<boolean>;
property validateOnMount
validateOnMount?: boolean;
property validationSchema
validationSchema?: MaybeRef< TSchema extends TypedSchema ? TypedSchema<TValues, TOutput> : any>;
interface FormState
interface FormState<TValues> {}
property errors
errors: Partial<Record<Path<TValues>, string | undefined>>;
property submitCount
submitCount: number;
property touched
touched: Partial<Record<Path<TValues>, boolean>>;
property values
values: PartialDeep<TValues>;
interface FormValidationResult
interface FormValidationResult< TInput extends GenericObject, TOutput extends GenericObject = TInput> {}
interface InputBindsConfig
interface InputBindsConfig< TValue = unknown, TExtraProps extends GenericObject = GenericObject> {}
property label
label: MaybeRefOrGetter<string>;
property props
props: (state: PublicPathState<TValue>) => TExtraProps;
property validateOnBlur
validateOnBlur: boolean;
property validateOnChange
validateOnChange: boolean;
property validateOnInput
validateOnInput: boolean;
property validateOnModelUpdate
validateOnModelUpdate: boolean;
interface InvalidSubmissionContext
interface InvalidSubmissionContext< TInput extends GenericObject = GenericObject, TOutput extends GenericObject = TInput> {}
interface PathState
interface PathState<TInput = unknown, TOutput = TInput> {}
property bails
bails: boolean;
property dirty
dirty: boolean;
property errors
errors: string[];
property fieldsCount
fieldsCount: number;
property id
id: number | number[];
property initialValue
initialValue: TInput | undefined;
property label
label: string | undefined;
property multiple
multiple: boolean;
property path
path: string;
property pending
pending: boolean;
property required
required: boolean;
property touched
touched: boolean;
property type
type: InputType;
property valid
valid: boolean;
property validate
validate?: FieldValidator<TOutput>;
property validated
validated: boolean;
property value
value: TInput | undefined;
interface PathStateConfig
interface PathStateConfig<TOutput> {}
interface PrivateFieldArrayContext
interface PrivateFieldArrayContext<TValue = unknown> extends FieldArrayContext<TValue> {}
interface PrivateFieldContext
interface PrivateFieldContext<TInput = unknown, TOutput = TInput> {}
property bails
bails?: boolean;
property checked
checked?: Ref<boolean>;
property checkedValue
checkedValue?: MaybeRefOrGetter<TInput>;
property errorMessage
errorMessage: Ref<string | undefined>;
property errors
errors: Ref<string[]>;
property id
id: number;
property keepValueOnUnmount
keepValueOnUnmount?: MaybeRefOrGetter<boolean | undefined>;
property label
label?: MaybeRefOrGetter<string | undefined>;
property meta
meta: FieldMeta<TInput>;
property name
name: MaybeRef<string>;
property type
type?: string;
property uncheckedValue
uncheckedValue?: MaybeRefOrGetter<TInput>;
property validate
validate: FieldValidator<TOutput>;
property value
value: Ref<TInput>;
method handleBlur
handleBlur: (e?: Event, shouldValidate?: boolean) => void;
method handleChange
handleChange: (e: Event | unknown, shouldValidate?: boolean) => void;
method handleReset
handleReset: () => void;
method resetField
resetField: (state?: Partial<FieldState<TInput>>) => void;
method setErrors
setErrors: (message: string | string[]) => void;
method setState
setState: (state: Partial<FieldState<TInput>>) => void;
method setTouched
setTouched: (isTouched: boolean) => void;
method setValue
setValue: (value: TInput, shouldValidate?: boolean) => void;
interface PrivateFormContext
interface PrivateFormContext< TValues extends GenericObject = GenericObject, TOutput extends GenericObject = TValues> extends FormActions<TValues> {}
property controlledValues
controlledValues: Ref<TValues>;
property errorBag
errorBag: Ref<FormErrorBag<TValues>>;
property errors
errors: ComputedRef<FormErrors<TValues>>;
property fieldArrays
fieldArrays: PrivateFieldArrayContext[];
property formId
formId: number;
property handleSubmit
handleSubmit: HandleSubmitFactory<TValues, TOutput> & { withControlled: HandleSubmitFactory<TValues, TOutput>;};
property initialValues
initialValues: Ref<Partial<TValues>>;
property isSubmitting
isSubmitting: Ref<boolean>;
property isValidating
isValidating: Ref<boolean>;
property keepValuesOnUnmount
keepValuesOnUnmount: MaybeRef<boolean>;
property meta
meta: ComputedRef<FormMeta<TValues>>;
property schema
schema?: MaybeRef< | RawFormSchema<TValues> | TypedSchema<TValues, TOutput> | YupSchema<TValues> | undefined>;
property submitCount
submitCount: Ref<number>;
property validateSchema
validateSchema?: ( mode: SchemaValidationMode) => Promise<FormValidationResult<TValues, TOutput>>;
property values
values: TValues;
method createPathState
createPathState: <TPath extends Path<TValues>>( path: MaybeRef<TPath>, config?: Partial<PathStateConfig<TOutput[TPath]>>) => PathState<PathValue<TValues, TPath>>;
method defineComponentBinds
defineComponentBinds: < TPath extends Path<TValues>, TValue = PathValue<TValues, TPath>, TModel extends string = 'modelValue', TExtras extends GenericObject = GenericObject>( path: MaybeRefOrGetter<TPath>, config?: | Partial<ComponentBindsConfig<TValue, TExtras, TModel>> | LazyComponentBindsConfig<TValue, TExtras, TModel>) => Ref< ComponentModellessBinds & { [TKey in `onUpdate:${TModel}`]: (value: TValue) => void; } & { [k in TModel]: TValue } & TExtras>;
Deprecated
use defineField instead
method defineField
defineField: < TPath extends Path<TValues>, TValue = PathValue<TValues, TPath>, TExtras extends GenericObject = GenericObject>( path: MaybeRefOrGetter<TPath>, config?: | Partial<InputBindsConfig<TValue, TExtras>> | LazyInputBindsConfig<TValue, TExtras>) => [Ref<TValue>, Ref<BaseFieldProps & TExtras>];
method defineInputBinds
defineInputBinds: < TPath extends Path<TValues>, TValue = PathValue<TValues, TPath>, TExtras extends GenericObject = GenericObject>( path: MaybeRefOrGetter<TPath>, config?: | Partial<InputBindsConfig<TValue, TExtras>> | LazyInputBindsConfig<TValue, TExtras>) => Ref<BaseInputBinds<TValue> & TExtras>;
Deprecated
use defineField instead
method destroyPath
destroyPath: (path: string) => void;
method getAllPathStates
getAllPathStates: () => PathState[];
method getPathState
getPathState: <TPath extends Path<TValues>>( path: TPath) => PathState<PathValue<TValues, TPath>> | undefined;
method isFieldDirty
isFieldDirty: <TPath extends Path<TValues>>(path: TPath) => boolean;
method isFieldTouched
isFieldTouched: <TPath extends Path<TValues>>(path: TPath) => boolean;
method isFieldValid
isFieldValid: <TPath extends Path<TValues>>(path: TPath) => boolean;
method removePathState
removePathState: <TPath extends Path<TValues>>(path: TPath, id: number) => void;
method setFieldInitialValue
setFieldInitialValue: ( path: string, value: unknown, updateOriginal?: boolean) => void;
method stageInitialValue
stageInitialValue: ( path: string, value: unknown, updateOriginal?: boolean) => void;
method unsetInitialValue
unsetInitialValue: (path: string) => void;
method unsetPathValue
unsetPathValue: <TPath extends Path<TValues>>(path: TPath) => void;
method useFieldModel
useFieldModel: { <TPath extends Path<TValues>>(path: TPath): Ref<PathValue<TValues, TPath>>; <TPaths extends readonly MaybeRef<Path<TValues>>[]>( paths: TPaths ): MapValuesPathsToRefs<TValues, TPaths>;};
Deprecated
use defineField instead
method validate
validate: ( opts?: Partial<ValidationOptions$1>) => Promise<FormValidationResult<TValues, TOutput>>;
method validateField
validateField: <TPath extends Path<TValues>>( field: TPath, opts?: Partial<ValidationOptions$1>) => Promise<ValidationResult<TOutput[TPath]>>;
interface ResetFormOpts
interface ResetFormOpts {}
property force
force: boolean;
interface SubmissionContext
interface SubmissionContext<TInput extends GenericObject = GenericObject> extends FormActions<TInput> {}
property controlledValues
controlledValues: Partial<TInput>;
property evt
evt?: Event;
interface TypedSchema
interface TypedSchema<TInput = any, TOutput = TInput> {}
interface TypedSchemaContext
interface TypedSchemaContext {}
property formData
formData: GenericObject;
interface TypedSchemaError
interface TypedSchemaError {}
interface TypedSchemaPathDescription
interface TypedSchemaPathDescription {}
interface ValidationOptions
interface ValidationOptions$1 {}
interface ValidationResult
interface ValidationResult<TValue = unknown> {}
Type Aliases
type BaseComponentBinds
type BaseComponentBinds< TValue = any, TModel extends string = 'modelValue'> = ComponentModelBinds<TValue, TModel> & { [k in TModel]: TValue;};
type ComponentModelBinds
type ComponentModelBinds< TValue = any, TModel extends string = 'modelValue'> = ComponentModellessBinds & { [TKey in `onUpdate:${TModel}`]: (value: TValue) => void;};
type FieldContext
type FieldContext<TValue = unknown> = Omit< PrivateFieldContext<TValue>, 'id' | 'instances'>;
type FieldPathLookup
type FieldPathLookup<TValues extends GenericObject = GenericObject> = Partial< Record<Path<TValues>, PrivateFieldContext | PrivateFieldContext[]>>;
type FieldValidator
type FieldValidator<TOutput> = ( opts?: Partial<ValidationOptions$1>) => Promise<ValidationResult<TOutput>>;
type FlattenAndMapPathsValidationResult
type FlattenAndMapPathsValidationResult< TInput extends GenericObject, TOutput extends GenericObject> = { [K in Path<TInput>]: ValidationResult<TOutput[K]>;};
type FlattenAndSetPathsType
type FlattenAndSetPathsType<TRecord, TType> = { [K in Path<TRecord>]: TType;};
type FormErrorBag
type FormErrorBag<TValues extends GenericObject> = Partial< Record<Path<TValues>, string[]>>;
type FormErrors
type FormErrors<TValues extends GenericObject> = Partial< Record<Path<TValues>, string | undefined>>;
type FormSlotProps
type FormSlotProps = UnwrapRef< Pick< FormContext, | 'meta' | 'errors' | 'errorBag' | 'values' | 'isSubmitting' | 'isValidating' | 'submitCount' | 'validate' | 'validateField' | 'handleReset' | 'setErrors' | 'setFieldError' | 'setFieldValue' | 'setValues' | 'setFieldTouched' | 'setTouched' | 'resetForm' | 'resetField' | 'controlledValues' >> & { handleSubmit: ( evt: Event | SubmissionHandler, onSubmit?: SubmissionHandler ) => Promise<unknown>; submitForm(evt?: Event): void; getValues<TValues extends GenericObject = GenericObject>(): TValues; getMeta<TValues extends GenericObject = GenericObject>(): FormMeta<TValues>; getErrors<TValues extends GenericObject = GenericObject>(): FormErrors<TValues>;};
type GenericObject
type GenericObject = Record<string, any>;
type GenericValidateFunction
type GenericValidateFunction<TValue = unknown> = ( value: TValue, ctx: FieldValidationMetaInfo) => MaybePromise<boolean | MaybeArray<string>>;
type InferInput
type InferInput<TSchema extends TypedSchema> = TSchema extends TypedSchema< infer TInput, any> ? TInput : never;
type InferOutput
type InferOutput<TSchema extends TypedSchema> = TSchema extends TypedSchema< any, infer TOutput> ? TOutput : never;
type InputType
type InputType = 'checkbox' | 'radio' | 'default';
type InvalidSubmissionHandler
type InvalidSubmissionHandler< TInput extends GenericObject = GenericObject, TOutput extends GenericObject = TInput> = (ctx: InvalidSubmissionContext<TInput, TOutput>) => void;
type IsAny
type IsAny<T> = 0 extends 1 & T ? true : false;
Checks whether the type is any See https://stackoverflow.com/a/49928360/3406963
type IsEqual
type IsEqual<T1, T2> = T1 extends T2 ? (<G>() => G extends T1 ? 1 : 2) extends <G>() => G extends T2 ? 1 : 2 ? true : false : false;
Checks whether T1 can be exactly (mutually) assigned to T2
type LazyComponentBindsConfig
type LazyComponentBindsConfig< TValue = unknown, TExtraProps extends GenericObject = GenericObject, TModel extends string = 'modelValue'> = (state: PublicPathState<TValue>) => Partial<{ props: TExtraProps; validateOnBlur: boolean; validateOnModelUpdate: boolean; model: TModel;}>;
type LazyInputBindsConfig
type LazyInputBindsConfig< TValue = unknown, TExtraProps extends GenericObject = GenericObject> = (state: PublicPathState<TValue>) => Partial<{ props: TExtraProps; validateOnBlur: boolean; validateOnChange: boolean; validateOnInput: boolean; validateOnModelUpdate: boolean;}>;
type Locator
type Locator = { __locatorRef: string;} & ((values: GenericObject) => unknown);
type MapValuesPathsToRefs
type MapValuesPathsToRefs< TValues extends GenericObject, TPaths extends readonly [...MaybeRef<Path<TValues>>[]]> = { readonly [K in keyof TPaths]: TPaths[K] extends MaybeRef<infer TKey> ? TKey extends Path<TValues> ? Ref<PathValue<TValues, TKey>> : Ref<unknown> : Ref<unknown>;};
type MaybeArray
type MaybeArray<T> = T | T[];
type MaybePromise
type MaybePromise<T> = T | Promise<T>;
type Path
type Path<T> = T extends any ? PathInternal<T> : never;
Type which eagerly collects all paths through a type
Example 1
Path<{foo: {bar: string}}> = 'foo' | 'foo.bar'
type PathValue
type PathValue<T, P extends Path<T> | ArrayPath<T>> = T extends any ? P extends `${infer K}.${infer R}` ? K extends keyof T ? R extends Path<T[K]> ? PathValue<T[K], R> : never : K extends `${ArrayKey}` ? T extends ReadonlyArray<infer V> ? PathValue<V, R & Path<V>> : never : never : P extends keyof T ? T[P] : P extends `${ArrayKey}` ? T extends ReadonlyArray<infer V> ? V : never : never : never;
Type to evaluate the type which the given path points to.
Example 1
PathValue<{foo: {bar: string}}, 'foo.bar'> = stringPathValue<[number, string], '1'> = string
type PublicPathState
type PublicPathState<TValue = unknown> = Omit< PathState<TValue>, | 'bails' | 'label' | 'multiple' | 'fieldsCount' | 'validate' | 'id' | 'type' | '__flags'>;
type RawFormSchema
type RawFormSchema<TValues> = Record< Path<TValues>, string | GenericValidateFunction | GenericObject>;
type RuleExpression
type RuleExpression<TValue> = | string | Record<string, unknown> | GenericValidateFunction<TValue> | GenericValidateFunction<TValue>[] | TypedSchema<TValue> | YupSchema<TValue> | undefined;
type SchemaValidationMode
type SchemaValidationMode = 'validated-only' | 'silent' | 'force';
validated-only: only mutate the previously validated fields silent: do not mutate any field force: validate all fields and mutate their state
type SubmissionHandler
type SubmissionHandler< TInput extends GenericObject = GenericObject, TOutput = TInput, TReturn = unknown> = (values: TOutput, ctx: SubmissionContext<TInput>) => TReturn;
type YupSchema
type YupSchema<TValues = any> = { __isYupSchema__: boolean; validate(value: any, options: GenericObject): Promise<any>;};
Package Files (1)
Dependencies (2)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/vee-validate
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/vee-validate)
- HTML<a href="https://www.jsdocs.io/package/vee-validate"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 7206 ms. - Missing or incorrect documentation? Open an issue for this package.