diff --git a/bower.json b/bower.json index baa1c37..d5b670b 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-validation-ghiscoding", - "version": "1.3.33", + "version": "1.3.34", "author": "Ghislain B.", "description": "Angular-Validation Directive and Service (ghiscoding)", "main": [ diff --git a/changelog.txt b/changelog.txt index 912ee9a..f0041ef 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,37 +1,38 @@ Angular-Validation change logs -1.1.0 (2014-05-02): only start validating after user inactivity, it could also be passed as an argument for more customization of the inactivity timeout (typing-limit). -1.3.0 (2014-12-01): support to Angular 1.3.x -1.3.1 (2015-01-02): Added Input Match (confirmation) Validator -1.3.2 (2015-01-03): Float number validator to also permit dot (.) as first char. Also removed keyboard blocking of invalid character on input type="number" instead display error message. -1.3.3 (2015-01-04): Updated Bootstrap(3.3.1) and AngularJS(1.3.7) to latest versions -1.3.4 (2015-01-06): Removed the necessity of creating a for displaying the error message, the directive now handles it by itself. -1.3.5 (2015-01-26): Throw an error message when user did not provide a name="" property inside the element to validate. -1.3.6 (2015-02-09): Added ng-strict-di for minification, renamed some files and folder lib to /vendors, moved directive into new /src folder for better separation. -1.3.7 (2015-03-08): Complete rewrite (but same functionality) so that I could add an Angular-Validation Service which is similar implementation as the Directive. Also added `debounce` attribute which is an alias to `typingLimit`, validation rules are now defined as an external service for better maintainability and also created a common file for shared functions by both Validation Directive and Service. -1.3.8 (2015-03-15): Added between/min/max conditional validators on all Date types (ISO, EURO_LONG, EURO_SHORT, US_LONG, US_SHORT) -1.3.9 (2015-03-21): Added validation summary through 2 new and equivalent properties `$scope.$validationSummary` and `$scope.formName.$validationSummary`. Also added `bower` and `gulp` support, the Gulp script gives minified files. -1.3.10 (2015-03-28): Added new function of `checkFormValidity()` before submitting the form. Now use only 1 minified script instead of multiples. -1.3.11 (2015-03-30): Accepted pull request #15 to fix form without name attribute. Also accepted pull request #18 to add Spanish locales. -1.3.12 (2015-04-04): Fix issue #16 and added Validators Alternate Text option on all type of validators. Also fixed removeValidator and clean a lot of code. -1.3.13 (2015-04-06) Fixed $translate delay issue when using external JSON files -1.3.14 (2015-04-07) Merge pull request #19 Added norwegian translation and changes to allow user to remove invalid validators. -1.3.15 (2015-04-08) Fixed issue #23 If multiple forms exist in the app the errors in 1 form affect validation in the other -1.3.16 (2015-04-09) Accept Merge #3 Fixed removeFromValidationSummary to also remove from 'local' array -1.3.17 (2015-04-11) Added global `$scope.$validationOptions` object, for now only has the `debounce` property that be used by both the Directive and Service. -1.3.18 (2015-04-19) Fixed issue #20 - Error messages shown on submit are non-understandable, this was fixed using $translate promises instead of $translate.instant(). Fixed a few error display on the validationSummary() and checkFormValidity(). Also merged #27 to add Russian -1.3.19 (2015-04-20) Fixed issue #28 - unbind all 'blur' in cancelValidation() might affect other modules -1.3.20 (2015-04-21) Fixed issue #26 - validation of forms inside ng-repeat (added sample `dynamicFormView` in `more-examples` folder). And again issue #28 - unbind all 'blur' in cancelValidation() might affect other modules. -1.3.21 (2015-04-29) Moved the Alternate Text inside the $translate promise as well which removes possible delay of non-translated text appearing as alternate text (this will not affect regular text, or already translated text). Also cleanup code and made my Gulp task even more automated. -1.3.22 (2015-05-03) Added new element attribute of `friendly-name` which is used ONLY in the ValidationSummary, this friendly name is to give a better element name display, which also support translation, inside the ValidationSummary instead of just "input1" (see ValidationSummary for more details). -1.3.23 (2015-05-05) Added option to display only last error message instead of all messages at once. Fixed a bug where changing route on View/Controller would make the ValidationSummary fail when coming back to original View/Controller, this bug was associated to the fact that the ValidationSummary kept growing from Controller to Controller, now this ValidationSummary is wipe out as soon as we detect a route change. -1.3.24 (2015-05-17) Replaced all `:param` inside each locale translations with a better standard of {0}, {1}, etc.. like C# `String.Format()`. Added a full Protractor End-to-End test suite (1000+ asserts). Fixed a few minor bugs found with Protractor test cases. Fixed issue #36, bower.json scripts in wrong order. -1.3.25 (2015-05-19) Enhancement #34 to add Remote Validation and updated Protractor to cover this new feature. -1.3.26 (2015-05-30) Added enhancement #35 - PreValidate the Form, display all errors on page load. -1.3.27 (2015-06-02) Added possibility to use own isolated scope (issue #37 and #26). Fixed an implementation issue found from last revision (issue #35). Fixed email validation (issue #38). Fixed a performance issue found with onBlur which would run as much validations as there was characters inside the input when onBlur was called (abcdef => would make 6 validations) and this was extremely costly with a Remote validation call. Update the code of Remote validation to also accept the "As" alias "remote:vm.customRemoteValidation". Finally added and updated a few Protractor tests to cover all of the above and more. -1.3.28 (2015-06-04) Fixed a bug with ngDisabled not being interpreted before observing it (ng-disabled="vm.type == 1" would give false result because it was not being interpreted), added Protractor Test for this behavior in 2Forms page. Added `displayOnlyLastErrorMsg` in the list of Global Options. Cleaned up a lot of code. -1.3.29 (2015-06-10) Added RemoveValidator() for Directive, added Protractor tests on RemoveValidator() for both the Directive and Service. Fixed ngDisabled not working correctly in Service, added Protractor tests for ngDisabled On/Off in both Directive and Service -1.3.30 (2015-06-15) Merged pull request #40 - Polish translations -1.3.31 (2015-06-20) Enhancement #39 - How to Reset a Form, added Protractor tests to cover this new functionality. +1.3.34 (2015-07-08) Merge pull request #44 - Adding support to brazilian portuguese language. +1.3.33 (2015-07-02) Reset isolatedScope on route change 1.3.32 (2015-06-24) Merged pull request #41 and fixed errors inside it, updated Protractor test as well. -1.3.33 (2015-07-02) Reset isolatedScope on route change \ No newline at end of file +1.3.31 (2015-06-20) Enhancement #39 - How to Reset a Form, added Protractor tests to cover this new functionality. +1.3.30 (2015-06-15) Merged pull request #40 - Polish translations +1.3.29 (2015-06-10) Added RemoveValidator() for Directive, added Protractor tests on RemoveValidator() for both the Directive and Service. Fixed ngDisabled not working correctly in Service, added Protractor tests for ngDisabled On/Off in both Directive and Service +1.3.28 (2015-06-04) Fixed a bug with ngDisabled not being interpreted before observing it (ng-disabled="vm.type == 1" would give false result because it was not being interpreted), added Protractor Test for this behavior in 2Forms page. Added `displayOnlyLastErrorMsg` in the list of Global Options. Cleaned up a lot of code. +1.3.27 (2015-06-02) Added possibility to use own isolated scope (issue #37 and #26). Fixed an implementation issue found from last revision (issue #35). Fixed email validation (issue #38). Fixed a performance issue found with onBlur which would run as much validations as there was characters inside the input when onBlur was called (abcdef => would make 6 validations) and this was extremely costly with a Remote validation call. Update the code of Remote validation to also accept the "As" alias "remote:vm.customRemoteValidation". Finally added and updated a few Protractor tests to cover all of the above and more. +1.3.26 (2015-05-30) Added enhancement #35 - PreValidate the Form, display all errors on page load. +1.3.25 (2015-05-19) Enhancement #34 to add Remote Validation and updated Protractor to cover this new feature. +1.3.24 (2015-05-17) Replaced all `:param` inside each locale translations with a better standard of {0}, {1}, etc.. like C# `String.Format()`. Added a full Protractor End-to-End test suite (1000+ asserts). Fixed a few minor bugs found with Protractor test cases. Fixed issue #36, bower.json scripts in wrong order. +1.3.23 (2015-05-05) Added option to display only last error message instead of all messages at once. Fixed a bug where changing route on View/Controller would make the ValidationSummary fail when coming back to original View/Controller, this bug was associated to the fact that the ValidationSummary kept growing from Controller to Controller, now this ValidationSummary is wipe out as soon as we detect a route change. +1.3.22 (2015-05-03) Added new element attribute of `friendly-name` which is used ONLY in the ValidationSummary, this friendly name is to give a better element name display, which also support translation, inside the ValidationSummary instead of just "input1" (see ValidationSummary for more details). +1.3.21 (2015-04-29) Moved the Alternate Text inside the $translate promise as well which removes possible delay of non-translated text appearing as alternate text (this will not affect regular text, or already translated text). Also cleanup code and made my Gulp task even more automated. +1.3.20 (2015-04-21) Fixed issue #26 - validation of forms inside ng-repeat (added sample `dynamicFormView` in `more-examples` folder). And again issue #28 - unbind all 'blur' in cancelValidation() might affect other modules. +1.3.19 (2015-04-20) Fixed issue #28 - unbind all 'blur' in cancelValidation() might affect other modules +1.3.18 (2015-04-19) Fixed issue #20 - Error messages shown on submit are non-understandable, this was fixed using $translate promises instead of $translate.instant(). Fixed a few error display on the validationSummary() and checkFormValidity(). Also merged #27 to add Russian +1.3.17 (2015-04-11) Added global `$scope.$validationOptions` object, for now only has the `debounce` property that be used by both the Directive and Service. +1.3.16 (2015-04-09) Accept Merge #3 Fixed removeFromValidationSummary to also remove from 'local' array +1.3.15 (2015-04-08) Fixed issue #23 If multiple forms exist in the app the errors in 1 form affect validation in the other +1.3.14 (2015-04-07) Merge pull request #19 Added norwegian translation and changes to allow user to remove invalid validators. +1.3.13 (2015-04-06) Fixed $translate delay issue when using external JSON files +1.3.12 (2015-04-04): Fix issue #16 and added Validators Alternate Text option on all type of validators. Also fixed removeValidator and clean a lot of code. +1.3.11 (2015-03-30): Accepted pull request #15 to fix form without name attribute. Also accepted pull request #18 to add Spanish locales. +1.3.10 (2015-03-28): Added new function of `checkFormValidity()` before submitting the form. Now use only 1 minified script instead of multiples. +1.3.9 (2015-03-21): Added validation summary through 2 new and equivalent properties `$scope.$validationSummary` and `$scope.formName.$validationSummary`. Also added `bower` and `gulp` support, the Gulp script gives minified files. +1.3.8 (2015-03-15): Added between/min/max conditional validators on all Date types (ISO, EURO_LONG, EURO_SHORT, US_LONG, US_SHORT) +1.3.7 (2015-03-08): Complete rewrite (but same functionality) so that I could add an Angular-Validation Service which is similar implementation as the Directive. Also added `debounce` attribute which is an alias to `typingLimit`, validation rules are now defined as an external service for better maintainability and also created a common file for shared functions by both Validation Directive and Service. +1.3.6 (2015-02-09): Added ng-strict-di for minification, renamed some files and folder lib to /vendors, moved directive into new /src folder for better separation. +1.3.5 (2015-01-26): Throw an error message when user did not provide a name="" property inside the element to validate. +1.3.4 (2015-01-06): Removed the necessity of creating a for displaying the error message, the directive now handles it by itself. +1.3.3 (2015-01-04): Updated Bootstrap(3.3.1) and AngularJS(1.3.7) to latest versions +1.3.2 (2015-01-03): Float number validator to also permit dot (.) as first char. Also removed keyboard blocking of invalid character on input type="number" instead display error message. +1.3.1 (2015-01-02): Added Input Match (confirmation) Validator +1.3.0 (2014-12-01): support to Angular 1.3.x +1.1.0 (2014-05-02): only start validating after user inactivity, it could also be passed as an argument for more customization of the inactivity timeout (typing-limit). \ No newline at end of file diff --git a/dist/angular-validation.min.js b/dist/angular-validation.min.js index c5bfaf6..b693ff5 100644 --- a/dist/angular-validation.min.js +++ b/dist/angular-validation.min.js @@ -2,9 +2,9 @@ * Angular-Validation Directive and Service (ghiscoding) * http://github.com/ghiscoding/angular-validation * @author: Ghislain B. - * @version: 1.3.33 + * @version: 1.3.34 * @license: MIT - * @build: Thu Jul 02 2015 18:47:45 GMT-0400 (Eastern Daylight Time) + * @build: Wed Jul 08 2015 18:33:00 GMT-0400 (Eastern Daylight Time) */ angular.module("ghiscoding.validation",["pascalprecht.translate"]).directive("validation",["$timeout","validationCommon",function(e,i){return{restrict:"A",require:"ngModel",link:function(t,a,n,d){function l(){var i=s.getFormElementByName(d.$name);i.isValidationCancelled=!0,e.cancel(r),s.updateErrorMsg(""),d.$setValidity("validation",!0),"function"==typeof u&&a.unbind("blur",u)}function o(i,n){var o="undefined"!=typeof n?n:s.typingLimit,u=s.getFormElementByName(d.$name);return s.validate(i,!1),s.isFieldRequired()||""!==i&&null!==i&&"undefined"!=typeof i?(u&&(u.isValidationCancelled=!1),(i||s.isFieldRequired())&&d.$setValidity("validation",!1),""!==i&&"undefined"!=typeof i||"NUMBER"!==a.prop("type").toUpperCase()?"SELECT"===a.prop("tagName").toUpperCase()?(d.$setValidity("validation",s.validate(i,!0)),i):("undefined"!=typeof i&&(s.updateErrorMsg(""),e.cancel(r),r=e(function(){t.$evalAsync(d.$setValidity("validation",s.validate(i,!0)))},o)),i):(e.cancel(r),d.$setValidity("validation",s.validate(i,!0)),i)):(l(),i)}var r,u,s=new i(t,a,n,d);d.$formatters.unshift(o),d.$parsers.unshift(o),n.$observe("disabled",function(e){if(e)l(),s.removeFromValidationSummary(n.name);else{"function"==typeof d.$setTouched&&d.$setTouched();var i=d.$viewValue||"";d.$setValidity("validation",s.validate(i,!0))}}),t.$watch(function(){return a.attr("validation")},function(e){("undefined"==typeof e||""===e)&&(d.$formatters.shift(),d.$parsers.shift(),l())}),a.bind("blur",u=function(e){var i=s.getFormElementByName(d.$name);i.isValidationCancelled?d.$setValidity("validation",!0):o(e.target.value,0)})}}}]); angular.module("ghiscoding.validation").factory("validationCommon",["$rootScope","$timeout","$translate","validationRules",function(t,e,a,r){function i(){var t=this,e={};t.validators=[],t.typingLimit=F,t.validatorAttrs.hasOwnProperty("debounce")?t.typingLimit=parseInt(t.validatorAttrs.debounce,10):t.validatorAttrs.hasOwnProperty("typingLimit")?t.typingLimit=parseInt(t.validatorAttrs.typingLimit,10):U&&U.hasOwnProperty("debounce")&&(t.typingLimit=parseInt(U.debounce,10));var a=t.validatorAttrs.hasOwnProperty("rules")?t.validatorAttrs.rules:t.validatorAttrs.validation;if(a.indexOf("regex:")>=0){var i=a.match("regex:(.*?):regex");if(i.length<2)throw'Regex validator within the validation needs to be define with an opening "regex:" and a closing ":regex", please review your validator.';var n=i[1].split(":=");e={message:n[0],pattern:n[1]},a=a.replace(i[0],"regex:")}var s=a.split("|");if(s){t.bFieldRequired=a.indexOf("required")>=0?!0:!1;for(var o=0,l=s.length;l>o;o++){var p=s[o].split(":"),d=s[o].indexOf("alt=")>=0?!0:!1;t.validators[o]=r.getElementValidators({altText:d===!0?2===p.length?p[1]:p[2]:"",customRegEx:e,rule:p[0],ruleParams:d&&2===p.length?null:p[1]})}}return t}function n(t){return O(L,"fieldName",t)}function s(t){return t?$(L,"formName",t):L}function o(t,e,a,r){this.scope=t,this.elm=e,this.ctrl=r,this.validatorAttrs=a,h(e,a,r,t),this.defineValidation()}function l(){var t=this;return t.bFieldRequired}function p(t,e){var a={};for(var r in t)a[r]=t[r];for(var r in e)a[r]=e[r];return a}function d(t){var e=S(L,"fieldName",t);e>=0&&L.splice(e,1)}function u(t,e){var a=this,r=E(t,a),i=e?e:q,n=S(i,"field",t);return n>=0&&i.splice(n,1),n=S(q,"field",t),n>=0&&q.splice(n,1),a.scope.$validationSummary=q,r&&(r.$validationSummary=$(q,"formName",r.$name)),q}function c(t){w=t}function m(t){U.displayOnlyLastErrorMsg=t}function f(t){var e=this;return U=p(U,t),e}function g(t,e){var r=this;e&&e.obj&&(r=e.obj,r.validatorAttrs=e.obj.attrs);var i=e&&e.elm?e.elm:r.elm,n=i&&i.attr("name")?i.attr("name"):null;if("undefined"==typeof n||null===n){var s=i?i.attr("ng-model"):"unknown";throw'Angular-Validation Service requires you to have a (name="") attribute on the element to validate... Your element is: ng-model="'+s+'"'}var o=e&&e.translate?a.instant(t):t,l=n.replace(/[|&;$%@"<>()+,\[\]\{\}]/g,""),p=null;if(r.validatorAttrs&&r.validatorAttrs.hasOwnProperty("validationErrorTo")){var d=r.validatorAttrs.validationErrorTo.charAt(0),u="."===d||"#"===d?r.validatorAttrs.validationErrorTo:"#"+r.validatorAttrs.validationErrorTo;p=angular.element(document.querySelector(u))}p&&0!==p.length||(p=angular.element(document.querySelector(".validation-"+l)));var c=e&&e.isSubmitted?e.isSubmitted:!1;e&&!e.isValid&&(c||r.ctrl.$dirty||r.ctrl.$touched)?p.length>0?p.text(o):i.after(''+o+""):p.text("")}function v(t,e){var r,i,s=this,o=!0,l=!0,p="";"undefined"==typeof t&&(t="");for(var d=s.ctrl&&s.ctrl.$name?s.ctrl.$name:s.attrs&&s.attrs.name?s.attrs.name:s.elm.attr("name"),u=n(d),c=s.validatorAttrs.hasOwnProperty("rules")?s.validatorAttrs.rules:s.validatorAttrs.validation,m=0,f=s.validators.length;f>m;m++){if(i=s.validators[m],"conditionalDate"===i.type){if(r=new RegExp(i.pattern,"i"),o=("\\S+"===i.pattern||c&&"required"===i.pattern)&&null===t?!1:r.test(t)){var g=i.dateType,v=A(t,g).getTime();if(2==i.params.length){var h=A(i.params[0],g).getTime(),O=A(i.params[1],g).getTime(),$=N(i.condition[0],v,h),S=N(i.condition[1],v,O);o=$&&S?!0:!1}else{var E=A(i.params[0],g).getTime();o=N(i.condition,v,E)}}}else if("conditionalNumber"===i.type)if(2==i.params.length){var $=N(i.condition[0],parseFloat(t),parseFloat(i.params[0])),S=N(i.condition[1],parseFloat(t),parseFloat(i.params[1]));o=$&&S?!0:!1}else o=N(i.condition,parseFloat(t),parseFloat(i.params[0]));else if("match"===i.type){var x=i.params[0],R=s.scope.$eval(x);o=R===t&&!!t}else if("remote"===i.type){if(t&&e){s.ctrl.$processing=!0;var V=null,T=i.params[0];if(-1===T.indexOf("."))V=s.scope[T];else{var w=T.split(".");V=s.scope;for(var F=0,L=w.length;L>F;F++)V=V[w[F]]}var q="function"==typeof V?V():null;if(k.length>1)for(;k.length>0;){var M=k.pop();"function"==typeof M.abort&&M.abort()}if(k.push(q),!q||"function"!=typeof q.then)throw"Remote Validation requires a declared function (in your Controller) which also needs to return a Promise, please review your code.";s.ctrl.$setValidity("remote",!1),function(t){q.then(function(a){a=a.data||a,k.pop(),s.ctrl.$processing=!1;var r=p+" ";"boolean"==typeof a?o=a?!0:!1:"object"==typeof a&&(o=a.isValid?!0:!1),o===!1&&(u.isValid=!1,r+=a.message?a.message:t,y(s,u,r,!1,e)),o===!0&&l===!0&&(u.isValid=!0,s.ctrl.$setValidity("remote",!0),y(s,u,"",!0,e))})}(i.altText)}}else{var P="undefined"!=typeof s.attrs?s.attrs.ngDisabled:s.validatorAttrs.ngDisabled;s.elm.prop("disabled")||s.scope.$eval(P)?o=!0:"string"==typeof t&&""===t&&"NUMBER"===s.elm.prop("type").toUpperCase()?o=!1:(r=new RegExp(i.pattern,"i"),o=("\\S+"===i.pattern||c&&"required"===i.pattern)&&null===t?!1:r.test(t))}(!s.bFieldRequired&&!t||s.elm.prop("disabled")||s.scope.$eval(P))&&(o=!0),o||(l=!1,function(t,r,i){var n=i.message;i.altText&&i.altText.length>0&&(n=i.altText.replace("alt=","")),a(n).then(function(a){p.length>0&&U.displayOnlyLastErrorMsg?p=" "+(i&&i.params?String.format(a,i.params):a):p+=" "+(i&&i.params?String.format(a,i.params):a),y(s,t,p,l,e)})["catch"](function(){i.altText&&i.altText.length>0&&(p.length>0&&U.displayOnlyLastErrorMsg?p=" "+n:p+=" "+n,y(s,t,p,l,e))})}(u,o,i))}return o&&(b(s,""),s.updateErrorMsg("",{isValid:o})),u&&(u.isValid=l,l&&(u.message="")),l}function h(t,e,r,i){var n=e.name?e.name:t.attr("name"),s=E(n,{scope:i}),o=e&&e.friendlyName?a.instant(e.friendlyName):"",l={fieldName:n,friendlyName:o,elm:t,attrs:e,ctrl:r,scope:i,isValid:!1,message:"",formName:s?s.$name:null},p=S(L,"fieldName",t.attr("name"));return p>=0?L[p]=l:L.push(l),L}function y(t,e,a,r,i){a=a.trim(),b(e,a),e&&(e.message=a),(t.validatorAttrs.preValidateFormElements||U.preValidateFormElements)&&(e&&"function"==typeof t.ctrl.$setTouched&&e.ctrl.$setTouched(),t.ctrl.$dirty===!1&&g(a,{isSubmitted:!0,isValid:r,obj:e})),i&&e&&!e.isValid?t.updateErrorMsg(a,{isValid:r}):e&&e.isValid&&b(e,"")}function b(t,e){if("undefined"!=typeof t&&null!=t){var r=t.ctrl&&t.ctrl.$name?t.ctrl.$name:t.attrs&&t.attrs.name?t.attrs.name:t.elm.attr("name"),i=E(r,t),n=S(q,"field",r);if(n>=0&&""===e)q.splice(n,1);else if(""!==e){var s=t.attrs&&t.friendlyName?a.instant(t.friendlyName):"",o={field:r,friendlyName:s,message:e,formName:i?i.$name:null};n>=0?q[n]=o:q.push(o)}return t.scope.$validationSummary=q,i&&(i.$validationSummary=$(q,"formName",i.$name)),q}}function O(t,e,a){if(t)for(var r=0;r8?t.substring(9).split(":"):null;break;case"UK":case"EURO":case"EURO_SHORT":case"EURO-SHORT":case"EUROPE":a=t.substring(0,8),r=t.substring(2,3),i=x(a,r),l=i[0],o=i[1],s=parseInt(i[2])<50?"20"+i[2]:"19"+i[2],n=t.length>8?t.substring(9).split(":"):null;break;case"US_LONG":case"US-LONG":a=t.substring(0,10),r=t.substring(2,3),i=x(a,r),o=i[0],l=i[1],s=i[2],n=t.length>8?t.substring(9).split(":"):null;break;case"US":case"US_SHORT":case"US-SHORT":a=t.substring(0,8),r=t.substring(2,3),i=x(a,r),o=i[0],l=i[1],s=parseInt(i[2])<50?"20"+i[2]:"19"+i[2],n=t.length>8?t.substring(9).split(":"):null;break;case"ISO":default:a=t.substring(0,10),r=t.substring(4,5),i=x(a,r),s=i[0],o=i[1],l=i[2],n=t.length>10?t.substring(11).split(":"):null}var p=n&&3===n.length?n[0]:0,d=n&&3===n.length?n[1]:0,u=n&&3===n.length?n[2]:0;return new Date(s,o-1,l,p,d,u)}function x(t,e){var a=[];switch(e){case"/":a=t.split("/");break;case".":a=t.split(".");break;case"-":default:a=t.split("-")}return a}function N(t,e,a){var r=!1;switch(t){case"<":r=a>e?!0:!1;break;case"<=":r=a>=e?!0:!1;break;case">":r=e>a?!0:!1;break;case">=":r=e>=a?!0:!1;break;case"!=":case"<>":r=e!=a?!0:!1;break;case"=":case"==":r=e==a?!0:!1;break;default:r=!1}return r}function R(){return this.replace(/^\s+|\s+$/g,"")}function V(){var t=Array.isArray(arguments[0])?arguments[0]:arguments;return this.replace(/{(\d+)}/g,function(e,a){return"undefined"!=typeof t[a]?t[a]:e})}function T(t){var e=Array.isArray(arguments[1])?arguments[1]:Array.prototype.slice.call(arguments,1);return t.replace(/{(\d+)}/g,function(t,a){return"undefined"!=typeof e[a]?e[a]:t})}var w=!1,F=1e3,L=[],U={},k=[],q=[];t.$on("$routeChangeStart",function(){w||(U.displayOnlyLastErrorMsg=!1,U.preValidateFormElements=!1,U.isolatedScope=null,U.scope=null,L=[],q=[])});var M=function(t,e,a,r){this.bFieldRequired=!1,this.validators=[],this.typingLimit=F,this.scope=t,this.elm=e,this.ctrl=r,this.validatorAttrs=a,t&&t.$validationOptions&&(U=t.$validationOptions),t&&(U.isolatedScope||U.scope)&&(this.scope=U.isolatedScope?U.isolatedScope:U.scope,U=p(t.$validationOptions,U)),this.elm&&this.validatorAttrs&&this.ctrl&&this.scope&&(h(this.elm,this.validatorAttrs,this.ctrl,this.scope),this.defineValidation())};return M.prototype.arrayFindObject=O,M.prototype.defineValidation=i,M.prototype.getFormElementByName=n,M.prototype.getFormElements=s,M.prototype.isFieldRequired=l,M.prototype.initialize=o,M.prototype.mergeObjects=p,M.prototype.removeFromValidationSummary=u,M.prototype.removeFromFormElementObjectList=d,M.prototype.setBypassRootScopeReset=c,M.prototype.setDisplayOnlyLastErrorMsg=m,M.prototype.setGlobalOptions=f,M.prototype.updateErrorMsg=g,M.prototype.validate=v,String.prototype.trim=R,String.prototype.format=V,String.format=T,M}]); diff --git a/index.html b/index.html index 9c95705..b0c4283 100644 --- a/index.html +++ b/index.html @@ -21,8 +21,9 @@

Angular-Validation Directive|Service (ghiscoding)

- + + Type: diff --git a/package.json b/package.json index a6f8b62..2ae2386 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-validation-ghiscoding", - "version": "1.3.33", + "version": "1.3.34", "author": "Ghislain B.", "description": "Angular-Validation Directive and Service (ghiscoding)", "main": "app.js", diff --git a/readme.md b/readme.md index 2463cd6..7e157d1 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,5 @@ #Angular Validation (Directive / Service) -`Version: 1.3.33` +`Version: 1.3.34` ### Form validation after user inactivity of default 1sec. (customizable timeout) Forms Validation with Angular made easy! Angular-Validation is an angular directive/service with locales (languages) with a very simple approach of defining your `validation=""` directly within your element to validate (input, textarea, etc) and...that's it!!! The directive/service will take care of the rest!