From ddb4d5b730a4c9f49ddb7cc0430ae190c69304f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 18 Jul 2022 15:31:14 -0300 Subject: [PATCH] Bump jquery-validation version from 1.19.3 to 1.19.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- js/vendor/jquery/additional-methods.js | 228 ++++++++++++------------- js/vendor/jquery/jquery.validate.js | 52 +++--- package.json | 2 +- yarn.lock | 8 +- 4 files changed, 147 insertions(+), 143 deletions(-) diff --git a/js/vendor/jquery/additional-methods.js b/js/vendor/jquery/additional-methods.js index 908647fd8a..c6a7229185 100644 --- a/js/vendor/jquery/additional-methods.js +++ b/js/vendor/jquery/additional-methods.js @@ -1,21 +1,21 @@ -/*! - * jQuery Validation Plugin v1.19.3 - * - * https://jqueryvalidation.org/ - * - * Copyright (c) 2021 Jörn Zaefferer - * Released under the MIT license - */ -(function( factory ) { - if ( typeof define === "function" && define.amd ) { - define( ["jquery", "./jquery.validate"], factory ); - } else if (typeof module === "object" && module.exports) { - module.exports = factory( require( "jquery" ) ); - } else { - factory( jQuery ); - } -}(function( $ ) { - +/*! + * jQuery Validation Plugin v1.19.5 + * + * https://jqueryvalidation.org/ + * + * Copyright (c) 2022 Jörn Zaefferer + * Released under the MIT license + */ +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + define( ["jquery", "./jquery.validate"], factory ); + } else if (typeof module === "object" && module.exports) { + module.exports = factory( require( "jquery" ) ); + } else { + factory( jQuery ); + } +}(function( $ ) { + ( function() { function stripHtml( value ) { @@ -42,7 +42,7 @@ }, $.validator.format( "Please enter between {0} and {1} words." ) ); }() ); - + /** * This is used in the United States to process payments, deposits, * or transfers using the Automated Clearing House (ACH) or Fedwire @@ -74,7 +74,7 @@ $.validator.addMethod( "abaRoutingNumber", function( value ) { return false; }, "Please enter a valid routing number." ); - + // Accept a value from a file input based on a required mimetype $.validator.addMethod( "accept", function( value, element, param ) { @@ -116,11 +116,11 @@ $.validator.addMethod( "accept", function( value, element, param ) { // browser does not support element.files and the FileList feature return true; }, $.validator.format( "Please enter a value with a valid mimetype." ) ); - + $.validator.addMethod( "alphanumeric", function( value, element ) { return this.optional( element ) || /^\w+$/i.test( value ); -}, "Letters, numbers, and underscores only please" ); - +}, "Letters, numbers, and underscores only please." ); + /* * Dutch bank account numbers (not 'giro' numbers) have 9 digits * and pass the '11 check'. @@ -146,14 +146,14 @@ $.validator.addMethod( "bankaccountNL", function( value, element ) { sum = sum + factor * digit; } return sum % 11 === 0; -}, "Please specify a valid bank account number" ); - +}, "Please specify a valid bank account number." ); + $.validator.addMethod( "bankorgiroaccountNL", function( value, element ) { return this.optional( element ) || ( $.validator.methods.bankaccountNL.call( this, value, element ) ) || ( $.validator.methods.giroaccountNL.call( this, value, element ) ); -}, "Please specify a valid bank or giro account number" ); - +}, "Please specify a valid bank or giro account number." ); + /** * BIC is the business identifier code (ISO 9362). This BIC check is not a guarantee for authenticity. * @@ -171,8 +171,8 @@ $.validator.addMethod( "bankorgiroaccountNL", function( value, element ) { */ $.validator.addMethod( "bic", function( value, element ) { return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() ); -}, "Please specify a valid BIC code" ); - +}, "Please specify a valid BIC code." ); + /* * Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities * Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal @@ -287,7 +287,7 @@ $.validator.addMethod( "cifES", function( value, element ) { return control === control_digit || control === control_letter; }, "Please specify a valid CIF number." ); - + /* * Brazillian CNH number (Carteira Nacional de Habilitacao) is the License Driver number. * CNH numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation. @@ -336,8 +336,8 @@ $.validator.addMethod( "cnhBR", function( value ) { return ( String( firstCN ).concat( secondCN ) === value.substr( -2 ) ); -}, "Please specify a valid CNH number" ); - +}, "Please specify a valid CNH number." ); + /* * Brazillian value number (Cadastrado de Pessoas Juridica). * value numbers have 14 digits in total: 12 numbers followed by 2 check numbers that are being used for validation. @@ -411,8 +411,8 @@ $.validator.addMethod( "cnpjBR", function( value, element ) { return true; -}, "Please specify a CNPJ value number" ); - +}, "Please specify a CNPJ value number." ); + /* * Brazillian CPF number (Cadastrado de Pessoas Físicas) is the equivalent of a Brazilian tax registration number. * CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation. @@ -477,8 +477,8 @@ $.validator.addMethod( "cpfBR", function( value, element ) { } return false; -}, "Please specify a valid CPF number" ); - +}, "Please specify a valid CPF number." ); + // https://jqueryvalidation.org/creditcard-method/ // based on https://en.wikipedia.org/wiki/Luhn_algorithm $.validator.addMethod( "creditcard", function( value, element ) { @@ -519,7 +519,7 @@ $.validator.addMethod( "creditcard", function( value, element ) { return ( nCheck % 10 ) === 0; }, "Please enter a valid credit card number." ); - + /* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator * Redistributed under the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 * Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings) @@ -589,7 +589,7 @@ $.validator.addMethod( "creditcardtypes", function( value, element, param ) { } return false; }, "Please enter a valid credit card number." ); - + /** * Validates currencies with any given symbols by @jameslouiz * Symbols can be optional or required. Symbols required by default @@ -630,12 +630,12 @@ $.validator.addMethod( "currency", function( value, element, param ) { regex = new RegExp( regex ); return this.optional( element ) || regex.test( value ); -}, "Please specify a valid currency" ); - +}, "Please specify a valid currency." ); + $.validator.addMethod( "dateFA", function( value, element ) { return this.optional( element ) || /^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test( value ); }, $.validator.messages.date ); - + /** * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy. * @@ -675,24 +675,24 @@ $.validator.addMethod( "dateITA", function( value, element ) { } return this.optional( element ) || check; }, $.validator.messages.date ); - + $.validator.addMethod( "dateNL", function( value, element ) { return this.optional( element ) || /^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test( value ); }, $.validator.messages.date ); - + // Older "accept" file extension method. Old docs: http://docs.jquery.com/Plugins/Validation/Methods/accept $.validator.addMethod( "extension", function( value, element, param ) { param = typeof param === "string" ? param.replace( /,/g, "|" ) : "png|jpe?g|gif"; return this.optional( element ) || value.match( new RegExp( "\\.(" + param + ")$", "i" ) ); }, $.validator.format( "Please enter a value with a valid extension." ) ); - + /** * Dutch giro account numbers (not bank numbers) have max 7 digits */ $.validator.addMethod( "giroaccountNL", function( value, element ) { return this.optional( element ) || /^[0-9]{1,7}$/.test( value ); -}, "Please specify a valid giro account number" ); - +}, "Please specify a valid giro account number." ); + $.validator.addMethod( "greaterThan", function( value, element, param ) { var target = $( param ); @@ -704,7 +704,7 @@ $.validator.addMethod( "greaterThan", function( value, element, param ) { return value > target.val(); }, "Please enter a greater value." ); - + $.validator.addMethod( "greaterThanEqual", function( value, element, param ) { var target = $( param ); @@ -716,7 +716,7 @@ $.validator.addMethod( "greaterThanEqual", function( value, element, param ) { return value >= target.val(); }, "Please enter a greater value." ); - + /** * IBAN is the international bank account number. * It has a country - specific format, that is checked here too @@ -852,20 +852,20 @@ $.validator.addMethod( "iban", function( value, element ) { cRest = cOperator % 97; } return cRest === 1; -}, "Please specify a valid IBAN" ); - +}, "Please specify a valid IBAN." ); + $.validator.addMethod( "integer", function( value, element ) { return this.optional( element ) || /^-?\d+$/.test( value ); -}, "A positive or negative non-decimal number please" ); - +}, "A positive or negative non-decimal number please." ); + $.validator.addMethod( "ipv4", function( value, element ) { return this.optional( element ) || /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test( value ); }, "Please enter a valid IP v4 address." ); - + $.validator.addMethod( "ipv6", function( value, element ) { return this.optional( element ) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test( value ); }, "Please enter a valid IP v6 address." ); - + $.validator.addMethod( "lessThan", function( value, element, param ) { var target = $( param ); @@ -877,7 +877,7 @@ $.validator.addMethod( "lessThan", function( value, element, param ) { return value < target.val(); }, "Please enter a lesser value." ); - + $.validator.addMethod( "lessThanEqual", function( value, element, param ) { var target = $( param ); @@ -889,15 +889,15 @@ $.validator.addMethod( "lessThanEqual", function( value, element, param ) { return value <= target.val(); }, "Please enter a lesser value." ); - + $.validator.addMethod( "lettersonly", function( value, element ) { return this.optional( element ) || /^[a-z]+$/i.test( value ); -}, "Letters only please" ); - +}, "Letters only please." ); + $.validator.addMethod( "letterswithbasicpunc", function( value, element ) { return this.optional( element ) || /^[a-z\-.,()'"\s]+$/i.test( value ); -}, "Letters or punctuation only please" ); - +}, "Letters or punctuation only please." ); + // Limit the number of files in a FileList. $.validator.addMethod( "maxfiles", function( value, element, param ) { if ( this.optional( element ) ) { @@ -912,7 +912,7 @@ $.validator.addMethod( "maxfiles", function( value, element, param ) { return true; }, $.validator.format( "Please select no more than {0} files." ) ); - + // Limit the size of each individual file in a FileList. $.validator.addMethod( "maxsize", function( value, element, param ) { if ( this.optional( element ) ) { @@ -931,7 +931,7 @@ $.validator.addMethod( "maxsize", function( value, element, param ) { return true; }, $.validator.format( "File size must not exceed {0} bytes each." ) ); - + // Limit the size of all files in a FileList. $.validator.addMethod( "maxsizetotal", function( value, element, param ) { if ( this.optional( element ) ) { @@ -954,16 +954,16 @@ $.validator.addMethod( "maxsizetotal", function( value, element, param ) { return true; }, $.validator.format( "Total size of all files must not exceed {0} bytes." ) ); - + $.validator.addMethod( "mobileNL", function( value, element ) { return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); -}, "Please specify a valid mobile number" ); - +}, "Please specify a valid mobile number." ); + $.validator.addMethod( "mobileRU", function( phone_number, element ) { var ruPhone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || ruPhone_number.length > 9 && /^((\+7|7|8)+([0-9]){10})$/.test( ruPhone_number ); -}, "Please specify a valid mobile number" ); - +}, "Please specify a valid mobile number." ); + /* For UK phone functions, do the following server side processing: * Compare original input with this RegEx pattern: * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ @@ -976,12 +976,12 @@ $.validator.addMethod( "mobileUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ ); -}, "Please specify a valid mobile number" ); - +}, "Please specify a valid mobile number." ); + $.validator.addMethod( "netmask", function( value, element ) { return this.optional( element ) || /^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test( value ); }, "Please enter a valid netmask." ); - + /* * The NIE (Número de Identificación de Extranjero) is a Spanish tax identification number assigned by the Spanish * authorities to any foreigner. @@ -1021,7 +1021,7 @@ $.validator.addMethod( "nieES", function( value, element ) { return validChars.charAt( parseInt( number, 10 ) % 23 ) === letter; }, "Please specify a valid NIE number." ); - + /* * The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals */ @@ -1052,7 +1052,7 @@ $.validator.addMethod( "nifES", function( value, element ) { return false; }, "Please specify a valid NIF number." ); - + /* * Numer identyfikacji podatkowej ( NIP ) is the way tax identification used in Poland for companies */ @@ -1075,7 +1075,7 @@ $.validator.addMethod( "nipPL", function( value ) { return ( intControlNr === parseInt( value[ 9 ], 10 ) ); }, "Please specify a valid NIP number." ); - + /** * Created for project jquery-validation. * @Description Brazillian PIS or NIS number (Número de Identificação Social Pis ou Pasep) is the equivalent of a @@ -1132,16 +1132,16 @@ $.validator.addMethod( "nisBR", function( value ) { } else { return false; } -}, "Please specify a valid NIS/PIS number" ); - +}, "Please specify a valid NIS/PIS number." ); + $.validator.addMethod( "notEqualTo", function( value, element, param ) { return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param ); }, "Please enter a different value, values must not be the same." ); - + $.validator.addMethod( "nowhitespace", function( value, element ) { return this.optional( element ) || /^\S+$/i.test( value ); -}, "No white space please" ); - +}, "No white space please." ); + /** * Return true if the field value matches the given format RegExp * @@ -1164,14 +1164,14 @@ $.validator.addMethod( "pattern", function( value, element, param ) { } return param.test( value ); }, "Invalid format." ); - + /** * Dutch phone numbers have 10 digits (or 11 and start with +31). */ $.validator.addMethod( "phoneNL", function( value, element ) { return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); }, "Please specify a valid phone number." ); - + /** * Polish telephone numbers have 9 digits. * @@ -1194,8 +1194,8 @@ $.validator.addMethod( "phonePL", function( phone_number, element ) { phone_number = phone_number.replace( /\s+/g, "" ); var regexp = /^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/; return this.optional( element ) || regexp.test( phone_number ); -}, "Please specify a valid phone number" ); - +}, "Please specify a valid phone number." ); + /* For UK phone functions, do the following server side processing: * Compare original input with this RegEx pattern: * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ @@ -1210,8 +1210,8 @@ $.validator.addMethod( "phonesUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ ); -}, "Please specify a valid uk phone number" ); - +}, "Please specify a valid uk phone number." ); + /* For UK phone functions, do the following server side processing: * Compare original input with this RegEx pattern: * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ @@ -1224,8 +1224,8 @@ $.validator.addMethod( "phoneUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/ ); -}, "Please specify a valid phone number" ); - +}, "Please specify a valid phone number." ); + /** * Matches US phone number format * @@ -1246,8 +1246,8 @@ $.validator.addMethod( "phoneUS", function( phone_number, element ) { phone_number = phone_number.replace( /\s+/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/ ); -}, "Please specify a valid phone number" ); - +}, "Please specify a valid phone number." ); + /* * Valida CEPs do brasileiros: * @@ -1259,7 +1259,7 @@ $.validator.addMethod( "phoneUS", function( phone_number, element ) { $.validator.addMethod( "postalcodeBR", function( cep_value, element ) { return this.optional( element ) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value ); }, "Informe um CEP válido." ); - + /** * Matches a valid Canadian Postal Code * @@ -1275,22 +1275,22 @@ $.validator.addMethod( "postalcodeBR", function( cep_value, element ) { */ $.validator.addMethod( "postalCodeCA", function( value, element ) { return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test( value ); -}, "Please specify a valid postal code" ); - +}, "Please specify a valid postal code." ); + /* Matches Italian postcode (CAP) */ $.validator.addMethod( "postalcodeIT", function( value, element ) { return this.optional( element ) || /^\d{5}$/.test( value ); -}, "Please specify a valid postal code" ); - +}, "Please specify a valid postal code." ); + $.validator.addMethod( "postalcodeNL", function( value, element ) { return this.optional( element ) || /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test( value ); -}, "Please specify a valid postal code" ); - +}, "Please specify a valid postal code." ); + // Matches UK postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK) $.validator.addMethod( "postcodeUK", function( value, element ) { return this.optional( element ) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test( value ); -}, "Please specify a valid UK postcode" ); - +}, "Please specify a valid UK postcode." ); + /* * Lets you say "at least X inputs that match selector Y must be filled." * @@ -1328,7 +1328,7 @@ $.validator.addMethod( "require_from_group", function( value, element, options ) } return isValid; }, $.validator.format( "Please fill at least {0} of these fields." ) ); - + /* * Lets you say "either at least X inputs that match selector Y must be filled, * OR they must all be skipped (left blank)." @@ -1372,7 +1372,7 @@ $.validator.addMethod( "skip_or_fill_minimum", function( value, element, options } return isValid; }, $.validator.format( "Please either skip these fields or fill at least {0} of them." ) ); - + /* Validates US States and/or Territories by @jdforsythe * Can be case insensitive or require capitalization - default is case insensitive * Can include US Territories or not - default does not @@ -1426,26 +1426,26 @@ $.validator.addMethod( "stateUS", function( value, element, options ) { regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" ); return this.optional( element ) || regex.test( value ); -}, "Please specify a valid state" ); - +}, "Please specify a valid state." ); + // TODO check if value starts with <, otherwise don't try stripping anything $.validator.addMethod( "strippedminlength", function( value, element, param ) { return $( value ).text().length >= param; -}, $.validator.format( "Please enter at least {0} characters" ) ); - +}, $.validator.format( "Please enter at least {0} characters." ) ); + $.validator.addMethod( "time", function( value, element ) { return this.optional( element ) || /^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test( value ); -}, "Please enter a valid time, between 00:00 and 23:59" ); - +}, "Please enter a valid time, between 00:00 and 23:59." ); + $.validator.addMethod( "time12h", function( value, element ) { return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value ); -}, "Please enter a valid time in 12-hour am/pm format" ); - +}, "Please enter a valid time in 12-hour am/pm format." ); + // Same as url, but TLD is optional $.validator.addMethod( "url2", function( value, element ) { - return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value ); + return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?: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-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?)|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff])|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62}\.)))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value ); }, $.validator.messages.url ); - + /** * Return true, if the value is a valid vehicle identification number (VIN). * @@ -1500,13 +1500,13 @@ $.validator.addMethod( "vinUS", function( v ) { } return false; }, "The specified vehicle identification number (VIN) is invalid." ); - + $.validator.addMethod( "zipcodeUS", function( value, element ) { return this.optional( element ) || /^\d{5}(-\d{4})?$/.test( value ); -}, "The specified US ZIP Code is invalid" ); - +}, "The specified US ZIP Code is invalid." ); + $.validator.addMethod( "ziprange", function( value, element ) { return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value ); -}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" ); -return $; +}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx." ); +return $; })); \ No newline at end of file diff --git a/js/vendor/jquery/jquery.validate.js b/js/vendor/jquery/jquery.validate.js index 4d6a863a7a..cd0442eb98 100644 --- a/js/vendor/jquery/jquery.validate.js +++ b/js/vendor/jquery/jquery.validate.js @@ -1,21 +1,21 @@ -/*! - * jQuery Validation Plugin v1.19.3 - * - * https://jqueryvalidation.org/ - * - * Copyright (c) 2021 Jörn Zaefferer - * Released under the MIT license - */ -(function( factory ) { - if ( typeof define === "function" && define.amd ) { - define( ["jquery"], factory ); - } else if (typeof module === "object" && module.exports) { - module.exports = factory( require( "jquery" ) ); - } else { - factory( jQuery ); - } -}(function( $ ) { - +/*! + * jQuery Validation Plugin v1.19.5 + * + * https://jqueryvalidation.org/ + * + * Copyright (c) 2022 Jörn Zaefferer + * Released under the MIT license + */ +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + define( ["jquery"], factory ); + } else if (typeof module === "object" && module.exports) { + module.exports = factory( require( "jquery" ) ); + } else { + factory( jQuery ); + } +}(function( $ ) { + $.extend( $.fn, { // https://jqueryvalidation.org/validate/ @@ -1050,6 +1050,10 @@ $.extend( $.validator, { // meta-characters that should be escaped in order to be used with JQuery // as a literal part of a name/id or any selector. escapeCssMeta: function( string ) { + if ( string === undefined ) { + return ""; + } + return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" ); }, @@ -1126,8 +1130,8 @@ $.extend( $.validator, { } delete this.pending[ element.name ]; $( element ).removeClass( this.settings.pendingClass ); - if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { - $( this.currentForm ).submit(); + if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() && this.pendingRequest === 0 ) { + $( this.currentForm ).trigger( "submit" ); // Remove the hidden input that was used as a replacement for the // missing submit button. The hidden input is added by `handle()` @@ -1232,7 +1236,7 @@ $.extend( $.validator, { // Exception: the jquery validate 'range' method // does not test for the html5 'range' type - rules[ method ] = true; + rules[ type === "date" ? "dateISO" : method ] = true; } }, @@ -1430,7 +1434,7 @@ $.extend( $.validator, { // https://gist.github.com/dperini/729294 // see also https://mathiasbynens.be/demo/url-regex // modified to allow protocol-relative URLs - return this.optional( element ) || /^(?:(?:(?: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-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value ); + return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?: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-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value ); }, // https://jqueryvalidation.org/date-method/ @@ -1617,7 +1621,7 @@ $.extend( $.validator, { } } ); - + // Ajax mode: abort // usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); // if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() @@ -1653,5 +1657,5 @@ if ( $.ajaxPrefilter ) { return ajax.apply( this, arguments ); }; } -return $; +return $; })); \ No newline at end of file diff --git a/package.json b/package.json index 2581f75d27..9d434d82df 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "jquery-ui-dist": "1.13.1", "jquery-ui-timepicker-addon": "1.6.3", "jquery-uitablefilter": "^1.0.0", - "jquery-validation": "1.19.3", + "jquery-validation": "1.19.5", "js-cookie": "2.2.1", "locutus.sprintf": "^2.0.14-code-lts.2", "ol": "6.14.1", diff --git a/yarn.lock b/yarn.lock index 536834a3ee..80b309f385 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3388,10 +3388,10 @@ jquery-uitablefilter@^1.0.0: resolved "https://registry.yarnpkg.com/jquery-uitablefilter/-/jquery-uitablefilter-1.0.0.tgz#ba90c5345826b2fd1fe90ec127826f9e9e7bad39" integrity sha512-iH3k0iiNXKtf6z9qV5htz0iGhSb+Hs9Za6V9GIAOeHdij77U96S2UT7j7FwMEyNZQmgrsKKzjfnLJq7lMGaANw== -jquery-validation@1.19.3: - version "1.19.3" - resolved "https://registry.yarnpkg.com/jquery-validation/-/jquery-validation-1.19.3.tgz#50b350eba8b02bcfd119ba15f199487b7eb64086" - integrity sha512-iXxCS5W7STthSTMFX/NDZfWHBLbJ1behVK3eAgHXAV8/0vRa9M4tiqHvJMr39VGWHMGdlkhrtrkBuaL2UlE8yw== +jquery-validation@1.19.5: + version "1.19.5" + resolved "https://registry.yarnpkg.com/jquery-validation/-/jquery-validation-1.19.5.tgz#557495b7cad79716897057c4447ad3cd76fda811" + integrity sha512-X2SmnPq1mRiDecVYL8edWx+yTBZDyC8ohWXFhXdtqFHgU9Wd4KHkvcbCoIZ0JaSaumzS8s2gXSkP8F7ivg/8ZQ== jquery@3.6.0, jquery@>=1.2.6, jquery@>=1.7, "jquery@>=1.8.0 <4.0.0": version "3.6.0"