All Downloads are FREE. Search and download functionalities are using the official Maven repository.

template.js.base.grid.common.min.js Maven / Gradle / Ivy

'use strict';(function(a){"function"===typeof define&&define.amd?define(["jquery","./grid.base","./jqdnr","./jqmodal"],a):"object"===typeof exports?a(require("jquery")):a(jQuery)})(function(a){var n=a.jgrid,w=a.fn.jqGrid,s=w.getGuiStyles,x=w.getGridRes;n.jqModal=n.jqModal||{};a.extend(!0,n.jqModal,{toTop:!0});a.extend(n,{showModal:function(a){a.w.show()},closeModal:function(a){a.w.hide().attr("aria-hidden","true");a.o&&a.o.remove()},hideModal:function(e,b){b=a.extend({jqm:!0,gb:"",removemodal:!1},
b||{});var c=b.gb&&"string"===typeof b.gb&&"#gbox_"===b.gb.substr(0,6)?a("#"+b.gb.substr(6))[0]:!1,f=a(e);if(b.onClose&&(c=c?b.onClose.call(c,e):b.onClose(e),"boolean"===typeof c&&!c))return;if(a.fn.jqm&&!0===b.jqm)f.attr("aria-hidden","true").jqmHide();else{if(""!==b.gb)try{a("\x3e.jqgrid-overlay",b.gb).first().hide()}catch(l){}f.hide().attr("aria-hidden","true")}b.removemodal&&f.remove()},createModal:function(e,b,c,f,l,k,d){var h=n.jqID,g=this.p,g=null!=g?g.jqModal||{}:{};c=a.extend(!0,{resizingRightBottomIcon:w.getIconRes.call(this,
"form.resizableLtr")},n.jqModal||{},g,c);var g=document.createElement("div"),m="#"+h(e.themodal),q="rtl"===a(c.gbox).attr("dir")?!0:!1,r=e.resizeAlso?"#"+h(e.resizeAlso):!1;d=a.extend({},d||{});g.className=s.call(this,"dialog.window","ui-jqdialog");g.id=e.themodal;g.dir=q?"rtl":"ltr";var p=document.createElement("div");p.className=s.call(this,"dialog.document");a(p).attr("role","document");var y=document.createElement("div");y.className=s.call(this,"dialog.subdocument");p.appendChild(y);g.appendChild(p);
p=document.createElement("div");p.className=s.call(this,"dialog.header","ui-jqdialog-titlebar "+(q?"ui-jqdialog-titlebar-rtl":"ui-jqdialog-titlebar-ltr"));p.id=e.modalhead;a(p).append("\x3cspan class\x3d'ui-jqdialog-title'\x3e"+c.caption+"\x3c/span\x3e");var u=s.call(this,"states.hover"),t=a("\x3ca aria-label\x3d'Close' class\x3d'"+s.call(this,"dialog.closeButton","ui-jqdialog-titlebar-close")+"'\x3e\x3c/a\x3e").hover(function(){t.addClass(u)},function(){t.removeClass(u)}).append("\x3cspan class\x3d'"+
w.getIconRes.call(this,"form.close")+"'\x3e\x3c/span\x3e");a(p).append(t);q=document.createElement("div");a(q).addClass(s.call(this,"dialog.content","ui-jqdialog-content")).attr("id",e.modalcontent);a(q).append(b);y.appendChild(q);a(y).prepend(p);!0===k?a("body").append(g):"string"===typeof k?a(k).append(g):a(g).insertBefore(f);a(g).css(d);void 0===c.jqModal&&(c.jqModal=!0);b={};if(a.fn.jqm&&!0===c.jqModal)0===c.left&&0===c.top&&c.overlay&&(c=a(l).offset(),c.left+=4,c.top+=4),b.top=c.top+"px",b.left=
c.left;else if(0!==c.left||0!==c.top)b.left=c.left,b.top=c.top+"px";a("a.ui-jqdialog-titlebar-close",p).click(function(){var b=a(m).data("onClose")||c.onClose,e=a(m).data("gbox")||c.gbox;n.hideModal(m,{gb:e,jqm:c.jqModal,onClose:b,removemodal:c.removemodal||!1});return!1});0!==c.width&&c.width||(c.width=300);0!==c.height&&c.height||(c.height=200);c.zIndex||((f=a(f).parents("*[role\x3ddialog]").first().css("z-index"))?(c.zIndex=parseInt(f,10)+2,c.toTop=!0):c.zIndex=950);b.left&&(b.left+="px");a(g).css(a.extend({width:isNaN(c.width)?
"auto":c.width+"px",height:isNaN(c.height)?"auto":c.height+"px",zIndex:c.zIndex},b)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":e.modalhead,"aria-hidden":"true"});void 0===c.drag&&(c.drag=!0);void 0===c.resize&&(c.resize=!0);if(c.drag)if(a.fn.jqDrag)a(p).css("cursor","move"),a(g).jqDrag(p);else try{a(g).draggable({handle:a("#"+h(p.id))})}catch(v){}if(c.resize)if(a.fn.jqResize)a(q).append("\x3cdiv class\x3d'jqResize ui-resizable-handle ui-resizable-se "+c.resizingRightBottomIcon+"'\x3e\x3c/div\x3e"),
a(m).jqResize(".jqResize",r);else try{a(g).resizable({handles:"se, sw",alsoResize:r})}catch(z){}!0===c.closeOnEscape&&a(g).keydown(function(b){27===b.which&&(b=a(m).data("onClose")||c.onClose,n.hideModal(m,{gb:c.gbox,jqm:c.jqModal,onClose:b,removemodal:c.removemodal||!1,formprop:!c.recreateForm||!1,form:c.form||""}))})},viewModal:function(e,b){b=a.extend(!0,{overlay:30,modal:!1,overlayClass:s.call(this,"overlay"),onShow:n.showModal,onHide:n.closeModal,gbox:"",jqm:!0,jqM:!0},n.jqModal||{},b||{});if(a.fn.jqm&&
!0===b.jqm)b.jqM?a(e).attr("aria-hidden","false").jqm(b).jqmShow():a(e).attr("aria-hidden","false").jqmShow();else{""!==b.gbox&&(a("\x3e.jqgrid-overlay",b.gbox).first().show(),a(e).data("gbox",b.gbox));a(e).show().attr("aria-hidden","false");try{a(":input:visible",e)[0].focus()}catch(c){}}},info_dialog:function(e,b,c,f){var l=this,k=l.p,d=a.extend(!0,{width:290,height:"auto",dataheight:"auto",drag:!0,resize:!1,left:250,top:170,zIndex:1E3,jqModal:!0,modal:!1,closeOnEscape:!0,align:"center",buttonalign:"center",
buttons:[]},n.jqModal||{},null!=k?k.jqModal||{}:{},{caption:"\x3cb\x3e"+e+"\x3c/b\x3e"},f||{}),h=d.jqModal;a.fn.jqm&&!h&&(h=!1);e="";var g=s.call(l,"states.hover");if(0l.search(/(false|f|0|no|n|off|undefined)/i)&&""!==l?(d.checked=!0,d.defaultChecked=
!0,d.value=c):d.value="on",a(d).data("offval","off"));k(d,b,["value"]);a(d).attr({role:"checkbox","aria-checked":d.checked?"true":"false"});break;case "select":d=document.createElement("select");m=[];e=null;!0===b.multiple?(f=!0,d.multiple="multiple",a(d).attr("aria-multiselectable","true"),m=c.split(","),m=a.map(m,function(b){return a.trim(b)})):(f=!1,m[0]=a.trim(c));void 0===b.size&&(b.size=f?3:1);try{e=b.rowId}catch(s){}g&&g.idPrefix&&(e=n.stripPref(g.idPrefix,e));if(void 0!==b.dataUrl){var u=
b.postData||l.postData,g={elem:d,options:b,cm:b.cm,mode:b.mode,rowid:e,iCol:b.iCol,ovm:m};a.ajax(a.extend({url:a.isFunction(b.dataUrl)?b.dataUrl.call(h,e,c,String(b.name),g):b.dataUrl,type:"GET",dataType:"html",data:a.isFunction(u)?u.call(h,e,c,String(b.name)):u,context:g,success:function(b,c,e){var d=this.ovm,f=this.elem,g=this.cm,l=this.iCol,m=a.extend({},this.options),p=this.rowid,q=this.mode;b=a.isFunction(m.buildSelect)?m.buildSelect.call(h,b,e,g,l):b;"string"===typeof b&&(b=a(a.trim(b)).html());
b&&(a(f).append(b),k(f,m,u?["postData"]:void 0),setTimeout(function(){var b;a("option",f).each(function(c){0===c&&f.multiple&&(this.selected=!1);-1g.length||1>c[a[d]]||12g.length||1>c[a[f]]||31(0!==l%4||0===l%100&&0!==l%400?28:29));return k||c[a[f]]>h[c[a[d]]]?!1:!0},
isEmpty:function(a){return a.match(/^\s+$/)||""===a?!0:!1},checkTime:function(a){var b=/^(\d{1,2}):(\d{2})([apAP][Mm])?$/;if(!n.isEmpty(a))if(a=a.match(b)){if(a[3]){if(1>a[1]||12b)return[!0,"",""];
f=d[b];c=f.editrules;null!=f.formoptions&&(k=f.formoptions.label)}else k=void 0===f?"_":f,f=d[b];if(c){k||(k=null!=h.colNames?h.colNames[b]:f.label);if(!0===c.required&&g(e))return[!1,k+": "+m.required,""];h=!1===c.required?!1:!0;if(!0===c.number&&(!1!==h||!g(e))&&isNaN(e))return[!1,k+": "+m.number,""];if(void 0!==c.minValue&&!isNaN(c.minValue)&&parseFloat(e)parseFloat(c.maxValue))return[!1,
k+": "+m.maxValue+" "+c.maxValue,""];var r;if(!(!0!==c.email||!1===h&&g(e)||(r=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([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])))\.?$/i,
r.test(e))))return[!1,k+": "+m.email,""];if(!(!0!==c.integer||!1===h&&g(e)||!isNaN(e)&&0===e%1&&-1===e.indexOf(".")))return[!1,k+": "+m.integer,""];if(!(!0!==c.date||!1===h&&g(e)||(f.formatoptions&&f.formatoptions.newformat?(d=f.formatoptions.newformat,q.hasOwnProperty(d)&&(d=q[d])):d=d[b].datefmt||"Y-m-d",n.checkDate(d,e))))return[!1,k+": "+m.date+" - "+d,""];if(!0===c.time&&!(!1===h&&g(e)||n.checkTime(e)))return[!1,k+": "+m.date+" - hh:mm (am/pm)",""];if(!(!0!==c.url||!1===h&&g(e)||(r=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i,
r.test(e))))return[!1,k+": "+m.url,""];if(!0===c.custom){if(!1!==h||!g(e))return a.isFunction(c.custom_func)?(e=c.custom_func.call(this,e,k,b),a.isArray(e)?e:[!1,m.customarray,""]):[!1,m.customfcheck,""]}else if(a.isFunction(c.custom)&&(!1!==h||!g(e)))return e=c.custom.call(this,l),a.isArray(e)?e:[!1,m.customarray,""]}return[!0,"",""]}})});




© 2015 - 2025 Weber Informatics LLC | Privacy Policy