Skip to content
This repository has been archived by the owner on Dec 25, 2017. It is now read-only.

Commit

Permalink
✨ release(patch): v2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed May 21, 2016
1 parent b1add7d commit cceabb8
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 107 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
<a name="2.1.2"></a>
## [2.1.2](https://github.com/vuejs/vue-validator/compare/v2.1.1...v2.1.2) (2016-05-21)


### :bug: Bug Fixes

* **cleanup:** fix cannot get validation result ([33c71d1](https://github.com/vuejs/vue-validator/commit/33c71d1))
* **errors:** fix cannot apply validation classes ([af91d57](https://github.com/vuejs/vue-validator/commit/af91d57)), closes [#239](https://github.com/vuejs/vue-validator/issues/239)
* **event:** fix cannot fire top level events ([b91d36a](https://github.com/vuejs/vue-validator/commit/b91d36a)), closes [#233](https://github.com/vuejs/vue-validator/issues/233)
* **group:** fix group validation for radio ([1fbfc53](https://github.com/vuejs/vue-validator/commit/1fbfc53)), closes [#234](https://github.com/vuejs/vue-validator/issues/234)


### :zap: Improvements

* **async:** update async validator for function I/F ([974cf61](https://github.com/vuejs/vue-validator/commit/974cf61))
* **errors:** error messages order ([b1add7d](https://github.com/vuejs/vue-validator/commit/b1add7d)), closes [#240](https://github.com/vuejs/vue-validator/issues/240)
* **warning:** changed warning for when the elements under validation are not wrapped in a <validator> element. ([#224](https://github.com/vuejs/vue-validator/issues/224)) by [@SERVANT14](https://github.com/SERVANT14) ([ec1f223](https://github.com/vuejs/vue-validator/commit/ec1f223))


### NOTE

* cleanup: warning: not fixes validation result outside available yet


<a name="2.1.1"></a>
## [2.1.1](https://github.com/vuejs/vue-validator/compare/v2.1.0...v2.1.1) (2016-05-02)

Expand Down
100 changes: 50 additions & 50 deletions dist/vue-validator.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-validator v2.1.1
* vue-validator v2.1.2
* (c) 2016 kazuya kawaguchi
* Released under the MIT License.
*/
Expand Down Expand Up @@ -567,7 +567,7 @@ function Validate (Vue) {
var el = this.el;

if (process.env.NODE_ENV !== 'production' && el.__vue__) {
warn('v-validate="' + this.expression + '" cannot be ' + 'used on an instance root element.');
warn('v-validate="' + this.expression + '" cannot be used on an instance root element.');
this._invalid = true;
return;
}
Expand Down Expand Up @@ -1245,28 +1245,13 @@ var BaseValidation = function () {
var future = validator.call(this, val, arg);
if (typeof future === 'function') {
// function
if (future.resolved) {
// cached
cb(future.resolved);
} else if (future.requested) {
// pool callbacks
future.pendingCallbacks.push(cb);
} else {
(function () {
future.requested = true;
var cbs = future.pendingCallbacks = [cb];
future(function () {
// resolve
future.resolved = true;
for (var i = 0, l = cbs.length; i < l; i++) {
cbs[i](true);
}
}, function (msg) {
// reject
cb(false, msg);
});
})();
}
future(function () {
// resolve
cb(true);
}, function (msg) {
// reject
cb(false, msg);
});
} else if (isPromise(future)) {
// promise
future.then(function () {
Expand Down Expand Up @@ -1845,20 +1830,31 @@ var Validator$1 = function () {

Validator.prototype.disableReactive = function disableReactive() {
var vm = this._dir.vm;
vm.$setValidationErrors = undefined;
vm.$validate = undefined;
vm.$validatorReset = undefined;
vm.$setValidationErrors = null;
delete vm['$setValidationErrors'];
vm.$validate = null;
delete vm['$validate'];
vm.$validatorReset = null;
delete vm['$validatorReset'];
vm._validatorMaps[this.name] = null;
delete vm._validatorMaps[this.name];
vm[this.name] = null;
delete vm[this.name];
};

Validator.prototype.registerEvents = function registerEvents() {
var isSimplePath = exports$1.Vue.parsers.expression.isSimplePath;

var attrs = this._dir.el.attributes;
for (var i = 0, l = attrs.length; i < l; i++) {
var event = attrs[i].name;
if (REGEX_EVENT.test(event)) {
var value = attrs[i].value;
if (isSimplePath(value)) {
value += '.apply(this, $arguments)';
}
event = event.replace(REGEX_EVENT, '');
this._events[this._getEventName(event)] = this._dir.vm.$eval(attrs[i].value, true);
this._events[this._getEventName(event)] = this._dir.vm.$eval(value, true);
}
}
};
Expand Down Expand Up @@ -1905,14 +1901,14 @@ var Validator$1 = function () {
Validator.prototype.addGroupValidation = function addGroupValidation(group, field) {
var indexOf = exports$1.Vue.util.indexOf;

var validation = this._validations[field] || this._checkboxValidations[field].validation || this._radioValidations[field].validation;
var validation = this._getValidationFrom(field);
var validations = this._groupValidations[group];

validations && ! ~indexOf(validations, validation) && validations.push(validation);
};

Validator.prototype.removeGroupValidation = function removeGroupValidation(group, field) {
var validation = this._validations[field] || this._checkboxValidations[field].validation || this._radioValidations[field].validation;
var validation = this._getValidationFrom(field);
var validations = this._groupValidations[group];

validations && pull(validations, validation);
Expand Down Expand Up @@ -2057,13 +2053,7 @@ var Validator$1 = function () {
};

Validator.prototype._getValidationFrom = function _getValidationFrom(field) {
var validation = this._validations[field];
if (!validation && this._checkboxValidations[field]) {
validation = this._checkboxValidations[field].validation;
} else if (!validation && this._radioValidations[field]) {
validation = this._radioValidations[field].validation;
}
return validation;
return this._validations[field] || this._checkboxValidations[field] && this._checkboxValidations[field].validation || this._radioValidations[field] && this._radioValidations[field].validation;
};

Validator.prototype._resetValidation = function _resetValidation(cb) {
Expand All @@ -2079,6 +2069,7 @@ var Validator$1 = function () {
var extend = exports$1.Vue.util.extend;

// make tempolaly errors

var temp = {};
each(errors, function (error, index) {
if (!temp[error.field]) {
Expand All @@ -2089,18 +2080,24 @@ var Validator$1 = function () {

// set errors
each(temp, function (values, field) {
var validation = _this9._scope[field];
var newValidation = {};
var results = _this9._scope[field];
var newResults = {};

each(values, function (error) {
if (error.validator) {
validation[error.validator] = error.message;
results[error.validator] = error.message;
}
});
validation.valid = false;
validation.invalid = true;
validation.errors = values;
extend(newValidation, validation);
exports$1.Vue.set(_this9._scope, field, newValidation);

results.valid = false;
results.invalid = true;
results.errors = values;
extend(newResults, results);

var validation = _this9._getValidationFrom(field);
validation.willUpdateClasses(newResults, validation.el);

exports$1.Vue.set(_this9._scope, field, newResults);
});
};

Expand Down Expand Up @@ -2189,13 +2186,14 @@ var Validator$1 = function () {
};

Validator.prototype._fireEvent = function _fireEvent(type) {
var handler = this._events[this._getEventName(type)];

for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}

handler && handler.apply(null, args);
var handler = this._events[this._getEventName(type)];
handler && this._dir.vm.$nextTick(function () {
handler.apply(null, args);
});
};

Validator.prototype._fireEvents = function _fireEvents() {
Expand Down Expand Up @@ -2330,7 +2328,9 @@ var Validator$1 = function () {
}
});

return empty(errors) ? undefined : errors;
return empty(errors) ? undefined : errors.sort(function (a, b) {
return a.field < b.field ? -1 : 1;
});
};

babelHelpers.createClass(Validator, [{
Expand Down Expand Up @@ -2587,7 +2587,7 @@ function plugin(Vue) {
Validate(Vue);
}

plugin.version = '2.1.1';
plugin.version = '2.1.2';

if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(plugin);
Expand Down
Loading

0 comments on commit cceabb8

Please sign in to comment.