zk.load("zul.lang.msgzul*"); zul={}; zul._movs={}; zul.initMovable=function(_1,_2){ zul._movs[_1.id]=new Draggable(_1,_2); }; zul.cleanMovable=function(id){ if(zul._movs[id]){ zul._movs[id].destroy(); delete zul._movs[id]; } }; zulHdrs={}; zulHdrs.setAttr=function(_4,nm,_6){ zkau.setAttr(_4,nm,_6); if(nm=="z.sizable"){ var _7=_4.cells; if(_7){ var _8=_6=="true"; for(var j=0;j zulHdr.setSizable(_7[j],_8); } } } return true; }; zulHdr={}; zulHdr._szs={}; zulHdr.init=function(_a){ zulHdr._show(_a); zk.listen(_a,"click",function(_b){ zulHdr.onclick(_b,_a); }); zk.listen(_a,"mousemove",function(_c){ if(window.zulHdr){ zulHdr.onmove(_c,_a); } }); zulHdr.setSizable(_a,zulHdr.sizable(_a)); }; zulHdr.sizable=function(_d){ return _d.parentNode&&getZKAttr(_d.parentNode,"sizable")=="true"; }; zulHdr.setSizable=function(_e,_f){ var id=_e.id; if(_f){ if(!zulHdr._szs[id]){ var _11=function(x,y){ return zulHdr._snap(_e,x,y); }; zulHdr._szs[id]=new Draggable(_e,{starteffect:zk.voidf,endeffect:zulHdr._endsizing,ghosting:zulHdr._ghostsizing,revert:true,ignoredrag:zulHdr._ignoresizing,snap:_11,constraint:"horizontal"}); } }else{ if(zulHdr._szs[id]){ zulHdr._szs[id].destroy(); delete zulHdr._szs[id]; } } }; zulHdr.resizeAll=function(_14,cmp,_16,col,wd,_19){ if(_14.paging){ return; } _14.bodytbl.style.width=_14.headtbl.style.width; wd=$int(wd); if(_14.foottbl){ _14.foottbl.style.width=_14.headtbl.style.width; if(_14.foottbl.rows.length){ var _1a=_14.foottbl.rows[0].cells; if(_16 var rwd=zk.revisedSize(_1a[_16],wd); _1a[_16].style.width=rwd+"px"; var _1c=$e($uuid(_1a[_16])+"!cave"); rwd=zk.revisedSize(_1c,rwd); _1c.style.width=rwd+"px"; } } } var _1d; for(var j=0;j var _1f=$type(_14.headtbl.rows[j]); if(_1f=="Cols"||_1f=="Lhrs"||_1f=="Tcols"){ _1d=_14.headtbl.rows[j]; break; } } zk.cpCellWidth(_1d,_14.bodyrows,_14); var _20=$e(_1d.id+"!fake"); if(!_20||_20.cells.length!=_1d.cells.length){ if(_20){ _20.parentNode.removeChild(_20); } var src=document.createElement("TR"); src.id=_1d.id+"!fake"; src.style.height="0px"; for(var j=0;j src.appendChild(document.createElement("TD")); } _14.headtbl.rows[0].parentNode.insertBefore(src,_14.headtbl.rows[0]); } var row=_14.headtbl.rows[0]; var _1a=row.cells; for(var k=0,z=0;k var s=_1a[k],d=_1d.cells[k]; var w=d.style.width; if(!w||w=="auto"||w.indexOf("%")>-1){ d.style.width=zk.revisedSize(d,d.offsetWidth)+"px"; setZKAttr(d,"wd","NaN"); } w=d.style.width; s.style.width=$int(w)+zk.sumStyles(d,"lr",zk.borders)+zk.sumStyles(d,"lr",zk.paddings)+"px"; } zkau.send({uuid:_14.id,cmd:"onInnerWidth",data:[_14.headtbl.style.width]},-1); wd=zk.revisedSize(_1d.cells[_16],wd)+"px"; zkau.send({uuid:cmp.id,cmd:"onColSize",data:[_16,col.id,wd,_19]},zkau.asapTimeout(cmp,"onColSize")); }; zulHdr.cleanup=function(cmp){ zulHdr.setSizable(cmp,false); }; zulHdr.setAttr=function(cmp,nm,val){ switch(nm){ case "style.width": var _2c=$type(cmp),_2d; if(_2c=="Col"){ _2d=$parentByType(cmp,"Grid"); }else{ if(_2c=="Lhr"){ _2d=$parentByType(cmp,"Libox"); }else{ if(_2c=="Tcol"){ _2d=$parentByType(cmp,"Tree"); } } } case "style.height": case "style": var _2e=cmp.parentNode; var _2f=$e(_2e.id+"!fake"); var _30=$e(cmp.id+"!cave"); var v=val; if(nm=="style"){ v=zk.getTextStyle(val,true,true); } if(v){ if(nm=="style.width"){ v=zk.revisedSize(_30,$int(v))+"px"; } zkau.setAttr(_30,nm,v); } zkau.setAttr(cmp,nm,val); if(nm=="style.width"&&_2f){ var wd; if(!val||val=="auto"||val.indexOf("%")>=0){ wd=cmp.offsetWidth+"px"; }else{ wd=$int(val)+zk.sumStyles(cmp,"lr",zk.borders)+zk.sumStyles(cmp,"lr",zk.paddings)+"px"; } _2f.cells[cmp.cellIndex].style.width=wd; } var _33=zkau.getMeta(_2d); if(_33){ _33.init(); } return true; } zkau.setAttr(cmp,nm,val); if(nm=="z.sort"){ zulHdr._show(cmp); } return true; }; zulHdr.onclick=function(evt,cmp){ if(!zk.dragging&&zulHdr._sortable(cmp)&&zkau.insamepos(evt)){ zkau.send({uuid:cmp.id,cmd:"onSort",data:null},10); } }; zulHdr.onmove=function(evt,cmp){ if(zk.dragging){ return; } var ofs=zk.revisedOffset(cmp); var v=zulHdr._insizer(cmp,Event.pointerX(evt)-ofs[0]); if(v){ zk.backupStyle(cmp,"cursor"); cmp.style.cursor=v==1?"e-resize":"w-resize"; }else{ zk.restoreStyle(cmp,"cursor"); } }; zulHdr.ignoredrag=function(cmp,_3b){ var ofs=zk.revisedOffset(cmp); return zulHdr._insizer(cmp,_3b[0]-ofs[0]); }; zulHdr._insizer=function(cmp,x){ if(zulHdr.sizable(cmp)){ if(x>=cmp.offsetWidth-10){ return 1; } } return 0; }; zulHdr._ignoresizing=function(cmp,_40){ var dg=zulHdr._szs[cmp.id]; if(dg){ var ofs=zk.revisedOffset(cmp); var v=zulHdr._insizer(cmp,_40[0]-ofs[0]); if(v){ dg.z_min=5+zk.sumStyles(cmp,"lr",zk.borders)+zk.sumStyles(cmp,"lr",zk.paddings); return false; } } return true; }; zulHdr._endsizing=function(cmp,evt){ var dg=zulHdr._szs[cmp.id]; if(dg&&dg.z_szofs){ var _47=cmp.parentNode.cells,j=0; for(;;++j){ if(j>=_47.length){ return; } if(cmp==_47[j]){ break; } } var _49=""; if(evt){ if(evt.altKey){ _49+="a"; } if(evt.ctrlKey){ _49+="c"; } if(evt.shiftKey){ _49+="s"; } } var wd=dg.z_szofs; var rwd=zk.safari?wd:zk.revisedSize(cmp,wd); var _4c=$parentByTag(cmp,"TABLE"); var _4d; for(var j=0;j var _4e=$type(_4c.rows[j]); if(_4e=="Cols"||_4e=="Lhrs"||_4e=="Tcols"){ _4d=_4c.rows[j]; break; } } var _47=_4d.cells; var _4f=0; for(var k=0;k if(_47[k]!=cmp){ _4f+=_47[k].offsetWidth; } } var row=_4c.rows[0]; row.cells[cmp.cellIndex].style.width=$int(rwd)+zk.sumStyles(cmp,"lr",zk.borders)+zk.sumStyles(cmp,"lr",zk.paddings)+"px"; cmp.style.width=rwd+"px"; var _52=$uuid(cmp); var _53=$e(_52+"!cave"); _53.style.width=zk.revisedSize(_53,rwd)+"px"; _4c.style.width=_4f+wd+"px"; setTimeout("zk.eval($e('"+cmp.id+"'),'resize',null,"+cmp.cellIndex+",'"+wd+"','"+_49+"')",0); } }; zulHdr._ghostsizing=function(dg,_55,_56){ if(_55){ var el=dg.element.parentNode.parentNode.parentNode; var of=zk.revisedOffset(el); var ofs=zkau.beginGhostToDIV(dg); ofs[1]=of[1]; var _5a=$parentByTag(dg.element,"DIV"); ofs[0]+=zk.offsetWidth(dg.element); document.body.insertAdjacentHTML("afterbegin",""); dg.element=$e("zk_ddghost"); }else{ var org=zkau.getGhostOrgin(dg); if(org){ var _5c=zk.revisedOffset(dg.element); var _5d=zk.revisedOffset(org); dg.z_szofs=_5c[0]-_5d[0]; }else{ dg.z_szofs=0; } zkau.endGhostToDIV(dg); } }; zulHdr._snap=function(cmp,x,y){ var dg=zulHdr._szs[cmp.id]; if(dg){ var ofs=zk.revisedOffset(cmp); x+=zk.offsetWidth(cmp); if(ofs[0]+dg.z_min>=x){ x=ofs[0]+dg.z_min; } } return [x,y]; }; zulHdr._sortable=function(cmp){ return getZKAttr(cmp,"asc")||getZKAttr(cmp,"dsc"); }; zulHdr._show=function(cmp){ switch(getZKAttr(cmp,"sort")){ case "ascending": zulHdr._renCls(cmp,"asc"); break; case "descending": zulHdr._renCls(cmp,"dsc"); break; case "natural": zulHdr._renCls(cmp); break; } }; zulHdr._renCls=function(cmp,ext){ var _67=cmp.className||""; if(_67.endsWith("-asc")||_67.endsWith("-dsc")){ _67=_67.substring(0,_67.length-4); } if(ext){ _67+="-"+ext; } if(_67!=cmp.className){ cmp.className=_67; } };