diff --git a/bower.json b/bower.json index 63ac717..d20ae35 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "expressive-annotations", - "version": "2.7.2-pre", + "version": "2.7.4-pre", "license": "MIT", "homepage": "https://github.com/jwaliszko/ExpressiveAnnotations", "description": "Client-side component of ExpressiveAnnotations - annotation-based conditional validation library.", diff --git a/package.json b/package.json index 7a2ab50..240a9a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "expressive-annotations", - "version": "2.7.2-pre", + "version": "2.7.4-pre", "license": "MIT", "homepage": "https://github.com/jwaliszko/ExpressiveAnnotations", "description": "Client-side component of ExpressiveAnnotations - annotation-based conditional validation library.", diff --git a/src/expressive.annotations.validate.min.js b/src/expressive.annotations.validate.min.js index b75b626..5267e22 100644 --- a/src/expressive.annotations.validate.min.js +++ b/src/expressive.annotations.validate.min.js @@ -1,7 +1,7 @@ -/* expressive.annotations.validate.js - v2.7.2 +/* expressive.annotations.validate.js - v2.7.3 * Client-side component of ExpressiveAnnotations - annotation-based conditional validation library. * https://github.com/jwaliszko/ExpressiveAnnotations * * Copyright (c) 2014 Jarosław Waliszko * Licensed MIT: http://opensource.org/licenses/MIT */ -!function(e,t){"use strict";var n=t.ea,r=t.console,i={settings:{debug:!1,optimize:!0,enumsAsNumbers:!0,dependencyTriggers:"change keyup",apply:function(t){!function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}(i.settings,t),function(){if(!o.isBool(i.settings.debug))throw"EA settings error: debug value must be a boolean (true or false)";if(!o.isBool(i.settings.optimize))throw"EA settings error: optimize value must be a boolean (true or false)";if(!o.isBool(i.settings.enumsAsNumbers))throw"EA settings error: enumsAsNumbers value must be a boolean (true or false)";if(!o.isString(i.settings.dependencyTriggers)&&null!==i.settings.dependencyTriggers&&void 0!==i.settings.dependencyTriggers)throw"EA settings error: dependencyTriggers value must be a string (multiple event types can be bound at once by including each one separated by a space), null or undefined"}(),e("form").each(function(){e(this).find("input, select, textarea").off(".expressive.annotations"),d.bindFields(this,!0)}),s.info(o.string.format("EA settings applied:\n{0}",t))}},addMethod:function(e,t){a.addMethod(e,t)},addValueParser:function(e,t){o.addValueParser(e,t)},noConflict:function(){return t.ea===this&&(t.ea=n),this}},s={info:function(e){i.settings.debug&&r&&"function"==typeof r.log&&r.log("[info] "+s.prep(e,new Date))},warn:function(e){r&&"function"==typeof r.warn&&r.warn("[warn] "+s.prep(e,new Date))},fail:function(e){r&&"function"==typeof r.error&&r.error("[fail] "+s.prep(e,new Date))},prep:function(e,t){var n=(e=o.string.tryParse(e)).split("\n"),r=(void 0!==t&&null!==t?"("+o.datetime.stamp(t)+"): ":"")+n.shift();return n.length>0?r+"\n"+o.string.indent(n.join("\n"),19):r}},a={methods:{},addMethod:function(e,t){var n=this.methods[e];this.methods[e]=function(){return t.length===arguments.length?t.apply(this,arguments):"function"==typeof n?n.apply(this,arguments):t.apply(this,arguments)}},registerMethods:function(e,t){var n,r,i;for(this.initialize(),n=0;nt?1:-1}),this.addMethod("CompareOrdinalIgnoreCase",function(e,t){return e=null!==e&&void 0!==e?e.toLowerCase():null,t=null!==t&&void 0!==t?t.toLowerCase():null,this.CompareOrdinal(e,t)}),this.addMethod("StartsWith",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.slice(0,t.length)===t}),this.addMethod("StartsWithIgnoreCase",function(e,t){return e=null!==e&&void 0!==e?e.toLowerCase():null,t=null!==t&&void 0!==t?t.toLowerCase():null,this.StartsWith(e,t)}),this.addMethod("EndsWith",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.slice(-t.length)===t}),this.addMethod("EndsWithIgnoreCase",function(e,t){return e=null!==e&&void 0!==e?e.toLowerCase():null,t=null!==t&&void 0!==t?t.toLowerCase():null,this.EndsWith(e,t)}),this.addMethod("Contains",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.indexOf(t)>-1}),this.addMethod("ContainsIgnoreCase",function(e,t){return e=null!==e&&void 0!==e?e.toLowerCase():null,t=null!==t&&void 0!==t?t.toLowerCase():null,this.Contains(e,t)}),this.addMethod("IsNullOrWhiteSpace",function(e){return null===e||!/\S/.test(e)}),this.addMethod("IsDigitChain",function(e){return/^[0-9]+$/.test(e)}),this.addMethod("IsNumber",function(e){return/^[+-]?(?:(?:[0-9]+)|(?:[0-9]+[eE][+-]?[0-9]+)|(?:[0-9]*\.[0-9]+(?:[eE][+-]?[0-9]+)?))$/.test(e)}),this.addMethod("IsEmail",function(e){return/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(e)}),this.addMethod("IsPhone",function(e){return/^(\+\s?)?((?!\+.*)\(\+?\d+([\s\-\.]?\d+)?\)|\d+)([\s\-\.]?(\(\d+([\s\-\.]?\d+)?\)|\d+))*(\s?(x|ext\.?)\s?\d+)?$/.test(e)}),this.addMethod("IsUrl",function(e){return/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i.test(e)}),this.addMethod("IsRegexMatch",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&new RegExp(t).test(e)}),this.addMethod("Guid",function(e){var t=o.guid.tryParse(e);if(t.error)throw t.msg;return t}),this.addMethod("Min",function(e){if(0===arguments.length)throw"no arguments";if(1===arguments.length&&o.isArray(e)){if(0===e.length)throw"empty sequence";return Math.min.apply(null,e)}return Math.min.apply(null,arguments)}),this.addMethod("Max",function(e){if(0===arguments.length)throw"no arguments";if(1===arguments.length&&o.isArray(e)){if(0===e.length)throw"empty sequence";return Math.max.apply(null,e)}return Math.max.apply(null,arguments)}),this.addMethod("Sum",function(e){if(0===arguments.length)throw"no arguments";var t,n,r=0;if(1===arguments.length&&o.isArray(e)){if(0===e.length)throw"empty sequence";for(t=0,n=e.length;t2&&s.warn(o.string.format("DOM field {0} is ambiguous (unless custom value parser is provided).",e.attr("name"))),e.is(":checked");case"radio":return e.filter(":checked").val();default:return e.length>1&&s.warn(o.string.format("DOM field {0} is ambiguous (unless custom value parser is provided).",e.attr("name"))),e.val()}}(u))||void 0===l||""===l)return null;if(null!==(f=o.tryParse(l,i,d,a))&&void 0!==f&&f.error)throw o.string.format("DOM field {0} value conversion to {1} failed. {2}",d,i,f.msg);return f},deserializeObject:function(e,t,n,r,s,a){function o(e,t,n){var r,i,s,a,o,u,d;for(d=/^([a-z_0-9]+)\[([0-9]+)\]$/i,r=e.split("."),i=n,s=0;s0?r+"\n"+o.string.indent(n.join("\n"),19):r}},a={methods:{},addMethod:function(e,t){var n=this.methods[e];this.methods[e]=function(){return t.length===arguments.length?t.apply(this,arguments):"function"==typeof n?n.apply(this,arguments):t.apply(this,arguments)}},registerMethods:function(e,t){var n,r,i;for(this.initialize(),n=0;nt?1:-1}),this.addMethod("CompareOrdinalIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.CompareOrdinal(e,n)}),this.addMethod("StartsWith",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.slice(0,t.length)===t}),this.addMethod("StartsWithIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.StartsWith(e,n)}),this.addMethod("EndsWith",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.slice(-t.length)===t}),this.addMethod("EndsWithIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.EndsWith(e,n)}),this.addMethod("Contains",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&e.indexOf(t)>-1}),this.addMethod("ContainsIgnoreCase",function(e,n){return e=null!==e&&void 0!==e?e.toLowerCase():null,n=null!==n&&void 0!==n?n.toLowerCase():null,t.methods.Contains(e,n)}),this.addMethod("IsNullOrWhiteSpace",function(e){return null===e||!/\S/.test(e)}),this.addMethod("IsDigitChain",function(e){return/^[0-9]+$/.test(e)}),this.addMethod("IsNumber",function(e){return/^[+-]?(?:(?:[0-9]+)|(?:[0-9]+[eE][+-]?[0-9]+)|(?:[0-9]*\.[0-9]+(?:[eE][+-]?[0-9]+)?))$/.test(e)}),this.addMethod("IsEmail",function(e){return/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(e)}),this.addMethod("IsPhone",function(e){return/^(\+\s?)?((?!\+.*)\(\+?\d+([\s\-\.]?\d+)?\)|\d+)([\s\-\.]?(\(\d+([\s\-\.]?\d+)?\)|\d+))*(\s?(x|ext\.?)\s?\d+)?$/.test(e)}),this.addMethod("IsUrl",function(e){return/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i.test(e)}),this.addMethod("IsRegexMatch",function(e,t){return null!==e&&void 0!==e&&null!==t&&void 0!==t&&new RegExp(t).test(e)}),this.addMethod("Guid",function(e){var t=o.guid.tryParse(e);if(t.error)throw t.msg;return t}),this.addMethod("Min",function(e){if(0===arguments.length)throw"no arguments";if(1===arguments.length&&o.isArray(e)){if(0===e.length)throw"empty sequence";return Math.min.apply(null,e)}return Math.min.apply(null,arguments)}),this.addMethod("Max",function(e){if(0===arguments.length)throw"no arguments";if(1===arguments.length&&o.isArray(e)){if(0===e.length)throw"empty sequence";return Math.max.apply(null,e)}return Math.max.apply(null,arguments)}),this.addMethod("Sum",function(e){if(0===arguments.length)throw"no arguments";var t,n,r=0;if(1===arguments.length&&o.isArray(e)){if(0===e.length)throw"empty sequence";for(t=0,n=e.length;t2&&s.warn(o.string.format("DOM field {0} is ambiguous (unless custom value parser is provided).",e.attr("name"))),e.is(":checked");case"radio":return e.filter(":checked").val();default:return e.length>1&&s.warn(o.string.format("DOM field {0} is ambiguous (unless custom value parser is provided).",e.attr("name"))),e.val()}}(u))||void 0===l||""===l)return null;if(null!==(f=o.tryParse(l,i,d,a))&&void 0!==f&&f.error)throw o.string.format("DOM field {0} value conversion to {1} failed. {2}",d,i,f.msg);return f},deserializeObject:function(e,t,n,r,s,a){function o(e,t,n){var r,i,s,a,o,u,d;for(d=/^([a-z_0-9]+)\[([0-9]+)\]$/i,r=e.split("."),i=n,s=0;s