From 2f26fd0b97511ba3b7b5656ef382c08a1983e6f5 Mon Sep 17 00:00:00 2001 From: francesco Date: Mon, 20 Jun 2016 10:34:12 +0200 Subject: [PATCH] corrected some bugs RTM --- bower.json | 4 ++-- jquery.validate.unobtrusive.extensions.min.js | 2 +- jquery.validate.unobtrusive.globalize.js | 2 +- jquery.validate.unobtrusive.globalize.min.js | 2 +- package.json | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bower.json b/bower.json index 2c5b390..61448ba 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "jquery-validation-unobtrusive-extensions", - "version": "1.0.0-rc3", + "version": "1.0.0", "homepage": "https://github.com/MvcControlsToolkit/Unobtrusive.Extensions", "description": "Add-on to jQuery Unobtrusive Validation to enable globalization and dynamic content parsing", "main": [ @@ -35,6 +35,6 @@ "dependencies": { "jquery-validation-unobtrusive": ">=3.2.4", "jquery": ">=1.8", - "mvcct-enhancer": ">=1.0.0-rc3" + "mvcct-enhancer": ">=1.0.0" } } \ No newline at end of file diff --git a/jquery.validate.unobtrusive.extensions.min.js b/jquery.validate.unobtrusive.extensions.min.js index 301e52f..144f268 100644 --- a/jquery.validate.unobtrusive.extensions.min.js +++ b/jquery.validate.unobtrusive.extensions.min.js @@ -1 +1 @@ -!function(n){function e(e){var a=n(e).first().closest("form");if(0!=a.length){var u=a[0];u._mvcct_form_expando_||(u._mvcct_form_expando_=!0,t.push(a),1==t.length&&setTimeout(function(){for(;t.length;){var n=t.pop();n[0]._mvcct_form_expando_=!1,r(n),n.removeData("unobtrusiveValidation")}}))}}function r(e){var r=e.data("unobtrusiveValidation");if(r){var t=e.validate();n.each(r.options.rules,function(e,a){if(void 0==t.settings.rules[e]){var u={};n.extend(u,a),u.messages=r.options.messages[e],n('[name= "'+e+'"]').rules("add",u)}else n.each(a,function(a,u){if(void 0==t.settings.rules[e][a]){var l={};l[a]=u,l.messages=r.options.messages[e][a],n('[name= "'+e+'"]').rules("add",l)}})})}}var t=[];n.validator.unobtrusive.parseDynamic=function(r){n.validator.unobtrusive.parse(r),e(r)},n.validator.unobtrusive.parseElementDynamic=function(r){n.validator.unobtrusive.parseElement(r,!0),e(r)};var a=window.mvcct||{},u=a.enhancer;u&&u.register(function(e,r){r?n.validator.unobtrusive.parse(document):n.validator.unobtrusive.parseDynamic(e)},!0,null,"unobtrusive validation")}(jQuery),function(n){function e(n){return parseInt(n.attr("data-val-correcttype-type"))+(n.attr("data-is-range")||"range"==n.attr("type")?10:0)}function r(e,t){var a=e.name,u=null,l=a.lastIndexOf(".");if(0>l?u=t:r=a.substring(0,l+1)+t,!r)return null;var i=n("[name='"+u+"']");return i.length>0?i[0]:null}function t(n,e){if(!e)return[];e=e.split(" ");for(var t=[],a=0;a=u?l.setDate(a.getDate()-a.getDay()+1):l.setDate(a.getDate()+8-a.getDay()),l}function u(n){if(!x){var e=f.Globalize();s||(s=o.enhancer.getSupport().Html5InputSupport);var r=e.locale().attributes.language,t=e.cldr.get("main/"+r).numbers["symbols-numberSystem-latn"];m=s.number>2?new RegExp("^[+-.0-9]*$"):new RegExp("^[\\"+t.plusSign+"\\"+t.minusSign+"\\"+t.decimal+"0-9]*$"),c=s.range>2?new RegExp("^[+-.0-9]*$"):new RegExp("^[\\"+t.plusSign+"\\"+t.minusSign+"\\"+t.decimal+"0-9]*$"),v=e.dateParser({raw:"HH:mm:ss"}),d=e.dateParser({raw:"yyyy-MM-ddTHH:mm:ss"}),p=e.dateParser({raw:"yyyy-MM"}),g=s.week>2?function(n){return n}:a,y=s.week>2?function(n){return n}:function(n){return f.parse("week",n)},weekFormatter=s.week>2?function(n){return n}:function(n){return f.format("week",n)},w=function(n,e){return n?e?n+parseFloat(e):n:null},h=function(n,e){return n?e?new Date(n.getTime()+parseInt(e)):n:null};var u=document.createElement("INPUT");u.setAttribute("type","week"),b=s.week>2?function(n,e){if(!n)return null;if(!e)return n;var r=parseInt(e)/6048e5;return 0==r?n:(u.value=n,r>0?u.stepUp(r):u.stepDown(-r),u.value)}:h,E[0]=function(n){return n},k[0]=E[0],_[0]=function(n){return n},I[0]=E[0],E[1]=E[2]=E[3]=function(n){return f.parse("number",n)},k[1]=k[2]=k[3]=D,_[1]=_[2]=_[3]=w,I[1]=I[2]=I[3]=function(n){return f.format("number",n)},E[11]=E[12]=E[13]=function(n){return f.parse("range",n)},k[11]=k[12]=k[13]=D,_[11]=_[12]=_[13]=w,I[11]=I[12]=I[13]=function(n){return f.format("range",n)},E[4]=function(n){return f.parse("time",n)},k[4]=v,I[4]=function(n){return f.format("time",n)},E[5]=function(n){return f.parse("date",n)},k[5]=d,I[5]=function(n){return f.format("date",n)},E[6]=function(n){return f.parse("datetime",n)},k[6]=d,_[4]=_[5]=_[6]=h,I[6]=function(n){return f.format("datetime",n)},E[7]=y,k[7]=g,_[7]=b,I[7]=weekFormatter,E[8]=function(n){return f.parse("month",n)},k[8]=p,_[8]=h,I[8]=function(n){return f.format("month",n)},x=!0}}function l(n,e,r){n.rules[e]=r,n.message&&(n.messages[e]=n.message)}function i(e,r,t){if(r)for(var a=0;am&&n(t).val(I[l](c)),!0}return i(r)>=s(a[0])},n.validator.methods.maxE=function(r,t,a){f||u();var l=e(n(t));if(!r)return!0;var i=E[l],o=a[1];if(o&&n(t).is(":focus"))return!0;var s=k[l];if(o){var m=i(r),c=s(a[0]);return m>c&&n(t).val(I[l](c)),!0}return i(r)<=s(a[0])},n.validator.methods.rangeE=function(r,t,a){f||u();var l=e(n(t));if(!r)return!0;var i=E[l],o=a[2];if(o&&n(t).is(":focus"))return!0;var s=k[l];if(o){var m=i(r),c=s(a[0]);return c>m?n(t).val(I[l](c)):(c=s(a[1]),m>c&&n(t).val(I[l](c))),!0}return i(r)<=s(a[1])&&i(r)>=s(a[0])},n.validator.methods.correcttype=function(r,t,a){if(f||u(),!r)return!0;var l=e(n(t)),i=E[l],o=i(r);return(o||0===o)&&(!("number"==typeof o)||(10>l?m.test(r):c.test(r)))&&(1!=l&&2!=l&&11!=l&&12!=l||o%1===0)&&(1!=l&&11!=l||o>=0)},n.validator.methods.drange=function(r,t,a){if(f||u(),!r)return!0;var l=e(n(t)),i=a[0],o=a[1],s=a[2],m=a[3],c=a[4];if(c&&n(t).is(":focus"))return!0;for(var v,d,p,g,y,h=E[l],b=_[l],w=h(r),x=0;x=D||(v=D),D>w))){if(!c)return!1;p=!0,y=!0}}for(var x=0;x=d||(d=D),w>D))){if(!c)return!1;p=!0,g=!0}}if(c&&p){if(v>d)return!1;g?n(t).val(I[l](d)):y&&n(t).val(I[l](v))}return!0};var S=M.unobtrusive.adapters,R=0;for(R=0;Rl?u=t:r=a.substring(0,l+1)+t,!r)return null;var i=n("[name='"+u+"']");return i.length>0?i[0]:null}function t(n,e){if(!e)return[];e=e.split(" ");for(var t=[],a=0;a=u?l.setDate(a.getDate()-a.getDay()+1):l.setDate(a.getDate()+8-a.getDay()),l}function u(n){if(!x){var e=f.Globalize();s||(s=o.enhancer.getSupport().Html5InputSupport);var r=e.locale().attributes.language,t=e.cldr.get("main/"+r).numbers["symbols-numberSystem-latn"];m=s.number>2?new RegExp("^[+-.0-9]*$"):new RegExp("^[\\"+t.plusSign+"\\"+t.minusSign+"\\"+t.decimal+"0-9]*$"),c=s.range>2?new RegExp("^[+-.0-9]*$"):new RegExp("^[\\"+t.plusSign+"\\"+t.minusSign+"\\"+t.decimal+"0-9]*$"),v=e.dateParser({raw:"HH:mm:ss"}),d=e.dateParser({raw:"yyyy-MM-ddTHH:mm:ss"}),p=e.dateParser({raw:"yyyy-MM"}),g=s.week>2?function(n){return n}:a,y=s.week>2?function(n){return n}:function(n){return f.parse("week",n)},weekFormatter=s.week>2?function(n){return n}:function(n){return f.format("week",n)},w=function(n,e){return n?e?n+parseFloat(e):n:null},h=function(n,e){return n?e?new Date(n.getTime()+parseInt(e)):n:null};var u=document.createElement("INPUT");u.setAttribute("type","week"),b=s.week>2?function(n,e){if(!n)return null;if(!e)return n;var r=parseInt(e)/6048e5;return 0==r?n:(u.value=n,r>0?u.stepUp(r):u.stepDown(-r),u.value)}:h,E[0]=function(n){return n},k[0]=E[0],_[0]=function(n){return n},I[0]=E[0],E[1]=E[2]=E[3]=function(n){return f.parse("number",n)},k[1]=k[2]=k[3]=D,_[1]=_[2]=_[3]=w,I[1]=I[2]=I[3]=function(n){return f.format("number",n)},E[11]=E[12]=E[13]=function(n){return f.parse("range",n)},k[11]=k[12]=k[13]=D,_[11]=_[12]=_[13]=w,I[11]=I[12]=I[13]=function(n){return f.format("range",n)},E[4]=function(n){return f.parse("time",n)},k[4]=v,I[4]=function(n){return f.format("time",n)},E[5]=function(n){return f.parse("date",n)},k[5]=d,I[5]=function(n){return f.format("date",n)},E[6]=function(n){return f.parse("datetime",n)},k[6]=d,_[4]=_[5]=_[6]=h,I[6]=function(n){return f.format("datetime",n)},E[7]=y,k[7]=g,_[7]=b,I[7]=weekFormatter,E[8]=function(n){return f.parse("month",n)},k[8]=p,_[8]=h,I[8]=function(n){return f.format("month",n)},x=!0}}function l(n,e,r){n.rules[e]=r,n.message&&(n.messages[e]=n.message)}function i(e,r,t){if(r)for(var a=0;am&&n(t).val(I[l](c)),!0}return i(r)>=s(a[0])},n.validator.methods.maxE=function(r,t,a){f||u();var l=e(n(t));if(!r)return!0;var i=E[l],o=a[1];if(o&&n(t).is(":focus"))return!0;var s=k[l];if(o){var m=i(r),c=s(a[0]);return m>c&&n(t).val(I[l](c)),!0}return i(r)<=s(a[0])},n.validator.methods.rangeE=function(r,t,a){f||u();var l=e(n(t));if(!r)return!0;var i=E[l],o=a[2];if(o&&n(t).is(":focus"))return!0;var s=k[l];if(o){var m=i(r),c=s(a[0]);return c>m?n(t).val(I[l](c)):(c=s(a[1]),m>c&&n(t).val(I[l](c))),!0}return i(r)<=s(a[1])&&i(r)>=s(a[0])},n.validator.methods.correcttype=function(r,t,a){if(f||u(),!r)return!0;var l=e(n(t)),i=E[l],o=i(r);return(o||0===o)&&(!("number"==typeof o)||(10>l?m.test(r):c.test(r)))&&(1!=l&&2!=l&&11!=l&&12!=l||o%1===0)&&(1!=l&&11!=l||o>=0)},n.validator.methods.drange=function(r,t,a){if(f||u(),!r)return!0;var l=e(n(t)),i=a[0],o=a[1],s=a[2],m=a[3],c=a[4];if(c&&n(t).is(":focus"))return!0;for(var v,d,p,g,y,h=E[l],b=_[l],w=h(r),x=0;x=D||(v=D),D>w))){if(!c)return!1;p=!0,y=!0}}for(var x=0;x=d||(d=D),w>D))){if(!c)return!1;p=!0,g=!0}}if(c&&p){if(v>d)return!1;g?n(t).val(I[l](d)):y&&n(t).val(I[l](v))}return!0};var S=M.unobtrusive.adapters,R=0;for(R=0;Rl?u=t:e=a.substring(0,l+1)+t,!e)return null;var i=n("[name='"+u+"']");return i.length>0?i[0]:null}function t(n,r){if(!r)return[];r=r.split(" ");for(var t=[],a=0;a=u?l.setDate(a.getDate()-a.getDay()+1):l.setDate(a.getDate()+8-a.getDay()),l}function u(n){if(!x){var r=f.Globalize();s||(s=o.enhancer.getSupport().Html5InputSupport);var e=r.locale().attributes.language,t=r.cldr.get("main/"+e).numbers["symbols-numberSystem-latn"];m=s.number>2?new RegExp("^[+-.0-9]*$"):new RegExp("^[\\"+t.plusSign+"\\"+t.minusSign+"\\"+t.decimal+"0-9]*$"),c=s.range>2?new RegExp("^[+-.0-9]*$"):new RegExp("^[\\"+t.plusSign+"\\"+t.minusSign+"\\"+t.decimal+"0-9]*$"),d=r.dateParser({raw:"HH:mm:ss"}),p=r.dateParser({raw:"yyyy-MM-ddTHH:mm:ss"}),v=r.dateParser({raw:"yyyy-MM"}),g=s.week>2?function(n){return n}:a,y=s.week>2?function(n){return n}:function(n){return f.parse("week",n)},weekFormatter=s.week>2?function(n){return n}:function(n){return f.format("week",n)},b=function(n,r){return n?r?n+parseFloat(r):n:null},w=function(n,r){return n?r?new Date(n.getTime()+parseInt(r)):n:null};var u=document.createElement("INPUT");u.setAttribute("type","week"),h=s.week>2?function(n,r){if(!n)return null;if(!r)return n;var e=parseInt(r)/6048e5;return 0==e?n:(u.value=n,e>0?u.stepUp(e):u.stepDown(-e),u.value)}:w,k[0]=function(n){return n},E[0]=k[0],I[0]=function(n){return n},M[0]=k[0],k[1]=k[2]=k[3]=function(n){return f.parse("number",n)},E[1]=E[2]=E[3]=D,I[1]=I[2]=I[3]=b,M[1]=M[2]=M[3]=function(n){return f.format("number",n)},k[11]=k[12]=k[13]=function(n){return f.parse("range",n)},E[11]=E[12]=E[13]=D,I[11]=I[12]=I[13]=b,M[11]=M[12]=M[13]=function(n){return f.format("range",n)},k[4]=function(n){return f.parse("time",n)},E[4]=d,M[4]=function(n){return f.format("time",n)},k[5]=function(n){return f.parse("date",n)},E[5]=p,M[5]=function(n){return f.format("date",n)},k[6]=function(n){return f.parse("datetime",n)},E[6]=p,I[4]=I[5]=I[6]=w,M[6]=function(n){return f.format("datetime",n)},k[7]=y,E[7]=g,I[7]=h,M[7]=weekFormatter,k[8]=function(n){return f.parse("month",n)},E[8]=v,I[8]=w,M[8]=function(n){return f.format("month",n)},x=!0}}function l(n,r,e){n.rules[r]=e,n.message&&(n.messages[r]=n.message)}function i(r,e,t){if(e)for(var a=0;am&&n(t).val(M[l](c)),!0}return i(e)>=s(a[0])},n.validator.methods.maxE=function(e,t,a){f||u();var l=r(n(t));if(!e)return!0;var i=k[l],o=a[1];if(o&&n(t).is(":focus"))return!0;var s=E[l];if(o){var m=i(e),c=s(a[0]);return m>c&&n(t).val(M[l](c)),!0}return i(e)<=s(a[0])},n.validator.methods.rangeE=function(e,t,a){f||u();var l=r(n(t));if(!e)return!0;var i=k[l],o=a[2];if(o&&n(t).is(":focus"))return!0;var s=E[l];if(o){var m=i(e),c=s(a[0]);return c>m?n(t).val(M[l](c)):(c=s(a[1]),m>c&&n(t).val(M[l](c))),!0}return i(e)<=s(a[1])&&i(e)>=s(a[0])},n.validator.methods.correcttype=function(e,t,a){if(f||u(),!e)return!0;var l=r(n(t)),i=k[l],o=i(e);return(o||0===o)&&(!("number"==typeof o)||(10>l?m.test(e):c.test(e)))&&(1!=l&&2!=l&&11!=l&&12!=l||o%1===0)&&(1!=l&&11!=l||o>=0)},n.validator.methods.drange=function(e,t,a){if(f||u(),!e)return!0;var l=r(n(t)),i=a[0],o=a[1],s=a[2],m=a[3],c=a[4];if(c&&n(t).is(":focus"))return!0;for(var d,p,v,g,y,w=k[l],h=I[l],b=w(e),x=0;x=D||(d=D),D>b))){if(!c)return!1;v=!0,y=!0}}for(var x=0;x=p||(p=D),b>D))){if(!c)return!1;v=!0,g=!0}}if(c&&v){if(d>p)return!1;g?n(t).val(M[l](p)):y&&n(t).val(M[l](d))}return!0};var R=S.unobtrusive.adapters,H=0;for(H=0;Hl?a=t:e=u.substring(0,l+1)+t,!e)return null;var i=n("[name='"+a+"']");return i.length>0?i[0]:null}function t(n,r){if(!r)return[];r=r.split(" ");for(var t=[],u=0;u=a?l.setDate(u.getDate()-u.getDay()+1):l.setDate(u.getDate()+8-u.getDay()),l}function a(n){if(!x){var r=f.Globalize();s||(s=o.enhancer.getSupport().Html5InputSupport);var e=r.locale().attributes.language,t=r.cldr.get("main/"+e).numbers["symbols-numberSystem-latn"];m=s.number>2?new RegExp("^[+-.0-9]*$"):new RegExp("^[\\"+t.plusSign+"\\"+t.minusSign+"\\"+t.decimal+"0-9]*$"),c=s.range>2?new RegExp("^[+-.0-9]*$"):new RegExp("^[\\"+t.plusSign+"\\"+t.minusSign+"\\"+t.decimal+"0-9]*$"),d=r.dateParser({raw:"HH:mm:ss"}),p=r.dateParser({raw:"yyyy-MM-ddTHH:mm:ss"}),v=r.dateParser({raw:"yyyy-MM"}),g=s.week>2?function(n){return n}:u,y=s.week>2?function(n){return n}:function(n){return f.parse("week",n)},weekFormatter=s.week>2?function(n){return n}:function(n){return f.format("week",n)},b=function(n,r){return n?r?n+parseFloat(r):n:null},w=function(n,r){return n?r?new Date(n.getTime()+parseInt(r)):n:null};var a=document.createElement("INPUT");a.setAttribute("type","week"),h=s.week>2?function(n,r){if(!n)return null;if(!r)return n;var e=parseInt(r)/6048e5;return 0==e?n:(a.value=n,e>0?a.stepUp(e):a.stepDown(-e),a.value)}:w,D[0]=function(n){return n},E[0]=D[0],I[0]=function(n){return n},M[0]=D[0],D[1]=D[2]=D[3]=function(n){return f.parse("number",n)},E[1]=E[2]=E[3]=k,I[1]=I[2]=I[3]=b,M[1]=M[2]=M[3]=function(n){return f.format("number",n)},D[11]=D[12]=D[13]=function(n){return f.parse("range",n)},E[11]=E[12]=E[13]=k,I[11]=I[12]=I[13]=b,M[11]=M[12]=M[13]=function(n){return f.format("range",n)},D[4]=function(n){return f.parse("time",n)},E[4]=d,M[4]=function(n){return f.format("time",n)},D[5]=function(n){return f.parse("date",n)},E[5]=p,M[5]=function(n){return f.format("date",n)},D[6]=function(n){return f.parse("datetime",n)},E[6]=p,I[4]=I[5]=I[6]=w,M[6]=function(n){return f.format("datetime",n)},D[7]=y,E[7]=g,I[7]=h,M[7]=weekFormatter,D[8]=function(n){return f.parse("month",n)},E[8]=v,I[8]=w,M[8]=function(n){return f.format("month",n)},x=!0}}function l(n,r,e){n.rules[r]=e,n.message&&(n.messages[r]=n.message)}function i(r,e,t){if(e)for(var u=0;um&&n(t).val(M[l](c)),!0}return i(e)>=s(u[0])},n.validator.methods.maxE=function(e,t,u){f||a();var l=r(n(t));if(!e)return!0;var i=D[l],o=u[1];if(o&&n(t).is(":focus"))return!0;var s=E[l];if(o){var m=i(e),c=s(u[0]);return m>c&&n(t).val(M[l](c)),!0}return i(e)<=s(u[0])},n.validator.methods.rangeE=function(e,t,u){f||a();var l=r(n(t));if(!e)return!0;var i=D[l],o=u[2];if(o&&n(t).is(":focus"))return!0;var s=E[l];if(o){var m=i(e),c=s(u[0]);return c>m?n(t).val(M[l](c)):(c=s(u[1]),m>c&&n(t).val(M[l](c))),!0}return i(e)<=s(u[1])&&i(e)>=s(u[0])},n.validator.methods.correcttype=function(e,t,u){if(f||a(),!e)return!0;var l=r(n(t)),i=D[l],o=i(e);return(o||0===o)&&(!("number"==typeof o)||(10>l?m.test(e):c.test(e)))&&(1!=l&&2!=l&&11!=l&&12!=l||o%1===0)&&(1!=l&&11!=l||o>=0)},n.validator.methods.drange=function(e,t,u){if(f||a(),!e)return!0;var l=r(n(t)),i=u[0],o=u[1],s=u[2],m=u[3],c=u[4];if(c&&n(t).is(":focus"))return!0;for(var d,p,v,g,y,w=D[l],h=I[l],b=w(e),x=0;x=k||(d=k),k>b))){if(!c)return!1;v=!0,y=!0}}for(var x=0;x=p||(p=k),b>k))){if(!c)return!1;v=!0,g=!0}}if(c&&v){if(d>p)return!1;g?n(t).val(M[l](p)):y&&n(t).val(M[l](d))}return!0};var R=S.unobtrusive.adapters,H=0;for(H=0;H=1.8", "jquery-validation-unobtrusive": ">=3.2.6", "globalize": ">=1.1.1", - "mvcct-enhancer": ">=1.0.0-rc3" + "mvcct-enhancer": ">=1.0.0" }, "devDependencies": { "gulp": "3.9.1",