14304 lines
382 KiB
JavaScript
14304 lines
382 KiB
JavaScript
/**
|
|
* jQuery EasyUI 1.4.4
|
|
*
|
|
* Copyright (c) 2009-2015 www.jeasyui.com. All rights reserved.
|
|
*
|
|
* Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php
|
|
* To use it on other terms please contact us: info@jeasyui.com
|
|
*
|
|
*/
|
|
(function($){
|
|
$.parser={auto:true,onComplete:function(_1){
|
|
},plugins:["draggable","droppable","resizable","pagination","tooltip","linkbutton","menu","menubutton","splitbutton","switchbutton","progressbar","tree","textbox","filebox","combo","combobox","combotree","combogrid","numberbox","validatebox","searchbox","spinner","numberspinner","timespinner","datetimespinner","calendar","datebox","datetimebox","slider","layout","panel","datagrid","propertygrid","treegrid","datalist","tabs","accordion","window","dialog","form"],parse:function(_2){
|
|
var aa=[];
|
|
for(var i=0;i<$.parser.plugins.length;i++){
|
|
var _3=$.parser.plugins[i];
|
|
var r=$(".easyui-"+_3,_2);
|
|
if(r.length){
|
|
if(r[_3]){
|
|
r[_3]();
|
|
}else{
|
|
aa.push({name:_3,jq:r});
|
|
}
|
|
}
|
|
}
|
|
if(aa.length&&window.easyloader){
|
|
var _4=[];
|
|
for(var i=0;i<aa.length;i++){
|
|
_4.push(aa[i].name);
|
|
}
|
|
easyloader.load(_4,function(){
|
|
for(var i=0;i<aa.length;i++){
|
|
var _5=aa[i].name;
|
|
var jq=aa[i].jq;
|
|
jq[_5]();
|
|
}
|
|
$.parser.onComplete.call($.parser,_2);
|
|
});
|
|
}else{
|
|
$.parser.onComplete.call($.parser,_2);
|
|
}
|
|
},parseValue:function(_6,_7,_8,_9){
|
|
_9=_9||0;
|
|
var v=$.trim(String(_7||""));
|
|
var _a=v.substr(v.length-1,1);
|
|
if(_a=="%"){
|
|
v=parseInt(v.substr(0,v.length-1));
|
|
if(_6.toLowerCase().indexOf("width")>=0){
|
|
v=Math.floor((_8.width()-_9)*v/100);
|
|
}else{
|
|
v=Math.floor((_8.height()-_9)*v/100);
|
|
}
|
|
}else{
|
|
v=parseInt(v)||undefined;
|
|
}
|
|
return v;
|
|
},parseOptions:function(_b,_c){
|
|
var t=$(_b);
|
|
var _d={};
|
|
var s=$.trim(t.attr("data-options"));
|
|
if(s){
|
|
if(s.substring(0,1)!="{"){
|
|
s="{"+s+"}";
|
|
}
|
|
_d=(new Function("return "+s))();
|
|
}
|
|
$.map(["width","height","left","top","minWidth","maxWidth","minHeight","maxHeight"],function(p){
|
|
var pv=$.trim(_b.style[p]||"");
|
|
if(pv){
|
|
if(pv.indexOf("%")==-1){
|
|
pv=parseInt(pv)||undefined;
|
|
}
|
|
_d[p]=pv;
|
|
}
|
|
});
|
|
if(_c){
|
|
var _e={};
|
|
for(var i=0;i<_c.length;i++){
|
|
var pp=_c[i];
|
|
if(typeof pp=="string"){
|
|
_e[pp]=t.attr(pp);
|
|
}else{
|
|
for(var _f in pp){
|
|
var _10=pp[_f];
|
|
if(_10=="boolean"){
|
|
_e[_f]=t.attr(_f)?(t.attr(_f)=="true"):undefined;
|
|
}else{
|
|
if(_10=="number"){
|
|
_e[_f]=t.attr(_f)=="0"?0:parseFloat(t.attr(_f))||undefined;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$.extend(_d,_e);
|
|
}
|
|
return _d;
|
|
}};
|
|
$(function(){
|
|
var d=$("<div style=\"position:absolute;top:-1000px;width:100px;height:100px;padding:5px\"></div>").appendTo("body");
|
|
$._boxModel=d.outerWidth()!=100;
|
|
d.remove();
|
|
d=$("<div style=\"position:fixed\"></div>").appendTo("body");
|
|
$._positionFixed=(d.css("position")=="fixed");
|
|
d.remove();
|
|
if(!window.easyloader&&$.parser.auto){
|
|
$.parser.parse();
|
|
}
|
|
});
|
|
$.fn._outerWidth=function(_11){
|
|
if(_11==undefined){
|
|
if(this[0]==window){
|
|
return this.width()||document.body.clientWidth;
|
|
}
|
|
return this.outerWidth()||0;
|
|
}
|
|
return this._size("width",_11);
|
|
};
|
|
$.fn._outerHeight=function(_12){
|
|
if(_12==undefined){
|
|
if(this[0]==window){
|
|
return this.height()||document.body.clientHeight;
|
|
}
|
|
return this.outerHeight()||0;
|
|
}
|
|
return this._size("height",_12);
|
|
};
|
|
$.fn._scrollLeft=function(_13){
|
|
if(_13==undefined){
|
|
return this.scrollLeft();
|
|
}else{
|
|
return this.each(function(){
|
|
$(this).scrollLeft(_13);
|
|
});
|
|
}
|
|
};
|
|
$.fn._propAttr=$.fn.prop||$.fn.attr;
|
|
$.fn._size=function(_14,_15){
|
|
if(typeof _14=="string"){
|
|
if(_14=="clear"){
|
|
return this.each(function(){
|
|
$(this).css({width:"",minWidth:"",maxWidth:"",height:"",minHeight:"",maxHeight:""});
|
|
});
|
|
}else{
|
|
if(_14=="fit"){
|
|
return this.each(function(){
|
|
_16(this,this.tagName=="BODY"?$("body"):$(this).parent(),true);
|
|
});
|
|
}else{
|
|
if(_14=="unfit"){
|
|
return this.each(function(){
|
|
_16(this,$(this).parent(),false);
|
|
});
|
|
}else{
|
|
if(_15==undefined){
|
|
return _17(this[0],_14);
|
|
}else{
|
|
return this.each(function(){
|
|
_17(this,_14,_15);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
return this.each(function(){
|
|
_15=_15||$(this).parent();
|
|
$.extend(_14,_16(this,_15,_14.fit)||{});
|
|
var r1=_18(this,"width",_15,_14);
|
|
var r2=_18(this,"height",_15,_14);
|
|
if(r1||r2){
|
|
$(this).addClass("easyui-fluid");
|
|
}else{
|
|
$(this).removeClass("easyui-fluid");
|
|
}
|
|
});
|
|
}
|
|
function _16(_19,_1a,fit){
|
|
if(!_1a.length){
|
|
return false;
|
|
}
|
|
var t=$(_19)[0];
|
|
var p=_1a[0];
|
|
var _1b=p.fcount||0;
|
|
if(fit){
|
|
if(!t.fitted){
|
|
t.fitted=true;
|
|
p.fcount=_1b+1;
|
|
$(p).addClass("panel-noscroll");
|
|
if(p.tagName=="BODY"){
|
|
$("html").addClass("panel-fit");
|
|
}
|
|
}
|
|
return {width:($(p).width()||1),height:($(p).height()||1)};
|
|
}else{
|
|
if(t.fitted){
|
|
t.fitted=false;
|
|
p.fcount=_1b-1;
|
|
if(p.fcount==0){
|
|
$(p).removeClass("panel-noscroll");
|
|
if(p.tagName=="BODY"){
|
|
$("html").removeClass("panel-fit");
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
function _18(_1c,_1d,_1e,_1f){
|
|
var t=$(_1c);
|
|
var p=_1d;
|
|
var p1=p.substr(0,1).toUpperCase()+p.substr(1);
|
|
var min=$.parser.parseValue("min"+p1,_1f["min"+p1],_1e);
|
|
var max=$.parser.parseValue("max"+p1,_1f["max"+p1],_1e);
|
|
var val=$.parser.parseValue(p,_1f[p],_1e);
|
|
var _20=(String(_1f[p]||"").indexOf("%")>=0?true:false);
|
|
if(!isNaN(val)){
|
|
var v=Math.min(Math.max(val,min||0),max||99999);
|
|
if(!_20){
|
|
_1f[p]=v;
|
|
}
|
|
t._size("min"+p1,"");
|
|
t._size("max"+p1,"");
|
|
t._size(p,v);
|
|
}else{
|
|
t._size(p,"");
|
|
t._size("min"+p1,min);
|
|
t._size("max"+p1,max);
|
|
}
|
|
return _20||_1f.fit;
|
|
};
|
|
function _17(_21,_22,_23){
|
|
var t=$(_21);
|
|
if(_23==undefined){
|
|
_23=parseInt(_21.style[_22]);
|
|
if(isNaN(_23)){
|
|
return undefined;
|
|
}
|
|
if($._boxModel){
|
|
_23+=_24();
|
|
}
|
|
return _23;
|
|
}else{
|
|
if(_23===""){
|
|
t.css(_22,"");
|
|
}else{
|
|
if($._boxModel){
|
|
_23-=_24();
|
|
if(_23<0){
|
|
_23=0;
|
|
}
|
|
}
|
|
t.css(_22,_23+"px");
|
|
}
|
|
}
|
|
function _24(){
|
|
if(_22.toLowerCase().indexOf("width")>=0){
|
|
return t.outerWidth()-t.width();
|
|
}else{
|
|
return t.outerHeight()-t.height();
|
|
}
|
|
};
|
|
};
|
|
};
|
|
})(jQuery);
|
|
(function($){
|
|
var _25=null;
|
|
var _26=null;
|
|
var _27=false;
|
|
function _28(e){
|
|
if(e.touches.length!=1){
|
|
return;
|
|
}
|
|
if(!_27){
|
|
_27=true;
|
|
dblClickTimer=setTimeout(function(){
|
|
_27=false;
|
|
},500);
|
|
}else{
|
|
clearTimeout(dblClickTimer);
|
|
_27=false;
|
|
_29(e,"dblclick");
|
|
}
|
|
_25=setTimeout(function(){
|
|
_29(e,"contextmenu",3);
|
|
},1000);
|
|
_29(e,"mousedown");
|
|
if($.fn.draggable.isDragging||$.fn.resizable.isResizing){
|
|
e.preventDefault();
|
|
}
|
|
};
|
|
function _2a(e){
|
|
if(e.touches.length!=1){
|
|
return;
|
|
}
|
|
if(_25){
|
|
clearTimeout(_25);
|
|
}
|
|
_29(e,"mousemove");
|
|
if($.fn.draggable.isDragging||$.fn.resizable.isResizing){
|
|
e.preventDefault();
|
|
}
|
|
};
|
|
function _2b(e){
|
|
if(_25){
|
|
clearTimeout(_25);
|
|
}
|
|
_29(e,"mouseup");
|
|
if($.fn.draggable.isDragging||$.fn.resizable.isResizing){
|
|
e.preventDefault();
|
|
}
|
|
};
|
|
function _29(e,_2c,_2d){
|
|
var _2e=new $.Event(_2c);
|
|
_2e.pageX=e.changedTouches[0].pageX;
|
|
_2e.pageY=e.changedTouches[0].pageY;
|
|
_2e.which=_2d||1;
|
|
$(e.target).trigger(_2e);
|
|
};
|
|
if(document.addEventListener){
|
|
document.addEventListener("touchstart",_28,true);
|
|
document.addEventListener("touchmove",_2a,true);
|
|
document.addEventListener("touchend",_2b,true);
|
|
}
|
|
})(jQuery);
|
|
(function($){
|
|
function _2f(e){
|
|
var _30=$.data(e.data.target,"draggable");
|
|
var _31=_30.options;
|
|
var _32=_30.proxy;
|
|
var _33=e.data;
|
|
var _34=_33.startLeft+e.pageX-_33.startX;
|
|
var top=_33.startTop+e.pageY-_33.startY;
|
|
if(_32){
|
|
if(_32.parent()[0]==document.body){
|
|
if(_31.deltaX!=null&&_31.deltaX!=undefined){
|
|
_34=e.pageX+_31.deltaX;
|
|
}else{
|
|
_34=e.pageX-e.data.offsetWidth;
|
|
}
|
|
if(_31.deltaY!=null&&_31.deltaY!=undefined){
|
|
top=e.pageY+_31.deltaY;
|
|
}else{
|
|
top=e.pageY-e.data.offsetHeight;
|
|
}
|
|
}else{
|
|
if(_31.deltaX!=null&&_31.deltaX!=undefined){
|
|
_34+=e.data.offsetWidth+_31.deltaX;
|
|
}
|
|
if(_31.deltaY!=null&&_31.deltaY!=undefined){
|
|
top+=e.data.offsetHeight+_31.deltaY;
|
|
}
|
|
}
|
|
}
|
|
if(e.data.parent!=document.body){
|
|
_34+=$(e.data.parent).scrollLeft();
|
|
top+=$(e.data.parent).scrollTop();
|
|
}
|
|
if(_31.axis=="h"){
|
|
_33.left=_34;
|
|
}else{
|
|
if(_31.axis=="v"){
|
|
_33.top=top;
|
|
}else{
|
|
_33.left=_34;
|
|
_33.top=top;
|
|
}
|
|
}
|
|
};
|
|
function _35(e){
|
|
var _36=$.data(e.data.target,"draggable");
|
|
var _37=_36.options;
|
|
var _38=_36.proxy;
|
|
if(!_38){
|
|
_38=$(e.data.target);
|
|
}
|
|
_38.css({left:e.data.left,top:e.data.top});
|
|
$("body").css("cursor",_37.cursor);
|
|
};
|
|
function _39(e){
|
|
if(!$.fn.draggable.isDragging){
|
|
return false;
|
|
}
|
|
var _3a=$.data(e.data.target,"draggable");
|
|
var _3b=_3a.options;
|
|
var _3c=$(".droppable").filter(function(){
|
|
return e.data.target!=this;
|
|
}).filter(function(){
|
|
var _3d=$.data(this,"droppable").options.accept;
|
|
if(_3d){
|
|
return $(_3d).filter(function(){
|
|
return this==e.data.target;
|
|
}).length>0;
|
|
}else{
|
|
return true;
|
|
}
|
|
});
|
|
_3a.droppables=_3c;
|
|
var _3e=_3a.proxy;
|
|
if(!_3e){
|
|
if(_3b.proxy){
|
|
if(_3b.proxy=="clone"){
|
|
_3e=$(e.data.target).clone().insertAfter(e.data.target);
|
|
}else{
|
|
_3e=_3b.proxy.call(e.data.target,e.data.target);
|
|
}
|
|
_3a.proxy=_3e;
|
|
}else{
|
|
_3e=$(e.data.target);
|
|
}
|
|
}
|
|
_3e.css("position","absolute");
|
|
_2f(e);
|
|
_35(e);
|
|
_3b.onStartDrag.call(e.data.target,e);
|
|
return false;
|
|
};
|
|
function _3f(e){
|
|
if(!$.fn.draggable.isDragging){
|
|
return false;
|
|
}
|
|
var _40=$.data(e.data.target,"draggable");
|
|
_2f(e);
|
|
if(_40.options.onDrag.call(e.data.target,e)!=false){
|
|
_35(e);
|
|
}
|
|
var _41=e.data.target;
|
|
_40.droppables.each(function(){
|
|
var _42=$(this);
|
|
if(_42.droppable("options").disabled){
|
|
return;
|
|
}
|
|
var p2=_42.offset();
|
|
if(e.pageX>p2.left&&e.pageX<p2.left+_42.outerWidth()&&e.pageY>p2.top&&e.pageY<p2.top+_42.outerHeight()){
|
|
if(!this.entered){
|
|
$(this).trigger("_dragenter",[_41]);
|
|
this.entered=true;
|
|
}
|
|
$(this).trigger("_dragover",[_41]);
|
|
}else{
|
|
if(this.entered){
|
|
$(this).trigger("_dragleave",[_41]);
|
|
this.entered=false;
|
|
}
|
|
}
|
|
});
|
|
return false;
|
|
};
|
|
function _43(e){
|
|
if(!$.fn.draggable.isDragging){
|
|
_44();
|
|
return false;
|
|
}
|
|
_3f(e);
|
|
var _45=$.data(e.data.target,"draggable");
|
|
var _46=_45.proxy;
|
|
var _47=_45.options;
|
|
if(_47.revert){
|
|
if(_48()==true){
|
|
$(e.data.target).css({position:e.data.startPosition,left:e.data.startLeft,top:e.data.startTop});
|
|
}else{
|
|
if(_46){
|
|
var _49,top;
|
|
if(_46.parent()[0]==document.body){
|
|
_49=e.data.startX-e.data.offsetWidth;
|
|
top=e.data.startY-e.data.offsetHeight;
|
|
}else{
|
|
_49=e.data.startLeft;
|
|
top=e.data.startTop;
|
|
}
|
|
_46.animate({left:_49,top:top},function(){
|
|
_4a();
|
|
});
|
|
}else{
|
|
$(e.data.target).animate({left:e.data.startLeft,top:e.data.startTop},function(){
|
|
$(e.data.target).css("position",e.data.startPosition);
|
|
});
|
|
}
|
|
}
|
|
}else{
|
|
$(e.data.target).css({position:"absolute",left:e.data.left,top:e.data.top});
|
|
_48();
|
|
}
|
|
_47.onStopDrag.call(e.data.target,e);
|
|
_44();
|
|
function _4a(){
|
|
if(_46){
|
|
_46.remove();
|
|
}
|
|
_45.proxy=null;
|
|
};
|
|
function _48(){
|
|
var _4b=false;
|
|
_45.droppables.each(function(){
|
|
var _4c=$(this);
|
|
if(_4c.droppable("options").disabled){
|
|
return;
|
|
}
|
|
var p2=_4c.offset();
|
|
if(e.pageX>p2.left&&e.pageX<p2.left+_4c.outerWidth()&&e.pageY>p2.top&&e.pageY<p2.top+_4c.outerHeight()){
|
|
if(_47.revert){
|
|
$(e.data.target).css({position:e.data.startPosition,left:e.data.startLeft,top:e.data.startTop});
|
|
}
|
|
$(this).trigger("_drop",[e.data.target]);
|
|
_4a();
|
|
_4b=true;
|
|
this.entered=false;
|
|
return false;
|
|
}
|
|
});
|
|
if(!_4b&&!_47.revert){
|
|
_4a();
|
|
}
|
|
return _4b;
|
|
};
|
|
return false;
|
|
};
|
|
function _44(){
|
|
if($.fn.draggable.timer){
|
|
clearTimeout($.fn.draggable.timer);
|
|
$.fn.draggable.timer=undefined;
|
|
}
|
|
$(document).unbind(".draggable");
|
|
$.fn.draggable.isDragging=false;
|
|
setTimeout(function(){
|
|
$("body").css("cursor","");
|
|
},100);
|
|
};
|
|
$.fn.draggable=function(_4d,_4e){
|
|
if(typeof _4d=="string"){
|
|
return $.fn.draggable.methods[_4d](this,_4e);
|
|
}
|
|
return this.each(function(){
|
|
var _4f;
|
|
var _50=$.data(this,"draggable");
|
|
if(_50){
|
|
_50.handle.unbind(".draggable");
|
|
_4f=$.extend(_50.options,_4d);
|
|
}else{
|
|
_4f=$.extend({},$.fn.draggable.defaults,$.fn.draggable.parseOptions(this),_4d||{});
|
|
}
|
|
var _51=_4f.handle?(typeof _4f.handle=="string"?$(_4f.handle,this):_4f.handle):$(this);
|
|
$.data(this,"draggable",{options:_4f,handle:_51});
|
|
if(_4f.disabled){
|
|
$(this).css("cursor","");
|
|
return;
|
|
}
|
|
_51.unbind(".draggable").bind("mousemove.draggable",{target:this},function(e){
|
|
if($.fn.draggable.isDragging){
|
|
return;
|
|
}
|
|
var _52=$.data(e.data.target,"draggable").options;
|
|
if(_53(e)){
|
|
$(this).css("cursor",_52.cursor);
|
|
}else{
|
|
$(this).css("cursor","");
|
|
}
|
|
}).bind("mouseleave.draggable",{target:this},function(e){
|
|
$(this).css("cursor","");
|
|
}).bind("mousedown.draggable",{target:this},function(e){
|
|
if(_53(e)==false){
|
|
return;
|
|
}
|
|
$(this).css("cursor","");
|
|
var _54=$(e.data.target).position();
|
|
var _55=$(e.data.target).offset();
|
|
var _56={startPosition:$(e.data.target).css("position"),startLeft:_54.left,startTop:_54.top,left:_54.left,top:_54.top,startX:e.pageX,startY:e.pageY,offsetWidth:(e.pageX-_55.left),offsetHeight:(e.pageY-_55.top),target:e.data.target,parent:$(e.data.target).parent()[0]};
|
|
$.extend(e.data,_56);
|
|
var _57=$.data(e.data.target,"draggable").options;
|
|
if(_57.onBeforeDrag.call(e.data.target,e)==false){
|
|
return;
|
|
}
|
|
$(document).bind("mousedown.draggable",e.data,_39);
|
|
$(document).bind("mousemove.draggable",e.data,_3f);
|
|
$(document).bind("mouseup.draggable",e.data,_43);
|
|
$.fn.draggable.timer=setTimeout(function(){
|
|
$.fn.draggable.isDragging=true;
|
|
_39(e);
|
|
},_57.delay);
|
|
return false;
|
|
});
|
|
function _53(e){
|
|
var _58=$.data(e.data.target,"draggable");
|
|
var _59=_58.handle;
|
|
var _5a=$(_59).offset();
|
|
var _5b=$(_59).outerWidth();
|
|
var _5c=$(_59).outerHeight();
|
|
var t=e.pageY-_5a.top;
|
|
var r=_5a.left+_5b-e.pageX;
|
|
var b=_5a.top+_5c-e.pageY;
|
|
var l=e.pageX-_5a.left;
|
|
return Math.min(t,r,b,l)>_58.options.edge;
|
|
};
|
|
});
|
|
};
|
|
$.fn.draggable.methods={options:function(jq){
|
|
return $.data(jq[0],"draggable").options;
|
|
},proxy:function(jq){
|
|
return $.data(jq[0],"draggable").proxy;
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
$(this).draggable({disabled:false});
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
$(this).draggable({disabled:true});
|
|
});
|
|
}};
|
|
$.fn.draggable.parseOptions=function(_5d){
|
|
var t=$(_5d);
|
|
return $.extend({},$.parser.parseOptions(_5d,["cursor","handle","axis",{"revert":"boolean","deltaX":"number","deltaY":"number","edge":"number","delay":"number"}]),{disabled:(t.attr("disabled")?true:undefined)});
|
|
};
|
|
$.fn.draggable.defaults={proxy:null,revert:false,cursor:"move",deltaX:null,deltaY:null,handle:null,disabled:false,edge:0,axis:null,delay:100,onBeforeDrag:function(e){
|
|
},onStartDrag:function(e){
|
|
},onDrag:function(e){
|
|
},onStopDrag:function(e){
|
|
}};
|
|
$.fn.draggable.isDragging=false;
|
|
})(jQuery);
|
|
(function($){
|
|
function _5e(_5f){
|
|
$(_5f).addClass("droppable");
|
|
$(_5f).bind("_dragenter",function(e,_60){
|
|
$.data(_5f,"droppable").options.onDragEnter.apply(_5f,[e,_60]);
|
|
});
|
|
$(_5f).bind("_dragleave",function(e,_61){
|
|
$.data(_5f,"droppable").options.onDragLeave.apply(_5f,[e,_61]);
|
|
});
|
|
$(_5f).bind("_dragover",function(e,_62){
|
|
$.data(_5f,"droppable").options.onDragOver.apply(_5f,[e,_62]);
|
|
});
|
|
$(_5f).bind("_drop",function(e,_63){
|
|
$.data(_5f,"droppable").options.onDrop.apply(_5f,[e,_63]);
|
|
});
|
|
};
|
|
$.fn.droppable=function(_64,_65){
|
|
if(typeof _64=="string"){
|
|
return $.fn.droppable.methods[_64](this,_65);
|
|
}
|
|
_64=_64||{};
|
|
return this.each(function(){
|
|
var _66=$.data(this,"droppable");
|
|
if(_66){
|
|
$.extend(_66.options,_64);
|
|
}else{
|
|
_5e(this);
|
|
$.data(this,"droppable",{options:$.extend({},$.fn.droppable.defaults,$.fn.droppable.parseOptions(this),_64)});
|
|
}
|
|
});
|
|
};
|
|
$.fn.droppable.methods={options:function(jq){
|
|
return $.data(jq[0],"droppable").options;
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
$(this).droppable({disabled:false});
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
$(this).droppable({disabled:true});
|
|
});
|
|
}};
|
|
$.fn.droppable.parseOptions=function(_67){
|
|
var t=$(_67);
|
|
return $.extend({},$.parser.parseOptions(_67,["accept"]),{disabled:(t.attr("disabled")?true:undefined)});
|
|
};
|
|
$.fn.droppable.defaults={accept:null,disabled:false,onDragEnter:function(e,_68){
|
|
},onDragOver:function(e,_69){
|
|
},onDragLeave:function(e,_6a){
|
|
},onDrop:function(e,_6b){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
$.fn.resizable=function(_6c,_6d){
|
|
if(typeof _6c=="string"){
|
|
return $.fn.resizable.methods[_6c](this,_6d);
|
|
}
|
|
function _6e(e){
|
|
var _6f=e.data;
|
|
var _70=$.data(_6f.target,"resizable").options;
|
|
if(_6f.dir.indexOf("e")!=-1){
|
|
var _71=_6f.startWidth+e.pageX-_6f.startX;
|
|
_71=Math.min(Math.max(_71,_70.minWidth),_70.maxWidth);
|
|
_6f.width=_71;
|
|
}
|
|
if(_6f.dir.indexOf("s")!=-1){
|
|
var _72=_6f.startHeight+e.pageY-_6f.startY;
|
|
_72=Math.min(Math.max(_72,_70.minHeight),_70.maxHeight);
|
|
_6f.height=_72;
|
|
}
|
|
if(_6f.dir.indexOf("w")!=-1){
|
|
var _71=_6f.startWidth-e.pageX+_6f.startX;
|
|
_71=Math.min(Math.max(_71,_70.minWidth),_70.maxWidth);
|
|
_6f.width=_71;
|
|
_6f.left=_6f.startLeft+_6f.startWidth-_6f.width;
|
|
}
|
|
if(_6f.dir.indexOf("n")!=-1){
|
|
var _72=_6f.startHeight-e.pageY+_6f.startY;
|
|
_72=Math.min(Math.max(_72,_70.minHeight),_70.maxHeight);
|
|
_6f.height=_72;
|
|
_6f.top=_6f.startTop+_6f.startHeight-_6f.height;
|
|
}
|
|
};
|
|
function _73(e){
|
|
var _74=e.data;
|
|
var t=$(_74.target);
|
|
t.css({left:_74.left,top:_74.top});
|
|
if(t.outerWidth()!=_74.width){
|
|
t._outerWidth(_74.width);
|
|
}
|
|
if(t.outerHeight()!=_74.height){
|
|
t._outerHeight(_74.height);
|
|
}
|
|
};
|
|
function _75(e){
|
|
$.fn.resizable.isResizing=true;
|
|
$.data(e.data.target,"resizable").options.onStartResize.call(e.data.target,e);
|
|
return false;
|
|
};
|
|
function _76(e){
|
|
_6e(e);
|
|
if($.data(e.data.target,"resizable").options.onResize.call(e.data.target,e)!=false){
|
|
_73(e);
|
|
}
|
|
return false;
|
|
};
|
|
function _77(e){
|
|
$.fn.resizable.isResizing=false;
|
|
_6e(e,true);
|
|
_73(e);
|
|
$.data(e.data.target,"resizable").options.onStopResize.call(e.data.target,e);
|
|
$(document).unbind(".resizable");
|
|
$("body").css("cursor","");
|
|
return false;
|
|
};
|
|
return this.each(function(){
|
|
var _78=null;
|
|
var _79=$.data(this,"resizable");
|
|
if(_79){
|
|
$(this).unbind(".resizable");
|
|
_78=$.extend(_79.options,_6c||{});
|
|
}else{
|
|
_78=$.extend({},$.fn.resizable.defaults,$.fn.resizable.parseOptions(this),_6c||{});
|
|
$.data(this,"resizable",{options:_78});
|
|
}
|
|
if(_78.disabled==true){
|
|
return;
|
|
}
|
|
$(this).bind("mousemove.resizable",{target:this},function(e){
|
|
if($.fn.resizable.isResizing){
|
|
return;
|
|
}
|
|
var dir=_7a(e);
|
|
if(dir==""){
|
|
$(e.data.target).css("cursor","");
|
|
}else{
|
|
$(e.data.target).css("cursor",dir+"-resize");
|
|
}
|
|
}).bind("mouseleave.resizable",{target:this},function(e){
|
|
$(e.data.target).css("cursor","");
|
|
}).bind("mousedown.resizable",{target:this},function(e){
|
|
var dir=_7a(e);
|
|
if(dir==""){
|
|
return;
|
|
}
|
|
function _7b(css){
|
|
var val=parseInt($(e.data.target).css(css));
|
|
if(isNaN(val)){
|
|
return 0;
|
|
}else{
|
|
return val;
|
|
}
|
|
};
|
|
var _7c={target:e.data.target,dir:dir,startLeft:_7b("left"),startTop:_7b("top"),left:_7b("left"),top:_7b("top"),startX:e.pageX,startY:e.pageY,startWidth:$(e.data.target).outerWidth(),startHeight:$(e.data.target).outerHeight(),width:$(e.data.target).outerWidth(),height:$(e.data.target).outerHeight(),deltaWidth:$(e.data.target).outerWidth()-$(e.data.target).width(),deltaHeight:$(e.data.target).outerHeight()-$(e.data.target).height()};
|
|
$(document).bind("mousedown.resizable",_7c,_75);
|
|
$(document).bind("mousemove.resizable",_7c,_76);
|
|
$(document).bind("mouseup.resizable",_7c,_77);
|
|
$("body").css("cursor",dir+"-resize");
|
|
});
|
|
function _7a(e){
|
|
var tt=$(e.data.target);
|
|
var dir="";
|
|
var _7d=tt.offset();
|
|
var _7e=tt.outerWidth();
|
|
var _7f=tt.outerHeight();
|
|
var _80=_78.edge;
|
|
if(e.pageY>_7d.top&&e.pageY<_7d.top+_80){
|
|
dir+="n";
|
|
}else{
|
|
if(e.pageY<_7d.top+_7f&&e.pageY>_7d.top+_7f-_80){
|
|
dir+="s";
|
|
}
|
|
}
|
|
if(e.pageX>_7d.left&&e.pageX<_7d.left+_80){
|
|
dir+="w";
|
|
}else{
|
|
if(e.pageX<_7d.left+_7e&&e.pageX>_7d.left+_7e-_80){
|
|
dir+="e";
|
|
}
|
|
}
|
|
var _81=_78.handles.split(",");
|
|
for(var i=0;i<_81.length;i++){
|
|
var _82=_81[i].replace(/(^\s*)|(\s*$)/g,"");
|
|
if(_82=="all"||_82==dir){
|
|
return dir;
|
|
}
|
|
}
|
|
return "";
|
|
};
|
|
});
|
|
};
|
|
$.fn.resizable.methods={options:function(jq){
|
|
return $.data(jq[0],"resizable").options;
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
$(this).resizable({disabled:false});
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
$(this).resizable({disabled:true});
|
|
});
|
|
}};
|
|
$.fn.resizable.parseOptions=function(_83){
|
|
var t=$(_83);
|
|
return $.extend({},$.parser.parseOptions(_83,["handles",{minWidth:"number",minHeight:"number",maxWidth:"number",maxHeight:"number",edge:"number"}]),{disabled:(t.attr("disabled")?true:undefined)});
|
|
};
|
|
$.fn.resizable.defaults={disabled:false,handles:"n, e, s, w, ne, se, sw, nw, all",minWidth:10,minHeight:10,maxWidth:10000,maxHeight:10000,edge:5,onStartResize:function(e){
|
|
},onResize:function(e){
|
|
},onStopResize:function(e){
|
|
}};
|
|
$.fn.resizable.isResizing=false;
|
|
})(jQuery);
|
|
(function($){
|
|
function _84(_85,_86){
|
|
var _87=$.data(_85,"linkbutton").options;
|
|
if(_86){
|
|
$.extend(_87,_86);
|
|
}
|
|
if(_87.width||_87.height||_87.fit){
|
|
var btn=$(_85);
|
|
var _88=btn.parent();
|
|
var _89=btn.is(":visible");
|
|
if(!_89){
|
|
var _8a=$("<div style=\"display:none\"></div>").insertBefore(_85);
|
|
var _8b={position:btn.css("position"),display:btn.css("display"),left:btn.css("left")};
|
|
btn.appendTo("body");
|
|
btn.css({position:"absolute",display:"inline-block",left:-20000});
|
|
}
|
|
btn._size(_87,_88);
|
|
var _8c=btn.find(".l-btn-left");
|
|
_8c.css("margin-top",0);
|
|
_8c.css("margin-top",parseInt((btn.height()-_8c.height())/2)+"px");
|
|
if(!_89){
|
|
btn.insertAfter(_8a);
|
|
btn.css(_8b);
|
|
_8a.remove();
|
|
}
|
|
}
|
|
};
|
|
function _8d(_8e){
|
|
var _8f=$.data(_8e,"linkbutton").options;
|
|
var t=$(_8e).empty();
|
|
t.addClass("l-btn").removeClass("l-btn-plain l-btn-selected l-btn-plain-selected l-btn-outline");
|
|
t.removeClass("l-btn-small l-btn-medium l-btn-large").addClass("l-btn-"+_8f.size);
|
|
if(_8f.plain){
|
|
t.addClass("l-btn-plain");
|
|
}
|
|
if(_8f.outline){
|
|
t.addClass("l-btn-outline");
|
|
}
|
|
if(_8f.selected){
|
|
t.addClass(_8f.plain?"l-btn-selected l-btn-plain-selected":"l-btn-selected");
|
|
}
|
|
t.attr("group",_8f.group||"");
|
|
t.attr("id",_8f.id||"");
|
|
var _90=$("<span class=\"l-btn-left\"></span>").appendTo(t);
|
|
if(_8f.text){
|
|
$("<span class=\"l-btn-text\"></span>").html(_8f.text).appendTo(_90);
|
|
}else{
|
|
$("<span class=\"l-btn-text l-btn-empty\"> </span>").appendTo(_90);
|
|
}
|
|
if(_8f.iconCls){
|
|
$("<span class=\"l-btn-icon\"> </span>").addClass(_8f.iconCls).appendTo(_90);
|
|
_90.addClass("l-btn-icon-"+_8f.iconAlign);
|
|
}
|
|
t.unbind(".linkbutton").bind("focus.linkbutton",function(){
|
|
if(!_8f.disabled){
|
|
$(this).addClass("l-btn-focus");
|
|
}
|
|
}).bind("blur.linkbutton",function(){
|
|
$(this).removeClass("l-btn-focus");
|
|
}).bind("click.linkbutton",function(){
|
|
if(!_8f.disabled){
|
|
if(_8f.toggle){
|
|
if(_8f.selected){
|
|
$(this).linkbutton("unselect");
|
|
}else{
|
|
$(this).linkbutton("select");
|
|
}
|
|
}
|
|
_8f.onClick.call(this);
|
|
}
|
|
});
|
|
_91(_8e,_8f.selected);
|
|
_92(_8e,_8f.disabled);
|
|
};
|
|
function _91(_93,_94){
|
|
var _95=$.data(_93,"linkbutton").options;
|
|
if(_94){
|
|
if(_95.group){
|
|
$("a.l-btn[group=\""+_95.group+"\"]").each(function(){
|
|
var o=$(this).linkbutton("options");
|
|
if(o.toggle){
|
|
$(this).removeClass("l-btn-selected l-btn-plain-selected");
|
|
o.selected=false;
|
|
}
|
|
});
|
|
}
|
|
$(_93).addClass(_95.plain?"l-btn-selected l-btn-plain-selected":"l-btn-selected");
|
|
_95.selected=true;
|
|
}else{
|
|
if(!_95.group){
|
|
$(_93).removeClass("l-btn-selected l-btn-plain-selected");
|
|
_95.selected=false;
|
|
}
|
|
}
|
|
};
|
|
function _92(_96,_97){
|
|
var _98=$.data(_96,"linkbutton");
|
|
var _99=_98.options;
|
|
$(_96).removeClass("l-btn-disabled l-btn-plain-disabled");
|
|
if(_97){
|
|
_99.disabled=true;
|
|
var _9a=$(_96).attr("href");
|
|
if(_9a){
|
|
_98.href=_9a;
|
|
$(_96).attr("href","javascript:void(0)");
|
|
}
|
|
if(_96.onclick){
|
|
_98.onclick=_96.onclick;
|
|
_96.onclick=null;
|
|
}
|
|
_99.plain?$(_96).addClass("l-btn-disabled l-btn-plain-disabled"):$(_96).addClass("l-btn-disabled");
|
|
}else{
|
|
_99.disabled=false;
|
|
if(_98.href){
|
|
$(_96).attr("href",_98.href);
|
|
}
|
|
if(_98.onclick){
|
|
_96.onclick=_98.onclick;
|
|
}
|
|
}
|
|
};
|
|
$.fn.linkbutton=function(_9b,_9c){
|
|
if(typeof _9b=="string"){
|
|
return $.fn.linkbutton.methods[_9b](this,_9c);
|
|
}
|
|
_9b=_9b||{};
|
|
return this.each(function(){
|
|
var _9d=$.data(this,"linkbutton");
|
|
if(_9d){
|
|
$.extend(_9d.options,_9b);
|
|
}else{
|
|
$.data(this,"linkbutton",{options:$.extend({},$.fn.linkbutton.defaults,$.fn.linkbutton.parseOptions(this),_9b)});
|
|
$(this).removeAttr("disabled");
|
|
$(this).bind("_resize",function(e,_9e){
|
|
if($(this).hasClass("easyui-fluid")||_9e){
|
|
_84(this);
|
|
}
|
|
return false;
|
|
});
|
|
}
|
|
_8d(this);
|
|
_84(this);
|
|
});
|
|
};
|
|
$.fn.linkbutton.methods={options:function(jq){
|
|
return $.data(jq[0],"linkbutton").options;
|
|
},resize:function(jq,_9f){
|
|
return jq.each(function(){
|
|
_84(this,_9f);
|
|
});
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
_92(this,false);
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
_92(this,true);
|
|
});
|
|
},select:function(jq){
|
|
return jq.each(function(){
|
|
_91(this,true);
|
|
});
|
|
},unselect:function(jq){
|
|
return jq.each(function(){
|
|
_91(this,false);
|
|
});
|
|
}};
|
|
$.fn.linkbutton.parseOptions=function(_a0){
|
|
var t=$(_a0);
|
|
return $.extend({},$.parser.parseOptions(_a0,["id","iconCls","iconAlign","group","size","text",{plain:"boolean",toggle:"boolean",selected:"boolean",outline:"boolean"}]),{disabled:(t.attr("disabled")?true:undefined),text:($.trim(t.html())||undefined),iconCls:(t.attr("icon")||t.attr("iconCls"))});
|
|
};
|
|
$.fn.linkbutton.defaults={id:null,disabled:false,toggle:false,selected:false,outline:false,group:null,plain:false,text:"",iconCls:null,iconAlign:"left",size:"small",onClick:function(){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _a1(_a2){
|
|
var _a3=$.data(_a2,"pagination");
|
|
var _a4=_a3.options;
|
|
var bb=_a3.bb={};
|
|
var _a5=$(_a2).addClass("pagination").html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr></tr></table>");
|
|
var tr=_a5.find("tr");
|
|
var aa=$.extend([],_a4.layout);
|
|
if(!_a4.showPageList){
|
|
_a6(aa,"list");
|
|
}
|
|
if(!_a4.showRefresh){
|
|
_a6(aa,"refresh");
|
|
}
|
|
if(aa[0]=="sep"){
|
|
aa.shift();
|
|
}
|
|
if(aa[aa.length-1]=="sep"){
|
|
aa.pop();
|
|
}
|
|
for(var _a7=0;_a7<aa.length;_a7++){
|
|
var _a8=aa[_a7];
|
|
if(_a8=="list"){
|
|
var ps=$("<select class=\"pagination-page-list\"></select>");
|
|
ps.bind("change",function(){
|
|
_a4.pageSize=parseInt($(this).val());
|
|
_a4.onChangePageSize.call(_a2,_a4.pageSize);
|
|
_ae(_a2,_a4.pageNumber);
|
|
});
|
|
for(var i=0;i<_a4.pageList.length;i++){
|
|
$("<option></option>").text(_a4.pageList[i]).appendTo(ps);
|
|
}
|
|
$("<td></td>").append(ps).appendTo(tr);
|
|
}else{
|
|
if(_a8=="sep"){
|
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr);
|
|
}else{
|
|
if(_a8=="first"){
|
|
bb.first=_a9("first");
|
|
}else{
|
|
if(_a8=="prev"){
|
|
bb.prev=_a9("prev");
|
|
}else{
|
|
if(_a8=="next"){
|
|
bb.next=_a9("next");
|
|
}else{
|
|
if(_a8=="last"){
|
|
bb.last=_a9("last");
|
|
}else{
|
|
if(_a8=="manual"){
|
|
$("<span style=\"padding-left:6px;\"></span>").html(_a4.beforePageText).appendTo(tr).wrap("<td></td>");
|
|
bb.num=$("<input class=\"pagination-num\" type=\"text\" value=\"1\" size=\"2\">").appendTo(tr).wrap("<td></td>");
|
|
bb.num.unbind(".pagination").bind("keydown.pagination",function(e){
|
|
if(e.keyCode==13){
|
|
var _aa=parseInt($(this).val())||1;
|
|
_ae(_a2,_aa);
|
|
return false;
|
|
}
|
|
});
|
|
bb.after=$("<span style=\"padding-right:6px;\"></span>").appendTo(tr).wrap("<td></td>");
|
|
}else{
|
|
if(_a8=="refresh"){
|
|
bb.refresh=_a9("refresh");
|
|
}else{
|
|
if(_a8=="links"){
|
|
$("<td class=\"pagination-links\"></td>").appendTo(tr);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(_a4.buttons){
|
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr);
|
|
if($.isArray(_a4.buttons)){
|
|
for(var i=0;i<_a4.buttons.length;i++){
|
|
var btn=_a4.buttons[i];
|
|
if(btn=="-"){
|
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr);
|
|
}else{
|
|
var td=$("<td></td>").appendTo(tr);
|
|
var a=$("<a href=\"javascript:void(0)\"></a>").appendTo(td);
|
|
a[0].onclick=eval(btn.handler||function(){
|
|
});
|
|
a.linkbutton($.extend({},btn,{plain:true}));
|
|
}
|
|
}
|
|
}else{
|
|
var td=$("<td></td>").appendTo(tr);
|
|
$(_a4.buttons).appendTo(td).show();
|
|
}
|
|
}
|
|
$("<div class=\"pagination-info\"></div>").appendTo(_a5);
|
|
$("<div style=\"clear:both;\"></div>").appendTo(_a5);
|
|
function _a9(_ab){
|
|
var btn=_a4.nav[_ab];
|
|
var a=$("<a href=\"javascript:void(0)\"></a>").appendTo(tr);
|
|
a.wrap("<td></td>");
|
|
a.linkbutton({iconCls:btn.iconCls,plain:true}).unbind(".pagination").bind("click.pagination",function(){
|
|
btn.handler.call(_a2);
|
|
});
|
|
return a;
|
|
};
|
|
function _a6(aa,_ac){
|
|
var _ad=$.inArray(_ac,aa);
|
|
if(_ad>=0){
|
|
aa.splice(_ad,1);
|
|
}
|
|
return aa;
|
|
};
|
|
};
|
|
function _ae(_af,_b0){
|
|
var _b1=$.data(_af,"pagination").options;
|
|
_b2(_af,{pageNumber:_b0});
|
|
_b1.onSelectPage.call(_af,_b1.pageNumber,_b1.pageSize);
|
|
};
|
|
function _b2(_b3,_b4){
|
|
var _b5=$.data(_b3,"pagination");
|
|
var _b6=_b5.options;
|
|
var bb=_b5.bb;
|
|
$.extend(_b6,_b4||{});
|
|
var ps=$(_b3).find("select.pagination-page-list");
|
|
if(ps.length){
|
|
ps.val(_b6.pageSize+"");
|
|
_b6.pageSize=parseInt(ps.val());
|
|
}
|
|
var _b7=Math.ceil(_b6.total/_b6.pageSize)||1;
|
|
if(_b6.pageNumber<1){
|
|
_b6.pageNumber=1;
|
|
}
|
|
if(_b6.pageNumber>_b7){
|
|
_b6.pageNumber=_b7;
|
|
}
|
|
if(_b6.total==0){
|
|
_b6.pageNumber=0;
|
|
_b7=0;
|
|
}
|
|
if(bb.num){
|
|
bb.num.val(_b6.pageNumber);
|
|
}
|
|
if(bb.after){
|
|
bb.after.html(_b6.afterPageText.replace(/{pages}/,_b7));
|
|
}
|
|
var td=$(_b3).find("td.pagination-links");
|
|
if(td.length){
|
|
td.empty();
|
|
var _b8=_b6.pageNumber-Math.floor(_b6.links/2);
|
|
if(_b8<1){
|
|
_b8=1;
|
|
}
|
|
var _b9=_b8+_b6.links-1;
|
|
if(_b9>_b7){
|
|
_b9=_b7;
|
|
}
|
|
_b8=_b9-_b6.links+1;
|
|
if(_b8<1){
|
|
_b8=1;
|
|
}
|
|
for(var i=_b8;i<=_b9;i++){
|
|
var a=$("<a class=\"pagination-link\" href=\"javascript:void(0)\"></a>").appendTo(td);
|
|
a.linkbutton({plain:true,text:i});
|
|
if(i==_b6.pageNumber){
|
|
a.linkbutton("select");
|
|
}else{
|
|
a.unbind(".pagination").bind("click.pagination",{pageNumber:i},function(e){
|
|
_ae(_b3,e.data.pageNumber);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
var _ba=_b6.displayMsg;
|
|
_ba=_ba.replace(/{from}/,_b6.total==0?0:_b6.pageSize*(_b6.pageNumber-1)+1);
|
|
_ba=_ba.replace(/{to}/,Math.min(_b6.pageSize*(_b6.pageNumber),_b6.total));
|
|
_ba=_ba.replace(/{total}/,_b6.total);
|
|
$(_b3).find("div.pagination-info").html(_ba);
|
|
if(bb.first){
|
|
bb.first.linkbutton({disabled:((!_b6.total)||_b6.pageNumber==1)});
|
|
}
|
|
if(bb.prev){
|
|
bb.prev.linkbutton({disabled:((!_b6.total)||_b6.pageNumber==1)});
|
|
}
|
|
if(bb.next){
|
|
bb.next.linkbutton({disabled:(_b6.pageNumber==_b7)});
|
|
}
|
|
if(bb.last){
|
|
bb.last.linkbutton({disabled:(_b6.pageNumber==_b7)});
|
|
}
|
|
_bb(_b3,_b6.loading);
|
|
};
|
|
function _bb(_bc,_bd){
|
|
var _be=$.data(_bc,"pagination");
|
|
var _bf=_be.options;
|
|
_bf.loading=_bd;
|
|
if(_bf.showRefresh&&_be.bb.refresh){
|
|
_be.bb.refresh.linkbutton({iconCls:(_bf.loading?"pagination-loading":"pagination-load")});
|
|
}
|
|
};
|
|
$.fn.pagination=function(_c0,_c1){
|
|
if(typeof _c0=="string"){
|
|
return $.fn.pagination.methods[_c0](this,_c1);
|
|
}
|
|
_c0=_c0||{};
|
|
return this.each(function(){
|
|
var _c2;
|
|
var _c3=$.data(this,"pagination");
|
|
if(_c3){
|
|
_c2=$.extend(_c3.options,_c0);
|
|
}else{
|
|
_c2=$.extend({},$.fn.pagination.defaults,$.fn.pagination.parseOptions(this),_c0);
|
|
$.data(this,"pagination",{options:_c2});
|
|
}
|
|
_a1(this);
|
|
_b2(this);
|
|
});
|
|
};
|
|
$.fn.pagination.methods={options:function(jq){
|
|
return $.data(jq[0],"pagination").options;
|
|
},loading:function(jq){
|
|
return jq.each(function(){
|
|
_bb(this,true);
|
|
});
|
|
},loaded:function(jq){
|
|
return jq.each(function(){
|
|
_bb(this,false);
|
|
});
|
|
},refresh:function(jq,_c4){
|
|
return jq.each(function(){
|
|
_b2(this,_c4);
|
|
});
|
|
},select:function(jq,_c5){
|
|
return jq.each(function(){
|
|
_ae(this,_c5);
|
|
});
|
|
}};
|
|
$.fn.pagination.parseOptions=function(_c6){
|
|
var t=$(_c6);
|
|
return $.extend({},$.parser.parseOptions(_c6,[{total:"number",pageSize:"number",pageNumber:"number",links:"number"},{loading:"boolean",showPageList:"boolean",showRefresh:"boolean"}]),{pageList:(t.attr("pageList")?eval(t.attr("pageList")):undefined)});
|
|
};
|
|
$.fn.pagination.defaults={total:1,pageSize:10,pageNumber:1,pageList:[10,20,30,50],loading:false,buttons:null,showPageList:true,showRefresh:true,links:10,layout:["list","sep","first","prev","sep","manual","sep","next","last","sep","refresh"],onSelectPage:function(_c7,_c8){
|
|
},onBeforeRefresh:function(_c9,_ca){
|
|
},onRefresh:function(_cb,_cc){
|
|
},onChangePageSize:function(_cd){
|
|
},beforePageText:"Page",afterPageText:"of {pages}",displayMsg:"Displaying {from} to {to} of {total} items",nav:{first:{iconCls:"pagination-first",handler:function(){
|
|
var _ce=$(this).pagination("options");
|
|
if(_ce.pageNumber>1){
|
|
$(this).pagination("select",1);
|
|
}
|
|
}},prev:{iconCls:"pagination-prev",handler:function(){
|
|
var _cf=$(this).pagination("options");
|
|
if(_cf.pageNumber>1){
|
|
$(this).pagination("select",_cf.pageNumber-1);
|
|
}
|
|
}},next:{iconCls:"pagination-next",handler:function(){
|
|
var _d0=$(this).pagination("options");
|
|
var _d1=Math.ceil(_d0.total/_d0.pageSize);
|
|
if(_d0.pageNumber<_d1){
|
|
$(this).pagination("select",_d0.pageNumber+1);
|
|
}
|
|
}},last:{iconCls:"pagination-last",handler:function(){
|
|
var _d2=$(this).pagination("options");
|
|
var _d3=Math.ceil(_d2.total/_d2.pageSize);
|
|
if(_d2.pageNumber<_d3){
|
|
$(this).pagination("select",_d3);
|
|
}
|
|
}},refresh:{iconCls:"pagination-refresh",handler:function(){
|
|
var _d4=$(this).pagination("options");
|
|
if(_d4.onBeforeRefresh.call(this,_d4.pageNumber,_d4.pageSize)!=false){
|
|
$(this).pagination("select",_d4.pageNumber);
|
|
_d4.onRefresh.call(this,_d4.pageNumber,_d4.pageSize);
|
|
}
|
|
}}}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _d5(_d6){
|
|
var _d7=$(_d6);
|
|
_d7.addClass("tree");
|
|
return _d7;
|
|
};
|
|
function _d8(_d9){
|
|
var _da=$.data(_d9,"tree").options;
|
|
$(_d9).unbind().bind("mouseover",function(e){
|
|
var tt=$(e.target);
|
|
var _db=tt.closest("div.tree-node");
|
|
if(!_db.length){
|
|
return;
|
|
}
|
|
_db.addClass("tree-node-hover");
|
|
if(tt.hasClass("tree-hit")){
|
|
if(tt.hasClass("tree-expanded")){
|
|
tt.addClass("tree-expanded-hover");
|
|
}else{
|
|
tt.addClass("tree-collapsed-hover");
|
|
}
|
|
}
|
|
e.stopPropagation();
|
|
}).bind("mouseout",function(e){
|
|
var tt=$(e.target);
|
|
var _dc=tt.closest("div.tree-node");
|
|
if(!_dc.length){
|
|
return;
|
|
}
|
|
_dc.removeClass("tree-node-hover");
|
|
if(tt.hasClass("tree-hit")){
|
|
if(tt.hasClass("tree-expanded")){
|
|
tt.removeClass("tree-expanded-hover");
|
|
}else{
|
|
tt.removeClass("tree-collapsed-hover");
|
|
}
|
|
}
|
|
e.stopPropagation();
|
|
}).bind("click",function(e){
|
|
var tt=$(e.target);
|
|
var _dd=tt.closest("div.tree-node");
|
|
if(!_dd.length){
|
|
return;
|
|
}
|
|
if(tt.hasClass("tree-hit")){
|
|
_144(_d9,_dd[0]);
|
|
return false;
|
|
}else{
|
|
if(tt.hasClass("tree-checkbox")){
|
|
_104(_d9,_dd[0]);
|
|
return false;
|
|
}else{
|
|
_18a(_d9,_dd[0]);
|
|
_da.onClick.call(_d9,_e0(_d9,_dd[0]));
|
|
}
|
|
}
|
|
e.stopPropagation();
|
|
}).bind("dblclick",function(e){
|
|
var _de=$(e.target).closest("div.tree-node");
|
|
if(!_de.length){
|
|
return;
|
|
}
|
|
_18a(_d9,_de[0]);
|
|
_da.onDblClick.call(_d9,_e0(_d9,_de[0]));
|
|
e.stopPropagation();
|
|
}).bind("contextmenu",function(e){
|
|
var _df=$(e.target).closest("div.tree-node");
|
|
if(!_df.length){
|
|
return;
|
|
}
|
|
_da.onContextMenu.call(_d9,e,_e0(_d9,_df[0]));
|
|
e.stopPropagation();
|
|
});
|
|
};
|
|
function _e1(_e2){
|
|
var _e3=$.data(_e2,"tree").options;
|
|
_e3.dnd=false;
|
|
var _e4=$(_e2).find("div.tree-node");
|
|
_e4.draggable("disable");
|
|
_e4.css("cursor","pointer");
|
|
};
|
|
function _e5(_e6){
|
|
var _e7=$.data(_e6,"tree");
|
|
var _e8=_e7.options;
|
|
var _e9=_e7.tree;
|
|
_e7.disabledNodes=[];
|
|
_e8.dnd=true;
|
|
_e9.find("div.tree-node").draggable({disabled:false,revert:true,cursor:"pointer",proxy:function(_ea){
|
|
var p=$("<div class=\"tree-node-proxy\"></div>").appendTo("body");
|
|
p.html("<span class=\"tree-dnd-icon tree-dnd-no\"> </span>"+$(_ea).find(".tree-title").html());
|
|
p.hide();
|
|
return p;
|
|
},deltaX:15,deltaY:15,onBeforeDrag:function(e){
|
|
if(_e8.onBeforeDrag.call(_e6,_e0(_e6,this))==false){
|
|
return false;
|
|
}
|
|
if($(e.target).hasClass("tree-hit")||$(e.target).hasClass("tree-checkbox")){
|
|
return false;
|
|
}
|
|
if(e.which!=1){
|
|
return false;
|
|
}
|
|
var _eb=$(this).find("span.tree-indent");
|
|
if(_eb.length){
|
|
e.data.offsetWidth-=_eb.length*_eb.width();
|
|
}
|
|
},onStartDrag:function(e){
|
|
$(this).next("ul").find("div.tree-node").each(function(){
|
|
$(this).droppable("disable");
|
|
_e7.disabledNodes.push(this);
|
|
});
|
|
$(this).draggable("proxy").css({left:-10000,top:-10000});
|
|
_e8.onStartDrag.call(_e6,_e0(_e6,this));
|
|
var _ec=_e0(_e6,this);
|
|
if(_ec.id==undefined){
|
|
_ec.id="easyui_tree_node_id_temp";
|
|
_127(_e6,_ec);
|
|
}
|
|
_e7.draggingNodeId=_ec.id;
|
|
},onDrag:function(e){
|
|
var x1=e.pageX,y1=e.pageY,x2=e.data.startX,y2=e.data.startY;
|
|
var d=Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
|
|
if(d>3){
|
|
$(this).draggable("proxy").show();
|
|
}
|
|
this.pageY=e.pageY;
|
|
},onStopDrag:function(){
|
|
for(var i=0;i<_e7.disabledNodes.length;i++){
|
|
$(_e7.disabledNodes[i]).droppable("enable");
|
|
}
|
|
_e7.disabledNodes=[];
|
|
var _ed=_182(_e6,_e7.draggingNodeId);
|
|
if(_ed&&_ed.id=="easyui_tree_node_id_temp"){
|
|
_ed.id="";
|
|
_127(_e6,_ed);
|
|
}
|
|
_e8.onStopDrag.call(_e6,_ed);
|
|
}}).droppable({accept:"div.tree-node",onDragEnter:function(e,_ee){
|
|
if(_e8.onDragEnter.call(_e6,this,_ef(_ee))==false){
|
|
_f0(_ee,false);
|
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom");
|
|
$(this).droppable("disable");
|
|
_e7.disabledNodes.push(this);
|
|
}
|
|
},onDragOver:function(e,_f1){
|
|
if($(this).droppable("options").disabled){
|
|
return;
|
|
}
|
|
var _f2=_f1.pageY;
|
|
var top=$(this).offset().top;
|
|
var _f3=top+$(this).outerHeight();
|
|
_f0(_f1,true);
|
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom");
|
|
if(_f2>top+(_f3-top)/2){
|
|
if(_f3-_f2<5){
|
|
$(this).addClass("tree-node-bottom");
|
|
}else{
|
|
$(this).addClass("tree-node-append");
|
|
}
|
|
}else{
|
|
if(_f2-top<5){
|
|
$(this).addClass("tree-node-top");
|
|
}else{
|
|
$(this).addClass("tree-node-append");
|
|
}
|
|
}
|
|
if(_e8.onDragOver.call(_e6,this,_ef(_f1))==false){
|
|
_f0(_f1,false);
|
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom");
|
|
$(this).droppable("disable");
|
|
_e7.disabledNodes.push(this);
|
|
}
|
|
},onDragLeave:function(e,_f4){
|
|
_f0(_f4,false);
|
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom");
|
|
_e8.onDragLeave.call(_e6,this,_ef(_f4));
|
|
},onDrop:function(e,_f5){
|
|
var _f6=this;
|
|
var _f7,_f8;
|
|
if($(this).hasClass("tree-node-append")){
|
|
_f7=_f9;
|
|
_f8="append";
|
|
}else{
|
|
_f7=_fa;
|
|
_f8=$(this).hasClass("tree-node-top")?"top":"bottom";
|
|
}
|
|
if(_e8.onBeforeDrop.call(_e6,_f6,_ef(_f5),_f8)==false){
|
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom");
|
|
return;
|
|
}
|
|
_f7(_f5,_f6,_f8);
|
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom");
|
|
}});
|
|
function _ef(_fb,pop){
|
|
return $(_fb).closest("ul.tree").tree(pop?"pop":"getData",_fb);
|
|
};
|
|
function _f0(_fc,_fd){
|
|
var _fe=$(_fc).draggable("proxy").find("span.tree-dnd-icon");
|
|
_fe.removeClass("tree-dnd-yes tree-dnd-no").addClass(_fd?"tree-dnd-yes":"tree-dnd-no");
|
|
};
|
|
function _f9(_ff,dest){
|
|
if(_e0(_e6,dest).state=="closed"){
|
|
_13c(_e6,dest,function(){
|
|
_100();
|
|
});
|
|
}else{
|
|
_100();
|
|
}
|
|
function _100(){
|
|
var node=_ef(_ff,true);
|
|
$(_e6).tree("append",{parent:dest,data:[node]});
|
|
_e8.onDrop.call(_e6,dest,node,"append");
|
|
};
|
|
};
|
|
function _fa(_101,dest,_102){
|
|
var _103={};
|
|
if(_102=="top"){
|
|
_103.before=dest;
|
|
}else{
|
|
_103.after=dest;
|
|
}
|
|
var node=_ef(_101,true);
|
|
_103.data=node;
|
|
$(_e6).tree("insert",_103);
|
|
_e8.onDrop.call(_e6,dest,node,_102);
|
|
};
|
|
};
|
|
function _104(_105,_106,_107){
|
|
var _108=$.data(_105,"tree");
|
|
var opts=_108.options;
|
|
if(!opts.checkbox){
|
|
return;
|
|
}
|
|
var _109=_e0(_105,_106);
|
|
if(_107==undefined){
|
|
var ck=$(_106).find(".tree-checkbox");
|
|
if(ck.hasClass("tree-checkbox1")){
|
|
_107=false;
|
|
}else{
|
|
if(ck.hasClass("tree-checkbox0")){
|
|
_107=true;
|
|
}else{
|
|
if(_109._checked==undefined){
|
|
_109._checked=$(_106).find(".tree-checkbox").hasClass("tree-checkbox1");
|
|
}
|
|
_107=!_109._checked;
|
|
}
|
|
}
|
|
}
|
|
_109._checked=_107;
|
|
if(opts.onBeforeCheck.call(_105,_109,_107)==false){
|
|
return;
|
|
}
|
|
if(opts.cascadeCheck){
|
|
_10a(_109,_107);
|
|
_10b(_109,_107);
|
|
}else{
|
|
_10c($(_109.target),_107?"1":"0");
|
|
}
|
|
opts.onCheck.call(_105,_109,_107);
|
|
function _10c(node,flag){
|
|
var ck=node.find(".tree-checkbox");
|
|
ck.removeClass("tree-checkbox0 tree-checkbox1 tree-checkbox2");
|
|
ck.addClass("tree-checkbox"+flag);
|
|
};
|
|
function _10a(_10d,_10e){
|
|
if(opts.deepCheck){
|
|
var node=$("#"+_10d.domId);
|
|
var flag=_10e?"1":"0";
|
|
_10c(node,flag);
|
|
_10c(node.next(),flag);
|
|
}else{
|
|
_10f(_10d,_10e);
|
|
_12a(_10d.children||[],function(n){
|
|
_10f(n,_10e);
|
|
});
|
|
}
|
|
};
|
|
function _10f(_110,_111){
|
|
if(_110.hidden){
|
|
return;
|
|
}
|
|
var cls="tree-checkbox"+(_111?"1":"0");
|
|
var node=$("#"+_110.domId);
|
|
_10c(node,_111?"1":"0");
|
|
if(_110.children){
|
|
for(var i=0;i<_110.children.length;i++){
|
|
if(_110.children[i].hidden){
|
|
if(!$("#"+_110.children[i].domId).find("."+cls).length){
|
|
_10c(node,"2");
|
|
var _112=_14f(_105,node[0]);
|
|
while(_112){
|
|
_10c($(_112.target),"2");
|
|
_112=_14f(_105,_112[0]);
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function _10b(_113,_114){
|
|
var node=$("#"+_113.domId);
|
|
var _115=_14f(_105,node[0]);
|
|
if(_115){
|
|
var flag="";
|
|
if(_116(node,true)){
|
|
flag="1";
|
|
}else{
|
|
if(_116(node,false)){
|
|
flag="0";
|
|
}else{
|
|
flag="2";
|
|
}
|
|
}
|
|
_10c($(_115.target),flag);
|
|
_10b(_115,_114);
|
|
}
|
|
};
|
|
function _116(node,_117){
|
|
var cls="tree-checkbox"+(_117?"1":"0");
|
|
var ck=node.find(".tree-checkbox");
|
|
if(!ck.hasClass(cls)){
|
|
return false;
|
|
}
|
|
var b=true;
|
|
node.parent().siblings().each(function(){
|
|
var ck=$(this).children("div.tree-node").children(".tree-checkbox");
|
|
if(ck.length&&!ck.hasClass(cls)){
|
|
b=false;
|
|
return false;
|
|
}
|
|
});
|
|
return b;
|
|
};
|
|
};
|
|
function _118(_119,_11a){
|
|
var opts=$.data(_119,"tree").options;
|
|
if(!opts.checkbox){
|
|
return;
|
|
}
|
|
var node=$(_11a);
|
|
if(_11b(_119,_11a)){
|
|
var ck=node.find(".tree-checkbox");
|
|
if(ck.length){
|
|
if(ck.hasClass("tree-checkbox1")){
|
|
_104(_119,_11a,true);
|
|
}else{
|
|
_104(_119,_11a,false);
|
|
}
|
|
}else{
|
|
if(opts.onlyLeafCheck){
|
|
$("<span class=\"tree-checkbox tree-checkbox0\"></span>").insertBefore(node.find(".tree-title"));
|
|
}
|
|
}
|
|
}else{
|
|
var ck=node.find(".tree-checkbox");
|
|
if(opts.onlyLeafCheck){
|
|
ck.remove();
|
|
}else{
|
|
if(ck.hasClass("tree-checkbox1")){
|
|
_104(_119,_11a,true);
|
|
}else{
|
|
if(ck.hasClass("tree-checkbox2")){
|
|
var _11c=true;
|
|
var _11d=true;
|
|
var _11e=_11f(_119,_11a);
|
|
for(var i=0;i<_11e.length;i++){
|
|
if(_11e[i].checked){
|
|
_11d=false;
|
|
}else{
|
|
_11c=false;
|
|
}
|
|
}
|
|
if(_11c){
|
|
_104(_119,_11a,true);
|
|
}
|
|
if(_11d){
|
|
_104(_119,_11a,false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function _120(_121,ul,data,_122){
|
|
var _123=$.data(_121,"tree");
|
|
var opts=_123.options;
|
|
var _124=$(ul).prevAll("div.tree-node:first");
|
|
data=opts.loadFilter.call(_121,data,_124[0]);
|
|
var _125=_126(_121,"domId",_124.attr("id"));
|
|
if(!_122){
|
|
_125?_125.children=data:_123.data=data;
|
|
$(ul).empty();
|
|
}else{
|
|
if(_125){
|
|
_125.children?_125.children=_125.children.concat(data):_125.children=data;
|
|
}else{
|
|
_123.data=_123.data.concat(data);
|
|
}
|
|
}
|
|
opts.view.render.call(opts.view,_121,ul,data);
|
|
if(opts.dnd){
|
|
_e5(_121);
|
|
}
|
|
if(_125){
|
|
_127(_121,_125);
|
|
}
|
|
var _128=[];
|
|
var _129=[];
|
|
for(var i=0;i<data.length;i++){
|
|
var node=data[i];
|
|
if(!node.checked){
|
|
_128.push(node);
|
|
}
|
|
}
|
|
_12a(data,function(node){
|
|
if(node.checked){
|
|
_129.push(node);
|
|
}
|
|
});
|
|
var _12b=opts.onCheck;
|
|
opts.onCheck=function(){
|
|
};
|
|
if(_128.length){
|
|
_104(_121,$("#"+_128[0].domId)[0],false);
|
|
}
|
|
for(var i=0;i<_129.length;i++){
|
|
_104(_121,$("#"+_129[i].domId)[0],true);
|
|
}
|
|
opts.onCheck=_12b;
|
|
setTimeout(function(){
|
|
_12c(_121,_121);
|
|
},0);
|
|
opts.onLoadSuccess.call(_121,_125,data);
|
|
};
|
|
function _12c(_12d,ul,_12e){
|
|
var opts=$.data(_12d,"tree").options;
|
|
if(opts.lines){
|
|
$(_12d).addClass("tree-lines");
|
|
}else{
|
|
$(_12d).removeClass("tree-lines");
|
|
return;
|
|
}
|
|
if(!_12e){
|
|
_12e=true;
|
|
$(_12d).find("span.tree-indent").removeClass("tree-line tree-join tree-joinbottom");
|
|
$(_12d).find("div.tree-node").removeClass("tree-node-last tree-root-first tree-root-one");
|
|
var _12f=$(_12d).tree("getRoots");
|
|
if(_12f.length>1){
|
|
$(_12f[0].target).addClass("tree-root-first");
|
|
}else{
|
|
if(_12f.length==1){
|
|
$(_12f[0].target).addClass("tree-root-one");
|
|
}
|
|
}
|
|
}
|
|
$(ul).children("li").each(function(){
|
|
var node=$(this).children("div.tree-node");
|
|
var ul=node.next("ul");
|
|
if(ul.length){
|
|
if($(this).next().length){
|
|
_130(node);
|
|
}
|
|
_12c(_12d,ul,_12e);
|
|
}else{
|
|
_131(node);
|
|
}
|
|
});
|
|
var _132=$(ul).children("li:last").children("div.tree-node").addClass("tree-node-last");
|
|
_132.children("span.tree-join").removeClass("tree-join").addClass("tree-joinbottom");
|
|
function _131(node,_133){
|
|
var icon=node.find("span.tree-icon");
|
|
icon.prev("span.tree-indent").addClass("tree-join");
|
|
};
|
|
function _130(node){
|
|
var _134=node.find("span.tree-indent, span.tree-hit").length;
|
|
node.next().find("div.tree-node").each(function(){
|
|
$(this).children("span:eq("+(_134-1)+")").addClass("tree-line");
|
|
});
|
|
};
|
|
};
|
|
function _135(_136,ul,_137,_138){
|
|
var opts=$.data(_136,"tree").options;
|
|
_137=$.extend({},opts.queryParams,_137||{});
|
|
var _139=null;
|
|
if(_136!=ul){
|
|
var node=$(ul).prev();
|
|
_139=_e0(_136,node[0]);
|
|
}
|
|
if(opts.onBeforeLoad.call(_136,_139,_137)==false){
|
|
return;
|
|
}
|
|
var _13a=$(ul).prev().children("span.tree-folder");
|
|
_13a.addClass("tree-loading");
|
|
var _13b=opts.loader.call(_136,_137,function(data){
|
|
_13a.removeClass("tree-loading");
|
|
_120(_136,ul,data);
|
|
if(_138){
|
|
_138();
|
|
}
|
|
},function(){
|
|
_13a.removeClass("tree-loading");
|
|
opts.onLoadError.apply(_136,arguments);
|
|
if(_138){
|
|
_138();
|
|
}
|
|
});
|
|
if(_13b==false){
|
|
_13a.removeClass("tree-loading");
|
|
}
|
|
};
|
|
function _13c(_13d,_13e,_13f){
|
|
var opts=$.data(_13d,"tree").options;
|
|
var hit=$(_13e).children("span.tree-hit");
|
|
if(hit.length==0){
|
|
return;
|
|
}
|
|
if(hit.hasClass("tree-expanded")){
|
|
return;
|
|
}
|
|
var node=_e0(_13d,_13e);
|
|
if(opts.onBeforeExpand.call(_13d,node)==false){
|
|
return;
|
|
}
|
|
hit.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded");
|
|
hit.next().addClass("tree-folder-open");
|
|
var ul=$(_13e).next();
|
|
if(ul.length){
|
|
if(opts.animate){
|
|
ul.slideDown("normal",function(){
|
|
node.state="open";
|
|
opts.onExpand.call(_13d,node);
|
|
if(_13f){
|
|
_13f();
|
|
}
|
|
});
|
|
}else{
|
|
ul.css("display","block");
|
|
node.state="open";
|
|
opts.onExpand.call(_13d,node);
|
|
if(_13f){
|
|
_13f();
|
|
}
|
|
}
|
|
}else{
|
|
var _140=$("<ul style=\"display:none\"></ul>").insertAfter(_13e);
|
|
_135(_13d,_140[0],{id:node.id},function(){
|
|
if(_140.is(":empty")){
|
|
_140.remove();
|
|
}
|
|
if(opts.animate){
|
|
_140.slideDown("normal",function(){
|
|
node.state="open";
|
|
opts.onExpand.call(_13d,node);
|
|
if(_13f){
|
|
_13f();
|
|
}
|
|
});
|
|
}else{
|
|
_140.css("display","block");
|
|
node.state="open";
|
|
opts.onExpand.call(_13d,node);
|
|
if(_13f){
|
|
_13f();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
};
|
|
function _141(_142,_143){
|
|
var opts=$.data(_142,"tree").options;
|
|
var hit=$(_143).children("span.tree-hit");
|
|
if(hit.length==0){
|
|
return;
|
|
}
|
|
if(hit.hasClass("tree-collapsed")){
|
|
return;
|
|
}
|
|
var node=_e0(_142,_143);
|
|
if(opts.onBeforeCollapse.call(_142,node)==false){
|
|
return;
|
|
}
|
|
hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed");
|
|
hit.next().removeClass("tree-folder-open");
|
|
var ul=$(_143).next();
|
|
if(opts.animate){
|
|
ul.slideUp("normal",function(){
|
|
node.state="closed";
|
|
opts.onCollapse.call(_142,node);
|
|
});
|
|
}else{
|
|
ul.css("display","none");
|
|
node.state="closed";
|
|
opts.onCollapse.call(_142,node);
|
|
}
|
|
};
|
|
function _144(_145,_146){
|
|
var hit=$(_146).children("span.tree-hit");
|
|
if(hit.length==0){
|
|
return;
|
|
}
|
|
if(hit.hasClass("tree-expanded")){
|
|
_141(_145,_146);
|
|
}else{
|
|
_13c(_145,_146);
|
|
}
|
|
};
|
|
function _147(_148,_149){
|
|
var _14a=_11f(_148,_149);
|
|
if(_149){
|
|
_14a.unshift(_e0(_148,_149));
|
|
}
|
|
for(var i=0;i<_14a.length;i++){
|
|
_13c(_148,_14a[i].target);
|
|
}
|
|
};
|
|
function _14b(_14c,_14d){
|
|
var _14e=[];
|
|
var p=_14f(_14c,_14d);
|
|
while(p){
|
|
_14e.unshift(p);
|
|
p=_14f(_14c,p.target);
|
|
}
|
|
for(var i=0;i<_14e.length;i++){
|
|
_13c(_14c,_14e[i].target);
|
|
}
|
|
};
|
|
function _150(_151,_152){
|
|
var c=$(_151).parent();
|
|
while(c[0].tagName!="BODY"&&c.css("overflow-y")!="auto"){
|
|
c=c.parent();
|
|
}
|
|
var n=$(_152);
|
|
var ntop=n.offset().top;
|
|
if(c[0].tagName!="BODY"){
|
|
var ctop=c.offset().top;
|
|
if(ntop<ctop){
|
|
c.scrollTop(c.scrollTop()+ntop-ctop);
|
|
}else{
|
|
if(ntop+n.outerHeight()>ctop+c.outerHeight()-18){
|
|
c.scrollTop(c.scrollTop()+ntop+n.outerHeight()-ctop-c.outerHeight()+18);
|
|
}
|
|
}
|
|
}else{
|
|
c.scrollTop(ntop);
|
|
}
|
|
};
|
|
function _153(_154,_155){
|
|
var _156=_11f(_154,_155);
|
|
if(_155){
|
|
_156.unshift(_e0(_154,_155));
|
|
}
|
|
for(var i=0;i<_156.length;i++){
|
|
_141(_154,_156[i].target);
|
|
}
|
|
};
|
|
function _157(_158,_159){
|
|
var node=$(_159.parent);
|
|
var data=_159.data;
|
|
if(!data){
|
|
return;
|
|
}
|
|
data=$.isArray(data)?data:[data];
|
|
if(!data.length){
|
|
return;
|
|
}
|
|
var ul;
|
|
if(node.length==0){
|
|
ul=$(_158);
|
|
}else{
|
|
if(_11b(_158,node[0])){
|
|
var _15a=node.find("span.tree-icon");
|
|
_15a.removeClass("tree-file").addClass("tree-folder tree-folder-open");
|
|
var hit=$("<span class=\"tree-hit tree-expanded\"></span>").insertBefore(_15a);
|
|
if(hit.prev().length){
|
|
hit.prev().remove();
|
|
}
|
|
}
|
|
ul=node.next();
|
|
if(!ul.length){
|
|
ul=$("<ul></ul>").insertAfter(node);
|
|
}
|
|
}
|
|
_120(_158,ul[0],data,true);
|
|
_118(_158,ul.prev());
|
|
};
|
|
function _15b(_15c,_15d){
|
|
var ref=_15d.before||_15d.after;
|
|
var _15e=_14f(_15c,ref);
|
|
var data=_15d.data;
|
|
if(!data){
|
|
return;
|
|
}
|
|
data=$.isArray(data)?data:[data];
|
|
if(!data.length){
|
|
return;
|
|
}
|
|
_157(_15c,{parent:(_15e?_15e.target:null),data:data});
|
|
var _15f=_15e?_15e.children:$(_15c).tree("getRoots");
|
|
for(var i=0;i<_15f.length;i++){
|
|
if(_15f[i].domId==$(ref).attr("id")){
|
|
for(var j=data.length-1;j>=0;j--){
|
|
_15f.splice((_15d.before?i:(i+1)),0,data[j]);
|
|
}
|
|
_15f.splice(_15f.length-data.length,data.length);
|
|
break;
|
|
}
|
|
}
|
|
var li=$();
|
|
for(var i=0;i<data.length;i++){
|
|
li=li.add($("#"+data[i].domId).parent());
|
|
}
|
|
if(_15d.before){
|
|
li.insertBefore($(ref).parent());
|
|
}else{
|
|
li.insertAfter($(ref).parent());
|
|
}
|
|
};
|
|
function _160(_161,_162){
|
|
var _163=del(_162);
|
|
$(_162).parent().remove();
|
|
if(_163){
|
|
if(!_163.children||!_163.children.length){
|
|
var node=$(_163.target);
|
|
node.find(".tree-icon").removeClass("tree-folder").addClass("tree-file");
|
|
node.find(".tree-hit").remove();
|
|
$("<span class=\"tree-indent\"></span>").prependTo(node);
|
|
node.next().remove();
|
|
}
|
|
_127(_161,_163);
|
|
_118(_161,_163.target);
|
|
}
|
|
_12c(_161,_161);
|
|
function del(_164){
|
|
var id=$(_164).attr("id");
|
|
var _165=_14f(_161,_164);
|
|
var cc=_165?_165.children:$.data(_161,"tree").data;
|
|
for(var i=0;i<cc.length;i++){
|
|
if(cc[i].domId==id){
|
|
cc.splice(i,1);
|
|
break;
|
|
}
|
|
}
|
|
return _165;
|
|
};
|
|
};
|
|
function _127(_166,_167){
|
|
var opts=$.data(_166,"tree").options;
|
|
var node=$(_167.target);
|
|
var data=_e0(_166,_167.target);
|
|
var _168=data.checked;
|
|
if(data.iconCls){
|
|
node.find(".tree-icon").removeClass(data.iconCls);
|
|
}
|
|
$.extend(data,_167);
|
|
node.find(".tree-title").html(opts.formatter.call(_166,data));
|
|
if(data.iconCls){
|
|
node.find(".tree-icon").addClass(data.iconCls);
|
|
}
|
|
if(_168!=data.checked){
|
|
_104(_166,_167.target,data.checked);
|
|
}
|
|
};
|
|
function _169(_16a,_16b){
|
|
if(_16b){
|
|
var p=_14f(_16a,_16b);
|
|
while(p){
|
|
_16b=p.target;
|
|
p=_14f(_16a,_16b);
|
|
}
|
|
return _e0(_16a,_16b);
|
|
}else{
|
|
var _16c=_16d(_16a);
|
|
return _16c.length?_16c[0]:null;
|
|
}
|
|
};
|
|
function _16d(_16e){
|
|
var _16f=$.data(_16e,"tree").data;
|
|
for(var i=0;i<_16f.length;i++){
|
|
_170(_16f[i]);
|
|
}
|
|
return _16f;
|
|
};
|
|
function _11f(_171,_172){
|
|
var _173=[];
|
|
var n=_e0(_171,_172);
|
|
var data=n?(n.children||[]):$.data(_171,"tree").data;
|
|
_12a(data,function(node){
|
|
_173.push(_170(node));
|
|
});
|
|
return _173;
|
|
};
|
|
function _14f(_174,_175){
|
|
var p=$(_175).closest("ul").prevAll("div.tree-node:first");
|
|
return _e0(_174,p[0]);
|
|
};
|
|
function _176(_177,_178){
|
|
_178=_178||"checked";
|
|
if(!$.isArray(_178)){
|
|
_178=[_178];
|
|
}
|
|
var _179=[];
|
|
for(var i=0;i<_178.length;i++){
|
|
var s=_178[i];
|
|
if(s=="checked"){
|
|
_179.push("span.tree-checkbox1");
|
|
}else{
|
|
if(s=="unchecked"){
|
|
_179.push("span.tree-checkbox0");
|
|
}else{
|
|
if(s=="indeterminate"){
|
|
_179.push("span.tree-checkbox2");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var _17a=[];
|
|
$(_177).find(_179.join(",")).each(function(){
|
|
var node=$(this).parent();
|
|
_17a.push(_e0(_177,node[0]));
|
|
});
|
|
return _17a;
|
|
};
|
|
function _17b(_17c){
|
|
var node=$(_17c).find("div.tree-node-selected");
|
|
return node.length?_e0(_17c,node[0]):null;
|
|
};
|
|
function _17d(_17e,_17f){
|
|
var data=_e0(_17e,_17f);
|
|
if(data&&data.children){
|
|
_12a(data.children,function(node){
|
|
_170(node);
|
|
});
|
|
}
|
|
return data;
|
|
};
|
|
function _e0(_180,_181){
|
|
return _126(_180,"domId",$(_181).attr("id"));
|
|
};
|
|
function _182(_183,id){
|
|
return _126(_183,"id",id);
|
|
};
|
|
function _126(_184,_185,_186){
|
|
var data=$.data(_184,"tree").data;
|
|
var _187=null;
|
|
_12a(data,function(node){
|
|
if(node[_185]==_186){
|
|
_187=_170(node);
|
|
return false;
|
|
}
|
|
});
|
|
return _187;
|
|
};
|
|
function _170(node){
|
|
var d=$("#"+node.domId);
|
|
node.target=d[0];
|
|
node.checked=d.find(".tree-checkbox").hasClass("tree-checkbox1");
|
|
return node;
|
|
};
|
|
function _12a(data,_188){
|
|
var _189=[];
|
|
for(var i=0;i<data.length;i++){
|
|
_189.push(data[i]);
|
|
}
|
|
while(_189.length){
|
|
var node=_189.shift();
|
|
if(_188(node)==false){
|
|
return;
|
|
}
|
|
if(node.children){
|
|
for(var i=node.children.length-1;i>=0;i--){
|
|
_189.unshift(node.children[i]);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function _18a(_18b,_18c){
|
|
var opts=$.data(_18b,"tree").options;
|
|
var node=_e0(_18b,_18c);
|
|
if(opts.onBeforeSelect.call(_18b,node)==false){
|
|
return;
|
|
}
|
|
$(_18b).find("div.tree-node-selected").removeClass("tree-node-selected");
|
|
$(_18c).addClass("tree-node-selected");
|
|
opts.onSelect.call(_18b,node);
|
|
};
|
|
function _11b(_18d,_18e){
|
|
return $(_18e).children("span.tree-hit").length==0;
|
|
};
|
|
function _18f(_190,_191){
|
|
var opts=$.data(_190,"tree").options;
|
|
var node=_e0(_190,_191);
|
|
if(opts.onBeforeEdit.call(_190,node)==false){
|
|
return;
|
|
}
|
|
$(_191).css("position","relative");
|
|
var nt=$(_191).find(".tree-title");
|
|
var _192=nt.outerWidth();
|
|
nt.empty();
|
|
var _193=$("<input class=\"tree-editor\">").appendTo(nt);
|
|
_193.val(node.text).focus();
|
|
_193.width(_192+20);
|
|
_193.height(document.compatMode=="CSS1Compat"?(18-(_193.outerHeight()-_193.height())):18);
|
|
_193.bind("click",function(e){
|
|
return false;
|
|
}).bind("mousedown",function(e){
|
|
e.stopPropagation();
|
|
}).bind("mousemove",function(e){
|
|
e.stopPropagation();
|
|
}).bind("keydown",function(e){
|
|
if(e.keyCode==13){
|
|
_194(_190,_191);
|
|
return false;
|
|
}else{
|
|
if(e.keyCode==27){
|
|
_198(_190,_191);
|
|
return false;
|
|
}
|
|
}
|
|
}).bind("blur",function(e){
|
|
e.stopPropagation();
|
|
_194(_190,_191);
|
|
});
|
|
};
|
|
function _194(_195,_196){
|
|
var opts=$.data(_195,"tree").options;
|
|
$(_196).css("position","");
|
|
var _197=$(_196).find("input.tree-editor");
|
|
var val=_197.val();
|
|
_197.remove();
|
|
var node=_e0(_195,_196);
|
|
node.text=val;
|
|
_127(_195,node);
|
|
opts.onAfterEdit.call(_195,node);
|
|
};
|
|
function _198(_199,_19a){
|
|
var opts=$.data(_199,"tree").options;
|
|
$(_19a).css("position","");
|
|
$(_19a).find("input.tree-editor").remove();
|
|
var node=_e0(_199,_19a);
|
|
_127(_199,node);
|
|
opts.onCancelEdit.call(_199,node);
|
|
};
|
|
function _19b(_19c,q){
|
|
var _19d=$.data(_19c,"tree");
|
|
var opts=_19d.options;
|
|
var ids={};
|
|
_12a(_19d.data,function(node){
|
|
if(opts.filter.call(_19c,q,node)){
|
|
$("#"+node.domId).removeClass("tree-node-hidden");
|
|
ids[node.domId]=1;
|
|
node.hidden=false;
|
|
}else{
|
|
$("#"+node.domId).addClass("tree-node-hidden");
|
|
node.hidden=true;
|
|
}
|
|
});
|
|
for(var id in ids){
|
|
_19e(id);
|
|
}
|
|
function _19e(_19f){
|
|
var p=$(_19c).tree("getParent",$("#"+_19f)[0]);
|
|
while(p){
|
|
$(p.target).removeClass("tree-node-hidden");
|
|
p.hidden=false;
|
|
p=$(_19c).tree("getParent",p.target);
|
|
}
|
|
};
|
|
};
|
|
$.fn.tree=function(_1a0,_1a1){
|
|
if(typeof _1a0=="string"){
|
|
return $.fn.tree.methods[_1a0](this,_1a1);
|
|
}
|
|
var _1a0=_1a0||{};
|
|
return this.each(function(){
|
|
var _1a2=$.data(this,"tree");
|
|
var opts;
|
|
if(_1a2){
|
|
opts=$.extend(_1a2.options,_1a0);
|
|
_1a2.options=opts;
|
|
}else{
|
|
opts=$.extend({},$.fn.tree.defaults,$.fn.tree.parseOptions(this),_1a0);
|
|
$.data(this,"tree",{options:opts,tree:_d5(this),data:[]});
|
|
var data=$.fn.tree.parseData(this);
|
|
if(data.length){
|
|
_120(this,this,data);
|
|
}
|
|
}
|
|
_d8(this);
|
|
if(opts.data){
|
|
_120(this,this,$.extend(true,[],opts.data));
|
|
}
|
|
_135(this,this);
|
|
});
|
|
};
|
|
$.fn.tree.methods={options:function(jq){
|
|
return $.data(jq[0],"tree").options;
|
|
},loadData:function(jq,data){
|
|
return jq.each(function(){
|
|
_120(this,this,data);
|
|
});
|
|
},getNode:function(jq,_1a3){
|
|
return _e0(jq[0],_1a3);
|
|
},getData:function(jq,_1a4){
|
|
return _17d(jq[0],_1a4);
|
|
},reload:function(jq,_1a5){
|
|
return jq.each(function(){
|
|
if(_1a5){
|
|
var node=$(_1a5);
|
|
var hit=node.children("span.tree-hit");
|
|
hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed");
|
|
node.next().remove();
|
|
_13c(this,_1a5);
|
|
}else{
|
|
$(this).empty();
|
|
_135(this,this);
|
|
}
|
|
});
|
|
},getRoot:function(jq,_1a6){
|
|
return _169(jq[0],_1a6);
|
|
},getRoots:function(jq){
|
|
return _16d(jq[0]);
|
|
},getParent:function(jq,_1a7){
|
|
return _14f(jq[0],_1a7);
|
|
},getChildren:function(jq,_1a8){
|
|
return _11f(jq[0],_1a8);
|
|
},getChecked:function(jq,_1a9){
|
|
return _176(jq[0],_1a9);
|
|
},getSelected:function(jq){
|
|
return _17b(jq[0]);
|
|
},isLeaf:function(jq,_1aa){
|
|
return _11b(jq[0],_1aa);
|
|
},find:function(jq,id){
|
|
return _182(jq[0],id);
|
|
},select:function(jq,_1ab){
|
|
return jq.each(function(){
|
|
_18a(this,_1ab);
|
|
});
|
|
},check:function(jq,_1ac){
|
|
return jq.each(function(){
|
|
_104(this,_1ac,true);
|
|
});
|
|
},uncheck:function(jq,_1ad){
|
|
return jq.each(function(){
|
|
_104(this,_1ad,false);
|
|
});
|
|
},collapse:function(jq,_1ae){
|
|
return jq.each(function(){
|
|
_141(this,_1ae);
|
|
});
|
|
},expand:function(jq,_1af){
|
|
return jq.each(function(){
|
|
_13c(this,_1af);
|
|
});
|
|
},collapseAll:function(jq,_1b0){
|
|
return jq.each(function(){
|
|
_153(this,_1b0);
|
|
});
|
|
},expandAll:function(jq,_1b1){
|
|
return jq.each(function(){
|
|
_147(this,_1b1);
|
|
});
|
|
},expandTo:function(jq,_1b2){
|
|
return jq.each(function(){
|
|
_14b(this,_1b2);
|
|
});
|
|
},scrollTo:function(jq,_1b3){
|
|
return jq.each(function(){
|
|
_150(this,_1b3);
|
|
});
|
|
},toggle:function(jq,_1b4){
|
|
return jq.each(function(){
|
|
_144(this,_1b4);
|
|
});
|
|
},append:function(jq,_1b5){
|
|
return jq.each(function(){
|
|
_157(this,_1b5);
|
|
});
|
|
},insert:function(jq,_1b6){
|
|
return jq.each(function(){
|
|
_15b(this,_1b6);
|
|
});
|
|
},remove:function(jq,_1b7){
|
|
return jq.each(function(){
|
|
_160(this,_1b7);
|
|
});
|
|
},pop:function(jq,_1b8){
|
|
var node=jq.tree("getData",_1b8);
|
|
jq.tree("remove",_1b8);
|
|
return node;
|
|
},update:function(jq,_1b9){
|
|
return jq.each(function(){
|
|
_127(this,_1b9);
|
|
});
|
|
},enableDnd:function(jq){
|
|
return jq.each(function(){
|
|
_e5(this);
|
|
});
|
|
},disableDnd:function(jq){
|
|
return jq.each(function(){
|
|
_e1(this);
|
|
});
|
|
},beginEdit:function(jq,_1ba){
|
|
return jq.each(function(){
|
|
_18f(this,_1ba);
|
|
});
|
|
},endEdit:function(jq,_1bb){
|
|
return jq.each(function(){
|
|
_194(this,_1bb);
|
|
});
|
|
},cancelEdit:function(jq,_1bc){
|
|
return jq.each(function(){
|
|
_198(this,_1bc);
|
|
});
|
|
},doFilter:function(jq,q){
|
|
return jq.each(function(){
|
|
_19b(this,q);
|
|
});
|
|
}};
|
|
$.fn.tree.parseOptions=function(_1bd){
|
|
var t=$(_1bd);
|
|
return $.extend({},$.parser.parseOptions(_1bd,["url","method",{checkbox:"boolean",cascadeCheck:"boolean",onlyLeafCheck:"boolean"},{animate:"boolean",lines:"boolean",dnd:"boolean"}]));
|
|
};
|
|
$.fn.tree.parseData=function(_1be){
|
|
var data=[];
|
|
_1bf(data,$(_1be));
|
|
return data;
|
|
function _1bf(aa,tree){
|
|
tree.children("li").each(function(){
|
|
var node=$(this);
|
|
var item=$.extend({},$.parser.parseOptions(this,["id","iconCls","state"]),{checked:(node.attr("checked")?true:undefined)});
|
|
item.text=node.children("span").html();
|
|
if(!item.text){
|
|
item.text=node.html();
|
|
}
|
|
var _1c0=node.children("ul");
|
|
if(_1c0.length){
|
|
item.children=[];
|
|
_1bf(item.children,_1c0);
|
|
}
|
|
aa.push(item);
|
|
});
|
|
};
|
|
};
|
|
var _1c1=1;
|
|
var _1c2={render:function(_1c3,ul,data){
|
|
var opts=$.data(_1c3,"tree").options;
|
|
var _1c4=$(ul).prev("div.tree-node").find("span.tree-indent, span.tree-hit").length;
|
|
var cc=_1c5(_1c4,data);
|
|
$(ul).append(cc.join(""));
|
|
function _1c5(_1c6,_1c7){
|
|
var cc=[];
|
|
for(var i=0;i<_1c7.length;i++){
|
|
var item=_1c7[i];
|
|
if(item.state!="open"&&item.state!="closed"){
|
|
item.state="open";
|
|
}
|
|
item.domId="_easyui_tree_"+_1c1++;
|
|
cc.push("<li>");
|
|
cc.push("<div id=\""+item.domId+"\" class=\"tree-node\">");
|
|
for(var j=0;j<_1c6;j++){
|
|
cc.push("<span class=\"tree-indent\"></span>");
|
|
}
|
|
var _1c8=false;
|
|
if(item.state=="closed"){
|
|
cc.push("<span class=\"tree-hit tree-collapsed\"></span>");
|
|
cc.push("<span class=\"tree-icon tree-folder "+(item.iconCls?item.iconCls:"")+"\"></span>");
|
|
}else{
|
|
if(item.children&&item.children.length){
|
|
cc.push("<span class=\"tree-hit tree-expanded\"></span>");
|
|
cc.push("<span class=\"tree-icon tree-folder tree-folder-open "+(item.iconCls?item.iconCls:"")+"\"></span>");
|
|
}else{
|
|
cc.push("<span class=\"tree-indent\"></span>");
|
|
cc.push("<span class=\"tree-icon tree-file "+(item.iconCls?item.iconCls:"")+"\"></span>");
|
|
_1c8=true;
|
|
}
|
|
}
|
|
if(opts.checkbox){
|
|
if((!opts.onlyLeafCheck)||_1c8){
|
|
cc.push("<span class=\"tree-checkbox tree-checkbox0\"></span>");
|
|
}
|
|
}
|
|
cc.push("<span class=\"tree-title\">"+opts.formatter.call(_1c3,item)+"</span>");
|
|
cc.push("</div>");
|
|
if(item.children&&item.children.length){
|
|
var tmp=_1c5(_1c6+1,item.children);
|
|
cc.push("<ul style=\"display:"+(item.state=="closed"?"none":"block")+"\">");
|
|
cc=cc.concat(tmp);
|
|
cc.push("</ul>");
|
|
}
|
|
cc.push("</li>");
|
|
}
|
|
return cc;
|
|
};
|
|
}};
|
|
$.fn.tree.defaults={url:null,method:"post",animate:false,checkbox:false,cascadeCheck:true,onlyLeafCheck:false,lines:false,dnd:false,data:null,queryParams:{},formatter:function(node){
|
|
return node.text;
|
|
},filter:function(q,node){
|
|
return node.text.toLowerCase().indexOf(q.toLowerCase())>=0;
|
|
},loader:function(_1c9,_1ca,_1cb){
|
|
var opts=$(this).tree("options");
|
|
if(!opts.url){
|
|
return false;
|
|
}
|
|
$.ajax({type:opts.method,url:opts.url,data:_1c9,dataType:"json",success:function(data){
|
|
_1ca(data);
|
|
},error:function(){
|
|
_1cb.apply(this,arguments);
|
|
}});
|
|
},loadFilter:function(data,_1cc){
|
|
return data;
|
|
},view:_1c2,onBeforeLoad:function(node,_1cd){
|
|
},onLoadSuccess:function(node,data){
|
|
},onLoadError:function(){
|
|
},onClick:function(node){
|
|
},onDblClick:function(node){
|
|
},onBeforeExpand:function(node){
|
|
},onExpand:function(node){
|
|
},onBeforeCollapse:function(node){
|
|
},onCollapse:function(node){
|
|
},onBeforeCheck:function(node,_1ce){
|
|
},onCheck:function(node,_1cf){
|
|
},onBeforeSelect:function(node){
|
|
},onSelect:function(node){
|
|
},onContextMenu:function(e,node){
|
|
},onBeforeDrag:function(node){
|
|
},onStartDrag:function(node){
|
|
},onStopDrag:function(node){
|
|
},onDragEnter:function(_1d0,_1d1){
|
|
},onDragOver:function(_1d2,_1d3){
|
|
},onDragLeave:function(_1d4,_1d5){
|
|
},onBeforeDrop:function(_1d6,_1d7,_1d8){
|
|
},onDrop:function(_1d9,_1da,_1db){
|
|
},onBeforeEdit:function(node){
|
|
},onAfterEdit:function(node){
|
|
},onCancelEdit:function(node){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_1dc){
|
|
$(_1dc).addClass("progressbar");
|
|
$(_1dc).html("<div class=\"progressbar-text\"></div><div class=\"progressbar-value\"><div class=\"progressbar-text\"></div></div>");
|
|
$(_1dc).bind("_resize",function(e,_1dd){
|
|
if($(this).hasClass("easyui-fluid")||_1dd){
|
|
_1de(_1dc);
|
|
}
|
|
return false;
|
|
});
|
|
return $(_1dc);
|
|
};
|
|
function _1de(_1df,_1e0){
|
|
var opts=$.data(_1df,"progressbar").options;
|
|
var bar=$.data(_1df,"progressbar").bar;
|
|
if(_1e0){
|
|
opts.width=_1e0;
|
|
}
|
|
bar._size(opts);
|
|
bar.find("div.progressbar-text").css("width",bar.width());
|
|
bar.find("div.progressbar-text,div.progressbar-value").css({height:bar.height()+"px",lineHeight:bar.height()+"px"});
|
|
};
|
|
$.fn.progressbar=function(_1e1,_1e2){
|
|
if(typeof _1e1=="string"){
|
|
var _1e3=$.fn.progressbar.methods[_1e1];
|
|
if(_1e3){
|
|
return _1e3(this,_1e2);
|
|
}
|
|
}
|
|
_1e1=_1e1||{};
|
|
return this.each(function(){
|
|
var _1e4=$.data(this,"progressbar");
|
|
if(_1e4){
|
|
$.extend(_1e4.options,_1e1);
|
|
}else{
|
|
_1e4=$.data(this,"progressbar",{options:$.extend({},$.fn.progressbar.defaults,$.fn.progressbar.parseOptions(this),_1e1),bar:init(this)});
|
|
}
|
|
$(this).progressbar("setValue",_1e4.options.value);
|
|
_1de(this);
|
|
});
|
|
};
|
|
$.fn.progressbar.methods={options:function(jq){
|
|
return $.data(jq[0],"progressbar").options;
|
|
},resize:function(jq,_1e5){
|
|
return jq.each(function(){
|
|
_1de(this,_1e5);
|
|
});
|
|
},getValue:function(jq){
|
|
return $.data(jq[0],"progressbar").options.value;
|
|
},setValue:function(jq,_1e6){
|
|
if(_1e6<0){
|
|
_1e6=0;
|
|
}
|
|
if(_1e6>100){
|
|
_1e6=100;
|
|
}
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"progressbar").options;
|
|
var text=opts.text.replace(/{value}/,_1e6);
|
|
var _1e7=opts.value;
|
|
opts.value=_1e6;
|
|
$(this).find("div.progressbar-value").width(_1e6+"%");
|
|
$(this).find("div.progressbar-text").html(text);
|
|
if(_1e7!=_1e6){
|
|
opts.onChange.call(this,_1e6,_1e7);
|
|
}
|
|
});
|
|
}};
|
|
$.fn.progressbar.parseOptions=function(_1e8){
|
|
return $.extend({},$.parser.parseOptions(_1e8,["width","height","text",{value:"number"}]));
|
|
};
|
|
$.fn.progressbar.defaults={width:"auto",height:22,value:0,text:"{value}%",onChange:function(_1e9,_1ea){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_1eb){
|
|
$(_1eb).addClass("tooltip-f");
|
|
};
|
|
function _1ec(_1ed){
|
|
var opts=$.data(_1ed,"tooltip").options;
|
|
$(_1ed).unbind(".tooltip").bind(opts.showEvent+".tooltip",function(e){
|
|
$(_1ed).tooltip("show",e);
|
|
}).bind(opts.hideEvent+".tooltip",function(e){
|
|
$(_1ed).tooltip("hide",e);
|
|
}).bind("mousemove.tooltip",function(e){
|
|
if(opts.trackMouse){
|
|
opts.trackMouseX=e.pageX;
|
|
opts.trackMouseY=e.pageY;
|
|
$(_1ed).tooltip("reposition");
|
|
}
|
|
});
|
|
};
|
|
function _1ee(_1ef){
|
|
var _1f0=$.data(_1ef,"tooltip");
|
|
if(_1f0.showTimer){
|
|
clearTimeout(_1f0.showTimer);
|
|
_1f0.showTimer=null;
|
|
}
|
|
if(_1f0.hideTimer){
|
|
clearTimeout(_1f0.hideTimer);
|
|
_1f0.hideTimer=null;
|
|
}
|
|
};
|
|
function _1f1(_1f2){
|
|
var _1f3=$.data(_1f2,"tooltip");
|
|
if(!_1f3||!_1f3.tip){
|
|
return;
|
|
}
|
|
var opts=_1f3.options;
|
|
var tip=_1f3.tip;
|
|
var pos={left:-100000,top:-100000};
|
|
if($(_1f2).is(":visible")){
|
|
pos=_1f4(opts.position);
|
|
if(opts.position=="top"&&pos.top<0){
|
|
pos=_1f4("bottom");
|
|
}else{
|
|
if((opts.position=="bottom")&&(pos.top+tip._outerHeight()>$(window)._outerHeight()+$(document).scrollTop())){
|
|
pos=_1f4("top");
|
|
}
|
|
}
|
|
if(pos.left<0){
|
|
if(opts.position=="left"){
|
|
pos=_1f4("right");
|
|
}else{
|
|
$(_1f2).tooltip("arrow").css("left",tip._outerWidth()/2+pos.left);
|
|
pos.left=0;
|
|
}
|
|
}else{
|
|
if(pos.left+tip._outerWidth()>$(window)._outerWidth()+$(document)._scrollLeft()){
|
|
if(opts.position=="right"){
|
|
pos=_1f4("left");
|
|
}else{
|
|
var left=pos.left;
|
|
pos.left=$(window)._outerWidth()+$(document)._scrollLeft()-tip._outerWidth();
|
|
$(_1f2).tooltip("arrow").css("left",tip._outerWidth()/2-(pos.left-left));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
tip.css({left:pos.left,top:pos.top,zIndex:(opts.zIndex!=undefined?opts.zIndex:($.fn.window?$.fn.window.defaults.zIndex++:""))});
|
|
opts.onPosition.call(_1f2,pos.left,pos.top);
|
|
function _1f4(_1f5){
|
|
opts.position=_1f5||"bottom";
|
|
tip.removeClass("tooltip-top tooltip-bottom tooltip-left tooltip-right").addClass("tooltip-"+opts.position);
|
|
var left,top;
|
|
if(opts.trackMouse){
|
|
t=$();
|
|
left=opts.trackMouseX+opts.deltaX;
|
|
top=opts.trackMouseY+opts.deltaY;
|
|
}else{
|
|
var t=$(_1f2);
|
|
left=t.offset().left+opts.deltaX;
|
|
top=t.offset().top+opts.deltaY;
|
|
}
|
|
switch(opts.position){
|
|
case "right":
|
|
left+=t._outerWidth()+12+(opts.trackMouse?12:0);
|
|
top-=(tip._outerHeight()-t._outerHeight())/2;
|
|
break;
|
|
case "left":
|
|
left-=tip._outerWidth()+12+(opts.trackMouse?12:0);
|
|
top-=(tip._outerHeight()-t._outerHeight())/2;
|
|
break;
|
|
case "top":
|
|
left-=(tip._outerWidth()-t._outerWidth())/2;
|
|
top-=tip._outerHeight()+12+(opts.trackMouse?12:0);
|
|
break;
|
|
case "bottom":
|
|
left-=(tip._outerWidth()-t._outerWidth())/2;
|
|
top+=t._outerHeight()+12+(opts.trackMouse?12:0);
|
|
break;
|
|
}
|
|
return {left:left,top:top};
|
|
};
|
|
};
|
|
function _1f6(_1f7,e){
|
|
var _1f8=$.data(_1f7,"tooltip");
|
|
var opts=_1f8.options;
|
|
var tip=_1f8.tip;
|
|
if(!tip){
|
|
tip=$("<div tabindex=\"-1\" class=\"tooltip\">"+"<div class=\"tooltip-content\"></div>"+"<div class=\"tooltip-arrow-outer\"></div>"+"<div class=\"tooltip-arrow\"></div>"+"</div>").appendTo("body");
|
|
_1f8.tip=tip;
|
|
_1f9(_1f7);
|
|
}
|
|
_1ee(_1f7);
|
|
_1f8.showTimer=setTimeout(function(){
|
|
$(_1f7).tooltip("reposition");
|
|
tip.show();
|
|
opts.onShow.call(_1f7,e);
|
|
var _1fa=tip.children(".tooltip-arrow-outer");
|
|
var _1fb=tip.children(".tooltip-arrow");
|
|
var bc="border-"+opts.position+"-color";
|
|
_1fa.add(_1fb).css({borderTopColor:"",borderBottomColor:"",borderLeftColor:"",borderRightColor:""});
|
|
_1fa.css(bc,tip.css(bc));
|
|
_1fb.css(bc,tip.css("backgroundColor"));
|
|
},opts.showDelay);
|
|
};
|
|
function _1fc(_1fd,e){
|
|
var _1fe=$.data(_1fd,"tooltip");
|
|
if(_1fe&&_1fe.tip){
|
|
_1ee(_1fd);
|
|
_1fe.hideTimer=setTimeout(function(){
|
|
_1fe.tip.hide();
|
|
_1fe.options.onHide.call(_1fd,e);
|
|
},_1fe.options.hideDelay);
|
|
}
|
|
};
|
|
function _1f9(_1ff,_200){
|
|
var _201=$.data(_1ff,"tooltip");
|
|
var opts=_201.options;
|
|
if(_200){
|
|
opts.content=_200;
|
|
}
|
|
if(!_201.tip){
|
|
return;
|
|
}
|
|
var cc=typeof opts.content=="function"?opts.content.call(_1ff):opts.content;
|
|
_201.tip.children(".tooltip-content").html(cc);
|
|
opts.onUpdate.call(_1ff,cc);
|
|
};
|
|
function _202(_203){
|
|
var _204=$.data(_203,"tooltip");
|
|
if(_204){
|
|
_1ee(_203);
|
|
var opts=_204.options;
|
|
if(_204.tip){
|
|
_204.tip.remove();
|
|
}
|
|
if(opts._title){
|
|
$(_203).attr("title",opts._title);
|
|
}
|
|
$.removeData(_203,"tooltip");
|
|
$(_203).unbind(".tooltip").removeClass("tooltip-f");
|
|
opts.onDestroy.call(_203);
|
|
}
|
|
};
|
|
$.fn.tooltip=function(_205,_206){
|
|
if(typeof _205=="string"){
|
|
return $.fn.tooltip.methods[_205](this,_206);
|
|
}
|
|
_205=_205||{};
|
|
return this.each(function(){
|
|
var _207=$.data(this,"tooltip");
|
|
if(_207){
|
|
$.extend(_207.options,_205);
|
|
}else{
|
|
$.data(this,"tooltip",{options:$.extend({},$.fn.tooltip.defaults,$.fn.tooltip.parseOptions(this),_205)});
|
|
init(this);
|
|
}
|
|
_1ec(this);
|
|
_1f9(this);
|
|
});
|
|
};
|
|
$.fn.tooltip.methods={options:function(jq){
|
|
return $.data(jq[0],"tooltip").options;
|
|
},tip:function(jq){
|
|
return $.data(jq[0],"tooltip").tip;
|
|
},arrow:function(jq){
|
|
return jq.tooltip("tip").children(".tooltip-arrow-outer,.tooltip-arrow");
|
|
},show:function(jq,e){
|
|
return jq.each(function(){
|
|
_1f6(this,e);
|
|
});
|
|
},hide:function(jq,e){
|
|
return jq.each(function(){
|
|
_1fc(this,e);
|
|
});
|
|
},update:function(jq,_208){
|
|
return jq.each(function(){
|
|
_1f9(this,_208);
|
|
});
|
|
},reposition:function(jq){
|
|
return jq.each(function(){
|
|
_1f1(this);
|
|
});
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
_202(this);
|
|
});
|
|
}};
|
|
$.fn.tooltip.parseOptions=function(_209){
|
|
var t=$(_209);
|
|
var opts=$.extend({},$.parser.parseOptions(_209,["position","showEvent","hideEvent","content",{trackMouse:"boolean",deltaX:"number",deltaY:"number",showDelay:"number",hideDelay:"number"}]),{_title:t.attr("title")});
|
|
t.attr("title","");
|
|
if(!opts.content){
|
|
opts.content=opts._title;
|
|
}
|
|
return opts;
|
|
};
|
|
$.fn.tooltip.defaults={position:"bottom",content:null,trackMouse:false,deltaX:0,deltaY:0,showEvent:"mouseenter",hideEvent:"mouseleave",showDelay:200,hideDelay:100,onShow:function(e){
|
|
},onHide:function(e){
|
|
},onUpdate:function(_20a){
|
|
},onPosition:function(left,top){
|
|
},onDestroy:function(){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
$.fn._remove=function(){
|
|
return this.each(function(){
|
|
$(this).remove();
|
|
try{
|
|
this.outerHTML="";
|
|
}
|
|
catch(err){
|
|
}
|
|
});
|
|
};
|
|
function _20b(node){
|
|
node._remove();
|
|
};
|
|
function _20c(_20d,_20e){
|
|
var _20f=$.data(_20d,"panel");
|
|
var opts=_20f.options;
|
|
var _210=_20f.panel;
|
|
var _211=_210.children(".panel-header");
|
|
var _212=_210.children(".panel-body");
|
|
var _213=_210.children(".panel-footer");
|
|
if(_20e){
|
|
$.extend(opts,{width:_20e.width,height:_20e.height,minWidth:_20e.minWidth,maxWidth:_20e.maxWidth,minHeight:_20e.minHeight,maxHeight:_20e.maxHeight,left:_20e.left,top:_20e.top});
|
|
}
|
|
_210._size(opts);
|
|
_211.add(_212)._outerWidth(_210.width());
|
|
if(!isNaN(parseInt(opts.height))){
|
|
_212._outerHeight(_210.height()-_211._outerHeight()-_213._outerHeight());
|
|
}else{
|
|
_212.css("height","");
|
|
var min=$.parser.parseValue("minHeight",opts.minHeight,_210.parent());
|
|
var max=$.parser.parseValue("maxHeight",opts.maxHeight,_210.parent());
|
|
var _214=_211._outerHeight()+_213._outerHeight()+_210._outerHeight()-_210.height();
|
|
_212._size("minHeight",min?(min-_214):"");
|
|
_212._size("maxHeight",max?(max-_214):"");
|
|
}
|
|
_210.css({height:"",minHeight:"",maxHeight:"",left:opts.left,top:opts.top});
|
|
opts.onResize.apply(_20d,[opts.width,opts.height]);
|
|
$(_20d).panel("doLayout");
|
|
};
|
|
function _215(_216,_217){
|
|
var opts=$.data(_216,"panel").options;
|
|
var _218=$.data(_216,"panel").panel;
|
|
if(_217){
|
|
if(_217.left!=null){
|
|
opts.left=_217.left;
|
|
}
|
|
if(_217.top!=null){
|
|
opts.top=_217.top;
|
|
}
|
|
}
|
|
_218.css({left:opts.left,top:opts.top});
|
|
opts.onMove.apply(_216,[opts.left,opts.top]);
|
|
};
|
|
function _219(_21a){
|
|
$(_21a).addClass("panel-body")._size("clear");
|
|
var _21b=$("<div class=\"panel\"></div>").insertBefore(_21a);
|
|
_21b[0].appendChild(_21a);
|
|
_21b.bind("_resize",function(e,_21c){
|
|
if($(this).hasClass("easyui-fluid")||_21c){
|
|
_20c(_21a);
|
|
}
|
|
return false;
|
|
});
|
|
return _21b;
|
|
};
|
|
function _21d(_21e){
|
|
var _21f=$.data(_21e,"panel");
|
|
var opts=_21f.options;
|
|
var _220=_21f.panel;
|
|
_220.css(opts.style);
|
|
_220.addClass(opts.cls);
|
|
_221();
|
|
_222();
|
|
var _223=$(_21e).panel("header");
|
|
var body=$(_21e).panel("body");
|
|
var _224=$(_21e).siblings(".panel-footer");
|
|
if(opts.border){
|
|
_223.removeClass("panel-header-noborder");
|
|
body.removeClass("panel-body-noborder");
|
|
_224.removeClass("panel-footer-noborder");
|
|
}else{
|
|
_223.addClass("panel-header-noborder");
|
|
body.addClass("panel-body-noborder");
|
|
_224.addClass("panel-footer-noborder");
|
|
}
|
|
_223.addClass(opts.headerCls);
|
|
body.addClass(opts.bodyCls);
|
|
$(_21e).attr("id",opts.id||"");
|
|
if(opts.content){
|
|
$(_21e).panel("clear");
|
|
$(_21e).html(opts.content);
|
|
$.parser.parse($(_21e));
|
|
}
|
|
function _221(){
|
|
if(opts.noheader||(!opts.title&&!opts.header)){
|
|
_20b(_220.children(".panel-header"));
|
|
_220.children(".panel-body").addClass("panel-body-noheader");
|
|
}else{
|
|
if(opts.header){
|
|
$(opts.header).addClass("panel-header").prependTo(_220);
|
|
}else{
|
|
var _225=_220.children(".panel-header");
|
|
if(!_225.length){
|
|
_225=$("<div class=\"panel-header\"></div>").prependTo(_220);
|
|
}
|
|
if(!$.isArray(opts.tools)){
|
|
_225.find("div.panel-tool .panel-tool-a").appendTo(opts.tools);
|
|
}
|
|
_225.empty();
|
|
var _226=$("<div class=\"panel-title\"></div>").html(opts.title).appendTo(_225);
|
|
if(opts.iconCls){
|
|
_226.addClass("panel-with-icon");
|
|
$("<div class=\"panel-icon\"></div>").addClass(opts.iconCls).appendTo(_225);
|
|
}
|
|
var tool=$("<div class=\"panel-tool\"></div>").appendTo(_225);
|
|
tool.bind("click",function(e){
|
|
e.stopPropagation();
|
|
});
|
|
if(opts.tools){
|
|
if($.isArray(opts.tools)){
|
|
$.map(opts.tools,function(t){
|
|
_227(tool,t.iconCls,eval(t.handler));
|
|
});
|
|
}else{
|
|
$(opts.tools).children().each(function(){
|
|
$(this).addClass($(this).attr("iconCls")).addClass("panel-tool-a").appendTo(tool);
|
|
});
|
|
}
|
|
}
|
|
if(opts.collapsible){
|
|
_227(tool,"panel-tool-collapse",function(){
|
|
if(opts.collapsed==true){
|
|
_245(_21e,true);
|
|
}else{
|
|
_238(_21e,true);
|
|
}
|
|
});
|
|
}
|
|
if(opts.minimizable){
|
|
_227(tool,"panel-tool-min",function(){
|
|
_24b(_21e);
|
|
});
|
|
}
|
|
if(opts.maximizable){
|
|
_227(tool,"panel-tool-max",function(){
|
|
if(opts.maximized==true){
|
|
_24e(_21e);
|
|
}else{
|
|
_237(_21e);
|
|
}
|
|
});
|
|
}
|
|
if(opts.closable){
|
|
_227(tool,"panel-tool-close",function(){
|
|
_239(_21e);
|
|
});
|
|
}
|
|
}
|
|
_220.children("div.panel-body").removeClass("panel-body-noheader");
|
|
}
|
|
};
|
|
function _227(c,icon,_228){
|
|
var a=$("<a href=\"javascript:void(0)\"></a>").addClass(icon).appendTo(c);
|
|
a.bind("click",_228);
|
|
};
|
|
function _222(){
|
|
if(opts.footer){
|
|
$(opts.footer).addClass("panel-footer").appendTo(_220);
|
|
$(_21e).addClass("panel-body-nobottom");
|
|
}else{
|
|
_220.children(".panel-footer").remove();
|
|
$(_21e).removeClass("panel-body-nobottom");
|
|
}
|
|
};
|
|
};
|
|
function _229(_22a,_22b){
|
|
var _22c=$.data(_22a,"panel");
|
|
var opts=_22c.options;
|
|
if(_22d){
|
|
opts.queryParams=_22b;
|
|
}
|
|
if(!opts.href){
|
|
return;
|
|
}
|
|
if(!_22c.isLoaded||!opts.cache){
|
|
var _22d=$.extend({},opts.queryParams);
|
|
if(opts.onBeforeLoad.call(_22a,_22d)==false){
|
|
return;
|
|
}
|
|
_22c.isLoaded=false;
|
|
$(_22a).panel("clear");
|
|
if(opts.loadingMessage){
|
|
$(_22a).html($("<div class=\"panel-loading\"></div>").html(opts.loadingMessage));
|
|
}
|
|
opts.loader.call(_22a,_22d,function(data){
|
|
var _22e=opts.extractor.call(_22a,data);
|
|
$(_22a).html(_22e);
|
|
$.parser.parse($(_22a));
|
|
opts.onLoad.apply(_22a,arguments);
|
|
_22c.isLoaded=true;
|
|
},function(){
|
|
opts.onLoadError.apply(_22a,arguments);
|
|
});
|
|
}
|
|
};
|
|
function _22f(_230){
|
|
var t=$(_230);
|
|
t.find(".combo-f").each(function(){
|
|
$(this).combo("destroy");
|
|
});
|
|
t.find(".m-btn").each(function(){
|
|
$(this).menubutton("destroy");
|
|
});
|
|
t.find(".s-btn").each(function(){
|
|
$(this).splitbutton("destroy");
|
|
});
|
|
t.find(".tooltip-f").each(function(){
|
|
$(this).tooltip("destroy");
|
|
});
|
|
t.children("div").each(function(){
|
|
$(this)._size("unfit");
|
|
});
|
|
t.empty();
|
|
};
|
|
function _231(_232){
|
|
$(_232).panel("doLayout",true);
|
|
};
|
|
function _233(_234,_235){
|
|
var opts=$.data(_234,"panel").options;
|
|
var _236=$.data(_234,"panel").panel;
|
|
if(_235!=true){
|
|
if(opts.onBeforeOpen.call(_234)==false){
|
|
return;
|
|
}
|
|
}
|
|
_236.stop(true,true);
|
|
if($.isFunction(opts.openAnimation)){
|
|
opts.openAnimation.call(_234,cb);
|
|
}else{
|
|
switch(opts.openAnimation){
|
|
case "slide":
|
|
_236.slideDown(opts.openDuration,cb);
|
|
break;
|
|
case "fade":
|
|
_236.fadeIn(opts.openDuration,cb);
|
|
break;
|
|
case "show":
|
|
_236.show(opts.openDuration,cb);
|
|
break;
|
|
default:
|
|
_236.show();
|
|
cb();
|
|
}
|
|
}
|
|
function cb(){
|
|
opts.closed=false;
|
|
opts.minimized=false;
|
|
var tool=_236.children(".panel-header").find("a.panel-tool-restore");
|
|
if(tool.length){
|
|
opts.maximized=true;
|
|
}
|
|
opts.onOpen.call(_234);
|
|
if(opts.maximized==true){
|
|
opts.maximized=false;
|
|
_237(_234);
|
|
}
|
|
if(opts.collapsed==true){
|
|
opts.collapsed=false;
|
|
_238(_234);
|
|
}
|
|
if(!opts.collapsed){
|
|
_229(_234);
|
|
_231(_234);
|
|
}
|
|
};
|
|
};
|
|
function _239(_23a,_23b){
|
|
var opts=$.data(_23a,"panel").options;
|
|
var _23c=$.data(_23a,"panel").panel;
|
|
if(_23b!=true){
|
|
if(opts.onBeforeClose.call(_23a)==false){
|
|
return;
|
|
}
|
|
}
|
|
_23c.stop(true,true);
|
|
_23c._size("unfit");
|
|
if($.isFunction(opts.closeAnimation)){
|
|
opts.closeAnimation.call(_23a,cb);
|
|
}else{
|
|
switch(opts.closeAnimation){
|
|
case "slide":
|
|
_23c.slideUp(opts.closeDuration,cb);
|
|
break;
|
|
case "fade":
|
|
_23c.fadeOut(opts.closeDuration,cb);
|
|
break;
|
|
case "hide":
|
|
_23c.hide(opts.closeDuration,cb);
|
|
break;
|
|
default:
|
|
_23c.hide();
|
|
cb();
|
|
}
|
|
}
|
|
function cb(){
|
|
opts.closed=true;
|
|
opts.onClose.call(_23a);
|
|
};
|
|
};
|
|
function _23d(_23e,_23f){
|
|
var _240=$.data(_23e,"panel");
|
|
var opts=_240.options;
|
|
var _241=_240.panel;
|
|
if(_23f!=true){
|
|
if(opts.onBeforeDestroy.call(_23e)==false){
|
|
return;
|
|
}
|
|
}
|
|
$(_23e).panel("clear").panel("clear","footer");
|
|
_20b(_241);
|
|
opts.onDestroy.call(_23e);
|
|
};
|
|
function _238(_242,_243){
|
|
var opts=$.data(_242,"panel").options;
|
|
var _244=$.data(_242,"panel").panel;
|
|
var body=_244.children(".panel-body");
|
|
var tool=_244.children(".panel-header").find("a.panel-tool-collapse");
|
|
if(opts.collapsed==true){
|
|
return;
|
|
}
|
|
body.stop(true,true);
|
|
if(opts.onBeforeCollapse.call(_242)==false){
|
|
return;
|
|
}
|
|
tool.addClass("panel-tool-expand");
|
|
if(_243==true){
|
|
body.slideUp("normal",function(){
|
|
opts.collapsed=true;
|
|
opts.onCollapse.call(_242);
|
|
});
|
|
}else{
|
|
body.hide();
|
|
opts.collapsed=true;
|
|
opts.onCollapse.call(_242);
|
|
}
|
|
};
|
|
function _245(_246,_247){
|
|
var opts=$.data(_246,"panel").options;
|
|
var _248=$.data(_246,"panel").panel;
|
|
var body=_248.children(".panel-body");
|
|
var tool=_248.children(".panel-header").find("a.panel-tool-collapse");
|
|
if(opts.collapsed==false){
|
|
return;
|
|
}
|
|
body.stop(true,true);
|
|
if(opts.onBeforeExpand.call(_246)==false){
|
|
return;
|
|
}
|
|
tool.removeClass("panel-tool-expand");
|
|
if(_247==true){
|
|
body.slideDown("normal",function(){
|
|
opts.collapsed=false;
|
|
opts.onExpand.call(_246);
|
|
_229(_246);
|
|
_231(_246);
|
|
});
|
|
}else{
|
|
body.show();
|
|
opts.collapsed=false;
|
|
opts.onExpand.call(_246);
|
|
_229(_246);
|
|
_231(_246);
|
|
}
|
|
};
|
|
function _237(_249){
|
|
var opts=$.data(_249,"panel").options;
|
|
var _24a=$.data(_249,"panel").panel;
|
|
var tool=_24a.children(".panel-header").find("a.panel-tool-max");
|
|
if(opts.maximized==true){
|
|
return;
|
|
}
|
|
tool.addClass("panel-tool-restore");
|
|
if(!$.data(_249,"panel").original){
|
|
$.data(_249,"panel").original={width:opts.width,height:opts.height,left:opts.left,top:opts.top,fit:opts.fit};
|
|
}
|
|
opts.left=0;
|
|
opts.top=0;
|
|
opts.fit=true;
|
|
_20c(_249);
|
|
opts.minimized=false;
|
|
opts.maximized=true;
|
|
opts.onMaximize.call(_249);
|
|
};
|
|
function _24b(_24c){
|
|
var opts=$.data(_24c,"panel").options;
|
|
var _24d=$.data(_24c,"panel").panel;
|
|
_24d._size("unfit");
|
|
_24d.hide();
|
|
opts.minimized=true;
|
|
opts.maximized=false;
|
|
opts.onMinimize.call(_24c);
|
|
};
|
|
function _24e(_24f){
|
|
var opts=$.data(_24f,"panel").options;
|
|
var _250=$.data(_24f,"panel").panel;
|
|
var tool=_250.children(".panel-header").find("a.panel-tool-max");
|
|
if(opts.maximized==false){
|
|
return;
|
|
}
|
|
_250.show();
|
|
tool.removeClass("panel-tool-restore");
|
|
$.extend(opts,$.data(_24f,"panel").original);
|
|
_20c(_24f);
|
|
opts.minimized=false;
|
|
opts.maximized=false;
|
|
$.data(_24f,"panel").original=null;
|
|
opts.onRestore.call(_24f);
|
|
};
|
|
function _251(_252,_253){
|
|
$.data(_252,"panel").options.title=_253;
|
|
$(_252).panel("header").find("div.panel-title").html(_253);
|
|
};
|
|
var _254=null;
|
|
$(window).unbind(".panel").bind("resize.panel",function(){
|
|
if(_254){
|
|
clearTimeout(_254);
|
|
}
|
|
_254=setTimeout(function(){
|
|
var _255=$("body.layout");
|
|
if(_255.length){
|
|
_255.layout("resize");
|
|
$("body").children(".easyui-fluid:visible").each(function(){
|
|
$(this).triggerHandler("_resize");
|
|
});
|
|
}else{
|
|
$("body").panel("doLayout");
|
|
}
|
|
_254=null;
|
|
},100);
|
|
});
|
|
$.fn.panel=function(_256,_257){
|
|
if(typeof _256=="string"){
|
|
return $.fn.panel.methods[_256](this,_257);
|
|
}
|
|
_256=_256||{};
|
|
return this.each(function(){
|
|
var _258=$.data(this,"panel");
|
|
var opts;
|
|
if(_258){
|
|
opts=$.extend(_258.options,_256);
|
|
_258.isLoaded=false;
|
|
}else{
|
|
opts=$.extend({},$.fn.panel.defaults,$.fn.panel.parseOptions(this),_256);
|
|
$(this).attr("title","");
|
|
_258=$.data(this,"panel",{options:opts,panel:_219(this),isLoaded:false});
|
|
}
|
|
_21d(this);
|
|
if(opts.doSize==true){
|
|
_258.panel.css("display","block");
|
|
_20c(this);
|
|
}
|
|
if(opts.closed==true||opts.minimized==true){
|
|
_258.panel.hide();
|
|
}else{
|
|
_233(this);
|
|
}
|
|
});
|
|
};
|
|
$.fn.panel.methods={options:function(jq){
|
|
return $.data(jq[0],"panel").options;
|
|
},panel:function(jq){
|
|
return $.data(jq[0],"panel").panel;
|
|
},header:function(jq){
|
|
return $.data(jq[0],"panel").panel.children(".panel-header");
|
|
},footer:function(jq){
|
|
return jq.panel("panel").children(".panel-footer");
|
|
},body:function(jq){
|
|
return $.data(jq[0],"panel").panel.children(".panel-body");
|
|
},setTitle:function(jq,_259){
|
|
return jq.each(function(){
|
|
_251(this,_259);
|
|
});
|
|
},open:function(jq,_25a){
|
|
return jq.each(function(){
|
|
_233(this,_25a);
|
|
});
|
|
},close:function(jq,_25b){
|
|
return jq.each(function(){
|
|
_239(this,_25b);
|
|
});
|
|
},destroy:function(jq,_25c){
|
|
return jq.each(function(){
|
|
_23d(this,_25c);
|
|
});
|
|
},clear:function(jq,type){
|
|
return jq.each(function(){
|
|
_22f(type=="footer"?$(this).panel("footer"):this);
|
|
});
|
|
},refresh:function(jq,href){
|
|
return jq.each(function(){
|
|
var _25d=$.data(this,"panel");
|
|
_25d.isLoaded=false;
|
|
if(href){
|
|
if(typeof href=="string"){
|
|
_25d.options.href=href;
|
|
}else{
|
|
_25d.options.queryParams=href;
|
|
}
|
|
}
|
|
_229(this);
|
|
});
|
|
},resize:function(jq,_25e){
|
|
return jq.each(function(){
|
|
_20c(this,_25e);
|
|
});
|
|
},doLayout:function(jq,all){
|
|
return jq.each(function(){
|
|
_25f(this,"body");
|
|
_25f($(this).siblings(".panel-footer")[0],"footer");
|
|
function _25f(_260,type){
|
|
if(!_260){
|
|
return;
|
|
}
|
|
var _261=_260==$("body")[0];
|
|
var s=$(_260).find("div.panel:visible,div.accordion:visible,div.tabs-container:visible,div.layout:visible,.easyui-fluid:visible").filter(function(_262,el){
|
|
var p=$(el).parents(".panel-"+type+":first");
|
|
return _261?p.length==0:p[0]==_260;
|
|
});
|
|
s.each(function(){
|
|
$(this).triggerHandler("_resize",[all||false]);
|
|
});
|
|
};
|
|
});
|
|
},move:function(jq,_263){
|
|
return jq.each(function(){
|
|
_215(this,_263);
|
|
});
|
|
},maximize:function(jq){
|
|
return jq.each(function(){
|
|
_237(this);
|
|
});
|
|
},minimize:function(jq){
|
|
return jq.each(function(){
|
|
_24b(this);
|
|
});
|
|
},restore:function(jq){
|
|
return jq.each(function(){
|
|
_24e(this);
|
|
});
|
|
},collapse:function(jq,_264){
|
|
return jq.each(function(){
|
|
_238(this,_264);
|
|
});
|
|
},expand:function(jq,_265){
|
|
return jq.each(function(){
|
|
_245(this,_265);
|
|
});
|
|
}};
|
|
$.fn.panel.parseOptions=function(_266){
|
|
var t=$(_266);
|
|
var hh=t.children(".panel-header,header");
|
|
var ff=t.children(".panel-footer,footer");
|
|
return $.extend({},$.parser.parseOptions(_266,["id","width","height","left","top","title","iconCls","cls","headerCls","bodyCls","tools","href","method","header","footer",{cache:"boolean",fit:"boolean",border:"boolean",noheader:"boolean"},{collapsible:"boolean",minimizable:"boolean",maximizable:"boolean"},{closable:"boolean",collapsed:"boolean",minimized:"boolean",maximized:"boolean",closed:"boolean"},"openAnimation","closeAnimation",{openDuration:"number",closeDuration:"number"},]),{loadingMessage:(t.attr("loadingMessage")!=undefined?t.attr("loadingMessage"):undefined),header:(hh.length?hh.removeClass("panel-header"):undefined),footer:(ff.length?ff.removeClass("panel-footer"):undefined)});
|
|
};
|
|
$.fn.panel.defaults={id:null,title:null,iconCls:null,width:"auto",height:"auto",left:null,top:null,cls:null,headerCls:null,bodyCls:null,style:{},href:null,cache:true,fit:false,border:true,doSize:true,noheader:false,content:null,collapsible:false,minimizable:false,maximizable:false,closable:false,collapsed:false,minimized:false,maximized:false,closed:false,openAnimation:false,openDuration:400,closeAnimation:false,closeDuration:400,tools:null,footer:null,header:null,queryParams:{},method:"get",href:null,loadingMessage:"Loading...",loader:function(_267,_268,_269){
|
|
var opts=$(this).panel("options");
|
|
if(!opts.href){
|
|
return false;
|
|
}
|
|
$.ajax({type:opts.method,url:opts.href,cache:false,data:_267,dataType:"html",success:function(data){
|
|
_268(data);
|
|
},error:function(){
|
|
_269.apply(this,arguments);
|
|
}});
|
|
},extractor:function(data){
|
|
var _26a=/<body[^>]*>((.|[\n\r])*)<\/body>/im;
|
|
var _26b=_26a.exec(data);
|
|
if(_26b){
|
|
return _26b[1];
|
|
}else{
|
|
return data;
|
|
}
|
|
},onBeforeLoad:function(_26c){
|
|
},onLoad:function(){
|
|
},onLoadError:function(){
|
|
},onBeforeOpen:function(){
|
|
},onOpen:function(){
|
|
},onBeforeClose:function(){
|
|
},onClose:function(){
|
|
},onBeforeDestroy:function(){
|
|
},onDestroy:function(){
|
|
},onResize:function(_26d,_26e){
|
|
},onMove:function(left,top){
|
|
},onMaximize:function(){
|
|
},onRestore:function(){
|
|
},onMinimize:function(){
|
|
},onBeforeCollapse:function(){
|
|
},onBeforeExpand:function(){
|
|
},onCollapse:function(){
|
|
},onExpand:function(){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _26f(_270,_271){
|
|
var _272=$.data(_270,"window");
|
|
if(_271){
|
|
if(_271.left!=null){
|
|
_272.options.left=_271.left;
|
|
}
|
|
if(_271.top!=null){
|
|
_272.options.top=_271.top;
|
|
}
|
|
}
|
|
$(_270).panel("move",_272.options);
|
|
if(_272.shadow){
|
|
_272.shadow.css({left:_272.options.left,top:_272.options.top});
|
|
}
|
|
};
|
|
function _273(_274,_275){
|
|
var opts=$.data(_274,"window").options;
|
|
var pp=$(_274).window("panel");
|
|
var _276=pp._outerWidth();
|
|
if(opts.inline){
|
|
var _277=pp.parent();
|
|
opts.left=Math.ceil((_277.width()-_276)/2+_277.scrollLeft());
|
|
}else{
|
|
opts.left=Math.ceil(($(window)._outerWidth()-_276)/2+$(document).scrollLeft());
|
|
}
|
|
if(_275){
|
|
_26f(_274);
|
|
}
|
|
};
|
|
function _278(_279,_27a){
|
|
var opts=$.data(_279,"window").options;
|
|
var pp=$(_279).window("panel");
|
|
var _27b=pp._outerHeight();
|
|
if(opts.inline){
|
|
var _27c=pp.parent();
|
|
opts.top=Math.ceil((_27c.height()-_27b)/2+_27c.scrollTop());
|
|
}else{
|
|
opts.top=Math.ceil(($(window)._outerHeight()-_27b)/2+$(document).scrollTop());
|
|
}
|
|
if(_27a){
|
|
_26f(_279);
|
|
}
|
|
};
|
|
function _27d(_27e){
|
|
var _27f=$.data(_27e,"window");
|
|
var opts=_27f.options;
|
|
var win=$(_27e).panel($.extend({},_27f.options,{border:false,doSize:true,closed:true,cls:"window",headerCls:"window-header",bodyCls:"window-body "+(opts.noheader?"window-body-noheader":""),onBeforeDestroy:function(){
|
|
if(opts.onBeforeDestroy.call(_27e)==false){
|
|
return false;
|
|
}
|
|
if(_27f.shadow){
|
|
_27f.shadow.remove();
|
|
}
|
|
if(_27f.mask){
|
|
_27f.mask.remove();
|
|
}
|
|
},onClose:function(){
|
|
if(_27f.shadow){
|
|
_27f.shadow.hide();
|
|
}
|
|
if(_27f.mask){
|
|
_27f.mask.hide();
|
|
}
|
|
opts.onClose.call(_27e);
|
|
},onOpen:function(){
|
|
if(_27f.mask){
|
|
_27f.mask.css($.extend({display:"block",zIndex:$.fn.window.defaults.zIndex++},$.fn.window.getMaskSize(_27e)));
|
|
}
|
|
if(_27f.shadow){
|
|
_27f.shadow.css({display:"block",zIndex:$.fn.window.defaults.zIndex++,left:opts.left,top:opts.top,width:_27f.window._outerWidth(),height:_27f.window._outerHeight()});
|
|
}
|
|
_27f.window.css("z-index",$.fn.window.defaults.zIndex++);
|
|
opts.onOpen.call(_27e);
|
|
},onResize:function(_280,_281){
|
|
var _282=$(this).panel("options");
|
|
$.extend(opts,{width:_282.width,height:_282.height,left:_282.left,top:_282.top});
|
|
if(_27f.shadow){
|
|
_27f.shadow.css({left:opts.left,top:opts.top,width:_27f.window._outerWidth(),height:_27f.window._outerHeight()});
|
|
}
|
|
opts.onResize.call(_27e,_280,_281);
|
|
},onMinimize:function(){
|
|
if(_27f.shadow){
|
|
_27f.shadow.hide();
|
|
}
|
|
if(_27f.mask){
|
|
_27f.mask.hide();
|
|
}
|
|
_27f.options.onMinimize.call(_27e);
|
|
},onBeforeCollapse:function(){
|
|
if(opts.onBeforeCollapse.call(_27e)==false){
|
|
return false;
|
|
}
|
|
if(_27f.shadow){
|
|
_27f.shadow.hide();
|
|
}
|
|
},onExpand:function(){
|
|
if(_27f.shadow){
|
|
_27f.shadow.show();
|
|
}
|
|
opts.onExpand.call(_27e);
|
|
}}));
|
|
_27f.window=win.panel("panel");
|
|
if(_27f.mask){
|
|
_27f.mask.remove();
|
|
}
|
|
if(opts.modal){
|
|
_27f.mask=$("<div class=\"window-mask\" style=\"display:none\"></div>").insertAfter(_27f.window);
|
|
}
|
|
if(_27f.shadow){
|
|
_27f.shadow.remove();
|
|
}
|
|
if(opts.shadow){
|
|
_27f.shadow=$("<div class=\"window-shadow\" style=\"display:none\"></div>").insertAfter(_27f.window);
|
|
}
|
|
var _283=opts.closed;
|
|
if(opts.left==null){
|
|
_273(_27e);
|
|
}
|
|
if(opts.top==null){
|
|
_278(_27e);
|
|
}
|
|
_26f(_27e);
|
|
if(!_283){
|
|
win.window("open");
|
|
}
|
|
};
|
|
function _284(_285){
|
|
var _286=$.data(_285,"window");
|
|
_286.window.draggable({handle:">div.panel-header>div.panel-title",disabled:_286.options.draggable==false,onStartDrag:function(e){
|
|
if(_286.mask){
|
|
_286.mask.css("z-index",$.fn.window.defaults.zIndex++);
|
|
}
|
|
if(_286.shadow){
|
|
_286.shadow.css("z-index",$.fn.window.defaults.zIndex++);
|
|
}
|
|
_286.window.css("z-index",$.fn.window.defaults.zIndex++);
|
|
if(!_286.proxy){
|
|
_286.proxy=$("<div class=\"window-proxy\"></div>").insertAfter(_286.window);
|
|
}
|
|
_286.proxy.css({display:"none",zIndex:$.fn.window.defaults.zIndex++,left:e.data.left,top:e.data.top});
|
|
_286.proxy._outerWidth(_286.window._outerWidth());
|
|
_286.proxy._outerHeight(_286.window._outerHeight());
|
|
setTimeout(function(){
|
|
if(_286.proxy){
|
|
_286.proxy.show();
|
|
}
|
|
},500);
|
|
},onDrag:function(e){
|
|
_286.proxy.css({display:"block",left:e.data.left,top:e.data.top});
|
|
return false;
|
|
},onStopDrag:function(e){
|
|
_286.options.left=e.data.left;
|
|
_286.options.top=e.data.top;
|
|
$(_285).window("move");
|
|
_286.proxy.remove();
|
|
_286.proxy=null;
|
|
}});
|
|
_286.window.resizable({disabled:_286.options.resizable==false,onStartResize:function(e){
|
|
if(_286.pmask){
|
|
_286.pmask.remove();
|
|
}
|
|
_286.pmask=$("<div class=\"window-proxy-mask\"></div>").insertAfter(_286.window);
|
|
_286.pmask.css({zIndex:$.fn.window.defaults.zIndex++,left:e.data.left,top:e.data.top,width:_286.window._outerWidth(),height:_286.window._outerHeight()});
|
|
if(_286.proxy){
|
|
_286.proxy.remove();
|
|
}
|
|
_286.proxy=$("<div class=\"window-proxy\"></div>").insertAfter(_286.window);
|
|
_286.proxy.css({zIndex:$.fn.window.defaults.zIndex++,left:e.data.left,top:e.data.top});
|
|
_286.proxy._outerWidth(e.data.width)._outerHeight(e.data.height);
|
|
},onResize:function(e){
|
|
_286.proxy.css({left:e.data.left,top:e.data.top});
|
|
_286.proxy._outerWidth(e.data.width);
|
|
_286.proxy._outerHeight(e.data.height);
|
|
return false;
|
|
},onStopResize:function(e){
|
|
$(_285).window("resize",e.data);
|
|
_286.pmask.remove();
|
|
_286.pmask=null;
|
|
_286.proxy.remove();
|
|
_286.proxy=null;
|
|
}});
|
|
};
|
|
$(window).resize(function(){
|
|
$("body>div.window-mask").css({width:$(window)._outerWidth(),height:$(window)._outerHeight()});
|
|
setTimeout(function(){
|
|
$("body>div.window-mask").css($.fn.window.getMaskSize());
|
|
},50);
|
|
});
|
|
$.fn.window=function(_287,_288){
|
|
if(typeof _287=="string"){
|
|
var _289=$.fn.window.methods[_287];
|
|
if(_289){
|
|
return _289(this,_288);
|
|
}else{
|
|
return this.panel(_287,_288);
|
|
}
|
|
}
|
|
_287=_287||{};
|
|
return this.each(function(){
|
|
var _28a=$.data(this,"window");
|
|
if(_28a){
|
|
$.extend(_28a.options,_287);
|
|
}else{
|
|
_28a=$.data(this,"window",{options:$.extend({},$.fn.window.defaults,$.fn.window.parseOptions(this),_287)});
|
|
if(!_28a.options.inline){
|
|
document.body.appendChild(this);
|
|
}
|
|
}
|
|
_27d(this);
|
|
_284(this);
|
|
});
|
|
};
|
|
$.fn.window.methods={options:function(jq){
|
|
var _28b=jq.panel("options");
|
|
var _28c=$.data(jq[0],"window").options;
|
|
return $.extend(_28c,{closed:_28b.closed,collapsed:_28b.collapsed,minimized:_28b.minimized,maximized:_28b.maximized});
|
|
},window:function(jq){
|
|
return $.data(jq[0],"window").window;
|
|
},move:function(jq,_28d){
|
|
return jq.each(function(){
|
|
_26f(this,_28d);
|
|
});
|
|
},hcenter:function(jq){
|
|
return jq.each(function(){
|
|
_273(this,true);
|
|
});
|
|
},vcenter:function(jq){
|
|
return jq.each(function(){
|
|
_278(this,true);
|
|
});
|
|
},center:function(jq){
|
|
return jq.each(function(){
|
|
_273(this);
|
|
_278(this);
|
|
_26f(this);
|
|
});
|
|
}};
|
|
$.fn.window.getMaskSize=function(_28e){
|
|
var _28f=$(_28e).data("window");
|
|
var _290=(_28f&&_28f.options.inline);
|
|
return {width:(_290?"100%":$(document).width()),height:(_290?"100%":$(document).height())};
|
|
};
|
|
$.fn.window.parseOptions=function(_291){
|
|
return $.extend({},$.fn.panel.parseOptions(_291),$.parser.parseOptions(_291,[{draggable:"boolean",resizable:"boolean",shadow:"boolean",modal:"boolean",inline:"boolean"}]));
|
|
};
|
|
$.fn.window.defaults=$.extend({},$.fn.panel.defaults,{zIndex:9000,draggable:true,resizable:true,shadow:true,modal:false,inline:false,title:"New Window",collapsible:true,minimizable:true,maximizable:true,closable:true,closed:false});
|
|
})(jQuery);
|
|
(function($){
|
|
function _292(_293){
|
|
var opts=$.data(_293,"dialog").options;
|
|
opts.inited=false;
|
|
$(_293).window($.extend({},opts,{onResize:function(w,h){
|
|
if(opts.inited){
|
|
_298(this);
|
|
opts.onResize.call(this,w,h);
|
|
}
|
|
}}));
|
|
var win=$(_293).window("window");
|
|
if(opts.toolbar){
|
|
if($.isArray(opts.toolbar)){
|
|
$(_293).siblings("div.dialog-toolbar").remove();
|
|
var _294=$("<div class=\"dialog-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").appendTo(win);
|
|
var tr=_294.find("tr");
|
|
for(var i=0;i<opts.toolbar.length;i++){
|
|
var btn=opts.toolbar[i];
|
|
if(btn=="-"){
|
|
$("<td><div class=\"dialog-tool-separator\"></div></td>").appendTo(tr);
|
|
}else{
|
|
var td=$("<td></td>").appendTo(tr);
|
|
var tool=$("<a href=\"javascript:void(0)\"></a>").appendTo(td);
|
|
tool[0].onclick=eval(btn.handler||function(){
|
|
});
|
|
tool.linkbutton($.extend({},btn,{plain:true}));
|
|
}
|
|
}
|
|
}else{
|
|
$(opts.toolbar).addClass("dialog-toolbar").appendTo(win);
|
|
$(opts.toolbar).show();
|
|
}
|
|
}else{
|
|
$(_293).siblings("div.dialog-toolbar").remove();
|
|
}
|
|
if(opts.buttons){
|
|
if($.isArray(opts.buttons)){
|
|
$(_293).siblings("div.dialog-button").remove();
|
|
var _295=$("<div class=\"dialog-button\"></div>").appendTo(win);
|
|
for(var i=0;i<opts.buttons.length;i++){
|
|
var p=opts.buttons[i];
|
|
var _296=$("<a href=\"javascript:void(0)\"></a>").appendTo(_295);
|
|
if(p.handler){
|
|
_296[0].onclick=p.handler;
|
|
}
|
|
_296.linkbutton(p);
|
|
}
|
|
}else{
|
|
$(opts.buttons).addClass("dialog-button").appendTo(win);
|
|
$(opts.buttons).show();
|
|
}
|
|
}else{
|
|
$(_293).siblings("div.dialog-button").remove();
|
|
}
|
|
opts.inited=true;
|
|
var _297=opts.closed;
|
|
win.show();
|
|
$(_293).window("resize");
|
|
if(_297){
|
|
win.hide();
|
|
}
|
|
};
|
|
function _298(_299,_29a){
|
|
var t=$(_299);
|
|
var opts=t.dialog("options");
|
|
var _29b=opts.noheader;
|
|
var tb=t.siblings(".dialog-toolbar");
|
|
var bb=t.siblings(".dialog-button");
|
|
tb.insertBefore(_299).css({position:"relative",borderTopWidth:(_29b?1:0),top:(_29b?tb.length:0)});
|
|
bb.insertAfter(_299).css({position:"relative",top:-1});
|
|
tb.add(bb)._outerWidth(t._outerWidth()).find(".easyui-fluid:visible").each(function(){
|
|
$(this).triggerHandler("_resize");
|
|
});
|
|
var _29c=tb._outerHeight()+bb._outerHeight();
|
|
if(!isNaN(parseInt(opts.height))){
|
|
t._outerHeight(t._outerHeight()-_29c);
|
|
}else{
|
|
var _29d=t._size("min-height");
|
|
if(_29d){
|
|
t._size("min-height",_29d-_29c);
|
|
}
|
|
var _29e=t._size("max-height");
|
|
if(_29e){
|
|
t._size("max-height",_29e-_29c);
|
|
}
|
|
}
|
|
var _29f=$.data(_299,"window").shadow;
|
|
if(_29f){
|
|
var cc=t.panel("panel");
|
|
_29f.css({width:cc._outerWidth(),height:cc._outerHeight()});
|
|
}
|
|
};
|
|
$.fn.dialog=function(_2a0,_2a1){
|
|
if(typeof _2a0=="string"){
|
|
var _2a2=$.fn.dialog.methods[_2a0];
|
|
if(_2a2){
|
|
return _2a2(this,_2a1);
|
|
}else{
|
|
return this.window(_2a0,_2a1);
|
|
}
|
|
}
|
|
_2a0=_2a0||{};
|
|
return this.each(function(){
|
|
var _2a3=$.data(this,"dialog");
|
|
if(_2a3){
|
|
$.extend(_2a3.options,_2a0);
|
|
}else{
|
|
$.data(this,"dialog",{options:$.extend({},$.fn.dialog.defaults,$.fn.dialog.parseOptions(this),_2a0)});
|
|
}
|
|
_292(this);
|
|
});
|
|
};
|
|
$.fn.dialog.methods={options:function(jq){
|
|
var _2a4=$.data(jq[0],"dialog").options;
|
|
var _2a5=jq.panel("options");
|
|
$.extend(_2a4,{width:_2a5.width,height:_2a5.height,left:_2a5.left,top:_2a5.top,closed:_2a5.closed,collapsed:_2a5.collapsed,minimized:_2a5.minimized,maximized:_2a5.maximized});
|
|
return _2a4;
|
|
},dialog:function(jq){
|
|
return jq.window("window");
|
|
}};
|
|
$.fn.dialog.parseOptions=function(_2a6){
|
|
var t=$(_2a6);
|
|
return $.extend({},$.fn.window.parseOptions(_2a6),$.parser.parseOptions(_2a6,["toolbar","buttons"]),{toolbar:(t.children(".dialog-toolbar").length?t.children(".dialog-toolbar").removeClass("dialog-toolbar"):undefined),buttons:(t.children(".dialog-button").length?t.children(".dialog-button").removeClass("dialog-button"):undefined)});
|
|
};
|
|
$.fn.dialog.defaults=$.extend({},$.fn.window.defaults,{title:"New Dialog",collapsible:false,minimizable:false,maximizable:false,resizable:false,toolbar:null,buttons:null});
|
|
})(jQuery);
|
|
(function($){
|
|
function _2a7(){
|
|
$(document).unbind(".messager").bind("keydown.messager",function(e){
|
|
if(e.keyCode==27){
|
|
$("body").children("div.messager-window").children("div.messager-body").each(function(){
|
|
$(this).dialog("close");
|
|
});
|
|
}else{
|
|
if(e.keyCode==9){
|
|
var win=$("body").children("div.messager-window");
|
|
if(!win.length){
|
|
return;
|
|
}
|
|
var _2a8=win.find(".messager-input,.messager-button .l-btn");
|
|
for(var i=0;i<_2a8.length;i++){
|
|
if($(_2a8[i]).is(":focus")){
|
|
$(_2a8[i>=_2a8.length-1?0:i+1]).focus();
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
};
|
|
function _2a9(){
|
|
$(document).unbind(".messager");
|
|
};
|
|
function _2aa(_2ab){
|
|
var opts=$.extend({},$.messager.defaults,{modal:false,shadow:false,draggable:false,resizable:false,closed:true,style:{left:"",top:"",right:0,zIndex:$.fn.window.defaults.zIndex++,bottom:-document.body.scrollTop-document.documentElement.scrollTop},title:"",width:250,height:100,minHeight:0,showType:"slide",showSpeed:600,content:_2ab.msg,timeout:4000},_2ab);
|
|
var dlg=$("<div class=\"messager-body\"></div>").appendTo("body");
|
|
dlg.dialog($.extend({},opts,{noheader:(opts.title?false:true),openAnimation:(opts.showType),closeAnimation:(opts.showType=="show"?"hide":opts.showType),openDuration:opts.showSpeed,closeDuration:opts.showSpeed,onOpen:function(){
|
|
dlg.dialog("dialog").hover(function(){
|
|
if(opts.timer){
|
|
clearTimeout(opts.timer);
|
|
}
|
|
},function(){
|
|
_2ac();
|
|
});
|
|
_2ac();
|
|
function _2ac(){
|
|
if(opts.timeout>0){
|
|
opts.timer=setTimeout(function(){
|
|
if(dlg.length&&dlg.data("dialog")){
|
|
dlg.dialog("close");
|
|
}
|
|
},opts.timeout);
|
|
}
|
|
};
|
|
if(_2ab.onOpen){
|
|
_2ab.onOpen.call(this);
|
|
}else{
|
|
opts.onOpen.call(this);
|
|
}
|
|
},onClose:function(){
|
|
if(opts.timer){
|
|
clearTimeout(opts.timer);
|
|
}
|
|
if(_2ab.onClose){
|
|
_2ab.onClose.call(this);
|
|
}else{
|
|
opts.onClose.call(this);
|
|
}
|
|
dlg.dialog("destroy");
|
|
}}));
|
|
dlg.dialog("dialog").css(opts.style);
|
|
dlg.dialog("open");
|
|
return dlg;
|
|
};
|
|
function _2ad(_2ae){
|
|
_2a7();
|
|
var dlg=$("<div class=\"messager-body\"></div>").appendTo("body");
|
|
dlg.dialog($.extend({},_2ae,{noheader:(_2ae.title?false:true),onClose:function(){
|
|
_2a9();
|
|
if(_2ae.onClose){
|
|
_2ae.onClose.call(this);
|
|
}
|
|
setTimeout(function(){
|
|
dlg.dialog("destroy");
|
|
},100);
|
|
}}));
|
|
var win=dlg.dialog("dialog").addClass("messager-window");
|
|
win.find(".dialog-button").addClass("messager-button").find("a:first").focus();
|
|
return dlg;
|
|
};
|
|
function _2af(dlg,_2b0){
|
|
dlg.dialog("close");
|
|
dlg.dialog("options").fn(_2b0);
|
|
};
|
|
$.messager={show:function(_2b1){
|
|
return _2aa(_2b1);
|
|
},alert:function(_2b2,msg,icon,fn){
|
|
var opts=typeof _2b2=="object"?_2b2:{title:_2b2,msg:msg,icon:icon,fn:fn};
|
|
var cls=opts.icon?"messager-icon messager-"+opts.icon:"";
|
|
opts=$.extend({},$.messager.defaults,{content:"<div class=\""+cls+"\"></div>"+"<div>"+opts.msg+"</div>"+"<div style=\"clear:both;\"/>"},opts);
|
|
if(!opts.buttons){
|
|
opts.buttons=[{text:opts.ok,onClick:function(){
|
|
_2af(dlg);
|
|
}}];
|
|
}
|
|
var dlg=_2ad(opts);
|
|
return dlg;
|
|
},confirm:function(_2b3,msg,fn){
|
|
var opts=typeof _2b3=="object"?_2b3:{title:_2b3,msg:msg,fn:fn};
|
|
opts=$.extend({},$.messager.defaults,{content:"<div class=\"messager-icon messager-question\"></div>"+"<div>"+opts.msg+"</div>"+"<div style=\"clear:both;\"/>"},opts);
|
|
if(!opts.buttons){
|
|
opts.buttons=[{text:opts.ok,onClick:function(){
|
|
_2af(dlg,true);
|
|
}},{text:opts.cancel,onClick:function(){
|
|
_2af(dlg,false);
|
|
}}];
|
|
}
|
|
var dlg=_2ad(opts);
|
|
return dlg;
|
|
},prompt:function(_2b4,msg,fn){
|
|
var opts=typeof _2b4=="object"?_2b4:{title:_2b4,msg:msg,fn:fn};
|
|
opts=$.extend({},$.messager.defaults,{content:"<div class=\"messager-icon messager-question\"></div>"+"<div>"+opts.msg+"</div>"+"<br/>"+"<div style=\"clear:both;\"/>"+"<div><input class=\"messager-input\" type=\"text\"/></div>"},opts);
|
|
if(!opts.buttons){
|
|
opts.buttons=[{text:opts.ok,onClick:function(){
|
|
_2af(dlg,dlg.find(".messager-input").val());
|
|
}},{text:opts.cancel,onClick:function(){
|
|
_2af(dlg);
|
|
}}];
|
|
}
|
|
var dlg=_2ad(opts);
|
|
dlg.find("input.messager-input").focus();
|
|
return dlg;
|
|
},progress:function(_2b5){
|
|
var _2b6={bar:function(){
|
|
return $("body>div.messager-window").find("div.messager-p-bar");
|
|
},close:function(){
|
|
var dlg=$("body>div.messager-window>div.messager-body:has(div.messager-progress)");
|
|
if(dlg.length){
|
|
dlg.dialog("close");
|
|
}
|
|
}};
|
|
if(typeof _2b5=="string"){
|
|
var _2b7=_2b6[_2b5];
|
|
return _2b7();
|
|
}
|
|
_2b5=_2b5||{};
|
|
var opts=$.extend({},{title:"",minHeight:0,content:undefined,msg:"",text:undefined,interval:300},_2b5);
|
|
var dlg=_2ad($.extend({},$.messager.defaults,{content:"<div class=\"messager-progress\"><div class=\"messager-p-msg\">"+opts.msg+"</div><div class=\"messager-p-bar\"></div></div>",closable:false,doSize:false},opts,{onClose:function(){
|
|
if(this.timer){
|
|
clearInterval(this.timer);
|
|
}
|
|
if(_2b5.onClose){
|
|
_2b5.onClose.call(this);
|
|
}else{
|
|
$.messager.defaults.onClose.call(this);
|
|
}
|
|
}}));
|
|
var bar=dlg.find("div.messager-p-bar");
|
|
bar.progressbar({text:opts.text});
|
|
dlg.dialog("resize");
|
|
if(opts.interval){
|
|
dlg[0].timer=setInterval(function(){
|
|
var v=bar.progressbar("getValue");
|
|
v+=10;
|
|
if(v>100){
|
|
v=0;
|
|
}
|
|
bar.progressbar("setValue",v);
|
|
},opts.interval);
|
|
}
|
|
return dlg;
|
|
}};
|
|
$.messager.defaults=$.extend({},$.fn.dialog.defaults,{ok:"Ok",cancel:"Cancel",width:300,height:"auto",minHeight:150,modal:true,collapsible:false,minimizable:false,maximizable:false,resizable:false,fn:function(){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _2b8(_2b9,_2ba){
|
|
var _2bb=$.data(_2b9,"accordion");
|
|
var opts=_2bb.options;
|
|
var _2bc=_2bb.panels;
|
|
var cc=$(_2b9);
|
|
if(_2ba){
|
|
$.extend(opts,{width:_2ba.width,height:_2ba.height});
|
|
}
|
|
cc._size(opts);
|
|
var _2bd=0;
|
|
var _2be="auto";
|
|
var _2bf=cc.find(">.panel>.accordion-header");
|
|
if(_2bf.length){
|
|
_2bd=$(_2bf[0]).css("height","")._outerHeight();
|
|
}
|
|
if(!isNaN(parseInt(opts.height))){
|
|
_2be=cc.height()-_2bd*_2bf.length;
|
|
}
|
|
_2c0(true,_2be-_2c0(false)+1);
|
|
function _2c0(_2c1,_2c2){
|
|
var _2c3=0;
|
|
for(var i=0;i<_2bc.length;i++){
|
|
var p=_2bc[i];
|
|
var h=p.panel("header")._outerHeight(_2bd);
|
|
if(p.panel("options").collapsible==_2c1){
|
|
var _2c4=isNaN(_2c2)?undefined:(_2c2+_2bd*h.length);
|
|
p.panel("resize",{width:cc.width(),height:(_2c1?_2c4:undefined)});
|
|
_2c3+=p.panel("panel").outerHeight()-_2bd*h.length;
|
|
}
|
|
}
|
|
return _2c3;
|
|
};
|
|
};
|
|
function _2c5(_2c6,_2c7,_2c8,all){
|
|
var _2c9=$.data(_2c6,"accordion").panels;
|
|
var pp=[];
|
|
for(var i=0;i<_2c9.length;i++){
|
|
var p=_2c9[i];
|
|
if(_2c7){
|
|
if(p.panel("options")[_2c7]==_2c8){
|
|
pp.push(p);
|
|
}
|
|
}else{
|
|
if(p[0]==$(_2c8)[0]){
|
|
return i;
|
|
}
|
|
}
|
|
}
|
|
if(_2c7){
|
|
return all?pp:(pp.length?pp[0]:null);
|
|
}else{
|
|
return -1;
|
|
}
|
|
};
|
|
function _2ca(_2cb){
|
|
return _2c5(_2cb,"collapsed",false,true);
|
|
};
|
|
function _2cc(_2cd){
|
|
var pp=_2ca(_2cd);
|
|
return pp.length?pp[0]:null;
|
|
};
|
|
function _2ce(_2cf,_2d0){
|
|
return _2c5(_2cf,null,_2d0);
|
|
};
|
|
function _2d1(_2d2,_2d3){
|
|
var _2d4=$.data(_2d2,"accordion").panels;
|
|
if(typeof _2d3=="number"){
|
|
if(_2d3<0||_2d3>=_2d4.length){
|
|
return null;
|
|
}else{
|
|
return _2d4[_2d3];
|
|
}
|
|
}
|
|
return _2c5(_2d2,"title",_2d3);
|
|
};
|
|
function _2d5(_2d6){
|
|
var opts=$.data(_2d6,"accordion").options;
|
|
var cc=$(_2d6);
|
|
if(opts.border){
|
|
cc.removeClass("accordion-noborder");
|
|
}else{
|
|
cc.addClass("accordion-noborder");
|
|
}
|
|
};
|
|
function init(_2d7){
|
|
var _2d8=$.data(_2d7,"accordion");
|
|
var cc=$(_2d7);
|
|
cc.addClass("accordion");
|
|
_2d8.panels=[];
|
|
cc.children("div").each(function(){
|
|
var opts=$.extend({},$.parser.parseOptions(this),{selected:($(this).attr("selected")?true:undefined)});
|
|
var pp=$(this);
|
|
_2d8.panels.push(pp);
|
|
_2da(_2d7,pp,opts);
|
|
});
|
|
cc.bind("_resize",function(e,_2d9){
|
|
if($(this).hasClass("easyui-fluid")||_2d9){
|
|
_2b8(_2d7);
|
|
}
|
|
return false;
|
|
});
|
|
};
|
|
function _2da(_2db,pp,_2dc){
|
|
var opts=$.data(_2db,"accordion").options;
|
|
pp.panel($.extend({},{collapsible:true,minimizable:false,maximizable:false,closable:false,doSize:false,collapsed:true,headerCls:"accordion-header",bodyCls:"accordion-body"},_2dc,{onBeforeExpand:function(){
|
|
if(_2dc.onBeforeExpand){
|
|
if(_2dc.onBeforeExpand.call(this)==false){
|
|
return false;
|
|
}
|
|
}
|
|
if(!opts.multiple){
|
|
var all=$.grep(_2ca(_2db),function(p){
|
|
return p.panel("options").collapsible;
|
|
});
|
|
for(var i=0;i<all.length;i++){
|
|
_2e4(_2db,_2ce(_2db,all[i]));
|
|
}
|
|
}
|
|
var _2dd=$(this).panel("header");
|
|
_2dd.addClass("accordion-header-selected");
|
|
_2dd.find(".accordion-collapse").removeClass("accordion-expand");
|
|
},onExpand:function(){
|
|
if(_2dc.onExpand){
|
|
_2dc.onExpand.call(this);
|
|
}
|
|
opts.onSelect.call(_2db,$(this).panel("options").title,_2ce(_2db,this));
|
|
},onBeforeCollapse:function(){
|
|
if(_2dc.onBeforeCollapse){
|
|
if(_2dc.onBeforeCollapse.call(this)==false){
|
|
return false;
|
|
}
|
|
}
|
|
var _2de=$(this).panel("header");
|
|
_2de.removeClass("accordion-header-selected");
|
|
_2de.find(".accordion-collapse").addClass("accordion-expand");
|
|
},onCollapse:function(){
|
|
if(_2dc.onCollapse){
|
|
_2dc.onCollapse.call(this);
|
|
}
|
|
opts.onUnselect.call(_2db,$(this).panel("options").title,_2ce(_2db,this));
|
|
}}));
|
|
var _2df=pp.panel("header");
|
|
var tool=_2df.children("div.panel-tool");
|
|
tool.children("a.panel-tool-collapse").hide();
|
|
var t=$("<a href=\"javascript:void(0)\"></a>").addClass("accordion-collapse accordion-expand").appendTo(tool);
|
|
t.bind("click",function(){
|
|
_2e0(pp);
|
|
return false;
|
|
});
|
|
pp.panel("options").collapsible?t.show():t.hide();
|
|
_2df.click(function(){
|
|
_2e0(pp);
|
|
return false;
|
|
});
|
|
function _2e0(p){
|
|
var _2e1=p.panel("options");
|
|
if(_2e1.collapsible){
|
|
var _2e2=_2ce(_2db,p);
|
|
if(_2e1.collapsed){
|
|
_2e3(_2db,_2e2);
|
|
}else{
|
|
_2e4(_2db,_2e2);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function _2e3(_2e5,_2e6){
|
|
var p=_2d1(_2e5,_2e6);
|
|
if(!p){
|
|
return;
|
|
}
|
|
_2e7(_2e5);
|
|
var opts=$.data(_2e5,"accordion").options;
|
|
p.panel("expand",opts.animate);
|
|
};
|
|
function _2e4(_2e8,_2e9){
|
|
var p=_2d1(_2e8,_2e9);
|
|
if(!p){
|
|
return;
|
|
}
|
|
_2e7(_2e8);
|
|
var opts=$.data(_2e8,"accordion").options;
|
|
p.panel("collapse",opts.animate);
|
|
};
|
|
function _2ea(_2eb){
|
|
var opts=$.data(_2eb,"accordion").options;
|
|
var p=_2c5(_2eb,"selected",true);
|
|
if(p){
|
|
_2ec(_2ce(_2eb,p));
|
|
}else{
|
|
_2ec(opts.selected);
|
|
}
|
|
function _2ec(_2ed){
|
|
var _2ee=opts.animate;
|
|
opts.animate=false;
|
|
_2e3(_2eb,_2ed);
|
|
opts.animate=_2ee;
|
|
};
|
|
};
|
|
function _2e7(_2ef){
|
|
var _2f0=$.data(_2ef,"accordion").panels;
|
|
for(var i=0;i<_2f0.length;i++){
|
|
_2f0[i].stop(true,true);
|
|
}
|
|
};
|
|
function add(_2f1,_2f2){
|
|
var _2f3=$.data(_2f1,"accordion");
|
|
var opts=_2f3.options;
|
|
var _2f4=_2f3.panels;
|
|
if(_2f2.selected==undefined){
|
|
_2f2.selected=true;
|
|
}
|
|
_2e7(_2f1);
|
|
var pp=$("<div></div>").appendTo(_2f1);
|
|
_2f4.push(pp);
|
|
_2da(_2f1,pp,_2f2);
|
|
_2b8(_2f1);
|
|
opts.onAdd.call(_2f1,_2f2.title,_2f4.length-1);
|
|
if(_2f2.selected){
|
|
_2e3(_2f1,_2f4.length-1);
|
|
}
|
|
};
|
|
function _2f5(_2f6,_2f7){
|
|
var _2f8=$.data(_2f6,"accordion");
|
|
var opts=_2f8.options;
|
|
var _2f9=_2f8.panels;
|
|
_2e7(_2f6);
|
|
var _2fa=_2d1(_2f6,_2f7);
|
|
var _2fb=_2fa.panel("options").title;
|
|
var _2fc=_2ce(_2f6,_2fa);
|
|
if(!_2fa){
|
|
return;
|
|
}
|
|
if(opts.onBeforeRemove.call(_2f6,_2fb,_2fc)==false){
|
|
return;
|
|
}
|
|
_2f9.splice(_2fc,1);
|
|
_2fa.panel("destroy");
|
|
if(_2f9.length){
|
|
_2b8(_2f6);
|
|
var curr=_2cc(_2f6);
|
|
if(!curr){
|
|
_2e3(_2f6,0);
|
|
}
|
|
}
|
|
opts.onRemove.call(_2f6,_2fb,_2fc);
|
|
};
|
|
$.fn.accordion=function(_2fd,_2fe){
|
|
if(typeof _2fd=="string"){
|
|
return $.fn.accordion.methods[_2fd](this,_2fe);
|
|
}
|
|
_2fd=_2fd||{};
|
|
return this.each(function(){
|
|
var _2ff=$.data(this,"accordion");
|
|
if(_2ff){
|
|
$.extend(_2ff.options,_2fd);
|
|
}else{
|
|
$.data(this,"accordion",{options:$.extend({},$.fn.accordion.defaults,$.fn.accordion.parseOptions(this),_2fd),accordion:$(this).addClass("accordion"),panels:[]});
|
|
init(this);
|
|
}
|
|
_2d5(this);
|
|
_2b8(this);
|
|
_2ea(this);
|
|
});
|
|
};
|
|
$.fn.accordion.methods={options:function(jq){
|
|
return $.data(jq[0],"accordion").options;
|
|
},panels:function(jq){
|
|
return $.data(jq[0],"accordion").panels;
|
|
},resize:function(jq,_300){
|
|
return jq.each(function(){
|
|
_2b8(this,_300);
|
|
});
|
|
},getSelections:function(jq){
|
|
return _2ca(jq[0]);
|
|
},getSelected:function(jq){
|
|
return _2cc(jq[0]);
|
|
},getPanel:function(jq,_301){
|
|
return _2d1(jq[0],_301);
|
|
},getPanelIndex:function(jq,_302){
|
|
return _2ce(jq[0],_302);
|
|
},select:function(jq,_303){
|
|
return jq.each(function(){
|
|
_2e3(this,_303);
|
|
});
|
|
},unselect:function(jq,_304){
|
|
return jq.each(function(){
|
|
_2e4(this,_304);
|
|
});
|
|
},add:function(jq,_305){
|
|
return jq.each(function(){
|
|
add(this,_305);
|
|
});
|
|
},remove:function(jq,_306){
|
|
return jq.each(function(){
|
|
_2f5(this,_306);
|
|
});
|
|
}};
|
|
$.fn.accordion.parseOptions=function(_307){
|
|
var t=$(_307);
|
|
return $.extend({},$.parser.parseOptions(_307,["width","height",{fit:"boolean",border:"boolean",animate:"boolean",multiple:"boolean",selected:"number"}]));
|
|
};
|
|
$.fn.accordion.defaults={width:"auto",height:"auto",fit:false,border:true,animate:true,multiple:false,selected:0,onSelect:function(_308,_309){
|
|
},onUnselect:function(_30a,_30b){
|
|
},onAdd:function(_30c,_30d){
|
|
},onBeforeRemove:function(_30e,_30f){
|
|
},onRemove:function(_310,_311){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _312(c){
|
|
var w=0;
|
|
$(c).children().each(function(){
|
|
w+=$(this).outerWidth(true);
|
|
});
|
|
return w;
|
|
};
|
|
function _313(_314){
|
|
var opts=$.data(_314,"tabs").options;
|
|
if(opts.tabPosition=="left"||opts.tabPosition=="right"||!opts.showHeader){
|
|
return;
|
|
}
|
|
var _315=$(_314).children("div.tabs-header");
|
|
var tool=_315.children("div.tabs-tool:not(.tabs-tool-hidden)");
|
|
var _316=_315.children("div.tabs-scroller-left");
|
|
var _317=_315.children("div.tabs-scroller-right");
|
|
var wrap=_315.children("div.tabs-wrap");
|
|
var _318=_315.outerHeight();
|
|
if(opts.plain){
|
|
_318-=_318-_315.height();
|
|
}
|
|
tool._outerHeight(_318);
|
|
var _319=_312(_315.find("ul.tabs"));
|
|
var _31a=_315.width()-tool._outerWidth();
|
|
if(_319>_31a){
|
|
_316.add(_317).show()._outerHeight(_318);
|
|
if(opts.toolPosition=="left"){
|
|
tool.css({left:_316.outerWidth(),right:""});
|
|
wrap.css({marginLeft:_316.outerWidth()+tool._outerWidth(),marginRight:_317._outerWidth(),width:_31a-_316.outerWidth()-_317.outerWidth()});
|
|
}else{
|
|
tool.css({left:"",right:_317.outerWidth()});
|
|
wrap.css({marginLeft:_316.outerWidth(),marginRight:_317.outerWidth()+tool._outerWidth(),width:_31a-_316.outerWidth()-_317.outerWidth()});
|
|
}
|
|
}else{
|
|
_316.add(_317).hide();
|
|
if(opts.toolPosition=="left"){
|
|
tool.css({left:0,right:""});
|
|
wrap.css({marginLeft:tool._outerWidth(),marginRight:0,width:_31a});
|
|
}else{
|
|
tool.css({left:"",right:0});
|
|
wrap.css({marginLeft:0,marginRight:tool._outerWidth(),width:_31a});
|
|
}
|
|
}
|
|
};
|
|
function _31b(_31c){
|
|
var opts=$.data(_31c,"tabs").options;
|
|
var _31d=$(_31c).children("div.tabs-header");
|
|
if(opts.tools){
|
|
if(typeof opts.tools=="string"){
|
|
$(opts.tools).addClass("tabs-tool").appendTo(_31d);
|
|
$(opts.tools).show();
|
|
}else{
|
|
_31d.children("div.tabs-tool").remove();
|
|
var _31e=$("<div class=\"tabs-tool\"><table cellspacing=\"0\" cellpadding=\"0\" style=\"height:100%\"><tr></tr></table></div>").appendTo(_31d);
|
|
var tr=_31e.find("tr");
|
|
for(var i=0;i<opts.tools.length;i++){
|
|
var td=$("<td></td>").appendTo(tr);
|
|
var tool=$("<a href=\"javascript:void(0);\"></a>").appendTo(td);
|
|
tool[0].onclick=eval(opts.tools[i].handler||function(){
|
|
});
|
|
tool.linkbutton($.extend({},opts.tools[i],{plain:true}));
|
|
}
|
|
}
|
|
}else{
|
|
_31d.children("div.tabs-tool").remove();
|
|
}
|
|
};
|
|
function _31f(_320,_321){
|
|
var _322=$.data(_320,"tabs");
|
|
var opts=_322.options;
|
|
var cc=$(_320);
|
|
if(!opts.doSize){
|
|
return;
|
|
}
|
|
if(_321){
|
|
$.extend(opts,{width:_321.width,height:_321.height});
|
|
}
|
|
cc._size(opts);
|
|
var _323=cc.children("div.tabs-header");
|
|
var _324=cc.children("div.tabs-panels");
|
|
var wrap=_323.find("div.tabs-wrap");
|
|
var ul=wrap.find(".tabs");
|
|
ul.children("li").removeClass("tabs-first tabs-last");
|
|
ul.children("li:first").addClass("tabs-first");
|
|
ul.children("li:last").addClass("tabs-last");
|
|
if(opts.tabPosition=="left"||opts.tabPosition=="right"){
|
|
_323._outerWidth(opts.showHeader?opts.headerWidth:0);
|
|
_324._outerWidth(cc.width()-_323.outerWidth());
|
|
_323.add(_324)._size("height",isNaN(parseInt(opts.height))?"":cc.height());
|
|
wrap._outerWidth(_323.width());
|
|
ul._outerWidth(wrap.width()).css("height","");
|
|
}else{
|
|
_323.children("div.tabs-scroller-left,div.tabs-scroller-right,div.tabs-tool:not(.tabs-tool-hidden)").css("display",opts.showHeader?"block":"none");
|
|
_323._outerWidth(cc.width()).css("height","");
|
|
if(opts.showHeader){
|
|
_323.css("background-color","");
|
|
wrap.css("height","");
|
|
}else{
|
|
_323.css("background-color","transparent");
|
|
_323._outerHeight(0);
|
|
wrap._outerHeight(0);
|
|
}
|
|
ul._outerHeight(opts.tabHeight).css("width","");
|
|
ul._outerHeight(ul.outerHeight()-ul.height()-1+opts.tabHeight).css("width","");
|
|
_324._size("height",isNaN(parseInt(opts.height))?"":(cc.height()-_323.outerHeight()));
|
|
_324._size("width",cc.width());
|
|
}
|
|
if(_322.tabs.length){
|
|
var d1=ul.outerWidth(true)-ul.width();
|
|
var li=ul.children("li:first");
|
|
var d2=li.outerWidth(true)-li.width();
|
|
var _325=_323.width()-_323.children(".tabs-tool:not(.tabs-tool-hidden)")._outerWidth();
|
|
var _326=Math.floor((_325-d1-d2*_322.tabs.length)/_322.tabs.length);
|
|
$.map(_322.tabs,function(p){
|
|
_327(p,(opts.justified&&$.inArray(opts.tabPosition,["top","bottom"])>=0)?_326:undefined);
|
|
});
|
|
if(opts.justified&&$.inArray(opts.tabPosition,["top","bottom"])>=0){
|
|
var _328=_325-d1-_312(ul);
|
|
_327(_322.tabs[_322.tabs.length-1],_326+_328);
|
|
}
|
|
}
|
|
_313(_320);
|
|
function _327(p,_329){
|
|
var _32a=p.panel("options");
|
|
var p_t=_32a.tab.find("a.tabs-inner");
|
|
var _329=_329?_329:(parseInt(_32a.tabWidth||opts.tabWidth||undefined));
|
|
if(_329){
|
|
p_t._outerWidth(_329);
|
|
}else{
|
|
p_t.css("width","");
|
|
}
|
|
p_t._outerHeight(opts.tabHeight);
|
|
p_t.css("lineHeight",p_t.height()+"px");
|
|
p_t.find(".easyui-fluid:visible").triggerHandler("_resize");
|
|
};
|
|
};
|
|
function _32b(_32c){
|
|
var opts=$.data(_32c,"tabs").options;
|
|
var tab=_32d(_32c);
|
|
if(tab){
|
|
var _32e=$(_32c).children("div.tabs-panels");
|
|
var _32f=opts.width=="auto"?"auto":_32e.width();
|
|
var _330=opts.height=="auto"?"auto":_32e.height();
|
|
tab.panel("resize",{width:_32f,height:_330});
|
|
}
|
|
};
|
|
function _331(_332){
|
|
var tabs=$.data(_332,"tabs").tabs;
|
|
var cc=$(_332).addClass("tabs-container");
|
|
var _333=$("<div class=\"tabs-panels\"></div>").insertBefore(cc);
|
|
cc.children("div").each(function(){
|
|
_333[0].appendChild(this);
|
|
});
|
|
cc[0].appendChild(_333[0]);
|
|
$("<div class=\"tabs-header\">"+"<div class=\"tabs-scroller-left\"></div>"+"<div class=\"tabs-scroller-right\"></div>"+"<div class=\"tabs-wrap\">"+"<ul class=\"tabs\"></ul>"+"</div>"+"</div>").prependTo(_332);
|
|
cc.children("div.tabs-panels").children("div").each(function(i){
|
|
var opts=$.extend({},$.parser.parseOptions(this),{disabled:($(this).attr("disabled")?true:undefined),selected:($(this).attr("selected")?true:undefined)});
|
|
_340(_332,opts,$(this));
|
|
});
|
|
cc.children("div.tabs-header").find(".tabs-scroller-left, .tabs-scroller-right").hover(function(){
|
|
$(this).addClass("tabs-scroller-over");
|
|
},function(){
|
|
$(this).removeClass("tabs-scroller-over");
|
|
});
|
|
cc.bind("_resize",function(e,_334){
|
|
if($(this).hasClass("easyui-fluid")||_334){
|
|
_31f(_332);
|
|
_32b(_332);
|
|
}
|
|
return false;
|
|
});
|
|
};
|
|
function _335(_336){
|
|
var _337=$.data(_336,"tabs");
|
|
var opts=_337.options;
|
|
$(_336).children("div.tabs-header").unbind().bind("click",function(e){
|
|
if($(e.target).hasClass("tabs-scroller-left")){
|
|
$(_336).tabs("scrollBy",-opts.scrollIncrement);
|
|
}else{
|
|
if($(e.target).hasClass("tabs-scroller-right")){
|
|
$(_336).tabs("scrollBy",opts.scrollIncrement);
|
|
}else{
|
|
var li=$(e.target).closest("li");
|
|
if(li.hasClass("tabs-disabled")){
|
|
return false;
|
|
}
|
|
var a=$(e.target).closest("a.tabs-close");
|
|
if(a.length){
|
|
_359(_336,_338(li));
|
|
}else{
|
|
if(li.length){
|
|
var _339=_338(li);
|
|
var _33a=_337.tabs[_339].panel("options");
|
|
if(_33a.collapsible){
|
|
_33a.closed?_350(_336,_339):_36d(_336,_339);
|
|
}else{
|
|
_350(_336,_339);
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}).bind("contextmenu",function(e){
|
|
var li=$(e.target).closest("li");
|
|
if(li.hasClass("tabs-disabled")){
|
|
return;
|
|
}
|
|
if(li.length){
|
|
opts.onContextMenu.call(_336,e,li.find("span.tabs-title").html(),_338(li));
|
|
}
|
|
});
|
|
function _338(li){
|
|
var _33b=0;
|
|
li.parent().children("li").each(function(i){
|
|
if(li[0]==this){
|
|
_33b=i;
|
|
return false;
|
|
}
|
|
});
|
|
return _33b;
|
|
};
|
|
};
|
|
function _33c(_33d){
|
|
var opts=$.data(_33d,"tabs").options;
|
|
var _33e=$(_33d).children("div.tabs-header");
|
|
var _33f=$(_33d).children("div.tabs-panels");
|
|
_33e.removeClass("tabs-header-top tabs-header-bottom tabs-header-left tabs-header-right");
|
|
_33f.removeClass("tabs-panels-top tabs-panels-bottom tabs-panels-left tabs-panels-right");
|
|
if(opts.tabPosition=="top"){
|
|
_33e.insertBefore(_33f);
|
|
}else{
|
|
if(opts.tabPosition=="bottom"){
|
|
_33e.insertAfter(_33f);
|
|
_33e.addClass("tabs-header-bottom");
|
|
_33f.addClass("tabs-panels-top");
|
|
}else{
|
|
if(opts.tabPosition=="left"){
|
|
_33e.addClass("tabs-header-left");
|
|
_33f.addClass("tabs-panels-right");
|
|
}else{
|
|
if(opts.tabPosition=="right"){
|
|
_33e.addClass("tabs-header-right");
|
|
_33f.addClass("tabs-panels-left");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(opts.plain==true){
|
|
_33e.addClass("tabs-header-plain");
|
|
}else{
|
|
_33e.removeClass("tabs-header-plain");
|
|
}
|
|
_33e.removeClass("tabs-header-narrow").addClass(opts.narrow?"tabs-header-narrow":"");
|
|
var tabs=_33e.find(".tabs");
|
|
tabs.removeClass("tabs-pill").addClass(opts.pill?"tabs-pill":"");
|
|
tabs.removeClass("tabs-narrow").addClass(opts.narrow?"tabs-narrow":"");
|
|
tabs.removeClass("tabs-justified").addClass(opts.justified?"tabs-justified":"");
|
|
if(opts.border==true){
|
|
_33e.removeClass("tabs-header-noborder");
|
|
_33f.removeClass("tabs-panels-noborder");
|
|
}else{
|
|
_33e.addClass("tabs-header-noborder");
|
|
_33f.addClass("tabs-panels-noborder");
|
|
}
|
|
opts.doSize=true;
|
|
};
|
|
function _340(_341,_342,pp){
|
|
_342=_342||{};
|
|
var _343=$.data(_341,"tabs");
|
|
var tabs=_343.tabs;
|
|
if(_342.index==undefined||_342.index>tabs.length){
|
|
_342.index=tabs.length;
|
|
}
|
|
if(_342.index<0){
|
|
_342.index=0;
|
|
}
|
|
var ul=$(_341).children("div.tabs-header").find("ul.tabs");
|
|
var _344=$(_341).children("div.tabs-panels");
|
|
var tab=$("<li>"+"<a href=\"javascript:void(0)\" class=\"tabs-inner\">"+"<span class=\"tabs-title\"></span>"+"<span class=\"tabs-icon\"></span>"+"</a>"+"</li>");
|
|
if(!pp){
|
|
pp=$("<div></div>");
|
|
}
|
|
if(_342.index>=tabs.length){
|
|
tab.appendTo(ul);
|
|
pp.appendTo(_344);
|
|
tabs.push(pp);
|
|
}else{
|
|
tab.insertBefore(ul.children("li:eq("+_342.index+")"));
|
|
pp.insertBefore(_344.children("div.panel:eq("+_342.index+")"));
|
|
tabs.splice(_342.index,0,pp);
|
|
}
|
|
pp.panel($.extend({},_342,{tab:tab,border:false,noheader:true,closed:true,doSize:false,iconCls:(_342.icon?_342.icon:undefined),onLoad:function(){
|
|
if(_342.onLoad){
|
|
_342.onLoad.call(this,arguments);
|
|
}
|
|
_343.options.onLoad.call(_341,$(this));
|
|
},onBeforeOpen:function(){
|
|
if(_342.onBeforeOpen){
|
|
if(_342.onBeforeOpen.call(this)==false){
|
|
return false;
|
|
}
|
|
}
|
|
var p=$(_341).tabs("getSelected");
|
|
if(p){
|
|
if(p[0]!=this){
|
|
$(_341).tabs("unselect",_34b(_341,p));
|
|
p=$(_341).tabs("getSelected");
|
|
if(p){
|
|
return false;
|
|
}
|
|
}else{
|
|
_32b(_341);
|
|
return false;
|
|
}
|
|
}
|
|
var _345=$(this).panel("options");
|
|
_345.tab.addClass("tabs-selected");
|
|
var wrap=$(_341).find(">div.tabs-header>div.tabs-wrap");
|
|
var left=_345.tab.position().left;
|
|
var _346=left+_345.tab.outerWidth();
|
|
if(left<0||_346>wrap.width()){
|
|
var _347=left-(wrap.width()-_345.tab.width())/2;
|
|
$(_341).tabs("scrollBy",_347);
|
|
}else{
|
|
$(_341).tabs("scrollBy",0);
|
|
}
|
|
var _348=$(this).panel("panel");
|
|
_348.css("display","block");
|
|
_32b(_341);
|
|
_348.css("display","none");
|
|
},onOpen:function(){
|
|
if(_342.onOpen){
|
|
_342.onOpen.call(this);
|
|
}
|
|
var _349=$(this).panel("options");
|
|
_343.selectHis.push(_349.title);
|
|
_343.options.onSelect.call(_341,_349.title,_34b(_341,this));
|
|
},onBeforeClose:function(){
|
|
if(_342.onBeforeClose){
|
|
if(_342.onBeforeClose.call(this)==false){
|
|
return false;
|
|
}
|
|
}
|
|
$(this).panel("options").tab.removeClass("tabs-selected");
|
|
},onClose:function(){
|
|
if(_342.onClose){
|
|
_342.onClose.call(this);
|
|
}
|
|
var _34a=$(this).panel("options");
|
|
_343.options.onUnselect.call(_341,_34a.title,_34b(_341,this));
|
|
}}));
|
|
$(_341).tabs("update",{tab:pp,options:pp.panel("options"),type:"header"});
|
|
};
|
|
function _34c(_34d,_34e){
|
|
var _34f=$.data(_34d,"tabs");
|
|
var opts=_34f.options;
|
|
if(_34e.selected==undefined){
|
|
_34e.selected=true;
|
|
}
|
|
_340(_34d,_34e);
|
|
opts.onAdd.call(_34d,_34e.title,_34e.index);
|
|
if(_34e.selected){
|
|
_350(_34d,_34e.index);
|
|
}
|
|
};
|
|
function _351(_352,_353){
|
|
_353.type=_353.type||"all";
|
|
var _354=$.data(_352,"tabs").selectHis;
|
|
var pp=_353.tab;
|
|
var opts=pp.panel("options");
|
|
var _355=opts.title;
|
|
$.extend(opts,_353.options,{iconCls:(_353.options.icon?_353.options.icon:undefined)});
|
|
if(_353.type=="all"||_353.type=="body"){
|
|
pp.panel();
|
|
}
|
|
if(_353.type=="all"||_353.type=="header"){
|
|
var tab=opts.tab;
|
|
if(opts.header){
|
|
tab.find(".tabs-inner").html($(opts.header));
|
|
}else{
|
|
var _356=tab.find("span.tabs-title");
|
|
var _357=tab.find("span.tabs-icon");
|
|
_356.html(opts.title);
|
|
_357.attr("class","tabs-icon");
|
|
tab.find("a.tabs-close").remove();
|
|
if(opts.closable){
|
|
_356.addClass("tabs-closable");
|
|
$("<a href=\"javascript:void(0)\" class=\"tabs-close\"></a>").appendTo(tab);
|
|
}else{
|
|
_356.removeClass("tabs-closable");
|
|
}
|
|
if(opts.iconCls){
|
|
_356.addClass("tabs-with-icon");
|
|
_357.addClass(opts.iconCls);
|
|
}else{
|
|
_356.removeClass("tabs-with-icon");
|
|
}
|
|
if(opts.tools){
|
|
var _358=tab.find("span.tabs-p-tool");
|
|
if(!_358.length){
|
|
var _358=$("<span class=\"tabs-p-tool\"></span>").insertAfter(tab.find("a.tabs-inner"));
|
|
}
|
|
if($.isArray(opts.tools)){
|
|
_358.empty();
|
|
for(var i=0;i<opts.tools.length;i++){
|
|
var t=$("<a href=\"javascript:void(0)\"></a>").appendTo(_358);
|
|
t.addClass(opts.tools[i].iconCls);
|
|
if(opts.tools[i].handler){
|
|
t.bind("click",{handler:opts.tools[i].handler},function(e){
|
|
if($(this).parents("li").hasClass("tabs-disabled")){
|
|
return;
|
|
}
|
|
e.data.handler.call(this);
|
|
});
|
|
}
|
|
}
|
|
}else{
|
|
$(opts.tools).children().appendTo(_358);
|
|
}
|
|
var pr=_358.children().length*12;
|
|
if(opts.closable){
|
|
pr+=8;
|
|
}else{
|
|
pr-=3;
|
|
_358.css("right","5px");
|
|
}
|
|
_356.css("padding-right",pr+"px");
|
|
}else{
|
|
tab.find("span.tabs-p-tool").remove();
|
|
_356.css("padding-right","");
|
|
}
|
|
}
|
|
if(_355!=opts.title){
|
|
for(var i=0;i<_354.length;i++){
|
|
if(_354[i]==_355){
|
|
_354[i]=opts.title;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(opts.disabled){
|
|
opts.tab.addClass("tabs-disabled");
|
|
}else{
|
|
opts.tab.removeClass("tabs-disabled");
|
|
}
|
|
_31f(_352);
|
|
$.data(_352,"tabs").options.onUpdate.call(_352,opts.title,_34b(_352,pp));
|
|
};
|
|
function _359(_35a,_35b){
|
|
var opts=$.data(_35a,"tabs").options;
|
|
var tabs=$.data(_35a,"tabs").tabs;
|
|
var _35c=$.data(_35a,"tabs").selectHis;
|
|
if(!_35d(_35a,_35b)){
|
|
return;
|
|
}
|
|
var tab=_35e(_35a,_35b);
|
|
var _35f=tab.panel("options").title;
|
|
var _360=_34b(_35a,tab);
|
|
if(opts.onBeforeClose.call(_35a,_35f,_360)==false){
|
|
return;
|
|
}
|
|
var tab=_35e(_35a,_35b,true);
|
|
tab.panel("options").tab.remove();
|
|
tab.panel("destroy");
|
|
opts.onClose.call(_35a,_35f,_360);
|
|
_31f(_35a);
|
|
for(var i=0;i<_35c.length;i++){
|
|
if(_35c[i]==_35f){
|
|
_35c.splice(i,1);
|
|
i--;
|
|
}
|
|
}
|
|
var _361=_35c.pop();
|
|
if(_361){
|
|
_350(_35a,_361);
|
|
}else{
|
|
if(tabs.length){
|
|
_350(_35a,0);
|
|
}
|
|
}
|
|
};
|
|
function _35e(_362,_363,_364){
|
|
var tabs=$.data(_362,"tabs").tabs;
|
|
if(typeof _363=="number"){
|
|
if(_363<0||_363>=tabs.length){
|
|
return null;
|
|
}else{
|
|
var tab=tabs[_363];
|
|
if(_364){
|
|
tabs.splice(_363,1);
|
|
}
|
|
return tab;
|
|
}
|
|
}
|
|
for(var i=0;i<tabs.length;i++){
|
|
var tab=tabs[i];
|
|
if(tab.panel("options").title==_363){
|
|
if(_364){
|
|
tabs.splice(i,1);
|
|
}
|
|
return tab;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _34b(_365,tab){
|
|
var tabs=$.data(_365,"tabs").tabs;
|
|
for(var i=0;i<tabs.length;i++){
|
|
if(tabs[i][0]==$(tab)[0]){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
function _32d(_366){
|
|
var tabs=$.data(_366,"tabs").tabs;
|
|
for(var i=0;i<tabs.length;i++){
|
|
var tab=tabs[i];
|
|
if(tab.panel("options").tab.hasClass("tabs-selected")){
|
|
return tab;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _367(_368){
|
|
var _369=$.data(_368,"tabs");
|
|
var tabs=_369.tabs;
|
|
for(var i=0;i<tabs.length;i++){
|
|
var opts=tabs[i].panel("options");
|
|
if(opts.selected&&!opts.disabled){
|
|
_350(_368,i);
|
|
return;
|
|
}
|
|
}
|
|
_350(_368,_369.options.selected);
|
|
};
|
|
function _350(_36a,_36b){
|
|
var p=_35e(_36a,_36b);
|
|
if(p&&!p.is(":visible")){
|
|
_36c(_36a);
|
|
if(!p.panel("options").disabled){
|
|
p.panel("open");
|
|
}
|
|
}
|
|
};
|
|
function _36d(_36e,_36f){
|
|
var p=_35e(_36e,_36f);
|
|
if(p&&p.is(":visible")){
|
|
_36c(_36e);
|
|
p.panel("close");
|
|
}
|
|
};
|
|
function _36c(_370){
|
|
$(_370).children("div.tabs-panels").each(function(){
|
|
$(this).stop(true,true);
|
|
});
|
|
};
|
|
function _35d(_371,_372){
|
|
return _35e(_371,_372)!=null;
|
|
};
|
|
function _373(_374,_375){
|
|
var opts=$.data(_374,"tabs").options;
|
|
opts.showHeader=_375;
|
|
$(_374).tabs("resize");
|
|
};
|
|
function _376(_377,_378){
|
|
var tool=$(_377).find(">.tabs-header>.tabs-tool");
|
|
if(_378){
|
|
tool.removeClass("tabs-tool-hidden").show();
|
|
}else{
|
|
tool.addClass("tabs-tool-hidden").hide();
|
|
}
|
|
$(_377).tabs("resize").tabs("scrollBy",0);
|
|
};
|
|
$.fn.tabs=function(_379,_37a){
|
|
if(typeof _379=="string"){
|
|
return $.fn.tabs.methods[_379](this,_37a);
|
|
}
|
|
_379=_379||{};
|
|
return this.each(function(){
|
|
var _37b=$.data(this,"tabs");
|
|
if(_37b){
|
|
$.extend(_37b.options,_379);
|
|
}else{
|
|
$.data(this,"tabs",{options:$.extend({},$.fn.tabs.defaults,$.fn.tabs.parseOptions(this),_379),tabs:[],selectHis:[]});
|
|
_331(this);
|
|
}
|
|
_31b(this);
|
|
_33c(this);
|
|
_31f(this);
|
|
_335(this);
|
|
_367(this);
|
|
});
|
|
};
|
|
$.fn.tabs.methods={options:function(jq){
|
|
var cc=jq[0];
|
|
var opts=$.data(cc,"tabs").options;
|
|
var s=_32d(cc);
|
|
opts.selected=s?_34b(cc,s):-1;
|
|
return opts;
|
|
},tabs:function(jq){
|
|
return $.data(jq[0],"tabs").tabs;
|
|
},resize:function(jq,_37c){
|
|
return jq.each(function(){
|
|
_31f(this,_37c);
|
|
_32b(this);
|
|
});
|
|
},add:function(jq,_37d){
|
|
return jq.each(function(){
|
|
_34c(this,_37d);
|
|
});
|
|
},close:function(jq,_37e){
|
|
return jq.each(function(){
|
|
_359(this,_37e);
|
|
});
|
|
},getTab:function(jq,_37f){
|
|
return _35e(jq[0],_37f);
|
|
},getTabIndex:function(jq,tab){
|
|
return _34b(jq[0],tab);
|
|
},getSelected:function(jq){
|
|
return _32d(jq[0]);
|
|
},select:function(jq,_380){
|
|
return jq.each(function(){
|
|
_350(this,_380);
|
|
});
|
|
},unselect:function(jq,_381){
|
|
return jq.each(function(){
|
|
_36d(this,_381);
|
|
});
|
|
},exists:function(jq,_382){
|
|
return _35d(jq[0],_382);
|
|
},update:function(jq,_383){
|
|
return jq.each(function(){
|
|
_351(this,_383);
|
|
});
|
|
},enableTab:function(jq,_384){
|
|
return jq.each(function(){
|
|
var opts=$(this).tabs("getTab",_384).panel("options");
|
|
opts.tab.removeClass("tabs-disabled");
|
|
opts.disabled=false;
|
|
});
|
|
},disableTab:function(jq,_385){
|
|
return jq.each(function(){
|
|
var opts=$(this).tabs("getTab",_385).panel("options");
|
|
opts.tab.addClass("tabs-disabled");
|
|
opts.disabled=true;
|
|
});
|
|
},showHeader:function(jq){
|
|
return jq.each(function(){
|
|
_373(this,true);
|
|
});
|
|
},hideHeader:function(jq){
|
|
return jq.each(function(){
|
|
_373(this,false);
|
|
});
|
|
},showTool:function(jq){
|
|
return jq.each(function(){
|
|
_376(this,true);
|
|
});
|
|
},hideTool:function(jq){
|
|
return jq.each(function(){
|
|
_376(this,false);
|
|
});
|
|
},scrollBy:function(jq,_386){
|
|
return jq.each(function(){
|
|
var opts=$(this).tabs("options");
|
|
var wrap=$(this).find(">div.tabs-header>div.tabs-wrap");
|
|
var pos=Math.min(wrap._scrollLeft()+_386,_387());
|
|
wrap.animate({scrollLeft:pos},opts.scrollDuration);
|
|
function _387(){
|
|
var w=0;
|
|
var ul=wrap.children("ul");
|
|
ul.children("li").each(function(){
|
|
w+=$(this).outerWidth(true);
|
|
});
|
|
return w-wrap.width()+(ul.outerWidth()-ul.width());
|
|
};
|
|
});
|
|
}};
|
|
$.fn.tabs.parseOptions=function(_388){
|
|
return $.extend({},$.parser.parseOptions(_388,["tools","toolPosition","tabPosition",{fit:"boolean",border:"boolean",plain:"boolean"},{headerWidth:"number",tabWidth:"number",tabHeight:"number",selected:"number"},{showHeader:"boolean",justified:"boolean",narrow:"boolean",pill:"boolean"}]));
|
|
};
|
|
$.fn.tabs.defaults={width:"auto",height:"auto",headerWidth:150,tabWidth:"auto",tabHeight:27,selected:0,showHeader:true,plain:false,fit:false,border:true,justified:false,narrow:false,pill:false,tools:null,toolPosition:"right",tabPosition:"top",scrollIncrement:100,scrollDuration:400,onLoad:function(_389){
|
|
},onSelect:function(_38a,_38b){
|
|
},onUnselect:function(_38c,_38d){
|
|
},onBeforeClose:function(_38e,_38f){
|
|
},onClose:function(_390,_391){
|
|
},onAdd:function(_392,_393){
|
|
},onUpdate:function(_394,_395){
|
|
},onContextMenu:function(e,_396,_397){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
var _398=false;
|
|
function _399(_39a,_39b){
|
|
var _39c=$.data(_39a,"layout");
|
|
var opts=_39c.options;
|
|
var _39d=_39c.panels;
|
|
var cc=$(_39a);
|
|
if(_39b){
|
|
$.extend(opts,{width:_39b.width,height:_39b.height});
|
|
}
|
|
if(_39a.tagName.toLowerCase()=="body"){
|
|
cc._size("fit");
|
|
}else{
|
|
cc._size(opts);
|
|
}
|
|
var cpos={top:0,left:0,width:cc.width(),height:cc.height()};
|
|
_39e(_39f(_39d.expandNorth)?_39d.expandNorth:_39d.north,"n");
|
|
_39e(_39f(_39d.expandSouth)?_39d.expandSouth:_39d.south,"s");
|
|
_3a0(_39f(_39d.expandEast)?_39d.expandEast:_39d.east,"e");
|
|
_3a0(_39f(_39d.expandWest)?_39d.expandWest:_39d.west,"w");
|
|
_39d.center.panel("resize",cpos);
|
|
function _39e(pp,type){
|
|
if(!pp.length||!_39f(pp)){
|
|
return;
|
|
}
|
|
var opts=pp.panel("options");
|
|
pp.panel("resize",{width:cc.width(),height:opts.height});
|
|
var _3a1=pp.panel("panel").outerHeight();
|
|
pp.panel("move",{left:0,top:(type=="n"?0:cc.height()-_3a1)});
|
|
cpos.height-=_3a1;
|
|
if(type=="n"){
|
|
cpos.top+=_3a1;
|
|
if(!opts.split&&opts.border){
|
|
cpos.top--;
|
|
}
|
|
}
|
|
if(!opts.split&&opts.border){
|
|
cpos.height++;
|
|
}
|
|
};
|
|
function _3a0(pp,type){
|
|
if(!pp.length||!_39f(pp)){
|
|
return;
|
|
}
|
|
var opts=pp.panel("options");
|
|
pp.panel("resize",{width:opts.width,height:cpos.height});
|
|
var _3a2=pp.panel("panel").outerWidth();
|
|
pp.panel("move",{left:(type=="e"?cc.width()-_3a2:0),top:cpos.top});
|
|
cpos.width-=_3a2;
|
|
if(type=="w"){
|
|
cpos.left+=_3a2;
|
|
if(!opts.split&&opts.border){
|
|
cpos.left--;
|
|
}
|
|
}
|
|
if(!opts.split&&opts.border){
|
|
cpos.width++;
|
|
}
|
|
};
|
|
};
|
|
function init(_3a3){
|
|
var cc=$(_3a3);
|
|
cc.addClass("layout");
|
|
function _3a4(cc){
|
|
var opts=cc.layout("options");
|
|
var _3a5=opts.onAdd;
|
|
opts.onAdd=function(){
|
|
};
|
|
cc.children("div").each(function(){
|
|
var _3a6=$.fn.layout.parsePanelOptions(this);
|
|
if("north,south,east,west,center".indexOf(_3a6.region)>=0){
|
|
_3a8(_3a3,_3a6,this);
|
|
}
|
|
});
|
|
opts.onAdd=_3a5;
|
|
};
|
|
cc.children("form").length?_3a4(cc.children("form")):_3a4(cc);
|
|
cc.append("<div class=\"layout-split-proxy-h\"></div><div class=\"layout-split-proxy-v\"></div>");
|
|
cc.bind("_resize",function(e,_3a7){
|
|
if($(this).hasClass("easyui-fluid")||_3a7){
|
|
_399(_3a3);
|
|
}
|
|
return false;
|
|
});
|
|
};
|
|
function _3a8(_3a9,_3aa,el){
|
|
_3aa.region=_3aa.region||"center";
|
|
var _3ab=$.data(_3a9,"layout").panels;
|
|
var cc=$(_3a9);
|
|
var dir=_3aa.region;
|
|
if(_3ab[dir].length){
|
|
return;
|
|
}
|
|
var pp=$(el);
|
|
if(!pp.length){
|
|
pp=$("<div></div>").appendTo(cc);
|
|
}
|
|
var _3ac=$.extend({},$.fn.layout.paneldefaults,{width:(pp.length?parseInt(pp[0].style.width)||pp.outerWidth():"auto"),height:(pp.length?parseInt(pp[0].style.height)||pp.outerHeight():"auto"),doSize:false,collapsible:true,onOpen:function(){
|
|
var tool=$(this).panel("header").children("div.panel-tool");
|
|
tool.children("a.panel-tool-collapse").hide();
|
|
var _3ad={north:"up",south:"down",east:"right",west:"left"};
|
|
if(!_3ad[dir]){
|
|
return;
|
|
}
|
|
var _3ae="layout-button-"+_3ad[dir];
|
|
var t=tool.children("a."+_3ae);
|
|
if(!t.length){
|
|
t=$("<a href=\"javascript:void(0)\"></a>").addClass(_3ae).appendTo(tool);
|
|
t.bind("click",{dir:dir},function(e){
|
|
_3ba(_3a9,e.data.dir);
|
|
return false;
|
|
});
|
|
}
|
|
$(this).panel("options").collapsible?t.show():t.hide();
|
|
}},_3aa,{cls:((_3aa.cls||"")+" layout-panel layout-panel-"+dir),bodyCls:((_3aa.bodyCls||"")+" layout-body")});
|
|
pp.panel(_3ac);
|
|
_3ab[dir]=pp;
|
|
var _3af={north:"s",south:"n",east:"w",west:"e"};
|
|
var _3b0=pp.panel("panel");
|
|
if(pp.panel("options").split){
|
|
_3b0.addClass("layout-split-"+dir);
|
|
}
|
|
_3b0.resizable($.extend({},{handles:(_3af[dir]||""),disabled:(!pp.panel("options").split),onStartResize:function(e){
|
|
_398=true;
|
|
if(dir=="north"||dir=="south"){
|
|
var _3b1=$(">div.layout-split-proxy-v",_3a9);
|
|
}else{
|
|
var _3b1=$(">div.layout-split-proxy-h",_3a9);
|
|
}
|
|
var top=0,left=0,_3b2=0,_3b3=0;
|
|
var pos={display:"block"};
|
|
if(dir=="north"){
|
|
pos.top=parseInt(_3b0.css("top"))+_3b0.outerHeight()-_3b1.height();
|
|
pos.left=parseInt(_3b0.css("left"));
|
|
pos.width=_3b0.outerWidth();
|
|
pos.height=_3b1.height();
|
|
}else{
|
|
if(dir=="south"){
|
|
pos.top=parseInt(_3b0.css("top"));
|
|
pos.left=parseInt(_3b0.css("left"));
|
|
pos.width=_3b0.outerWidth();
|
|
pos.height=_3b1.height();
|
|
}else{
|
|
if(dir=="east"){
|
|
pos.top=parseInt(_3b0.css("top"))||0;
|
|
pos.left=parseInt(_3b0.css("left"))||0;
|
|
pos.width=_3b1.width();
|
|
pos.height=_3b0.outerHeight();
|
|
}else{
|
|
if(dir=="west"){
|
|
pos.top=parseInt(_3b0.css("top"))||0;
|
|
pos.left=_3b0.outerWidth()-_3b1.width();
|
|
pos.width=_3b1.width();
|
|
pos.height=_3b0.outerHeight();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
_3b1.css(pos);
|
|
$("<div class=\"layout-mask\"></div>").css({left:0,top:0,width:cc.width(),height:cc.height()}).appendTo(cc);
|
|
},onResize:function(e){
|
|
if(dir=="north"||dir=="south"){
|
|
var _3b4=$(">div.layout-split-proxy-v",_3a9);
|
|
_3b4.css("top",e.pageY-$(_3a9).offset().top-_3b4.height()/2);
|
|
}else{
|
|
var _3b4=$(">div.layout-split-proxy-h",_3a9);
|
|
_3b4.css("left",e.pageX-$(_3a9).offset().left-_3b4.width()/2);
|
|
}
|
|
return false;
|
|
},onStopResize:function(e){
|
|
cc.children("div.layout-split-proxy-v,div.layout-split-proxy-h").hide();
|
|
pp.panel("resize",e.data);
|
|
_399(_3a9);
|
|
_398=false;
|
|
cc.find(">div.layout-mask").remove();
|
|
}},_3aa));
|
|
cc.layout("options").onAdd.call(_3a9,dir);
|
|
};
|
|
function _3b5(_3b6,_3b7){
|
|
var _3b8=$.data(_3b6,"layout").panels;
|
|
if(_3b8[_3b7].length){
|
|
_3b8[_3b7].panel("destroy");
|
|
_3b8[_3b7]=$();
|
|
var _3b9="expand"+_3b7.substring(0,1).toUpperCase()+_3b7.substring(1);
|
|
if(_3b8[_3b9]){
|
|
_3b8[_3b9].panel("destroy");
|
|
_3b8[_3b9]=undefined;
|
|
}
|
|
$(_3b6).layout("options").onRemove.call(_3b6,_3b7);
|
|
}
|
|
};
|
|
function _3ba(_3bb,_3bc,_3bd){
|
|
if(_3bd==undefined){
|
|
_3bd="normal";
|
|
}
|
|
var _3be=$.data(_3bb,"layout").panels;
|
|
var p=_3be[_3bc];
|
|
var _3bf=p.panel("options");
|
|
if(_3bf.onBeforeCollapse.call(p)==false){
|
|
return;
|
|
}
|
|
var _3c0="expand"+_3bc.substring(0,1).toUpperCase()+_3bc.substring(1);
|
|
if(!_3be[_3c0]){
|
|
_3be[_3c0]=_3c1(_3bc);
|
|
var ep=_3be[_3c0].panel("panel");
|
|
if(!_3bf.expandMode){
|
|
ep.css("cursor","default");
|
|
}else{
|
|
ep.bind("click",function(){
|
|
if(_3bf.expandMode=="dock"){
|
|
_3cc(_3bb,_3bc);
|
|
}else{
|
|
p.panel("expand",false).panel("open");
|
|
var _3c2=_3c3();
|
|
p.panel("resize",_3c2.collapse);
|
|
p.panel("panel").animate(_3c2.expand,function(){
|
|
$(this).unbind(".layout").bind("mouseleave.layout",{region:_3bc},function(e){
|
|
if(_398==true){
|
|
return;
|
|
}
|
|
if($("body>div.combo-p>div.combo-panel:visible").length){
|
|
return;
|
|
}
|
|
_3ba(_3bb,e.data.region);
|
|
});
|
|
$(_3bb).layout("options").onExpand.call(_3bb,_3bc);
|
|
});
|
|
}
|
|
return false;
|
|
});
|
|
}
|
|
}
|
|
var _3c4=_3c3();
|
|
if(!_39f(_3be[_3c0])){
|
|
_3be.center.panel("resize",_3c4.resizeC);
|
|
}
|
|
p.panel("panel").animate(_3c4.collapse,_3bd,function(){
|
|
p.panel("collapse",false).panel("close");
|
|
_3be[_3c0].panel("open").panel("resize",_3c4.expandP);
|
|
$(this).unbind(".layout");
|
|
$(_3bb).layout("options").onCollapse.call(_3bb,_3bc);
|
|
});
|
|
function _3c1(dir){
|
|
var _3c5={"east":"left","west":"right","north":"down","south":"up"};
|
|
var isns=(_3bf.region=="north"||_3bf.region=="south");
|
|
var icon="layout-button-"+_3c5[dir];
|
|
var p=$("<div></div>").appendTo(_3bb);
|
|
p.panel($.extend({},$.fn.layout.paneldefaults,{cls:("layout-expand layout-expand-"+dir),title:" ",iconCls:(_3bf.hideCollapsedContent?null:_3bf.iconCls),closed:true,minWidth:0,minHeight:0,doSize:false,region:_3bf.region,collapsedSize:_3bf.collapsedSize,noheader:(!isns&&_3bf.hideExpandTool),tools:((isns&&_3bf.hideExpandTool)?null:[{iconCls:icon,handler:function(){
|
|
_3cc(_3bb,_3bc);
|
|
return false;
|
|
}}])}));
|
|
if(!_3bf.hideCollapsedContent){
|
|
var _3c6=typeof _3bf.collapsedContent=="function"?_3bf.collapsedContent.call(p[0],_3bf.title):_3bf.collapsedContent;
|
|
isns?p.panel("setTitle",_3c6):p.html(_3c6);
|
|
}
|
|
p.panel("panel").hover(function(){
|
|
$(this).addClass("layout-expand-over");
|
|
},function(){
|
|
$(this).removeClass("layout-expand-over");
|
|
});
|
|
return p;
|
|
};
|
|
function _3c3(){
|
|
var cc=$(_3bb);
|
|
var _3c7=_3be.center.panel("options");
|
|
var _3c8=_3bf.collapsedSize;
|
|
if(_3bc=="east"){
|
|
var _3c9=p.panel("panel")._outerWidth();
|
|
var _3ca=_3c7.width+_3c9-_3c8;
|
|
if(_3bf.split||!_3bf.border){
|
|
_3ca++;
|
|
}
|
|
return {resizeC:{width:_3ca},expand:{left:cc.width()-_3c9},expandP:{top:_3c7.top,left:cc.width()-_3c8,width:_3c8,height:_3c7.height},collapse:{left:cc.width(),top:_3c7.top,height:_3c7.height}};
|
|
}else{
|
|
if(_3bc=="west"){
|
|
var _3c9=p.panel("panel")._outerWidth();
|
|
var _3ca=_3c7.width+_3c9-_3c8;
|
|
if(_3bf.split||!_3bf.border){
|
|
_3ca++;
|
|
}
|
|
return {resizeC:{width:_3ca,left:_3c8-1},expand:{left:0},expandP:{left:0,top:_3c7.top,width:_3c8,height:_3c7.height},collapse:{left:-_3c9,top:_3c7.top,height:_3c7.height}};
|
|
}else{
|
|
if(_3bc=="north"){
|
|
var _3cb=p.panel("panel")._outerHeight();
|
|
var hh=_3c7.height;
|
|
if(!_39f(_3be.expandNorth)){
|
|
hh+=_3cb-_3c8+((_3bf.split||!_3bf.border)?1:0);
|
|
}
|
|
_3be.east.add(_3be.west).add(_3be.expandEast).add(_3be.expandWest).panel("resize",{top:_3c8-1,height:hh});
|
|
return {resizeC:{top:_3c8-1,height:hh},expand:{top:0},expandP:{top:0,left:0,width:cc.width(),height:_3c8},collapse:{top:-_3cb,width:cc.width()}};
|
|
}else{
|
|
if(_3bc=="south"){
|
|
var _3cb=p.panel("panel")._outerHeight();
|
|
var hh=_3c7.height;
|
|
if(!_39f(_3be.expandSouth)){
|
|
hh+=_3cb-_3c8+((_3bf.split||!_3bf.border)?1:0);
|
|
}
|
|
_3be.east.add(_3be.west).add(_3be.expandEast).add(_3be.expandWest).panel("resize",{height:hh});
|
|
return {resizeC:{height:hh},expand:{top:cc.height()-_3cb},expandP:{top:cc.height()-_3c8,left:0,width:cc.width(),height:_3c8},collapse:{top:cc.height(),width:cc.width()}};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function _3cc(_3cd,_3ce){
|
|
var _3cf=$.data(_3cd,"layout").panels;
|
|
var p=_3cf[_3ce];
|
|
var _3d0=p.panel("options");
|
|
if(_3d0.onBeforeExpand.call(p)==false){
|
|
return;
|
|
}
|
|
var _3d1="expand"+_3ce.substring(0,1).toUpperCase()+_3ce.substring(1);
|
|
if(_3cf[_3d1]){
|
|
_3cf[_3d1].panel("close");
|
|
p.panel("panel").stop(true,true);
|
|
p.panel("expand",false).panel("open");
|
|
var _3d2=_3d3();
|
|
p.panel("resize",_3d2.collapse);
|
|
p.panel("panel").animate(_3d2.expand,function(){
|
|
_399(_3cd);
|
|
$(_3cd).layout("options").onExpand.call(_3cd,_3ce);
|
|
});
|
|
}
|
|
function _3d3(){
|
|
var cc=$(_3cd);
|
|
var _3d4=_3cf.center.panel("options");
|
|
if(_3ce=="east"&&_3cf.expandEast){
|
|
return {collapse:{left:cc.width(),top:_3d4.top,height:_3d4.height},expand:{left:cc.width()-p.panel("panel")._outerWidth()}};
|
|
}else{
|
|
if(_3ce=="west"&&_3cf.expandWest){
|
|
return {collapse:{left:-p.panel("panel")._outerWidth(),top:_3d4.top,height:_3d4.height},expand:{left:0}};
|
|
}else{
|
|
if(_3ce=="north"&&_3cf.expandNorth){
|
|
return {collapse:{top:-p.panel("panel")._outerHeight(),width:cc.width()},expand:{top:0}};
|
|
}else{
|
|
if(_3ce=="south"&&_3cf.expandSouth){
|
|
return {collapse:{top:cc.height(),width:cc.width()},expand:{top:cc.height()-p.panel("panel")._outerHeight()}};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function _39f(pp){
|
|
if(!pp){
|
|
return false;
|
|
}
|
|
if(pp.length){
|
|
return pp.panel("panel").is(":visible");
|
|
}else{
|
|
return false;
|
|
}
|
|
};
|
|
function _3d5(_3d6){
|
|
var _3d7=$.data(_3d6,"layout");
|
|
var opts=_3d7.options;
|
|
var _3d8=_3d7.panels;
|
|
var _3d9=opts.onCollapse;
|
|
opts.onCollapse=function(){
|
|
};
|
|
_3da("east");
|
|
_3da("west");
|
|
_3da("north");
|
|
_3da("south");
|
|
opts.onCollapse=_3d9;
|
|
function _3da(_3db){
|
|
var p=_3d8[_3db];
|
|
if(p.length&&p.panel("options").collapsed){
|
|
_3ba(_3d6,_3db,0);
|
|
}
|
|
};
|
|
};
|
|
function _3dc(_3dd,_3de,_3df){
|
|
var p=$(_3dd).layout("panel",_3de);
|
|
p.panel("options").split=_3df;
|
|
var cls="layout-split-"+_3de;
|
|
var _3e0=p.panel("panel").removeClass(cls);
|
|
if(_3df){
|
|
_3e0.addClass(cls);
|
|
}
|
|
_3e0.resizable({disabled:(!_3df)});
|
|
_399(_3dd);
|
|
};
|
|
$.fn.layout=function(_3e1,_3e2){
|
|
if(typeof _3e1=="string"){
|
|
return $.fn.layout.methods[_3e1](this,_3e2);
|
|
}
|
|
_3e1=_3e1||{};
|
|
return this.each(function(){
|
|
var _3e3=$.data(this,"layout");
|
|
if(_3e3){
|
|
$.extend(_3e3.options,_3e1);
|
|
}else{
|
|
var opts=$.extend({},$.fn.layout.defaults,$.fn.layout.parseOptions(this),_3e1);
|
|
$.data(this,"layout",{options:opts,panels:{center:$(),north:$(),south:$(),east:$(),west:$()}});
|
|
init(this);
|
|
}
|
|
_399(this);
|
|
_3d5(this);
|
|
});
|
|
};
|
|
$.fn.layout.methods={options:function(jq){
|
|
return $.data(jq[0],"layout").options;
|
|
},resize:function(jq,_3e4){
|
|
return jq.each(function(){
|
|
_399(this,_3e4);
|
|
});
|
|
},panel:function(jq,_3e5){
|
|
return $.data(jq[0],"layout").panels[_3e5];
|
|
},collapse:function(jq,_3e6){
|
|
return jq.each(function(){
|
|
_3ba(this,_3e6);
|
|
});
|
|
},expand:function(jq,_3e7){
|
|
return jq.each(function(){
|
|
_3cc(this,_3e7);
|
|
});
|
|
},add:function(jq,_3e8){
|
|
return jq.each(function(){
|
|
_3a8(this,_3e8);
|
|
_399(this);
|
|
if($(this).layout("panel",_3e8.region).panel("options").collapsed){
|
|
_3ba(this,_3e8.region,0);
|
|
}
|
|
});
|
|
},remove:function(jq,_3e9){
|
|
return jq.each(function(){
|
|
_3b5(this,_3e9);
|
|
_399(this);
|
|
});
|
|
},split:function(jq,_3ea){
|
|
return jq.each(function(){
|
|
_3dc(this,_3ea,true);
|
|
});
|
|
},unsplit:function(jq,_3eb){
|
|
return jq.each(function(){
|
|
_3dc(this,_3eb,false);
|
|
});
|
|
}};
|
|
$.fn.layout.parseOptions=function(_3ec){
|
|
return $.extend({},$.parser.parseOptions(_3ec,[{fit:"boolean"}]));
|
|
};
|
|
$.fn.layout.defaults={fit:false,onExpand:function(_3ed){
|
|
},onCollapse:function(_3ee){
|
|
},onAdd:function(_3ef){
|
|
},onRemove:function(_3f0){
|
|
}};
|
|
$.fn.layout.parsePanelOptions=function(_3f1){
|
|
var t=$(_3f1);
|
|
return $.extend({},$.fn.panel.parseOptions(_3f1),$.parser.parseOptions(_3f1,["region",{split:"boolean",collpasedSize:"number",minWidth:"number",minHeight:"number",maxWidth:"number",maxHeight:"number"}]));
|
|
};
|
|
$.fn.layout.paneldefaults=$.extend({},$.fn.panel.defaults,{region:null,split:false,collapsedSize:28,expandMode:"float",hideExpandTool:false,hideCollapsedContent:true,collapsedContent:function(_3f2){
|
|
var p=$(this);
|
|
var opts=p.panel("options");
|
|
if(opts.region=="north"||opts.region=="south"){
|
|
return _3f2;
|
|
}
|
|
var size=opts.collapsedSize-2;
|
|
var left=(size-16)/2;
|
|
left=size-left;
|
|
var cc=[];
|
|
if(opts.iconCls){
|
|
cc.push("<div class=\"panel-icon "+opts.iconCls+"\"></div>");
|
|
}
|
|
cc.push("<div class=\"panel-title layout-expand-title");
|
|
cc.push(opts.iconCls?" layout-expand-with-icon":"");
|
|
cc.push("\" style=\"left:"+left+"px\">");
|
|
cc.push(_3f2);
|
|
cc.push("</div>");
|
|
return cc.join("");
|
|
},minWidth:10,minHeight:10,maxWidth:10000,maxHeight:10000});
|
|
})(jQuery);
|
|
(function($){
|
|
$(function(){
|
|
$(document).unbind(".menu").bind("mousedown.menu",function(e){
|
|
var m=$(e.target).closest("div.menu,div.combo-p");
|
|
if(m.length){
|
|
return;
|
|
}
|
|
$("body>div.menu-top:visible").not(".menu-inline").menu("hide");
|
|
_3f3($("body>div.menu:visible").not(".menu-inline"));
|
|
});
|
|
});
|
|
function init(_3f4){
|
|
var opts=$.data(_3f4,"menu").options;
|
|
$(_3f4).addClass("menu-top");
|
|
opts.inline?$(_3f4).addClass("menu-inline"):$(_3f4).appendTo("body");
|
|
$(_3f4).bind("_resize",function(e,_3f5){
|
|
if($(this).hasClass("easyui-fluid")||_3f5){
|
|
$(_3f4).menu("resize",_3f4);
|
|
}
|
|
return false;
|
|
});
|
|
var _3f6=_3f7($(_3f4));
|
|
for(var i=0;i<_3f6.length;i++){
|
|
_3f8(_3f6[i]);
|
|
}
|
|
function _3f7(menu){
|
|
var _3f9=[];
|
|
menu.addClass("menu");
|
|
_3f9.push(menu);
|
|
if(!menu.hasClass("menu-content")){
|
|
menu.children("div").each(function(){
|
|
var _3fa=$(this).children("div");
|
|
if(_3fa.length){
|
|
_3fa.appendTo("body");
|
|
this.submenu=_3fa;
|
|
var mm=_3f7(_3fa);
|
|
_3f9=_3f9.concat(mm);
|
|
}
|
|
});
|
|
}
|
|
return _3f9;
|
|
};
|
|
function _3f8(menu){
|
|
var wh=$.parser.parseOptions(menu[0],["width","height"]);
|
|
menu[0].originalHeight=wh.height||0;
|
|
if(menu.hasClass("menu-content")){
|
|
menu[0].originalWidth=wh.width||menu._outerWidth();
|
|
}else{
|
|
menu[0].originalWidth=wh.width||0;
|
|
menu.children("div").each(function(){
|
|
var item=$(this);
|
|
var _3fb=$.extend({},$.parser.parseOptions(this,["name","iconCls","href",{separator:"boolean"}]),{disabled:(item.attr("disabled")?true:undefined)});
|
|
if(_3fb.separator){
|
|
item.addClass("menu-sep");
|
|
}
|
|
if(!item.hasClass("menu-sep")){
|
|
item[0].itemName=_3fb.name||"";
|
|
item[0].itemHref=_3fb.href||"";
|
|
var text=item.addClass("menu-item").html();
|
|
item.empty().append($("<div class=\"menu-text\"></div>").html(text));
|
|
if(_3fb.iconCls){
|
|
$("<div class=\"menu-icon\"></div>").addClass(_3fb.iconCls).appendTo(item);
|
|
}
|
|
if(_3fb.disabled){
|
|
_3fc(_3f4,item[0],true);
|
|
}
|
|
if(item[0].submenu){
|
|
$("<div class=\"menu-rightarrow\"></div>").appendTo(item);
|
|
}
|
|
_3fd(_3f4,item);
|
|
}
|
|
});
|
|
$("<div class=\"menu-line\"></div>").prependTo(menu);
|
|
}
|
|
_3fe(_3f4,menu);
|
|
if(!menu.hasClass("menu-inline")){
|
|
menu.hide();
|
|
}
|
|
_3ff(_3f4,menu);
|
|
};
|
|
};
|
|
function _3fe(_400,menu){
|
|
var opts=$.data(_400,"menu").options;
|
|
var _401=menu.attr("style")||"";
|
|
menu.css({display:"block",left:-10000,height:"auto",overflow:"hidden"});
|
|
menu.find(".menu-item").each(function(){
|
|
$(this)._outerHeight(opts.itemHeight);
|
|
$(this).find(".menu-text").css({height:(opts.itemHeight-2)+"px",lineHeight:(opts.itemHeight-2)+"px"});
|
|
});
|
|
menu.removeClass("menu-noline").addClass(opts.noline?"menu-noline":"");
|
|
var _402=menu[0].originalWidth||"auto";
|
|
if(isNaN(parseInt(_402))){
|
|
_402=0;
|
|
menu.find("div.menu-text").each(function(){
|
|
if(_402<$(this)._outerWidth()){
|
|
_402=$(this)._outerWidth();
|
|
}
|
|
});
|
|
_402+=40;
|
|
}
|
|
var _403=menu.outerHeight();
|
|
var _404=menu[0].originalHeight||"auto";
|
|
if(isNaN(parseInt(_404))){
|
|
_404=_403;
|
|
if(menu.hasClass("menu-top")&&opts.alignTo){
|
|
var at=$(opts.alignTo);
|
|
var h1=at.offset().top-$(document).scrollTop();
|
|
var h2=$(window)._outerHeight()+$(document).scrollTop()-at.offset().top-at._outerHeight();
|
|
_404=Math.min(_404,Math.max(h1,h2));
|
|
}else{
|
|
if(_404>$(window)._outerHeight()){
|
|
_404=$(window).height();
|
|
}
|
|
}
|
|
}
|
|
menu.attr("style",_401);
|
|
menu._size({fit:(menu[0]==_400?opts.fit:false),width:_402,minWidth:opts.minWidth,height:_404});
|
|
menu.css("overflow",menu.outerHeight()<_403?"auto":"hidden");
|
|
menu.children("div.menu-line")._outerHeight(_403-2);
|
|
};
|
|
function _3ff(_405,menu){
|
|
if(menu.hasClass("menu-inline")){
|
|
return;
|
|
}
|
|
var _406=$.data(_405,"menu");
|
|
menu.unbind(".menu").bind("mouseenter.menu",function(){
|
|
if(_406.timer){
|
|
clearTimeout(_406.timer);
|
|
_406.timer=null;
|
|
}
|
|
}).bind("mouseleave.menu",function(){
|
|
if(_406.options.hideOnUnhover){
|
|
_406.timer=setTimeout(function(){
|
|
_407(_405,$(_405).hasClass("menu-inline"));
|
|
},_406.options.duration);
|
|
}
|
|
});
|
|
};
|
|
function _3fd(_408,item){
|
|
if(!item.hasClass("menu-item")){
|
|
return;
|
|
}
|
|
item.unbind(".menu");
|
|
item.bind("click.menu",function(){
|
|
if($(this).hasClass("menu-item-disabled")){
|
|
return;
|
|
}
|
|
if(!this.submenu){
|
|
_407(_408,$(_408).hasClass("menu-inline"));
|
|
var href=this.itemHref;
|
|
if(href){
|
|
location.href=href;
|
|
}
|
|
}
|
|
$(this).trigger("mouseenter");
|
|
var item=$(_408).menu("getItem",this);
|
|
$.data(_408,"menu").options.onClick.call(_408,item);
|
|
}).bind("mouseenter.menu",function(e){
|
|
item.siblings().each(function(){
|
|
if(this.submenu){
|
|
_3f3(this.submenu);
|
|
}
|
|
$(this).removeClass("menu-active");
|
|
});
|
|
item.addClass("menu-active");
|
|
if($(this).hasClass("menu-item-disabled")){
|
|
item.addClass("menu-active-disabled");
|
|
return;
|
|
}
|
|
var _409=item[0].submenu;
|
|
if(_409){
|
|
$(_408).menu("show",{menu:_409,parent:item});
|
|
}
|
|
}).bind("mouseleave.menu",function(e){
|
|
item.removeClass("menu-active menu-active-disabled");
|
|
var _40a=item[0].submenu;
|
|
if(_40a){
|
|
if(e.pageX>=parseInt(_40a.css("left"))){
|
|
item.addClass("menu-active");
|
|
}else{
|
|
_3f3(_40a);
|
|
}
|
|
}else{
|
|
item.removeClass("menu-active");
|
|
}
|
|
});
|
|
};
|
|
function _407(_40b,_40c){
|
|
var _40d=$.data(_40b,"menu");
|
|
if(_40d){
|
|
if($(_40b).is(":visible")){
|
|
_3f3($(_40b));
|
|
if(_40c){
|
|
$(_40b).show();
|
|
}else{
|
|
_40d.options.onHide.call(_40b);
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
function _40e(_40f,_410){
|
|
var left,top;
|
|
_410=_410||{};
|
|
var menu=$(_410.menu||_40f);
|
|
$(_40f).menu("resize",menu[0]);
|
|
if(menu.hasClass("menu-top")){
|
|
var opts=$.data(_40f,"menu").options;
|
|
$.extend(opts,_410);
|
|
left=opts.left;
|
|
top=opts.top;
|
|
if(opts.alignTo){
|
|
var at=$(opts.alignTo);
|
|
left=at.offset().left;
|
|
top=at.offset().top+at._outerHeight();
|
|
if(opts.align=="right"){
|
|
left+=at.outerWidth()-menu.outerWidth();
|
|
}
|
|
}
|
|
if(left+menu.outerWidth()>$(window)._outerWidth()+$(document)._scrollLeft()){
|
|
left=$(window)._outerWidth()+$(document).scrollLeft()-menu.outerWidth()-5;
|
|
}
|
|
if(left<0){
|
|
left=0;
|
|
}
|
|
top=_411(top,opts.alignTo);
|
|
}else{
|
|
var _412=_410.parent;
|
|
left=_412.offset().left+_412.outerWidth()-2;
|
|
if(left+menu.outerWidth()+5>$(window)._outerWidth()+$(document).scrollLeft()){
|
|
left=_412.offset().left-menu.outerWidth()+2;
|
|
}
|
|
top=_411(_412.offset().top-3);
|
|
}
|
|
function _411(top,_413){
|
|
if(top+menu.outerHeight()>$(window)._outerHeight()+$(document).scrollTop()){
|
|
if(_413){
|
|
top=$(_413).offset().top-menu._outerHeight();
|
|
}else{
|
|
top=$(window)._outerHeight()+$(document).scrollTop()-menu.outerHeight();
|
|
}
|
|
}
|
|
if(top<0){
|
|
top=0;
|
|
}
|
|
return top;
|
|
};
|
|
menu.css({left:left,top:top});
|
|
menu.show(0,function(){
|
|
if(!menu[0].shadow){
|
|
menu[0].shadow=$("<div class=\"menu-shadow\"></div>").insertAfter(menu);
|
|
}
|
|
menu[0].shadow.css({display:(menu.hasClass("menu-inline")?"none":"block"),zIndex:$.fn.menu.defaults.zIndex++,left:menu.css("left"),top:menu.css("top"),width:menu.outerWidth(),height:menu.outerHeight()});
|
|
menu.css("z-index",$.fn.menu.defaults.zIndex++);
|
|
if(menu.hasClass("menu-top")){
|
|
$.data(menu[0],"menu").options.onShow.call(menu[0]);
|
|
}
|
|
});
|
|
};
|
|
function _3f3(menu){
|
|
if(menu&&menu.length){
|
|
_414(menu);
|
|
menu.find("div.menu-item").each(function(){
|
|
if(this.submenu){
|
|
_3f3(this.submenu);
|
|
}
|
|
$(this).removeClass("menu-active");
|
|
});
|
|
}
|
|
function _414(m){
|
|
m.stop(true,true);
|
|
if(m[0].shadow){
|
|
m[0].shadow.hide();
|
|
}
|
|
m.hide();
|
|
};
|
|
};
|
|
function _415(_416,text){
|
|
var _417=null;
|
|
var tmp=$("<div></div>");
|
|
function find(menu){
|
|
menu.children("div.menu-item").each(function(){
|
|
var item=$(_416).menu("getItem",this);
|
|
var s=tmp.empty().html(item.text).text();
|
|
if(text==$.trim(s)){
|
|
_417=item;
|
|
}else{
|
|
if(this.submenu&&!_417){
|
|
find(this.submenu);
|
|
}
|
|
}
|
|
});
|
|
};
|
|
find($(_416));
|
|
tmp.remove();
|
|
return _417;
|
|
};
|
|
function _3fc(_418,_419,_41a){
|
|
var t=$(_419);
|
|
if(!t.hasClass("menu-item")){
|
|
return;
|
|
}
|
|
if(_41a){
|
|
t.addClass("menu-item-disabled");
|
|
if(_419.onclick){
|
|
_419.onclick1=_419.onclick;
|
|
_419.onclick=null;
|
|
}
|
|
}else{
|
|
t.removeClass("menu-item-disabled");
|
|
if(_419.onclick1){
|
|
_419.onclick=_419.onclick1;
|
|
_419.onclick1=null;
|
|
}
|
|
}
|
|
};
|
|
function _41b(_41c,_41d){
|
|
var opts=$.data(_41c,"menu").options;
|
|
var menu=$(_41c);
|
|
if(_41d.parent){
|
|
if(!_41d.parent.submenu){
|
|
var _41e=$("<div class=\"menu\"><div class=\"menu-line\"></div></div>").appendTo("body");
|
|
_41e.hide();
|
|
_41d.parent.submenu=_41e;
|
|
$("<div class=\"menu-rightarrow\"></div>").appendTo(_41d.parent);
|
|
}
|
|
menu=_41d.parent.submenu;
|
|
}
|
|
if(_41d.separator){
|
|
var item=$("<div class=\"menu-sep\"></div>").appendTo(menu);
|
|
}else{
|
|
var item=$("<div class=\"menu-item\"></div>").appendTo(menu);
|
|
$("<div class=\"menu-text\"></div>").html(_41d.text).appendTo(item);
|
|
}
|
|
if(_41d.iconCls){
|
|
$("<div class=\"menu-icon\"></div>").addClass(_41d.iconCls).appendTo(item);
|
|
}
|
|
if(_41d.id){
|
|
item.attr("id",_41d.id);
|
|
}
|
|
if(_41d.name){
|
|
item[0].itemName=_41d.name;
|
|
}
|
|
if(_41d.href){
|
|
item[0].itemHref=_41d.href;
|
|
}
|
|
if(_41d.onclick){
|
|
if(typeof _41d.onclick=="string"){
|
|
item.attr("onclick",_41d.onclick);
|
|
}else{
|
|
item[0].onclick=eval(_41d.onclick);
|
|
}
|
|
}
|
|
if(_41d.handler){
|
|
item[0].onclick=eval(_41d.handler);
|
|
}
|
|
if(_41d.disabled){
|
|
_3fc(_41c,item[0],true);
|
|
}
|
|
_3fd(_41c,item);
|
|
_3ff(_41c,menu);
|
|
_3fe(_41c,menu);
|
|
};
|
|
function _41f(_420,_421){
|
|
function _422(el){
|
|
if(el.submenu){
|
|
el.submenu.children("div.menu-item").each(function(){
|
|
_422(this);
|
|
});
|
|
var _423=el.submenu[0].shadow;
|
|
if(_423){
|
|
_423.remove();
|
|
}
|
|
el.submenu.remove();
|
|
}
|
|
$(el).remove();
|
|
};
|
|
var menu=$(_421).parent();
|
|
_422(_421);
|
|
_3fe(_420,menu);
|
|
};
|
|
function _424(_425,_426,_427){
|
|
var menu=$(_426).parent();
|
|
if(_427){
|
|
$(_426).show();
|
|
}else{
|
|
$(_426).hide();
|
|
}
|
|
_3fe(_425,menu);
|
|
};
|
|
function _428(_429){
|
|
$(_429).children("div.menu-item").each(function(){
|
|
_41f(_429,this);
|
|
});
|
|
if(_429.shadow){
|
|
_429.shadow.remove();
|
|
}
|
|
$(_429).remove();
|
|
};
|
|
$.fn.menu=function(_42a,_42b){
|
|
if(typeof _42a=="string"){
|
|
return $.fn.menu.methods[_42a](this,_42b);
|
|
}
|
|
_42a=_42a||{};
|
|
return this.each(function(){
|
|
var _42c=$.data(this,"menu");
|
|
if(_42c){
|
|
$.extend(_42c.options,_42a);
|
|
}else{
|
|
_42c=$.data(this,"menu",{options:$.extend({},$.fn.menu.defaults,$.fn.menu.parseOptions(this),_42a)});
|
|
init(this);
|
|
}
|
|
$(this).css({left:_42c.options.left,top:_42c.options.top});
|
|
});
|
|
};
|
|
$.fn.menu.methods={options:function(jq){
|
|
return $.data(jq[0],"menu").options;
|
|
},show:function(jq,pos){
|
|
return jq.each(function(){
|
|
_40e(this,pos);
|
|
});
|
|
},hide:function(jq){
|
|
return jq.each(function(){
|
|
_407(this);
|
|
});
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
_428(this);
|
|
});
|
|
},setText:function(jq,_42d){
|
|
return jq.each(function(){
|
|
$(_42d.target).children("div.menu-text").html(_42d.text);
|
|
});
|
|
},setIcon:function(jq,_42e){
|
|
return jq.each(function(){
|
|
$(_42e.target).children("div.menu-icon").remove();
|
|
if(_42e.iconCls){
|
|
$("<div class=\"menu-icon\"></div>").addClass(_42e.iconCls).appendTo(_42e.target);
|
|
}
|
|
});
|
|
},getItem:function(jq,_42f){
|
|
var t=$(_42f);
|
|
var item={target:_42f,id:t.attr("id"),text:$.trim(t.children("div.menu-text").html()),disabled:t.hasClass("menu-item-disabled"),name:_42f.itemName,href:_42f.itemHref,onclick:_42f.onclick};
|
|
var icon=t.children("div.menu-icon");
|
|
if(icon.length){
|
|
var cc=[];
|
|
var aa=icon.attr("class").split(" ");
|
|
for(var i=0;i<aa.length;i++){
|
|
if(aa[i]!="menu-icon"){
|
|
cc.push(aa[i]);
|
|
}
|
|
}
|
|
item.iconCls=cc.join(" ");
|
|
}
|
|
return item;
|
|
},findItem:function(jq,text){
|
|
return _415(jq[0],text);
|
|
},appendItem:function(jq,_430){
|
|
return jq.each(function(){
|
|
_41b(this,_430);
|
|
});
|
|
},removeItem:function(jq,_431){
|
|
return jq.each(function(){
|
|
_41f(this,_431);
|
|
});
|
|
},enableItem:function(jq,_432){
|
|
return jq.each(function(){
|
|
_3fc(this,_432,false);
|
|
});
|
|
},disableItem:function(jq,_433){
|
|
return jq.each(function(){
|
|
_3fc(this,_433,true);
|
|
});
|
|
},showItem:function(jq,_434){
|
|
return jq.each(function(){
|
|
_424(this,_434,true);
|
|
});
|
|
},hideItem:function(jq,_435){
|
|
return jq.each(function(){
|
|
_424(this,_435,false);
|
|
});
|
|
},resize:function(jq,_436){
|
|
return jq.each(function(){
|
|
_3fe(this,$(_436));
|
|
});
|
|
}};
|
|
$.fn.menu.parseOptions=function(_437){
|
|
return $.extend({},$.parser.parseOptions(_437,[{minWidth:"number",itemHeight:"number",duration:"number",hideOnUnhover:"boolean"},{fit:"boolean",inline:"boolean",noline:"boolean"}]));
|
|
};
|
|
$.fn.menu.defaults={zIndex:110000,left:0,top:0,alignTo:null,align:"left",minWidth:120,itemHeight:22,duration:100,hideOnUnhover:true,inline:false,fit:false,noline:false,onShow:function(){
|
|
},onHide:function(){
|
|
},onClick:function(item){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_438){
|
|
var opts=$.data(_438,"menubutton").options;
|
|
var btn=$(_438);
|
|
btn.linkbutton(opts);
|
|
if(opts.hasDownArrow){
|
|
btn.removeClass(opts.cls.btn1+" "+opts.cls.btn2).addClass("m-btn");
|
|
btn.removeClass("m-btn-small m-btn-medium m-btn-large").addClass("m-btn-"+opts.size);
|
|
var _439=btn.find(".l-btn-left");
|
|
$("<span></span>").addClass(opts.cls.arrow).appendTo(_439);
|
|
$("<span></span>").addClass("m-btn-line").appendTo(_439);
|
|
}
|
|
$(_438).menubutton("resize");
|
|
if(opts.menu){
|
|
$(opts.menu).menu({duration:opts.duration});
|
|
var _43a=$(opts.menu).menu("options");
|
|
var _43b=_43a.onShow;
|
|
var _43c=_43a.onHide;
|
|
$.extend(_43a,{onShow:function(){
|
|
var _43d=$(this).menu("options");
|
|
var btn=$(_43d.alignTo);
|
|
var opts=btn.menubutton("options");
|
|
btn.addClass((opts.plain==true)?opts.cls.btn2:opts.cls.btn1);
|
|
_43b.call(this);
|
|
},onHide:function(){
|
|
var _43e=$(this).menu("options");
|
|
var btn=$(_43e.alignTo);
|
|
var opts=btn.menubutton("options");
|
|
btn.removeClass((opts.plain==true)?opts.cls.btn2:opts.cls.btn1);
|
|
_43c.call(this);
|
|
}});
|
|
}
|
|
};
|
|
function _43f(_440){
|
|
var opts=$.data(_440,"menubutton").options;
|
|
var btn=$(_440);
|
|
var t=btn.find("."+opts.cls.trigger);
|
|
if(!t.length){
|
|
t=btn;
|
|
}
|
|
t.unbind(".menubutton");
|
|
var _441=null;
|
|
t.bind("click.menubutton",function(){
|
|
if(!_442()){
|
|
_443(_440);
|
|
return false;
|
|
}
|
|
}).bind("mouseenter.menubutton",function(){
|
|
if(!_442()){
|
|
_441=setTimeout(function(){
|
|
_443(_440);
|
|
},opts.duration);
|
|
return false;
|
|
}
|
|
}).bind("mouseleave.menubutton",function(){
|
|
if(_441){
|
|
clearTimeout(_441);
|
|
}
|
|
$(opts.menu).triggerHandler("mouseleave");
|
|
});
|
|
function _442(){
|
|
return $(_440).linkbutton("options").disabled;
|
|
};
|
|
};
|
|
function _443(_444){
|
|
var opts=$(_444).menubutton("options");
|
|
if(opts.disabled||!opts.menu){
|
|
return;
|
|
}
|
|
$("body>div.menu-top").menu("hide");
|
|
var btn=$(_444);
|
|
var mm=$(opts.menu);
|
|
if(mm.length){
|
|
mm.menu("options").alignTo=btn;
|
|
mm.menu("show",{alignTo:btn,align:opts.menuAlign});
|
|
}
|
|
btn.blur();
|
|
};
|
|
$.fn.menubutton=function(_445,_446){
|
|
if(typeof _445=="string"){
|
|
var _447=$.fn.menubutton.methods[_445];
|
|
if(_447){
|
|
return _447(this,_446);
|
|
}else{
|
|
return this.linkbutton(_445,_446);
|
|
}
|
|
}
|
|
_445=_445||{};
|
|
return this.each(function(){
|
|
var _448=$.data(this,"menubutton");
|
|
if(_448){
|
|
$.extend(_448.options,_445);
|
|
}else{
|
|
$.data(this,"menubutton",{options:$.extend({},$.fn.menubutton.defaults,$.fn.menubutton.parseOptions(this),_445)});
|
|
$(this).removeAttr("disabled");
|
|
}
|
|
init(this);
|
|
_43f(this);
|
|
});
|
|
};
|
|
$.fn.menubutton.methods={options:function(jq){
|
|
var _449=jq.linkbutton("options");
|
|
return $.extend($.data(jq[0],"menubutton").options,{toggle:_449.toggle,selected:_449.selected,disabled:_449.disabled});
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).menubutton("options");
|
|
if(opts.menu){
|
|
$(opts.menu).menu("destroy");
|
|
}
|
|
$(this).remove();
|
|
});
|
|
}};
|
|
$.fn.menubutton.parseOptions=function(_44a){
|
|
var t=$(_44a);
|
|
return $.extend({},$.fn.linkbutton.parseOptions(_44a),$.parser.parseOptions(_44a,["menu",{plain:"boolean",hasDownArrow:"boolean",duration:"number"}]));
|
|
};
|
|
$.fn.menubutton.defaults=$.extend({},$.fn.linkbutton.defaults,{plain:true,hasDownArrow:true,menu:null,menuAlign:"left",duration:100,cls:{btn1:"m-btn-active",btn2:"m-btn-plain-active",arrow:"m-btn-downarrow",trigger:"m-btn"}});
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_44b){
|
|
var opts=$.data(_44b,"splitbutton").options;
|
|
$(_44b).menubutton(opts);
|
|
$(_44b).addClass("s-btn");
|
|
};
|
|
$.fn.splitbutton=function(_44c,_44d){
|
|
if(typeof _44c=="string"){
|
|
var _44e=$.fn.splitbutton.methods[_44c];
|
|
if(_44e){
|
|
return _44e(this,_44d);
|
|
}else{
|
|
return this.menubutton(_44c,_44d);
|
|
}
|
|
}
|
|
_44c=_44c||{};
|
|
return this.each(function(){
|
|
var _44f=$.data(this,"splitbutton");
|
|
if(_44f){
|
|
$.extend(_44f.options,_44c);
|
|
}else{
|
|
$.data(this,"splitbutton",{options:$.extend({},$.fn.splitbutton.defaults,$.fn.splitbutton.parseOptions(this),_44c)});
|
|
$(this).removeAttr("disabled");
|
|
}
|
|
init(this);
|
|
});
|
|
};
|
|
$.fn.splitbutton.methods={options:function(jq){
|
|
var _450=jq.menubutton("options");
|
|
var _451=$.data(jq[0],"splitbutton").options;
|
|
$.extend(_451,{disabled:_450.disabled,toggle:_450.toggle,selected:_450.selected});
|
|
return _451;
|
|
}};
|
|
$.fn.splitbutton.parseOptions=function(_452){
|
|
var t=$(_452);
|
|
return $.extend({},$.fn.linkbutton.parseOptions(_452),$.parser.parseOptions(_452,["menu",{plain:"boolean",duration:"number"}]));
|
|
};
|
|
$.fn.splitbutton.defaults=$.extend({},$.fn.linkbutton.defaults,{plain:true,menu:null,duration:100,cls:{btn1:"m-btn-active s-btn-active",btn2:"m-btn-plain-active s-btn-plain-active",arrow:"m-btn-downarrow",trigger:"m-btn-line"}});
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_453){
|
|
var _454=$("<span class=\"switchbutton\">"+"<span class=\"switchbutton-inner\">"+"<span class=\"switchbutton-on\"></span>"+"<span class=\"switchbutton-handle\"></span>"+"<span class=\"switchbutton-off\"></span>"+"<input class=\"switchbutton-value\" type=\"checkbox\">"+"</span>"+"</span>").insertAfter(_453);
|
|
var t=$(_453);
|
|
t.addClass("switchbutton-f").hide();
|
|
var name=t.attr("name");
|
|
if(name){
|
|
t.removeAttr("name").attr("switchbuttonName",name);
|
|
_454.find(".switchbutton-value").attr("name",name);
|
|
}
|
|
_454.bind("_resize",function(e,_455){
|
|
if($(this).hasClass("easyui-fluid")||_455){
|
|
_456(_453);
|
|
}
|
|
return false;
|
|
});
|
|
return _454;
|
|
};
|
|
function _456(_457,_458){
|
|
var _459=$.data(_457,"switchbutton");
|
|
var opts=_459.options;
|
|
var _45a=_459.switchbutton;
|
|
if(_458){
|
|
$.extend(opts,_458);
|
|
}
|
|
var _45b=_45a.is(":visible");
|
|
if(!_45b){
|
|
_45a.appendTo("body");
|
|
}
|
|
_45a._size(opts);
|
|
var w=_45a.width();
|
|
var h=_45a.height();
|
|
var w=_45a.outerWidth();
|
|
var h=_45a.outerHeight();
|
|
var _45c=parseInt(opts.handleWidth)||_45a.height();
|
|
var _45d=w*2-_45c;
|
|
_45a.find(".switchbutton-inner").css({width:_45d+"px",height:h+"px",lineHeight:h+"px"});
|
|
_45a.find(".switchbutton-handle")._outerWidth(_45c)._outerHeight(h).css({marginLeft:-_45c/2+"px"});
|
|
_45a.find(".switchbutton-on").css({width:(w-_45c/2)+"px",textIndent:(opts.reversed?"":"-")+_45c/2+"px"});
|
|
_45a.find(".switchbutton-off").css({width:(w-_45c/2)+"px",textIndent:(opts.reversed?"-":"")+_45c/2+"px"});
|
|
opts.marginWidth=w-_45c;
|
|
_45e(_457,opts.checked,false);
|
|
if(!_45b){
|
|
_45a.insertAfter(_457);
|
|
}
|
|
};
|
|
function _45f(_460){
|
|
var _461=$.data(_460,"switchbutton");
|
|
var opts=_461.options;
|
|
var _462=_461.switchbutton;
|
|
var _463=_462.find(".switchbutton-inner");
|
|
var on=_463.find(".switchbutton-on").html(opts.onText);
|
|
var off=_463.find(".switchbutton-off").html(opts.offText);
|
|
var _464=_463.find(".switchbutton-handle").html(opts.handleText);
|
|
if(opts.reversed){
|
|
off.prependTo(_463);
|
|
on.insertAfter(_464);
|
|
}else{
|
|
on.prependTo(_463);
|
|
off.insertAfter(_464);
|
|
}
|
|
_462.find(".switchbutton-value")._propAttr("checked",opts.checked);
|
|
_462.removeClass("switchbutton-disabled").addClass(opts.disabled?"switchbutton-disabled":"");
|
|
_462.removeClass("switchbutton-reversed").addClass(opts.reversed?"switchbutton-reversed":"");
|
|
_45e(_460,opts.checked);
|
|
_465(_460,opts.readonly);
|
|
$(_460).switchbutton("setValue",opts.value);
|
|
};
|
|
function _45e(_466,_467,_468){
|
|
var _469=$.data(_466,"switchbutton");
|
|
var opts=_469.options;
|
|
opts.checked=_467;
|
|
var _46a=_469.switchbutton.find(".switchbutton-inner");
|
|
var _46b=_46a.find(".switchbutton-on");
|
|
var _46c=opts.reversed?(opts.checked?opts.marginWidth:0):(opts.checked?0:opts.marginWidth);
|
|
var dir=_46b.css("float").toLowerCase();
|
|
var css={};
|
|
css["margin-"+dir]=-_46c+"px";
|
|
_468?_46a.animate(css,200):_46a.css(css);
|
|
var _46d=_46a.find(".switchbutton-value");
|
|
var ck=_46d.is(":checked");
|
|
$(_466).add(_46d)._propAttr("checked",opts.checked);
|
|
if(ck!=opts.checked){
|
|
opts.onChange.call(_466,opts.checked);
|
|
}
|
|
};
|
|
function _46e(_46f,_470){
|
|
var _471=$.data(_46f,"switchbutton");
|
|
var opts=_471.options;
|
|
var _472=_471.switchbutton;
|
|
var _473=_472.find(".switchbutton-value");
|
|
if(_470){
|
|
opts.disabled=true;
|
|
$(_46f).add(_473).attr("disabled","disabled");
|
|
_472.addClass("switchbutton-disabled");
|
|
}else{
|
|
opts.disabled=false;
|
|
$(_46f).add(_473).removeAttr("disabled");
|
|
_472.removeClass("switchbutton-disabled");
|
|
}
|
|
};
|
|
function _465(_474,mode){
|
|
var _475=$.data(_474,"switchbutton");
|
|
var opts=_475.options;
|
|
opts.readonly=mode==undefined?true:mode;
|
|
_475.switchbutton.removeClass("switchbutton-readonly").addClass(opts.readonly?"switchbutton-readonly":"");
|
|
};
|
|
function _476(_477){
|
|
var _478=$.data(_477,"switchbutton");
|
|
var opts=_478.options;
|
|
_478.switchbutton.unbind(".switchbutton").bind("click.switchbutton",function(){
|
|
if(!opts.disabled&&!opts.readonly){
|
|
_45e(_477,opts.checked?false:true,true);
|
|
}
|
|
});
|
|
};
|
|
$.fn.switchbutton=function(_479,_47a){
|
|
if(typeof _479=="string"){
|
|
return $.fn.switchbutton.methods[_479](this,_47a);
|
|
}
|
|
_479=_479||{};
|
|
return this.each(function(){
|
|
var _47b=$.data(this,"switchbutton");
|
|
if(_47b){
|
|
$.extend(_47b.options,_479);
|
|
}else{
|
|
_47b=$.data(this,"switchbutton",{options:$.extend({},$.fn.switchbutton.defaults,$.fn.switchbutton.parseOptions(this),_479),switchbutton:init(this)});
|
|
}
|
|
_47b.options.originalChecked=_47b.options.checked;
|
|
_45f(this);
|
|
_456(this);
|
|
_476(this);
|
|
});
|
|
};
|
|
$.fn.switchbutton.methods={options:function(jq){
|
|
var _47c=jq.data("switchbutton");
|
|
return $.extend(_47c.options,{value:_47c.switchbutton.find(".switchbutton-value").val()});
|
|
},resize:function(jq,_47d){
|
|
return jq.each(function(){
|
|
_456(this,_47d);
|
|
});
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
_46e(this,false);
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
_46e(this,true);
|
|
});
|
|
},readonly:function(jq,mode){
|
|
return jq.each(function(){
|
|
_465(this,mode);
|
|
});
|
|
},check:function(jq){
|
|
return jq.each(function(){
|
|
_45e(this,true);
|
|
});
|
|
},uncheck:function(jq){
|
|
return jq.each(function(){
|
|
_45e(this,false);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
_45e(this,false);
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).switchbutton("options");
|
|
_45e(this,opts.originalChecked);
|
|
});
|
|
},setValue:function(jq,_47e){
|
|
return jq.each(function(){
|
|
$(this).val(_47e);
|
|
$.data(this,"switchbutton").switchbutton.find(".switchbutton-value").val(_47e);
|
|
});
|
|
}};
|
|
$.fn.switchbutton.parseOptions=function(_47f){
|
|
var t=$(_47f);
|
|
return $.extend({},$.parser.parseOptions(_47f,["onText","offText","handleText",{handleWidth:"number",reversed:"boolean"}]),{value:(t.val()||undefined),checked:(t.attr("checked")?true:undefined),disabled:(t.attr("disabled")?true:undefined),readonly:(t.attr("readonly")?true:undefined)});
|
|
};
|
|
$.fn.switchbutton.defaults={handleWidth:"auto",width:60,height:26,checked:false,disabled:false,readonly:false,reversed:false,onText:"ON",offText:"OFF",handleText:"",value:"on",onChange:function(_480){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_481){
|
|
$(_481).addClass("validatebox-text");
|
|
};
|
|
function _482(_483){
|
|
var _484=$.data(_483,"validatebox");
|
|
_484.validating=false;
|
|
if(_484.timer){
|
|
clearTimeout(_484.timer);
|
|
}
|
|
$(_483).tooltip("destroy");
|
|
$(_483).unbind();
|
|
$(_483).remove();
|
|
};
|
|
function _485(_486){
|
|
var opts=$.data(_486,"validatebox").options;
|
|
var box=$(_486);
|
|
box.unbind(".validatebox");
|
|
if(opts.novalidate||box.is(":disabled")){
|
|
return;
|
|
}
|
|
for(var _487 in opts.events){
|
|
$(_486).bind(_487+".validatebox",{target:_486},opts.events[_487]);
|
|
}
|
|
};
|
|
function _488(e){
|
|
var _489=e.data.target;
|
|
var _48a=$.data(_489,"validatebox");
|
|
var box=$(_489);
|
|
if($(_489).attr("readonly")){
|
|
return;
|
|
}
|
|
_48a.validating=true;
|
|
_48a.value=undefined;
|
|
(function(){
|
|
if(_48a.validating){
|
|
if(_48a.value!=box.val()){
|
|
_48a.value=box.val();
|
|
if(_48a.timer){
|
|
clearTimeout(_48a.timer);
|
|
}
|
|
_48a.timer=setTimeout(function(){
|
|
$(_489).validatebox("validate");
|
|
},_48a.options.delay);
|
|
}else{
|
|
_48b(_489);
|
|
}
|
|
setTimeout(arguments.callee,200);
|
|
}
|
|
})();
|
|
};
|
|
function _48c(e){
|
|
var _48d=e.data.target;
|
|
var _48e=$.data(_48d,"validatebox");
|
|
if(_48e.timer){
|
|
clearTimeout(_48e.timer);
|
|
_48e.timer=undefined;
|
|
}
|
|
_48e.validating=false;
|
|
_48f(_48d);
|
|
};
|
|
function _490(e){
|
|
var _491=e.data.target;
|
|
if($(_491).hasClass("validatebox-invalid")){
|
|
_492(_491);
|
|
}
|
|
};
|
|
function _493(e){
|
|
var _494=e.data.target;
|
|
var _495=$.data(_494,"validatebox");
|
|
if(!_495.validating){
|
|
_48f(_494);
|
|
}
|
|
};
|
|
function _492(_496){
|
|
var _497=$.data(_496,"validatebox");
|
|
var opts=_497.options;
|
|
$(_496).tooltip($.extend({},opts.tipOptions,{content:_497.message,position:opts.tipPosition,deltaX:opts.deltaX})).tooltip("show");
|
|
_497.tip=true;
|
|
};
|
|
function _48b(_498){
|
|
var _499=$.data(_498,"validatebox");
|
|
if(_499&&_499.tip){
|
|
$(_498).tooltip("reposition");
|
|
}
|
|
};
|
|
function _48f(_49a){
|
|
var _49b=$.data(_49a,"validatebox");
|
|
_49b.tip=false;
|
|
$(_49a).tooltip("hide");
|
|
};
|
|
function _49c(_49d){
|
|
var _49e=$.data(_49d,"validatebox");
|
|
var opts=_49e.options;
|
|
var box=$(_49d);
|
|
opts.onBeforeValidate.call(_49d);
|
|
var _49f=_4a0();
|
|
opts.onValidate.call(_49d,_49f);
|
|
return _49f;
|
|
function _4a1(msg){
|
|
_49e.message=msg;
|
|
};
|
|
function _4a2(_4a3,_4a4){
|
|
var _4a5=box.val();
|
|
var _4a6=/([a-zA-Z_]+)(.*)/.exec(_4a3);
|
|
var rule=opts.rules[_4a6[1]];
|
|
if(rule&&_4a5){
|
|
var _4a7=_4a4||opts.validParams||eval(_4a6[2]);
|
|
if(!rule["validator"].call(_49d,_4a5,_4a7)){
|
|
box.addClass("validatebox-invalid");
|
|
var _4a8=rule["message"];
|
|
if(_4a7){
|
|
for(var i=0;i<_4a7.length;i++){
|
|
_4a8=_4a8.replace(new RegExp("\\{"+i+"\\}","g"),_4a7[i]);
|
|
}
|
|
}
|
|
_4a1(opts.invalidMessage||_4a8);
|
|
if(_49e.validating){
|
|
_492(_49d);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
function _4a0(){
|
|
box.removeClass("validatebox-invalid");
|
|
_48f(_49d);
|
|
if(opts.novalidate||box.is(":disabled")){
|
|
return true;
|
|
}
|
|
if(opts.required){
|
|
if(box.val()==""){
|
|
box.addClass("validatebox-invalid");
|
|
_4a1(opts.missingMessage);
|
|
if(_49e.validating){
|
|
_492(_49d);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
if(opts.validType){
|
|
if($.isArray(opts.validType)){
|
|
for(var i=0;i<opts.validType.length;i++){
|
|
if(!_4a2(opts.validType[i])){
|
|
return false;
|
|
}
|
|
}
|
|
}else{
|
|
if(typeof opts.validType=="string"){
|
|
if(!_4a2(opts.validType)){
|
|
return false;
|
|
}
|
|
}else{
|
|
for(var _4a9 in opts.validType){
|
|
var _4aa=opts.validType[_4a9];
|
|
if(!_4a2(_4a9,_4aa)){
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
};
|
|
function _4ab(_4ac,_4ad){
|
|
var opts=$.data(_4ac,"validatebox").options;
|
|
if(_4ad!=undefined){
|
|
opts.novalidate=_4ad;
|
|
}
|
|
if(opts.novalidate){
|
|
$(_4ac).removeClass("validatebox-invalid");
|
|
_48f(_4ac);
|
|
}
|
|
_49c(_4ac);
|
|
_485(_4ac);
|
|
};
|
|
$.fn.validatebox=function(_4ae,_4af){
|
|
if(typeof _4ae=="string"){
|
|
return $.fn.validatebox.methods[_4ae](this,_4af);
|
|
}
|
|
_4ae=_4ae||{};
|
|
return this.each(function(){
|
|
var _4b0=$.data(this,"validatebox");
|
|
if(_4b0){
|
|
$.extend(_4b0.options,_4ae);
|
|
}else{
|
|
init(this);
|
|
$.data(this,"validatebox",{options:$.extend({},$.fn.validatebox.defaults,$.fn.validatebox.parseOptions(this),_4ae)});
|
|
}
|
|
_4ab(this);
|
|
_49c(this);
|
|
});
|
|
};
|
|
$.fn.validatebox.methods={options:function(jq){
|
|
return $.data(jq[0],"validatebox").options;
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
_482(this);
|
|
});
|
|
},validate:function(jq){
|
|
return jq.each(function(){
|
|
_49c(this);
|
|
});
|
|
},isValid:function(jq){
|
|
return _49c(jq[0]);
|
|
},enableValidation:function(jq){
|
|
return jq.each(function(){
|
|
_4ab(this,false);
|
|
});
|
|
},disableValidation:function(jq){
|
|
return jq.each(function(){
|
|
_4ab(this,true);
|
|
});
|
|
}};
|
|
$.fn.validatebox.parseOptions=function(_4b1){
|
|
var t=$(_4b1);
|
|
return $.extend({},$.parser.parseOptions(_4b1,["validType","missingMessage","invalidMessage","tipPosition",{delay:"number",deltaX:"number"}]),{required:(t.attr("required")?true:undefined),novalidate:(t.attr("novalidate")!=undefined?true:undefined)});
|
|
};
|
|
$.fn.validatebox.defaults={required:false,validType:null,validParams:null,delay:200,missingMessage:"This field is required.",invalidMessage:null,tipPosition:"right",deltaX:0,novalidate:false,events:{focus:_488,blur:_48c,mouseenter:_490,mouseleave:_493,click:function(e){
|
|
var t=$(e.data.target);
|
|
if(!t.is(":focus")){
|
|
t.trigger("focus");
|
|
}
|
|
}},tipOptions:{showEvent:"none",hideEvent:"none",showDelay:0,hideDelay:0,zIndex:"",onShow:function(){
|
|
$(this).tooltip("tip").css({color:"#000",borderColor:"#CC9933",backgroundColor:"#FFFFCC"});
|
|
},onHide:function(){
|
|
$(this).tooltip("destroy");
|
|
}},rules:{email:{validator:function(_4b2){
|
|
return /^((([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.test(_4b2);
|
|
},message:"Please enter a valid email address."},url:{validator:function(_4b3){
|
|
return /^(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(_4b3);
|
|
},message:"Please enter a valid URL."},length:{validator:function(_4b4,_4b5){
|
|
var len=$.trim(_4b4).length;
|
|
return len>=_4b5[0]&&len<=_4b5[1];
|
|
},message:"Please enter a value between {0} and {1}."},remote:{validator:function(_4b6,_4b7){
|
|
var data={};
|
|
data[_4b7[1]]=_4b6;
|
|
var _4b8=$.ajax({url:_4b7[0],dataType:"json",data:data,async:false,cache:false,type:"post"}).responseText;
|
|
return _4b8=="true";
|
|
},message:"Please fix this field."}},onBeforeValidate:function(){
|
|
},onValidate:function(_4b9){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_4ba){
|
|
$(_4ba).addClass("textbox-f").hide();
|
|
var span=$("<span class=\"textbox\">"+"<input class=\"textbox-text\" autocomplete=\"off\">"+"<input type=\"hidden\" class=\"textbox-value\">"+"</span>").insertAfter(_4ba);
|
|
var name=$(_4ba).attr("name");
|
|
if(name){
|
|
span.find("input.textbox-value").attr("name",name);
|
|
$(_4ba).removeAttr("name").attr("textboxName",name);
|
|
}
|
|
return span;
|
|
};
|
|
function _4bb(_4bc){
|
|
var _4bd=$.data(_4bc,"textbox");
|
|
var opts=_4bd.options;
|
|
var tb=_4bd.textbox;
|
|
tb.find(".textbox-text").remove();
|
|
if(opts.multiline){
|
|
$("<textarea class=\"textbox-text\" autocomplete=\"off\"></textarea>").prependTo(tb);
|
|
}else{
|
|
$("<input type=\""+opts.type+"\" class=\"textbox-text\" autocomplete=\"off\">").prependTo(tb);
|
|
}
|
|
tb.find(".textbox-addon").remove();
|
|
var bb=opts.icons?$.extend(true,[],opts.icons):[];
|
|
if(opts.iconCls){
|
|
bb.push({iconCls:opts.iconCls,disabled:true});
|
|
}
|
|
if(bb.length){
|
|
var bc=$("<span class=\"textbox-addon\"></span>").prependTo(tb);
|
|
bc.addClass("textbox-addon-"+opts.iconAlign);
|
|
for(var i=0;i<bb.length;i++){
|
|
bc.append("<a href=\"javascript:void(0)\" class=\"textbox-icon "+bb[i].iconCls+"\" icon-index=\""+i+"\" tabindex=\"-1\"></a>");
|
|
}
|
|
}
|
|
tb.find(".textbox-button").remove();
|
|
if(opts.buttonText||opts.buttonIcon){
|
|
var btn=$("<a href=\"javascript:void(0)\" class=\"textbox-button\"></a>").prependTo(tb);
|
|
btn.addClass("textbox-button-"+opts.buttonAlign).linkbutton({text:opts.buttonText,iconCls:opts.buttonIcon});
|
|
}
|
|
_4be(_4bc,opts.disabled);
|
|
_4bf(_4bc,opts.readonly);
|
|
};
|
|
function _4c0(_4c1){
|
|
var tb=$.data(_4c1,"textbox").textbox;
|
|
tb.find(".textbox-text").validatebox("destroy");
|
|
tb.remove();
|
|
$(_4c1).remove();
|
|
};
|
|
function _4c2(_4c3,_4c4){
|
|
var _4c5=$.data(_4c3,"textbox");
|
|
var opts=_4c5.options;
|
|
var tb=_4c5.textbox;
|
|
var _4c6=tb.parent();
|
|
if(_4c4){
|
|
opts.width=_4c4;
|
|
}
|
|
if(isNaN(parseInt(opts.width))){
|
|
var c=$(_4c3).clone();
|
|
c.css("visibility","hidden");
|
|
c.insertAfter(_4c3);
|
|
opts.width=c.outerWidth();
|
|
c.remove();
|
|
}
|
|
var _4c7=tb.is(":visible");
|
|
if(!_4c7){
|
|
tb.appendTo("body");
|
|
}
|
|
var _4c8=tb.find(".textbox-text");
|
|
var btn=tb.find(".textbox-button");
|
|
var _4c9=tb.find(".textbox-addon");
|
|
var _4ca=_4c9.find(".textbox-icon");
|
|
tb._size(opts,_4c6);
|
|
btn.linkbutton("resize",{height:tb.height()});
|
|
btn.css({left:(opts.buttonAlign=="left"?0:""),right:(opts.buttonAlign=="right"?0:"")});
|
|
_4c9.css({left:(opts.iconAlign=="left"?(opts.buttonAlign=="left"?btn._outerWidth():0):""),right:(opts.iconAlign=="right"?(opts.buttonAlign=="right"?btn._outerWidth():0):"")});
|
|
_4ca.css({width:opts.iconWidth+"px",height:tb.height()+"px"});
|
|
_4c8.css({paddingLeft:(_4c3.style.paddingLeft||""),paddingRight:(_4c3.style.paddingRight||""),marginLeft:_4cb("left"),marginRight:_4cb("right")});
|
|
if(opts.multiline){
|
|
_4c8.css({paddingTop:(_4c3.style.paddingTop||""),paddingBottom:(_4c3.style.paddingBottom||"")});
|
|
_4c8._outerHeight(tb.height());
|
|
}else{
|
|
var _4cc=Math.floor((tb.height()-_4c8.height())/2);
|
|
_4c8.css({paddingTop:_4cc+"px",paddingBottom:_4cc+"px"});
|
|
}
|
|
_4c8._outerWidth(tb.width()-_4ca.length*opts.iconWidth-btn._outerWidth());
|
|
if(!_4c7){
|
|
tb.insertAfter(_4c3);
|
|
}
|
|
opts.onResize.call(_4c3,opts.width,opts.height);
|
|
function _4cb(_4cd){
|
|
return (opts.iconAlign==_4cd?_4c9._outerWidth():0)+(opts.buttonAlign==_4cd?btn._outerWidth():0);
|
|
};
|
|
};
|
|
function _4ce(_4cf){
|
|
var opts=$(_4cf).textbox("options");
|
|
var _4d0=$(_4cf).textbox("textbox");
|
|
_4d0.validatebox($.extend({},opts,{deltaX:$(_4cf).textbox("getTipX"),onBeforeValidate:function(){
|
|
var box=$(this);
|
|
if(!box.is(":focus")){
|
|
opts.oldInputValue=box.val();
|
|
box.val(opts.value);
|
|
}
|
|
},onValidate:function(_4d1){
|
|
var box=$(this);
|
|
if(opts.oldInputValue!=undefined){
|
|
box.val(opts.oldInputValue);
|
|
opts.oldInputValue=undefined;
|
|
}
|
|
var tb=box.parent();
|
|
if(_4d1){
|
|
tb.removeClass("textbox-invalid");
|
|
}else{
|
|
tb.addClass("textbox-invalid");
|
|
}
|
|
}}));
|
|
};
|
|
function _4d2(_4d3){
|
|
var _4d4=$.data(_4d3,"textbox");
|
|
var opts=_4d4.options;
|
|
var tb=_4d4.textbox;
|
|
var _4d5=tb.find(".textbox-text");
|
|
_4d5.attr("placeholder",opts.prompt);
|
|
_4d5.unbind(".textbox");
|
|
if(!opts.disabled&&!opts.readonly){
|
|
_4d5.bind("blur.textbox",function(e){
|
|
if(!tb.hasClass("textbox-focused")){
|
|
return;
|
|
}
|
|
opts.value=$(this).val();
|
|
if(opts.value==""){
|
|
$(this).val(opts.prompt).addClass("textbox-prompt");
|
|
}else{
|
|
$(this).removeClass("textbox-prompt");
|
|
}
|
|
tb.removeClass("textbox-focused");
|
|
}).bind("focus.textbox",function(e){
|
|
if(tb.hasClass("textbox-focused")){
|
|
return;
|
|
}
|
|
if($(this).val()!=opts.value){
|
|
$(this).val(opts.value);
|
|
}
|
|
$(this).removeClass("textbox-prompt");
|
|
tb.addClass("textbox-focused");
|
|
});
|
|
for(var _4d6 in opts.inputEvents){
|
|
_4d5.bind(_4d6+".textbox",{target:_4d3},opts.inputEvents[_4d6]);
|
|
}
|
|
}
|
|
var _4d7=tb.find(".textbox-addon");
|
|
_4d7.unbind().bind("click",{target:_4d3},function(e){
|
|
var icon=$(e.target).closest("a.textbox-icon:not(.textbox-icon-disabled)");
|
|
if(icon.length){
|
|
var _4d8=parseInt(icon.attr("icon-index"));
|
|
var conf=opts.icons[_4d8];
|
|
if(conf&&conf.handler){
|
|
conf.handler.call(icon[0],e);
|
|
opts.onClickIcon.call(_4d3,_4d8);
|
|
}
|
|
}
|
|
});
|
|
_4d7.find(".textbox-icon").each(function(_4d9){
|
|
var conf=opts.icons[_4d9];
|
|
var icon=$(this);
|
|
if(!conf||conf.disabled||opts.disabled||opts.readonly){
|
|
icon.addClass("textbox-icon-disabled");
|
|
}else{
|
|
icon.removeClass("textbox-icon-disabled");
|
|
}
|
|
});
|
|
var btn=tb.find(".textbox-button");
|
|
btn.unbind(".textbox").bind("click.textbox",function(){
|
|
if(!btn.linkbutton("options").disabled){
|
|
opts.onClickButton.call(_4d3);
|
|
}
|
|
});
|
|
btn.linkbutton((opts.disabled||opts.readonly)?"disable":"enable");
|
|
tb.unbind(".textbox").bind("_resize.textbox",function(e,_4da){
|
|
if($(this).hasClass("easyui-fluid")||_4da){
|
|
_4c2(_4d3);
|
|
}
|
|
return false;
|
|
});
|
|
};
|
|
function _4be(_4db,_4dc){
|
|
var _4dd=$.data(_4db,"textbox");
|
|
var opts=_4dd.options;
|
|
var tb=_4dd.textbox;
|
|
if(_4dc){
|
|
opts.disabled=true;
|
|
$(_4db).attr("disabled","disabled");
|
|
tb.addClass("textbox-disabled");
|
|
tb.find(".textbox-text,.textbox-value").attr("disabled","disabled");
|
|
}else{
|
|
opts.disabled=false;
|
|
tb.removeClass("textbox-disabled");
|
|
$(_4db).removeAttr("disabled");
|
|
tb.find(".textbox-text,.textbox-value").removeAttr("disabled");
|
|
}
|
|
};
|
|
function _4bf(_4de,mode){
|
|
var _4df=$.data(_4de,"textbox");
|
|
var opts=_4df.options;
|
|
opts.readonly=mode==undefined?true:mode;
|
|
_4df.textbox.removeClass("textbox-readonly").addClass(opts.readonly?"textbox-readonly":"");
|
|
var _4e0=_4df.textbox.find(".textbox-text");
|
|
_4e0.removeAttr("readonly");
|
|
if(opts.readonly||!opts.editable){
|
|
_4e0.attr("readonly","readonly");
|
|
}
|
|
};
|
|
$.fn.textbox=function(_4e1,_4e2){
|
|
if(typeof _4e1=="string"){
|
|
var _4e3=$.fn.textbox.methods[_4e1];
|
|
if(_4e3){
|
|
return _4e3(this,_4e2);
|
|
}else{
|
|
return this.each(function(){
|
|
var _4e4=$(this).textbox("textbox");
|
|
_4e4.validatebox(_4e1,_4e2);
|
|
});
|
|
}
|
|
}
|
|
_4e1=_4e1||{};
|
|
return this.each(function(){
|
|
var _4e5=$.data(this,"textbox");
|
|
if(_4e5){
|
|
$.extend(_4e5.options,_4e1);
|
|
if(_4e1.value!=undefined){
|
|
_4e5.options.originalValue=_4e1.value;
|
|
}
|
|
}else{
|
|
_4e5=$.data(this,"textbox",{options:$.extend({},$.fn.textbox.defaults,$.fn.textbox.parseOptions(this),_4e1),textbox:init(this)});
|
|
_4e5.options.originalValue=_4e5.options.value;
|
|
}
|
|
_4bb(this);
|
|
_4d2(this);
|
|
_4c2(this);
|
|
_4ce(this);
|
|
$(this).textbox("initValue",_4e5.options.value);
|
|
});
|
|
};
|
|
$.fn.textbox.methods={options:function(jq){
|
|
return $.data(jq[0],"textbox").options;
|
|
},cloneFrom:function(jq,from){
|
|
return jq.each(function(){
|
|
var t=$(this);
|
|
if(t.data("textbox")){
|
|
return;
|
|
}
|
|
if(!$(from).data("textbox")){
|
|
$(from).textbox();
|
|
}
|
|
var name=t.attr("name")||"";
|
|
t.addClass("textbox-f").hide();
|
|
t.removeAttr("name").attr("textboxName",name);
|
|
var span=$(from).next().clone().insertAfter(t);
|
|
span.find("input.textbox-value").attr("name",name);
|
|
$.data(this,"textbox",{options:$.extend(true,{},$(from).textbox("options")),textbox:span});
|
|
var _4e6=$(from).textbox("button");
|
|
if(_4e6.length){
|
|
t.textbox("button").linkbutton($.extend(true,{},_4e6.linkbutton("options")));
|
|
}
|
|
_4d2(this);
|
|
_4ce(this);
|
|
});
|
|
},textbox:function(jq){
|
|
return $.data(jq[0],"textbox").textbox.find(".textbox-text");
|
|
},button:function(jq){
|
|
return $.data(jq[0],"textbox").textbox.find(".textbox-button");
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
_4c0(this);
|
|
});
|
|
},resize:function(jq,_4e7){
|
|
return jq.each(function(){
|
|
_4c2(this,_4e7);
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
_4be(this,true);
|
|
_4d2(this);
|
|
});
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
_4be(this,false);
|
|
_4d2(this);
|
|
});
|
|
},readonly:function(jq,mode){
|
|
return jq.each(function(){
|
|
_4bf(this,mode);
|
|
_4d2(this);
|
|
});
|
|
},isValid:function(jq){
|
|
return jq.textbox("textbox").validatebox("isValid");
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
$(this).textbox("setValue","");
|
|
});
|
|
},setText:function(jq,_4e8){
|
|
return jq.each(function(){
|
|
var opts=$(this).textbox("options");
|
|
var _4e9=$(this).textbox("textbox");
|
|
_4e8=_4e8==undefined?"":String(_4e8);
|
|
if($(this).textbox("getText")!=_4e8){
|
|
_4e9.val(_4e8);
|
|
}
|
|
opts.value=_4e8;
|
|
if(!_4e9.is(":focus")){
|
|
if(_4e8){
|
|
_4e9.removeClass("textbox-prompt");
|
|
}else{
|
|
_4e9.val(opts.prompt).addClass("textbox-prompt");
|
|
}
|
|
}
|
|
$(this).textbox("validate");
|
|
});
|
|
},initValue:function(jq,_4ea){
|
|
return jq.each(function(){
|
|
var _4eb=$.data(this,"textbox");
|
|
_4eb.options.value="";
|
|
$(this).textbox("setText",_4ea);
|
|
_4eb.textbox.find(".textbox-value").val(_4ea);
|
|
$(this).val(_4ea);
|
|
});
|
|
},setValue:function(jq,_4ec){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"textbox").options;
|
|
var _4ed=$(this).textbox("getValue");
|
|
$(this).textbox("initValue",_4ec);
|
|
if(_4ed!=_4ec){
|
|
opts.onChange.call(this,_4ec,_4ed);
|
|
$(this).closest("form").trigger("_change",[this]);
|
|
}
|
|
});
|
|
},getText:function(jq){
|
|
var _4ee=jq.textbox("textbox");
|
|
if(_4ee.is(":focus")){
|
|
return _4ee.val();
|
|
}else{
|
|
return jq.textbox("options").value;
|
|
}
|
|
},getValue:function(jq){
|
|
return jq.data("textbox").textbox.find(".textbox-value").val();
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).textbox("options");
|
|
$(this).textbox("setValue",opts.originalValue);
|
|
});
|
|
},getIcon:function(jq,_4ef){
|
|
return jq.data("textbox").textbox.find(".textbox-icon:eq("+_4ef+")");
|
|
},getTipX:function(jq){
|
|
var _4f0=jq.data("textbox");
|
|
var opts=_4f0.options;
|
|
var tb=_4f0.textbox;
|
|
var _4f1=tb.find(".textbox-text");
|
|
var _4f2=tb.find(".textbox-addon")._outerWidth();
|
|
var _4f3=tb.find(".textbox-button")._outerWidth();
|
|
if(opts.tipPosition=="right"){
|
|
return (opts.iconAlign=="right"?_4f2:0)+(opts.buttonAlign=="right"?_4f3:0)+1;
|
|
}else{
|
|
if(opts.tipPosition=="left"){
|
|
return (opts.iconAlign=="left"?-_4f2:0)+(opts.buttonAlign=="left"?-_4f3:0)-1;
|
|
}else{
|
|
return _4f2/2*(opts.iconAlign=="right"?1:-1);
|
|
}
|
|
}
|
|
}};
|
|
$.fn.textbox.parseOptions=function(_4f4){
|
|
var t=$(_4f4);
|
|
return $.extend({},$.fn.validatebox.parseOptions(_4f4),$.parser.parseOptions(_4f4,["prompt","iconCls","iconAlign","buttonText","buttonIcon","buttonAlign",{multiline:"boolean",editable:"boolean",iconWidth:"number"}]),{value:(t.val()||undefined),type:(t.attr("type")?t.attr("type"):undefined),disabled:(t.attr("disabled")?true:undefined),readonly:(t.attr("readonly")?true:undefined)});
|
|
};
|
|
$.fn.textbox.defaults=$.extend({},$.fn.validatebox.defaults,{width:"auto",height:22,prompt:"",value:"",type:"text",multiline:false,editable:true,disabled:false,readonly:false,icons:[],iconCls:null,iconAlign:"right",iconWidth:18,buttonText:"",buttonIcon:null,buttonAlign:"right",inputEvents:{blur:function(e){
|
|
var t=$(e.data.target);
|
|
var opts=t.textbox("options");
|
|
t.textbox("setValue",opts.value);
|
|
},keydown:function(e){
|
|
if(e.keyCode==13){
|
|
var t=$(e.data.target);
|
|
t.textbox("setValue",t.textbox("getText"));
|
|
}
|
|
}},onChange:function(_4f5,_4f6){
|
|
},onResize:function(_4f7,_4f8){
|
|
},onClickButton:function(){
|
|
},onClickIcon:function(_4f9){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
var _4fa=0;
|
|
function _4fb(_4fc){
|
|
var _4fd=$.data(_4fc,"filebox");
|
|
var opts=_4fd.options;
|
|
opts.fileboxId="filebox_file_id_"+(++_4fa);
|
|
$(_4fc).addClass("filebox-f").textbox(opts);
|
|
$(_4fc).textbox("textbox").attr("readonly","readonly");
|
|
_4fd.filebox=$(_4fc).next().addClass("filebox");
|
|
var file=_4fe(_4fc);
|
|
var btn=$(_4fc).filebox("button");
|
|
if(btn.length){
|
|
$("<label class=\"filebox-label\" for=\""+opts.fileboxId+"\"></label>").appendTo(btn);
|
|
if(btn.linkbutton("options").disabled){
|
|
file.attr("disabled","disabled");
|
|
}else{
|
|
file.removeAttr("disabled");
|
|
}
|
|
}
|
|
};
|
|
function _4fe(_4ff){
|
|
var _500=$.data(_4ff,"filebox");
|
|
var opts=_500.options;
|
|
_500.filebox.find(".textbox-value").remove();
|
|
opts.oldValue="";
|
|
var file=$("<input type=\"file\" class=\"textbox-value\">").appendTo(_500.filebox);
|
|
file.attr("id",opts.fileboxId).attr("name",$(_4ff).attr("textboxName")||"");
|
|
file.change(function(){
|
|
$(_4ff).filebox("setText",this.value);
|
|
opts.onChange.call(_4ff,this.value,opts.oldValue);
|
|
opts.oldValue=this.value;
|
|
});
|
|
return file;
|
|
};
|
|
$.fn.filebox=function(_501,_502){
|
|
if(typeof _501=="string"){
|
|
var _503=$.fn.filebox.methods[_501];
|
|
if(_503){
|
|
return _503(this,_502);
|
|
}else{
|
|
return this.textbox(_501,_502);
|
|
}
|
|
}
|
|
_501=_501||{};
|
|
return this.each(function(){
|
|
var _504=$.data(this,"filebox");
|
|
if(_504){
|
|
$.extend(_504.options,_501);
|
|
}else{
|
|
$.data(this,"filebox",{options:$.extend({},$.fn.filebox.defaults,$.fn.filebox.parseOptions(this),_501)});
|
|
}
|
|
_4fb(this);
|
|
});
|
|
};
|
|
$.fn.filebox.methods={options:function(jq){
|
|
var opts=jq.textbox("options");
|
|
return $.extend($.data(jq[0],"filebox").options,{width:opts.width,value:opts.value,originalValue:opts.originalValue,disabled:opts.disabled,readonly:opts.readonly});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
$(this).textbox("clear");
|
|
_4fe(this);
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
$(this).filebox("clear");
|
|
});
|
|
}};
|
|
$.fn.filebox.parseOptions=function(_505){
|
|
return $.extend({},$.fn.textbox.parseOptions(_505),{});
|
|
};
|
|
$.fn.filebox.defaults=$.extend({},$.fn.textbox.defaults,{buttonIcon:null,buttonText:"Choose File",buttonAlign:"right",inputEvents:{}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _506(_507){
|
|
var _508=$.data(_507,"searchbox");
|
|
var opts=_508.options;
|
|
var _509=$.extend(true,[],opts.icons);
|
|
_509.push({iconCls:"searchbox-button",handler:function(e){
|
|
var t=$(e.data.target);
|
|
var opts=t.searchbox("options");
|
|
opts.searcher.call(e.data.target,t.searchbox("getValue"),t.searchbox("getName"));
|
|
}});
|
|
_50a();
|
|
var _50b=_50c();
|
|
$(_507).addClass("searchbox-f").textbox($.extend({},opts,{icons:_509,buttonText:(_50b?_50b.text:"")}));
|
|
$(_507).attr("searchboxName",$(_507).attr("textboxName"));
|
|
_508.searchbox=$(_507).next();
|
|
_508.searchbox.addClass("searchbox");
|
|
_50d(_50b);
|
|
function _50a(){
|
|
if(opts.menu){
|
|
_508.menu=$(opts.menu).menu();
|
|
var _50e=_508.menu.menu("options");
|
|
var _50f=_50e.onClick;
|
|
_50e.onClick=function(item){
|
|
_50d(item);
|
|
_50f.call(this,item);
|
|
};
|
|
}else{
|
|
if(_508.menu){
|
|
_508.menu.menu("destroy");
|
|
}
|
|
_508.menu=null;
|
|
}
|
|
};
|
|
function _50c(){
|
|
if(_508.menu){
|
|
var item=_508.menu.children("div.menu-item:first");
|
|
_508.menu.children("div.menu-item").each(function(){
|
|
var _510=$.extend({},$.parser.parseOptions(this),{selected:($(this).attr("selected")?true:undefined)});
|
|
if(_510.selected){
|
|
item=$(this);
|
|
return false;
|
|
}
|
|
});
|
|
return _508.menu.menu("getItem",item[0]);
|
|
}else{
|
|
return null;
|
|
}
|
|
};
|
|
function _50d(item){
|
|
if(!item){
|
|
return;
|
|
}
|
|
$(_507).textbox("button").menubutton({text:item.text,iconCls:(item.iconCls||null),menu:_508.menu,menuAlign:opts.buttonAlign,plain:false});
|
|
_508.searchbox.find("input.textbox-value").attr("name",item.name||item.text);
|
|
$(_507).searchbox("resize");
|
|
};
|
|
};
|
|
$.fn.searchbox=function(_511,_512){
|
|
if(typeof _511=="string"){
|
|
var _513=$.fn.searchbox.methods[_511];
|
|
if(_513){
|
|
return _513(this,_512);
|
|
}else{
|
|
return this.textbox(_511,_512);
|
|
}
|
|
}
|
|
_511=_511||{};
|
|
return this.each(function(){
|
|
var _514=$.data(this,"searchbox");
|
|
if(_514){
|
|
$.extend(_514.options,_511);
|
|
}else{
|
|
$.data(this,"searchbox",{options:$.extend({},$.fn.searchbox.defaults,$.fn.searchbox.parseOptions(this),_511)});
|
|
}
|
|
_506(this);
|
|
});
|
|
};
|
|
$.fn.searchbox.methods={options:function(jq){
|
|
var opts=jq.textbox("options");
|
|
return $.extend($.data(jq[0],"searchbox").options,{width:opts.width,value:opts.value,originalValue:opts.originalValue,disabled:opts.disabled,readonly:opts.readonly});
|
|
},menu:function(jq){
|
|
return $.data(jq[0],"searchbox").menu;
|
|
},getName:function(jq){
|
|
return $.data(jq[0],"searchbox").searchbox.find("input.textbox-value").attr("name");
|
|
},selectName:function(jq,name){
|
|
return jq.each(function(){
|
|
var menu=$.data(this,"searchbox").menu;
|
|
if(menu){
|
|
menu.children("div.menu-item").each(function(){
|
|
var item=menu.menu("getItem",this);
|
|
if(item.name==name){
|
|
$(this).triggerHandler("click");
|
|
return false;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
var menu=$(this).searchbox("menu");
|
|
if(menu){
|
|
menu.menu("destroy");
|
|
}
|
|
$(this).textbox("destroy");
|
|
});
|
|
}};
|
|
$.fn.searchbox.parseOptions=function(_515){
|
|
var t=$(_515);
|
|
return $.extend({},$.fn.textbox.parseOptions(_515),$.parser.parseOptions(_515,["menu"]),{searcher:(t.attr("searcher")?eval(t.attr("searcher")):undefined)});
|
|
};
|
|
$.fn.searchbox.defaults=$.extend({},$.fn.textbox.defaults,{inputEvents:$.extend({},$.fn.textbox.defaults.inputEvents,{keydown:function(e){
|
|
if(e.keyCode==13){
|
|
e.preventDefault();
|
|
var t=$(e.data.target);
|
|
var opts=t.searchbox("options");
|
|
t.searchbox("setValue",$(this).val());
|
|
opts.searcher.call(e.data.target,t.searchbox("getValue"),t.searchbox("getName"));
|
|
return false;
|
|
}
|
|
}}),buttonAlign:"left",menu:null,searcher:function(_516,name){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _517(_518,_519){
|
|
var opts=$.data(_518,"form").options;
|
|
$.extend(opts,_519||{});
|
|
var _51a=$.extend({},opts.queryParams);
|
|
if(opts.onSubmit.call(_518,_51a)==false){
|
|
return;
|
|
}
|
|
$(_518).find(".textbox-text:focus").blur();
|
|
var _51b="easyui_frame_"+(new Date().getTime());
|
|
var _51c=$("<iframe id="+_51b+" name="+_51b+"></iframe>").appendTo("body");
|
|
_51c.attr("src",window.ActiveXObject?"javascript:false":"about:blank");
|
|
_51c.css({position:"absolute",top:-1000,left:-1000});
|
|
_51c.bind("load",cb);
|
|
_51d(_51a);
|
|
function _51d(_51e){
|
|
var form=$(_518);
|
|
if(opts.url){
|
|
form.attr("action",opts.url);
|
|
}
|
|
var t=form.attr("target"),a=form.attr("action");
|
|
form.attr("target",_51b);
|
|
var _51f=$();
|
|
try{
|
|
for(var n in _51e){
|
|
var _520=$("<input type=\"hidden\" name=\""+n+"\">").val(_51e[n]).appendTo(form);
|
|
_51f=_51f.add(_520);
|
|
}
|
|
_521();
|
|
form[0].submit();
|
|
}
|
|
finally{
|
|
form.attr("action",a);
|
|
t?form.attr("target",t):form.removeAttr("target");
|
|
_51f.remove();
|
|
}
|
|
};
|
|
function _521(){
|
|
var f=$("#"+_51b);
|
|
if(!f.length){
|
|
return;
|
|
}
|
|
try{
|
|
var s=f.contents()[0].readyState;
|
|
if(s&&s.toLowerCase()=="uninitialized"){
|
|
setTimeout(_521,100);
|
|
}
|
|
}
|
|
catch(e){
|
|
cb();
|
|
}
|
|
};
|
|
var _522=10;
|
|
function cb(){
|
|
var f=$("#"+_51b);
|
|
if(!f.length){
|
|
return;
|
|
}
|
|
f.unbind();
|
|
var data="";
|
|
try{
|
|
var body=f.contents().find("body");
|
|
data=body.html();
|
|
if(data==""){
|
|
if(--_522){
|
|
setTimeout(cb,100);
|
|
return;
|
|
}
|
|
}
|
|
var ta=body.find(">textarea");
|
|
if(ta.length){
|
|
data=ta.val();
|
|
}else{
|
|
var pre=body.find(">pre");
|
|
if(pre.length){
|
|
data=pre.html();
|
|
}
|
|
}
|
|
}
|
|
catch(e){
|
|
}
|
|
opts.success(data);
|
|
setTimeout(function(){
|
|
f.unbind();
|
|
f.remove();
|
|
},100);
|
|
};
|
|
};
|
|
function load(_523,data){
|
|
var opts=$.data(_523,"form").options;
|
|
if(typeof data=="string"){
|
|
var _524={};
|
|
if(opts.onBeforeLoad.call(_523,_524)==false){
|
|
return;
|
|
}
|
|
$.ajax({url:data,data:_524,dataType:"json",success:function(data){
|
|
_525(data);
|
|
},error:function(){
|
|
opts.onLoadError.apply(_523,arguments);
|
|
}});
|
|
}else{
|
|
_525(data);
|
|
}
|
|
function _525(data){
|
|
var form=$(_523);
|
|
for(var name in data){
|
|
var val=data[name];
|
|
if(!_526(name,val)){
|
|
if(!_527(name,val)){
|
|
form.find("input[name=\""+name+"\"]").val(val);
|
|
form.find("textarea[name=\""+name+"\"]").val(val);
|
|
form.find("select[name=\""+name+"\"]").val(val);
|
|
}
|
|
}
|
|
}
|
|
opts.onLoadSuccess.call(_523,data);
|
|
form.form("validate");
|
|
};
|
|
function _526(name,val){
|
|
var cc=$(_523).find("[switchbuttonName=\""+name+"\"]");
|
|
if(cc.length){
|
|
cc.switchbutton("uncheck");
|
|
cc.each(function(){
|
|
if(_528($(this).switchbutton("options").value,val)){
|
|
$(this).switchbutton("check");
|
|
}
|
|
});
|
|
return true;
|
|
}
|
|
cc=$(_523).find("input[name=\""+name+"\"][type=radio], input[name=\""+name+"\"][type=checkbox]");
|
|
if(cc.length){
|
|
cc._propAttr("checked",false);
|
|
cc.each(function(){
|
|
if(_528($(this).val(),val)){
|
|
$(this)._propAttr("checked",true);
|
|
}
|
|
});
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
function _528(v,val){
|
|
if(v==String(val)||$.inArray(v,$.isArray(val)?val:[val])>=0){
|
|
return true;
|
|
}else{
|
|
return false;
|
|
}
|
|
};
|
|
function _527(name,val){
|
|
var _529=$(_523).find("[textboxName=\""+name+"\"],[sliderName=\""+name+"\"]");
|
|
if(_529.length){
|
|
for(var i=0;i<opts.fieldTypes.length;i++){
|
|
var type=opts.fieldTypes[i];
|
|
var _52a=_529.data(type);
|
|
if(_52a){
|
|
if(_52a.options.multiple||_52a.options.range){
|
|
_529[type]("setValues",val);
|
|
}else{
|
|
_529[type]("setValue",val);
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
};
|
|
function _52b(_52c){
|
|
$("input,select,textarea",_52c).each(function(){
|
|
var t=this.type,tag=this.tagName.toLowerCase();
|
|
if(t=="text"||t=="hidden"||t=="password"||tag=="textarea"){
|
|
this.value="";
|
|
}else{
|
|
if(t=="file"){
|
|
var file=$(this);
|
|
if(!file.hasClass("textbox-value")){
|
|
var _52d=file.clone().val("");
|
|
_52d.insertAfter(file);
|
|
if(file.data("validatebox")){
|
|
file.validatebox("destroy");
|
|
_52d.validatebox();
|
|
}else{
|
|
file.remove();
|
|
}
|
|
}
|
|
}else{
|
|
if(t=="checkbox"||t=="radio"){
|
|
this.checked=false;
|
|
}else{
|
|
if(tag=="select"){
|
|
this.selectedIndex=-1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
var form=$(_52c);
|
|
var opts=$.data(_52c,"form").options;
|
|
for(var i=opts.fieldTypes.length-1;i>=0;i--){
|
|
var type=opts.fieldTypes[i];
|
|
var _52e=form.find("."+type+"-f");
|
|
if(_52e.length&&_52e[type]){
|
|
_52e[type]("clear");
|
|
}
|
|
}
|
|
form.form("validate");
|
|
};
|
|
function _52f(_530){
|
|
_530.reset();
|
|
var form=$(_530);
|
|
var opts=$.data(_530,"form").options;
|
|
for(var i=opts.fieldTypes.length-1;i>=0;i--){
|
|
var type=opts.fieldTypes[i];
|
|
var _531=form.find("."+type+"-f");
|
|
if(_531.length&&_531[type]){
|
|
_531[type]("reset");
|
|
}
|
|
}
|
|
form.form("validate");
|
|
};
|
|
function _532(_533){
|
|
var _534=$.data(_533,"form").options;
|
|
$(_533).unbind(".form");
|
|
if(_534.ajax){
|
|
$(_533).bind("submit.form",function(){
|
|
setTimeout(function(){
|
|
_517(_533,_534);
|
|
},0);
|
|
return false;
|
|
});
|
|
}
|
|
$(_533).bind("_change.form",function(e,t){
|
|
_534.onChange.call(this,t);
|
|
}).bind("change.form",function(e){
|
|
var t=e.target;
|
|
if(!$(t).hasClass("textbox-text")){
|
|
_534.onChange.call(this,t);
|
|
}
|
|
});
|
|
_535(_533,_534.novalidate);
|
|
};
|
|
function _536(_537,_538){
|
|
_538=_538||{};
|
|
var _539=$.data(_537,"form");
|
|
if(_539){
|
|
$.extend(_539.options,_538);
|
|
}else{
|
|
$.data(_537,"form",{options:$.extend({},$.fn.form.defaults,$.fn.form.parseOptions(_537),_538)});
|
|
}
|
|
};
|
|
function _53a(_53b){
|
|
if($.fn.validatebox){
|
|
var t=$(_53b);
|
|
t.find(".validatebox-text:not(:disabled)").validatebox("validate");
|
|
var _53c=t.find(".validatebox-invalid");
|
|
_53c.filter(":not(:disabled):first").focus();
|
|
return _53c.length==0;
|
|
}
|
|
return true;
|
|
};
|
|
function _535(_53d,_53e){
|
|
var opts=$.data(_53d,"form").options;
|
|
opts.novalidate=_53e;
|
|
$(_53d).find(".validatebox-text:not(:disabled)").validatebox(_53e?"disableValidation":"enableValidation");
|
|
};
|
|
$.fn.form=function(_53f,_540){
|
|
if(typeof _53f=="string"){
|
|
this.each(function(){
|
|
_536(this);
|
|
});
|
|
return $.fn.form.methods[_53f](this,_540);
|
|
}
|
|
return this.each(function(){
|
|
_536(this,_53f);
|
|
_532(this);
|
|
});
|
|
};
|
|
$.fn.form.methods={options:function(jq){
|
|
return $.data(jq[0],"form").options;
|
|
},submit:function(jq,_541){
|
|
return jq.each(function(){
|
|
_517(this,_541);
|
|
});
|
|
},load:function(jq,data){
|
|
return jq.each(function(){
|
|
load(this,data);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
_52b(this);
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
_52f(this);
|
|
});
|
|
},validate:function(jq){
|
|
return _53a(jq[0]);
|
|
},disableValidation:function(jq){
|
|
return jq.each(function(){
|
|
_535(this,true);
|
|
});
|
|
},enableValidation:function(jq){
|
|
return jq.each(function(){
|
|
_535(this,false);
|
|
});
|
|
}};
|
|
$.fn.form.parseOptions=function(_542){
|
|
var t=$(_542);
|
|
return $.extend({},$.parser.parseOptions(_542,[{ajax:"boolean"}]),{url:(t.attr("action")?t.attr("action"):undefined)});
|
|
};
|
|
$.fn.form.defaults={fieldTypes:["combobox","combotree","combogrid","datetimebox","datebox","combo","datetimespinner","timespinner","numberspinner","spinner","slider","searchbox","numberbox","textbox","switchbutton"],novalidate:false,ajax:true,url:null,queryParams:{},onSubmit:function(_543){
|
|
return $(this).form("validate");
|
|
},success:function(data){
|
|
},onBeforeLoad:function(_544){
|
|
},onLoadSuccess:function(data){
|
|
},onLoadError:function(){
|
|
},onChange:function(_545){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _546(_547){
|
|
var _548=$.data(_547,"numberbox");
|
|
var opts=_548.options;
|
|
$(_547).addClass("numberbox-f").textbox(opts);
|
|
$(_547).textbox("textbox").css({imeMode:"disabled"});
|
|
$(_547).attr("numberboxName",$(_547).attr("textboxName"));
|
|
_548.numberbox=$(_547).next();
|
|
_548.numberbox.addClass("numberbox");
|
|
var _549=opts.parser.call(_547,opts.value);
|
|
var _54a=opts.formatter.call(_547,_549);
|
|
$(_547).numberbox("initValue",_549).numberbox("setText",_54a);
|
|
};
|
|
function _54b(_54c,_54d){
|
|
var _54e=$.data(_54c,"numberbox");
|
|
var opts=_54e.options;
|
|
var _54d=opts.parser.call(_54c,_54d);
|
|
var text=opts.formatter.call(_54c,_54d);
|
|
opts.value=_54d;
|
|
$(_54c).textbox("setText",text).textbox("setValue",_54d);
|
|
text=opts.formatter.call(_54c,$(_54c).textbox("getValue"));
|
|
$(_54c).textbox("setText",text);
|
|
};
|
|
$.fn.numberbox=function(_54f,_550){
|
|
if(typeof _54f=="string"){
|
|
var _551=$.fn.numberbox.methods[_54f];
|
|
if(_551){
|
|
return _551(this,_550);
|
|
}else{
|
|
return this.textbox(_54f,_550);
|
|
}
|
|
}
|
|
_54f=_54f||{};
|
|
return this.each(function(){
|
|
var _552=$.data(this,"numberbox");
|
|
if(_552){
|
|
$.extend(_552.options,_54f);
|
|
}else{
|
|
_552=$.data(this,"numberbox",{options:$.extend({},$.fn.numberbox.defaults,$.fn.numberbox.parseOptions(this),_54f)});
|
|
}
|
|
_546(this);
|
|
});
|
|
};
|
|
$.fn.numberbox.methods={options:function(jq){
|
|
var opts=jq.data("textbox")?jq.textbox("options"):{};
|
|
return $.extend($.data(jq[0],"numberbox").options,{width:opts.width,originalValue:opts.originalValue,disabled:opts.disabled,readonly:opts.readonly});
|
|
},fix:function(jq){
|
|
return jq.each(function(){
|
|
$(this).numberbox("setValue",$(this).numberbox("getText"));
|
|
});
|
|
},setValue:function(jq,_553){
|
|
return jq.each(function(){
|
|
_54b(this,_553);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
$(this).textbox("clear");
|
|
$(this).numberbox("options").value="";
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
$(this).textbox("reset");
|
|
$(this).numberbox("setValue",$(this).numberbox("getValue"));
|
|
});
|
|
}};
|
|
$.fn.numberbox.parseOptions=function(_554){
|
|
var t=$(_554);
|
|
return $.extend({},$.fn.textbox.parseOptions(_554),$.parser.parseOptions(_554,["decimalSeparator","groupSeparator","suffix",{min:"number",max:"number",precision:"number"}]),{prefix:(t.attr("prefix")?t.attr("prefix"):undefined)});
|
|
};
|
|
$.fn.numberbox.defaults=$.extend({},$.fn.textbox.defaults,{inputEvents:{keypress:function(e){
|
|
var _555=e.data.target;
|
|
var opts=$(_555).numberbox("options");
|
|
return opts.filter.call(_555,e);
|
|
},blur:function(e){
|
|
var _556=e.data.target;
|
|
$(_556).numberbox("setValue",$(_556).numberbox("getText"));
|
|
},keydown:function(e){
|
|
if(e.keyCode==13){
|
|
var _557=e.data.target;
|
|
$(_557).numberbox("setValue",$(_557).numberbox("getText"));
|
|
}
|
|
}},min:null,max:null,precision:0,decimalSeparator:".",groupSeparator:"",prefix:"",suffix:"",filter:function(e){
|
|
var opts=$(this).numberbox("options");
|
|
var s=$(this).numberbox("getText");
|
|
if(e.which==13){
|
|
return true;
|
|
}
|
|
if(e.which==45){
|
|
return (s.indexOf("-")==-1?true:false);
|
|
}
|
|
var c=String.fromCharCode(e.which);
|
|
if(c==opts.decimalSeparator){
|
|
return (s.indexOf(c)==-1?true:false);
|
|
}else{
|
|
if(c==opts.groupSeparator){
|
|
return true;
|
|
}else{
|
|
if((e.which>=48&&e.which<=57&&e.ctrlKey==false&&e.shiftKey==false)||e.which==0||e.which==8){
|
|
return true;
|
|
}else{
|
|
if(e.ctrlKey==true&&(e.which==99||e.which==118)){
|
|
return true;
|
|
}else{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},formatter:function(_558){
|
|
if(!_558){
|
|
return _558;
|
|
}
|
|
_558=_558+"";
|
|
var opts=$(this).numberbox("options");
|
|
var s1=_558,s2="";
|
|
var dpos=_558.indexOf(".");
|
|
if(dpos>=0){
|
|
s1=_558.substring(0,dpos);
|
|
s2=_558.substring(dpos+1,_558.length);
|
|
}
|
|
if(opts.groupSeparator){
|
|
var p=/(\d+)(\d{3})/;
|
|
while(p.test(s1)){
|
|
s1=s1.replace(p,"$1"+opts.groupSeparator+"$2");
|
|
}
|
|
}
|
|
if(s2){
|
|
return opts.prefix+s1+opts.decimalSeparator+s2+opts.suffix;
|
|
}else{
|
|
return opts.prefix+s1+opts.suffix;
|
|
}
|
|
},parser:function(s){
|
|
s=s+"";
|
|
var opts=$(this).numberbox("options");
|
|
if(parseFloat(s)!=s){
|
|
if(opts.prefix){
|
|
s=$.trim(s.replace(new RegExp("\\"+$.trim(opts.prefix),"g"),""));
|
|
}
|
|
if(opts.suffix){
|
|
s=$.trim(s.replace(new RegExp("\\"+$.trim(opts.suffix),"g"),""));
|
|
}
|
|
if(opts.groupSeparator){
|
|
s=$.trim(s.replace(new RegExp("\\"+opts.groupSeparator,"g"),""));
|
|
}
|
|
if(opts.decimalSeparator){
|
|
s=$.trim(s.replace(new RegExp("\\"+opts.decimalSeparator,"g"),"."));
|
|
}
|
|
s=s.replace(/\s/g,"");
|
|
}
|
|
var val=parseFloat(s).toFixed(opts.precision);
|
|
if(isNaN(val)){
|
|
val="";
|
|
}else{
|
|
if(typeof (opts.min)=="number"&&val<opts.min){
|
|
val=opts.min.toFixed(opts.precision);
|
|
}else{
|
|
if(typeof (opts.max)=="number"&&val>opts.max){
|
|
val=opts.max.toFixed(opts.precision);
|
|
}
|
|
}
|
|
}
|
|
return val;
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _559(_55a,_55b){
|
|
var opts=$.data(_55a,"calendar").options;
|
|
var t=$(_55a);
|
|
if(_55b){
|
|
$.extend(opts,{width:_55b.width,height:_55b.height});
|
|
}
|
|
t._size(opts,t.parent());
|
|
t.find(".calendar-body")._outerHeight(t.height()-t.find(".calendar-header")._outerHeight());
|
|
if(t.find(".calendar-menu").is(":visible")){
|
|
_55c(_55a);
|
|
}
|
|
};
|
|
function init(_55d){
|
|
$(_55d).addClass("calendar").html("<div class=\"calendar-header\">"+"<div class=\"calendar-nav calendar-prevmonth\"></div>"+"<div class=\"calendar-nav calendar-nextmonth\"></div>"+"<div class=\"calendar-nav calendar-prevyear\"></div>"+"<div class=\"calendar-nav calendar-nextyear\"></div>"+"<div class=\"calendar-title\">"+"<span class=\"calendar-text\"></span>"+"</div>"+"</div>"+"<div class=\"calendar-body\">"+"<div class=\"calendar-menu\">"+"<div class=\"calendar-menu-year-inner\">"+"<span class=\"calendar-nav calendar-menu-prev\"></span>"+"<span><input class=\"calendar-menu-year\" type=\"text\"></input></span>"+"<span class=\"calendar-nav calendar-menu-next\"></span>"+"</div>"+"<div class=\"calendar-menu-month-inner\">"+"</div>"+"</div>"+"</div>");
|
|
$(_55d).bind("_resize",function(e,_55e){
|
|
if($(this).hasClass("easyui-fluid")||_55e){
|
|
_559(_55d);
|
|
}
|
|
return false;
|
|
});
|
|
};
|
|
function _55f(_560){
|
|
var opts=$.data(_560,"calendar").options;
|
|
var menu=$(_560).find(".calendar-menu");
|
|
menu.find(".calendar-menu-year").unbind(".calendar").bind("keypress.calendar",function(e){
|
|
if(e.keyCode==13){
|
|
_561(true);
|
|
}
|
|
});
|
|
$(_560).unbind(".calendar").bind("mouseover.calendar",function(e){
|
|
var t=_562(e.target);
|
|
if(t.hasClass("calendar-nav")||t.hasClass("calendar-text")||(t.hasClass("calendar-day")&&!t.hasClass("calendar-disabled"))){
|
|
t.addClass("calendar-nav-hover");
|
|
}
|
|
}).bind("mouseout.calendar",function(e){
|
|
var t=_562(e.target);
|
|
if(t.hasClass("calendar-nav")||t.hasClass("calendar-text")||(t.hasClass("calendar-day")&&!t.hasClass("calendar-disabled"))){
|
|
t.removeClass("calendar-nav-hover");
|
|
}
|
|
}).bind("click.calendar",function(e){
|
|
var t=_562(e.target);
|
|
if(t.hasClass("calendar-menu-next")||t.hasClass("calendar-nextyear")){
|
|
_563(1);
|
|
}else{
|
|
if(t.hasClass("calendar-menu-prev")||t.hasClass("calendar-prevyear")){
|
|
_563(-1);
|
|
}else{
|
|
if(t.hasClass("calendar-menu-month")){
|
|
menu.find(".calendar-selected").removeClass("calendar-selected");
|
|
t.addClass("calendar-selected");
|
|
_561(true);
|
|
}else{
|
|
if(t.hasClass("calendar-prevmonth")){
|
|
_564(-1);
|
|
}else{
|
|
if(t.hasClass("calendar-nextmonth")){
|
|
_564(1);
|
|
}else{
|
|
if(t.hasClass("calendar-text")){
|
|
if(menu.is(":visible")){
|
|
menu.hide();
|
|
}else{
|
|
_55c(_560);
|
|
}
|
|
}else{
|
|
if(t.hasClass("calendar-day")){
|
|
if(t.hasClass("calendar-disabled")){
|
|
return;
|
|
}
|
|
var _565=opts.current;
|
|
t.closest("div.calendar-body").find(".calendar-selected").removeClass("calendar-selected");
|
|
t.addClass("calendar-selected");
|
|
var _566=t.attr("abbr").split(",");
|
|
var y=parseInt(_566[0]);
|
|
var m=parseInt(_566[1]);
|
|
var d=parseInt(_566[2]);
|
|
opts.current=new Date(y,m-1,d);
|
|
opts.onSelect.call(_560,opts.current);
|
|
if(!_565||_565.getTime()!=opts.current.getTime()){
|
|
opts.onChange.call(_560,opts.current,_565);
|
|
}
|
|
if(opts.year!=y||opts.month!=m){
|
|
opts.year=y;
|
|
opts.month=m;
|
|
show(_560);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
function _562(t){
|
|
var day=$(t).closest(".calendar-day");
|
|
if(day.length){
|
|
return day;
|
|
}else{
|
|
return $(t);
|
|
}
|
|
};
|
|
function _561(_567){
|
|
var menu=$(_560).find(".calendar-menu");
|
|
var year=menu.find(".calendar-menu-year").val();
|
|
var _568=menu.find(".calendar-selected").attr("abbr");
|
|
if(!isNaN(year)){
|
|
opts.year=parseInt(year);
|
|
opts.month=parseInt(_568);
|
|
show(_560);
|
|
}
|
|
if(_567){
|
|
menu.hide();
|
|
}
|
|
};
|
|
function _563(_569){
|
|
opts.year+=_569;
|
|
show(_560);
|
|
menu.find(".calendar-menu-year").val(opts.year);
|
|
};
|
|
function _564(_56a){
|
|
opts.month+=_56a;
|
|
if(opts.month>12){
|
|
opts.year++;
|
|
opts.month=1;
|
|
}else{
|
|
if(opts.month<1){
|
|
opts.year--;
|
|
opts.month=12;
|
|
}
|
|
}
|
|
show(_560);
|
|
menu.find("td.calendar-selected").removeClass("calendar-selected");
|
|
menu.find("td:eq("+(opts.month-1)+")").addClass("calendar-selected");
|
|
};
|
|
};
|
|
function _55c(_56b){
|
|
var opts=$.data(_56b,"calendar").options;
|
|
$(_56b).find(".calendar-menu").show();
|
|
if($(_56b).find(".calendar-menu-month-inner").is(":empty")){
|
|
$(_56b).find(".calendar-menu-month-inner").empty();
|
|
var t=$("<table class=\"calendar-mtable\"></table>").appendTo($(_56b).find(".calendar-menu-month-inner"));
|
|
var idx=0;
|
|
for(var i=0;i<3;i++){
|
|
var tr=$("<tr></tr>").appendTo(t);
|
|
for(var j=0;j<4;j++){
|
|
$("<td class=\"calendar-nav calendar-menu-month\"></td>").html(opts.months[idx++]).attr("abbr",idx).appendTo(tr);
|
|
}
|
|
}
|
|
}
|
|
var body=$(_56b).find(".calendar-body");
|
|
var sele=$(_56b).find(".calendar-menu");
|
|
var _56c=sele.find(".calendar-menu-year-inner");
|
|
var _56d=sele.find(".calendar-menu-month-inner");
|
|
_56c.find("input").val(opts.year).focus();
|
|
_56d.find("td.calendar-selected").removeClass("calendar-selected");
|
|
_56d.find("td:eq("+(opts.month-1)+")").addClass("calendar-selected");
|
|
sele._outerWidth(body._outerWidth());
|
|
sele._outerHeight(body._outerHeight());
|
|
_56d._outerHeight(sele.height()-_56c._outerHeight());
|
|
};
|
|
function _56e(_56f,year,_570){
|
|
var opts=$.data(_56f,"calendar").options;
|
|
var _571=[];
|
|
var _572=new Date(year,_570,0).getDate();
|
|
for(var i=1;i<=_572;i++){
|
|
_571.push([year,_570,i]);
|
|
}
|
|
var _573=[],week=[];
|
|
var _574=-1;
|
|
while(_571.length>0){
|
|
var date=_571.shift();
|
|
week.push(date);
|
|
var day=new Date(date[0],date[1]-1,date[2]).getDay();
|
|
if(_574==day){
|
|
day=0;
|
|
}else{
|
|
if(day==(opts.firstDay==0?7:opts.firstDay)-1){
|
|
_573.push(week);
|
|
week=[];
|
|
}
|
|
}
|
|
_574=day;
|
|
}
|
|
if(week.length){
|
|
_573.push(week);
|
|
}
|
|
var _575=_573[0];
|
|
if(_575.length<7){
|
|
while(_575.length<7){
|
|
var _576=_575[0];
|
|
var date=new Date(_576[0],_576[1]-1,_576[2]-1);
|
|
_575.unshift([date.getFullYear(),date.getMonth()+1,date.getDate()]);
|
|
}
|
|
}else{
|
|
var _576=_575[0];
|
|
var week=[];
|
|
for(var i=1;i<=7;i++){
|
|
var date=new Date(_576[0],_576[1]-1,_576[2]-i);
|
|
week.unshift([date.getFullYear(),date.getMonth()+1,date.getDate()]);
|
|
}
|
|
_573.unshift(week);
|
|
}
|
|
var _577=_573[_573.length-1];
|
|
while(_577.length<7){
|
|
var _578=_577[_577.length-1];
|
|
var date=new Date(_578[0],_578[1]-1,_578[2]+1);
|
|
_577.push([date.getFullYear(),date.getMonth()+1,date.getDate()]);
|
|
}
|
|
if(_573.length<6){
|
|
var _578=_577[_577.length-1];
|
|
var week=[];
|
|
for(var i=1;i<=7;i++){
|
|
var date=new Date(_578[0],_578[1]-1,_578[2]+i);
|
|
week.push([date.getFullYear(),date.getMonth()+1,date.getDate()]);
|
|
}
|
|
_573.push(week);
|
|
}
|
|
return _573;
|
|
};
|
|
function show(_579){
|
|
var opts=$.data(_579,"calendar").options;
|
|
if(opts.current&&!opts.validator.call(_579,opts.current)){
|
|
opts.current=null;
|
|
}
|
|
var now=new Date();
|
|
var _57a=now.getFullYear()+","+(now.getMonth()+1)+","+now.getDate();
|
|
var _57b=opts.current?(opts.current.getFullYear()+","+(opts.current.getMonth()+1)+","+opts.current.getDate()):"";
|
|
var _57c=6-opts.firstDay;
|
|
var _57d=_57c+1;
|
|
if(_57c>=7){
|
|
_57c-=7;
|
|
}
|
|
if(_57d>=7){
|
|
_57d-=7;
|
|
}
|
|
$(_579).find(".calendar-title span").html(opts.months[opts.month-1]+" "+opts.year);
|
|
var body=$(_579).find("div.calendar-body");
|
|
body.children("table").remove();
|
|
var data=["<table class=\"calendar-dtable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"];
|
|
data.push("<thead><tr>");
|
|
for(var i=opts.firstDay;i<opts.weeks.length;i++){
|
|
data.push("<th>"+opts.weeks[i]+"</th>");
|
|
}
|
|
for(var i=0;i<opts.firstDay;i++){
|
|
data.push("<th>"+opts.weeks[i]+"</th>");
|
|
}
|
|
data.push("</tr></thead>");
|
|
data.push("<tbody>");
|
|
var _57e=_56e(_579,opts.year,opts.month);
|
|
for(var i=0;i<_57e.length;i++){
|
|
var week=_57e[i];
|
|
var cls="";
|
|
if(i==0){
|
|
cls="calendar-first";
|
|
}else{
|
|
if(i==_57e.length-1){
|
|
cls="calendar-last";
|
|
}
|
|
}
|
|
data.push("<tr class=\""+cls+"\">");
|
|
for(var j=0;j<week.length;j++){
|
|
var day=week[j];
|
|
var s=day[0]+","+day[1]+","+day[2];
|
|
var _57f=new Date(day[0],parseInt(day[1])-1,day[2]);
|
|
var d=opts.formatter.call(_579,_57f);
|
|
var css=opts.styler.call(_579,_57f);
|
|
var _580="";
|
|
var _581="";
|
|
if(typeof css=="string"){
|
|
_581=css;
|
|
}else{
|
|
if(css){
|
|
_580=css["class"]||"";
|
|
_581=css["style"]||"";
|
|
}
|
|
}
|
|
var cls="calendar-day";
|
|
if(!(opts.year==day[0]&&opts.month==day[1])){
|
|
cls+=" calendar-other-month";
|
|
}
|
|
if(s==_57a){
|
|
cls+=" calendar-today";
|
|
}
|
|
if(s==_57b){
|
|
cls+=" calendar-selected";
|
|
}
|
|
if(j==_57c){
|
|
cls+=" calendar-saturday";
|
|
}else{
|
|
if(j==_57d){
|
|
cls+=" calendar-sunday";
|
|
}
|
|
}
|
|
if(j==0){
|
|
cls+=" calendar-first";
|
|
}else{
|
|
if(j==week.length-1){
|
|
cls+=" calendar-last";
|
|
}
|
|
}
|
|
cls+=" "+_580;
|
|
if(!opts.validator.call(_579,_57f)){
|
|
cls+=" calendar-disabled";
|
|
}
|
|
data.push("<td class=\""+cls+"\" abbr=\""+s+"\" style=\""+_581+"\">"+d+"</td>");
|
|
}
|
|
data.push("</tr>");
|
|
}
|
|
data.push("</tbody>");
|
|
data.push("</table>");
|
|
body.append(data.join(""));
|
|
body.children("table.calendar-dtable").prependTo(body);
|
|
opts.onNavigate.call(_579,opts.year,opts.month);
|
|
};
|
|
$.fn.calendar=function(_582,_583){
|
|
if(typeof _582=="string"){
|
|
return $.fn.calendar.methods[_582](this,_583);
|
|
}
|
|
_582=_582||{};
|
|
return this.each(function(){
|
|
var _584=$.data(this,"calendar");
|
|
if(_584){
|
|
$.extend(_584.options,_582);
|
|
}else{
|
|
_584=$.data(this,"calendar",{options:$.extend({},$.fn.calendar.defaults,$.fn.calendar.parseOptions(this),_582)});
|
|
init(this);
|
|
}
|
|
if(_584.options.border==false){
|
|
$(this).addClass("calendar-noborder");
|
|
}
|
|
_559(this);
|
|
_55f(this);
|
|
show(this);
|
|
$(this).find("div.calendar-menu").hide();
|
|
});
|
|
};
|
|
$.fn.calendar.methods={options:function(jq){
|
|
return $.data(jq[0],"calendar").options;
|
|
},resize:function(jq,_585){
|
|
return jq.each(function(){
|
|
_559(this,_585);
|
|
});
|
|
},moveTo:function(jq,date){
|
|
return jq.each(function(){
|
|
if(!date){
|
|
var now=new Date();
|
|
$(this).calendar({year:now.getFullYear(),month:now.getMonth()+1,current:date});
|
|
return;
|
|
}
|
|
var opts=$(this).calendar("options");
|
|
if(opts.validator.call(this,date)){
|
|
var _586=opts.current;
|
|
$(this).calendar({year:date.getFullYear(),month:date.getMonth()+1,current:date});
|
|
if(!_586||_586.getTime()!=date.getTime()){
|
|
opts.onChange.call(this,opts.current,_586);
|
|
}
|
|
}
|
|
});
|
|
}};
|
|
$.fn.calendar.parseOptions=function(_587){
|
|
var t=$(_587);
|
|
return $.extend({},$.parser.parseOptions(_587,[{firstDay:"number",fit:"boolean",border:"boolean"}]));
|
|
};
|
|
$.fn.calendar.defaults={width:180,height:180,fit:false,border:true,firstDay:0,weeks:["S","M","T","W","T","F","S"],months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],year:new Date().getFullYear(),month:new Date().getMonth()+1,current:(function(){
|
|
var d=new Date();
|
|
return new Date(d.getFullYear(),d.getMonth(),d.getDate());
|
|
})(),formatter:function(date){
|
|
return date.getDate();
|
|
},styler:function(date){
|
|
return "";
|
|
},validator:function(date){
|
|
return true;
|
|
},onSelect:function(date){
|
|
},onChange:function(_588,_589){
|
|
},onNavigate:function(year,_58a){
|
|
}};
|
|
})(jQuery);
|
|
(function($){
|
|
function _58b(_58c){
|
|
var _58d=$.data(_58c,"spinner");
|
|
var opts=_58d.options;
|
|
var _58e=$.extend(true,[],opts.icons);
|
|
_58e.push({iconCls:"spinner-arrow",handler:function(e){
|
|
_58f(e);
|
|
}});
|
|
$(_58c).addClass("spinner-f").textbox($.extend({},opts,{icons:_58e}));
|
|
var _590=$(_58c).textbox("getIcon",_58e.length-1);
|
|
_590.append("<a href=\"javascript:void(0)\" class=\"spinner-arrow-up\" tabindex=\"-1\"></a>");
|
|
_590.append("<a href=\"javascript:void(0)\" class=\"spinner-arrow-down\" tabindex=\"-1\"></a>");
|
|
$(_58c).attr("spinnerName",$(_58c).attr("textboxName"));
|
|
_58d.spinner=$(_58c).next();
|
|
_58d.spinner.addClass("spinner");
|
|
};
|
|
function _58f(e){
|
|
var _591=e.data.target;
|
|
var opts=$(_591).spinner("options");
|
|
var up=$(e.target).closest("a.spinner-arrow-up");
|
|
if(up.length){
|
|
opts.spin.call(_591,false);
|
|
opts.onSpinUp.call(_591);
|
|
$(_591).spinner("validate");
|
|
}
|
|
var down=$(e.target).closest("a.spinner-arrow-down");
|
|
if(down.length){
|
|
opts.spin.call(_591,true);
|
|
opts.onSpinDown.call(_591);
|
|
$(_591).spinner("validate");
|
|
}
|
|
};
|
|
$.fn.spinner=function(_592,_593){
|
|
if(typeof _592=="string"){
|
|
var _594=$.fn.spinner.methods[_592];
|
|
if(_594){
|
|
return _594(this,_593);
|
|
}else{
|
|
return this.textbox(_592,_593);
|
|
}
|
|
}
|
|
_592=_592||{};
|
|
return this.each(function(){
|
|
var _595=$.data(this,"spinner");
|
|
if(_595){
|
|
$.extend(_595.options,_592);
|
|
}else{
|
|
_595=$.data(this,"spinner",{options:$.extend({},$.fn.spinner.defaults,$.fn.spinner.parseOptions(this),_592)});
|
|
}
|
|
_58b(this);
|
|
});
|
|
};
|
|
$.fn.spinner.methods={options:function(jq){
|
|
var opts=jq.textbox("options");
|
|
return $.extend($.data(jq[0],"spinner").options,{width:opts.width,value:opts.value,originalValue:opts.originalValue,disabled:opts.disabled,readonly:opts.readonly});
|
|
}};
|
|
$.fn.spinner.parseOptions=function(_596){
|
|
return $.extend({},$.fn.textbox.parseOptions(_596),$.parser.parseOptions(_596,["min","max",{increment:"number"}]));
|
|
};
|
|
$.fn.spinner.defaults=$.extend({},$.fn.textbox.defaults,{min:null,max:null,increment:1,spin:function(down){
|
|
},onSpinUp:function(){
|
|
},onSpinDown:function(){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _597(_598){
|
|
$(_598).addClass("numberspinner-f");
|
|
var opts=$.data(_598,"numberspinner").options;
|
|
$(_598).numberbox(opts).spinner(opts);
|
|
$(_598).numberbox("setValue",opts.value);
|
|
};
|
|
function _599(_59a,down){
|
|
var opts=$.data(_59a,"numberspinner").options;
|
|
var v=parseFloat($(_59a).numberbox("getValue")||opts.value)||0;
|
|
if(down){
|
|
v-=opts.increment;
|
|
}else{
|
|
v+=opts.increment;
|
|
}
|
|
$(_59a).numberbox("setValue",v);
|
|
};
|
|
$.fn.numberspinner=function(_59b,_59c){
|
|
if(typeof _59b=="string"){
|
|
var _59d=$.fn.numberspinner.methods[_59b];
|
|
if(_59d){
|
|
return _59d(this,_59c);
|
|
}else{
|
|
return this.numberbox(_59b,_59c);
|
|
}
|
|
}
|
|
_59b=_59b||{};
|
|
return this.each(function(){
|
|
var _59e=$.data(this,"numberspinner");
|
|
if(_59e){
|
|
$.extend(_59e.options,_59b);
|
|
}else{
|
|
$.data(this,"numberspinner",{options:$.extend({},$.fn.numberspinner.defaults,$.fn.numberspinner.parseOptions(this),_59b)});
|
|
}
|
|
_597(this);
|
|
});
|
|
};
|
|
$.fn.numberspinner.methods={options:function(jq){
|
|
var opts=jq.numberbox("options");
|
|
return $.extend($.data(jq[0],"numberspinner").options,{width:opts.width,value:opts.value,originalValue:opts.originalValue,disabled:opts.disabled,readonly:opts.readonly});
|
|
}};
|
|
$.fn.numberspinner.parseOptions=function(_59f){
|
|
return $.extend({},$.fn.spinner.parseOptions(_59f),$.fn.numberbox.parseOptions(_59f),{});
|
|
};
|
|
$.fn.numberspinner.defaults=$.extend({},$.fn.spinner.defaults,$.fn.numberbox.defaults,{spin:function(down){
|
|
_599(this,down);
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _5a0(_5a1){
|
|
var _5a2=0;
|
|
if(typeof _5a1.selectionStart=="number"){
|
|
_5a2=_5a1.selectionStart;
|
|
}else{
|
|
if(_5a1.createTextRange){
|
|
var _5a3=_5a1.createTextRange();
|
|
var s=document.selection.createRange();
|
|
s.setEndPoint("StartToStart",_5a3);
|
|
_5a2=s.text.length;
|
|
}
|
|
}
|
|
return _5a2;
|
|
};
|
|
function _5a4(_5a5,_5a6,end){
|
|
if(_5a5.setSelectionRange){
|
|
_5a5.setSelectionRange(_5a6,end);
|
|
}else{
|
|
if(_5a5.createTextRange){
|
|
var _5a7=_5a5.createTextRange();
|
|
_5a7.collapse();
|
|
_5a7.moveEnd("character",end);
|
|
_5a7.moveStart("character",_5a6);
|
|
_5a7.select();
|
|
}
|
|
}
|
|
};
|
|
function _5a8(_5a9){
|
|
var opts=$.data(_5a9,"timespinner").options;
|
|
$(_5a9).addClass("timespinner-f").spinner(opts);
|
|
var _5aa=opts.formatter.call(_5a9,opts.parser.call(_5a9,opts.value));
|
|
$(_5a9).timespinner("initValue",_5aa);
|
|
};
|
|
function _5ab(e){
|
|
var _5ac=e.data.target;
|
|
var opts=$.data(_5ac,"timespinner").options;
|
|
var _5ad=_5a0(this);
|
|
for(var i=0;i<opts.selections.length;i++){
|
|
var _5ae=opts.selections[i];
|
|
if(_5ad>=_5ae[0]&&_5ad<=_5ae[1]){
|
|
_5af(_5ac,i);
|
|
return;
|
|
}
|
|
}
|
|
};
|
|
function _5af(_5b0,_5b1){
|
|
var opts=$.data(_5b0,"timespinner").options;
|
|
if(_5b1!=undefined){
|
|
opts.highlight=_5b1;
|
|
}
|
|
var _5b2=opts.selections[opts.highlight];
|
|
if(_5b2){
|
|
var tb=$(_5b0).timespinner("textbox");
|
|
_5a4(tb[0],_5b2[0],_5b2[1]);
|
|
tb.focus();
|
|
}
|
|
};
|
|
function _5b3(_5b4,_5b5){
|
|
var opts=$.data(_5b4,"timespinner").options;
|
|
var _5b5=opts.parser.call(_5b4,_5b5);
|
|
var text=opts.formatter.call(_5b4,_5b5);
|
|
$(_5b4).spinner("setValue",text);
|
|
};
|
|
function _5b6(_5b7,down){
|
|
var opts=$.data(_5b7,"timespinner").options;
|
|
var s=$(_5b7).timespinner("getValue");
|
|
var _5b8=opts.selections[opts.highlight];
|
|
var s1=s.substring(0,_5b8[0]);
|
|
var s2=s.substring(_5b8[0],_5b8[1]);
|
|
var s3=s.substring(_5b8[1]);
|
|
var v=s1+((parseInt(s2,10)||0)+opts.increment*(down?-1:1))+s3;
|
|
$(_5b7).timespinner("setValue",v);
|
|
_5af(_5b7);
|
|
};
|
|
$.fn.timespinner=function(_5b9,_5ba){
|
|
if(typeof _5b9=="string"){
|
|
var _5bb=$.fn.timespinner.methods[_5b9];
|
|
if(_5bb){
|
|
return _5bb(this,_5ba);
|
|
}else{
|
|
return this.spinner(_5b9,_5ba);
|
|
}
|
|
}
|
|
_5b9=_5b9||{};
|
|
return this.each(function(){
|
|
var _5bc=$.data(this,"timespinner");
|
|
if(_5bc){
|
|
$.extend(_5bc.options,_5b9);
|
|
}else{
|
|
$.data(this,"timespinner",{options:$.extend({},$.fn.timespinner.defaults,$.fn.timespinner.parseOptions(this),_5b9)});
|
|
}
|
|
_5a8(this);
|
|
});
|
|
};
|
|
$.fn.timespinner.methods={options:function(jq){
|
|
var opts=jq.data("spinner")?jq.spinner("options"):{};
|
|
return $.extend($.data(jq[0],"timespinner").options,{width:opts.width,value:opts.value,originalValue:opts.originalValue,disabled:opts.disabled,readonly:opts.readonly});
|
|
},setValue:function(jq,_5bd){
|
|
return jq.each(function(){
|
|
_5b3(this,_5bd);
|
|
});
|
|
},getHours:function(jq){
|
|
var opts=$.data(jq[0],"timespinner").options;
|
|
var vv=jq.timespinner("getValue").split(opts.separator);
|
|
return parseInt(vv[0],10);
|
|
},getMinutes:function(jq){
|
|
var opts=$.data(jq[0],"timespinner").options;
|
|
var vv=jq.timespinner("getValue").split(opts.separator);
|
|
return parseInt(vv[1],10);
|
|
},getSeconds:function(jq){
|
|
var opts=$.data(jq[0],"timespinner").options;
|
|
var vv=jq.timespinner("getValue").split(opts.separator);
|
|
return parseInt(vv[2],10)||0;
|
|
}};
|
|
$.fn.timespinner.parseOptions=function(_5be){
|
|
return $.extend({},$.fn.spinner.parseOptions(_5be),$.parser.parseOptions(_5be,["separator",{showSeconds:"boolean",highlight:"number"}]));
|
|
};
|
|
$.fn.timespinner.defaults=$.extend({},$.fn.spinner.defaults,{inputEvents:$.extend({},$.fn.spinner.defaults.inputEvents,{click:function(e){
|
|
_5ab.call(this,e);
|
|
},blur:function(e){
|
|
var t=$(e.data.target);
|
|
t.timespinner("setValue",t.timespinner("getText"));
|
|
},keydown:function(e){
|
|
if(e.keyCode==13){
|
|
var t=$(e.data.target);
|
|
t.timespinner("setValue",t.timespinner("getText"));
|
|
}
|
|
}}),formatter:function(date){
|
|
if(!date){
|
|
return "";
|
|
}
|
|
var opts=$(this).timespinner("options");
|
|
var tt=[_5bf(date.getHours()),_5bf(date.getMinutes())];
|
|
if(opts.showSeconds){
|
|
tt.push(_5bf(date.getSeconds()));
|
|
}
|
|
return tt.join(opts.separator);
|
|
function _5bf(_5c0){
|
|
return (_5c0<10?"0":"")+_5c0;
|
|
};
|
|
},parser:function(s){
|
|
var opts=$(this).timespinner("options");
|
|
var date=_5c1(s);
|
|
if(date){
|
|
var min=_5c1(opts.min);
|
|
var max=_5c1(opts.max);
|
|
if(min&&min>date){
|
|
date=min;
|
|
}
|
|
if(max&&max<date){
|
|
date=max;
|
|
}
|
|
}
|
|
return date;
|
|
function _5c1(s){
|
|
if(!s){
|
|
return null;
|
|
}
|
|
var tt=s.split(opts.separator);
|
|
return new Date(1900,0,0,parseInt(tt[0],10)||0,parseInt(tt[1],10)||0,parseInt(tt[2],10)||0);
|
|
};
|
|
},selections:[[0,2],[3,5],[6,8]],separator:":",showSeconds:false,highlight:0,spin:function(down){
|
|
_5b6(this,down);
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _5c2(_5c3){
|
|
var opts=$.data(_5c3,"datetimespinner").options;
|
|
$(_5c3).addClass("datetimespinner-f").timespinner(opts);
|
|
};
|
|
$.fn.datetimespinner=function(_5c4,_5c5){
|
|
if(typeof _5c4=="string"){
|
|
var _5c6=$.fn.datetimespinner.methods[_5c4];
|
|
if(_5c6){
|
|
return _5c6(this,_5c5);
|
|
}else{
|
|
return this.timespinner(_5c4,_5c5);
|
|
}
|
|
}
|
|
_5c4=_5c4||{};
|
|
return this.each(function(){
|
|
var _5c7=$.data(this,"datetimespinner");
|
|
if(_5c7){
|
|
$.extend(_5c7.options,_5c4);
|
|
}else{
|
|
$.data(this,"datetimespinner",{options:$.extend({},$.fn.datetimespinner.defaults,$.fn.datetimespinner.parseOptions(this),_5c4)});
|
|
}
|
|
_5c2(this);
|
|
});
|
|
};
|
|
$.fn.datetimespinner.methods={options:function(jq){
|
|
var opts=jq.timespinner("options");
|
|
return $.extend($.data(jq[0],"datetimespinner").options,{width:opts.width,value:opts.value,originalValue:opts.originalValue,disabled:opts.disabled,readonly:opts.readonly});
|
|
}};
|
|
$.fn.datetimespinner.parseOptions=function(_5c8){
|
|
return $.extend({},$.fn.timespinner.parseOptions(_5c8),$.parser.parseOptions(_5c8,[]));
|
|
};
|
|
$.fn.datetimespinner.defaults=$.extend({},$.fn.timespinner.defaults,{formatter:function(date){
|
|
if(!date){
|
|
return "";
|
|
}
|
|
return $.fn.datebox.defaults.formatter.call(this,date)+" "+$.fn.timespinner.defaults.formatter.call(this,date);
|
|
},parser:function(s){
|
|
s=$.trim(s);
|
|
if(!s){
|
|
return null;
|
|
}
|
|
var dt=s.split(" ");
|
|
var _5c9=$.fn.datebox.defaults.parser.call(this,dt[0]);
|
|
if(dt.length<2){
|
|
return _5c9;
|
|
}
|
|
var _5ca=$.fn.timespinner.defaults.parser.call(this,dt[1]);
|
|
return new Date(_5c9.getFullYear(),_5c9.getMonth(),_5c9.getDate(),_5ca.getHours(),_5ca.getMinutes(),_5ca.getSeconds());
|
|
},selections:[[0,2],[3,5],[6,10],[11,13],[14,16],[17,19]]});
|
|
})(jQuery);
|
|
(function($){
|
|
var _5cb=0;
|
|
function _5cc(a,o){
|
|
for(var i=0,len=a.length;i<len;i++){
|
|
if(a[i]==o){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
function _5cd(a,o,id){
|
|
if(typeof o=="string"){
|
|
for(var i=0,len=a.length;i<len;i++){
|
|
if(a[i][o]==id){
|
|
a.splice(i,1);
|
|
return;
|
|
}
|
|
}
|
|
}else{
|
|
var _5ce=_5cc(a,o);
|
|
if(_5ce!=-1){
|
|
a.splice(_5ce,1);
|
|
}
|
|
}
|
|
};
|
|
function _5cf(a,o,r){
|
|
for(var i=0,len=a.length;i<len;i++){
|
|
if(a[i][o]==r[o]){
|
|
return;
|
|
}
|
|
}
|
|
a.push(r);
|
|
};
|
|
function _5d0(_5d1,aa){
|
|
return $.data(_5d1,"treegrid")?aa.slice(1):aa;
|
|
};
|
|
function _5d2(_5d3){
|
|
var _5d4=$.data(_5d3,"datagrid");
|
|
var opts=_5d4.options;
|
|
var _5d5=_5d4.panel;
|
|
var dc=_5d4.dc;
|
|
var ss=null;
|
|
if(opts.sharedStyleSheet){
|
|
ss=typeof opts.sharedStyleSheet=="boolean"?"head":opts.sharedStyleSheet;
|
|
}else{
|
|
ss=_5d5.closest("div.datagrid-view");
|
|
if(!ss.length){
|
|
ss=dc.view;
|
|
}
|
|
}
|
|
var cc=$(ss);
|
|
var _5d6=$.data(cc[0],"ss");
|
|
if(!_5d6){
|
|
_5d6=$.data(cc[0],"ss",{cache:{},dirty:[]});
|
|
}
|
|
return {add:function(_5d7){
|
|
var ss=["<style type=\"text/css\" easyui=\"true\">"];
|
|
for(var i=0;i<_5d7.length;i++){
|
|
_5d6.cache[_5d7[i][0]]={width:_5d7[i][1]};
|
|
}
|
|
var _5d8=0;
|
|
for(var s in _5d6.cache){
|
|
var item=_5d6.cache[s];
|
|
item.index=_5d8++;
|
|
ss.push(s+"{width:"+item.width+"}");
|
|
}
|
|
ss.push("</style>");
|
|
$(ss.join("\n")).appendTo(cc);
|
|
cc.children("style[easyui]:not(:last)").remove();
|
|
},getRule:function(_5d9){
|
|
var _5da=cc.children("style[easyui]:last")[0];
|
|
var _5db=_5da.styleSheet?_5da.styleSheet:(_5da.sheet||document.styleSheets[document.styleSheets.length-1]);
|
|
var _5dc=_5db.cssRules||_5db.rules;
|
|
return _5dc[_5d9];
|
|
},set:function(_5dd,_5de){
|
|
var item=_5d6.cache[_5dd];
|
|
if(item){
|
|
item.width=_5de;
|
|
var rule=this.getRule(item.index);
|
|
if(rule){
|
|
rule.style["width"]=_5de;
|
|
}
|
|
}
|
|
},remove:function(_5df){
|
|
var tmp=[];
|
|
for(var s in _5d6.cache){
|
|
if(s.indexOf(_5df)==-1){
|
|
tmp.push([s,_5d6.cache[s].width]);
|
|
}
|
|
}
|
|
_5d6.cache={};
|
|
this.add(tmp);
|
|
},dirty:function(_5e0){
|
|
if(_5e0){
|
|
_5d6.dirty.push(_5e0);
|
|
}
|
|
},clean:function(){
|
|
for(var i=0;i<_5d6.dirty.length;i++){
|
|
this.remove(_5d6.dirty[i]);
|
|
}
|
|
_5d6.dirty=[];
|
|
}};
|
|
};
|
|
function _5e1(_5e2,_5e3){
|
|
var _5e4=$.data(_5e2,"datagrid");
|
|
var opts=_5e4.options;
|
|
var _5e5=_5e4.panel;
|
|
if(_5e3){
|
|
$.extend(opts,_5e3);
|
|
}
|
|
if(opts.fit==true){
|
|
var p=_5e5.panel("panel").parent();
|
|
opts.width=p.width();
|
|
opts.height=p.height();
|
|
}
|
|
_5e5.panel("resize",opts);
|
|
};
|
|
function _5e6(_5e7){
|
|
var _5e8=$.data(_5e7,"datagrid");
|
|
var opts=_5e8.options;
|
|
var dc=_5e8.dc;
|
|
var wrap=_5e8.panel;
|
|
var _5e9=wrap.width();
|
|
var _5ea=wrap.height();
|
|
var view=dc.view;
|
|
var _5eb=dc.view1;
|
|
var _5ec=dc.view2;
|
|
var _5ed=_5eb.children("div.datagrid-header");
|
|
var _5ee=_5ec.children("div.datagrid-header");
|
|
var _5ef=_5ed.find("table");
|
|
var _5f0=_5ee.find("table");
|
|
view.width(_5e9);
|
|
var _5f1=_5ed.children("div.datagrid-header-inner").show();
|
|
_5eb.width(_5f1.find("table").width());
|
|
if(!opts.showHeader){
|
|
_5f1.hide();
|
|
}
|
|
_5ec.width(_5e9-_5eb._outerWidth());
|
|
_5eb.children()._outerWidth(_5eb.width());
|
|
_5ec.children()._outerWidth(_5ec.width());
|
|
var all=_5ed.add(_5ee).add(_5ef).add(_5f0);
|
|
all.css("height","");
|
|
var hh=Math.max(_5ef.height(),_5f0.height());
|
|
all._outerHeight(hh);
|
|
dc.body1.add(dc.body2).children("table.datagrid-btable-frozen").css({position:"absolute",top:dc.header2._outerHeight()});
|
|
var _5f2=dc.body2.children("table.datagrid-btable-frozen")._outerHeight();
|
|
var _5f3=_5f2+_5ee._outerHeight()+_5ec.children(".datagrid-footer")._outerHeight();
|
|
wrap.children(":not(.datagrid-view,.datagrid-mask,.datagrid-mask-msg)").each(function(){
|
|
_5f3+=$(this)._outerHeight();
|
|
});
|
|
var _5f4=wrap.outerHeight()-wrap.height();
|
|
var _5f5=wrap._size("minHeight")||"";
|
|
var _5f6=wrap._size("maxHeight")||"";
|
|
_5eb.add(_5ec).children("div.datagrid-body").css({marginTop:_5f2,height:(isNaN(parseInt(opts.height))?"":(_5ea-_5f3)),minHeight:(_5f5?_5f5-_5f4-_5f3:""),maxHeight:(_5f6?_5f6-_5f4-_5f3:"")});
|
|
view.height(_5ec.height());
|
|
};
|
|
function _5f7(_5f8,_5f9,_5fa){
|
|
var rows=$.data(_5f8,"datagrid").data.rows;
|
|
var opts=$.data(_5f8,"datagrid").options;
|
|
var dc=$.data(_5f8,"datagrid").dc;
|
|
if(!dc.body1.is(":empty")&&(!opts.nowrap||opts.autoRowHeight||_5fa)){
|
|
if(_5f9!=undefined){
|
|
var tr1=opts.finder.getTr(_5f8,_5f9,"body",1);
|
|
var tr2=opts.finder.getTr(_5f8,_5f9,"body",2);
|
|
_5fb(tr1,tr2);
|
|
}else{
|
|
var tr1=opts.finder.getTr(_5f8,0,"allbody",1);
|
|
var tr2=opts.finder.getTr(_5f8,0,"allbody",2);
|
|
_5fb(tr1,tr2);
|
|
if(opts.showFooter){
|
|
var tr1=opts.finder.getTr(_5f8,0,"allfooter",1);
|
|
var tr2=opts.finder.getTr(_5f8,0,"allfooter",2);
|
|
_5fb(tr1,tr2);
|
|
}
|
|
}
|
|
}
|
|
_5e6(_5f8);
|
|
if(opts.height=="auto"){
|
|
var _5fc=dc.body1.parent();
|
|
var _5fd=dc.body2;
|
|
var _5fe=_5ff(_5fd);
|
|
var _600=_5fe.height;
|
|
if(_5fe.width>_5fd.width()){
|
|
_600+=18;
|
|
}
|
|
_600-=parseInt(_5fd.css("marginTop"))||0;
|
|
_5fc.height(_600);
|
|
_5fd.height(_600);
|
|
dc.view.height(dc.view2.height());
|
|
}
|
|
dc.body2.triggerHandler("scroll");
|
|
function _5fb(trs1,trs2){
|
|
for(var i=0;i<trs2.length;i++){
|
|
var tr1=$(trs1[i]);
|
|
var tr2=$(trs2[i]);
|
|
tr1.css("height","");
|
|
tr2.css("height","");
|
|
var _601=Math.max(tr1.height(),tr2.height());
|
|
tr1.css("height",_601);
|
|
tr2.css("height",_601);
|
|
}
|
|
};
|
|
function _5ff(cc){
|
|
var _602=0;
|
|
var _603=0;
|
|
$(cc).children().each(function(){
|
|
var c=$(this);
|
|
if(c.is(":visible")){
|
|
_603+=c._outerHeight();
|
|
if(_602<c._outerWidth()){
|
|
_602=c._outerWidth();
|
|
}
|
|
}
|
|
});
|
|
return {width:_602,height:_603};
|
|
};
|
|
};
|
|
function _604(_605,_606){
|
|
var _607=$.data(_605,"datagrid");
|
|
var opts=_607.options;
|
|
var dc=_607.dc;
|
|
if(!dc.body2.children("table.datagrid-btable-frozen").length){
|
|
dc.body1.add(dc.body2).prepend("<table class=\"datagrid-btable datagrid-btable-frozen\" cellspacing=\"0\" cellpadding=\"0\"></table>");
|
|
}
|
|
_608(true);
|
|
_608(false);
|
|
_5e6(_605);
|
|
function _608(_609){
|
|
var _60a=_609?1:2;
|
|
var tr=opts.finder.getTr(_605,_606,"body",_60a);
|
|
(_609?dc.body1:dc.body2).children("table.datagrid-btable-frozen").append(tr);
|
|
};
|
|
};
|
|
function _60b(_60c,_60d){
|
|
function _60e(){
|
|
var _60f=[];
|
|
var _610=[];
|
|
$(_60c).children("thead").each(function(){
|
|
var opt=$.parser.parseOptions(this,[{frozen:"boolean"}]);
|
|
$(this).find("tr").each(function(){
|
|
var cols=[];
|
|
$(this).find("th").each(function(){
|
|
var th=$(this);
|
|
var col=$.extend({},$.parser.parseOptions(this,["field","align","halign","order","width",{sortable:"boolean",checkbox:"boolean",resizable:"boolean",fixed:"boolean"},{rowspan:"number",colspan:"number"}]),{title:(th.html()||undefined),hidden:(th.attr("hidden")?true:undefined),formatter:(th.attr("formatter")?eval(th.attr("formatter")):undefined),styler:(th.attr("styler")?eval(th.attr("styler")):undefined),sorter:(th.attr("sorter")?eval(th.attr("sorter")):undefined)});
|
|
if(col.width&&String(col.width).indexOf("%")==-1){
|
|
col.width=parseInt(col.width);
|
|
}
|
|
if(th.attr("editor")){
|
|
var s=$.trim(th.attr("editor"));
|
|
if(s.substr(0,1)=="{"){
|
|
col.editor=eval("("+s+")");
|
|
}else{
|
|
col.editor=s;
|
|
}
|
|
}
|
|
cols.push(col);
|
|
});
|
|
opt.frozen?_60f.push(cols):_610.push(cols);
|
|
});
|
|
});
|
|
return [_60f,_610];
|
|
};
|
|
var _611=$("<div class=\"datagrid-wrap\">"+"<div class=\"datagrid-view\">"+"<div class=\"datagrid-view1\">"+"<div class=\"datagrid-header\">"+"<div class=\"datagrid-header-inner\"></div>"+"</div>"+"<div class=\"datagrid-body\">"+"<div class=\"datagrid-body-inner\"></div>"+"</div>"+"<div class=\"datagrid-footer\">"+"<div class=\"datagrid-footer-inner\"></div>"+"</div>"+"</div>"+"<div class=\"datagrid-view2\">"+"<div class=\"datagrid-header\">"+"<div class=\"datagrid-header-inner\"></div>"+"</div>"+"<div class=\"datagrid-body\"></div>"+"<div class=\"datagrid-footer\">"+"<div class=\"datagrid-footer-inner\"></div>"+"</div>"+"</div>"+"</div>"+"</div>").insertAfter(_60c);
|
|
_611.panel({doSize:false,cls:"datagrid"});
|
|
$(_60c).addClass("datagrid-f").hide().appendTo(_611.children("div.datagrid-view"));
|
|
var cc=_60e();
|
|
var view=_611.children("div.datagrid-view");
|
|
var _612=view.children("div.datagrid-view1");
|
|
var _613=view.children("div.datagrid-view2");
|
|
return {panel:_611,frozenColumns:cc[0],columns:cc[1],dc:{view:view,view1:_612,view2:_613,header1:_612.children("div.datagrid-header").children("div.datagrid-header-inner"),header2:_613.children("div.datagrid-header").children("div.datagrid-header-inner"),body1:_612.children("div.datagrid-body").children("div.datagrid-body-inner"),body2:_613.children("div.datagrid-body"),footer1:_612.children("div.datagrid-footer").children("div.datagrid-footer-inner"),footer2:_613.children("div.datagrid-footer").children("div.datagrid-footer-inner")}};
|
|
};
|
|
function _614(_615){
|
|
var _616=$.data(_615,"datagrid");
|
|
var opts=_616.options;
|
|
var dc=_616.dc;
|
|
var _617=_616.panel;
|
|
_616.ss=$(_615).datagrid("createStyleSheet");
|
|
_617.panel($.extend({},opts,{id:null,doSize:false,onResize:function(_618,_619){
|
|
if($.data(_615,"datagrid")){
|
|
_5e6(_615);
|
|
$(_615).datagrid("fitColumns");
|
|
opts.onResize.call(_617,_618,_619);
|
|
}
|
|
},onExpand:function(){
|
|
if($.data(_615,"datagrid")){
|
|
$(_615).datagrid("fixRowHeight").datagrid("fitColumns");
|
|
opts.onExpand.call(_617);
|
|
}
|
|
}}));
|
|
_616.rowIdPrefix="datagrid-row-r"+(++_5cb);
|
|
_616.cellClassPrefix="datagrid-cell-c"+_5cb;
|
|
_61a(dc.header1,opts.frozenColumns,true);
|
|
_61a(dc.header2,opts.columns,false);
|
|
_61b();
|
|
dc.header1.add(dc.header2).css("display",opts.showHeader?"block":"none");
|
|
dc.footer1.add(dc.footer2).css("display",opts.showFooter?"block":"none");
|
|
if(opts.toolbar){
|
|
if($.isArray(opts.toolbar)){
|
|
$("div.datagrid-toolbar",_617).remove();
|
|
var tb=$("<div class=\"datagrid-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(_617);
|
|
var tr=tb.find("tr");
|
|
for(var i=0;i<opts.toolbar.length;i++){
|
|
var btn=opts.toolbar[i];
|
|
if(btn=="-"){
|
|
$("<td><div class=\"datagrid-btn-separator\"></div></td>").appendTo(tr);
|
|
}else{
|
|
var td=$("<td></td>").appendTo(tr);
|
|
var tool=$("<a href=\"javascript:void(0)\"></a>").appendTo(td);
|
|
tool[0].onclick=eval(btn.handler||function(){
|
|
});
|
|
tool.linkbutton($.extend({},btn,{plain:true}));
|
|
}
|
|
}
|
|
}else{
|
|
$(opts.toolbar).addClass("datagrid-toolbar").prependTo(_617);
|
|
$(opts.toolbar).show();
|
|
}
|
|
}else{
|
|
$("div.datagrid-toolbar",_617).remove();
|
|
}
|
|
$("div.datagrid-pager",_617).remove();
|
|
if(opts.pagination){
|
|
var _61c=$("<div class=\"datagrid-pager\"></div>");
|
|
if(opts.pagePosition=="bottom"){
|
|
_61c.appendTo(_617);
|
|
}else{
|
|
if(opts.pagePosition=="top"){
|
|
_61c.addClass("datagrid-pager-top").prependTo(_617);
|
|
}else{
|
|
var ptop=$("<div class=\"datagrid-pager datagrid-pager-top\"></div>").prependTo(_617);
|
|
_61c.appendTo(_617);
|
|
_61c=_61c.add(ptop);
|
|
}
|
|
}
|
|
_61c.pagination({total:(opts.pageNumber*opts.pageSize),pageNumber:opts.pageNumber,pageSize:opts.pageSize,pageList:opts.pageList,onSelectPage:function(_61d,_61e){
|
|
opts.pageNumber=_61d||1;
|
|
opts.pageSize=_61e;
|
|
_61c.pagination("refresh",{pageNumber:_61d,pageSize:_61e});
|
|
_65a(_615);
|
|
}});
|
|
opts.pageSize=_61c.pagination("options").pageSize;
|
|
}
|
|
function _61a(_61f,_620,_621){
|
|
if(!_620){
|
|
return;
|
|
}
|
|
$(_61f).show();
|
|
$(_61f).empty();
|
|
var _622=[];
|
|
var _623=[];
|
|
if(opts.sortName){
|
|
_622=opts.sortName.split(",");
|
|
_623=opts.sortOrder.split(",");
|
|
}
|
|
var t=$("<table class=\"datagrid-htable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody></tbody></table>").appendTo(_61f);
|
|
for(var i=0;i<_620.length;i++){
|
|
var tr=$("<tr class=\"datagrid-header-row\"></tr>").appendTo($("tbody",t));
|
|
var cols=_620[i];
|
|
for(var j=0;j<cols.length;j++){
|
|
var col=cols[j];
|
|
var attr="";
|
|
if(col.rowspan){
|
|
attr+="rowspan=\""+col.rowspan+"\" ";
|
|
}
|
|
if(col.colspan){
|
|
attr+="colspan=\""+col.colspan+"\" ";
|
|
}
|
|
var td=$("<td "+attr+"></td>").appendTo(tr);
|
|
if(col.checkbox){
|
|
td.attr("field",col.field);
|
|
$("<div class=\"datagrid-header-check\"></div>").html("<input type=\"checkbox\"/>").appendTo(td);
|
|
}else{
|
|
if(col.field){
|
|
td.attr("field",col.field);
|
|
td.append("<div class=\"datagrid-cell\"><span></span><span class=\"datagrid-sort-icon\"> </span></div>");
|
|
td.find("span:first").html(col.title);
|
|
var cell=td.find("div.datagrid-cell");
|
|
var pos=_5cc(_622,col.field);
|
|
if(pos>=0){
|
|
cell.addClass("datagrid-sort-"+_623[pos]);
|
|
}
|
|
if(col.sortable){
|
|
cell.addClass("datagrid-sort");
|
|
}
|
|
if(col.resizable==false){
|
|
cell.attr("resizable","false");
|
|
}
|
|
if(col.width){
|
|
var _624=$.parser.parseValue("width",col.width,dc.view,opts.scrollbarSize);
|
|
cell._outerWidth(_624-1);
|
|
col.boxWidth=parseInt(cell[0].style.width);
|
|
col.deltaWidth=_624-col.boxWidth;
|
|
}else{
|
|
col.auto=true;
|
|
}
|
|
cell.css("text-align",(col.halign||col.align||""));
|
|
col.cellClass=_616.cellClassPrefix+"-"+col.field.replace(/[\.|\s]/g,"-");
|
|
cell.addClass(col.cellClass).css("width","");
|
|
}else{
|
|
$("<div class=\"datagrid-cell-group\"></div>").html(col.title).appendTo(td);
|
|
}
|
|
}
|
|
if(col.hidden){
|
|
td.hide();
|
|
}
|
|
}
|
|
}
|
|
if(_621&&opts.rownumbers){
|
|
var td=$("<td rowspan=\""+opts.frozenColumns.length+"\"><div class=\"datagrid-header-rownumber\"></div></td>");
|
|
if($("tr",t).length==0){
|
|
td.wrap("<tr class=\"datagrid-header-row\"></tr>").parent().appendTo($("tbody",t));
|
|
}else{
|
|
td.prependTo($("tr:first",t));
|
|
}
|
|
}
|
|
};
|
|
function _61b(){
|
|
var _625=[];
|
|
var _626=_627(_615,true).concat(_627(_615));
|
|
for(var i=0;i<_626.length;i++){
|
|
var col=_628(_615,_626[i]);
|
|
if(col&&!col.checkbox){
|
|
_625.push(["."+col.cellClass,col.boxWidth?col.boxWidth+"px":"auto"]);
|
|
}
|
|
}
|
|
_616.ss.add(_625);
|
|
_616.ss.dirty(_616.cellSelectorPrefix);
|
|
_616.cellSelectorPrefix="."+_616.cellClassPrefix;
|
|
};
|
|
};
|
|
function _629(_62a){
|
|
var _62b=$.data(_62a,"datagrid");
|
|
var _62c=_62b.panel;
|
|
var opts=_62b.options;
|
|
var dc=_62b.dc;
|
|
var _62d=dc.header1.add(dc.header2);
|
|
_62d.find("input[type=checkbox]").unbind(".datagrid").bind("click.datagrid",function(e){
|
|
if(opts.singleSelect&&opts.selectOnCheck){
|
|
return false;
|
|
}
|
|
if($(this).is(":checked")){
|
|
_6c4(_62a);
|
|
}else{
|
|
_6ca(_62a);
|
|
}
|
|
e.stopPropagation();
|
|
});
|
|
var _62e=_62d.find("div.datagrid-cell");
|
|
_62e.closest("td").unbind(".datagrid").bind("mouseenter.datagrid",function(){
|
|
if(_62b.resizing){
|
|
return;
|
|
}
|
|
$(this).addClass("datagrid-header-over");
|
|
}).bind("mouseleave.datagrid",function(){
|
|
$(this).removeClass("datagrid-header-over");
|
|
}).bind("contextmenu.datagrid",function(e){
|
|
var _62f=$(this).attr("field");
|
|
opts.onHeaderContextMenu.call(_62a,e,_62f);
|
|
});
|
|
_62e.unbind(".datagrid").bind("click.datagrid",function(e){
|
|
var p1=$(this).offset().left+5;
|
|
var p2=$(this).offset().left+$(this)._outerWidth()-5;
|
|
if(e.pageX<p2&&e.pageX>p1){
|
|
_64f(_62a,$(this).parent().attr("field"));
|
|
}
|
|
}).bind("dblclick.datagrid",function(e){
|
|
var p1=$(this).offset().left+5;
|
|
var p2=$(this).offset().left+$(this)._outerWidth()-5;
|
|
var cond=opts.resizeHandle=="right"?(e.pageX>p2):(opts.resizeHandle=="left"?(e.pageX<p1):(e.pageX<p1||e.pageX>p2));
|
|
if(cond){
|
|
var _630=$(this).parent().attr("field");
|
|
var col=_628(_62a,_630);
|
|
if(col.resizable==false){
|
|
return;
|
|
}
|
|
$(_62a).datagrid("autoSizeColumn",_630);
|
|
col.auto=false;
|
|
}
|
|
});
|
|
var _631=opts.resizeHandle=="right"?"e":(opts.resizeHandle=="left"?"w":"e,w");
|
|
_62e.each(function(){
|
|
$(this).resizable({handles:_631,disabled:($(this).attr("resizable")?$(this).attr("resizable")=="false":false),minWidth:25,onStartResize:function(e){
|
|
_62b.resizing=true;
|
|
_62d.css("cursor",$("body").css("cursor"));
|
|
if(!_62b.proxy){
|
|
_62b.proxy=$("<div class=\"datagrid-resize-proxy\"></div>").appendTo(dc.view);
|
|
}
|
|
_62b.proxy.css({left:e.pageX-$(_62c).offset().left-1,display:"none"});
|
|
setTimeout(function(){
|
|
if(_62b.proxy){
|
|
_62b.proxy.show();
|
|
}
|
|
},500);
|
|
},onResize:function(e){
|
|
_62b.proxy.css({left:e.pageX-$(_62c).offset().left-1,display:"block"});
|
|
return false;
|
|
},onStopResize:function(e){
|
|
_62d.css("cursor","");
|
|
$(this).css("height","");
|
|
var _632=$(this).parent().attr("field");
|
|
var col=_628(_62a,_632);
|
|
col.width=$(this)._outerWidth();
|
|
col.boxWidth=col.width-col.deltaWidth;
|
|
col.auto=undefined;
|
|
$(this).css("width","");
|
|
$(_62a).datagrid("fixColumnSize",_632);
|
|
_62b.proxy.remove();
|
|
_62b.proxy=null;
|
|
if($(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1")){
|
|
_5e6(_62a);
|
|
}
|
|
$(_62a).datagrid("fitColumns");
|
|
opts.onResizeColumn.call(_62a,_632,col.width);
|
|
setTimeout(function(){
|
|
_62b.resizing=false;
|
|
},0);
|
|
}});
|
|
});
|
|
var bb=dc.body1.add(dc.body2);
|
|
bb.unbind();
|
|
for(var _633 in opts.rowEvents){
|
|
bb.bind(_633,opts.rowEvents[_633]);
|
|
}
|
|
dc.body1.bind("mousewheel DOMMouseScroll",function(e){
|
|
var e1=e.originalEvent||window.event;
|
|
var _634=e1.wheelDelta||e1.detail*(-1);
|
|
var dg=$(e.target).closest("div.datagrid-view").children(".datagrid-f");
|
|
var dc=dg.data("datagrid").dc;
|
|
dc.body2.scrollTop(dc.body2.scrollTop()-_634);
|
|
});
|
|
dc.body2.bind("scroll",function(){
|
|
var b1=dc.view1.children("div.datagrid-body");
|
|
b1.scrollTop($(this).scrollTop());
|
|
var c1=dc.body1.children(":first");
|
|
var c2=dc.body2.children(":first");
|
|
if(c1.length&&c2.length){
|
|
var top1=c1.offset().top;
|
|
var top2=c2.offset().top;
|
|
if(top1!=top2){
|
|
b1.scrollTop(b1.scrollTop()+top1-top2);
|
|
}
|
|
}
|
|
dc.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft());
|
|
dc.body2.children("table.datagrid-btable-frozen").css("left",-$(this)._scrollLeft());
|
|
});
|
|
};
|
|
function _635(_636){
|
|
return function(e){
|
|
var tr=_637(e.target);
|
|
if(!tr){
|
|
return;
|
|
}
|
|
var _638=_639(tr);
|
|
if($.data(_638,"datagrid").resizing){
|
|
return;
|
|
}
|
|
var _63a=_63b(tr);
|
|
if(_636){
|
|
_63c(_638,_63a);
|
|
}else{
|
|
var opts=$.data(_638,"datagrid").options;
|
|
opts.finder.getTr(_638,_63a).removeClass("datagrid-row-over");
|
|
}
|
|
};
|
|
};
|
|
function _63d(e){
|
|
var tr=_637(e.target);
|
|
if(!tr){
|
|
return;
|
|
}
|
|
var _63e=_639(tr);
|
|
var opts=$.data(_63e,"datagrid").options;
|
|
var _63f=_63b(tr);
|
|
var tt=$(e.target);
|
|
if(tt.parent().hasClass("datagrid-cell-check")){
|
|
if(opts.singleSelect&&opts.selectOnCheck){
|
|
tt._propAttr("checked",!tt.is(":checked"));
|
|
_640(_63e,_63f);
|
|
}else{
|
|
if(tt.is(":checked")){
|
|
tt._propAttr("checked",false);
|
|
_640(_63e,_63f);
|
|
}else{
|
|
tt._propAttr("checked",true);
|
|
_641(_63e,_63f);
|
|
}
|
|
}
|
|
}else{
|
|
var row=opts.finder.getRow(_63e,_63f);
|
|
var td=tt.closest("td[field]",tr);
|
|
if(td.length){
|
|
var _642=td.attr("field");
|
|
opts.onClickCell.call(_63e,_63f,_642,row[_642]);
|
|
}
|
|
if(opts.singleSelect==true){
|
|
_643(_63e,_63f);
|
|
}else{
|
|
if(opts.ctrlSelect){
|
|
if(e.ctrlKey){
|
|
if(tr.hasClass("datagrid-row-selected")){
|
|
_644(_63e,_63f);
|
|
}else{
|
|
_643(_63e,_63f);
|
|
}
|
|
}else{
|
|
if(e.shiftKey){
|
|
$(_63e).datagrid("clearSelections");
|
|
var _645=Math.min(opts.lastSelectedIndex||0,_63f);
|
|
var _646=Math.max(opts.lastSelectedIndex||0,_63f);
|
|
for(var i=_645;i<=_646;i++){
|
|
_643(_63e,i);
|
|
}
|
|
}else{
|
|
$(_63e).datagrid("clearSelections");
|
|
_643(_63e,_63f);
|
|
opts.lastSelectedIndex=_63f;
|
|
}
|
|
}
|
|
}else{
|
|
if(tr.hasClass("datagrid-row-selected")){
|
|
_644(_63e,_63f);
|
|
}else{
|
|
_643(_63e,_63f);
|
|
}
|
|
}
|
|
}
|
|
opts.onClickRow.apply(_63e,_5d0(_63e,[_63f,row]));
|
|
}
|
|
};
|
|
function _647(e){
|
|
var tr=_637(e.target);
|
|
if(!tr){
|
|
return;
|
|
}
|
|
var _648=_639(tr);
|
|
var opts=$.data(_648,"datagrid").options;
|
|
var _649=_63b(tr);
|
|
var row=opts.finder.getRow(_648,_649);
|
|
var td=$(e.target).closest("td[field]",tr);
|
|
if(td.length){
|
|
var _64a=td.attr("field");
|
|
opts.onDblClickCell.call(_648,_649,_64a,row[_64a]);
|
|
}
|
|
opts.onDblClickRow.apply(_648,_5d0(_648,[_649,row]));
|
|
};
|
|
function _64b(e){
|
|
var tr=_637(e.target);
|
|
if(tr){
|
|
var _64c=_639(tr);
|
|
var opts=$.data(_64c,"datagrid").options;
|
|
var _64d=_63b(tr);
|
|
var row=opts.finder.getRow(_64c,_64d);
|
|
opts.onRowContextMenu.call(_64c,e,_64d,row);
|
|
}else{
|
|
var body=_637(e.target,".datagrid-body");
|
|
if(body){
|
|
var _64c=_639(body);
|
|
var opts=$.data(_64c,"datagrid").options;
|
|
opts.onRowContextMenu.call(_64c,e,-1,null);
|
|
}
|
|
}
|
|
};
|
|
function _639(t){
|
|
return $(t).closest("div.datagrid-view").children(".datagrid-f")[0];
|
|
};
|
|
function _637(t,_64e){
|
|
var tr=$(t).closest(_64e||"tr.datagrid-row");
|
|
if(tr.length&&tr.parent().length){
|
|
return tr;
|
|
}else{
|
|
return undefined;
|
|
}
|
|
};
|
|
function _63b(tr){
|
|
if(tr.attr("datagrid-row-index")){
|
|
return parseInt(tr.attr("datagrid-row-index"));
|
|
}else{
|
|
return tr.attr("node-id");
|
|
}
|
|
};
|
|
function _64f(_650,_651){
|
|
var _652=$.data(_650,"datagrid");
|
|
var opts=_652.options;
|
|
_651=_651||{};
|
|
var _653={sortName:opts.sortName,sortOrder:opts.sortOrder};
|
|
if(typeof _651=="object"){
|
|
$.extend(_653,_651);
|
|
}
|
|
var _654=[];
|
|
var _655=[];
|
|
if(_653.sortName){
|
|
_654=_653.sortName.split(",");
|
|
_655=_653.sortOrder.split(",");
|
|
}
|
|
if(typeof _651=="string"){
|
|
var _656=_651;
|
|
var col=_628(_650,_656);
|
|
if(!col.sortable||_652.resizing){
|
|
return;
|
|
}
|
|
var _657=col.order||"asc";
|
|
var pos=_5cc(_654,_656);
|
|
if(pos>=0){
|
|
var _658=_655[pos]=="asc"?"desc":"asc";
|
|
if(opts.multiSort&&_658==_657){
|
|
_654.splice(pos,1);
|
|
_655.splice(pos,1);
|
|
}else{
|
|
_655[pos]=_658;
|
|
}
|
|
}else{
|
|
if(opts.multiSort){
|
|
_654.push(_656);
|
|
_655.push(_657);
|
|
}else{
|
|
_654=[_656];
|
|
_655=[_657];
|
|
}
|
|
}
|
|
_653.sortName=_654.join(",");
|
|
_653.sortOrder=_655.join(",");
|
|
}
|
|
if(opts.onBeforeSortColumn.call(_650,_653.sortName,_653.sortOrder)==false){
|
|
return;
|
|
}
|
|
$.extend(opts,_653);
|
|
var dc=_652.dc;
|
|
var _659=dc.header1.add(dc.header2);
|
|
_659.find("div.datagrid-cell").removeClass("datagrid-sort-asc datagrid-sort-desc");
|
|
for(var i=0;i<_654.length;i++){
|
|
var col=_628(_650,_654[i]);
|
|
_659.find("div."+col.cellClass).addClass("datagrid-sort-"+_655[i]);
|
|
}
|
|
if(opts.remoteSort){
|
|
_65a(_650);
|
|
}else{
|
|
_65b(_650,$(_650).datagrid("getData"));
|
|
}
|
|
opts.onSortColumn.call(_650,opts.sortName,opts.sortOrder);
|
|
};
|
|
function _65c(_65d){
|
|
var _65e=$.data(_65d,"datagrid");
|
|
var opts=_65e.options;
|
|
var dc=_65e.dc;
|
|
var _65f=dc.view2.children("div.datagrid-header");
|
|
dc.body2.css("overflow-x","");
|
|
_660();
|
|
_661();
|
|
_662();
|
|
_660(true);
|
|
if(_65f.width()>=_65f.find("table").width()){
|
|
dc.body2.css("overflow-x","hidden");
|
|
}
|
|
function _662(){
|
|
if(!opts.fitColumns){
|
|
return;
|
|
}
|
|
if(!_65e.leftWidth){
|
|
_65e.leftWidth=0;
|
|
}
|
|
var _663=0;
|
|
var cc=[];
|
|
var _664=_627(_65d,false);
|
|
for(var i=0;i<_664.length;i++){
|
|
var col=_628(_65d,_664[i]);
|
|
if(_665(col)){
|
|
_663+=col.width;
|
|
cc.push({field:col.field,col:col,addingWidth:0});
|
|
}
|
|
}
|
|
if(!_663){
|
|
return;
|
|
}
|
|
cc[cc.length-1].addingWidth-=_65e.leftWidth;
|
|
var _666=_65f.children("div.datagrid-header-inner").show();
|
|
var _667=_65f.width()-_65f.find("table").width()-opts.scrollbarSize+_65e.leftWidth;
|
|
var rate=_667/_663;
|
|
if(!opts.showHeader){
|
|
_666.hide();
|
|
}
|
|
for(var i=0;i<cc.length;i++){
|
|
var c=cc[i];
|
|
var _668=parseInt(c.col.width*rate);
|
|
c.addingWidth+=_668;
|
|
_667-=_668;
|
|
}
|
|
cc[cc.length-1].addingWidth+=_667;
|
|
for(var i=0;i<cc.length;i++){
|
|
var c=cc[i];
|
|
if(c.col.boxWidth+c.addingWidth>0){
|
|
c.col.boxWidth+=c.addingWidth;
|
|
c.col.width+=c.addingWidth;
|
|
}
|
|
}
|
|
_65e.leftWidth=_667;
|
|
$(_65d).datagrid("fixColumnSize");
|
|
};
|
|
function _661(){
|
|
var _669=false;
|
|
var _66a=_627(_65d,true).concat(_627(_65d,false));
|
|
$.map(_66a,function(_66b){
|
|
var col=_628(_65d,_66b);
|
|
if(String(col.width||"").indexOf("%")>=0){
|
|
var _66c=$.parser.parseValue("width",col.width,dc.view,opts.scrollbarSize)-col.deltaWidth;
|
|
if(_66c>0){
|
|
col.boxWidth=_66c;
|
|
_669=true;
|
|
}
|
|
}
|
|
});
|
|
if(_669){
|
|
$(_65d).datagrid("fixColumnSize");
|
|
}
|
|
};
|
|
function _660(fit){
|
|
var _66d=dc.header1.add(dc.header2).find(".datagrid-cell-group");
|
|
if(_66d.length){
|
|
_66d.each(function(){
|
|
$(this)._outerWidth(fit?$(this).parent().width():10);
|
|
});
|
|
if(fit){
|
|
_5e6(_65d);
|
|
}
|
|
}
|
|
};
|
|
function _665(col){
|
|
if(String(col.width||"").indexOf("%")>=0){
|
|
return false;
|
|
}
|
|
if(!col.hidden&&!col.checkbox&&!col.auto&&!col.fixed){
|
|
return true;
|
|
}
|
|
};
|
|
};
|
|
function _66e(_66f,_670){
|
|
var _671=$.data(_66f,"datagrid");
|
|
var opts=_671.options;
|
|
var dc=_671.dc;
|
|
var tmp=$("<div class=\"datagrid-cell\" style=\"position:absolute;left:-9999px\"></div>").appendTo("body");
|
|
if(_670){
|
|
_5e1(_670);
|
|
$(_66f).datagrid("fitColumns");
|
|
}else{
|
|
var _672=false;
|
|
var _673=_627(_66f,true).concat(_627(_66f,false));
|
|
for(var i=0;i<_673.length;i++){
|
|
var _670=_673[i];
|
|
var col=_628(_66f,_670);
|
|
if(col.auto){
|
|
_5e1(_670);
|
|
_672=true;
|
|
}
|
|
}
|
|
if(_672){
|
|
$(_66f).datagrid("fitColumns");
|
|
}
|
|
}
|
|
tmp.remove();
|
|
function _5e1(_674){
|
|
var _675=dc.view.find("div.datagrid-header td[field=\""+_674+"\"] div.datagrid-cell");
|
|
_675.css("width","");
|
|
var col=$(_66f).datagrid("getColumnOption",_674);
|
|
col.width=undefined;
|
|
col.boxWidth=undefined;
|
|
col.auto=true;
|
|
$(_66f).datagrid("fixColumnSize",_674);
|
|
var _676=Math.max(_677("header"),_677("allbody"),_677("allfooter"))+1;
|
|
_675._outerWidth(_676-1);
|
|
col.width=_676;
|
|
col.boxWidth=parseInt(_675[0].style.width);
|
|
col.deltaWidth=_676-col.boxWidth;
|
|
_675.css("width","");
|
|
$(_66f).datagrid("fixColumnSize",_674);
|
|
opts.onResizeColumn.call(_66f,_674,col.width);
|
|
function _677(type){
|
|
var _678=0;
|
|
if(type=="header"){
|
|
_678=_679(_675);
|
|
}else{
|
|
opts.finder.getTr(_66f,0,type).find("td[field=\""+_674+"\"] div.datagrid-cell").each(function(){
|
|
var w=_679($(this));
|
|
if(_678<w){
|
|
_678=w;
|
|
}
|
|
});
|
|
}
|
|
return _678;
|
|
function _679(cell){
|
|
return cell.is(":visible")?cell._outerWidth():tmp.html(cell.html())._outerWidth();
|
|
};
|
|
};
|
|
};
|
|
};
|
|
function _67a(_67b,_67c){
|
|
var _67d=$.data(_67b,"datagrid");
|
|
var opts=_67d.options;
|
|
var dc=_67d.dc;
|
|
var _67e=dc.view.find("table.datagrid-btable,table.datagrid-ftable");
|
|
_67e.css("table-layout","fixed");
|
|
if(_67c){
|
|
fix(_67c);
|
|
}else{
|
|
var ff=_627(_67b,true).concat(_627(_67b,false));
|
|
for(var i=0;i<ff.length;i++){
|
|
fix(ff[i]);
|
|
}
|
|
}
|
|
_67e.css("table-layout","");
|
|
_67f(_67b);
|
|
_5f7(_67b);
|
|
_680(_67b);
|
|
function fix(_681){
|
|
var col=_628(_67b,_681);
|
|
if(col.cellClass){
|
|
_67d.ss.set("."+col.cellClass,col.boxWidth?col.boxWidth+"px":"auto");
|
|
}
|
|
};
|
|
};
|
|
function _67f(_682){
|
|
var dc=$.data(_682,"datagrid").dc;
|
|
dc.view.find("td.datagrid-td-merged").each(function(){
|
|
var td=$(this);
|
|
var _683=td.attr("colspan")||1;
|
|
var col=_628(_682,td.attr("field"));
|
|
var _684=col.boxWidth+col.deltaWidth-1;
|
|
for(var i=1;i<_683;i++){
|
|
td=td.next();
|
|
col=_628(_682,td.attr("field"));
|
|
_684+=col.boxWidth+col.deltaWidth;
|
|
}
|
|
$(this).children("div.datagrid-cell")._outerWidth(_684);
|
|
});
|
|
};
|
|
function _680(_685){
|
|
var dc=$.data(_685,"datagrid").dc;
|
|
dc.view.find("div.datagrid-editable").each(function(){
|
|
var cell=$(this);
|
|
var _686=cell.parent().attr("field");
|
|
var col=$(_685).datagrid("getColumnOption",_686);
|
|
cell._outerWidth(col.boxWidth+col.deltaWidth-1);
|
|
var ed=$.data(this,"datagrid.editor");
|
|
if(ed.actions.resize){
|
|
ed.actions.resize(ed.target,cell.width());
|
|
}
|
|
});
|
|
};
|
|
function _628(_687,_688){
|
|
function find(_689){
|
|
if(_689){
|
|
for(var i=0;i<_689.length;i++){
|
|
var cc=_689[i];
|
|
for(var j=0;j<cc.length;j++){
|
|
var c=cc[j];
|
|
if(c.field==_688){
|
|
return c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
var opts=$.data(_687,"datagrid").options;
|
|
var col=find(opts.columns);
|
|
if(!col){
|
|
col=find(opts.frozenColumns);
|
|
}
|
|
return col;
|
|
};
|
|
function _627(_68a,_68b){
|
|
var opts=$.data(_68a,"datagrid").options;
|
|
var _68c=(_68b==true)?(opts.frozenColumns||[[]]):opts.columns;
|
|
if(_68c.length==0){
|
|
return [];
|
|
}
|
|
var aa=[];
|
|
var _68d=_68e();
|
|
for(var i=0;i<_68c.length;i++){
|
|
aa[i]=new Array(_68d);
|
|
}
|
|
for(var _68f=0;_68f<_68c.length;_68f++){
|
|
$.map(_68c[_68f],function(col){
|
|
var _690=_691(aa[_68f]);
|
|
if(_690>=0){
|
|
var _692=col.field||"";
|
|
for(var c=0;c<(col.colspan||1);c++){
|
|
for(var r=0;r<(col.rowspan||1);r++){
|
|
aa[_68f+r][_690]=_692;
|
|
}
|
|
_690++;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return aa[aa.length-1];
|
|
function _68e(){
|
|
var _693=0;
|
|
$.map(_68c[0],function(col){
|
|
_693+=col.colspan||1;
|
|
});
|
|
return _693;
|
|
};
|
|
function _691(a){
|
|
for(var i=0;i<a.length;i++){
|
|
if(a[i]==undefined){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
};
|
|
function _65b(_694,data){
|
|
var _695=$.data(_694,"datagrid");
|
|
var opts=_695.options;
|
|
var dc=_695.dc;
|
|
data=opts.loadFilter.call(_694,data);
|
|
data.total=parseInt(data.total);
|
|
_695.data=data;
|
|
if(data.footer){
|
|
_695.footer=data.footer;
|
|
}
|
|
if(!opts.remoteSort&&opts.sortName){
|
|
var _696=opts.sortName.split(",");
|
|
var _697=opts.sortOrder.split(",");
|
|
data.rows.sort(function(r1,r2){
|
|
var r=0;
|
|
for(var i=0;i<_696.length;i++){
|
|
var sn=_696[i];
|
|
var so=_697[i];
|
|
var col=_628(_694,sn);
|
|
var _698=col.sorter||function(a,b){
|
|
return a==b?0:(a>b?1:-1);
|
|
};
|
|
r=_698(r1[sn],r2[sn])*(so=="asc"?1:-1);
|
|
if(r!=0){
|
|
return r;
|
|
}
|
|
}
|
|
return r;
|
|
});
|
|
}
|
|
if(opts.view.onBeforeRender){
|
|
opts.view.onBeforeRender.call(opts.view,_694,data.rows);
|
|
}
|
|
opts.view.render.call(opts.view,_694,dc.body2,false);
|
|
opts.view.render.call(opts.view,_694,dc.body1,true);
|
|
if(opts.showFooter){
|
|
opts.view.renderFooter.call(opts.view,_694,dc.footer2,false);
|
|
opts.view.renderFooter.call(opts.view,_694,dc.footer1,true);
|
|
}
|
|
if(opts.view.onAfterRender){
|
|
opts.view.onAfterRender.call(opts.view,_694);
|
|
}
|
|
_695.ss.clean();
|
|
var _699=$(_694).datagrid("getPager");
|
|
if(_699.length){
|
|
var _69a=_699.pagination("options");
|
|
if(_69a.total!=data.total){
|
|
_699.pagination("refresh",{total:data.total});
|
|
if(opts.pageNumber!=_69a.pageNumber&&_69a.pageNumber>0){
|
|
opts.pageNumber=_69a.pageNumber;
|
|
_65a(_694);
|
|
}
|
|
}
|
|
}
|
|
_5f7(_694);
|
|
dc.body2.triggerHandler("scroll");
|
|
$(_694).datagrid("setSelectionState");
|
|
$(_694).datagrid("autoSizeColumn");
|
|
opts.onLoadSuccess.call(_694,data);
|
|
};
|
|
function _69b(_69c){
|
|
var _69d=$.data(_69c,"datagrid");
|
|
var opts=_69d.options;
|
|
var dc=_69d.dc;
|
|
dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked",false);
|
|
if(opts.idField){
|
|
var _69e=$.data(_69c,"treegrid")?true:false;
|
|
var _69f=opts.onSelect;
|
|
var _6a0=opts.onCheck;
|
|
opts.onSelect=opts.onCheck=function(){
|
|
};
|
|
var rows=opts.finder.getRows(_69c);
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
var _6a1=_69e?row[opts.idField]:i;
|
|
if(_6a2(_69d.selectedRows,row)){
|
|
_643(_69c,_6a1,true);
|
|
}
|
|
if(_6a2(_69d.checkedRows,row)){
|
|
_640(_69c,_6a1,true);
|
|
}
|
|
}
|
|
opts.onSelect=_69f;
|
|
opts.onCheck=_6a0;
|
|
}
|
|
function _6a2(a,r){
|
|
for(var i=0;i<a.length;i++){
|
|
if(a[i][opts.idField]==r[opts.idField]){
|
|
a[i]=r;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
};
|
|
function _6a3(_6a4,row){
|
|
var _6a5=$.data(_6a4,"datagrid");
|
|
var opts=_6a5.options;
|
|
var rows=_6a5.data.rows;
|
|
if(typeof row=="object"){
|
|
return _5cc(rows,row);
|
|
}else{
|
|
for(var i=0;i<rows.length;i++){
|
|
if(rows[i][opts.idField]==row){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
};
|
|
function _6a6(_6a7){
|
|
var _6a8=$.data(_6a7,"datagrid");
|
|
var opts=_6a8.options;
|
|
var data=_6a8.data;
|
|
if(opts.idField){
|
|
return _6a8.selectedRows;
|
|
}else{
|
|
var rows=[];
|
|
opts.finder.getTr(_6a7,"","selected",2).each(function(){
|
|
rows.push(opts.finder.getRow(_6a7,$(this)));
|
|
});
|
|
return rows;
|
|
}
|
|
};
|
|
function _6a9(_6aa){
|
|
var _6ab=$.data(_6aa,"datagrid");
|
|
var opts=_6ab.options;
|
|
if(opts.idField){
|
|
return _6ab.checkedRows;
|
|
}else{
|
|
var rows=[];
|
|
opts.finder.getTr(_6aa,"","checked",2).each(function(){
|
|
rows.push(opts.finder.getRow(_6aa,$(this)));
|
|
});
|
|
return rows;
|
|
}
|
|
};
|
|
function _6ac(_6ad,_6ae){
|
|
var _6af=$.data(_6ad,"datagrid");
|
|
var dc=_6af.dc;
|
|
var opts=_6af.options;
|
|
var tr=opts.finder.getTr(_6ad,_6ae);
|
|
if(tr.length){
|
|
if(tr.closest("table").hasClass("datagrid-btable-frozen")){
|
|
return;
|
|
}
|
|
var _6b0=dc.view2.children("div.datagrid-header")._outerHeight();
|
|
var _6b1=dc.body2;
|
|
var _6b2=_6b1.outerHeight(true)-_6b1.outerHeight();
|
|
var top=tr.position().top-_6b0-_6b2;
|
|
if(top<0){
|
|
_6b1.scrollTop(_6b1.scrollTop()+top);
|
|
}else{
|
|
if(top+tr._outerHeight()>_6b1.height()-18){
|
|
_6b1.scrollTop(_6b1.scrollTop()+top+tr._outerHeight()-_6b1.height()+18);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function _63c(_6b3,_6b4){
|
|
var _6b5=$.data(_6b3,"datagrid");
|
|
var opts=_6b5.options;
|
|
opts.finder.getTr(_6b3,_6b5.highlightIndex).removeClass("datagrid-row-over");
|
|
opts.finder.getTr(_6b3,_6b4).addClass("datagrid-row-over");
|
|
_6b5.highlightIndex=_6b4;
|
|
};
|
|
function _643(_6b6,_6b7,_6b8){
|
|
var _6b9=$.data(_6b6,"datagrid");
|
|
var opts=_6b9.options;
|
|
var row=opts.finder.getRow(_6b6,_6b7);
|
|
if(opts.onBeforeSelect.apply(_6b6,_5d0(_6b6,[_6b7,row]))==false){
|
|
return;
|
|
}
|
|
if(opts.singleSelect){
|
|
_6ba(_6b6,true);
|
|
_6b9.selectedRows=[];
|
|
}
|
|
if(!_6b8&&opts.checkOnSelect){
|
|
_640(_6b6,_6b7,true);
|
|
}
|
|
if(opts.idField){
|
|
_5cf(_6b9.selectedRows,opts.idField,row);
|
|
}
|
|
opts.finder.getTr(_6b6,_6b7).addClass("datagrid-row-selected");
|
|
opts.onSelect.apply(_6b6,_5d0(_6b6,[_6b7,row]));
|
|
_6ac(_6b6,_6b7);
|
|
};
|
|
function _644(_6bb,_6bc,_6bd){
|
|
var _6be=$.data(_6bb,"datagrid");
|
|
var dc=_6be.dc;
|
|
var opts=_6be.options;
|
|
var row=opts.finder.getRow(_6bb,_6bc);
|
|
if(opts.onBeforeUnselect.apply(_6bb,_5d0(_6bb,[_6bc,row]))==false){
|
|
return;
|
|
}
|
|
if(!_6bd&&opts.checkOnSelect){
|
|
_641(_6bb,_6bc,true);
|
|
}
|
|
opts.finder.getTr(_6bb,_6bc).removeClass("datagrid-row-selected");
|
|
if(opts.idField){
|
|
_5cd(_6be.selectedRows,opts.idField,row[opts.idField]);
|
|
}
|
|
opts.onUnselect.apply(_6bb,_5d0(_6bb,[_6bc,row]));
|
|
};
|
|
function _6bf(_6c0,_6c1){
|
|
var _6c2=$.data(_6c0,"datagrid");
|
|
var opts=_6c2.options;
|
|
var rows=opts.finder.getRows(_6c0);
|
|
var _6c3=$.data(_6c0,"datagrid").selectedRows;
|
|
if(!_6c1&&opts.checkOnSelect){
|
|
_6c4(_6c0,true);
|
|
}
|
|
opts.finder.getTr(_6c0,"","allbody").addClass("datagrid-row-selected");
|
|
if(opts.idField){
|
|
for(var _6c5=0;_6c5<rows.length;_6c5++){
|
|
_5cf(_6c3,opts.idField,rows[_6c5]);
|
|
}
|
|
}
|
|
opts.onSelectAll.call(_6c0,rows);
|
|
};
|
|
function _6ba(_6c6,_6c7){
|
|
var _6c8=$.data(_6c6,"datagrid");
|
|
var opts=_6c8.options;
|
|
var rows=opts.finder.getRows(_6c6);
|
|
var _6c9=$.data(_6c6,"datagrid").selectedRows;
|
|
if(!_6c7&&opts.checkOnSelect){
|
|
_6ca(_6c6,true);
|
|
}
|
|
opts.finder.getTr(_6c6,"","selected").removeClass("datagrid-row-selected");
|
|
if(opts.idField){
|
|
for(var _6cb=0;_6cb<rows.length;_6cb++){
|
|
_5cd(_6c9,opts.idField,rows[_6cb][opts.idField]);
|
|
}
|
|
}
|
|
opts.onUnselectAll.call(_6c6,rows);
|
|
};
|
|
function _640(_6cc,_6cd,_6ce){
|
|
var _6cf=$.data(_6cc,"datagrid");
|
|
var opts=_6cf.options;
|
|
var row=opts.finder.getRow(_6cc,_6cd);
|
|
if(opts.onBeforeCheck.apply(_6cc,_5d0(_6cc,[_6cd,row]))==false){
|
|
return;
|
|
}
|
|
if(opts.singleSelect&&opts.selectOnCheck){
|
|
_6ca(_6cc,true);
|
|
_6cf.checkedRows=[];
|
|
}
|
|
if(!_6ce&&opts.selectOnCheck){
|
|
_643(_6cc,_6cd,true);
|
|
}
|
|
var tr=opts.finder.getTr(_6cc,_6cd).addClass("datagrid-row-checked");
|
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true);
|
|
tr=opts.finder.getTr(_6cc,"","checked",2);
|
|
if(tr.length==opts.finder.getRows(_6cc).length){
|
|
var dc=_6cf.dc;
|
|
dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked",true);
|
|
}
|
|
if(opts.idField){
|
|
_5cf(_6cf.checkedRows,opts.idField,row);
|
|
}
|
|
opts.onCheck.apply(_6cc,_5d0(_6cc,[_6cd,row]));
|
|
};
|
|
function _641(_6d0,_6d1,_6d2){
|
|
var _6d3=$.data(_6d0,"datagrid");
|
|
var opts=_6d3.options;
|
|
var row=opts.finder.getRow(_6d0,_6d1);
|
|
if(opts.onBeforeUncheck.apply(_6d0,_5d0(_6d0,[_6d1,row]))==false){
|
|
return;
|
|
}
|
|
if(!_6d2&&opts.selectOnCheck){
|
|
_644(_6d0,_6d1,true);
|
|
}
|
|
var tr=opts.finder.getTr(_6d0,_6d1).removeClass("datagrid-row-checked");
|
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",false);
|
|
var dc=_6d3.dc;
|
|
var _6d4=dc.header1.add(dc.header2);
|
|
_6d4.find("input[type=checkbox]")._propAttr("checked",false);
|
|
if(opts.idField){
|
|
_5cd(_6d3.checkedRows,opts.idField,row[opts.idField]);
|
|
}
|
|
opts.onUncheck.apply(_6d0,_5d0(_6d0,[_6d1,row]));
|
|
};
|
|
function _6c4(_6d5,_6d6){
|
|
var _6d7=$.data(_6d5,"datagrid");
|
|
var opts=_6d7.options;
|
|
var rows=opts.finder.getRows(_6d5);
|
|
if(!_6d6&&opts.selectOnCheck){
|
|
_6bf(_6d5,true);
|
|
}
|
|
var dc=_6d7.dc;
|
|
var hck=dc.header1.add(dc.header2).find("input[type=checkbox]");
|
|
var bck=opts.finder.getTr(_6d5,"","allbody").addClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]");
|
|
hck.add(bck)._propAttr("checked",true);
|
|
if(opts.idField){
|
|
for(var i=0;i<rows.length;i++){
|
|
_5cf(_6d7.checkedRows,opts.idField,rows[i]);
|
|
}
|
|
}
|
|
opts.onCheckAll.call(_6d5,rows);
|
|
};
|
|
function _6ca(_6d8,_6d9){
|
|
var _6da=$.data(_6d8,"datagrid");
|
|
var opts=_6da.options;
|
|
var rows=opts.finder.getRows(_6d8);
|
|
if(!_6d9&&opts.selectOnCheck){
|
|
_6ba(_6d8,true);
|
|
}
|
|
var dc=_6da.dc;
|
|
var hck=dc.header1.add(dc.header2).find("input[type=checkbox]");
|
|
var bck=opts.finder.getTr(_6d8,"","checked").removeClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]");
|
|
hck.add(bck)._propAttr("checked",false);
|
|
if(opts.idField){
|
|
for(var i=0;i<rows.length;i++){
|
|
_5cd(_6da.checkedRows,opts.idField,rows[i][opts.idField]);
|
|
}
|
|
}
|
|
opts.onUncheckAll.call(_6d8,rows);
|
|
};
|
|
function _6db(_6dc,_6dd){
|
|
var opts=$.data(_6dc,"datagrid").options;
|
|
var tr=opts.finder.getTr(_6dc,_6dd);
|
|
var row=opts.finder.getRow(_6dc,_6dd);
|
|
if(tr.hasClass("datagrid-row-editing")){
|
|
return;
|
|
}
|
|
if(opts.onBeforeEdit.apply(_6dc,_5d0(_6dc,[_6dd,row]))==false){
|
|
return;
|
|
}
|
|
tr.addClass("datagrid-row-editing");
|
|
_6de(_6dc,_6dd);
|
|
_680(_6dc);
|
|
tr.find("div.datagrid-editable").each(function(){
|
|
var _6df=$(this).parent().attr("field");
|
|
var ed=$.data(this,"datagrid.editor");
|
|
ed.actions.setValue(ed.target,row[_6df]);
|
|
});
|
|
_6e0(_6dc,_6dd);
|
|
opts.onBeginEdit.apply(_6dc,_5d0(_6dc,[_6dd,row]));
|
|
};
|
|
function _6e1(_6e2,_6e3,_6e4){
|
|
var _6e5=$.data(_6e2,"datagrid");
|
|
var opts=_6e5.options;
|
|
var _6e6=_6e5.updatedRows;
|
|
var _6e7=_6e5.insertedRows;
|
|
var tr=opts.finder.getTr(_6e2,_6e3);
|
|
var row=opts.finder.getRow(_6e2,_6e3);
|
|
if(!tr.hasClass("datagrid-row-editing")){
|
|
return;
|
|
}
|
|
if(!_6e4){
|
|
if(!_6e0(_6e2,_6e3)){
|
|
return;
|
|
}
|
|
var _6e8=false;
|
|
var _6e9={};
|
|
tr.find("div.datagrid-editable").each(function(){
|
|
var _6ea=$(this).parent().attr("field");
|
|
var ed=$.data(this,"datagrid.editor");
|
|
var t=$(ed.target);
|
|
var _6eb=t.data("textbox")?t.textbox("textbox"):t;
|
|
_6eb.triggerHandler("blur");
|
|
var _6ec=ed.actions.getValue(ed.target);
|
|
if(row[_6ea]!=_6ec){
|
|
row[_6ea]=_6ec;
|
|
_6e8=true;
|
|
_6e9[_6ea]=_6ec;
|
|
}
|
|
});
|
|
if(_6e8){
|
|
if(_5cc(_6e7,row)==-1){
|
|
if(_5cc(_6e6,row)==-1){
|
|
_6e6.push(row);
|
|
}
|
|
}
|
|
}
|
|
opts.onEndEdit.apply(_6e2,_5d0(_6e2,[_6e3,row,_6e9]));
|
|
}
|
|
tr.removeClass("datagrid-row-editing");
|
|
_6ed(_6e2,_6e3);
|
|
$(_6e2).datagrid("refreshRow",_6e3);
|
|
if(!_6e4){
|
|
opts.onAfterEdit.apply(_6e2,_5d0(_6e2,[_6e3,row,_6e9]));
|
|
}else{
|
|
opts.onCancelEdit.apply(_6e2,_5d0(_6e2,[_6e3,row]));
|
|
}
|
|
};
|
|
function _6ee(_6ef,_6f0){
|
|
var opts=$.data(_6ef,"datagrid").options;
|
|
var tr=opts.finder.getTr(_6ef,_6f0);
|
|
var _6f1=[];
|
|
tr.children("td").each(function(){
|
|
var cell=$(this).find("div.datagrid-editable");
|
|
if(cell.length){
|
|
var ed=$.data(cell[0],"datagrid.editor");
|
|
_6f1.push(ed);
|
|
}
|
|
});
|
|
return _6f1;
|
|
};
|
|
function _6f2(_6f3,_6f4){
|
|
var _6f5=_6ee(_6f3,_6f4.index!=undefined?_6f4.index:_6f4.id);
|
|
for(var i=0;i<_6f5.length;i++){
|
|
if(_6f5[i].field==_6f4.field){
|
|
return _6f5[i];
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _6de(_6f6,_6f7){
|
|
var opts=$.data(_6f6,"datagrid").options;
|
|
var tr=opts.finder.getTr(_6f6,_6f7);
|
|
tr.children("td").each(function(){
|
|
var cell=$(this).find("div.datagrid-cell");
|
|
var _6f8=$(this).attr("field");
|
|
var col=_628(_6f6,_6f8);
|
|
if(col&&col.editor){
|
|
var _6f9,_6fa;
|
|
if(typeof col.editor=="string"){
|
|
_6f9=col.editor;
|
|
}else{
|
|
_6f9=col.editor.type;
|
|
_6fa=col.editor.options;
|
|
}
|
|
var _6fb=opts.editors[_6f9];
|
|
if(_6fb){
|
|
var _6fc=cell.html();
|
|
var _6fd=cell._outerWidth();
|
|
cell.addClass("datagrid-editable");
|
|
cell._outerWidth(_6fd);
|
|
cell.html("<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\"><tr><td></td></tr></table>");
|
|
cell.children("table").bind("click dblclick contextmenu",function(e){
|
|
e.stopPropagation();
|
|
});
|
|
$.data(cell[0],"datagrid.editor",{actions:_6fb,target:_6fb.init(cell.find("td"),_6fa),field:_6f8,type:_6f9,oldHtml:_6fc});
|
|
}
|
|
}
|
|
});
|
|
_5f7(_6f6,_6f7,true);
|
|
};
|
|
function _6ed(_6fe,_6ff){
|
|
var opts=$.data(_6fe,"datagrid").options;
|
|
var tr=opts.finder.getTr(_6fe,_6ff);
|
|
tr.children("td").each(function(){
|
|
var cell=$(this).find("div.datagrid-editable");
|
|
if(cell.length){
|
|
var ed=$.data(cell[0],"datagrid.editor");
|
|
if(ed.actions.destroy){
|
|
ed.actions.destroy(ed.target);
|
|
}
|
|
cell.html(ed.oldHtml);
|
|
$.removeData(cell[0],"datagrid.editor");
|
|
cell.removeClass("datagrid-editable");
|
|
cell.css("width","");
|
|
}
|
|
});
|
|
};
|
|
function _6e0(_700,_701){
|
|
var tr=$.data(_700,"datagrid").options.finder.getTr(_700,_701);
|
|
if(!tr.hasClass("datagrid-row-editing")){
|
|
return true;
|
|
}
|
|
var vbox=tr.find(".validatebox-text");
|
|
vbox.validatebox("validate");
|
|
vbox.trigger("mouseleave");
|
|
var _702=tr.find(".validatebox-invalid");
|
|
return _702.length==0;
|
|
};
|
|
function _703(_704,_705){
|
|
var _706=$.data(_704,"datagrid").insertedRows;
|
|
var _707=$.data(_704,"datagrid").deletedRows;
|
|
var _708=$.data(_704,"datagrid").updatedRows;
|
|
if(!_705){
|
|
var rows=[];
|
|
rows=rows.concat(_706);
|
|
rows=rows.concat(_707);
|
|
rows=rows.concat(_708);
|
|
return rows;
|
|
}else{
|
|
if(_705=="inserted"){
|
|
return _706;
|
|
}else{
|
|
if(_705=="deleted"){
|
|
return _707;
|
|
}else{
|
|
if(_705=="updated"){
|
|
return _708;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return [];
|
|
};
|
|
function _709(_70a,_70b){
|
|
var _70c=$.data(_70a,"datagrid");
|
|
var opts=_70c.options;
|
|
var data=_70c.data;
|
|
var _70d=_70c.insertedRows;
|
|
var _70e=_70c.deletedRows;
|
|
$(_70a).datagrid("cancelEdit",_70b);
|
|
var row=opts.finder.getRow(_70a,_70b);
|
|
if(_5cc(_70d,row)>=0){
|
|
_5cd(_70d,row);
|
|
}else{
|
|
_70e.push(row);
|
|
}
|
|
_5cd(_70c.selectedRows,opts.idField,row[opts.idField]);
|
|
_5cd(_70c.checkedRows,opts.idField,row[opts.idField]);
|
|
opts.view.deleteRow.call(opts.view,_70a,_70b);
|
|
if(opts.height=="auto"){
|
|
_5f7(_70a);
|
|
}
|
|
$(_70a).datagrid("getPager").pagination("refresh",{total:data.total});
|
|
};
|
|
function _70f(_710,_711){
|
|
var data=$.data(_710,"datagrid").data;
|
|
var view=$.data(_710,"datagrid").options.view;
|
|
var _712=$.data(_710,"datagrid").insertedRows;
|
|
view.insertRow.call(view,_710,_711.index,_711.row);
|
|
_712.push(_711.row);
|
|
$(_710).datagrid("getPager").pagination("refresh",{total:data.total});
|
|
};
|
|
function _713(_714,row){
|
|
var data=$.data(_714,"datagrid").data;
|
|
var view=$.data(_714,"datagrid").options.view;
|
|
var _715=$.data(_714,"datagrid").insertedRows;
|
|
view.insertRow.call(view,_714,null,row);
|
|
_715.push(row);
|
|
$(_714).datagrid("getPager").pagination("refresh",{total:data.total});
|
|
};
|
|
function _716(_717){
|
|
var _718=$.data(_717,"datagrid");
|
|
var data=_718.data;
|
|
var rows=data.rows;
|
|
var _719=[];
|
|
for(var i=0;i<rows.length;i++){
|
|
_719.push($.extend({},rows[i]));
|
|
}
|
|
_718.originalRows=_719;
|
|
_718.updatedRows=[];
|
|
_718.insertedRows=[];
|
|
_718.deletedRows=[];
|
|
};
|
|
function _71a(_71b){
|
|
var data=$.data(_71b,"datagrid").data;
|
|
var ok=true;
|
|
for(var i=0,len=data.rows.length;i<len;i++){
|
|
if(_6e0(_71b,i)){
|
|
$(_71b).datagrid("endEdit",i);
|
|
}else{
|
|
ok=false;
|
|
}
|
|
}
|
|
if(ok){
|
|
_716(_71b);
|
|
}
|
|
};
|
|
function _71c(_71d){
|
|
var _71e=$.data(_71d,"datagrid");
|
|
var opts=_71e.options;
|
|
var _71f=_71e.originalRows;
|
|
var _720=_71e.insertedRows;
|
|
var _721=_71e.deletedRows;
|
|
var _722=_71e.selectedRows;
|
|
var _723=_71e.checkedRows;
|
|
var data=_71e.data;
|
|
function _724(a){
|
|
var ids=[];
|
|
for(var i=0;i<a.length;i++){
|
|
ids.push(a[i][opts.idField]);
|
|
}
|
|
return ids;
|
|
};
|
|
function _725(ids,_726){
|
|
for(var i=0;i<ids.length;i++){
|
|
var _727=_6a3(_71d,ids[i]);
|
|
if(_727>=0){
|
|
(_726=="s"?_643:_640)(_71d,_727,true);
|
|
}
|
|
}
|
|
};
|
|
for(var i=0;i<data.rows.length;i++){
|
|
$(_71d).datagrid("cancelEdit",i);
|
|
}
|
|
var _728=_724(_722);
|
|
var _729=_724(_723);
|
|
_722.splice(0,_722.length);
|
|
_723.splice(0,_723.length);
|
|
data.total+=_721.length-_720.length;
|
|
data.rows=_71f;
|
|
_65b(_71d,data);
|
|
_725(_728,"s");
|
|
_725(_729,"c");
|
|
_716(_71d);
|
|
};
|
|
function _65a(_72a,_72b,cb){
|
|
var opts=$.data(_72a,"datagrid").options;
|
|
if(_72b){
|
|
opts.queryParams=_72b;
|
|
}
|
|
var _72c=$.extend({},opts.queryParams);
|
|
if(opts.pagination){
|
|
$.extend(_72c,{page:opts.pageNumber||1,rows:opts.pageSize});
|
|
}
|
|
if(opts.sortName){
|
|
$.extend(_72c,{sort:opts.sortName,order:opts.sortOrder});
|
|
}
|
|
if(opts.onBeforeLoad.call(_72a,_72c)==false){
|
|
return;
|
|
}
|
|
$(_72a).datagrid("loading");
|
|
var _72d=opts.loader.call(_72a,_72c,function(data){
|
|
$(_72a).datagrid("loaded");
|
|
$(_72a).datagrid("loadData",data);
|
|
if(cb){
|
|
cb();
|
|
}
|
|
},function(){
|
|
$(_72a).datagrid("loaded");
|
|
opts.onLoadError.apply(_72a,arguments);
|
|
});
|
|
if(_72d==false){
|
|
$(_72a).datagrid("loaded");
|
|
}
|
|
};
|
|
function _72e(_72f,_730){
|
|
var opts=$.data(_72f,"datagrid").options;
|
|
_730.type=_730.type||"body";
|
|
_730.rowspan=_730.rowspan||1;
|
|
_730.colspan=_730.colspan||1;
|
|
if(_730.rowspan==1&&_730.colspan==1){
|
|
return;
|
|
}
|
|
var tr=opts.finder.getTr(_72f,(_730.index!=undefined?_730.index:_730.id),_730.type);
|
|
if(!tr.length){
|
|
return;
|
|
}
|
|
var td=tr.find("td[field=\""+_730.field+"\"]");
|
|
td.attr("rowspan",_730.rowspan).attr("colspan",_730.colspan);
|
|
td.addClass("datagrid-td-merged");
|
|
_731(td.next(),_730.colspan-1);
|
|
for(var i=1;i<_730.rowspan;i++){
|
|
tr=tr.next();
|
|
if(!tr.length){
|
|
break;
|
|
}
|
|
td=tr.find("td[field=\""+_730.field+"\"]");
|
|
_731(td,_730.colspan);
|
|
}
|
|
_67f(_72f);
|
|
function _731(td,_732){
|
|
for(var i=0;i<_732;i++){
|
|
td.hide();
|
|
td=td.next();
|
|
}
|
|
};
|
|
};
|
|
$.fn.datagrid=function(_733,_734){
|
|
if(typeof _733=="string"){
|
|
return $.fn.datagrid.methods[_733](this,_734);
|
|
}
|
|
_733=_733||{};
|
|
return this.each(function(){
|
|
var _735=$.data(this,"datagrid");
|
|
var opts;
|
|
if(_735){
|
|
opts=$.extend(_735.options,_733);
|
|
_735.options=opts;
|
|
}else{
|
|
opts=$.extend({},$.extend({},$.fn.datagrid.defaults,{queryParams:{}}),$.fn.datagrid.parseOptions(this),_733);
|
|
$(this).css("width","").css("height","");
|
|
var _736=_60b(this,opts.rownumbers);
|
|
if(!opts.columns){
|
|
opts.columns=_736.columns;
|
|
}
|
|
if(!opts.frozenColumns){
|
|
opts.frozenColumns=_736.frozenColumns;
|
|
}
|
|
opts.columns=$.extend(true,[],opts.columns);
|
|
opts.frozenColumns=$.extend(true,[],opts.frozenColumns);
|
|
opts.view=$.extend({},opts.view);
|
|
$.data(this,"datagrid",{options:opts,panel:_736.panel,dc:_736.dc,ss:null,selectedRows:[],checkedRows:[],data:{total:0,rows:[]},originalRows:[],updatedRows:[],insertedRows:[],deletedRows:[]});
|
|
}
|
|
_614(this);
|
|
_629(this);
|
|
_5e1(this);
|
|
if(opts.data){
|
|
$(this).datagrid("loadData",opts.data);
|
|
}else{
|
|
var data=$.fn.datagrid.parseData(this);
|
|
if(data.total>0){
|
|
$(this).datagrid("loadData",data);
|
|
}else{
|
|
opts.view.renderEmptyRow(this);
|
|
$(this).datagrid("autoSizeColumn");
|
|
}
|
|
}
|
|
_65a(this);
|
|
});
|
|
};
|
|
function _737(_738){
|
|
var _739={};
|
|
$.map(_738,function(name){
|
|
_739[name]=_73a(name);
|
|
});
|
|
return _739;
|
|
function _73a(name){
|
|
function isA(_73b){
|
|
return $.data($(_73b)[0],name)!=undefined;
|
|
};
|
|
return {init:function(_73c,_73d){
|
|
var _73e=$("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_73c);
|
|
if(_73e[name]&&name!="text"){
|
|
return _73e[name](_73d);
|
|
}else{
|
|
return _73e;
|
|
}
|
|
},destroy:function(_73f){
|
|
if(isA(_73f,name)){
|
|
$(_73f)[name]("destroy");
|
|
}
|
|
},getValue:function(_740){
|
|
if(isA(_740,name)){
|
|
var opts=$(_740)[name]("options");
|
|
if(opts.multiple){
|
|
return $(_740)[name]("getValues").join(opts.separator);
|
|
}else{
|
|
return $(_740)[name]("getValue");
|
|
}
|
|
}else{
|
|
return $(_740).val();
|
|
}
|
|
},setValue:function(_741,_742){
|
|
if(isA(_741,name)){
|
|
var opts=$(_741)[name]("options");
|
|
if(opts.multiple){
|
|
if(_742){
|
|
$(_741)[name]("setValues",_742.split(opts.separator));
|
|
}else{
|
|
$(_741)[name]("clear");
|
|
}
|
|
}else{
|
|
$(_741)[name]("setValue",_742);
|
|
}
|
|
}else{
|
|
$(_741).val(_742);
|
|
}
|
|
},resize:function(_743,_744){
|
|
if(isA(_743,name)){
|
|
$(_743)[name]("resize",_744);
|
|
}else{
|
|
$(_743)._outerWidth(_744)._outerHeight(22);
|
|
}
|
|
}};
|
|
};
|
|
};
|
|
var _745=$.extend({},_737(["text","textbox","numberbox","numberspinner","combobox","combotree","combogrid","datebox","datetimebox","timespinner","datetimespinner"]),{textarea:{init:function(_746,_747){
|
|
var _748=$("<textarea class=\"datagrid-editable-input\"></textarea>").appendTo(_746);
|
|
return _748;
|
|
},getValue:function(_749){
|
|
return $(_749).val();
|
|
},setValue:function(_74a,_74b){
|
|
$(_74a).val(_74b);
|
|
},resize:function(_74c,_74d){
|
|
$(_74c)._outerWidth(_74d);
|
|
}},checkbox:{init:function(_74e,_74f){
|
|
var _750=$("<input type=\"checkbox\">").appendTo(_74e);
|
|
_750.val(_74f.on);
|
|
_750.attr("offval",_74f.off);
|
|
return _750;
|
|
},getValue:function(_751){
|
|
if($(_751).is(":checked")){
|
|
return $(_751).val();
|
|
}else{
|
|
return $(_751).attr("offval");
|
|
}
|
|
},setValue:function(_752,_753){
|
|
var _754=false;
|
|
if($(_752).val()==_753){
|
|
_754=true;
|
|
}
|
|
$(_752)._propAttr("checked",_754);
|
|
}},validatebox:{init:function(_755,_756){
|
|
var _757=$("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_755);
|
|
_757.validatebox(_756);
|
|
return _757;
|
|
},destroy:function(_758){
|
|
$(_758).validatebox("destroy");
|
|
},getValue:function(_759){
|
|
return $(_759).val();
|
|
},setValue:function(_75a,_75b){
|
|
$(_75a).val(_75b);
|
|
},resize:function(_75c,_75d){
|
|
$(_75c)._outerWidth(_75d)._outerHeight(22);
|
|
}}});
|
|
$.fn.datagrid.methods={options:function(jq){
|
|
var _75e=$.data(jq[0],"datagrid").options;
|
|
var _75f=$.data(jq[0],"datagrid").panel.panel("options");
|
|
var opts=$.extend(_75e,{width:_75f.width,height:_75f.height,closed:_75f.closed,collapsed:_75f.collapsed,minimized:_75f.minimized,maximized:_75f.maximized});
|
|
return opts;
|
|
},setSelectionState:function(jq){
|
|
return jq.each(function(){
|
|
_69b(this);
|
|
});
|
|
},createStyleSheet:function(jq){
|
|
return _5d2(jq[0]);
|
|
},getPanel:function(jq){
|
|
return $.data(jq[0],"datagrid").panel;
|
|
},getPager:function(jq){
|
|
return $.data(jq[0],"datagrid").panel.children("div.datagrid-pager");
|
|
},getColumnFields:function(jq,_760){
|
|
return _627(jq[0],_760);
|
|
},getColumnOption:function(jq,_761){
|
|
return _628(jq[0],_761);
|
|
},resize:function(jq,_762){
|
|
return jq.each(function(){
|
|
_5e1(this,_762);
|
|
});
|
|
},load:function(jq,_763){
|
|
return jq.each(function(){
|
|
var opts=$(this).datagrid("options");
|
|
if(typeof _763=="string"){
|
|
opts.url=_763;
|
|
_763=null;
|
|
}
|
|
opts.pageNumber=1;
|
|
var _764=$(this).datagrid("getPager");
|
|
_764.pagination("refresh",{pageNumber:1});
|
|
_65a(this,_763);
|
|
});
|
|
},reload:function(jq,_765){
|
|
return jq.each(function(){
|
|
var opts=$(this).datagrid("options");
|
|
if(typeof _765=="string"){
|
|
opts.url=_765;
|
|
_765=null;
|
|
}
|
|
_65a(this,_765);
|
|
});
|
|
},reloadFooter:function(jq,_766){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"datagrid").options;
|
|
var dc=$.data(this,"datagrid").dc;
|
|
if(_766){
|
|
$.data(this,"datagrid").footer=_766;
|
|
}
|
|
if(opts.showFooter){
|
|
opts.view.renderFooter.call(opts.view,this,dc.footer2,false);
|
|
opts.view.renderFooter.call(opts.view,this,dc.footer1,true);
|
|
if(opts.view.onAfterRender){
|
|
opts.view.onAfterRender.call(opts.view,this);
|
|
}
|
|
$(this).datagrid("fixRowHeight");
|
|
}
|
|
});
|
|
},loading:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"datagrid").options;
|
|
$(this).datagrid("getPager").pagination("loading");
|
|
if(opts.loadMsg){
|
|
var _767=$(this).datagrid("getPanel");
|
|
if(!_767.children("div.datagrid-mask").length){
|
|
$("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo(_767);
|
|
var msg=$("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html(opts.loadMsg).appendTo(_767);
|
|
msg._outerHeight(40);
|
|
msg.css({marginLeft:(-msg.outerWidth()/2),lineHeight:(msg.height()+"px")});
|
|
}
|
|
}
|
|
});
|
|
},loaded:function(jq){
|
|
return jq.each(function(){
|
|
$(this).datagrid("getPager").pagination("loaded");
|
|
var _768=$(this).datagrid("getPanel");
|
|
_768.children("div.datagrid-mask-msg").remove();
|
|
_768.children("div.datagrid-mask").remove();
|
|
});
|
|
},fitColumns:function(jq){
|
|
return jq.each(function(){
|
|
_65c(this);
|
|
});
|
|
},fixColumnSize:function(jq,_769){
|
|
return jq.each(function(){
|
|
_67a(this,_769);
|
|
});
|
|
},fixRowHeight:function(jq,_76a){
|
|
return jq.each(function(){
|
|
_5f7(this,_76a);
|
|
});
|
|
},freezeRow:function(jq,_76b){
|
|
return jq.each(function(){
|
|
_604(this,_76b);
|
|
});
|
|
},autoSizeColumn:function(jq,_76c){
|
|
return jq.each(function(){
|
|
_66e(this,_76c);
|
|
});
|
|
},loadData:function(jq,data){
|
|
return jq.each(function(){
|
|
_65b(this,data);
|
|
_716(this);
|
|
});
|
|
},getData:function(jq){
|
|
return $.data(jq[0],"datagrid").data;
|
|
},getRows:function(jq){
|
|
return $.data(jq[0],"datagrid").data.rows;
|
|
},getFooterRows:function(jq){
|
|
return $.data(jq[0],"datagrid").footer;
|
|
},getRowIndex:function(jq,id){
|
|
return _6a3(jq[0],id);
|
|
},getChecked:function(jq){
|
|
return _6a9(jq[0]);
|
|
},getSelected:function(jq){
|
|
var rows=_6a6(jq[0]);
|
|
return rows.length>0?rows[0]:null;
|
|
},getSelections:function(jq){
|
|
return _6a6(jq[0]);
|
|
},clearSelections:function(jq){
|
|
return jq.each(function(){
|
|
var _76d=$.data(this,"datagrid");
|
|
var _76e=_76d.selectedRows;
|
|
var _76f=_76d.checkedRows;
|
|
_76e.splice(0,_76e.length);
|
|
_6ba(this);
|
|
if(_76d.options.checkOnSelect){
|
|
_76f.splice(0,_76f.length);
|
|
}
|
|
});
|
|
},clearChecked:function(jq){
|
|
return jq.each(function(){
|
|
var _770=$.data(this,"datagrid");
|
|
var _771=_770.selectedRows;
|
|
var _772=_770.checkedRows;
|
|
_772.splice(0,_772.length);
|
|
_6ca(this);
|
|
if(_770.options.selectOnCheck){
|
|
_771.splice(0,_771.length);
|
|
}
|
|
});
|
|
},scrollTo:function(jq,_773){
|
|
return jq.each(function(){
|
|
_6ac(this,_773);
|
|
});
|
|
},highlightRow:function(jq,_774){
|
|
return jq.each(function(){
|
|
_63c(this,_774);
|
|
_6ac(this,_774);
|
|
});
|
|
},selectAll:function(jq){
|
|
return jq.each(function(){
|
|
_6bf(this);
|
|
});
|
|
},unselectAll:function(jq){
|
|
return jq.each(function(){
|
|
_6ba(this);
|
|
});
|
|
},selectRow:function(jq,_775){
|
|
return jq.each(function(){
|
|
_643(this,_775);
|
|
});
|
|
},selectRecord:function(jq,id){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"datagrid").options;
|
|
if(opts.idField){
|
|
var _776=_6a3(this,id);
|
|
if(_776>=0){
|
|
$(this).datagrid("selectRow",_776);
|
|
}
|
|
}
|
|
});
|
|
},unselectRow:function(jq,_777){
|
|
return jq.each(function(){
|
|
_644(this,_777);
|
|
});
|
|
},checkRow:function(jq,_778){
|
|
return jq.each(function(){
|
|
_640(this,_778);
|
|
});
|
|
},uncheckRow:function(jq,_779){
|
|
return jq.each(function(){
|
|
_641(this,_779);
|
|
});
|
|
},checkAll:function(jq){
|
|
return jq.each(function(){
|
|
_6c4(this);
|
|
});
|
|
},uncheckAll:function(jq){
|
|
return jq.each(function(){
|
|
_6ca(this);
|
|
});
|
|
},beginEdit:function(jq,_77a){
|
|
return jq.each(function(){
|
|
_6db(this,_77a);
|
|
});
|
|
},endEdit:function(jq,_77b){
|
|
return jq.each(function(){
|
|
_6e1(this,_77b,false);
|
|
});
|
|
},cancelEdit:function(jq,_77c){
|
|
return jq.each(function(){
|
|
_6e1(this,_77c,true);
|
|
});
|
|
},getEditors:function(jq,_77d){
|
|
return _6ee(jq[0],_77d);
|
|
},getEditor:function(jq,_77e){
|
|
return _6f2(jq[0],_77e);
|
|
},refreshRow:function(jq,_77f){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"datagrid").options;
|
|
opts.view.refreshRow.call(opts.view,this,_77f);
|
|
});
|
|
},validateRow:function(jq,_780){
|
|
return _6e0(jq[0],_780);
|
|
},updateRow:function(jq,_781){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"datagrid").options;
|
|
opts.view.updateRow.call(opts.view,this,_781.index,_781.row);
|
|
});
|
|
},appendRow:function(jq,row){
|
|
return jq.each(function(){
|
|
_713(this,row);
|
|
});
|
|
},insertRow:function(jq,_782){
|
|
return jq.each(function(){
|
|
_70f(this,_782);
|
|
});
|
|
},deleteRow:function(jq,_783){
|
|
return jq.each(function(){
|
|
_709(this,_783);
|
|
});
|
|
},getChanges:function(jq,_784){
|
|
return _703(jq[0],_784);
|
|
},acceptChanges:function(jq){
|
|
return jq.each(function(){
|
|
_71a(this);
|
|
});
|
|
},rejectChanges:function(jq){
|
|
return jq.each(function(){
|
|
_71c(this);
|
|
});
|
|
},mergeCells:function(jq,_785){
|
|
return jq.each(function(){
|
|
_72e(this,_785);
|
|
});
|
|
},showColumn:function(jq,_786){
|
|
return jq.each(function(){
|
|
var _787=$(this).datagrid("getPanel");
|
|
_787.find("td[field=\""+_786+"\"]").show();
|
|
$(this).datagrid("getColumnOption",_786).hidden=false;
|
|
$(this).datagrid("fitColumns");
|
|
});
|
|
},hideColumn:function(jq,_788){
|
|
return jq.each(function(){
|
|
var _789=$(this).datagrid("getPanel");
|
|
_789.find("td[field=\""+_788+"\"]").hide();
|
|
$(this).datagrid("getColumnOption",_788).hidden=true;
|
|
$(this).datagrid("fitColumns");
|
|
});
|
|
},sort:function(jq,_78a){
|
|
return jq.each(function(){
|
|
_64f(this,_78a);
|
|
});
|
|
},gotoPage:function(jq,_78b){
|
|
return jq.each(function(){
|
|
var _78c=this;
|
|
var page,cb;
|
|
if(typeof _78b=="object"){
|
|
page=_78b.page;
|
|
cb=_78b.callback;
|
|
}else{
|
|
page=_78b;
|
|
}
|
|
$(_78c).datagrid("options").pageNumber=page;
|
|
$(_78c).datagrid("getPager").pagination("refresh",{pageNumber:page});
|
|
_65a(_78c,null,function(){
|
|
if(cb){
|
|
cb.call(_78c,page);
|
|
}
|
|
});
|
|
});
|
|
}};
|
|
$.fn.datagrid.parseOptions=function(_78d){
|
|
var t=$(_78d);
|
|
return $.extend({},$.fn.panel.parseOptions(_78d),$.parser.parseOptions(_78d,["url","toolbar","idField","sortName","sortOrder","pagePosition","resizeHandle",{sharedStyleSheet:"boolean",fitColumns:"boolean",autoRowHeight:"boolean",striped:"boolean",nowrap:"boolean"},{rownumbers:"boolean",singleSelect:"boolean",ctrlSelect:"boolean",checkOnSelect:"boolean",selectOnCheck:"boolean"},{pagination:"boolean",pageSize:"number",pageNumber:"number"},{multiSort:"boolean",remoteSort:"boolean",showHeader:"boolean",showFooter:"boolean"},{scrollbarSize:"number"}]),{pageList:(t.attr("pageList")?eval(t.attr("pageList")):undefined),loadMsg:(t.attr("loadMsg")!=undefined?t.attr("loadMsg"):undefined),rowStyler:(t.attr("rowStyler")?eval(t.attr("rowStyler")):undefined)});
|
|
};
|
|
$.fn.datagrid.parseData=function(_78e){
|
|
var t=$(_78e);
|
|
var data={total:0,rows:[]};
|
|
var _78f=t.datagrid("getColumnFields",true).concat(t.datagrid("getColumnFields",false));
|
|
t.find("tbody tr").each(function(){
|
|
data.total++;
|
|
var row={};
|
|
$.extend(row,$.parser.parseOptions(this,["iconCls","state"]));
|
|
for(var i=0;i<_78f.length;i++){
|
|
row[_78f[i]]=$(this).find("td:eq("+i+")").html();
|
|
}
|
|
data.rows.push(row);
|
|
});
|
|
return data;
|
|
};
|
|
var _790={render:function(_791,_792,_793){
|
|
var rows=$(_791).datagrid("getRows");
|
|
$(_792).html(this.renderTable(_791,0,rows,_793));
|
|
},renderFooter:function(_794,_795,_796){
|
|
var opts=$.data(_794,"datagrid").options;
|
|
var rows=$.data(_794,"datagrid").footer||[];
|
|
var _797=$(_794).datagrid("getColumnFields",_796);
|
|
var _798=["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
|
|
for(var i=0;i<rows.length;i++){
|
|
_798.push("<tr class=\"datagrid-row\" datagrid-row-index=\""+i+"\">");
|
|
_798.push(this.renderRow.call(this,_794,_797,_796,i,rows[i]));
|
|
_798.push("</tr>");
|
|
}
|
|
_798.push("</tbody></table>");
|
|
$(_795).html(_798.join(""));
|
|
},renderTable:function(_799,_79a,rows,_79b){
|
|
var _79c=$.data(_799,"datagrid");
|
|
var opts=_79c.options;
|
|
if(_79b){
|
|
if(!(opts.rownumbers||(opts.frozenColumns&&opts.frozenColumns.length))){
|
|
return "";
|
|
}
|
|
}
|
|
var _79d=$(_799).datagrid("getColumnFields",_79b);
|
|
var _79e=["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
var css=opts.rowStyler?opts.rowStyler.call(_799,_79a,row):"";
|
|
var _79f="";
|
|
var _7a0="";
|
|
if(typeof css=="string"){
|
|
_7a0=css;
|
|
}else{
|
|
if(css){
|
|
_79f=css["class"]||"";
|
|
_7a0=css["style"]||"";
|
|
}
|
|
}
|
|
var cls="class=\"datagrid-row "+(_79a%2&&opts.striped?"datagrid-row-alt ":" ")+_79f+"\"";
|
|
var _7a1=_7a0?"style=\""+_7a0+"\"":"";
|
|
var _7a2=_79c.rowIdPrefix+"-"+(_79b?1:2)+"-"+_79a;
|
|
_79e.push("<tr id=\""+_7a2+"\" datagrid-row-index=\""+_79a+"\" "+cls+" "+_7a1+">");
|
|
_79e.push(this.renderRow.call(this,_799,_79d,_79b,_79a,row));
|
|
_79e.push("</tr>");
|
|
_79a++;
|
|
}
|
|
_79e.push("</tbody></table>");
|
|
return _79e.join("");
|
|
},renderRow:function(_7a3,_7a4,_7a5,_7a6,_7a7){
|
|
var opts=$.data(_7a3,"datagrid").options;
|
|
var cc=[];
|
|
if(_7a5&&opts.rownumbers){
|
|
var _7a8=_7a6+1;
|
|
if(opts.pagination){
|
|
_7a8+=(opts.pageNumber-1)*opts.pageSize;
|
|
}
|
|
cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">"+_7a8+"</div></td>");
|
|
}
|
|
for(var i=0;i<_7a4.length;i++){
|
|
var _7a9=_7a4[i];
|
|
var col=$(_7a3).datagrid("getColumnOption",_7a9);
|
|
if(col){
|
|
var _7aa=_7a7[_7a9];
|
|
var css=col.styler?(col.styler(_7aa,_7a7,_7a6)||""):"";
|
|
var _7ab="";
|
|
var _7ac="";
|
|
if(typeof css=="string"){
|
|
_7ac=css;
|
|
}else{
|
|
if(css){
|
|
_7ab=css["class"]||"";
|
|
_7ac=css["style"]||"";
|
|
}
|
|
}
|
|
var cls=_7ab?"class=\""+_7ab+"\"":"";
|
|
var _7ad=col.hidden?"style=\"display:none;"+_7ac+"\"":(_7ac?"style=\""+_7ac+"\"":"");
|
|
cc.push("<td field=\""+_7a9+"\" "+cls+" "+_7ad+">");
|
|
var _7ad="";
|
|
if(!col.checkbox){
|
|
if(col.align){
|
|
_7ad+="text-align:"+col.align+";";
|
|
}
|
|
if(!opts.nowrap){
|
|
_7ad+="white-space:normal;height:auto;";
|
|
}else{
|
|
if(opts.autoRowHeight){
|
|
_7ad+="height:auto;";
|
|
}
|
|
}
|
|
}
|
|
cc.push("<div style=\""+_7ad+"\" ");
|
|
cc.push(col.checkbox?"class=\"datagrid-cell-check\"":"class=\"datagrid-cell "+col.cellClass+"\"");
|
|
cc.push(">");
|
|
if(col.checkbox){
|
|
cc.push("<input type=\"checkbox\" "+(_7a7.checked?"checked=\"checked\"":""));
|
|
cc.push(" name=\""+_7a9+"\" value=\""+(_7aa!=undefined?_7aa:"")+"\">");
|
|
}else{
|
|
if(col.formatter){
|
|
cc.push(col.formatter(_7aa,_7a7,_7a6));
|
|
}else{
|
|
cc.push(_7aa);
|
|
}
|
|
}
|
|
cc.push("</div>");
|
|
cc.push("</td>");
|
|
}
|
|
}
|
|
return cc.join("");
|
|
},refreshRow:function(_7ae,_7af){
|
|
this.updateRow.call(this,_7ae,_7af,{});
|
|
},updateRow:function(_7b0,_7b1,row){
|
|
var opts=$.data(_7b0,"datagrid").options;
|
|
var rows=$(_7b0).datagrid("getRows");
|
|
var _7b2=_7b3(_7b1);
|
|
$.extend(rows[_7b1],row);
|
|
var _7b4=_7b3(_7b1);
|
|
var _7b5=_7b2.c;
|
|
var _7b6=_7b4.s;
|
|
var _7b7="datagrid-row "+(_7b1%2&&opts.striped?"datagrid-row-alt ":" ")+_7b4.c;
|
|
function _7b3(_7b8){
|
|
var css=opts.rowStyler?opts.rowStyler.call(_7b0,_7b8,rows[_7b8]):"";
|
|
var _7b9="";
|
|
var _7ba="";
|
|
if(typeof css=="string"){
|
|
_7ba=css;
|
|
}else{
|
|
if(css){
|
|
_7b9=css["class"]||"";
|
|
_7ba=css["style"]||"";
|
|
}
|
|
}
|
|
return {c:_7b9,s:_7ba};
|
|
};
|
|
function _7bb(_7bc){
|
|
var _7bd=$(_7b0).datagrid("getColumnFields",_7bc);
|
|
var tr=opts.finder.getTr(_7b0,_7b1,"body",(_7bc?1:2));
|
|
var _7be=tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked");
|
|
tr.html(this.renderRow.call(this,_7b0,_7bd,_7bc,_7b1,rows[_7b1]));
|
|
tr.attr("style",_7b6).removeClass(_7b5).addClass(_7b7);
|
|
if(_7be){
|
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true);
|
|
}
|
|
};
|
|
_7bb.call(this,true);
|
|
_7bb.call(this,false);
|
|
$(_7b0).datagrid("fixRowHeight",_7b1);
|
|
},insertRow:function(_7bf,_7c0,row){
|
|
var _7c1=$.data(_7bf,"datagrid");
|
|
var opts=_7c1.options;
|
|
var dc=_7c1.dc;
|
|
var data=_7c1.data;
|
|
if(_7c0==undefined||_7c0==null){
|
|
_7c0=data.rows.length;
|
|
}
|
|
if(_7c0>data.rows.length){
|
|
_7c0=data.rows.length;
|
|
}
|
|
function _7c2(_7c3){
|
|
var _7c4=_7c3?1:2;
|
|
for(var i=data.rows.length-1;i>=_7c0;i--){
|
|
var tr=opts.finder.getTr(_7bf,i,"body",_7c4);
|
|
tr.attr("datagrid-row-index",i+1);
|
|
tr.attr("id",_7c1.rowIdPrefix+"-"+_7c4+"-"+(i+1));
|
|
if(_7c3&&opts.rownumbers){
|
|
var _7c5=i+2;
|
|
if(opts.pagination){
|
|
_7c5+=(opts.pageNumber-1)*opts.pageSize;
|
|
}
|
|
tr.find("div.datagrid-cell-rownumber").html(_7c5);
|
|
}
|
|
if(opts.striped){
|
|
tr.removeClass("datagrid-row-alt").addClass((i+1)%2?"datagrid-row-alt":"");
|
|
}
|
|
}
|
|
};
|
|
function _7c6(_7c7){
|
|
var _7c8=_7c7?1:2;
|
|
var _7c9=$(_7bf).datagrid("getColumnFields",_7c7);
|
|
var _7ca=_7c1.rowIdPrefix+"-"+_7c8+"-"+_7c0;
|
|
var tr="<tr id=\""+_7ca+"\" class=\"datagrid-row\" datagrid-row-index=\""+_7c0+"\"></tr>";
|
|
if(_7c0>=data.rows.length){
|
|
if(data.rows.length){
|
|
opts.finder.getTr(_7bf,"","last",_7c8).after(tr);
|
|
}else{
|
|
var cc=_7c7?dc.body1:dc.body2;
|
|
cc.html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"+tr+"</tbody></table>");
|
|
}
|
|
}else{
|
|
opts.finder.getTr(_7bf,_7c0+1,"body",_7c8).before(tr);
|
|
}
|
|
};
|
|
_7c2.call(this,true);
|
|
_7c2.call(this,false);
|
|
_7c6.call(this,true);
|
|
_7c6.call(this,false);
|
|
data.total+=1;
|
|
data.rows.splice(_7c0,0,row);
|
|
this.refreshRow.call(this,_7bf,_7c0);
|
|
},deleteRow:function(_7cb,_7cc){
|
|
var _7cd=$.data(_7cb,"datagrid");
|
|
var opts=_7cd.options;
|
|
var data=_7cd.data;
|
|
function _7ce(_7cf){
|
|
var _7d0=_7cf?1:2;
|
|
for(var i=_7cc+1;i<data.rows.length;i++){
|
|
var tr=opts.finder.getTr(_7cb,i,"body",_7d0);
|
|
tr.attr("datagrid-row-index",i-1);
|
|
tr.attr("id",_7cd.rowIdPrefix+"-"+_7d0+"-"+(i-1));
|
|
if(_7cf&&opts.rownumbers){
|
|
var _7d1=i;
|
|
if(opts.pagination){
|
|
_7d1+=(opts.pageNumber-1)*opts.pageSize;
|
|
}
|
|
tr.find("div.datagrid-cell-rownumber").html(_7d1);
|
|
}
|
|
if(opts.striped){
|
|
tr.removeClass("datagrid-row-alt").addClass((i-1)%2?"datagrid-row-alt":"");
|
|
}
|
|
}
|
|
};
|
|
opts.finder.getTr(_7cb,_7cc).remove();
|
|
_7ce.call(this,true);
|
|
_7ce.call(this,false);
|
|
data.total-=1;
|
|
data.rows.splice(_7cc,1);
|
|
},onBeforeRender:function(_7d2,rows){
|
|
},onAfterRender:function(_7d3){
|
|
var _7d4=$.data(_7d3,"datagrid");
|
|
var opts=_7d4.options;
|
|
if(opts.showFooter){
|
|
var _7d5=$(_7d3).datagrid("getPanel").find("div.datagrid-footer");
|
|
_7d5.find("div.datagrid-cell-rownumber,div.datagrid-cell-check").css("visibility","hidden");
|
|
}
|
|
if(opts.finder.getRows(_7d3).length==0){
|
|
this.renderEmptyRow(_7d3);
|
|
}
|
|
},renderEmptyRow:function(_7d6){
|
|
var cols=$.map($(_7d6).datagrid("getColumnFields"),function(_7d7){
|
|
return $(_7d6).datagrid("getColumnOption",_7d7);
|
|
});
|
|
$.map(cols,function(col){
|
|
col.formatter1=col.formatter;
|
|
col.styler1=col.styler;
|
|
col.formatter=col.styler=undefined;
|
|
});
|
|
var _7d8=$.data(_7d6,"datagrid").dc.body2;
|
|
_7d8.html(this.renderTable(_7d6,0,[{}],false));
|
|
_7d8.find("tbody *").css({height:1,borderColor:"transparent",background:"transparent"});
|
|
var tr=_7d8.find(".datagrid-row");
|
|
tr.removeClass("datagrid-row").removeAttr("datagrid-row-index");
|
|
tr.find(".datagrid-cell,.datagrid-cell-check").empty();
|
|
$.map(cols,function(col){
|
|
col.formatter=col.formatter1;
|
|
col.styler=col.styler1;
|
|
col.formatter1=col.styler1=undefined;
|
|
});
|
|
}};
|
|
$.fn.datagrid.defaults=$.extend({},$.fn.panel.defaults,{sharedStyleSheet:false,frozenColumns:undefined,columns:undefined,fitColumns:false,resizeHandle:"right",autoRowHeight:true,toolbar:null,striped:false,method:"post",nowrap:true,idField:null,url:null,data:null,loadMsg:"Processing, please wait ...",rownumbers:false,singleSelect:false,ctrlSelect:false,selectOnCheck:true,checkOnSelect:true,pagination:false,pagePosition:"bottom",pageNumber:1,pageSize:10,pageList:[10,20,30,40,50],queryParams:{},sortName:null,sortOrder:"asc",multiSort:false,remoteSort:true,showHeader:true,showFooter:false,scrollbarSize:18,rowEvents:{mouseover:_635(true),mouseout:_635(false),click:_63d,dblclick:_647,contextmenu:_64b},rowStyler:function(_7d9,_7da){
|
|
},loader:function(_7db,_7dc,_7dd){
|
|
var opts=$(this).datagrid("options");
|
|
if(!opts.url){
|
|
return false;
|
|
}
|
|
$.ajax({type:opts.method,url:opts.url,data:_7db,dataType:"json",success:function(data){
|
|
_7dc(data);
|
|
},error:function(){
|
|
_7dd.apply(this,arguments);
|
|
}});
|
|
},loadFilter:function(data){
|
|
if(typeof data.length=="number"&&typeof data.splice=="function"){
|
|
return {total:data.length,rows:data};
|
|
}else{
|
|
return data;
|
|
}
|
|
},editors:_745,finder:{getTr:function(_7de,_7df,type,_7e0){
|
|
type=type||"body";
|
|
_7e0=_7e0||0;
|
|
var _7e1=$.data(_7de,"datagrid");
|
|
var dc=_7e1.dc;
|
|
var opts=_7e1.options;
|
|
if(_7e0==0){
|
|
var tr1=opts.finder.getTr(_7de,_7df,type,1);
|
|
var tr2=opts.finder.getTr(_7de,_7df,type,2);
|
|
return tr1.add(tr2);
|
|
}else{
|
|
if(type=="body"){
|
|
var tr=$("#"+_7e1.rowIdPrefix+"-"+_7e0+"-"+_7df);
|
|
if(!tr.length){
|
|
tr=(_7e0==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index="+_7df+"]");
|
|
}
|
|
return tr;
|
|
}else{
|
|
if(type=="footer"){
|
|
return (_7e0==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index="+_7df+"]");
|
|
}else{
|
|
if(type=="selected"){
|
|
return (_7e0==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-selected");
|
|
}else{
|
|
if(type=="highlight"){
|
|
return (_7e0==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-over");
|
|
}else{
|
|
if(type=="checked"){
|
|
return (_7e0==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-checked");
|
|
}else{
|
|
if(type=="editing"){
|
|
return (_7e0==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-editing");
|
|
}else{
|
|
if(type=="last"){
|
|
return (_7e0==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]:last");
|
|
}else{
|
|
if(type=="allbody"){
|
|
return (_7e0==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]");
|
|
}else{
|
|
if(type=="allfooter"){
|
|
return (_7e0==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index]");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},getRow:function(_7e2,p){
|
|
var _7e3=(typeof p=="object")?p.attr("datagrid-row-index"):p;
|
|
return $.data(_7e2,"datagrid").data.rows[parseInt(_7e3)];
|
|
},getRows:function(_7e4){
|
|
return $(_7e4).datagrid("getRows");
|
|
}},view:_790,onBeforeLoad:function(_7e5){
|
|
},onLoadSuccess:function(){
|
|
},onLoadError:function(){
|
|
},onClickRow:function(_7e6,_7e7){
|
|
},onDblClickRow:function(_7e8,_7e9){
|
|
},onClickCell:function(_7ea,_7eb,_7ec){
|
|
},onDblClickCell:function(_7ed,_7ee,_7ef){
|
|
},onBeforeSortColumn:function(sort,_7f0){
|
|
},onSortColumn:function(sort,_7f1){
|
|
},onResizeColumn:function(_7f2,_7f3){
|
|
},onBeforeSelect:function(_7f4,_7f5){
|
|
},onSelect:function(_7f6,_7f7){
|
|
},onBeforeUnselect:function(_7f8,_7f9){
|
|
},onUnselect:function(_7fa,_7fb){
|
|
},onSelectAll:function(rows){
|
|
},onUnselectAll:function(rows){
|
|
},onBeforeCheck:function(_7fc,_7fd){
|
|
},onCheck:function(_7fe,_7ff){
|
|
},onBeforeUncheck:function(_800,_801){
|
|
},onUncheck:function(_802,_803){
|
|
},onCheckAll:function(rows){
|
|
},onUncheckAll:function(rows){
|
|
},onBeforeEdit:function(_804,_805){
|
|
},onBeginEdit:function(_806,_807){
|
|
},onEndEdit:function(_808,_809,_80a){
|
|
},onAfterEdit:function(_80b,_80c,_80d){
|
|
},onCancelEdit:function(_80e,_80f){
|
|
},onHeaderContextMenu:function(e,_810){
|
|
},onRowContextMenu:function(e,_811,_812){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
var _813;
|
|
$(document).unbind(".propertygrid").bind("mousedown.propertygrid",function(e){
|
|
var p=$(e.target).closest("div.datagrid-view,div.combo-panel");
|
|
if(p.length){
|
|
return;
|
|
}
|
|
_814(_813);
|
|
_813=undefined;
|
|
});
|
|
function _815(_816){
|
|
var _817=$.data(_816,"propertygrid");
|
|
var opts=$.data(_816,"propertygrid").options;
|
|
$(_816).datagrid($.extend({},opts,{cls:"propertygrid",view:(opts.showGroup?opts.groupView:opts.view),onBeforeEdit:function(_818,row){
|
|
if(opts.onBeforeEdit.call(_816,_818,row)==false){
|
|
return false;
|
|
}
|
|
var dg=$(this);
|
|
var row=dg.datagrid("getRows")[_818];
|
|
var col=dg.datagrid("getColumnOption","value");
|
|
if(row === undefined){
|
|
return false;
|
|
}else{
|
|
col.editor=row.editor;
|
|
}
|
|
},onClickCell:function(_819,_81a,_81b){
|
|
if(_813!=this){
|
|
_814(_813);
|
|
_813=this;
|
|
}
|
|
if(opts.editIndex!=_819){
|
|
_814(_813);
|
|
$(this).datagrid("beginEdit",_819);
|
|
var ed=$(this).datagrid("getEditor",{index:_819,field:_81a});
|
|
if(!ed){
|
|
ed=$(this).datagrid("getEditor",{index:_819,field:"value"});
|
|
}
|
|
if(ed){
|
|
var t=$(ed.target);
|
|
var _81c=t.data("textbox")?t.textbox("textbox"):t;
|
|
_81c.focus();
|
|
opts.editIndex=_819;
|
|
}
|
|
}
|
|
opts.onClickCell.call(_816,_819,_81a,_81b);
|
|
},loadFilter:function(data){
|
|
_814(this);
|
|
return opts.loadFilter.call(this,data);
|
|
}}));
|
|
};
|
|
function _814(_81d){
|
|
var t=$(_81d);
|
|
if(!t.length){
|
|
return;
|
|
}
|
|
var opts=$.data(_81d,"propertygrid").options;
|
|
opts.finder.getTr(_81d,null,"editing").each(function(){
|
|
var _81e=parseInt($(this).attr("datagrid-row-index"));
|
|
if(t.datagrid("validateRow",_81e)){
|
|
t.datagrid("endEdit",_81e);
|
|
}else{
|
|
t.datagrid("cancelEdit",_81e);
|
|
}
|
|
});
|
|
opts.editIndex=undefined;
|
|
};
|
|
$.fn.propertygrid=function(_81f,_820){
|
|
if(typeof _81f=="string"){
|
|
var _821=$.fn.propertygrid.methods[_81f];
|
|
if(_821){
|
|
return _821(this,_820);
|
|
}else{
|
|
return this.datagrid(_81f,_820);
|
|
}
|
|
}
|
|
_81f=_81f||{};
|
|
return this.each(function(){
|
|
var _822=$.data(this,"propertygrid");
|
|
if(_822){
|
|
$.extend(_822.options,_81f);
|
|
}else{
|
|
var opts=$.extend({},$.fn.propertygrid.defaults,$.fn.propertygrid.parseOptions(this),_81f);
|
|
opts.frozenColumns=$.extend(true,[],opts.frozenColumns);
|
|
opts.columns=$.extend(true,[],opts.columns);
|
|
$.data(this,"propertygrid",{options:opts});
|
|
}
|
|
_815(this);
|
|
});
|
|
};
|
|
$.fn.propertygrid.methods={options:function(jq){
|
|
return $.data(jq[0],"propertygrid").options;
|
|
}};
|
|
$.fn.propertygrid.parseOptions=function(_823){
|
|
return $.extend({},$.fn.datagrid.parseOptions(_823),$.parser.parseOptions(_823,[{showGroup:"boolean"}]));
|
|
};
|
|
var _824=$.extend({},$.fn.datagrid.defaults.view,{render:function(_825,_826,_827){
|
|
var _828=[];
|
|
var _829=this.groups;
|
|
for(var i=0;i<_829.length;i++){
|
|
_828.push(this.renderGroup.call(this,_825,i,_829[i],_827));
|
|
}
|
|
$(_826).html(_828.join(""));
|
|
},renderGroup:function(_82a,_82b,_82c,_82d){
|
|
var _82e=$.data(_82a,"datagrid");
|
|
var opts=_82e.options;
|
|
var _82f=$(_82a).datagrid("getColumnFields",_82d);
|
|
var _830=[];
|
|
_830.push("<div class=\"datagrid-group\" group-index="+_82b+">");
|
|
if((_82d&&(opts.rownumbers||opts.frozenColumns.length))||(!_82d&&!(opts.rownumbers||opts.frozenColumns.length))){
|
|
_830.push("<span class=\"datagrid-group-expander\">");
|
|
_830.push("<span class=\"datagrid-row-expander datagrid-row-collapse\"> </span>");
|
|
_830.push("</span>");
|
|
}
|
|
if(!_82d){
|
|
_830.push("<span class=\"datagrid-group-title\">");
|
|
_830.push(opts.groupFormatter.call(_82a,_82c.value,_82c.rows));
|
|
_830.push("</span>");
|
|
}
|
|
_830.push("</div>");
|
|
_830.push("<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>");
|
|
var _831=_82c.startIndex;
|
|
for(var j=0;j<_82c.rows.length;j++){
|
|
var css=opts.rowStyler?opts.rowStyler.call(_82a,_831,_82c.rows[j]):"";
|
|
var _832="";
|
|
var _833="";
|
|
if(typeof css=="string"){
|
|
_833=css;
|
|
}else{
|
|
if(css){
|
|
_832=css["class"]||"";
|
|
_833=css["style"]||"";
|
|
}
|
|
}
|
|
var cls="class=\"datagrid-row "+(_831%2&&opts.striped?"datagrid-row-alt ":" ")+_832+"\"";
|
|
var _834=_833?"style=\""+_833+"\"":"";
|
|
var _835=_82e.rowIdPrefix+"-"+(_82d?1:2)+"-"+_831;
|
|
_830.push("<tr id=\""+_835+"\" datagrid-row-index=\""+_831+"\" "+cls+" "+_834+">");
|
|
_830.push(this.renderRow.call(this,_82a,_82f,_82d,_831,_82c.rows[j]));
|
|
_830.push("</tr>");
|
|
_831++;
|
|
}
|
|
_830.push("</tbody></table>");
|
|
return _830.join("");
|
|
},bindEvents:function(_836){
|
|
var _837=$.data(_836,"datagrid");
|
|
var dc=_837.dc;
|
|
var body=dc.body1.add(dc.body2);
|
|
var _838=($.data(body[0],"events")||$._data(body[0],"events")).click[0].handler;
|
|
body.unbind("click").bind("click",function(e){
|
|
var tt=$(e.target);
|
|
var _839=tt.closest("span.datagrid-row-expander");
|
|
if(_839.length){
|
|
var _83a=_839.closest("div.datagrid-group").attr("group-index");
|
|
if(_839.hasClass("datagrid-row-collapse")){
|
|
$(_836).datagrid("collapseGroup",_83a);
|
|
}else{
|
|
$(_836).datagrid("expandGroup",_83a);
|
|
}
|
|
}else{
|
|
_838(e);
|
|
}
|
|
e.stopPropagation();
|
|
});
|
|
},onBeforeRender:function(_83b,rows){
|
|
var _83c=$.data(_83b,"datagrid");
|
|
var opts=_83c.options;
|
|
_83d();
|
|
var _83e=[];
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
var _83f=_840(row[opts.groupField]);
|
|
if(!_83f){
|
|
_83f={value:row[opts.groupField],rows:[row]};
|
|
_83e.push(_83f);
|
|
}else{
|
|
_83f.rows.push(row);
|
|
}
|
|
}
|
|
var _841=0;
|
|
var _842=[];
|
|
for(var i=0;i<_83e.length;i++){
|
|
var _83f=_83e[i];
|
|
_83f.startIndex=_841;
|
|
_841+=_83f.rows.length;
|
|
_842=_842.concat(_83f.rows);
|
|
}
|
|
_83c.data.rows=_842;
|
|
this.groups=_83e;
|
|
var that=this;
|
|
setTimeout(function(){
|
|
that.bindEvents(_83b);
|
|
},0);
|
|
function _840(_843){
|
|
for(var i=0;i<_83e.length;i++){
|
|
var _844=_83e[i];
|
|
if(_844.value==_843){
|
|
return _844;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _83d(){
|
|
if(!$("#datagrid-group-style").length){
|
|
$("head").append("<style id=\"datagrid-group-style\">"+".datagrid-group{height:"+opts.groupHeight+"px;overflow:hidden;font-weight:bold;border-bottom:1px solid #ccc;}"+".datagrid-group-title,.datagrid-group-expander{display:inline-block;vertical-align:bottom;height:100%;line-height:"+opts.groupHeight+"px;padding:0 4px;}"+".datagrid-group-expander{width:"+opts.expanderWidth+"px;text-align:center;padding:0}"+".datagrid-row-expander{margin:"+Math.floor((opts.groupHeight-16)/2)+"px 0;display:inline-block;width:16px;height:16px;cursor:pointer}"+"</style>");
|
|
}
|
|
};
|
|
}});
|
|
$.extend($.fn.datagrid.methods,{groups:function(jq){
|
|
return jq.datagrid("options").view.groups;
|
|
},expandGroup:function(jq,_845){
|
|
return jq.each(function(){
|
|
var view=$.data(this,"datagrid").dc.view;
|
|
var _846=view.find(_845!=undefined?"div.datagrid-group[group-index=\""+_845+"\"]":"div.datagrid-group");
|
|
var _847=_846.find("span.datagrid-row-expander");
|
|
if(_847.hasClass("datagrid-row-expand")){
|
|
_847.removeClass("datagrid-row-expand").addClass("datagrid-row-collapse");
|
|
_846.next("table").show();
|
|
}
|
|
$(this).datagrid("fixRowHeight");
|
|
});
|
|
},collapseGroup:function(jq,_848){
|
|
return jq.each(function(){
|
|
var view=$.data(this,"datagrid").dc.view;
|
|
var _849=view.find(_848!=undefined?"div.datagrid-group[group-index=\""+_848+"\"]":"div.datagrid-group");
|
|
var _84a=_849.find("span.datagrid-row-expander");
|
|
if(_84a.hasClass("datagrid-row-collapse")){
|
|
_84a.removeClass("datagrid-row-collapse").addClass("datagrid-row-expand");
|
|
_849.next("table").hide();
|
|
}
|
|
$(this).datagrid("fixRowHeight");
|
|
});
|
|
}});
|
|
$.extend(_824,{refreshGroupTitle:function(_84b,_84c){
|
|
var _84d=$.data(_84b,"datagrid");
|
|
var opts=_84d.options;
|
|
var dc=_84d.dc;
|
|
var _84e=this.groups[_84c];
|
|
var span=dc.body2.children("div.datagrid-group[group-index="+_84c+"]").find("span.datagrid-group-title");
|
|
span.html(opts.groupFormatter.call(_84b,_84e.value,_84e.rows));
|
|
},insertRow:function(_84f,_850,row){
|
|
var _851=$.data(_84f,"datagrid");
|
|
var opts=_851.options;
|
|
var dc=_851.dc;
|
|
var _852=null;
|
|
var _853;
|
|
if(!_851.data.rows.length){
|
|
$(_84f).datagrid("loadData",[row]);
|
|
return;
|
|
}
|
|
for(var i=0;i<this.groups.length;i++){
|
|
if(this.groups[i].value==row[opts.groupField]){
|
|
_852=this.groups[i];
|
|
_853=i;
|
|
break;
|
|
}
|
|
}
|
|
if(_852){
|
|
if(_850==undefined||_850==null){
|
|
_850=_851.data.rows.length;
|
|
}
|
|
if(_850<_852.startIndex){
|
|
_850=_852.startIndex;
|
|
}else{
|
|
if(_850>_852.startIndex+_852.rows.length){
|
|
_850=_852.startIndex+_852.rows.length;
|
|
}
|
|
}
|
|
$.fn.datagrid.defaults.view.insertRow.call(this,_84f,_850,row);
|
|
if(_850>=_852.startIndex+_852.rows.length){
|
|
_854(_850,true);
|
|
_854(_850,false);
|
|
}
|
|
_852.rows.splice(_850-_852.startIndex,0,row);
|
|
}else{
|
|
_852={value:row[opts.groupField],rows:[row],startIndex:_851.data.rows.length};
|
|
_853=this.groups.length;
|
|
dc.body1.append(this.renderGroup.call(this,_84f,_853,_852,true));
|
|
dc.body2.append(this.renderGroup.call(this,_84f,_853,_852,false));
|
|
this.groups.push(_852);
|
|
_851.data.rows.push(row);
|
|
}
|
|
this.refreshGroupTitle(_84f,_853);
|
|
function _854(_855,_856){
|
|
var _857=_856?1:2;
|
|
var _858=opts.finder.getTr(_84f,_855-1,"body",_857);
|
|
var tr=opts.finder.getTr(_84f,_855,"body",_857);
|
|
tr.insertAfter(_858);
|
|
};
|
|
},updateRow:function(_859,_85a,row){
|
|
var opts=$.data(_859,"datagrid").options;
|
|
$.fn.datagrid.defaults.view.updateRow.call(this,_859,_85a,row);
|
|
var tb=opts.finder.getTr(_859,_85a,"body",2).closest("table.datagrid-btable");
|
|
var _85b=parseInt(tb.prev().attr("group-index"));
|
|
this.refreshGroupTitle(_859,_85b);
|
|
},deleteRow:function(_85c,_85d){
|
|
var _85e=$.data(_85c,"datagrid");
|
|
var opts=_85e.options;
|
|
var dc=_85e.dc;
|
|
var body=dc.body1.add(dc.body2);
|
|
var tb=opts.finder.getTr(_85c,_85d,"body",2).closest("table.datagrid-btable");
|
|
var _85f=parseInt(tb.prev().attr("group-index"));
|
|
$.fn.datagrid.defaults.view.deleteRow.call(this,_85c,_85d);
|
|
var _860=this.groups[_85f];
|
|
if(_860.rows.length>1){
|
|
_860.rows.splice(_85d-_860.startIndex,1);
|
|
this.refreshGroupTitle(_85c,_85f);
|
|
}else{
|
|
body.children("div.datagrid-group[group-index="+_85f+"]").remove();
|
|
for(var i=_85f+1;i<this.groups.length;i++){
|
|
body.children("div.datagrid-group[group-index="+i+"]").attr("group-index",i-1);
|
|
}
|
|
this.groups.splice(_85f,1);
|
|
}
|
|
var _85d=0;
|
|
for(var i=0;i<this.groups.length;i++){
|
|
var _860=this.groups[i];
|
|
_860.startIndex=_85d;
|
|
_85d+=_860.rows.length;
|
|
}
|
|
}});
|
|
$.fn.propertygrid.defaults=$.extend({},$.fn.datagrid.defaults,{groupHeight:21,expanderWidth:16,singleSelect:true,remoteSort:false,fitColumns:true,loadMsg:"",frozenColumns:[[{field:"f",width:16,resizable:false}]],columns:[[{field:"name",title:"Name",width:100,sortable:true},{field:"value",title:"Value",width:100,resizable:false}]],showGroup:false,groupView:_824,groupField:"group",groupFormatter:function(_861,rows){
|
|
return _861;
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _862(_863){
|
|
var _864=$.data(_863,"treegrid");
|
|
var opts=_864.options;
|
|
$(_863).datagrid($.extend({},opts,{url:null,data:null,loader:function(){
|
|
return false;
|
|
},onBeforeLoad:function(){
|
|
return false;
|
|
},onLoadSuccess:function(){
|
|
},onResizeColumn:function(_865,_866){
|
|
_873(_863);
|
|
opts.onResizeColumn.call(_863,_865,_866);
|
|
},onBeforeSortColumn:function(sort,_867){
|
|
if(opts.onBeforeSortColumn.call(_863,sort,_867)==false){
|
|
return false;
|
|
}
|
|
},onSortColumn:function(sort,_868){
|
|
opts.sortName=sort;
|
|
opts.sortOrder=_868;
|
|
if(opts.remoteSort){
|
|
_872(_863);
|
|
}else{
|
|
var data=$(_863).treegrid("getData");
|
|
_889(_863,0,data);
|
|
}
|
|
opts.onSortColumn.call(_863,sort,_868);
|
|
},onClickCell:function(_869,_86a){
|
|
opts.onClickCell.call(_863,_86a,find(_863,_869));
|
|
},onDblClickCell:function(_86b,_86c){
|
|
opts.onDblClickCell.call(_863,_86c,find(_863,_86b));
|
|
},onRowContextMenu:function(e,_86d){
|
|
opts.onContextMenu.call(_863,e,find(_863,_86d));
|
|
}}));
|
|
var _86e=$.data(_863,"datagrid").options;
|
|
opts.columns=_86e.columns;
|
|
opts.frozenColumns=_86e.frozenColumns;
|
|
_864.dc=$.data(_863,"datagrid").dc;
|
|
if(opts.pagination){
|
|
var _86f=$(_863).datagrid("getPager");
|
|
_86f.pagination({pageNumber:opts.pageNumber,pageSize:opts.pageSize,pageList:opts.pageList,onSelectPage:function(_870,_871){
|
|
opts.pageNumber=_870;
|
|
opts.pageSize=_871;
|
|
_872(_863);
|
|
}});
|
|
opts.pageSize=_86f.pagination("options").pageSize;
|
|
}
|
|
};
|
|
function _873(_874,_875){
|
|
var opts=$.data(_874,"datagrid").options;
|
|
var dc=$.data(_874,"datagrid").dc;
|
|
if(!dc.body1.is(":empty")&&(!opts.nowrap||opts.autoRowHeight)){
|
|
if(_875!=undefined){
|
|
var _876=_877(_874,_875);
|
|
for(var i=0;i<_876.length;i++){
|
|
_878(_876[i][opts.idField]);
|
|
}
|
|
}
|
|
}
|
|
$(_874).datagrid("fixRowHeight",_875);
|
|
function _878(_879){
|
|
var tr1=opts.finder.getTr(_874,_879,"body",1);
|
|
var tr2=opts.finder.getTr(_874,_879,"body",2);
|
|
tr1.css("height","");
|
|
tr2.css("height","");
|
|
var _87a=Math.max(tr1.height(),tr2.height());
|
|
tr1.css("height",_87a);
|
|
tr2.css("height",_87a);
|
|
};
|
|
};
|
|
function _87b(_87c){
|
|
var dc=$.data(_87c,"datagrid").dc;
|
|
var opts=$.data(_87c,"treegrid").options;
|
|
if(!opts.rownumbers){
|
|
return;
|
|
}
|
|
dc.body1.find("div.datagrid-cell-rownumber").each(function(i){
|
|
$(this).html(i+1);
|
|
});
|
|
};
|
|
function _87d(_87e){
|
|
return function(e){
|
|
$.fn.datagrid.defaults.rowEvents[_87e?"mouseover":"mouseout"](e);
|
|
var tt=$(e.target);
|
|
var fn=_87e?"addClass":"removeClass";
|
|
if(tt.hasClass("tree-hit")){
|
|
tt.hasClass("tree-expanded")?tt[fn]("tree-expanded-hover"):tt[fn]("tree-collapsed-hover");
|
|
}
|
|
};
|
|
};
|
|
function _87f(e){
|
|
var tt=$(e.target);
|
|
if(tt.hasClass("tree-hit")){
|
|
var tr=tt.closest("tr.datagrid-row");
|
|
var _880=tr.closest("div.datagrid-view").children(".datagrid-f")[0];
|
|
_881(_880,tr.attr("node-id"));
|
|
}else{
|
|
$.fn.datagrid.defaults.rowEvents.click(e);
|
|
}
|
|
};
|
|
function _882(_883,_884){
|
|
var opts=$.data(_883,"treegrid").options;
|
|
var tr1=opts.finder.getTr(_883,_884,"body",1);
|
|
var tr2=opts.finder.getTr(_883,_884,"body",2);
|
|
var _885=$(_883).datagrid("getColumnFields",true).length+(opts.rownumbers?1:0);
|
|
var _886=$(_883).datagrid("getColumnFields",false).length;
|
|
_887(tr1,_885);
|
|
_887(tr2,_886);
|
|
function _887(tr,_888){
|
|
$("<tr class=\"treegrid-tr-tree\">"+"<td style=\"border:0px\" colspan=\""+_888+"\">"+"<div></div>"+"</td>"+"</tr>").insertAfter(tr);
|
|
};
|
|
};
|
|
function _889(_88a,_88b,data,_88c){
|
|
var _88d=$.data(_88a,"treegrid");
|
|
var opts=_88d.options;
|
|
var dc=_88d.dc;
|
|
data=opts.loadFilter.call(_88a,data,_88b);
|
|
var node=find(_88a,_88b);
|
|
if(node){
|
|
var _88e=opts.finder.getTr(_88a,_88b,"body",1);
|
|
var _88f=opts.finder.getTr(_88a,_88b,"body",2);
|
|
var cc1=_88e.next("tr.treegrid-tr-tree").children("td").children("div");
|
|
var cc2=_88f.next("tr.treegrid-tr-tree").children("td").children("div");
|
|
if(!_88c){
|
|
node.children=[];
|
|
}
|
|
}else{
|
|
var cc1=dc.body1;
|
|
var cc2=dc.body2;
|
|
if(!_88c){
|
|
_88d.data=[];
|
|
}
|
|
}
|
|
if(!_88c){
|
|
cc1.empty();
|
|
cc2.empty();
|
|
}
|
|
if(opts.view.onBeforeRender){
|
|
opts.view.onBeforeRender.call(opts.view,_88a,_88b,data);
|
|
}
|
|
opts.view.render.call(opts.view,_88a,cc1,true);
|
|
opts.view.render.call(opts.view,_88a,cc2,false);
|
|
if(opts.showFooter){
|
|
opts.view.renderFooter.call(opts.view,_88a,dc.footer1,true);
|
|
opts.view.renderFooter.call(opts.view,_88a,dc.footer2,false);
|
|
}
|
|
if(opts.view.onAfterRender){
|
|
opts.view.onAfterRender.call(opts.view,_88a);
|
|
}
|
|
if(!_88b&&opts.pagination){
|
|
var _890=$.data(_88a,"treegrid").total;
|
|
var _891=$(_88a).datagrid("getPager");
|
|
if(_891.pagination("options").total!=_890){
|
|
_891.pagination({total:_890});
|
|
}
|
|
}
|
|
_873(_88a);
|
|
_87b(_88a);
|
|
$(_88a).treegrid("showLines");
|
|
$(_88a).treegrid("setSelectionState");
|
|
$(_88a).treegrid("autoSizeColumn");
|
|
opts.onLoadSuccess.call(_88a,node,data);
|
|
};
|
|
function _872(_892,_893,_894,_895,_896){
|
|
var opts=$.data(_892,"treegrid").options;
|
|
var body=$(_892).datagrid("getPanel").find("div.datagrid-body");
|
|
if(_894){
|
|
opts.queryParams=_894;
|
|
}
|
|
var _897=$.extend({},opts.queryParams);
|
|
if(opts.pagination){
|
|
$.extend(_897,{page:opts.pageNumber,rows:opts.pageSize});
|
|
}
|
|
if(opts.sortName){
|
|
$.extend(_897,{sort:opts.sortName,order:opts.sortOrder});
|
|
}
|
|
var row=find(_892,_893);
|
|
if(opts.onBeforeLoad.call(_892,row,_897)==false){
|
|
return;
|
|
}
|
|
var _898=body.find("tr[node-id=\""+_893+"\"] span.tree-folder");
|
|
_898.addClass("tree-loading");
|
|
$(_892).treegrid("loading");
|
|
var _899=opts.loader.call(_892,_897,function(data){
|
|
_898.removeClass("tree-loading");
|
|
$(_892).treegrid("loaded");
|
|
_889(_892,_893,data,_895);
|
|
if(_896){
|
|
_896();
|
|
}
|
|
},function(){
|
|
_898.removeClass("tree-loading");
|
|
$(_892).treegrid("loaded");
|
|
opts.onLoadError.apply(_892,arguments);
|
|
if(_896){
|
|
_896();
|
|
}
|
|
});
|
|
if(_899==false){
|
|
_898.removeClass("tree-loading");
|
|
$(_892).treegrid("loaded");
|
|
}
|
|
};
|
|
function _89a(_89b){
|
|
var rows=_89c(_89b);
|
|
if(rows.length){
|
|
return rows[0];
|
|
}else{
|
|
return null;
|
|
}
|
|
};
|
|
function _89c(_89d){
|
|
return $.data(_89d,"treegrid").data;
|
|
};
|
|
function _89e(_89f,_8a0){
|
|
var row=find(_89f,_8a0);
|
|
if(row._parentId){
|
|
return find(_89f,row._parentId);
|
|
}else{
|
|
return null;
|
|
}
|
|
};
|
|
function _877(_8a1,_8a2){
|
|
var opts=$.data(_8a1,"treegrid").options;
|
|
var body=$(_8a1).datagrid("getPanel").find("div.datagrid-view2 div.datagrid-body");
|
|
var _8a3=[];
|
|
if(_8a2){
|
|
_8a4(_8a2);
|
|
}else{
|
|
var _8a5=_89c(_8a1);
|
|
for(var i=0;i<_8a5.length;i++){
|
|
_8a3.push(_8a5[i]);
|
|
_8a4(_8a5[i][opts.idField]);
|
|
}
|
|
}
|
|
function _8a4(_8a6){
|
|
var _8a7=find(_8a1,_8a6);
|
|
if(_8a7&&_8a7.children){
|
|
for(var i=0,len=_8a7.children.length;i<len;i++){
|
|
var _8a8=_8a7.children[i];
|
|
_8a3.push(_8a8);
|
|
_8a4(_8a8[opts.idField]);
|
|
}
|
|
}
|
|
};
|
|
return _8a3;
|
|
};
|
|
function _8a9(_8aa,_8ab){
|
|
var opts=$.data(_8aa,"treegrid").options;
|
|
var tr=opts.finder.getTr(_8aa,_8ab);
|
|
var node=tr.children("td[field=\""+opts.treeField+"\"]");
|
|
return node.find("span.tree-indent,span.tree-hit").length;
|
|
};
|
|
function find(_8ac,_8ad){
|
|
var opts=$.data(_8ac,"treegrid").options;
|
|
var data=$.data(_8ac,"treegrid").data;
|
|
var cc=[data];
|
|
while(cc.length){
|
|
var c=cc.shift();
|
|
for(var i=0;i<c.length;i++){
|
|
var node=c[i];
|
|
if(node[opts.idField]==_8ad){
|
|
return node;
|
|
}else{
|
|
if(node["children"]){
|
|
cc.push(node["children"]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _8ae(_8af,_8b0){
|
|
var opts=$.data(_8af,"treegrid").options;
|
|
var row=find(_8af,_8b0);
|
|
var tr=opts.finder.getTr(_8af,_8b0);
|
|
var hit=tr.find("span.tree-hit");
|
|
if(hit.length==0){
|
|
return;
|
|
}
|
|
if(hit.hasClass("tree-collapsed")){
|
|
return;
|
|
}
|
|
if(opts.onBeforeCollapse.call(_8af,row)==false){
|
|
return;
|
|
}
|
|
hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed");
|
|
hit.next().removeClass("tree-folder-open");
|
|
row.state="closed";
|
|
tr=tr.next("tr.treegrid-tr-tree");
|
|
var cc=tr.children("td").children("div");
|
|
if(opts.animate){
|
|
cc.slideUp("normal",function(){
|
|
$(_8af).treegrid("autoSizeColumn");
|
|
_873(_8af,_8b0);
|
|
opts.onCollapse.call(_8af,row);
|
|
});
|
|
}else{
|
|
cc.hide();
|
|
$(_8af).treegrid("autoSizeColumn");
|
|
_873(_8af,_8b0);
|
|
opts.onCollapse.call(_8af,row);
|
|
}
|
|
};
|
|
function _8b1(_8b2,_8b3){
|
|
var opts=$.data(_8b2,"treegrid").options;
|
|
var tr=opts.finder.getTr(_8b2,_8b3);
|
|
var hit=tr.find("span.tree-hit");
|
|
var row=find(_8b2,_8b3);
|
|
if(hit.length==0){
|
|
return;
|
|
}
|
|
if(hit.hasClass("tree-expanded")){
|
|
return;
|
|
}
|
|
if(opts.onBeforeExpand.call(_8b2,row)==false){
|
|
return;
|
|
}
|
|
hit.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded");
|
|
hit.next().addClass("tree-folder-open");
|
|
var _8b4=tr.next("tr.treegrid-tr-tree");
|
|
if(_8b4.length){
|
|
var cc=_8b4.children("td").children("div");
|
|
_8b5(cc);
|
|
}else{
|
|
_882(_8b2,row[opts.idField]);
|
|
var _8b4=tr.next("tr.treegrid-tr-tree");
|
|
var cc=_8b4.children("td").children("div");
|
|
cc.hide();
|
|
var _8b6=$.extend({},opts.queryParams||{});
|
|
_8b6.id=row[opts.idField];
|
|
_872(_8b2,row[opts.idField],_8b6,true,function(){
|
|
if(cc.is(":empty")){
|
|
_8b4.remove();
|
|
}else{
|
|
_8b5(cc);
|
|
}
|
|
});
|
|
}
|
|
function _8b5(cc){
|
|
row.state="open";
|
|
if(opts.animate){
|
|
cc.slideDown("normal",function(){
|
|
$(_8b2).treegrid("autoSizeColumn");
|
|
_873(_8b2,_8b3);
|
|
opts.onExpand.call(_8b2,row);
|
|
});
|
|
}else{
|
|
cc.show();
|
|
$(_8b2).treegrid("autoSizeColumn");
|
|
_873(_8b2,_8b3);
|
|
opts.onExpand.call(_8b2,row);
|
|
}
|
|
};
|
|
};
|
|
function _881(_8b7,_8b8){
|
|
var opts=$.data(_8b7,"treegrid").options;
|
|
var tr=opts.finder.getTr(_8b7,_8b8);
|
|
var hit=tr.find("span.tree-hit");
|
|
if(hit.hasClass("tree-expanded")){
|
|
_8ae(_8b7,_8b8);
|
|
}else{
|
|
_8b1(_8b7,_8b8);
|
|
}
|
|
};
|
|
function _8b9(_8ba,_8bb){
|
|
var opts=$.data(_8ba,"treegrid").options;
|
|
var _8bc=_877(_8ba,_8bb);
|
|
if(_8bb){
|
|
_8bc.unshift(find(_8ba,_8bb));
|
|
}
|
|
for(var i=0;i<_8bc.length;i++){
|
|
_8ae(_8ba,_8bc[i][opts.idField]);
|
|
}
|
|
};
|
|
function _8bd(_8be,_8bf){
|
|
var opts=$.data(_8be,"treegrid").options;
|
|
var _8c0=_877(_8be,_8bf);
|
|
if(_8bf){
|
|
_8c0.unshift(find(_8be,_8bf));
|
|
}
|
|
for(var i=0;i<_8c0.length;i++){
|
|
_8b1(_8be,_8c0[i][opts.idField]);
|
|
}
|
|
};
|
|
function _8c1(_8c2,_8c3){
|
|
var opts=$.data(_8c2,"treegrid").options;
|
|
var ids=[];
|
|
var p=_89e(_8c2,_8c3);
|
|
while(p){
|
|
var id=p[opts.idField];
|
|
ids.unshift(id);
|
|
p=_89e(_8c2,id);
|
|
}
|
|
for(var i=0;i<ids.length;i++){
|
|
_8b1(_8c2,ids[i]);
|
|
}
|
|
};
|
|
function _8c4(_8c5,_8c6){
|
|
var opts=$.data(_8c5,"treegrid").options;
|
|
if(_8c6.parent){
|
|
var tr=opts.finder.getTr(_8c5,_8c6.parent);
|
|
if(tr.next("tr.treegrid-tr-tree").length==0){
|
|
_882(_8c5,_8c6.parent);
|
|
}
|
|
var cell=tr.children("td[field=\""+opts.treeField+"\"]").children("div.datagrid-cell");
|
|
var _8c7=cell.children("span.tree-icon");
|
|
if(_8c7.hasClass("tree-file")){
|
|
_8c7.removeClass("tree-file").addClass("tree-folder tree-folder-open");
|
|
var hit=$("<span class=\"tree-hit tree-expanded\"></span>").insertBefore(_8c7);
|
|
if(hit.prev().length){
|
|
hit.prev().remove();
|
|
}
|
|
}
|
|
}
|
|
_889(_8c5,_8c6.parent,_8c6.data,true);
|
|
};
|
|
function _8c8(_8c9,_8ca){
|
|
var ref=_8ca.before||_8ca.after;
|
|
var opts=$.data(_8c9,"treegrid").options;
|
|
var _8cb=_89e(_8c9,ref);
|
|
_8c4(_8c9,{parent:(_8cb?_8cb[opts.idField]:null),data:[_8ca.data]});
|
|
var _8cc=_8cb?_8cb.children:$(_8c9).treegrid("getRoots");
|
|
for(var i=0;i<_8cc.length;i++){
|
|
if(_8cc[i][opts.idField]==ref){
|
|
var _8cd=_8cc[_8cc.length-1];
|
|
_8cc.splice(_8ca.before?i:(i+1),0,_8cd);
|
|
_8cc.splice(_8cc.length-1,1);
|
|
break;
|
|
}
|
|
}
|
|
_8ce(true);
|
|
_8ce(false);
|
|
_87b(_8c9);
|
|
$(_8c9).treegrid("showLines");
|
|
function _8ce(_8cf){
|
|
var _8d0=_8cf?1:2;
|
|
var tr=opts.finder.getTr(_8c9,_8ca.data[opts.idField],"body",_8d0);
|
|
var _8d1=tr.closest("table.datagrid-btable");
|
|
tr=tr.parent().children();
|
|
var dest=opts.finder.getTr(_8c9,ref,"body",_8d0);
|
|
if(_8ca.before){
|
|
tr.insertBefore(dest);
|
|
}else{
|
|
var sub=dest.next("tr.treegrid-tr-tree");
|
|
tr.insertAfter(sub.length?sub:dest);
|
|
}
|
|
_8d1.remove();
|
|
};
|
|
};
|
|
function _8d2(_8d3,_8d4){
|
|
var _8d5=$.data(_8d3,"treegrid");
|
|
$(_8d3).datagrid("deleteRow",_8d4);
|
|
_87b(_8d3);
|
|
_8d5.total-=1;
|
|
$(_8d3).datagrid("getPager").pagination("refresh",{total:_8d5.total});
|
|
$(_8d3).treegrid("showLines");
|
|
};
|
|
function _8d6(_8d7){
|
|
var t=$(_8d7);
|
|
var opts=t.treegrid("options");
|
|
if(opts.lines){
|
|
t.treegrid("getPanel").addClass("tree-lines");
|
|
}else{
|
|
t.treegrid("getPanel").removeClass("tree-lines");
|
|
return;
|
|
}
|
|
t.treegrid("getPanel").find("span.tree-indent").removeClass("tree-line tree-join tree-joinbottom");
|
|
t.treegrid("getPanel").find("div.datagrid-cell").removeClass("tree-node-last tree-root-first tree-root-one");
|
|
var _8d8=t.treegrid("getRoots");
|
|
if(_8d8.length>1){
|
|
_8d9(_8d8[0]).addClass("tree-root-first");
|
|
}else{
|
|
if(_8d8.length==1){
|
|
_8d9(_8d8[0]).addClass("tree-root-one");
|
|
}
|
|
}
|
|
_8da(_8d8);
|
|
_8db(_8d8);
|
|
function _8da(_8dc){
|
|
$.map(_8dc,function(node){
|
|
if(node.children&&node.children.length){
|
|
_8da(node.children);
|
|
}else{
|
|
var cell=_8d9(node);
|
|
cell.find(".tree-icon").prev().addClass("tree-join");
|
|
}
|
|
});
|
|
if(_8dc.length){
|
|
var cell=_8d9(_8dc[_8dc.length-1]);
|
|
cell.addClass("tree-node-last");
|
|
cell.find(".tree-join").removeClass("tree-join").addClass("tree-joinbottom");
|
|
}
|
|
};
|
|
function _8db(_8dd){
|
|
$.map(_8dd,function(node){
|
|
if(node.children&&node.children.length){
|
|
_8db(node.children);
|
|
}
|
|
});
|
|
for(var i=0;i<_8dd.length-1;i++){
|
|
var node=_8dd[i];
|
|
var _8de=t.treegrid("getLevel",node[opts.idField]);
|
|
var tr=opts.finder.getTr(_8d7,node[opts.idField]);
|
|
var cc=tr.next().find("tr.datagrid-row td[field=\""+opts.treeField+"\"] div.datagrid-cell");
|
|
cc.find("span:eq("+(_8de-1)+")").addClass("tree-line");
|
|
}
|
|
};
|
|
function _8d9(node){
|
|
var tr=opts.finder.getTr(_8d7,node[opts.idField]);
|
|
var cell=tr.find("td[field=\""+opts.treeField+"\"] div.datagrid-cell");
|
|
return cell;
|
|
};
|
|
};
|
|
$.fn.treegrid=function(_8df,_8e0){
|
|
if(typeof _8df=="string"){
|
|
var _8e1=$.fn.treegrid.methods[_8df];
|
|
if(_8e1){
|
|
return _8e1(this,_8e0);
|
|
}else{
|
|
return this.datagrid(_8df,_8e0);
|
|
}
|
|
}
|
|
_8df=_8df||{};
|
|
return this.each(function(){
|
|
var _8e2=$.data(this,"treegrid");
|
|
if(_8e2){
|
|
$.extend(_8e2.options,_8df);
|
|
}else{
|
|
_8e2=$.data(this,"treegrid",{options:$.extend({},$.fn.treegrid.defaults,$.fn.treegrid.parseOptions(this),_8df),data:[]});
|
|
}
|
|
_862(this);
|
|
if(_8e2.options.data){
|
|
$(this).treegrid("loadData",_8e2.options.data);
|
|
}
|
|
_872(this);
|
|
});
|
|
};
|
|
$.fn.treegrid.methods={options:function(jq){
|
|
return $.data(jq[0],"treegrid").options;
|
|
},resize:function(jq,_8e3){
|
|
return jq.each(function(){
|
|
$(this).datagrid("resize",_8e3);
|
|
});
|
|
},fixRowHeight:function(jq,_8e4){
|
|
return jq.each(function(){
|
|
_873(this,_8e4);
|
|
});
|
|
},loadData:function(jq,data){
|
|
return jq.each(function(){
|
|
_889(this,data.parent,data);
|
|
});
|
|
},load:function(jq,_8e5){
|
|
return jq.each(function(){
|
|
$(this).treegrid("options").pageNumber=1;
|
|
$(this).treegrid("getPager").pagination({pageNumber:1});
|
|
$(this).treegrid("reload",_8e5);
|
|
});
|
|
},reload:function(jq,id){
|
|
return jq.each(function(){
|
|
var opts=$(this).treegrid("options");
|
|
var _8e6={};
|
|
if(typeof id=="object"){
|
|
_8e6=id;
|
|
}else{
|
|
_8e6=$.extend({},opts.queryParams);
|
|
_8e6.id=id;
|
|
}
|
|
if(_8e6.id){
|
|
var node=$(this).treegrid("find",_8e6.id);
|
|
if(node.children){
|
|
node.children.splice(0,node.children.length);
|
|
}
|
|
opts.queryParams=_8e6;
|
|
var tr=opts.finder.getTr(this,_8e6.id);
|
|
tr.next("tr.treegrid-tr-tree").remove();
|
|
tr.find("span.tree-hit").removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed");
|
|
_8b1(this,_8e6.id);
|
|
}else{
|
|
_872(this,null,_8e6);
|
|
}
|
|
});
|
|
},reloadFooter:function(jq,_8e7){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"treegrid").options;
|
|
var dc=$.data(this,"datagrid").dc;
|
|
if(_8e7){
|
|
$.data(this,"treegrid").footer=_8e7;
|
|
}
|
|
if(opts.showFooter){
|
|
opts.view.renderFooter.call(opts.view,this,dc.footer1,true);
|
|
opts.view.renderFooter.call(opts.view,this,dc.footer2,false);
|
|
if(opts.view.onAfterRender){
|
|
opts.view.onAfterRender.call(opts.view,this);
|
|
}
|
|
$(this).treegrid("fixRowHeight");
|
|
}
|
|
});
|
|
},getData:function(jq){
|
|
return $.data(jq[0],"treegrid").data;
|
|
},getFooterRows:function(jq){
|
|
return $.data(jq[0],"treegrid").footer;
|
|
},getRoot:function(jq){
|
|
return _89a(jq[0]);
|
|
},getRoots:function(jq){
|
|
return _89c(jq[0]);
|
|
},getParent:function(jq,id){
|
|
return _89e(jq[0],id);
|
|
},getChildren:function(jq,id){
|
|
return _877(jq[0],id);
|
|
},getLevel:function(jq,id){
|
|
return _8a9(jq[0],id);
|
|
},find:function(jq,id){
|
|
return find(jq[0],id);
|
|
},isLeaf:function(jq,id){
|
|
var opts=$.data(jq[0],"treegrid").options;
|
|
var tr=opts.finder.getTr(jq[0],id);
|
|
var hit=tr.find("span.tree-hit");
|
|
return hit.length==0;
|
|
},select:function(jq,id){
|
|
return jq.each(function(){
|
|
$(this).datagrid("selectRow",id);
|
|
});
|
|
},unselect:function(jq,id){
|
|
return jq.each(function(){
|
|
$(this).datagrid("unselectRow",id);
|
|
});
|
|
},collapse:function(jq,id){
|
|
return jq.each(function(){
|
|
_8ae(this,id);
|
|
});
|
|
},expand:function(jq,id){
|
|
return jq.each(function(){
|
|
_8b1(this,id);
|
|
});
|
|
},toggle:function(jq,id){
|
|
return jq.each(function(){
|
|
_881(this,id);
|
|
});
|
|
},collapseAll:function(jq,id){
|
|
return jq.each(function(){
|
|
_8b9(this,id);
|
|
});
|
|
},expandAll:function(jq,id){
|
|
return jq.each(function(){
|
|
_8bd(this,id);
|
|
});
|
|
},expandTo:function(jq,id){
|
|
return jq.each(function(){
|
|
_8c1(this,id);
|
|
});
|
|
},append:function(jq,_8e8){
|
|
return jq.each(function(){
|
|
_8c4(this,_8e8);
|
|
});
|
|
},insert:function(jq,_8e9){
|
|
return jq.each(function(){
|
|
_8c8(this,_8e9);
|
|
});
|
|
},remove:function(jq,id){
|
|
return jq.each(function(){
|
|
_8d2(this,id);
|
|
});
|
|
},pop:function(jq,id){
|
|
var row=jq.treegrid("find",id);
|
|
jq.treegrid("remove",id);
|
|
return row;
|
|
},refresh:function(jq,id){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"treegrid").options;
|
|
opts.view.refreshRow.call(opts.view,this,id);
|
|
});
|
|
},update:function(jq,_8ea){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"treegrid").options;
|
|
opts.view.updateRow.call(opts.view,this,_8ea.id,_8ea.row);
|
|
});
|
|
},beginEdit:function(jq,id){
|
|
return jq.each(function(){
|
|
$(this).datagrid("beginEdit",id);
|
|
$(this).treegrid("fixRowHeight",id);
|
|
});
|
|
},endEdit:function(jq,id){
|
|
return jq.each(function(){
|
|
$(this).datagrid("endEdit",id);
|
|
});
|
|
},cancelEdit:function(jq,id){
|
|
return jq.each(function(){
|
|
$(this).datagrid("cancelEdit",id);
|
|
});
|
|
},showLines:function(jq){
|
|
return jq.each(function(){
|
|
_8d6(this);
|
|
});
|
|
}};
|
|
$.fn.treegrid.parseOptions=function(_8eb){
|
|
return $.extend({},$.fn.datagrid.parseOptions(_8eb),$.parser.parseOptions(_8eb,["treeField",{animate:"boolean"}]));
|
|
};
|
|
var _8ec=$.extend({},$.fn.datagrid.defaults.view,{render:function(_8ed,_8ee,_8ef){
|
|
var opts=$.data(_8ed,"treegrid").options;
|
|
var _8f0=$(_8ed).datagrid("getColumnFields",_8ef);
|
|
var _8f1=$.data(_8ed,"datagrid").rowIdPrefix;
|
|
if(_8ef){
|
|
if(!(opts.rownumbers||(opts.frozenColumns&&opts.frozenColumns.length))){
|
|
return;
|
|
}
|
|
}
|
|
var view=this;
|
|
if(this.treeNodes&&this.treeNodes.length){
|
|
var _8f2=_8f3(_8ef,this.treeLevel,this.treeNodes);
|
|
$(_8ee).append(_8f2.join(""));
|
|
}
|
|
function _8f3(_8f4,_8f5,_8f6){
|
|
var _8f7=$(_8ed).treegrid("getParent",_8f6[0][opts.idField]);
|
|
var _8f8=(_8f7?_8f7.children.length:$(_8ed).treegrid("getRoots").length)-_8f6.length;
|
|
var _8f9=["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
|
|
for(var i=0;i<_8f6.length;i++){
|
|
var row=_8f6[i];
|
|
if(row.state!="open"&&row.state!="closed"){
|
|
row.state="open";
|
|
}
|
|
var css=opts.rowStyler?opts.rowStyler.call(_8ed,row):"";
|
|
var _8fa="";
|
|
var _8fb="";
|
|
if(typeof css=="string"){
|
|
_8fb=css;
|
|
}else{
|
|
if(css){
|
|
_8fa=css["class"]||"";
|
|
_8fb=css["style"]||"";
|
|
}
|
|
}
|
|
var cls="class=\"datagrid-row "+(_8f8++%2&&opts.striped?"datagrid-row-alt ":" ")+_8fa+"\"";
|
|
var _8fc=_8fb?"style=\""+_8fb+"\"":"";
|
|
var _8fd=_8f1+"-"+(_8f4?1:2)+"-"+row[opts.idField];
|
|
_8f9.push("<tr id=\""+_8fd+"\" node-id=\""+row[opts.idField]+"\" "+cls+" "+_8fc+">");
|
|
_8f9=_8f9.concat(view.renderRow.call(view,_8ed,_8f0,_8f4,_8f5,row));
|
|
_8f9.push("</tr>");
|
|
if(row.children&&row.children.length){
|
|
var tt=_8f3(_8f4,_8f5+1,row.children);
|
|
var v=row.state=="closed"?"none":"block";
|
|
_8f9.push("<tr class=\"treegrid-tr-tree\"><td style=\"border:0px\" colspan="+(_8f0.length+(opts.rownumbers?1:0))+"><div style=\"display:"+v+"\">");
|
|
_8f9=_8f9.concat(tt);
|
|
_8f9.push("</div></td></tr>");
|
|
}
|
|
}
|
|
_8f9.push("</tbody></table>");
|
|
return _8f9;
|
|
};
|
|
},renderFooter:function(_8fe,_8ff,_900){
|
|
var opts=$.data(_8fe,"treegrid").options;
|
|
var rows=$.data(_8fe,"treegrid").footer||[];
|
|
var _901=$(_8fe).datagrid("getColumnFields",_900);
|
|
var _902=["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
row[opts.idField]=row[opts.idField]||("foot-row-id"+i);
|
|
_902.push("<tr class=\"datagrid-row\" node-id=\""+row[opts.idField]+"\">");
|
|
_902.push(this.renderRow.call(this,_8fe,_901,_900,0,row));
|
|
_902.push("</tr>");
|
|
}
|
|
_902.push("</tbody></table>");
|
|
$(_8ff).html(_902.join(""));
|
|
},renderRow:function(_903,_904,_905,_906,row){
|
|
var opts=$.data(_903,"treegrid").options;
|
|
var cc=[];
|
|
if(_905&&opts.rownumbers){
|
|
cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">0</div></td>");
|
|
}
|
|
for(var i=0;i<_904.length;i++){
|
|
var _907=_904[i];
|
|
var col=$(_903).datagrid("getColumnOption",_907);
|
|
if(col){
|
|
var css=col.styler?(col.styler(row[_907],row)||""):"";
|
|
var _908="";
|
|
var _909="";
|
|
if(typeof css=="string"){
|
|
_909=css;
|
|
}else{
|
|
if(cc){
|
|
_908=css["class"]||"";
|
|
_909=css["style"]||"";
|
|
}
|
|
}
|
|
var cls=_908?"class=\""+_908+"\"":"";
|
|
var _90a=col.hidden?"style=\"display:none;"+_909+"\"":(_909?"style=\""+_909+"\"":"");
|
|
cc.push("<td field=\""+_907+"\" "+cls+" "+_90a+">");
|
|
var _90a="";
|
|
if(!col.checkbox){
|
|
if(col.align){
|
|
_90a+="text-align:"+col.align+";";
|
|
}
|
|
if(!opts.nowrap){
|
|
_90a+="white-space:normal;height:auto;";
|
|
}else{
|
|
if(opts.autoRowHeight){
|
|
_90a+="height:auto;";
|
|
}
|
|
}
|
|
}
|
|
cc.push("<div style=\""+_90a+"\" ");
|
|
if(col.checkbox){
|
|
cc.push("class=\"datagrid-cell-check ");
|
|
}else{
|
|
cc.push("class=\"datagrid-cell "+col.cellClass);
|
|
}
|
|
cc.push("\">");
|
|
if(col.checkbox){
|
|
if(row.checked){
|
|
cc.push("<input type=\"checkbox\" checked=\"checked\"");
|
|
}else{
|
|
cc.push("<input type=\"checkbox\"");
|
|
}
|
|
cc.push(" name=\""+_907+"\" value=\""+(row[_907]!=undefined?row[_907]:"")+"\">");
|
|
}else{
|
|
var val=null;
|
|
if(col.formatter){
|
|
val=col.formatter(row[_907],row);
|
|
}else{
|
|
val=row[_907];
|
|
}
|
|
if(_907==opts.treeField){
|
|
for(var j=0;j<_906;j++){
|
|
cc.push("<span class=\"tree-indent\"></span>");
|
|
}
|
|
if(row.state=="closed"){
|
|
cc.push("<span class=\"tree-hit tree-collapsed\"></span>");
|
|
cc.push("<span class=\"tree-icon tree-folder "+(row.iconCls?row.iconCls:"")+"\"></span>");
|
|
}else{
|
|
if(row.children&&row.children.length){
|
|
cc.push("<span class=\"tree-hit tree-expanded\"></span>");
|
|
cc.push("<span class=\"tree-icon tree-folder tree-folder-open "+(row.iconCls?row.iconCls:"")+"\"></span>");
|
|
}else{
|
|
cc.push("<span class=\"tree-indent\"></span>");
|
|
cc.push("<span class=\"tree-icon tree-file "+(row.iconCls?row.iconCls:"")+"\"></span>");
|
|
}
|
|
}
|
|
cc.push("<span class=\"tree-title\">"+val+"</span>");
|
|
}else{
|
|
cc.push(val);
|
|
}
|
|
}
|
|
cc.push("</div>");
|
|
cc.push("</td>");
|
|
}
|
|
}
|
|
return cc.join("");
|
|
},refreshRow:function(_90b,id){
|
|
this.updateRow.call(this,_90b,id,{});
|
|
},updateRow:function(_90c,id,row){
|
|
var opts=$.data(_90c,"treegrid").options;
|
|
var _90d=$(_90c).treegrid("find",id);
|
|
$.extend(_90d,row);
|
|
var _90e=$(_90c).treegrid("getLevel",id)-1;
|
|
var _90f=opts.rowStyler?opts.rowStyler.call(_90c,_90d):"";
|
|
var _910=$.data(_90c,"datagrid").rowIdPrefix;
|
|
var _911=_90d[opts.idField];
|
|
function _912(_913){
|
|
var _914=$(_90c).treegrid("getColumnFields",_913);
|
|
var tr=opts.finder.getTr(_90c,id,"body",(_913?1:2));
|
|
var _915=tr.find("div.datagrid-cell-rownumber").html();
|
|
var _916=tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked");
|
|
tr.html(this.renderRow(_90c,_914,_913,_90e,_90d));
|
|
tr.attr("style",_90f||"");
|
|
tr.find("div.datagrid-cell-rownumber").html(_915);
|
|
if(_916){
|
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true);
|
|
}
|
|
if(_911!=id){
|
|
tr.attr("id",_910+"-"+(_913?1:2)+"-"+_911);
|
|
tr.attr("node-id",_911);
|
|
}
|
|
};
|
|
_912.call(this,true);
|
|
_912.call(this,false);
|
|
$(_90c).treegrid("fixRowHeight",id);
|
|
},deleteRow:function(_917,id){
|
|
var opts=$.data(_917,"treegrid").options;
|
|
var tr=opts.finder.getTr(_917,id);
|
|
tr.next("tr.treegrid-tr-tree").remove();
|
|
tr.remove();
|
|
var _918=del(id);
|
|
if(_918){
|
|
if(_918.children.length==0){
|
|
tr=opts.finder.getTr(_917,_918[opts.idField]);
|
|
tr.next("tr.treegrid-tr-tree").remove();
|
|
var cell=tr.children("td[field=\""+opts.treeField+"\"]").children("div.datagrid-cell");
|
|
cell.find(".tree-icon").removeClass("tree-folder").addClass("tree-file");
|
|
cell.find(".tree-hit").remove();
|
|
$("<span class=\"tree-indent\"></span>").prependTo(cell);
|
|
}
|
|
}
|
|
function del(id){
|
|
var cc;
|
|
var _919=$(_917).treegrid("getParent",id);
|
|
if(_919){
|
|
cc=_919.children;
|
|
}else{
|
|
cc=$(_917).treegrid("getData");
|
|
}
|
|
for(var i=0;i<cc.length;i++){
|
|
if(cc[i][opts.idField]==id){
|
|
cc.splice(i,1);
|
|
break;
|
|
}
|
|
}
|
|
return _919;
|
|
};
|
|
},onBeforeRender:function(_91a,_91b,data){
|
|
if($.isArray(_91b)){
|
|
data={total:_91b.length,rows:_91b};
|
|
_91b=null;
|
|
}
|
|
if(!data){
|
|
return false;
|
|
}
|
|
var _91c=$.data(_91a,"treegrid");
|
|
var opts=_91c.options;
|
|
if(data.length==undefined){
|
|
if(data.footer){
|
|
_91c.footer=data.footer;
|
|
}
|
|
if(data.total){
|
|
_91c.total=data.total;
|
|
}
|
|
data=this.transfer(_91a,_91b,data.rows);
|
|
}else{
|
|
function _91d(_91e,_91f){
|
|
for(var i=0;i<_91e.length;i++){
|
|
var row=_91e[i];
|
|
row._parentId=_91f;
|
|
if(row.children&&row.children.length){
|
|
_91d(row.children,row[opts.idField]);
|
|
}
|
|
}
|
|
};
|
|
_91d(data,_91b);
|
|
}
|
|
var node=find(_91a,_91b);
|
|
if(node){
|
|
if(node.children){
|
|
node.children=node.children.concat(data);
|
|
}else{
|
|
node.children=data;
|
|
}
|
|
}else{
|
|
_91c.data=_91c.data.concat(data);
|
|
}
|
|
this.sort(_91a,data);
|
|
this.treeNodes=data;
|
|
this.treeLevel=$(_91a).treegrid("getLevel",_91b);
|
|
},sort:function(_920,data){
|
|
var opts=$.data(_920,"treegrid").options;
|
|
if(!opts.remoteSort&&opts.sortName){
|
|
var _921=opts.sortName.split(",");
|
|
var _922=opts.sortOrder.split(",");
|
|
_923(data);
|
|
}
|
|
function _923(rows){
|
|
rows.sort(function(r1,r2){
|
|
var r=0;
|
|
for(var i=0;i<_921.length;i++){
|
|
var sn=_921[i];
|
|
var so=_922[i];
|
|
var col=$(_920).treegrid("getColumnOption",sn);
|
|
var _924=col.sorter||function(a,b){
|
|
return a==b?0:(a>b?1:-1);
|
|
};
|
|
r=_924(r1[sn],r2[sn])*(so=="asc"?1:-1);
|
|
if(r!=0){
|
|
return r;
|
|
}
|
|
}
|
|
return r;
|
|
});
|
|
for(var i=0;i<rows.length;i++){
|
|
var _925=rows[i].children;
|
|
if(_925&&_925.length){
|
|
_923(_925);
|
|
}
|
|
}
|
|
};
|
|
},transfer:function(_926,_927,data){
|
|
var opts=$.data(_926,"treegrid").options;
|
|
var rows=[];
|
|
for(var i=0;i<data.length;i++){
|
|
rows.push(data[i]);
|
|
}
|
|
var _928=[];
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
if(!_927){
|
|
if(!row._parentId){
|
|
_928.push(row);
|
|
rows.splice(i,1);
|
|
i--;
|
|
}
|
|
}else{
|
|
if(row._parentId==_927){
|
|
_928.push(row);
|
|
rows.splice(i,1);
|
|
i--;
|
|
}
|
|
}
|
|
}
|
|
var toDo=[];
|
|
for(var i=0;i<_928.length;i++){
|
|
toDo.push(_928[i]);
|
|
}
|
|
while(toDo.length){
|
|
var node=toDo.shift();
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
if(row._parentId==node[opts.idField]){
|
|
if(node.children){
|
|
node.children.push(row);
|
|
}else{
|
|
node.children=[row];
|
|
}
|
|
toDo.push(row);
|
|
rows.splice(i,1);
|
|
i--;
|
|
}
|
|
}
|
|
}
|
|
return _928;
|
|
}});
|
|
$.fn.treegrid.defaults=$.extend({},$.fn.datagrid.defaults,{treeField:null,lines:false,animate:false,singleSelect:true,view:_8ec,rowEvents:$.extend({},$.fn.datagrid.defaults.rowEvents,{mouseover:_87d(true),mouseout:_87d(false),click:_87f}),loader:function(_929,_92a,_92b){
|
|
var opts=$(this).treegrid("options");
|
|
if(!opts.url){
|
|
return false;
|
|
}
|
|
$.ajax({type:opts.method,url:opts.url,data:_929,dataType:"json",success:function(data){
|
|
_92a(data);
|
|
},error:function(){
|
|
_92b.apply(this,arguments);
|
|
}});
|
|
},loadFilter:function(data,_92c){
|
|
return data;
|
|
},finder:{getTr:function(_92d,id,type,_92e){
|
|
type=type||"body";
|
|
_92e=_92e||0;
|
|
var dc=$.data(_92d,"datagrid").dc;
|
|
if(_92e==0){
|
|
var opts=$.data(_92d,"treegrid").options;
|
|
var tr1=opts.finder.getTr(_92d,id,type,1);
|
|
var tr2=opts.finder.getTr(_92d,id,type,2);
|
|
return tr1.add(tr2);
|
|
}else{
|
|
if(type=="body"){
|
|
var tr=$("#"+$.data(_92d,"datagrid").rowIdPrefix+"-"+_92e+"-"+id);
|
|
if(!tr.length){
|
|
tr=(_92e==1?dc.body1:dc.body2).find("tr[node-id=\""+id+"\"]");
|
|
}
|
|
return tr;
|
|
}else{
|
|
if(type=="footer"){
|
|
return (_92e==1?dc.footer1:dc.footer2).find("tr[node-id=\""+id+"\"]");
|
|
}else{
|
|
if(type=="selected"){
|
|
return (_92e==1?dc.body1:dc.body2).find("tr.datagrid-row-selected");
|
|
}else{
|
|
if(type=="highlight"){
|
|
return (_92e==1?dc.body1:dc.body2).find("tr.datagrid-row-over");
|
|
}else{
|
|
if(type=="checked"){
|
|
return (_92e==1?dc.body1:dc.body2).find("tr.datagrid-row-checked");
|
|
}else{
|
|
if(type=="last"){
|
|
return (_92e==1?dc.body1:dc.body2).find("tr:last[node-id]");
|
|
}else{
|
|
if(type=="allbody"){
|
|
return (_92e==1?dc.body1:dc.body2).find("tr[node-id]");
|
|
}else{
|
|
if(type=="allfooter"){
|
|
return (_92e==1?dc.footer1:dc.footer2).find("tr[node-id]");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},getRow:function(_92f,p){
|
|
var id=(typeof p=="object")?p.attr("node-id"):p;
|
|
return $(_92f).treegrid("find",id);
|
|
},getRows:function(_930){
|
|
return $(_930).treegrid("getChildren");
|
|
}},onBeforeLoad:function(row,_931){
|
|
},onLoadSuccess:function(row,data){
|
|
},onLoadError:function(){
|
|
},onBeforeCollapse:function(row){
|
|
},onCollapse:function(row){
|
|
},onBeforeExpand:function(row){
|
|
},onExpand:function(row){
|
|
},onClickRow:function(row){
|
|
},onDblClickRow:function(row){
|
|
},onClickCell:function(_932,row){
|
|
},onDblClickCell:function(_933,row){
|
|
},onContextMenu:function(e,row){
|
|
},onBeforeEdit:function(row){
|
|
},onAfterEdit:function(row,_934){
|
|
},onCancelEdit:function(row){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _935(_936){
|
|
var opts=$.data(_936,"datalist").options;
|
|
$(_936).datagrid($.extend({},opts,{cls:"datalist"+(opts.lines?" datalist-lines":""),frozenColumns:(opts.frozenColumns&&opts.frozenColumns.length)?opts.frozenColumns:(opts.checkbox?[[{field:"_ck",checkbox:true}]]:undefined),columns:(opts.columns&&opts.columns.length)?opts.columns:[[{field:opts.textField,width:"100%",formatter:function(_937,row,_938){
|
|
return opts.textFormatter?opts.textFormatter(_937,row,_938):_937;
|
|
}}]]}));
|
|
};
|
|
var _939=$.extend({},$.fn.datagrid.defaults.view,{render:function(_93a,_93b,_93c){
|
|
var _93d=$.data(_93a,"datagrid");
|
|
var opts=_93d.options;
|
|
if(opts.groupField){
|
|
var g=this.groupRows(_93a,_93d.data.rows);
|
|
this.groups=g.groups;
|
|
_93d.data.rows=g.rows;
|
|
var _93e=[];
|
|
for(var i=0;i<g.groups.length;i++){
|
|
_93e.push(this.renderGroup.call(this,_93a,i,g.groups[i],_93c));
|
|
}
|
|
$(_93b).html(_93e.join(""));
|
|
}else{
|
|
$(_93b).html(this.renderTable(_93a,0,_93d.data.rows,_93c));
|
|
}
|
|
},renderGroup:function(_93f,_940,_941,_942){
|
|
var _943=$.data(_93f,"datagrid");
|
|
var opts=_943.options;
|
|
var _944=$(_93f).datagrid("getColumnFields",_942);
|
|
var _945=[];
|
|
_945.push("<div class=\"datagrid-group\" group-index="+_940+">");
|
|
if(!_942){
|
|
_945.push("<span class=\"datagrid-group-title\">");
|
|
_945.push(opts.groupFormatter.call(_93f,_941.value,_941.rows));
|
|
_945.push("</span>");
|
|
}
|
|
_945.push("</div>");
|
|
_945.push(this.renderTable(_93f,_941.startIndex,_941.rows,_942));
|
|
return _945.join("");
|
|
},groupRows:function(_946,rows){
|
|
var _947=$.data(_946,"datagrid");
|
|
var opts=_947.options;
|
|
var _948=[];
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
var _949=_94a(row[opts.groupField]);
|
|
if(!_949){
|
|
_949={value:row[opts.groupField],rows:[row]};
|
|
_948.push(_949);
|
|
}else{
|
|
_949.rows.push(row);
|
|
}
|
|
}
|
|
var _94b=0;
|
|
var rows=[];
|
|
for(var i=0;i<_948.length;i++){
|
|
var _949=_948[i];
|
|
_949.startIndex=_94b;
|
|
_94b+=_949.rows.length;
|
|
rows=rows.concat(_949.rows);
|
|
}
|
|
return {groups:_948,rows:rows};
|
|
function _94a(_94c){
|
|
for(var i=0;i<_948.length;i++){
|
|
var _94d=_948[i];
|
|
if(_94d.value==_94c){
|
|
return _94d;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
}});
|
|
$.fn.datalist=function(_94e,_94f){
|
|
if(typeof _94e=="string"){
|
|
var _950=$.fn.datalist.methods[_94e];
|
|
if(_950){
|
|
return _950(this,_94f);
|
|
}else{
|
|
return this.datagrid(_94e,_94f);
|
|
}
|
|
}
|
|
_94e=_94e||{};
|
|
return this.each(function(){
|
|
var _951=$.data(this,"datalist");
|
|
if(_951){
|
|
$.extend(_951.options,_94e);
|
|
}else{
|
|
var opts=$.extend({},$.fn.datalist.defaults,$.fn.datalist.parseOptions(this),_94e);
|
|
opts.columns=$.extend(true,[],opts.columns);
|
|
_951=$.data(this,"datalist",{options:opts});
|
|
}
|
|
_935(this);
|
|
if(!_951.options.data){
|
|
var data=$.fn.datalist.parseData(this);
|
|
if(data.total){
|
|
$(this).datalist("loadData",data);
|
|
}
|
|
}
|
|
});
|
|
};
|
|
$.fn.datalist.methods={options:function(jq){
|
|
return $.data(jq[0],"datalist").options;
|
|
}};
|
|
$.fn.datalist.parseOptions=function(_952){
|
|
return $.extend({},$.fn.datagrid.parseOptions(_952),$.parser.parseOptions(_952,["valueField","textField","groupField",{checkbox:"boolean",lines:"boolean"}]));
|
|
};
|
|
$.fn.datalist.parseData=function(_953){
|
|
var opts=$.data(_953,"datalist").options;
|
|
var data={total:0,rows:[]};
|
|
$(_953).children().each(function(){
|
|
var _954=$.parser.parseOptions(this,["value","group"]);
|
|
var row={};
|
|
var html=$(this).html();
|
|
row[opts.valueField]=_954.value!=undefined?_954.value:html;
|
|
row[opts.textField]=html;
|
|
if(opts.groupField){
|
|
row[opts.groupField]=_954.group;
|
|
}
|
|
data.total++;
|
|
data.rows.push(row);
|
|
});
|
|
return data;
|
|
};
|
|
$.fn.datalist.defaults=$.extend({},$.fn.datagrid.defaults,{fitColumns:true,singleSelect:true,showHeader:false,checkbox:false,lines:false,valueField:"value",textField:"text",groupField:"",view:_939,textFormatter:function(_955,row){
|
|
return _955;
|
|
},groupFormatter:function(_956,rows){
|
|
return _956;
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
$(function(){
|
|
$(document).unbind(".combo").bind("mousedown.combo mousewheel.combo",function(e){
|
|
var p=$(e.target).closest("span.combo,div.combo-p,div.menu");
|
|
if(p.length){
|
|
_957(p);
|
|
return;
|
|
}
|
|
$("body>div.combo-p>div.combo-panel:visible").panel("close");
|
|
});
|
|
});
|
|
function _958(_959){
|
|
var _95a=$.data(_959,"combo");
|
|
var opts=_95a.options;
|
|
if(!_95a.panel){
|
|
_95a.panel=$("<div class=\"combo-panel\"></div>").appendTo("body");
|
|
_95a.panel.panel({minWidth:opts.panelMinWidth,maxWidth:opts.panelMaxWidth,minHeight:opts.panelMinHeight,maxHeight:opts.panelMaxHeight,doSize:false,closed:true,cls:"combo-p",style:{position:"absolute",zIndex:10},onOpen:function(){
|
|
var _95b=$(this).panel("options").comboTarget;
|
|
var _95c=$.data(_95b,"combo");
|
|
if(_95c){
|
|
_95c.options.onShowPanel.call(_95b);
|
|
}
|
|
},onBeforeClose:function(){
|
|
_957(this);
|
|
},onClose:function(){
|
|
var _95d=$(this).panel("options").comboTarget;
|
|
var _95e=$(_95d).data("combo");
|
|
if(_95e){
|
|
_95e.options.onHidePanel.call(_95d);
|
|
}
|
|
}});
|
|
}
|
|
var _95f=$.extend(true,[],opts.icons);
|
|
if(opts.hasDownArrow){
|
|
_95f.push({iconCls:"combo-arrow",handler:function(e){
|
|
_963(e.data.target);
|
|
}});
|
|
}
|
|
$(_959).addClass("combo-f").textbox($.extend({},opts,{icons:_95f,onChange:function(){
|
|
}}));
|
|
$(_959).attr("comboName",$(_959).attr("textboxName"));
|
|
_95a.combo=$(_959).next();
|
|
_95a.combo.addClass("combo");
|
|
};
|
|
function _960(_961){
|
|
var _962=$.data(_961,"combo");
|
|
var opts=_962.options;
|
|
var p=_962.panel;
|
|
if(p.is(":visible")){
|
|
p.panel("close");
|
|
}
|
|
if(!opts.cloned){
|
|
p.panel("destroy");
|
|
}
|
|
$(_961).textbox("destroy");
|
|
};
|
|
function _963(_964){
|
|
var _965=$.data(_964,"combo").panel;
|
|
if(_965.is(":visible")){
|
|
_966(_964);
|
|
}else{
|
|
var p=$(_964).closest("div.combo-panel");
|
|
$("div.combo-panel:visible").not(_965).not(p).panel("close");
|
|
$(_964).combo("showPanel");
|
|
}
|
|
$(_964).combo("textbox").focus();
|
|
};
|
|
function _957(_967){
|
|
$(_967).find(".combo-f").each(function(){
|
|
var p=$(this).combo("panel");
|
|
if(p.is(":visible")){
|
|
p.panel("close");
|
|
}
|
|
});
|
|
};
|
|
function _968(e){
|
|
var _969=e.data.target;
|
|
var _96a=$.data(_969,"combo");
|
|
var opts=_96a.options;
|
|
var _96b=_96a.panel;
|
|
if(!opts.editable){
|
|
_963(_969);
|
|
}else{
|
|
var p=$(_969).closest("div.combo-panel");
|
|
$("div.combo-panel:visible").not(_96b).not(p).panel("close");
|
|
}
|
|
};
|
|
function _96c(e){
|
|
var _96d=e.data.target;
|
|
var t=$(_96d);
|
|
var _96e=t.data("combo");
|
|
var opts=t.combo("options");
|
|
switch(e.keyCode){
|
|
case 38:
|
|
opts.keyHandler.up.call(_96d,e);
|
|
break;
|
|
case 40:
|
|
opts.keyHandler.down.call(_96d,e);
|
|
break;
|
|
case 37:
|
|
opts.keyHandler.left.call(_96d,e);
|
|
break;
|
|
case 39:
|
|
opts.keyHandler.right.call(_96d,e);
|
|
break;
|
|
case 13:
|
|
e.preventDefault();
|
|
opts.keyHandler.enter.call(_96d,e);
|
|
return false;
|
|
case 9:
|
|
case 27:
|
|
_966(_96d);
|
|
break;
|
|
default:
|
|
if(opts.editable){
|
|
if(_96e.timer){
|
|
clearTimeout(_96e.timer);
|
|
}
|
|
_96e.timer=setTimeout(function(){
|
|
var q=t.combo("getText");
|
|
if(_96e.previousText!=q){
|
|
_96e.previousText=q;
|
|
t.combo("showPanel");
|
|
opts.keyHandler.query.call(_96d,q,e);
|
|
t.combo("validate");
|
|
}
|
|
},opts.delay);
|
|
}
|
|
}
|
|
};
|
|
function _96f(_970){
|
|
var _971=$.data(_970,"combo");
|
|
var _972=_971.combo;
|
|
var _973=_971.panel;
|
|
var opts=$(_970).combo("options");
|
|
var _974=_973.panel("options");
|
|
_974.comboTarget=_970;
|
|
if(_974.closed){
|
|
_973.panel("panel").show().css({zIndex:($.fn.menu?$.fn.menu.defaults.zIndex++:($.fn.window?$.fn.window.defaults.zIndex++:99)),left:-999999});
|
|
_973.panel("resize",{width:(opts.panelWidth?opts.panelWidth:_972._outerWidth()),height:opts.panelHeight});
|
|
_973.panel("panel").hide();
|
|
_973.panel("open");
|
|
}
|
|
(function(){
|
|
if(_973.is(":visible")){
|
|
_973.panel("move",{left:_975(),top:_976()});
|
|
setTimeout(arguments.callee,200);
|
|
}
|
|
})();
|
|
function _975(){
|
|
var left=_972.offset().left;
|
|
if(opts.panelAlign=="right"){
|
|
left+=_972._outerWidth()-_973._outerWidth();
|
|
}
|
|
if(left+_973._outerWidth()>$(window)._outerWidth()+$(document).scrollLeft()){
|
|
left=$(window)._outerWidth()+$(document).scrollLeft()-_973._outerWidth();
|
|
}
|
|
if(left<0){
|
|
left=0;
|
|
}
|
|
return left;
|
|
};
|
|
function _976(){
|
|
var top=_972.offset().top+_972._outerHeight();
|
|
if(top+_973._outerHeight()>$(window)._outerHeight()+$(document).scrollTop()){
|
|
top=_972.offset().top-_973._outerHeight();
|
|
}
|
|
if(top<$(document).scrollTop()){
|
|
top=_972.offset().top+_972._outerHeight();
|
|
}
|
|
return top;
|
|
};
|
|
};
|
|
function _966(_977){
|
|
var _978=$.data(_977,"combo").panel;
|
|
_978.panel("close");
|
|
};
|
|
function _979(_97a,text){
|
|
var _97b=$.data(_97a,"combo");
|
|
var _97c=$(_97a).textbox("getText");
|
|
if(_97c!=text){
|
|
$(_97a).textbox("setText",text);
|
|
_97b.previousText=text;
|
|
}
|
|
};
|
|
function _97d(_97e){
|
|
var _97f=[];
|
|
var _980=$.data(_97e,"combo").combo;
|
|
_980.find(".textbox-value").each(function(){
|
|
_97f.push($(this).val());
|
|
});
|
|
return _97f;
|
|
};
|
|
function _981(_982,_983){
|
|
var _984=$.data(_982,"combo");
|
|
var opts=_984.options;
|
|
var _985=_984.combo;
|
|
if(!$.isArray(_983)){
|
|
_983=_983.split(opts.separator);
|
|
}
|
|
var _986=_97d(_982);
|
|
_985.find(".textbox-value").remove();
|
|
var name=$(_982).attr("textboxName")||"";
|
|
for(var i=0;i<_983.length;i++){
|
|
var _987=$("<input type=\"hidden\" class=\"textbox-value\">").appendTo(_985);
|
|
_987.attr("name",name);
|
|
if(opts.disabled){
|
|
_987.attr("disabled","disabled");
|
|
}
|
|
_987.val(_983[i]);
|
|
}
|
|
var _988=(function(){
|
|
if(_986.length!=_983.length){
|
|
return true;
|
|
}
|
|
var a1=$.extend(true,[],_986);
|
|
var a2=$.extend(true,[],_983);
|
|
a1.sort();
|
|
a2.sort();
|
|
for(var i=0;i<a1.length;i++){
|
|
if(a1[i]!=a2[i]){
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
})();
|
|
if(_988){
|
|
if(opts.multiple){
|
|
opts.onChange.call(_982,_983,_986);
|
|
}else{
|
|
opts.onChange.call(_982,_983[0],_986[0]);
|
|
}
|
|
$(_982).closest("form").trigger("_change",[_982]);
|
|
}
|
|
};
|
|
function _989(_98a){
|
|
var _98b=_97d(_98a);
|
|
return _98b[0];
|
|
};
|
|
function _98c(_98d,_98e){
|
|
_981(_98d,[_98e]);
|
|
};
|
|
function _98f(_990){
|
|
var opts=$.data(_990,"combo").options;
|
|
var _991=opts.onChange;
|
|
opts.onChange=function(){
|
|
};
|
|
if(opts.multiple){
|
|
_981(_990,opts.value?opts.value:[]);
|
|
}else{
|
|
_98c(_990,opts.value);
|
|
}
|
|
opts.onChange=_991;
|
|
};
|
|
$.fn.combo=function(_992,_993){
|
|
if(typeof _992=="string"){
|
|
var _994=$.fn.combo.methods[_992];
|
|
if(_994){
|
|
return _994(this,_993);
|
|
}else{
|
|
return this.textbox(_992,_993);
|
|
}
|
|
}
|
|
_992=_992||{};
|
|
return this.each(function(){
|
|
var _995=$.data(this,"combo");
|
|
if(_995){
|
|
$.extend(_995.options,_992);
|
|
if(_992.value!=undefined){
|
|
_995.options.originalValue=_992.value;
|
|
}
|
|
}else{
|
|
_995=$.data(this,"combo",{options:$.extend({},$.fn.combo.defaults,$.fn.combo.parseOptions(this),_992),previousText:""});
|
|
_995.options.originalValue=_995.options.value;
|
|
}
|
|
_958(this);
|
|
_98f(this);
|
|
});
|
|
};
|
|
$.fn.combo.methods={options:function(jq){
|
|
var opts=jq.textbox("options");
|
|
return $.extend($.data(jq[0],"combo").options,{width:opts.width,height:opts.height,disabled:opts.disabled,readonly:opts.readonly});
|
|
},cloneFrom:function(jq,from){
|
|
return jq.each(function(){
|
|
$(this).textbox("cloneFrom",from);
|
|
$.data(this,"combo",{options:$.extend(true,{cloned:true},$(from).combo("options")),combo:$(this).next(),panel:$(from).combo("panel")});
|
|
$(this).addClass("combo-f").attr("comboName",$(this).attr("textboxName"));
|
|
});
|
|
},panel:function(jq){
|
|
return $.data(jq[0],"combo").panel;
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
_960(this);
|
|
});
|
|
},showPanel:function(jq){
|
|
return jq.each(function(){
|
|
_96f(this);
|
|
});
|
|
},hidePanel:function(jq){
|
|
return jq.each(function(){
|
|
_966(this);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
$(this).textbox("setText","");
|
|
var opts=$.data(this,"combo").options;
|
|
if(opts.multiple){
|
|
$(this).combo("setValues",[]);
|
|
}else{
|
|
$(this).combo("setValue","");
|
|
}
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"combo").options;
|
|
if(opts.multiple){
|
|
$(this).combo("setValues",opts.originalValue);
|
|
}else{
|
|
$(this).combo("setValue",opts.originalValue);
|
|
}
|
|
});
|
|
},setText:function(jq,text){
|
|
return jq.each(function(){
|
|
_979(this,text);
|
|
});
|
|
},getValues:function(jq){
|
|
return _97d(jq[0]);
|
|
},setValues:function(jq,_996){
|
|
return jq.each(function(){
|
|
_981(this,_996);
|
|
});
|
|
},getValue:function(jq){
|
|
return _989(jq[0]);
|
|
},setValue:function(jq,_997){
|
|
return jq.each(function(){
|
|
_98c(this,_997);
|
|
});
|
|
}};
|
|
$.fn.combo.parseOptions=function(_998){
|
|
var t=$(_998);
|
|
return $.extend({},$.fn.textbox.parseOptions(_998),$.parser.parseOptions(_998,["separator","panelAlign",{panelWidth:"number",hasDownArrow:"boolean",delay:"number",selectOnNavigation:"boolean"},{panelMinWidth:"number",panelMaxWidth:"number",panelMinHeight:"number",panelMaxHeight:"number"}]),{panelHeight:(t.attr("panelHeight")=="auto"?"auto":parseInt(t.attr("panelHeight"))||undefined),multiple:(t.attr("multiple")?true:undefined)});
|
|
};
|
|
$.fn.combo.defaults=$.extend({},$.fn.textbox.defaults,{inputEvents:{click:_968,keydown:_96c,paste:_96c,drop:_96c},panelWidth:null,panelHeight:200,panelMinWidth:null,panelMaxWidth:null,panelMinHeight:null,panelMaxHeight:null,panelAlign:"left",multiple:false,selectOnNavigation:true,separator:",",hasDownArrow:true,delay:200,keyHandler:{up:function(e){
|
|
},down:function(e){
|
|
},left:function(e){
|
|
},right:function(e){
|
|
},enter:function(e){
|
|
},query:function(q,e){
|
|
}},onShowPanel:function(){
|
|
},onHidePanel:function(){
|
|
},onChange:function(_999,_99a){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
var _99b=0;
|
|
function _99c(_99d,_99e){
|
|
var _99f=$.data(_99d,"combobox");
|
|
var opts=_99f.options;
|
|
var data=_99f.data;
|
|
for(var i=0;i<data.length;i++){
|
|
if(data[i][opts.valueField]==_99e){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
function _9a0(_9a1,_9a2){
|
|
var opts=$.data(_9a1,"combobox").options;
|
|
var _9a3=$(_9a1).combo("panel");
|
|
var item=opts.finder.getEl(_9a1,_9a2);
|
|
if(item.length){
|
|
if(item.position().top<=0){
|
|
var h=_9a3.scrollTop()+item.position().top;
|
|
_9a3.scrollTop(h);
|
|
}else{
|
|
if(item.position().top+item.outerHeight()>_9a3.height()){
|
|
var h=_9a3.scrollTop()+item.position().top+item.outerHeight()-_9a3.height();
|
|
_9a3.scrollTop(h);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function nav(_9a4,dir){
|
|
var opts=$.data(_9a4,"combobox").options;
|
|
var _9a5=$(_9a4).combobox("panel");
|
|
var item=_9a5.children("div.combobox-item-hover");
|
|
if(!item.length){
|
|
item=_9a5.children("div.combobox-item-selected");
|
|
}
|
|
item.removeClass("combobox-item-hover");
|
|
var _9a6="div.combobox-item:visible:not(.combobox-item-disabled):first";
|
|
var _9a7="div.combobox-item:visible:not(.combobox-item-disabled):last";
|
|
if(!item.length){
|
|
item=_9a5.children(dir=="next"?_9a6:_9a7);
|
|
}else{
|
|
if(dir=="next"){
|
|
item=item.nextAll(_9a6);
|
|
if(!item.length){
|
|
item=_9a5.children(_9a6);
|
|
}
|
|
}else{
|
|
item=item.prevAll(_9a6);
|
|
if(!item.length){
|
|
item=_9a5.children(_9a7);
|
|
}
|
|
}
|
|
}
|
|
if(item.length){
|
|
item.addClass("combobox-item-hover");
|
|
var row=opts.finder.getRow(_9a4,item);
|
|
if(row){
|
|
_9a0(_9a4,row[opts.valueField]);
|
|
if(opts.selectOnNavigation){
|
|
_9a8(_9a4,row[opts.valueField]);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function _9a8(_9a9,_9aa){
|
|
var opts=$.data(_9a9,"combobox").options;
|
|
var _9ab=$(_9a9).combo("getValues");
|
|
if($.inArray(_9aa+"",_9ab)==-1){
|
|
if(opts.multiple){
|
|
_9ab.push(_9aa);
|
|
}else{
|
|
_9ab=[_9aa];
|
|
}
|
|
_9ac(_9a9,_9ab);
|
|
opts.onSelect.call(_9a9,opts.finder.getRow(_9a9,_9aa));
|
|
}
|
|
};
|
|
function _9ad(_9ae,_9af){
|
|
var opts=$.data(_9ae,"combobox").options;
|
|
var _9b0=$(_9ae).combo("getValues");
|
|
var _9b1=$.inArray(_9af+"",_9b0);
|
|
if(_9b1>=0){
|
|
_9b0.splice(_9b1,1);
|
|
_9ac(_9ae,_9b0);
|
|
opts.onUnselect.call(_9ae,opts.finder.getRow(_9ae,_9af));
|
|
}
|
|
};
|
|
function _9ac(_9b2,_9b3,_9b4){
|
|
var opts=$.data(_9b2,"combobox").options;
|
|
var _9b5=$(_9b2).combo("panel");
|
|
if(!$.isArray(_9b3)){
|
|
_9b3=_9b3.split(opts.separator);
|
|
}
|
|
_9b5.find("div.combobox-item-selected").removeClass("combobox-item-selected");
|
|
var vv=[],ss=[];
|
|
for(var i=0;i<_9b3.length;i++){
|
|
var v=_9b3[i];
|
|
var s=v;
|
|
opts.finder.getEl(_9b2,v).addClass("combobox-item-selected");
|
|
var row=opts.finder.getRow(_9b2,v);
|
|
if(row){
|
|
s=row[opts.textField];
|
|
}
|
|
vv.push(v);
|
|
ss.push(s);
|
|
}
|
|
if(!_9b4){
|
|
$(_9b2).combo("setText",ss.join(opts.separator));
|
|
}
|
|
$(_9b2).combo("setValues",vv);
|
|
};
|
|
function _9b6(_9b7,data,_9b8){
|
|
var _9b9=$.data(_9b7,"combobox");
|
|
var opts=_9b9.options;
|
|
_9b9.data=opts.loadFilter.call(_9b7,data);
|
|
_9b9.groups=[];
|
|
data=_9b9.data;
|
|
var _9ba=$(_9b7).combobox("getValues");
|
|
var dd=[];
|
|
var _9bb=undefined;
|
|
for(var i=0;i<data.length;i++){
|
|
var row=data[i];
|
|
var v=row[opts.valueField]+"";
|
|
var s=row[opts.textField];
|
|
var g=row[opts.groupField];
|
|
if(g){
|
|
if(_9bb!=g){
|
|
_9bb=g;
|
|
_9b9.groups.push(g);
|
|
dd.push("<div id=\""+(_9b9.groupIdPrefix+"_"+(_9b9.groups.length-1))+"\" class=\"combobox-group\">");
|
|
dd.push(opts.groupFormatter?opts.groupFormatter.call(_9b7,g):g);
|
|
dd.push("</div>");
|
|
}
|
|
}else{
|
|
_9bb=undefined;
|
|
}
|
|
var cls="combobox-item"+(row.disabled?" combobox-item-disabled":"")+(g?" combobox-gitem":"");
|
|
dd.push("<div id=\""+(_9b9.itemIdPrefix+"_"+i)+"\" class=\""+cls+"\">");
|
|
dd.push(opts.formatter?opts.formatter.call(_9b7,row):s);
|
|
dd.push("</div>");
|
|
if(row["selected"]&&$.inArray(v,_9ba)==-1){
|
|
_9ba.push(v);
|
|
}
|
|
}
|
|
$(_9b7).combo("panel").html(dd.join(""));
|
|
if(opts.multiple){
|
|
_9ac(_9b7,_9ba,_9b8);
|
|
}else{
|
|
_9ac(_9b7,_9ba.length?[_9ba[_9ba.length-1]]:[],_9b8);
|
|
}
|
|
opts.onLoadSuccess.call(_9b7,data);
|
|
};
|
|
function _9bc(_9bd,url,_9be,_9bf){
|
|
var opts=$.data(_9bd,"combobox").options;
|
|
if(url){
|
|
opts.url=url;
|
|
}
|
|
_9be=$.extend({},opts.queryParams,_9be||{});
|
|
if(opts.onBeforeLoad.call(_9bd,_9be)==false){
|
|
return;
|
|
}
|
|
opts.loader.call(_9bd,_9be,function(data){
|
|
_9b6(_9bd,data,_9bf);
|
|
},function(){
|
|
opts.onLoadError.apply(this,arguments);
|
|
});
|
|
};
|
|
function _9c0(_9c1,q){
|
|
var _9c2=$.data(_9c1,"combobox");
|
|
var opts=_9c2.options;
|
|
var qq=opts.multiple?q.split(opts.separator):[q];
|
|
if(opts.mode=="remote"){
|
|
_9c3(qq);
|
|
_9bc(_9c1,null,{q:q},true);
|
|
}else{
|
|
var _9c4=$(_9c1).combo("panel");
|
|
_9c4.find("div.combobox-item-selected,div.combobox-item-hover").removeClass("combobox-item-selected combobox-item-hover");
|
|
_9c4.find("div.combobox-item,div.combobox-group").hide();
|
|
var data=_9c2.data;
|
|
var vv=[];
|
|
$.map(qq,function(q){
|
|
q=$.trim(q);
|
|
var _9c5=q;
|
|
var _9c6=undefined;
|
|
for(var i=0;i<data.length;i++){
|
|
var row=data[i];
|
|
if(opts.filter.call(_9c1,q,row)){
|
|
var v=row[opts.valueField];
|
|
var s=row[opts.textField];
|
|
var g=row[opts.groupField];
|
|
var item=opts.finder.getEl(_9c1,v).show();
|
|
if(s.toLowerCase()==q.toLowerCase()){
|
|
_9c5=v;
|
|
item.addClass("combobox-item-selected");
|
|
opts.onSelect.call(_9c1,row);
|
|
}
|
|
if(opts.groupField&&_9c6!=g){
|
|
$("#"+_9c2.groupIdPrefix+"_"+$.inArray(g,_9c2.groups)).show();
|
|
_9c6=g;
|
|
}
|
|
}
|
|
}
|
|
vv.push(_9c5);
|
|
});
|
|
_9c3(vv);
|
|
}
|
|
function _9c3(vv){
|
|
_9ac(_9c1,opts.multiple?(q?vv:[]):vv,true);
|
|
};
|
|
};
|
|
function _9c7(_9c8){
|
|
var t=$(_9c8);
|
|
var opts=t.combobox("options");
|
|
var _9c9=t.combobox("panel");
|
|
var item=_9c9.children("div.combobox-item-hover");
|
|
if(item.length){
|
|
var row=opts.finder.getRow(_9c8,item);
|
|
var _9ca=row[opts.valueField];
|
|
if(opts.multiple){
|
|
if(item.hasClass("combobox-item-selected")){
|
|
t.combobox("unselect",_9ca);
|
|
}else{
|
|
t.combobox("select",_9ca);
|
|
}
|
|
}else{
|
|
t.combobox("select",_9ca);
|
|
}
|
|
}
|
|
var vv=[];
|
|
$.map(t.combobox("getValues"),function(v){
|
|
if(_99c(_9c8,v)>=0){
|
|
vv.push(v);
|
|
}
|
|
});
|
|
t.combobox("setValues",vv);
|
|
if(!opts.multiple){
|
|
t.combobox("hidePanel");
|
|
}
|
|
};
|
|
function _9cb(_9cc){
|
|
var _9cd=$.data(_9cc,"combobox");
|
|
var opts=_9cd.options;
|
|
_99b++;
|
|
_9cd.itemIdPrefix="_easyui_combobox_i"+_99b;
|
|
_9cd.groupIdPrefix="_easyui_combobox_g"+_99b;
|
|
$(_9cc).addClass("combobox-f");
|
|
$(_9cc).combo($.extend({},opts,{onShowPanel:function(){
|
|
$(_9cc).combo("panel").find("div.combobox-item:hidden,div.combobox-group:hidden").show();
|
|
_9a0(_9cc,$(_9cc).combobox("getValue"));
|
|
opts.onShowPanel.call(_9cc);
|
|
}}));
|
|
$(_9cc).combo("panel").unbind().bind("mouseover",function(e){
|
|
$(this).children("div.combobox-item-hover").removeClass("combobox-item-hover");
|
|
var item=$(e.target).closest("div.combobox-item");
|
|
if(!item.hasClass("combobox-item-disabled")){
|
|
item.addClass("combobox-item-hover");
|
|
}
|
|
e.stopPropagation();
|
|
}).bind("mouseout",function(e){
|
|
$(e.target).closest("div.combobox-item").removeClass("combobox-item-hover");
|
|
e.stopPropagation();
|
|
}).bind("click",function(e){
|
|
var item=$(e.target).closest("div.combobox-item");
|
|
if(!item.length||item.hasClass("combobox-item-disabled")){
|
|
return;
|
|
}
|
|
var row=opts.finder.getRow(_9cc,item);
|
|
if(!row){
|
|
return;
|
|
}
|
|
var _9ce=row[opts.valueField];
|
|
if(opts.multiple){
|
|
if(item.hasClass("combobox-item-selected")){
|
|
_9ad(_9cc,_9ce);
|
|
}else{
|
|
_9a8(_9cc,_9ce);
|
|
}
|
|
}else{
|
|
_9a8(_9cc,_9ce);
|
|
$(_9cc).combo("hidePanel");
|
|
}
|
|
e.stopPropagation();
|
|
});
|
|
};
|
|
$.fn.combobox=function(_9cf,_9d0){
|
|
if(typeof _9cf=="string"){
|
|
var _9d1=$.fn.combobox.methods[_9cf];
|
|
if(_9d1){
|
|
return _9d1(this,_9d0);
|
|
}else{
|
|
return this.combo(_9cf,_9d0);
|
|
}
|
|
}
|
|
_9cf=_9cf||{};
|
|
return this.each(function(){
|
|
var _9d2=$.data(this,"combobox");
|
|
if(_9d2){
|
|
$.extend(_9d2.options,_9cf);
|
|
}else{
|
|
_9d2=$.data(this,"combobox",{options:$.extend({},$.fn.combobox.defaults,$.fn.combobox.parseOptions(this),_9cf),data:[]});
|
|
}
|
|
_9cb(this);
|
|
if(_9d2.options.data){
|
|
_9b6(this,_9d2.options.data);
|
|
}else{
|
|
var data=$.fn.combobox.parseData(this);
|
|
if(data.length){
|
|
_9b6(this,data);
|
|
}
|
|
}
|
|
_9bc(this);
|
|
});
|
|
};
|
|
$.fn.combobox.methods={options:function(jq){
|
|
var _9d3=jq.combo("options");
|
|
return $.extend($.data(jq[0],"combobox").options,{width:_9d3.width,height:_9d3.height,originalValue:_9d3.originalValue,disabled:_9d3.disabled,readonly:_9d3.readonly});
|
|
},getData:function(jq){
|
|
return $.data(jq[0],"combobox").data;
|
|
},setValues:function(jq,_9d4){
|
|
return jq.each(function(){
|
|
_9ac(this,_9d4);
|
|
});
|
|
},setValue:function(jq,_9d5){
|
|
return jq.each(function(){
|
|
_9ac(this,[_9d5]);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
$(this).combo("clear");
|
|
var _9d6=$(this).combo("panel");
|
|
_9d6.find("div.combobox-item-selected").removeClass("combobox-item-selected");
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).combobox("options");
|
|
if(opts.multiple){
|
|
$(this).combobox("setValues",opts.originalValue);
|
|
}else{
|
|
$(this).combobox("setValue",opts.originalValue);
|
|
}
|
|
});
|
|
},loadData:function(jq,data){
|
|
return jq.each(function(){
|
|
_9b6(this,data);
|
|
});
|
|
},reload:function(jq,url){
|
|
return jq.each(function(){
|
|
if(typeof url=="string"){
|
|
_9bc(this,url);
|
|
}else{
|
|
if(url){
|
|
var opts=$(this).combobox("options");
|
|
opts.queryParams=url;
|
|
}
|
|
_9bc(this);
|
|
}
|
|
});
|
|
},select:function(jq,_9d7){
|
|
return jq.each(function(){
|
|
_9a8(this,_9d7);
|
|
});
|
|
},unselect:function(jq,_9d8){
|
|
return jq.each(function(){
|
|
_9ad(this,_9d8);
|
|
});
|
|
}};
|
|
$.fn.combobox.parseOptions=function(_9d9){
|
|
var t=$(_9d9);
|
|
return $.extend({},$.fn.combo.parseOptions(_9d9),$.parser.parseOptions(_9d9,["valueField","textField","groupField","mode","method","url"]));
|
|
};
|
|
$.fn.combobox.parseData=function(_9da){
|
|
var data=[];
|
|
var opts=$(_9da).combobox("options");
|
|
$(_9da).children().each(function(){
|
|
if(this.tagName.toLowerCase()=="optgroup"){
|
|
var _9db=$(this).attr("label");
|
|
$(this).children().each(function(){
|
|
_9dc(this,_9db);
|
|
});
|
|
}else{
|
|
_9dc(this);
|
|
}
|
|
});
|
|
return data;
|
|
function _9dc(el,_9dd){
|
|
var t=$(el);
|
|
var row={};
|
|
row[opts.valueField]=t.attr("value")!=undefined?t.attr("value"):t.text();
|
|
row[opts.textField]=t.text();
|
|
row["selected"]=t.is(":selected");
|
|
row["disabled"]=t.is(":disabled");
|
|
if(_9dd){
|
|
opts.groupField=opts.groupField||"group";
|
|
row[opts.groupField]=_9dd;
|
|
}
|
|
data.push(row);
|
|
};
|
|
};
|
|
$.fn.combobox.defaults=$.extend({},$.fn.combo.defaults,{valueField:"value",textField:"text",groupField:null,groupFormatter:function(_9de){
|
|
return _9de;
|
|
},mode:"local",method:"post",url:null,data:null,queryParams:{},keyHandler:{up:function(e){
|
|
nav(this,"prev");
|
|
e.preventDefault();
|
|
},down:function(e){
|
|
nav(this,"next");
|
|
e.preventDefault();
|
|
},left:function(e){
|
|
},right:function(e){
|
|
},enter:function(e){
|
|
_9c7(this);
|
|
},query:function(q,e){
|
|
_9c0(this,q);
|
|
}},filter:function(q,row){
|
|
var opts=$(this).combobox("options");
|
|
return row[opts.textField].toLowerCase().indexOf(q.toLowerCase())==0;
|
|
},formatter:function(row){
|
|
var opts=$(this).combobox("options");
|
|
return row[opts.textField];
|
|
},loader:function(_9df,_9e0,_9e1){
|
|
var opts=$(this).combobox("options");
|
|
if(!opts.url){
|
|
return false;
|
|
}
|
|
$.ajax({type:opts.method,url:opts.url,data:_9df,dataType:"json",success:function(data){
|
|
_9e0(data);
|
|
},error:function(){
|
|
_9e1.apply(this,arguments);
|
|
}});
|
|
},loadFilter:function(data){
|
|
return data;
|
|
},finder:{getEl:function(_9e2,_9e3){
|
|
var _9e4=_99c(_9e2,_9e3);
|
|
var id=$.data(_9e2,"combobox").itemIdPrefix+"_"+_9e4;
|
|
return $("#"+id);
|
|
},getRow:function(_9e5,p){
|
|
var _9e6=$.data(_9e5,"combobox");
|
|
var _9e7=(p instanceof jQuery)?p.attr("id").substr(_9e6.itemIdPrefix.length+1):_99c(_9e5,p);
|
|
return _9e6.data[parseInt(_9e7)];
|
|
}},onBeforeLoad:function(_9e8){
|
|
},onLoadSuccess:function(){
|
|
},onLoadError:function(){
|
|
},onSelect:function(_9e9){
|
|
},onUnselect:function(_9ea){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _9eb(_9ec){
|
|
var _9ed=$.data(_9ec,"combotree");
|
|
var opts=_9ed.options;
|
|
var tree=_9ed.tree;
|
|
$(_9ec).addClass("combotree-f");
|
|
$(_9ec).combo(opts);
|
|
var _9ee=$(_9ec).combo("panel");
|
|
if(!tree){
|
|
tree=$("<ul></ul>").appendTo(_9ee);
|
|
$.data(_9ec,"combotree").tree=tree;
|
|
}
|
|
tree.tree($.extend({},opts,{checkbox:opts.multiple,onLoadSuccess:function(node,data){
|
|
var _9ef=$(_9ec).combotree("getValues");
|
|
if(opts.multiple){
|
|
var _9f0=tree.tree("getChecked");
|
|
for(var i=0;i<_9f0.length;i++){
|
|
var id=_9f0[i].id;
|
|
(function(){
|
|
for(var i=0;i<_9ef.length;i++){
|
|
if(id==_9ef[i]){
|
|
return;
|
|
}
|
|
}
|
|
_9ef.push(id);
|
|
})();
|
|
}
|
|
}
|
|
$(_9ec).combotree("setValues",_9ef);
|
|
opts.onLoadSuccess.call(this,node,data);
|
|
},onClick:function(node){
|
|
if(opts.multiple){
|
|
$(this).tree(node.checked?"uncheck":"check",node.target);
|
|
}else{
|
|
$(_9ec).combo("hidePanel");
|
|
}
|
|
_9f2(_9ec);
|
|
opts.onClick.call(this,node);
|
|
},onCheck:function(node,_9f1){
|
|
_9f2(_9ec);
|
|
opts.onCheck.call(this,node,_9f1);
|
|
}}));
|
|
};
|
|
function _9f2(_9f3){
|
|
var _9f4=$.data(_9f3,"combotree");
|
|
var opts=_9f4.options;
|
|
var tree=_9f4.tree;
|
|
var vv=[],ss=[];
|
|
if(opts.multiple){
|
|
var _9f5=tree.tree("getChecked");
|
|
for(var i=0;i<_9f5.length;i++){
|
|
vv.push(_9f5[i].id);
|
|
ss.push(_9f5[i].text);
|
|
}
|
|
}else{
|
|
var node=tree.tree("getSelected");
|
|
if(node){
|
|
vv.push(node.id);
|
|
ss.push(node.text);
|
|
}
|
|
}
|
|
$(_9f3).combo("setText",ss.join(opts.separator)).combo("setValues",opts.multiple?vv:(vv.length?vv:[""]));
|
|
};
|
|
function _9f6(_9f7,_9f8){
|
|
var _9f9=$.data(_9f7,"combotree");
|
|
var opts=_9f9.options;
|
|
var tree=_9f9.tree;
|
|
var _9fa=tree.tree("options");
|
|
var _9fb=_9fa.onCheck;
|
|
var _9fc=_9fa.onSelect;
|
|
_9fa.onCheck=_9fa.onSelect=function(){
|
|
};
|
|
tree.find("span.tree-checkbox").addClass("tree-checkbox0").removeClass("tree-checkbox1 tree-checkbox2");
|
|
if(!$.isArray(_9f8)){
|
|
_9f8=_9f8.split(opts.separator);
|
|
}
|
|
var vv=$.map(_9f8,function(_9fd){
|
|
return String(_9fd);
|
|
});
|
|
var ss=[];
|
|
$.map(vv,function(v){
|
|
var node=tree.tree("find",v);
|
|
if(node){
|
|
tree.tree("check",node.target).tree("select",node.target);
|
|
ss.push(node.text);
|
|
}else{
|
|
ss.push(v);
|
|
}
|
|
});
|
|
if(opts.multiple){
|
|
var _9fe=tree.tree("getChecked");
|
|
$.map(_9fe,function(node){
|
|
var id=String(node.id);
|
|
if($.inArray(id,vv)==-1){
|
|
vv.push(id);
|
|
ss.push(node.text);
|
|
}
|
|
});
|
|
}
|
|
_9fa.onCheck=_9fb;
|
|
_9fa.onSelect=_9fc;
|
|
$(_9f7).combo("setText",ss.join(opts.separator)).combo("setValues",opts.multiple?vv:(vv.length?vv:[""]));
|
|
};
|
|
$.fn.combotree=function(_9ff,_a00){
|
|
if(typeof _9ff=="string"){
|
|
var _a01=$.fn.combotree.methods[_9ff];
|
|
if(_a01){
|
|
return _a01(this,_a00);
|
|
}else{
|
|
return this.combo(_9ff,_a00);
|
|
}
|
|
}
|
|
_9ff=_9ff||{};
|
|
return this.each(function(){
|
|
var _a02=$.data(this,"combotree");
|
|
if(_a02){
|
|
$.extend(_a02.options,_9ff);
|
|
}else{
|
|
$.data(this,"combotree",{options:$.extend({},$.fn.combotree.defaults,$.fn.combotree.parseOptions(this),_9ff)});
|
|
}
|
|
_9eb(this);
|
|
});
|
|
};
|
|
$.fn.combotree.methods={options:function(jq){
|
|
var _a03=jq.combo("options");
|
|
return $.extend($.data(jq[0],"combotree").options,{width:_a03.width,height:_a03.height,originalValue:_a03.originalValue,disabled:_a03.disabled,readonly:_a03.readonly});
|
|
},clone:function(jq,_a04){
|
|
var t=jq.combo("clone",_a04);
|
|
t.data("combotree",{options:$.extend(true,{},jq.combotree("options")),tree:jq.combotree("tree")});
|
|
return t;
|
|
},tree:function(jq){
|
|
return $.data(jq[0],"combotree").tree;
|
|
},loadData:function(jq,data){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"combotree").options;
|
|
opts.data=data;
|
|
var tree=$.data(this,"combotree").tree;
|
|
tree.tree("loadData",data);
|
|
});
|
|
},reload:function(jq,url){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"combotree").options;
|
|
var tree=$.data(this,"combotree").tree;
|
|
if(url){
|
|
opts.url=url;
|
|
}
|
|
tree.tree({url:opts.url});
|
|
});
|
|
},setValues:function(jq,_a05){
|
|
return jq.each(function(){
|
|
_9f6(this,_a05);
|
|
});
|
|
},setValue:function(jq,_a06){
|
|
return jq.each(function(){
|
|
_9f6(this,[_a06]);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
var tree=$.data(this,"combotree").tree;
|
|
tree.find("div.tree-node-selected").removeClass("tree-node-selected");
|
|
var cc=tree.tree("getChecked");
|
|
for(var i=0;i<cc.length;i++){
|
|
tree.tree("uncheck",cc[i].target);
|
|
}
|
|
$(this).combo("clear");
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).combotree("options");
|
|
if(opts.multiple){
|
|
$(this).combotree("setValues",opts.originalValue);
|
|
}else{
|
|
$(this).combotree("setValue",opts.originalValue);
|
|
}
|
|
});
|
|
}};
|
|
$.fn.combotree.parseOptions=function(_a07){
|
|
return $.extend({},$.fn.combo.parseOptions(_a07),$.fn.tree.parseOptions(_a07));
|
|
};
|
|
$.fn.combotree.defaults=$.extend({},$.fn.combo.defaults,$.fn.tree.defaults,{editable:false});
|
|
})(jQuery);
|
|
(function($){
|
|
function _a08(_a09){
|
|
var _a0a=$.data(_a09,"combogrid");
|
|
var opts=_a0a.options;
|
|
var grid=_a0a.grid;
|
|
$(_a09).addClass("combogrid-f").combo($.extend({},opts,{onShowPanel:function(){
|
|
var p=$(this).combogrid("panel");
|
|
var _a0b=p.outerHeight()-p.height();
|
|
var _a0c=p._size("minHeight");
|
|
var _a0d=p._size("maxHeight");
|
|
var dg=$(this).combogrid("grid");
|
|
dg.datagrid("resize",{width:"100%",height:(isNaN(parseInt(opts.panelHeight))?"auto":"100%"),minHeight:(_a0c?_a0c-_a0b:""),maxHeight:(_a0d?_a0d-_a0b:"")});
|
|
var row=dg.datagrid("getSelected");
|
|
if(row){
|
|
dg.datagrid("scrollTo",dg.datagrid("getRowIndex",row));
|
|
}
|
|
opts.onShowPanel.call(this);
|
|
}}));
|
|
var _a0e=$(_a09).combo("panel");
|
|
if(!grid){
|
|
grid=$("<table></table>").appendTo(_a0e);
|
|
_a0a.grid=grid;
|
|
}
|
|
grid.datagrid($.extend({},opts,{border:false,singleSelect:(!opts.multiple),onLoadSuccess:function(data){
|
|
var _a0f=$(_a09).combo("getValues");
|
|
var _a10=opts.onSelect;
|
|
opts.onSelect=function(){
|
|
};
|
|
_a16(_a09,_a0f,_a0a.remainText);
|
|
opts.onSelect=_a10;
|
|
opts.onLoadSuccess.apply(_a09,arguments);
|
|
},onClickRow:_a11,onSelect:function(_a12,row){
|
|
_a13();
|
|
opts.onSelect.call(this,_a12,row);
|
|
},onUnselect:function(_a14,row){
|
|
_a13();
|
|
opts.onUnselect.call(this,_a14,row);
|
|
},onSelectAll:function(rows){
|
|
_a13();
|
|
opts.onSelectAll.call(this,rows);
|
|
},onUnselectAll:function(rows){
|
|
if(opts.multiple){
|
|
_a13();
|
|
}
|
|
opts.onUnselectAll.call(this,rows);
|
|
}}));
|
|
function _a11(_a15,row){
|
|
_a0a.remainText=false;
|
|
_a13();
|
|
if(!opts.multiple){
|
|
$(_a09).combo("hidePanel");
|
|
}
|
|
opts.onClickRow.call(this,_a15,row);
|
|
};
|
|
function _a13(){
|
|
var vv=$.map(grid.datagrid("getSelections"),function(row){
|
|
return row[opts.idField];
|
|
});
|
|
vv=vv.concat(opts.unselectedValues);
|
|
if(!opts.multiple){
|
|
vv=vv.length?[vv[0]]:[""];
|
|
}
|
|
_a16(_a09,vv,_a0a.remainText);
|
|
};
|
|
};
|
|
function nav(_a17,dir){
|
|
var _a18=$.data(_a17,"combogrid");
|
|
var opts=_a18.options;
|
|
var grid=_a18.grid;
|
|
var _a19=grid.datagrid("getRows").length;
|
|
if(!_a19){
|
|
return;
|
|
}
|
|
var tr=opts.finder.getTr(grid[0],null,"highlight");
|
|
if(!tr.length){
|
|
tr=opts.finder.getTr(grid[0],null,"selected");
|
|
}
|
|
var _a1a;
|
|
if(!tr.length){
|
|
_a1a=(dir=="next"?0:_a19-1);
|
|
}else{
|
|
var _a1a=parseInt(tr.attr("datagrid-row-index"));
|
|
_a1a+=(dir=="next"?1:-1);
|
|
if(_a1a<0){
|
|
_a1a=_a19-1;
|
|
}
|
|
if(_a1a>=_a19){
|
|
_a1a=0;
|
|
}
|
|
}
|
|
grid.datagrid("highlightRow",_a1a);
|
|
if(opts.selectOnNavigation){
|
|
_a18.remainText=false;
|
|
grid.datagrid("selectRow",_a1a);
|
|
}
|
|
};
|
|
function _a16(_a1b,_a1c,_a1d){
|
|
var _a1e=$.data(_a1b,"combogrid");
|
|
var opts=_a1e.options;
|
|
var grid=_a1e.grid;
|
|
var _a1f=$(_a1b).combo("getValues");
|
|
var _a20=$(_a1b).combo("options");
|
|
var _a21=_a20.onChange;
|
|
_a20.onChange=function(){
|
|
};
|
|
var _a22=grid.datagrid("options");
|
|
var _a23=_a22.onSelect;
|
|
var _a24=_a22.onUnselectAll;
|
|
_a22.onSelect=_a22.onUnselectAll=function(){
|
|
};
|
|
if(!$.isArray(_a1c)){
|
|
_a1c=_a1c.split(opts.separator);
|
|
}
|
|
var _a25=[];
|
|
$.map(grid.datagrid("getSelections"),function(row){
|
|
if($.inArray(row[opts.idField],_a1c)>=0){
|
|
_a25.push(row);
|
|
}
|
|
});
|
|
grid.datagrid("clearSelections");
|
|
grid.data("datagrid").selectedRows=_a25;
|
|
var ss=[];
|
|
for(var i=0;i<_a1c.length;i++){
|
|
var _a26=_a1c[i];
|
|
var _a27=grid.datagrid("getRowIndex",_a26);
|
|
if(_a27>=0){
|
|
grid.datagrid("selectRow",_a27);
|
|
}
|
|
ss.push(_a28(_a26,grid.datagrid("getRows"))||_a28(_a26,grid.datagrid("getSelections"))||_a28(_a26,opts.mappingRows)||_a26);
|
|
}
|
|
opts.unselectedValues=[];
|
|
var _a29=$.map(_a25,function(row){
|
|
return row[opts.idField];
|
|
});
|
|
$.map(_a1c,function(_a2a){
|
|
if($.inArray(_a2a,_a29)==-1){
|
|
opts.unselectedValues.push(_a2a);
|
|
}
|
|
});
|
|
$(_a1b).combo("setValues",_a1f);
|
|
_a20.onChange=_a21;
|
|
_a22.onSelect=_a23;
|
|
_a22.onUnselectAll=_a24;
|
|
if(!_a1d){
|
|
var s=ss.join(opts.separator);
|
|
if($(_a1b).combo("getText")!=s){
|
|
$(_a1b).combo("setText",s);
|
|
}
|
|
}
|
|
$(_a1b).combo("setValues",_a1c);
|
|
function _a28(_a2b,a){
|
|
for(var i=0;i<a.length;i++){
|
|
if(_a2b==a[i][opts.idField]){
|
|
return a[i][opts.textField];
|
|
}
|
|
}
|
|
return undefined;
|
|
};
|
|
};
|
|
function _a2c(_a2d,q){
|
|
var _a2e=$.data(_a2d,"combogrid");
|
|
var opts=_a2e.options;
|
|
var grid=_a2e.grid;
|
|
_a2e.remainText=true;
|
|
if(opts.multiple&&!q){
|
|
_a16(_a2d,[],true);
|
|
}else{
|
|
_a16(_a2d,[q],true);
|
|
}
|
|
if(opts.mode=="remote"){
|
|
grid.datagrid("clearSelections");
|
|
grid.datagrid("load",$.extend({},opts.queryParams,{q:q}));
|
|
}else{
|
|
if(!q){
|
|
return;
|
|
}
|
|
grid.datagrid("clearSelections").datagrid("highlightRow",-1);
|
|
var rows=grid.datagrid("getRows");
|
|
var qq=opts.multiple?q.split(opts.separator):[q];
|
|
$.map(qq,function(q){
|
|
q=$.trim(q);
|
|
if(q){
|
|
$.map(rows,function(row,i){
|
|
if(q==row[opts.textField]){
|
|
grid.datagrid("selectRow",i);
|
|
}else{
|
|
if(opts.filter.call(_a2d,q,row)){
|
|
grid.datagrid("highlightRow",i);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
};
|
|
function _a2f(_a30){
|
|
var _a31=$.data(_a30,"combogrid");
|
|
var opts=_a31.options;
|
|
var grid=_a31.grid;
|
|
var tr=opts.finder.getTr(grid[0],null,"highlight");
|
|
_a31.remainText=false;
|
|
if(tr.length){
|
|
var _a32=parseInt(tr.attr("datagrid-row-index"));
|
|
if(opts.multiple){
|
|
if(tr.hasClass("datagrid-row-selected")){
|
|
grid.datagrid("unselectRow",_a32);
|
|
}else{
|
|
grid.datagrid("selectRow",_a32);
|
|
}
|
|
}else{
|
|
grid.datagrid("selectRow",_a32);
|
|
}
|
|
}
|
|
var vv=[];
|
|
$.map(grid.datagrid("getSelections"),function(row){
|
|
vv.push(row[opts.idField]);
|
|
});
|
|
$(_a30).combogrid("setValues",vv);
|
|
if(!opts.multiple){
|
|
$(_a30).combogrid("hidePanel");
|
|
}
|
|
};
|
|
$.fn.combogrid=function(_a33,_a34){
|
|
if(typeof _a33=="string"){
|
|
var _a35=$.fn.combogrid.methods[_a33];
|
|
if(_a35){
|
|
return _a35(this,_a34);
|
|
}else{
|
|
return this.combo(_a33,_a34);
|
|
}
|
|
}
|
|
_a33=_a33||{};
|
|
return this.each(function(){
|
|
var _a36=$.data(this,"combogrid");
|
|
if(_a36){
|
|
$.extend(_a36.options,_a33);
|
|
}else{
|
|
_a36=$.data(this,"combogrid",{options:$.extend({},$.fn.combogrid.defaults,$.fn.combogrid.parseOptions(this),_a33)});
|
|
}
|
|
_a08(this);
|
|
});
|
|
};
|
|
$.fn.combogrid.methods={options:function(jq){
|
|
var _a37=jq.combo("options");
|
|
return $.extend($.data(jq[0],"combogrid").options,{width:_a37.width,height:_a37.height,originalValue:_a37.originalValue,disabled:_a37.disabled,readonly:_a37.readonly});
|
|
},grid:function(jq){
|
|
return $.data(jq[0],"combogrid").grid;
|
|
},setValues:function(jq,_a38){
|
|
return jq.each(function(){
|
|
var opts=$(this).combogrid("options");
|
|
if($.isArray(_a38)){
|
|
_a38=$.map(_a38,function(_a39){
|
|
if(typeof _a39=="object"){
|
|
var v=_a39[opts.idField];
|
|
(function(){
|
|
for(var i=0;i<opts.mappingRows.length;i++){
|
|
if(v==opts.mappingRows[i][opts.idField]){
|
|
return;
|
|
}
|
|
}
|
|
opts.mappingRows.push(_a39);
|
|
})();
|
|
return v;
|
|
}else{
|
|
return _a39;
|
|
}
|
|
});
|
|
}
|
|
_a16(this,_a38);
|
|
});
|
|
},setValue:function(jq,_a3a){
|
|
return jq.each(function(){
|
|
$(this).combogrid("setValues",[_a3a]);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
$(this).combogrid("grid").datagrid("clearSelections");
|
|
$(this).combo("clear");
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).combogrid("options");
|
|
if(opts.multiple){
|
|
$(this).combogrid("setValues",opts.originalValue);
|
|
}else{
|
|
$(this).combogrid("setValue",opts.originalValue);
|
|
}
|
|
});
|
|
}};
|
|
$.fn.combogrid.parseOptions=function(_a3b){
|
|
var t=$(_a3b);
|
|
return $.extend({},$.fn.combo.parseOptions(_a3b),$.fn.datagrid.parseOptions(_a3b),$.parser.parseOptions(_a3b,["idField","textField","mode"]));
|
|
};
|
|
$.fn.combogrid.defaults=$.extend({},$.fn.combo.defaults,$.fn.datagrid.defaults,{height:22,loadMsg:null,idField:null,textField:null,unselectedValues:[],mappingRows:[],mode:"local",keyHandler:{up:function(e){
|
|
nav(this,"prev");
|
|
e.preventDefault();
|
|
},down:function(e){
|
|
nav(this,"next");
|
|
e.preventDefault();
|
|
},left:function(e){
|
|
},right:function(e){
|
|
},enter:function(e){
|
|
_a2f(this);
|
|
},query:function(q,e){
|
|
_a2c(this,q);
|
|
}},filter:function(q,row){
|
|
var opts=$(this).combogrid("options");
|
|
return (row[opts.textField]||"").toLowerCase().indexOf(q.toLowerCase())==0;
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _a3c(_a3d){
|
|
var _a3e=$.data(_a3d,"datebox");
|
|
var opts=_a3e.options;
|
|
$(_a3d).addClass("datebox-f").combo($.extend({},opts,{onShowPanel:function(){
|
|
_a3f(this);
|
|
_a40(this);
|
|
_a41(this);
|
|
_a4f(this,$(this).datebox("getText"),true);
|
|
opts.onShowPanel.call(this);
|
|
}}));
|
|
if(!_a3e.calendar){
|
|
var _a42=$(_a3d).combo("panel").css("overflow","hidden");
|
|
_a42.panel("options").onBeforeDestroy=function(){
|
|
var c=$(this).find(".calendar-shared");
|
|
if(c.length){
|
|
c.insertBefore(c[0].pholder);
|
|
}
|
|
};
|
|
var cc=$("<div class=\"datebox-calendar-inner\"></div>").prependTo(_a42);
|
|
if(opts.sharedCalendar){
|
|
var c=$(opts.sharedCalendar);
|
|
if(!c[0].pholder){
|
|
c[0].pholder=$("<div class=\"calendar-pholder\" style=\"display:none\"></div>").insertAfter(c);
|
|
}
|
|
c.addClass("calendar-shared").appendTo(cc);
|
|
if(!c.hasClass("calendar")){
|
|
c.calendar();
|
|
}
|
|
_a3e.calendar=c;
|
|
}else{
|
|
_a3e.calendar=$("<div></div>").appendTo(cc).calendar();
|
|
}
|
|
$.extend(_a3e.calendar.calendar("options"),{fit:true,border:false,onSelect:function(date){
|
|
var _a43=this.target;
|
|
var opts=$(_a43).datebox("options");
|
|
_a4f(_a43,opts.formatter.call(_a43,date));
|
|
$(_a43).combo("hidePanel");
|
|
opts.onSelect.call(_a43,date);
|
|
}});
|
|
}
|
|
$(_a3d).combo("textbox").parent().addClass("datebox");
|
|
$(_a3d).datebox("initValue",opts.value);
|
|
function _a3f(_a44){
|
|
var opts=$(_a44).datebox("options");
|
|
var _a45=$(_a44).combo("panel");
|
|
_a45.unbind(".datebox").bind("click.datebox",function(e){
|
|
if($(e.target).hasClass("datebox-button-a")){
|
|
var _a46=parseInt($(e.target).attr("datebox-button-index"));
|
|
opts.buttons[_a46].handler.call(e.target,_a44);
|
|
}
|
|
});
|
|
};
|
|
function _a40(_a47){
|
|
var _a48=$(_a47).combo("panel");
|
|
if(_a48.children("div.datebox-button").length){
|
|
return;
|
|
}
|
|
var _a49=$("<div class=\"datebox-button\"><table cellspacing=\"0\" cellpadding=\"0\" style=\"width:100%\"><tr></tr></table></div>").appendTo(_a48);
|
|
var tr=_a49.find("tr");
|
|
for(var i=0;i<opts.buttons.length;i++){
|
|
var td=$("<td></td>").appendTo(tr);
|
|
var btn=opts.buttons[i];
|
|
var t=$("<a class=\"datebox-button-a\" href=\"javascript:void(0)\"></a>").html($.isFunction(btn.text)?btn.text(_a47):btn.text).appendTo(td);
|
|
t.attr("datebox-button-index",i);
|
|
}
|
|
tr.find("td").css("width",(100/opts.buttons.length)+"%");
|
|
};
|
|
function _a41(_a4a){
|
|
var _a4b=$(_a4a).combo("panel");
|
|
var cc=_a4b.children("div.datebox-calendar-inner");
|
|
_a4b.children()._outerWidth(_a4b.width());
|
|
_a3e.calendar.appendTo(cc);
|
|
_a3e.calendar[0].target=_a4a;
|
|
if(opts.panelHeight!="auto"){
|
|
var _a4c=_a4b.height();
|
|
_a4b.children().not(cc).each(function(){
|
|
_a4c-=$(this).outerHeight();
|
|
});
|
|
cc._outerHeight(_a4c);
|
|
}
|
|
_a3e.calendar.calendar("resize");
|
|
};
|
|
};
|
|
function _a4d(_a4e,q){
|
|
_a4f(_a4e,q,true);
|
|
};
|
|
function _a50(_a51){
|
|
var _a52=$.data(_a51,"datebox");
|
|
var opts=_a52.options;
|
|
var _a53=_a52.calendar.calendar("options").current;
|
|
if(_a53){
|
|
_a4f(_a51,opts.formatter.call(_a51,_a53));
|
|
$(_a51).combo("hidePanel");
|
|
}
|
|
};
|
|
function _a4f(_a54,_a55,_a56){
|
|
var _a57=$.data(_a54,"datebox");
|
|
var opts=_a57.options;
|
|
var _a58=_a57.calendar;
|
|
_a58.calendar("moveTo",opts.parser.call(_a54,_a55));
|
|
if(_a56){
|
|
$(_a54).combo("setValue",_a55);
|
|
}else{
|
|
if(_a55){
|
|
_a55=opts.formatter.call(_a54,_a58.calendar("options").current);
|
|
}
|
|
$(_a54).combo("setText",_a55).combo("setValue",_a55);
|
|
}
|
|
};
|
|
$.fn.datebox=function(_a59,_a5a){
|
|
if(typeof _a59=="string"){
|
|
var _a5b=$.fn.datebox.methods[_a59];
|
|
if(_a5b){
|
|
return _a5b(this,_a5a);
|
|
}else{
|
|
return this.combo(_a59,_a5a);
|
|
}
|
|
}
|
|
_a59=_a59||{};
|
|
return this.each(function(){
|
|
var _a5c=$.data(this,"datebox");
|
|
if(_a5c){
|
|
$.extend(_a5c.options,_a59);
|
|
}else{
|
|
$.data(this,"datebox",{options:$.extend({},$.fn.datebox.defaults,$.fn.datebox.parseOptions(this),_a59)});
|
|
}
|
|
_a3c(this);
|
|
});
|
|
};
|
|
$.fn.datebox.methods={options:function(jq){
|
|
var _a5d=jq.combo("options");
|
|
return $.extend($.data(jq[0],"datebox").options,{width:_a5d.width,height:_a5d.height,originalValue:_a5d.originalValue,disabled:_a5d.disabled,readonly:_a5d.readonly});
|
|
},cloneFrom:function(jq,from){
|
|
return jq.each(function(){
|
|
$(this).combo("cloneFrom",from);
|
|
$.data(this,"datebox",{options:$.extend(true,{},$(from).datebox("options")),calendar:$(from).datebox("calendar")});
|
|
$(this).addClass("datebox-f");
|
|
});
|
|
},calendar:function(jq){
|
|
return $.data(jq[0],"datebox").calendar;
|
|
},initValue:function(jq,_a5e){
|
|
return jq.each(function(){
|
|
var opts=$(this).datebox("options");
|
|
var _a5f=opts.value;
|
|
if(_a5f){
|
|
_a5f=opts.formatter.call(this,opts.parser.call(this,_a5f));
|
|
}
|
|
$(this).combo("initValue",_a5f).combo("setText",_a5f);
|
|
});
|
|
},setValue:function(jq,_a60){
|
|
return jq.each(function(){
|
|
_a4f(this,_a60);
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).datebox("options");
|
|
$(this).datebox("setValue",opts.originalValue);
|
|
});
|
|
}};
|
|
$.fn.datebox.parseOptions=function(_a61){
|
|
return $.extend({},$.fn.combo.parseOptions(_a61),$.parser.parseOptions(_a61,["sharedCalendar"]));
|
|
};
|
|
$.fn.datebox.defaults=$.extend({},$.fn.combo.defaults,{panelWidth:180,panelHeight:"auto",sharedCalendar:null,keyHandler:{up:function(e){
|
|
},down:function(e){
|
|
},left:function(e){
|
|
},right:function(e){
|
|
},enter:function(e){
|
|
_a50(this);
|
|
},query:function(q,e){
|
|
_a4d(this,q);
|
|
}},currentText:"Today",closeText:"Close",okText:"Ok",buttons:[{text:function(_a62){
|
|
return $(_a62).datebox("options").currentText;
|
|
},handler:function(_a63){
|
|
var now=new Date();
|
|
$(_a63).datebox("calendar").calendar({year:now.getFullYear(),month:now.getMonth()+1,current:new Date(now.getFullYear(),now.getMonth(),now.getDate())});
|
|
_a50(_a63);
|
|
}},{text:function(_a64){
|
|
return $(_a64).datebox("options").closeText;
|
|
},handler:function(_a65){
|
|
$(this).closest("div.combo-panel").panel("close");
|
|
}}],formatter:function(date){
|
|
var y=date.getFullYear();
|
|
var m=date.getMonth()+1;
|
|
var d=date.getDate();
|
|
return (m<10?("0"+m):m)+"/"+(d<10?("0"+d):d)+"/"+y;
|
|
},parser:function(s){
|
|
if(!s){
|
|
return new Date();
|
|
}
|
|
var ss=s.split("/");
|
|
var m=parseInt(ss[0],10);
|
|
var d=parseInt(ss[1],10);
|
|
var y=parseInt(ss[2],10);
|
|
if(!isNaN(y)&&!isNaN(m)&&!isNaN(d)){
|
|
return new Date(y,m-1,d);
|
|
}else{
|
|
return new Date();
|
|
}
|
|
},onSelect:function(date){
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function _a66(_a67){
|
|
var _a68=$.data(_a67,"datetimebox");
|
|
var opts=_a68.options;
|
|
$(_a67).datebox($.extend({},opts,{onShowPanel:function(){
|
|
var _a69=$(this).datetimebox("getValue");
|
|
_a6f(this,_a69,true);
|
|
opts.onShowPanel.call(this);
|
|
},formatter:$.fn.datebox.defaults.formatter,parser:$.fn.datebox.defaults.parser}));
|
|
$(_a67).removeClass("datebox-f").addClass("datetimebox-f");
|
|
$(_a67).datebox("calendar").calendar({onSelect:function(date){
|
|
opts.onSelect.call(this.target,date);
|
|
}});
|
|
if(!_a68.spinner){
|
|
var _a6a=$(_a67).datebox("panel");
|
|
var p=$("<div style=\"padding:2px\"><input></div>").insertAfter(_a6a.children("div.datebox-calendar-inner"));
|
|
_a68.spinner=p.children("input");
|
|
}
|
|
_a68.spinner.timespinner({width:opts.spinnerWidth,showSeconds:opts.showSeconds,separator:opts.timeSeparator});
|
|
$(_a67).datetimebox("initValue",opts.value);
|
|
};
|
|
function _a6b(_a6c){
|
|
var c=$(_a6c).datetimebox("calendar");
|
|
var t=$(_a6c).datetimebox("spinner");
|
|
var date=c.calendar("options").current;
|
|
return new Date(date.getFullYear(),date.getMonth(),date.getDate(),t.timespinner("getHours"),t.timespinner("getMinutes"),t.timespinner("getSeconds"));
|
|
};
|
|
function _a6d(_a6e,q){
|
|
_a6f(_a6e,q,true);
|
|
};
|
|
function _a70(_a71){
|
|
var opts=$.data(_a71,"datetimebox").options;
|
|
var date=_a6b(_a71);
|
|
_a6f(_a71,opts.formatter.call(_a71,date));
|
|
$(_a71).combo("hidePanel");
|
|
};
|
|
function _a6f(_a72,_a73,_a74){
|
|
var opts=$.data(_a72,"datetimebox").options;
|
|
$(_a72).combo("setValue",_a73);
|
|
if(!_a74){
|
|
if(_a73){
|
|
var date=opts.parser.call(_a72,_a73);
|
|
$(_a72).combo("setText",opts.formatter.call(_a72,date));
|
|
$(_a72).combo("setValue",opts.formatter.call(_a72,date));
|
|
}else{
|
|
$(_a72).combo("setText",_a73);
|
|
}
|
|
}
|
|
var date=opts.parser.call(_a72,_a73);
|
|
$(_a72).datetimebox("calendar").calendar("moveTo",date);
|
|
$(_a72).datetimebox("spinner").timespinner("setValue",_a75(date));
|
|
function _a75(date){
|
|
function _a76(_a77){
|
|
return (_a77<10?"0":"")+_a77;
|
|
};
|
|
var tt=[_a76(date.getHours()),_a76(date.getMinutes())];
|
|
if(opts.showSeconds){
|
|
tt.push(_a76(date.getSeconds()));
|
|
}
|
|
return tt.join($(_a72).datetimebox("spinner").timespinner("options").separator);
|
|
};
|
|
};
|
|
$.fn.datetimebox=function(_a78,_a79){
|
|
if(typeof _a78=="string"){
|
|
var _a7a=$.fn.datetimebox.methods[_a78];
|
|
if(_a7a){
|
|
return _a7a(this,_a79);
|
|
}else{
|
|
return this.datebox(_a78,_a79);
|
|
}
|
|
}
|
|
_a78=_a78||{};
|
|
return this.each(function(){
|
|
var _a7b=$.data(this,"datetimebox");
|
|
if(_a7b){
|
|
$.extend(_a7b.options,_a78);
|
|
}else{
|
|
$.data(this,"datetimebox",{options:$.extend({},$.fn.datetimebox.defaults,$.fn.datetimebox.parseOptions(this),_a78)});
|
|
}
|
|
_a66(this);
|
|
});
|
|
};
|
|
$.fn.datetimebox.methods={options:function(jq){
|
|
var _a7c=jq.datebox("options");
|
|
return $.extend($.data(jq[0],"datetimebox").options,{originalValue:_a7c.originalValue,disabled:_a7c.disabled,readonly:_a7c.readonly});
|
|
},cloneFrom:function(jq,from){
|
|
return jq.each(function(){
|
|
$(this).datebox("cloneFrom",from);
|
|
$.data(this,"datetimebox",{options:$.extend(true,{},$(from).datetimebox("options")),spinner:$(from).datetimebox("spinner")});
|
|
$(this).removeClass("datebox-f").addClass("datetimebox-f");
|
|
});
|
|
},spinner:function(jq){
|
|
return $.data(jq[0],"datetimebox").spinner;
|
|
},initValue:function(jq,_a7d){
|
|
return jq.each(function(){
|
|
var opts=$(this).datetimebox("options");
|
|
var _a7e=opts.value;
|
|
if(_a7e){
|
|
_a7e=opts.formatter.call(this,opts.parser.call(this,_a7e));
|
|
}
|
|
$(this).combo("initValue",_a7e).combo("setText",_a7e);
|
|
});
|
|
},setValue:function(jq,_a7f){
|
|
return jq.each(function(){
|
|
_a6f(this,_a7f);
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).datetimebox("options");
|
|
$(this).datetimebox("setValue",opts.originalValue);
|
|
});
|
|
}};
|
|
$.fn.datetimebox.parseOptions=function(_a80){
|
|
var t=$(_a80);
|
|
return $.extend({},$.fn.datebox.parseOptions(_a80),$.parser.parseOptions(_a80,["timeSeparator","spinnerWidth",{showSeconds:"boolean"}]));
|
|
};
|
|
$.fn.datetimebox.defaults=$.extend({},$.fn.datebox.defaults,{spinnerWidth:"100%",showSeconds:true,timeSeparator:":",keyHandler:{up:function(e){
|
|
},down:function(e){
|
|
},left:function(e){
|
|
},right:function(e){
|
|
},enter:function(e){
|
|
_a70(this);
|
|
},query:function(q,e){
|
|
_a6d(this,q);
|
|
}},buttons:[{text:function(_a81){
|
|
return $(_a81).datetimebox("options").currentText;
|
|
},handler:function(_a82){
|
|
var opts=$(_a82).datetimebox("options");
|
|
_a6f(_a82,opts.formatter.call(_a82,new Date()));
|
|
$(_a82).datetimebox("hidePanel");
|
|
}},{text:function(_a83){
|
|
return $(_a83).datetimebox("options").okText;
|
|
},handler:function(_a84){
|
|
_a70(_a84);
|
|
}},{text:function(_a85){
|
|
return $(_a85).datetimebox("options").closeText;
|
|
},handler:function(_a86){
|
|
$(_a86).datetimebox("hidePanel");
|
|
}}],formatter:function(date){
|
|
var h=date.getHours();
|
|
var M=date.getMinutes();
|
|
var s=date.getSeconds();
|
|
function _a87(_a88){
|
|
return (_a88<10?"0":"")+_a88;
|
|
};
|
|
var _a89=$(this).datetimebox("spinner").timespinner("options").separator;
|
|
var r=$.fn.datebox.defaults.formatter(date)+" "+_a87(h)+_a89+_a87(M);
|
|
if($(this).datetimebox("options").showSeconds){
|
|
r+=_a89+_a87(s);
|
|
}
|
|
return r;
|
|
},parser:function(s){
|
|
if($.trim(s)==""){
|
|
return new Date();
|
|
}
|
|
var dt=s.split(" ");
|
|
var d=$.fn.datebox.defaults.parser(dt[0]);
|
|
if(dt.length<2){
|
|
return d;
|
|
}
|
|
var _a8a=$(this).datetimebox("spinner").timespinner("options").separator;
|
|
var tt=dt[1].split(_a8a);
|
|
var hour=parseInt(tt[0],10)||0;
|
|
var _a8b=parseInt(tt[1],10)||0;
|
|
var _a8c=parseInt(tt[2],10)||0;
|
|
return new Date(d.getFullYear(),d.getMonth(),d.getDate(),hour,_a8b,_a8c);
|
|
}});
|
|
})(jQuery);
|
|
(function($){
|
|
function init(_a8d){
|
|
var _a8e=$("<div class=\"slider\">"+"<div class=\"slider-inner\">"+"<a href=\"javascript:void(0)\" class=\"slider-handle\"></a>"+"<span class=\"slider-tip\"></span>"+"</div>"+"<div class=\"slider-rule\"></div>"+"<div class=\"slider-rulelabel\"></div>"+"<div style=\"clear:both\"></div>"+"<input type=\"hidden\" class=\"slider-value\">"+"</div>").insertAfter(_a8d);
|
|
var t=$(_a8d);
|
|
t.addClass("slider-f").hide();
|
|
var name=t.attr("name");
|
|
if(name){
|
|
_a8e.find("input.slider-value").attr("name",name);
|
|
t.removeAttr("name").attr("sliderName",name);
|
|
}
|
|
_a8e.bind("_resize",function(e,_a8f){
|
|
if($(this).hasClass("easyui-fluid")||_a8f){
|
|
_a90(_a8d);
|
|
}
|
|
return false;
|
|
});
|
|
return _a8e;
|
|
};
|
|
function _a90(_a91,_a92){
|
|
var _a93=$.data(_a91,"slider");
|
|
var opts=_a93.options;
|
|
var _a94=_a93.slider;
|
|
if(_a92){
|
|
if(_a92.width){
|
|
opts.width=_a92.width;
|
|
}
|
|
if(_a92.height){
|
|
opts.height=_a92.height;
|
|
}
|
|
}
|
|
_a94._size(opts);
|
|
if(opts.mode=="h"){
|
|
_a94.css("height","");
|
|
_a94.children("div").css("height","");
|
|
}else{
|
|
_a94.css("width","");
|
|
_a94.children("div").css("width","");
|
|
_a94.children("div.slider-rule,div.slider-rulelabel,div.slider-inner")._outerHeight(_a94._outerHeight());
|
|
}
|
|
_a95(_a91);
|
|
};
|
|
function _a96(_a97){
|
|
var _a98=$.data(_a97,"slider");
|
|
var opts=_a98.options;
|
|
var _a99=_a98.slider;
|
|
var aa=opts.mode=="h"?opts.rule:opts.rule.slice(0).reverse();
|
|
if(opts.reversed){
|
|
aa=aa.slice(0).reverse();
|
|
}
|
|
_a9a(aa);
|
|
function _a9a(aa){
|
|
var rule=_a99.find("div.slider-rule");
|
|
var _a9b=_a99.find("div.slider-rulelabel");
|
|
rule.empty();
|
|
_a9b.empty();
|
|
for(var i=0;i<aa.length;i++){
|
|
var _a9c=i*100/(aa.length-1)+"%";
|
|
var span=$("<span></span>").appendTo(rule);
|
|
span.css((opts.mode=="h"?"left":"top"),_a9c);
|
|
if(aa[i]!="|"){
|
|
span=$("<span></span>").appendTo(_a9b);
|
|
span.html(aa[i]);
|
|
if(opts.mode=="h"){
|
|
span.css({left:_a9c,marginLeft:-Math.round(span.outerWidth()/2)});
|
|
}else{
|
|
span.css({top:_a9c,marginTop:-Math.round(span.outerHeight()/2)});
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function _a9d(_a9e){
|
|
var _a9f=$.data(_a9e,"slider");
|
|
var opts=_a9f.options;
|
|
var _aa0=_a9f.slider;
|
|
_aa0.removeClass("slider-h slider-v slider-disabled");
|
|
_aa0.addClass(opts.mode=="h"?"slider-h":"slider-v");
|
|
_aa0.addClass(opts.disabled?"slider-disabled":"");
|
|
var _aa1=_aa0.find(".slider-inner");
|
|
_aa1.html("<a href=\"javascript:void(0)\" class=\"slider-handle\"></a>"+"<span class=\"slider-tip\"></span>");
|
|
if(opts.range){
|
|
_aa1.append("<a href=\"javascript:void(0)\" class=\"slider-handle\"></a>"+"<span class=\"slider-tip\"></span>");
|
|
}
|
|
_aa0.find("a.slider-handle").draggable({axis:opts.mode,cursor:"pointer",disabled:opts.disabled,onDrag:function(e){
|
|
var left=e.data.left;
|
|
var _aa2=_aa0.width();
|
|
if(opts.mode!="h"){
|
|
left=e.data.top;
|
|
_aa2=_aa0.height();
|
|
}
|
|
if(left<0||left>_aa2){
|
|
return false;
|
|
}else{
|
|
_aa3(left,this);
|
|
return false;
|
|
}
|
|
},onStartDrag:function(){
|
|
_a9f.isDragging=true;
|
|
opts.onSlideStart.call(_a9e,opts.value);
|
|
},onStopDrag:function(e){
|
|
_aa3(opts.mode=="h"?e.data.left:e.data.top,this);
|
|
opts.onSlideEnd.call(_a9e,opts.value);
|
|
opts.onComplete.call(_a9e,opts.value);
|
|
_a9f.isDragging=false;
|
|
}});
|
|
_aa0.find("div.slider-inner").unbind(".slider").bind("mousedown.slider",function(e){
|
|
if(_a9f.isDragging||opts.disabled){
|
|
return;
|
|
}
|
|
var pos=$(this).offset();
|
|
_aa3(opts.mode=="h"?(e.pageX-pos.left):(e.pageY-pos.top));
|
|
opts.onComplete.call(_a9e,opts.value);
|
|
});
|
|
function _aa3(pos,_aa4){
|
|
var _aa5=_aa6(_a9e,pos);
|
|
var s=Math.abs(_aa5%opts.step);
|
|
if(s<opts.step/2){
|
|
_aa5-=s;
|
|
}else{
|
|
_aa5=_aa5-s+opts.step;
|
|
}
|
|
if(opts.range){
|
|
var v1=opts.value[0];
|
|
var v2=opts.value[1];
|
|
var m=parseFloat((v1+v2)/2);
|
|
if(_aa4){
|
|
var _aa7=$(_aa4).nextAll(".slider-handle").length>0;
|
|
if(_aa5<=v2&&_aa7){
|
|
v1=_aa5;
|
|
}else{
|
|
if(_aa5>=v1&&(!_aa7)){
|
|
v2=_aa5;
|
|
}
|
|
}
|
|
}else{
|
|
if(_aa5<v1){
|
|
v1=_aa5;
|
|
}else{
|
|
if(_aa5>v2){
|
|
v2=_aa5;
|
|
}else{
|
|
_aa5<m?v1=_aa5:v2=_aa5;
|
|
}
|
|
}
|
|
}
|
|
$(_a9e).slider("setValues",[v1,v2]);
|
|
}else{
|
|
$(_a9e).slider("setValue",_aa5);
|
|
}
|
|
};
|
|
};
|
|
function _aa8(_aa9,_aaa){
|
|
var _aab=$.data(_aa9,"slider");
|
|
var opts=_aab.options;
|
|
var _aac=_aab.slider;
|
|
var _aad=$.isArray(opts.value)?opts.value:[opts.value];
|
|
var _aae=[];
|
|
if(!$.isArray(_aaa)){
|
|
_aaa=$.map(String(_aaa).split(opts.separator),function(v){
|
|
return parseFloat(v);
|
|
});
|
|
}
|
|
_aac.find(".slider-value").remove();
|
|
var name=$(_aa9).attr("sliderName")||"";
|
|
for(var i=0;i<_aaa.length;i++){
|
|
var _aaf=_aaa[i];
|
|
if(_aaf<opts.min){
|
|
_aaf=opts.min;
|
|
}
|
|
if(_aaf>opts.max){
|
|
_aaf=opts.max;
|
|
}
|
|
var _ab0=$("<input type=\"hidden\" class=\"slider-value\">").appendTo(_aac);
|
|
_ab0.attr("name",name);
|
|
_ab0.val(_aaf);
|
|
_aae.push(_aaf);
|
|
var _ab1=_aac.find(".slider-handle:eq("+i+")");
|
|
var tip=_ab1.next();
|
|
var pos=_ab2(_aa9,_aaf);
|
|
if(opts.showTip){
|
|
tip.show();
|
|
tip.html(opts.tipFormatter.call(_aa9,_aaf));
|
|
}else{
|
|
tip.hide();
|
|
}
|
|
if(opts.mode=="h"){
|
|
var _ab3="left:"+pos+"px;";
|
|
_ab1.attr("style",_ab3);
|
|
tip.attr("style",_ab3+"margin-left:"+(-Math.round(tip.outerWidth()/2))+"px");
|
|
}else{
|
|
var _ab3="top:"+pos+"px;";
|
|
_ab1.attr("style",_ab3);
|
|
tip.attr("style",_ab3+"margin-left:"+(-Math.round(tip.outerWidth()))+"px");
|
|
}
|
|
}
|
|
opts.value=opts.range?_aae:_aae[0];
|
|
$(_aa9).val(opts.range?_aae.join(opts.separator):_aae[0]);
|
|
if(_aad.join(",")!=_aae.join(",")){
|
|
opts.onChange.call(_aa9,opts.value,(opts.range?_aad:_aad[0]));
|
|
}
|
|
};
|
|
function _a95(_ab4){
|
|
var opts=$.data(_ab4,"slider").options;
|
|
var fn=opts.onChange;
|
|
opts.onChange=function(){
|
|
};
|
|
_aa8(_ab4,opts.value);
|
|
opts.onChange=fn;
|
|
};
|
|
function _ab2(_ab5,_ab6){
|
|
var _ab7=$.data(_ab5,"slider");
|
|
var opts=_ab7.options;
|
|
var _ab8=_ab7.slider;
|
|
var size=opts.mode=="h"?_ab8.width():_ab8.height();
|
|
var pos=opts.converter.toPosition.call(_ab5,_ab6,size);
|
|
if(opts.mode=="v"){
|
|
pos=_ab8.height()-pos;
|
|
}
|
|
if(opts.reversed){
|
|
pos=size-pos;
|
|
}
|
|
return pos.toFixed(0);
|
|
};
|
|
function _aa6(_ab9,pos){
|
|
var _aba=$.data(_ab9,"slider");
|
|
var opts=_aba.options;
|
|
var _abb=_aba.slider;
|
|
var size=opts.mode=="h"?_abb.width():_abb.height();
|
|
var pos=opts.mode=="h"?(opts.reversed?(size-pos):pos):(opts.reversed?pos:(size-pos));
|
|
var _abc=opts.converter.toValue.call(_ab9,pos,size);
|
|
return _abc.toFixed(0);
|
|
};
|
|
$.fn.slider=function(_abd,_abe){
|
|
if(typeof _abd=="string"){
|
|
return $.fn.slider.methods[_abd](this,_abe);
|
|
}
|
|
_abd=_abd||{};
|
|
return this.each(function(){
|
|
var _abf=$.data(this,"slider");
|
|
if(_abf){
|
|
$.extend(_abf.options,_abd);
|
|
}else{
|
|
_abf=$.data(this,"slider",{options:$.extend({},$.fn.slider.defaults,$.fn.slider.parseOptions(this),_abd),slider:init(this)});
|
|
$(this).removeAttr("disabled");
|
|
}
|
|
var opts=_abf.options;
|
|
opts.min=parseFloat(opts.min);
|
|
opts.max=parseFloat(opts.max);
|
|
if(opts.range){
|
|
if(!$.isArray(opts.value)){
|
|
opts.value=$.map(String(opts.value).split(opts.separator),function(v){
|
|
return parseFloat(v);
|
|
});
|
|
}
|
|
if(opts.value.length<2){
|
|
opts.value.push(opts.max);
|
|
}
|
|
}else{
|
|
opts.value=parseFloat(opts.value);
|
|
}
|
|
opts.step=parseFloat(opts.step);
|
|
opts.originalValue=opts.value;
|
|
_a9d(this);
|
|
_a96(this);
|
|
_a90(this);
|
|
});
|
|
};
|
|
$.fn.slider.methods={options:function(jq){
|
|
return $.data(jq[0],"slider").options;
|
|
},destroy:function(jq){
|
|
return jq.each(function(){
|
|
$.data(this,"slider").slider.remove();
|
|
$(this).remove();
|
|
});
|
|
},resize:function(jq,_ac0){
|
|
return jq.each(function(){
|
|
_a90(this,_ac0);
|
|
});
|
|
},getValue:function(jq){
|
|
return jq.slider("options").value;
|
|
},getValues:function(jq){
|
|
return jq.slider("options").value;
|
|
},setValue:function(jq,_ac1){
|
|
return jq.each(function(){
|
|
_aa8(this,[_ac1]);
|
|
});
|
|
},setValues:function(jq,_ac2){
|
|
return jq.each(function(){
|
|
_aa8(this,_ac2);
|
|
});
|
|
},clear:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).slider("options");
|
|
_aa8(this,opts.range?[opts.min,opts.max]:[opts.min]);
|
|
});
|
|
},reset:function(jq){
|
|
return jq.each(function(){
|
|
var opts=$(this).slider("options");
|
|
$(this).slider(opts.range?"setValues":"setValue",opts.originalValue);
|
|
});
|
|
},enable:function(jq){
|
|
return jq.each(function(){
|
|
$.data(this,"slider").options.disabled=false;
|
|
_a9d(this);
|
|
});
|
|
},disable:function(jq){
|
|
return jq.each(function(){
|
|
$.data(this,"slider").options.disabled=true;
|
|
_a9d(this);
|
|
});
|
|
}};
|
|
$.fn.slider.parseOptions=function(_ac3){
|
|
var t=$(_ac3);
|
|
return $.extend({},$.parser.parseOptions(_ac3,["width","height","mode",{reversed:"boolean",showTip:"boolean",range:"boolean",min:"number",max:"number",step:"number"}]),{value:(t.val()||undefined),disabled:(t.attr("disabled")?true:undefined),rule:(t.attr("rule")?eval(t.attr("rule")):undefined)});
|
|
};
|
|
$.fn.slider.defaults={width:"auto",height:"auto",mode:"h",reversed:false,showTip:false,disabled:false,range:false,value:0,separator:",",min:0,max:100,step:1,rule:[],tipFormatter:function(_ac4){
|
|
return _ac4;
|
|
},converter:{toPosition:function(_ac5,size){
|
|
var opts=$(this).slider("options");
|
|
return (_ac5-opts.min)/(opts.max-opts.min)*size;
|
|
},toValue:function(pos,size){
|
|
var opts=$(this).slider("options");
|
|
return opts.min+(opts.max-opts.min)*(pos/size);
|
|
}},onChange:function(_ac6,_ac7){
|
|
},onSlideStart:function(_ac8){
|
|
},onSlideEnd:function(_ac9){
|
|
},onComplete:function(_aca){
|
|
}};
|
|
})(jQuery);
|
|
|