npm vee-validate 2.1.0-beta.0

latest releases: 4.12.6, 4.12.5, 4.12.4...
5 years ago

This release introduces some breaking changes due to pressing concerns with DX with vee-validate, as well as some bug fixes and enhancements. This has the beta status to allow users to test this release with their projects.

☠️ Breaking Changes

  • targeting: Now all targets must be a ref (#1318). this removes the confusion around the different targeting selector formats which now only leaves one universal way to target other fields regardless of their nature, meaning you should always now have a ref on the target field. Also, this is more SSR friendly since it removes the need for document and window object existence. This affects the confirmed, before, and after rules.
  • renamed rules: The in and not_in rules have been renamed to included and excluded respectively to avoid confusing in rule with the in keyword in some situations.
<input type="password" name="password" v-validate="'required|confirmed:password'">
<input type="password" name="confirmation" ref="password">

🛑 Deprecations

  • errorbag.add: the old add(field, msg, rule, scope) method signature is now deprecated, use add(error: FieldError) instead.
const FieldError = {
  field: string,
  msg: string,
  scope: ?string,
  id: ?string,
  rule: ?string
};

- __ctor.validates__: has now been removed from the code, use `ctor.$_veeValidate.validator` instead.

💯 New Features

  • VeeValidate now infers rules from HTML5 input attributes #1250

🐛 Bug Fixes

  • computed setters: updated an internal check that prevented computed properties with setters (common use-case for Vuex state with inputs) from being watched properly, closes #1310 #1316.
  • targeting: targeted custom components now use the correct listeners and value resolvers, closes #1315
  • custom errors: any added custom errors are now removed properly, closes #1303

🛠 Enhancements

  • rules bundle: remove default export #1329.
  • ErrorBag: The ErrorBag API is now more consistent across first, has, remove, collect methods.
  • included and excluded rules: Work on iterables (check if the value is included or excluded from an iterable).

That change allows remove and collect to take advantage of the selector synatx, for example:

errors.remove('myfield:required'); // remove the required rule error related to the field name `myfield`.
errors.remove('s1.myfield:required'); // remove the required rule error related to the field name `myfield` within the scope 's1'.

This is still backward compatible. closes #1317 and #1322

Don't miss a new vee-validate release

NewReleases is sending notifications on new releases.