You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Prowlarr/packages/TelerikMvcExtensions.2011.1.../content/Scripts/2011.1.315/telerik.grid.editing.min.js

1 line
23 KiB

(function(h){var c=h.telerik,j=/^\/Date\((.*?)\)\/$/;var g=function(l){this.formId=l;this._isBuild=false;var n="tUnobtrusiveValidation";var m="tUnobtrusiveContainer";var k=this.unobtrusive={adapters:[],parseElement:function(o,r){var p=h(o),q=p.parents("form")[0],t,s,u;if(!q){return}t=k.validationInfo(q);t.options.rules[o.name]=s={};t.options.messages[o.name]=u={};h.each(this.adapters,function(){var v="data-val-"+this.name,w=p.attr(v),x={};if(w!==undefined){v+="-";h.each(this.params,function(){x[this]=p.attr(v+this)});this.adapt({element:o,form:q,message:w,params:x,rules:s,messages:u})}});if(!r){t.attachValidation()}},parse:function(o){h(o).find(":input[data-val=true]").each(function(){k.parseElement(this,true)});h("form").each(function(){var p=k.validationInfo(this);if(p){p.attachValidation()}})},onError:function(o,r){var q=h(this).find("[data-valmsg-for='"+r[0].name+"']"),p=h.parseJSON(q.attr("data-valmsg-replace"))!==false;q.removeClass("field-validation-valid").addClass("field-validation-error");o.data(m,q);if(p){q.empty();o.removeClass("input-validation-error").appendTo(q)}else{o.hide()}},onErrors:function(o,r){var q=h(this).find("[data-valmsg-summary=true]"),p=q.find("ul");if(p&&p.length&&r.errorList.length){p.empty();q.addClass("validation-summary-errors").removeClass("validation-summary-valid");h.each(r.errorList,function(){h("<li />").html(this.message).appendTo(p)})}},onSuccess:function(o){var q=o.data(m),p=h.parseJSON(q.attr("data-valmsg-replace"));if(q){q.addClass("field-valiion-valid").removeClass("field-validation-error");o.removeData(m);if(p){q.empty()}}},validationInfo:function(o){var q=h(o),p=q.data(n);if(!p){p={options:{errorClass:"input-validation-error",errorElement:"span",errorPlacement:h.proxy(k.onError,o),invalidHandler:h.proxy(k.onErrors,o),messages:{},rules:{},success:h.proxy(k.onSuccess,o)},attachValidation:function(){q.validate(this.options)},validate:function(){q.validate();return q.valid()}};q.data(n,p)}return p}}};g.prototype={build:function(){if(this._isBuild){return}this._isBuild=true;var o=[];function m(r,q,p){r.rules[q]=p;if(r.message){r.messages[q]=r.message}}function n(p){return p.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function l(p){return p.substr(0,p.lastIndexOf(".")+1)}function k(q,p){if(q.indexOf("*.")===0){q=q.replace("*.",p)}return q}o=this.unobtrusive.adapters;o.add=function(r,q,p){if(!p){p=q;q=[]}this.push({name:r,params:q,adapt:p});return this};o.addBool=function(q,p){return this.add(q,function(r){m(r,p||q,true)})};o.addMinMax=function(s,q,u,p,r,t){return this.add(s,[r||"min",t||"max"],function(x){var v=x.params.min,w=x.params.max;if(v&&w){m(x,p,[v,w])}else{if(v){m(x,q,v)}else{if(w){m(x,u,w)}}}})};o.addSingleVal=function(q,r,p){return this.add(q,[r||"val"],function(s){m(s,p||q,s.params[r])})};o.addSingleVal("accept","exts").addSingleVal("regex","pattern");o.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");o.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");o.add("equalto",["other"],function(q){var p=h(q.form).find(":input[name="+q.params.other+"]")[0];m(q,"equalTo",p)});o.add("required",function(p){if(p.element.tagName.toUpperCase()!=="INPUT"||p.element.type.toUpperCase()!=="CHECKBOX"){m(p,"required",true)}});o.add("remote",["url","type","additionalfields"],function(r){var p={url:r.params.url,type:r.params.type||"GET",data:{}},q=l(r.element.name);h.each(n(r.params.additionalfields||r.element.name),function(s,u){var t=k(u,q);p.data[t]=function(){return h(r.form).find(":input[name='"+t+"']").val()}});m(r,"remote",p)});if(h.validator.unobtrusive&&h.validator.unobtrusive.adapters){h.extend(o,h.validator.unobtrusive.adapters)}h.validator.addMethod("regex",function(p,r,q){if(this.optional(r)){return true}var s=new RegExp(q).exec(p);return s&&s.index==0&&s[0].length==p.length});h.validator.addMethod("number",function(p,s){var q=c.cultureInfo.numericgroupsize;var r=new c.stringBuilder();r.cat("^-?(?:\\d+|\\d{1,").cat(q).cat("}(?:").cat(c.cultureInfo.numericgroupseparator).cat("\