Vee Validate Versions Save

✅ Painless Vue forms

v4.12.6

2 months ago

🐛 Bug Fixes

  • Apply error messages again to prevent hoisted paths from being overridden 07d01fdd9bd41d44bcb163021d15ff4b3d4bde45

👕 TypeScript

  • Expose Field component interface #4657
  • Updated valibot dependency #4658

v4.12.5

3 months ago

🐛 Bug Fixes

  • Make sure removePathState removes the correct path state #4643 (#4649) thanks to @bgoscinski
  • Remove event arg from define field handlers for component compat #4637 (#4647)

v4.12.4

4 months ago

🐛 Bug Fixes

  • Check if both source and target objects are POJOs before attempting to merge them (2a09a58)

v4.12.3

5 months ago

🐛 Bug Fixes

  • use spec object instead of checking tests for determining the required status of a field on yup schemas #4598 (#4599)

🆕 Improvements

  • Remove deep data mutation warning #4597 (72e4379)
  • Allow path meta querying for nested fields #4575 (a18c19f)
  • Expose some state on form instance (e2171f8)

v4.12.2

5 months ago

🐛 Bug Fixes

  • Apply schema casts when submitting #4565 (b2203c8e)
  • defineField should respect global validateOnModelUpdate config #4567 (ec8a4d7e)

v4.12.1

5 months ago

🐛 Bug Fixes

  • resetForm not resetting unspecified fields to their original values if a partial is provided #4564 (36f6b9e6)
  • resetField not setting the original value of the field causing the dirty flag to not update #4564 (36f6b9e6)

DX

  • unref initial values when initializing the form #4563 (c1c6f399)

v4.12.0

5 months ago

💣 Breaking Changes

Deprecated reactive initial values #4402 (bbecc973)

Initial values can no longer be reactive since they did not serve any purpose for being so. The recommended API for setting async initial values is by explicitly calling resetForm.

🆕 defineField API #4497

This is a new function available on useForm and is meant to replace useFieldModel, defineInputBinds and defineComponentBinds by building upon and improving those APIs.

<script setup>
import { useForm } from 'vee-validate';

const { defineField, errors } = useForm({
  validationSchema: schema,
  validateOnMount: true,
});

const [email, emalProps] = defineField('email', { validateOnModelUpdate: true });
const [password, pwProps] = defineField('password', { validateOnModelUpdate: true });
</script>

<template>
  <input v-model="email" v-bind="emailProps" />
  <span>{{ errors.email }}</span>

  <input  v-model="password" v-bind="pwProps" />
  <span>{{ errors.password }}</span>
</div>
</template>

The docs have been updated to reflect using this new API instead of the deprecated ones. The old ones will continue to work till they get removed in next minor releases.

🆕 meta.required

Added support for meta.required state for Typed Schemas only.

That means if you are using toTypedSchema helper with either Yup, Zod, Valibot, or Global rules then it should be automatically done for you. This is a new experimental feature and may not work well with conditional schemas or dynamic ones.

For more info check the live demo link here.

🆕 DX improvements

  • feat: add label support to defineField #4530 (f9a95843)
  • feat(DX): allow getters for field arrays paths (95b701f7)

🐛 Bug Fixes

  • Avoid overriding paths and destroy path on remove #4476 #4557 (f688896f)
  • Clone values before reset #4536 (2abb8966)
  • Handle hoisted paths overriding one another (e370413b)

v4.11.8

7 months ago

🐛 Bug Fixes

  • (perf) Avoid triggering extra model value events #4461 (d1b5b855)

👕 TypeScript

  • Allow null as a valid Form prop type #4483 (78c4668e)

v4.11.7

7 months ago

💣 Breaking Changes

  • Removed default export from the @vee-validate/rules package which caused issues for ESM importing #4470

This only affects you if you are importing all the rules.

Migration:

- import AllRules from '@vee-validate/rules';
+ import * as AllRules from '@vee-validate/rules';

👕 Types

  • useSetFormValues now accepts values generic type parameters (#4475) thanks to @ivan-angjelkoski
  • Exported missing internal types causing a build error #4478 (a1414f6aa9d133376b98c6a53347be47da480d6d)

🆕 New Features

  • Added Joi schema support thanks to @lallenfrancisl (#4463), it was sneaked in a previous release tag but it is being announced here to acknowledge that addition.
  • Valibot and Yup schemas now merge their default values with the initial form values, allowing you to use each lib's schema defaults more freely (c3727181aeb768976c6467f6033b8381191c2e2f)

v4.11.6

8 months ago

👕 TypeScript

This release is aimed at resolving #4421

  • useForm#defineComponentBinds is now more strict and provides accurate typings for both modelValue and update:modeValue properties. Previously they were not exposed.

Try the following example.

const { defineComponentBinds } = useForm({
  validationSchema: toTypedSchema(yup.object({
    date: yup.date().required(),
    number: yup.number().required(),
    string: yup.string().required(),
    valueModel: yup.string().required(),
  })),
});

const date = defineComponentBinds('date');
const number = defineComponentBinds('number');
const string = defineComponentBinds('string');
const valueModel = defineComponentBinds('valueModel');