nette-forms
Advanced tools
Comparing version 3.3.2 to 3.3.3
{ | ||
"name": "nette-forms", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "Client side script for Nette Forms Component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -141,3 +141,2 @@ /**! | ||
Nette.validateControl = function(elem, rules, onlyCheck, value, emptyOptional) { | ||
var top = !rules; | ||
elem = elem.tagName ? elem : elem[0]; // RadioNodeList | ||
@@ -332,5 +331,4 @@ rules = rules || JSON.parse(elem.getAttribute('data-nette-rules') || '[]'); | ||
dialog.innerText = message + '\n\n'; | ||
dialog.appendChild(style); | ||
dialog.appendChild(button); | ||
document.body.appendChild(dialog); | ||
dialog.append(style, button); | ||
document.body.append(dialog); | ||
dialog.showModal(); | ||
@@ -374,3 +372,3 @@ }; | ||
&& (!Array.isArray(val) || !!val.length) | ||
&& (!window.FileList || !(val instanceof window.FileList) || val.length); | ||
&& (!(val instanceof FileList) || val.length); | ||
}, | ||
@@ -464,3 +462,3 @@ | ||
if (window.FileList && val instanceof FileList) { | ||
if (val instanceof FileList) { | ||
for (var i = 0; i < val.length; i++) { | ||
@@ -501,12 +499,19 @@ if (!regExp.test(val[i].name)) { | ||
min: function(elem, arg, val) { | ||
return arg === null || parseFloat(val) >= arg; | ||
if (Number.isFinite(arg)) { | ||
val = parseFloat(val); | ||
} | ||
return val >= arg; | ||
}, | ||
max: function(elem, arg, val) { | ||
return arg === null || parseFloat(val) <= arg; | ||
if (Number.isFinite(arg)) { | ||
val = parseFloat(val); | ||
} | ||
return val <= arg; | ||
}, | ||
range: function(elem, arg, val) { | ||
return Array.isArray(arg) ? | ||
((arg[0] === null || parseFloat(val) >= arg[0]) && (arg[1] === null || parseFloat(val) <= arg[1])) : null; | ||
return Array.isArray(arg) | ||
? (arg[0] === null || Nette.validators.min(elem, arg[0], val)) && (arg[1] === null || Nette.validators.max(elem, arg[1], val)) | ||
: null; | ||
}, | ||
@@ -519,7 +524,5 @@ | ||
fileSize: function(elem, arg, val) { | ||
if (window.FileList) { | ||
for (var i = 0; i < val.length; i++) { | ||
if (val[i].size > arg) { | ||
return false; | ||
} | ||
for (var i = 0; i < val.length; i++) { | ||
if (val[i].size > arg) { | ||
return false; | ||
} | ||
@@ -537,3 +540,3 @@ } | ||
if (window.FileList && val instanceof FileList) { | ||
if (val instanceof FileList) { | ||
for (i = 0; i < val.length; i++) { | ||
@@ -692,3 +695,3 @@ if (val[i].type && !re.test(val[i].type)) { | ||
elem.setAttribute('type', 'hidden'); | ||
form.appendChild(elem); | ||
form.append(elem); | ||
} | ||
@@ -695,0 +698,0 @@ form.elements[name].value = values[name].join(','); |
@@ -1,22 +0,22 @@ | ||
'use strict';(function(n,e){if(n.JSON)if("function"===typeof define&&define.amd)define(function(){return e(n)});else if("object"===typeof module&&"object"===typeof module.exports)module.exports=e(n);else{var u=!n.Nette||!n.Nette.noInit;n.Nette=e(n);u&&n.Nette.initOnLoad()}})("undefined"!==typeof window?window:this,function(n){var e={},u={},r={},x=new n.WeakMap;e.formErrors=[];e.version="3.3.0";e.invalidNumberMessage="Please enter a valid value.";e.onDocumentReady=function(a){"loading"!==document.readyState? | ||
a.call(this):document.addEventListener("DOMContentLoaded",a)};e.getValue=function(a){var b;if(a){if(a.tagName){if("radio"===a.type){var c=a.form.elements;for(b=0;b<c.length;b++)if(c[b].name===a.name&&c[b].checked)return c[b].value;return null}if("file"===a.type)return a.files||a.value;if("select"===a.tagName.toLowerCase()){b=a.selectedIndex;c=a.options;var d=[];if("select-one"===a.type)return 0>b?null:c[b].value;for(b=0;b<c.length;b++)c[b].selected&&d.push(c[b].value);return d}if(a.name&&"[]"===a.name.substr(-2)){c= | ||
a.form.elements[a.name].tagName?[a]:a.form.elements[a.name];d=[];for(b=0;b<c.length;b++)("checkbox"!==c[b].type||c[b].checked)&&d.push(c[b].value);return d}return"checkbox"===a.type?a.checked:"textarea"===a.tagName.toLowerCase()?a.value.replace("\r",""):a.value.replace("\r","").replace(/^\s+|\s+$/g,"")}return a[0]?e.getValue(a[0]):null}return null};e.getEffectiveValue=function(a,b){var c=e.getValue(a);a.getAttribute&&c===a.getAttribute("data-nette-empty-value")&&(c="");b&&void 0===u[a.name]&&(u[a.name]= | ||
!0,b={value:c},e.validateControl(a,null,!0,b),c=b.value,delete u[a.name]);return c};e.validateControl=function(a,b,c,d,f){a=a.tagName?a:a[0];b=b||JSON.parse(a.getAttribute("data-nette-rules")||"[]");d=void 0===d?{value:e.getEffectiveValue(a)}:d;f=void 0===f?!e.validateRule(a,":filled",null,d):f;for(var g=0,q=b.length;g<q;g++){var h=b[g],k=h.op.match(/(~)?([^?]+)/),p=h.control?a.form.elements.namedItem(h.control):a;h.neg=k[1];h.op=k[2];h.condition=!!h.rules;if(p&&(!f||h.condition||":filled"===h.op)&& | ||
(p=p.tagName?p:p[0],k=e.validateRule(p,h.op,h.arg,a===p?d:void 0),null!==k))if(h.neg&&(k=!k),h.condition&&k){if(!e.validateControl(a,h.rules,c,d,":blank"===h.op?!1:f))return!1}else if(!h.condition&&!k&&!e.isDisabled(p)){if(!c){var w=Array.isArray(h.arg)?h.arg:[h.arg];b=h.msg.replace(/%(value|\d+)/g,function(l,m){return e.getValue("value"===m?p:a.form.elements.namedItem(w[m].control))});e.addError(p,b)}return!1}}return!0};e.validateForm=function(a,b){a=a.form||a;var c=!1;e.formErrors=[];if(a["nette-submittedBy"]&& | ||
null!==a["nette-submittedBy"].getAttribute("formnovalidate"))if(c=JSON.parse(a["nette-submittedBy"].getAttribute("data-nette-validation-scope")||"[]"),c.length)c=new RegExp("^("+c.join("-|")+"-)");else return e.showFormErrors(a,[]),!0;var d={},f;for(f=0;f<a.elements.length;f++){var g=a.elements[f];if(!g.tagName||g.tagName.toLowerCase()in{input:1,select:1,textarea:1,button:1}){if("radio"===g.type){if(d[g.name])continue;d[g.name]=!0}else if("number"===g.type&&g.validity.badInput&&!e.isDisabled(g)){if(b)return!1; | ||
e.addError(g,e.invalidNumberMessage);continue}if(!(c&&!g.name.replace(/]\[|\[|]|$/g,"-").match(c)||e.isDisabled(g)||e.validateControl(g,null,b)||e.formErrors.length))return!1}}b=!e.formErrors.length;e.showFormErrors(a,e.formErrors);return b};e.isDisabled=function(a){if("radio"===a.type){for(var b=0,c=a.form.elements;b<c.length;b++)if(c[b].name===a.name&&!c[b].disabled)return!1;return!0}return a.disabled};e.addError=function(a,b){e.formErrors.push({element:a,message:b})};e.showFormErrors=function(a, | ||
b){a=[];for(var c,d=0;d<b.length;d++){var f=b[d].element,g=b[d].message;0>a.indexOf(g)&&(a.push(g),!c&&f.focus&&(c=f))}a.length&&e.showModal(a.join("\n"),function(){c&&c.focus()})};e.showModal=function(a,b){var c=document.createElement("dialog");if(c.showModal){var d=document.createElement("style");d.innerText=".netteFormsModal { text-align: center; margin: auto; border: 2px solid black; padding: 1rem } .netteFormsModal button { padding: .1em 2em }";var f=document.createElement("button");f.innerText= | ||
"OK";f.onclick=function(){c.remove();b()};c.setAttribute("class","netteFormsModal");c.innerText=a+"\n\n";c.appendChild(d);c.appendChild(f);document.body.appendChild(c);c.showModal()}else alert(a),b()};e.validateRule=function(a,b,c,d){if("number"===a.type&&a.validity.badInput)return"filled"===b;d=void 0===d?{value:e.getEffectiveValue(a,!0)}:d;":"===b.charAt(0)&&(b=b.substr(1));b=b.replace("::","_");b=b.replace(/\\/g,"");for(var f=Array.isArray(c)?c.slice(0):[c],g=0,q=f.length;g<q;g++)if(f[g]&&f[g].control){var h= | ||
a.form.elements.namedItem(f[g].control);f[g]=h===a?d.value:e.getEffectiveValue(h,!0)}return e.validators[b]?e.validators[b](a,Array.isArray(c)?f:f[0],d.value,d):null};e.validators={filled:function(a,b,c){return""!==c&&!1!==c&&null!==c&&(!Array.isArray(c)||!!c.length)&&(!n.FileList||!(c instanceof n.FileList)||c.length)},blank:function(a,b,c){return!e.validators.filled(a,b,c)},valid:function(a){return e.validateControl(a,null,!0)},equal:function(a,b,c){if(void 0===b)return null;a=function(h){return"number"=== | ||
typeof h||"string"===typeof h?""+h:!0===h?"1":""};c=Array.isArray(c)?c:[c];b=Array.isArray(b)?b:[b];var d=0,f=c.length;a:for(;d<f;d++){for(var g=0,q=b.length;g<q;g++)if(a(c[d])===a(b[g]))continue a;return!1}return 0<c.length},notEqual:function(a,b,c){return void 0===b?null:!e.validators.equal(a,b,c)},minLength:function(a,b,c){return c.length>=b},maxLength:function(a,b,c){return c.length<=b},length:function(a,b,c){b=Array.isArray(b)?b:[b,b];return(null===b[0]||c.length>=b[0])&&(null===b[1]||c.length<= | ||
b[1])},email:function(a,b,c){return/^("([ !#-[\]-~]|\\[ -~])+"|[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*)@([0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)+[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?$/i.test(c)},url:function(a,b,c,d){/^[a-z\d+.-]+:/.test(c)||(c="https://"+c);return/^https?:\/\/((([-_0-9a-z\u00C0-\u02FF\u0370-\u1EFF]+\.)*[0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)?[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[[0-9a-f:]{3,39}\])(:\d{1,5})?(\/\S*)?$/i.test(c)? | ||
(d.value=c,!0):!1},regexp:function(a,b,c){a="string"===typeof b?b.match(/^\/(.*)\/([imu]*)$/):!1;try{return a&&(new RegExp(a[1],a[2].replace("u",""))).test(c)}catch(d){}},pattern:function(a,b,c,d,f){if("string"!==typeof b)return null;try{try{var g=new RegExp("^(?:"+b+")$",f?"ui":"u")}catch(q){g=new RegExp("^(?:"+b+")$",f?"i":"")}if(n.FileList&&c instanceof FileList){for(a=0;a<c.length;a++)if(!g.test(c[a].name))return!1;return!0}return g.test(c)}catch(q){}},patternCaseInsensitive:function(a,b,c){return e.validators.pattern(a, | ||
b,c,null,!0)},numeric:function(a,b,c){return/^[0-9]+$/.test(c)},integer:function(a,b,c){return/^-?[0-9]+$/.test(c)},"float":function(a,b,c,d){c=c.replace(/ +/g,"").replace(/,/g,".");return/^-?[0-9]*\.?[0-9]+$/.test(c)?(d.value=c,!0):!1},min:function(a,b,c){return null===b||parseFloat(c)>=b},max:function(a,b,c){return null===b||parseFloat(c)<=b},range:function(a,b,c){return Array.isArray(b)?(null===b[0]||parseFloat(c)>=b[0])&&(null===b[1]||parseFloat(c)<=b[1]):null},submitted:function(a){return a.form["nette-submittedBy"]=== | ||
a},fileSize:function(a,b,c){if(n.FileList)for(a=0;a<c.length;a++)if(c[a].size>b)return!1;return!0},mimeType:function(a,b,c){b=Array.isArray(b)?b:[b];for(var d=0,f=b.length,g=[];d<f;d++)g.push("^"+b[d].replace(/([^\w])/g,"\\$1").replace("\\*",".*")+"$");g=new RegExp(g.join("|"));if(n.FileList&&c instanceof FileList)for(d=0;d<c.length;d++){if(c[d].type&&!g.test(c[d].type))return!1;if(a.validity.badInput)return null}return!0},image:function(a,b,c){return e.validators.mimeType(a,["image/gif","image/png", | ||
"image/jpeg","image/webp"],c)},"static":function(a,b){return b}};e.toggleForm=function(a,b){var c;r={};for(c=0;c<a.elements.length;c++)a.elements[c].tagName.toLowerCase()in{input:1,select:1,textarea:1,button:1}&&e.toggleControl(a.elements[c],null,null,!b);for(c in r)e.toggle(c,r[c].state,r[c].elem,b)};e.toggleControl=function(a,b,c,d,f,g){b=b||JSON.parse(a.getAttribute("data-nette-rules")||"[]");f=void 0===f?{value:e.getEffectiveValue(a)}:f;g=void 0===g?!e.validateRule(a,":filled",null,f):g;for(var q= | ||
!1,h=function(y){e.toggleForm(a.form,y)},k,p=0,w=b.length;p<w;p++){var l=b[p];k=l.op.match(/(~)?([^?]+)/);var m=l.control?a.form.elements.namedItem(l.control):a;l.neg=k[1];l.op=k[2];l.condition=!!l.rules;if(m&&(!g||l.condition||":filled"===l.op)){k=c;if(!1!==c){k=e.validateRule(m,l.op,l.arg,a===m?f:void 0);if(null===k)continue;else l.neg&&(k=!k);l.condition||(c=k)}if(l.condition&&e.toggleControl(a,l.rules,k,d,f,":blank"===l.op?!1:g)||l.toggle){q=!0;if(d){var z=m.tagName?m.name:m[0].name;m=m.tagName? | ||
m.form.elements:m;for(var t=0;t<m.length;t++)m[t].name!==z||x.has(m[t])||(m[t].addEventListener("change",h),x.set(m[t],null))}for(var v in l.toggle||[])r[v]=r[v]||{elem:a},r[v].state=r[v].state||(l.toggle[v]?k:!k)}}}return q};e.toggle=function(a,b,c,d){/^\w[\w.:-]*$/.test(a)&&(a="#"+a);a=document.querySelectorAll(a);for(c=0;c<a.length;c++)a[c].hidden=!b};e.compactCheckboxes=function(a){var b,c={};for(b=0;b<a.elements.length;b++){var d=a.elements[b];if(d.tagName&&"input"===d.tagName.toLowerCase()&& | ||
"checkbox"===d.type){if(d.name&&"[]"===d.name.substr(-2)){var f=d.name.substr(0,d.name.length-2);d.removeAttribute("name");d.setAttribute("data-nette-name",f)}if(f=d.getAttribute("data-nette-name"))c[f]=c[f]||[],d.checked&&!d.disabled&&c[f].push(d.value)}}for(f in c)void 0===a.elements[f]&&(d=document.createElement("input"),d.setAttribute("name",f),d.setAttribute("type","hidden"),a.appendChild(d)),a.elements[f].value=c[f].join(","),a.elements[f].disabled=0===c[f].length};e.initForm=function(a){"get"=== | ||
a.method&&a.hasAttribute("data-nette-compact")&&a.addEventListener("submit",function(){e.compactCheckboxes(a)});a:{for(var b=0;b<a.elements.length;b++)if(a.elements[b].getAttribute("data-nette-rules"))break a;return}e.toggleForm(a);a.noValidate||(a.noValidate=!0,a.addEventListener("submit",function(c){e.validateForm(a)||(c.stopPropagation(),c.preventDefault())}),a.addEventListener("reset",function(){setTimeout(function(){e.toggleForm(a)})}))};e.initOnLoad=function(){e.onDocumentReady(function(){for(var a= | ||
0;a<document.forms.length;a++)e.initForm(document.forms[a]);document.body.addEventListener("click",function(b){for(b=b.target;b;){if(b.form&&b.type in{submit:1,image:1}){b.form["nette-submittedBy"]=b;break}b=b.parentNode}})})};e.webalize=function(a){a=a.toLowerCase();var b="",c;for(c=0;c<a.length;c++){var d=e.webalizeTable[a.charAt(c)];b+=d?d:a.charAt(c)}return b.replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")};e.webalizeTable={"\u00e1":"a","\u00e4":"a","\u010d":"c","\u010f":"d","\u00e9":"e","\u011b":"e", | ||
"\u00ed":"i","\u013e":"l","\u0148":"n","\u00f3":"o","\u00f4":"o","\u0159":"r","\u0161":"s","\u0165":"t","\u00fa":"u","\u016f":"u","\u00fd":"y","\u017e":"z"};return e}); | ||
(function(p,d){if(p.JSON)if("function"===typeof define&&define.amd)define(function(){return d(p)});else if("object"===typeof module&&"object"===typeof module.exports)module.exports=d(p);else{var u=!p.Nette||!p.Nette.noInit;p.Nette=d(p);u&&p.Nette.initOnLoad()}})("undefined"!==typeof window?window:this,function(p){var d={},u={},r={},x=new p.WeakMap;d.formErrors=[];d.version="3.3.0";d.invalidNumberMessage="Please enter a valid value.";d.onDocumentReady=function(a){"loading"!==document.readyState?a.call(this): | ||
document.addEventListener("DOMContentLoaded",a)};d.getValue=function(a){var c;if(a){if(a.tagName){if("radio"===a.type){var b=a.form.elements;for(c=0;c<b.length;c++)if(b[c].name===a.name&&b[c].checked)return b[c].value;return null}if("file"===a.type)return a.files||a.value;if("select"===a.tagName.toLowerCase()){c=a.selectedIndex;b=a.options;var e=[];if("select-one"===a.type)return 0>c?null:b[c].value;for(c=0;c<b.length;c++)b[c].selected&&e.push(b[c].value);return e}if(a.name&&"[]"===a.name.substr(-2)){b= | ||
a.form.elements[a.name].tagName?[a]:a.form.elements[a.name];e=[];for(c=0;c<b.length;c++)("checkbox"!==b[c].type||b[c].checked)&&e.push(b[c].value);return e}return"checkbox"===a.type?a.checked:"textarea"===a.tagName.toLowerCase()?a.value.replace("\r",""):a.value.replace("\r","").replace(/^\s+|\s+$/g,"")}return a[0]?d.getValue(a[0]):null}return null};d.getEffectiveValue=function(a,c){var b=d.getValue(a);a.getAttribute&&b===a.getAttribute("data-nette-empty-value")&&(b="");c&&void 0===u[a.name]&&(u[a.name]= | ||
!0,c={value:b},d.validateControl(a,null,!0,c),b=c.value,delete u[a.name]);return b};d.validateControl=function(a,c,b,e,f){a=a.tagName?a:a[0];c=c||JSON.parse(a.getAttribute("data-nette-rules")||"[]");e=void 0===e?{value:d.getEffectiveValue(a)}:e;f=void 0===f?!d.validateRule(a,":filled",null,e):f;for(var g=0,q=c.length;g<q;g++){var h=c[g],k=h.op.match(/(~)?([^?]+)/),n=h.control?a.form.elements.namedItem(h.control):a;h.neg=k[1];h.op=k[2];h.condition=!!h.rules;if(n&&(!f||h.condition||":filled"===h.op)&& | ||
(n=n.tagName?n:n[0],k=d.validateRule(n,h.op,h.arg,a===n?e:void 0),null!==k))if(h.neg&&(k=!k),h.condition&&k){if(!d.validateControl(a,h.rules,b,e,":blank"===h.op?!1:f))return!1}else if(!h.condition&&!k&&!d.isDisabled(n)){if(!b){var w=Array.isArray(h.arg)?h.arg:[h.arg];c=h.msg.replace(/%(value|\d+)/g,function(l,m){return d.getValue("value"===m?n:a.form.elements.namedItem(w[m].control))});d.addError(n,c)}return!1}}return!0};d.validateForm=function(a,c){a=a.form||a;var b=!1;d.formErrors=[];if(a["nette-submittedBy"]&& | ||
null!==a["nette-submittedBy"].getAttribute("formnovalidate"))if(b=JSON.parse(a["nette-submittedBy"].getAttribute("data-nette-validation-scope")||"[]"),b.length)b=new RegExp("^("+b.join("-|")+"-)");else return d.showFormErrors(a,[]),!0;var e={},f;for(f=0;f<a.elements.length;f++){var g=a.elements[f];if(!g.tagName||g.tagName.toLowerCase()in{input:1,select:1,textarea:1,button:1}){if("radio"===g.type){if(e[g.name])continue;e[g.name]=!0}else if("number"===g.type&&g.validity.badInput&&!d.isDisabled(g)){if(c)return!1; | ||
d.addError(g,d.invalidNumberMessage);continue}if(!(b&&!g.name.replace(/]\[|\[|]|$/g,"-").match(b)||d.isDisabled(g)||d.validateControl(g,null,c)||d.formErrors.length))return!1}}c=!d.formErrors.length;d.showFormErrors(a,d.formErrors);return c};d.isDisabled=function(a){if("radio"===a.type){for(var c=0,b=a.form.elements;c<b.length;c++)if(b[c].name===a.name&&!b[c].disabled)return!1;return!0}return a.disabled};d.addError=function(a,c){d.formErrors.push({element:a,message:c})};d.showFormErrors=function(a, | ||
c){a=[];for(var b,e=0;e<c.length;e++){var f=c[e].element,g=c[e].message;0>a.indexOf(g)&&(a.push(g),!b&&f.focus&&(b=f))}a.length&&d.showModal(a.join("\n"),function(){b&&b.focus()})};d.showModal=function(a,c){var b=document.createElement("dialog");if(b.showModal){var e=document.createElement("style");e.innerText=".netteFormsModal { text-align: center; margin: auto; border: 2px solid black; padding: 1rem } .netteFormsModal button { padding: .1em 2em }";var f=document.createElement("button");f.innerText= | ||
"OK";f.onclick=function(){b.remove();c()};b.setAttribute("class","netteFormsModal");b.innerText=a+"\n\n";b.append(e,f);document.body.append(b);b.showModal()}else alert(a),c()};d.validateRule=function(a,c,b,e){if("number"===a.type&&a.validity.badInput)return"filled"===c;e=void 0===e?{value:d.getEffectiveValue(a,!0)}:e;":"===c.charAt(0)&&(c=c.substr(1));c=c.replace("::","_");c=c.replace(/\\/g,"");for(var f=Array.isArray(b)?b.slice(0):[b],g=0,q=f.length;g<q;g++)if(f[g]&&f[g].control){var h=a.form.elements.namedItem(f[g].control); | ||
f[g]=h===a?e.value:d.getEffectiveValue(h,!0)}return d.validators[c]?d.validators[c](a,Array.isArray(b)?f:f[0],e.value,e):null};d.validators={filled:function(a,c,b){return""!==b&&!1!==b&&null!==b&&(!Array.isArray(b)||!!b.length)&&(!(b instanceof FileList)||b.length)},blank:function(a,c,b){return!d.validators.filled(a,c,b)},valid:function(a){return d.validateControl(a,null,!0)},equal:function(a,c,b){if(void 0===c)return null;a=function(h){return"number"===typeof h||"string"===typeof h?""+h:!0===h?"1": | ||
""};b=Array.isArray(b)?b:[b];c=Array.isArray(c)?c:[c];var e=0,f=b.length;a:for(;e<f;e++){for(var g=0,q=c.length;g<q;g++)if(a(b[e])===a(c[g]))continue a;return!1}return 0<b.length},notEqual:function(a,c,b){return void 0===c?null:!d.validators.equal(a,c,b)},minLength:function(a,c,b){return b.length>=c},maxLength:function(a,c,b){return b.length<=c},length:function(a,c,b){c=Array.isArray(c)?c:[c,c];return(null===c[0]||b.length>=c[0])&&(null===c[1]||b.length<=c[1])},email:function(a,c,b){return/^("([ !#-[\]-~]|\\[ -~])+"|[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*)@([0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)+[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?$/i.test(b)}, | ||
url:function(a,c,b,e){/^[a-z\d+.-]+:/.test(b)||(b="https://"+b);return/^https?:\/\/((([-_0-9a-z\u00C0-\u02FF\u0370-\u1EFF]+\.)*[0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)?[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[[0-9a-f:]{3,39}\])(:\d{1,5})?(\/\S*)?$/i.test(b)?(e.value=b,!0):!1},regexp:function(a,c,b){a="string"===typeof c?c.match(/^\/(.*)\/([imu]*)$/): | ||
!1;try{return a&&(new RegExp(a[1],a[2].replace("u",""))).test(b)}catch(e){}},pattern:function(a,c,b,e,f){if("string"!==typeof c)return null;try{try{var g=new RegExp("^(?:"+c+")$",f?"ui":"u")}catch(q){g=new RegExp("^(?:"+c+")$",f?"i":"")}if(b instanceof FileList){for(a=0;a<b.length;a++)if(!g.test(b[a].name))return!1;return!0}return g.test(b)}catch(q){}},patternCaseInsensitive:function(a,c,b){return d.validators.pattern(a,c,b,null,!0)},numeric:function(a,c,b){return/^[0-9]+$/.test(b)},integer:function(a, | ||
c,b){return/^-?[0-9]+$/.test(b)},"float":function(a,c,b,e){b=b.replace(/ +/g,"").replace(/,/g,".");return/^-?[0-9]*\.?[0-9]+$/.test(b)?(e.value=b,!0):!1},min:function(a,c,b){Number.isFinite(c)&&(b=parseFloat(b));return b>=c},max:function(a,c,b){Number.isFinite(c)&&(b=parseFloat(b));return b<=c},range:function(a,c,b){return Array.isArray(c)?(null===c[0]||d.validators.min(a,c[0],b))&&(null===c[1]||d.validators.max(a,c[1],b)):null},submitted:function(a){return a.form["nette-submittedBy"]===a},fileSize:function(a, | ||
c,b){for(a=0;a<b.length;a++)if(b[a].size>c)return!1;return!0},mimeType:function(a,c,b){c=Array.isArray(c)?c:[c];for(var e=0,f=c.length,g=[];e<f;e++)g.push("^"+c[e].replace(/([^\w])/g,"\\$1").replace("\\*",".*")+"$");g=new RegExp(g.join("|"));if(b instanceof FileList)for(e=0;e<b.length;e++){if(b[e].type&&!g.test(b[e].type))return!1;if(a.validity.badInput)return null}return!0},image:function(a,c,b){return d.validators.mimeType(a,["image/gif","image/png","image/jpeg","image/webp"],b)},"static":function(a, | ||
c){return c}};d.toggleForm=function(a,c){var b;r={};for(b=0;b<a.elements.length;b++)a.elements[b].tagName.toLowerCase()in{input:1,select:1,textarea:1,button:1}&&d.toggleControl(a.elements[b],null,null,!c);for(b in r)d.toggle(b,r[b].state,r[b].elem,c)};d.toggleControl=function(a,c,b,e,f,g){c=c||JSON.parse(a.getAttribute("data-nette-rules")||"[]");f=void 0===f?{value:d.getEffectiveValue(a)}:f;g=void 0===g?!d.validateRule(a,":filled",null,f):g;for(var q=!1,h=function(y){d.toggleForm(a.form,y)},k,n=0, | ||
w=c.length;n<w;n++){var l=c[n];k=l.op.match(/(~)?([^?]+)/);var m=l.control?a.form.elements.namedItem(l.control):a;l.neg=k[1];l.op=k[2];l.condition=!!l.rules;if(m&&(!g||l.condition||":filled"===l.op)){k=b;if(!1!==b){k=d.validateRule(m,l.op,l.arg,a===m?f:void 0);if(null===k)continue;else l.neg&&(k=!k);l.condition||(b=k)}if(l.condition&&d.toggleControl(a,l.rules,k,e,f,":blank"===l.op?!1:g)||l.toggle){q=!0;if(e){var z=m.tagName?m.name:m[0].name;m=m.tagName?m.form.elements:m;for(var t=0;t<m.length;t++)m[t].name!== | ||
z||x.has(m[t])||(m[t].addEventListener("change",h),x.set(m[t],null))}for(var v in l.toggle||[])r[v]=r[v]||{elem:a},r[v].state=r[v].state||(l.toggle[v]?k:!k)}}}return q};d.toggle=function(a,c,b,e){/^\w[\w.:-]*$/.test(a)&&(a="#"+a);a=document.querySelectorAll(a);for(b=0;b<a.length;b++)a[b].hidden=!c};d.compactCheckboxes=function(a){var c,b={};for(c=0;c<a.elements.length;c++){var e=a.elements[c];if(e.tagName&&"input"===e.tagName.toLowerCase()&&"checkbox"===e.type){if(e.name&&"[]"===e.name.substr(-2)){var f= | ||
e.name.substr(0,e.name.length-2);e.removeAttribute("name");e.setAttribute("data-nette-name",f)}if(f=e.getAttribute("data-nette-name"))b[f]=b[f]||[],e.checked&&!e.disabled&&b[f].push(e.value)}}for(f in b)void 0===a.elements[f]&&(e=document.createElement("input"),e.setAttribute("name",f),e.setAttribute("type","hidden"),a.append(e)),a.elements[f].value=b[f].join(","),a.elements[f].disabled=0===b[f].length};d.initForm=function(a){"get"===a.method&&a.hasAttribute("data-nette-compact")&&a.addEventListener("submit", | ||
function(){d.compactCheckboxes(a)});a:{for(var c=0;c<a.elements.length;c++)if(a.elements[c].getAttribute("data-nette-rules"))break a;return}d.toggleForm(a);a.noValidate||(a.noValidate=!0,a.addEventListener("submit",function(b){d.validateForm(a)||(b.stopPropagation(),b.preventDefault())}),a.addEventListener("reset",function(){setTimeout(function(){d.toggleForm(a)})}))};d.initOnLoad=function(){d.onDocumentReady(function(){for(var a=0;a<document.forms.length;a++)d.initForm(document.forms[a]);document.body.addEventListener("click", | ||
function(c){for(c=c.target;c;){if(c.form&&c.type in{submit:1,image:1}){c.form["nette-submittedBy"]=c;break}c=c.parentNode}})})};d.webalize=function(a){a=a.toLowerCase();var c="",b;for(b=0;b<a.length;b++){var e=d.webalizeTable[a.charAt(b)];c+=e?e:a.charAt(b)}return c.replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")};d.webalizeTable={"\u00e1":"a","\u00e4":"a","\u010d":"c","\u010f":"d","\u00e9":"e","\u011b":"e","\u00ed":"i","\u013e":"l","\u0148":"n","\u00f3":"o","\u00f4":"o","\u0159":"r","\u0161":"s", | ||
"\u0165":"t","\u00fa":"u","\u016f":"u","\u00fd":"y","\u017e":"z"};return d}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39028
5
695