From d7cabcb70a84e81de17d298693d20e713db1941d Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Mon, 25 Jul 2016 16:45:19 +0900 Subject: [PATCH] :sparkles: release(patch): v2.1.5 --- CHANGELOG.md | 10 ++++++++++ dist/vue-validator.common.js | 5 +++-- dist/vue-validator.js | 5 +++-- dist/vue-validator.min.js | 6 +++--- docs/en/installation.md | 2 +- docs/ja/installation.md | 2 +- docs/zh-cn/installation.md | 2 +- package.json | 2 +- src/index.js | 2 +- 9 files changed, 24 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34aefd5..621d037 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [2.1.5](https://github.com/vuejs/vue-validator/compare/v2.1.4...v2.1.5) (2016-07-25) + + +### :bug: Bug Fixes + +* **validate:** fix cannot change validation rule and error message ([7013c4e](https://github.com/vuejs/vue-validator/commit/7013c4e)) + + + ## [2.1.4](https://github.com/vuejs/vue-validator/compare/v2.1.3...v2.1.4) (2016-07-19) diff --git a/dist/vue-validator.common.js b/dist/vue-validator.common.js index 7853d77..cc3123d 100644 --- a/dist/vue-validator.common.js +++ b/dist/vue-validator.common.js @@ -1,5 +1,5 @@ /*! - * vue-validator v2.1.4 + * vue-validator v2.1.5 * (c) 2016 kazuya kawaguchi * Released under the MIT License. */ @@ -541,6 +541,7 @@ function Validate (Vue) { */ Vue.directive('validate', { + deep: true, terminal: true, priority: vIf.priority + PRIORITY_VALIDATE, params: ['group', 'field', 'detect-blur', 'detect-change', 'initial', 'classes'], @@ -2603,7 +2604,7 @@ function plugin(Vue) { Validate(Vue); } -plugin.version = '2.1.4'; +plugin.version = '2.1.5'; if (typeof window !== 'undefined' && window.Vue) { window.Vue.use(plugin); diff --git a/dist/vue-validator.js b/dist/vue-validator.js index f7bac9c..7400a56 100644 --- a/dist/vue-validator.js +++ b/dist/vue-validator.js @@ -1,5 +1,5 @@ /*! - * vue-validator v2.1.4 + * vue-validator v2.1.5 * (c) 2016 kazuya kawaguchi * Released under the MIT License. */ @@ -545,6 +545,7 @@ var validators = Object.freeze({ */ Vue.directive('validate', { + deep: true, terminal: true, priority: vIf.priority + PRIORITY_VALIDATE, params: ['group', 'field', 'detect-blur', 'detect-change', 'initial', 'classes'], @@ -2607,7 +2608,7 @@ var validators = Object.freeze({ Validate(Vue); } - plugin.version = '2.1.4'; + plugin.version = '2.1.5'; if (typeof window !== 'undefined' && window.Vue) { window.Vue.use(plugin); diff --git a/dist/vue-validator.min.js b/dist/vue-validator.min.js index 507758b..765723f 100644 --- a/dist/vue-validator.min.js +++ b/dist/vue-validator.min.js @@ -1,7 +1,7 @@ /*! - * vue-validator v2.1.4 + * vue-validator v2.1.5 * (c) 2016 kazuya kawaguchi * Released under the MIT License. */ -!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.VueValidator=i()}(this,function(){"use strict";function t(t,i){window.console&&(console.warn("[vue-validator] "+t),i&&console.warn(i.stack))}function i(t){if(null===t||void 0===t)return!0;if(Array.isArray(t)){if(t.length>0)return!1;if(0===t.length)return!0}else if(C.Vue.util.isPlainObject(t))for(var i in t)if(C.Vue.util.hasOwn(t,i))return!1;return!0}function e(t,i,e){if(Array.isArray(t))for(var n=0;n0:null!==t&&"object"===("undefined"==typeof t?"undefined":w.typeof(t))?Object.keys(t).length>0:null!==t&&void 0!==t&&void 0)}function l(t,i){if("string"!=typeof i)return!1;var e=i.match(new RegExp("^/(.*?)/([gimy]*)$"));return!!e&&new RegExp(e[1],e[2]).test(t)}function d(t,i){return"string"==typeof t?f(i,10)&&t.length>=parseInt(i,10):!!Array.isArray(t)&&t.length>=parseInt(i,10)}function u(t,i){return"string"==typeof t?f(i,10)&&t.length<=parseInt(i,10):!!Array.isArray(t)&&t.length<=parseInt(i,10)}function h(t,i){return!isNaN(+t)&&!isNaN(+i)&&+t>=+i}function c(t,i){return!isNaN(+t)&&!isNaN(+i)&&+t<=+i}function f(t){return/^(-?[1-9]\d*|0)$/.test(t)}function p(t){var i=t.util.extend,e=Object.create(null);i(e,k),t.options.validators=e;var n=t.config.optionMergeStrategies;n&&(n.validators=function(t,e){if(!e)return t;if(!t)return e;var n=Object.create(null);i(n,t);for(var a in e)n[a]=e[a];return n}),t.validator=function(i,e){return e?void(t.options.validators[i]=e):t.options.validators[i]}}function v(t){var i=t.prototype._init;t.prototype._init=function(t){this._validatorMaps||(this._validatorMaps=Object.create(null)),i.call(this,t)};var e=t.prototype._destroy;t.prototype._destroy=function(){e.apply(this,arguments),this._validatorMaps=null}}function _(t){var i=t.directive("if"),e=t.FragmentFactory,n=t.util,a=n.toArray,o=n.replace,r=n.createAnchor;t.directive("validate-class",{terminal:!0,priority:i.priority+F,bind:function(){var t=this,i=String(I++);this.setClassIds(this.el,i),this.vm.$on(E,this.cb=function(e,n,a){e.indexOf(i)>-1&&n.updateClasses(a,t.frag.node)}),this.setupFragment()},unbind:function(){this.vm.$off(E,this.cb),this.teardownFragment()},setClassIds:function(t,i){for(var e=a(t.childNodes),n=0,o=e.length;n',partials:{}};return i.partials["validator-error-default"]="

{{field}}: {{message}}

",i}function V(t){var i=t.util,e=y(t),n={name:"validator-errors",props:{validation:{type:Object,required:!0},group:{type:String,default:null},field:{type:String,default:null},component:{type:String,default:"validator-error"}},computed:{errors:function(){var t=this;if(null!==this.group)return this.validation[this.group].errors;if(null!==this.field){var e=this.validation[this.field];if(!e.errors)return;return e.errors.map(function(e){var n={field:t.field};return i.isPlainObject(e)?(e.validator&&(n.validator=e.validator),n.message=e.message):"string"==typeof e&&(n.message=e),n})}return this.validation.errors}},template:'',components:{}};return n.props.partial=e.props.partial,n.components[e.name]=e,t.component(n.name,n),n}function b(i){arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return b.installed?void t("already installed."):(C.Vue=i,p(i),V(i),v(i),m(i),_(i),void g(i))}var w={};w.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},w.classCallCheck=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},w.createClass=function(){function t(t,i){for(var e=0;e=a&&i()})})},t.prototype._invokeValidator=function(t,i,e,n,a){var r=i.call(this,e,n);"function"==typeof r?r(function(){a(!0)},function(t){a(!1,t)}):o(r)?r.then(function(){a(!0)},function(t){a(!1,t)}).catch(function(t){a(!1,t.message)}):a(r)},t.prototype._resolveValidator=function(t){var i=C.Vue.util.resolveAsset;return i(this._vm.$options,"validators",t)},w.createClass(t,[{key:"vm",get:function(){return this._vm}},{key:"el",get:function(){return this._el}},{key:"detectChange",get:function(){return this._detectChange},set:function(t){this._detectChange=t}},{key:"detectBlur",get:function(){return this._detectBlur},set:function(t){this._detectBlur=t}}]),t}(),$=function(t){function i(e,n,a,o,r,s,l,d,u){w.classCallCheck(this,i);var h=w.possibleConstructorReturn(this,t.call(this,e,n,a,o,r,s,l,d,u));return h._inits=[],h}return w.inherits(i,t),i.prototype.manageElement=function(t,i){var e=this,n=this._getScope(),a=this._addItem(t,i),o=a.model=this._model;if(o){var r=this._evalModel(o,this._filters);Array.isArray(r)?(this._setChecked(r,a.el),a.unwatch=n.$watch(o,function(t,i){if(t!==i){if(e.guardValidate(a.el,"change"))return;e.handleValidate(a.el,{noopable:a.initial}),a.initial&&(a.initial=null)}})):(t.checked=r||!1,this._init=t.checked,a.init=t.checked,a.value=t.value,a.unwatch=n.$watch(o,function(i,n){if(i!==n){if(e.guardValidate(t,"change"))return;e.handleValidate(t,{noopable:a.initial}),a.initial&&(a.initial=null)}}))}else{var s={field:this.field,noopable:i};this._checkClassIds(t)&&(s.el=t),this._validator.validate(s)}},i.prototype.unmanageElement=function(t){var i=-1;e(this._inits,function(e,n){e.el===t&&(i=n,e.unwatch&&e.model&&(e.unwatch(),e.unwatch=null,e.model=null))}),i!==-1&&(this._inits.splice(i,1),this._validator.validate({field:this.field}))},i.prototype.willUpdateFlags=function(){var t=this,i=!(arguments.length<=0||void 0===arguments[0])&&arguments[0];e(this._inits,function(e,n){i&&t.willUpdateTouched(e.el,"blur"),t.willUpdateDirty(e.el),t.willUpdateModified(e.el)})},i.prototype.reset=function(){this.resetFlags(),e(this._inits,function(t,i){t.init=t.el.checked,t.value=t.el.value})},i.prototype.updateClasses=function(t){var i=this,n=arguments.length<=1||void 0===arguments[1]?null:arguments[1];n?this._updateClasses(n,t):e(this._inits,function(e,n){i._updateClasses(e.el,t)})},i.prototype._addItem=function(t,i){var e={el:t,init:t.checked,value:t.value,initial:i},n=t.getAttribute(E);return n&&(t.removeAttribute(E),e.classIds=n.split(",")),this._inits.push(e),e},i.prototype._setChecked=function(t,i){for(var e=0,n=t.length;e1?i-1:0),n=1;n=n&&i()})})},t.prototype._walkValidations=function(t,i,n){var a=this,o=C.Vue.util.hasOwn,r=n;return e(t,function(t,e){if(r!==!n&&o(a._scope,t.field)){var s=a._scope[t.field];s&&s[i]===!n&&(r=!n)}}),r},t.prototype._defineValid=function(t){return this._walkValidations(t(),"valid",!0)},t.prototype._defineInvalid=function(t){return!t().valid},t.prototype._defineTouched=function(t){return this._walkValidations(t(),"touched",!1)},t.prototype._defineUntouched=function(t){return!t().touched},t.prototype._defineModified=function(t){return this._walkValidations(t(),"modified",!1)},t.prototype._defineDirty=function(t){return this._walkValidations(t(),"dirty",!1)},t.prototype._definePristine=function(t){return!t().dirty},t.prototype._defineErrors=function(t){var n=this,a=C.Vue.util.hasOwn,o=C.Vue.util.isPlainObject,r=[];return e(t(),function(t,s){if(a(n._scope,t.field)){var l=n._scope[t.field];l&&!i(l.errors)&&e(l.errors,function(i,e){var n={field:t.field};o(i)?(i.validator&&(n.validator=i.validator),n.message=i.message):"string"==typeof i&&(n.message=i),r.push(n)})}}),i(r)?void 0:r.sort(function(t,i){return t.field0)return!1;if(0===t.length)return!0}else if(C.Vue.util.isPlainObject(t))for(var i in t)if(C.Vue.util.hasOwn(t,i))return!1;return!0}function e(t,i,e){if(Array.isArray(t))for(var n=0;n0:null!==t&&"object"===("undefined"==typeof t?"undefined":w.typeof(t))?Object.keys(t).length>0:null!==t&&void 0!==t&&void 0)}function l(t,i){if("string"!=typeof i)return!1;var e=i.match(new RegExp("^/(.*?)/([gimy]*)$"));return!!e&&new RegExp(e[1],e[2]).test(t)}function d(t,i){return"string"==typeof t?f(i,10)&&t.length>=parseInt(i,10):!!Array.isArray(t)&&t.length>=parseInt(i,10)}function u(t,i){return"string"==typeof t?f(i,10)&&t.length<=parseInt(i,10):!!Array.isArray(t)&&t.length<=parseInt(i,10)}function h(t,i){return!isNaN(+t)&&!isNaN(+i)&&+t>=+i}function c(t,i){return!isNaN(+t)&&!isNaN(+i)&&+t<=+i}function f(t){return/^(-?[1-9]\d*|0)$/.test(t)}function p(t){var i=t.util.extend,e=Object.create(null);i(e,k),t.options.validators=e;var n=t.config.optionMergeStrategies;n&&(n.validators=function(t,e){if(!e)return t;if(!t)return e;var n=Object.create(null);i(n,t);for(var a in e)n[a]=e[a];return n}),t.validator=function(i,e){return e?void(t.options.validators[i]=e):t.options.validators[i]}}function v(t){var i=t.prototype._init;t.prototype._init=function(t){this._validatorMaps||(this._validatorMaps=Object.create(null)),i.call(this,t)};var e=t.prototype._destroy;t.prototype._destroy=function(){e.apply(this,arguments),this._validatorMaps=null}}function _(t){var i=t.directive("if"),e=t.FragmentFactory,n=t.util,a=n.toArray,o=n.replace,r=n.createAnchor;t.directive("validate-class",{terminal:!0,priority:i.priority+F,bind:function(){var t=this,i=String(I++);this.setClassIds(this.el,i),this.vm.$on(E,this.cb=function(e,n,a){e.indexOf(i)>-1&&n.updateClasses(a,t.frag.node)}),this.setupFragment()},unbind:function(){this.vm.$off(E,this.cb),this.teardownFragment()},setClassIds:function(t,i){for(var e=a(t.childNodes),n=0,o=e.length;n',partials:{}};return i.partials["validator-error-default"]="

{{field}}: {{message}}

",i}function V(t){var i=t.util,e=y(t),n={name:"validator-errors",props:{validation:{type:Object,required:!0},group:{type:String,default:null},field:{type:String,default:null},component:{type:String,default:"validator-error"}},computed:{errors:function(){var t=this;if(null!==this.group)return this.validation[this.group].errors;if(null!==this.field){var e=this.validation[this.field];if(!e.errors)return;return e.errors.map(function(e){var n={field:t.field};return i.isPlainObject(e)?(e.validator&&(n.validator=e.validator),n.message=e.message):"string"==typeof e&&(n.message=e),n})}return this.validation.errors}},template:'',components:{}};return n.props.partial=e.props.partial,n.components[e.name]=e,t.component(n.name,n),n}function b(i){arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return b.installed?void t("already installed."):(C.Vue=i,p(i),V(i),v(i),m(i),_(i),void g(i))}var w={};w.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},w.classCallCheck=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},w.createClass=function(){function t(t,i){for(var e=0;e=a&&i()})})},t.prototype._invokeValidator=function(t,i,e,n,a){var r=i.call(this,e,n);"function"==typeof r?r(function(){a(!0)},function(t){a(!1,t)}):o(r)?r.then(function(){a(!0)},function(t){a(!1,t)}).catch(function(t){a(!1,t.message)}):a(r)},t.prototype._resolveValidator=function(t){var i=C.Vue.util.resolveAsset;return i(this._vm.$options,"validators",t)},w.createClass(t,[{key:"vm",get:function(){return this._vm}},{key:"el",get:function(){return this._el}},{key:"detectChange",get:function(){return this._detectChange},set:function(t){this._detectChange=t}},{key:"detectBlur",get:function(){return this._detectBlur},set:function(t){this._detectBlur=t}}]),t}(),$=function(t){function i(e,n,a,o,r,s,l,d,u){w.classCallCheck(this,i);var h=w.possibleConstructorReturn(this,t.call(this,e,n,a,o,r,s,l,d,u));return h._inits=[],h}return w.inherits(i,t),i.prototype.manageElement=function(t,i){var e=this,n=this._getScope(),a=this._addItem(t,i),o=a.model=this._model;if(o){var r=this._evalModel(o,this._filters);Array.isArray(r)?(this._setChecked(r,a.el),a.unwatch=n.$watch(o,function(t,i){if(t!==i){if(e.guardValidate(a.el,"change"))return;e.handleValidate(a.el,{noopable:a.initial}),a.initial&&(a.initial=null)}})):(t.checked=r||!1,this._init=t.checked,a.init=t.checked,a.value=t.value,a.unwatch=n.$watch(o,function(i,n){if(i!==n){if(e.guardValidate(t,"change"))return;e.handleValidate(t,{noopable:a.initial}),a.initial&&(a.initial=null)}}))}else{var s={field:this.field,noopable:i};this._checkClassIds(t)&&(s.el=t),this._validator.validate(s)}},i.prototype.unmanageElement=function(t){var i=-1;e(this._inits,function(e,n){e.el===t&&(i=n,e.unwatch&&e.model&&(e.unwatch(),e.unwatch=null,e.model=null))}),i!==-1&&(this._inits.splice(i,1),this._validator.validate({field:this.field}))},i.prototype.willUpdateFlags=function(){var t=this,i=!(arguments.length<=0||void 0===arguments[0])&&arguments[0];e(this._inits,function(e,n){i&&t.willUpdateTouched(e.el,"blur"),t.willUpdateDirty(e.el),t.willUpdateModified(e.el)})},i.prototype.reset=function(){this.resetFlags(),e(this._inits,function(t,i){t.init=t.el.checked,t.value=t.el.value})},i.prototype.updateClasses=function(t){var i=this,n=arguments.length<=1||void 0===arguments[1]?null:arguments[1];n?this._updateClasses(n,t):e(this._inits,function(e,n){i._updateClasses(e.el,t)})},i.prototype._addItem=function(t,i){var e={el:t,init:t.checked,value:t.value,initial:i},n=t.getAttribute(E);return n&&(t.removeAttribute(E),e.classIds=n.split(",")),this._inits.push(e),e},i.prototype._setChecked=function(t,i){for(var e=0,n=t.length;e1?i-1:0),n=1;n=n&&i()})})},t.prototype._walkValidations=function(t,i,n){var a=this,o=C.Vue.util.hasOwn,r=n;return e(t,function(t,e){if(r!==!n&&o(a._scope,t.field)){var s=a._scope[t.field];s&&s[i]===!n&&(r=!n)}}),r},t.prototype._defineValid=function(t){return this._walkValidations(t(),"valid",!0)},t.prototype._defineInvalid=function(t){return!t().valid},t.prototype._defineTouched=function(t){return this._walkValidations(t(),"touched",!1)},t.prototype._defineUntouched=function(t){return!t().touched},t.prototype._defineModified=function(t){return this._walkValidations(t(),"modified",!1)},t.prototype._defineDirty=function(t){return this._walkValidations(t(),"dirty",!1)},t.prototype._definePristine=function(t){return!t().dirty},t.prototype._defineErrors=function(t){var n=this,a=C.Vue.util.hasOwn,o=C.Vue.util.isPlainObject,r=[];return e(t(),function(t,s){if(a(n._scope,t.field)){var l=n._scope[t.field];l&&!i(l.errors)&&e(l.errors,function(i,e){var n={field:t.field};o(i)?(i.validator&&(n.validator=i.validator),n.message=i.message):"string"==typeof i&&(n.message=i),r.push(n)})}}),i(r)?void 0:r.sort(function(t,i){return t.field + ``` ## NPM diff --git a/docs/ja/installation.md b/docs/ja/installation.md index 82f5672..e0b3301 100644 --- a/docs/ja/installation.md +++ b/docs/ja/installation.md @@ -9,7 +9,7 @@ ### jsdelivr ```html - + ``` ## NPM diff --git a/docs/zh-cn/installation.md b/docs/zh-cn/installation.md index 6f24ec3..28fc1e7 100644 --- a/docs/zh-cn/installation.md +++ b/docs/zh-cn/installation.md @@ -9,7 +9,7 @@ ### jsdelivr ```html - + ``` ## NPM diff --git a/package.json b/package.json index 56db9d1..224b155 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vue-validator", "description": "Validator component for Vue.js", - "version": "2.1.4", + "version": "2.1.5", "author": { "name": "kazuya kawaguchi", "email": "kawakazu80@gmail.com" diff --git a/src/index.js b/src/index.js index 8309a2c..1d4ab3c 100644 --- a/src/index.js +++ b/src/index.js @@ -30,7 +30,7 @@ function plugin (Vue, options = {}) { Validate(Vue) } -plugin.version = '2.1.4' +plugin.version = '2.1.5' export default plugin