Releases: logaretm/vee-validate
2.0.3
🐛 Fixed
- Fixed
date_between
not dealing with single values correctly. #1104 - Fixed bound
ref
in av-for
loop crashing and causing an infinite loop. #1107 - Patched an issue with
vue-devtools
crashing when inspecting a component that has validation logic in it. #1111
Enhancements
- Updated typescript definitions of
Validator.attach
method. Thanks @azampagl
2.0.2
2.0.1
2.0.0 Full Release
We finally got our first full release out, vee-validate
has been ready for production for quite a while now but it never satisfied me unless certain features are implemented and the tests to be improved, so now we will be following a stable releases, no breaking changes will be introduced in patch versions.
We will have our new documentation site ready very soon, most content will be rewritten from scratch.
🐛 Fixed
-
Fixed an issue in locales when used as a script tag src where they would still call the now deprecated
addLocale
method. -
In rare cases
valid/invalid
classes will be applied on inputs before they are validated by the user, now they will only be applied when the user has interacted with the input, or if the input has explicitly been validated using thevalidator
instance. #1067 -
Allow multiple installations for the plugin with different Vue references. #1064
-
Vue.use
would change the locale back to the default config if the validator has been localized beforehand. #1050
✨ Enhancements
2.0.0-rc.27
This is a small hotfix release:
🐛 Fixed
- Fixed an issue that prevented resolving correct delay values #1041
- Fixed
vee-validate
setting the locale at installation whenvue-i18n
was used which in turn triggered the warning.
2.0.0.rc-26
🔥 New Stuff
Added Basic vue-i18n Support #1007
vee-validate
now supports vue-i18n
plugin out of the box, and it can convert the vee-validate
localization format to the vue-i18n
format as well if you intend to use them in your app. and is done automatically whenever you use the Validator.localize
method.
Here is an example use case:
import VeeValidate from 'vee-validate';
import en from 'vee-validate/dist/locale/en'
import VueI18n from 'vue-i18n';
Vue.use(VueI18n)
const i18n = new VueI18n({
locale: 'en',
messages: {}
})
Vue.use(VeeValidate, {
i18n, // the vue-i18n instance
i18nRootKey: 'validation' // where the locale keys for vee-validate will live in each locale.,
dictionary: { // locales defined here will be converted to `vue-i18n` format.
en
}
});
new Vue({ i18n }).mount('#app');
Note that now
vee-validate
will always respecti18n
locale settings, so any attempts to change the locale from the validator will result in a warning. You should change your app locale usingvue-i18n
API.
vee-validate
will use the list formatting method of vue-i18n
messages, so make sure all messages are properly formatted.
New Rule: is:{value}
is
is a new rule to compare values, it is not very useful when used in string format. But when using it in the Object format you can then make checking values a lot easier than using confirmed
.
<template>
<input type="text" name="pass" v-model="pass" v-validate="{ is: confirmed }">
<input type="text" name="confirm" v-model="confirmed">
</template>
<script>
export default {
data: () => ({
pass: null,
confirmed: null
})
};
</script>
✨ Enhancements
- Messages generated by the validator will now regenerate if the locale changes, allowing messages to display in run-time locale at all times, this works also for
i18n
plugin messages. #1029 #1033 #1019 #152
Manually added messages do not have this feature, you would need to provide a
regenerate
function which displays the same message in the current locale.
localize
method now accepts an dictionary object, which allows you to merge locales at once without having to merge them one by one or accidentally setting the current locale. The dictionary object should look like this:
// object of string keys representing the locale keys.
const dict = {
[locale: string]: {
messages: {},
attributes: {},
custom: {},
dateFormat: 'whatever'
}
};
Validator.localize(dict); // does not set the locale, just merges the data
Validator.extend
Now accepts a third parameter of type ExtendOptions which allows your rule to target/request another field value as its first element in the params array, which makes creating rules likeconfirmed
possible and is governed by the validator field resolution mechanism.
🐛 Bugs fixed
- Fix
field.update
not respecting the global delay config when updating field events #1025
💀 Deprecated and Breaking 🛑
- The validator will no longer generate messages in the English locale if the message was not found in the current locale, each dictionary implementation should now handle this case.
validator.updateDictionary
has been deprecated in favor ofvalidator.localize
.validator.setLocale
has been deprecated in favor ofvalidator.localize
and thevalidator.locale
setter.validator.installDateTimeValidators
has been removed API, date validators have been available out of the box for a while.- Automatic classes will no longer work for custom components.
messages
object will no longer be accepted inValidator.extend
, you should uselocalize
API from now on.
2.0.0-rc.25
🐛 Bugs Fixed
- Fixed unique Id rotation cap.
2.0.0-rc.24
🐛 Bugs Fixed
- Fixed delay not being handled properly when passed as a
number
value #997
✨ Enhancements
- Random ids are now more deterministic/predictable check the
src/utils/core/index.js#uniqId
implementation.
2.0.0.rc-23
🐛 Bugs Fixed
- Fixed directive hook error #989
2.0.0-rc.22
🐛 Bugs Fixed
- Fixed an issue with programatic use of
url
andip
rules would trigger a console warning #966 - Fixed an issue with scoped fields' flags being placed the root level instead of nesting them under
$scopeName
prefix #949
✨ Enhancements
- The
pending
flag is now set to true before the validation kicks in, meaning in debounced/delayed validation thepending
flag will betrue
before the delay amount has passed. #985 - Errors are now being added after validation instead of during, which should reduce flickering behavior when long running validations are pending.
- Deprecate the title attribute being used as a fallback for the field alias, the title attribute has a wide array of use cases and shouldn't be used by
vee-validate
. #983 - Delays can now be configured per event thanks to @sebastianbarfurth for PR #954
Vue.use(VeeValidate, {
delay: {
blur: 1000,
input: 2000,
},
events: 'input|blur|focus',
});
// Now blur event will have a 1sec debounce, input event 2sec debounce, and focus will have 0sec since it is not specified.
mapFields
Now offers additional mapping utilities:
export default {
// ...
computed: {
all: mapFields(), // Maps all fields within the validator instance.
...mapFields({
scopeless: '*', // map fields without a scope
myScope: 'scope.*', // map all fields within a scope
myField: 'field', // map a single field
scopedField: 'scope.field' // map a scoped field
})
}
// ...
};
This additions should make it easier to manage form states, without having to build computed properties manually, the flags are merged based on their meanings:
- touched: true if one field is touched.
- untouched: true if all fields are untouched.
- dirty: true if one field is dirty.
- pristine: true if all fields are pristine.
- invalid: true if one field is invalid.
- valid: true if all fields are valid.
- pending: true if one field is pending validation.
- validated: true if all fields have been validated at least once