📄 treegrid.js
字号:
'CELLS-mouseover':{
$order:4,
'background':linb.UI.$bg('row-over.gif', ' #D9E8FB repeat-x left top')
},
'CELL-disabled':{
$order:8,
'background-color':'#EBEADB'
},
'CELL-disabled CELLA':{
$order:8,
color:'#999'
},
'CELLS-active, CELL-active':{
$order:5,
background:linb.UI.$bg('row-active.gif', ' #FDFDFD repeat-x left top')
},
'CELLS-checked, CELL-checked':{
$order:6,
background:linb.UI.$bg('row-checked.gif', ' #A7F2FE repeat-x left top')
},
'HCELL0, FIRSTCELL, GROUPCAP':{
height:'100%',
'font-weight':'bold',
'font-size':'12px',
'line-height':'20px',
'vertical-align':'top'
},
FIRSTCELL:{
'padding-left':'1px',
'padding-right':'1px'
},
'HCELL0A, FIRSTCELLA':{
'-moz-box-flex':'1',
'-moz-user-select':'none',
display:'block',
position:'relative',
overflow:'hidden',
height:'100%'
},
FIRSTCELLA:{
'text-align': 'left',
'padding-left':'4px'
},
TDFCAPTION:{
'font-weight':'bold'
},
ROWHANDLER:{
position:'absolute',
'height':'4px',
left:'0px',
width:'100%',
bottom:'0px',
cursor:'n-resize',
'z-index':10,
'font-size':0,
'line-height':0
},
'HCELL0, HCELL':{
height:'100%',
'border-left':'1px solid #fff',
'border-right':'1px solid #ACA899',
padding:0,
'vertical-align':'top',
'font-size':'12px',
'line-height':'14px'
},
'HCELL-mouseover':{
background: linb.UI.$bg('head-over.gif', ' #FAF9F4 repeat-x left bottom')
},
ROW:{
'_position':'relative',
zoom:linb.browser.ie?1:null,
'border-top': '1px solid #ACA899',
'font-size':0,
'line-height':0
},
CELL:{
//firefox:height:100% without overflow:hidden
'padding-left':'1px',
'border-right':'1px solid #ACA899',
height:'100%',
position:'relative',
overflow:linb.browser.ie6?'hidden':'',
'font-size':'12px',
'line-height':'20px',
'vertical-align':'top'
},
'ALT':{
'background-color':'#f1f1f1'
},
//
'CELL-label a':{
color: '#000'
},
'CELL-input':{
},
'CELL-number':{
'text-align':'right'
},
'CELL-checkbox':{
'text-align':'center'
},
'CELL-button CELLA':{
width:'100%'
},
'CELL-mouseover':{
$order:5,
background:linb.UI.$bg('row-over.gif', ' #D9E8FB repeat-x left top')
},
HCELLA:{
position:'relative'
},
'HCELLA, CELLA':{
display:'block',
overflow:'hidden',
'-moz-box-flex':'1',
'-moz-user-select':'none',
height:'100%',
//ie need this
width:linb.browser.ie?'100%':''
},
'CELLA-inline':{
$order:5,
display:'inline',
'-moz-box-flex':0
},
'HCELLA, HCELL0A':{
'text-align': 'center',
'font-weight': 'bold'
},
CHECKBOX:{
cursor:'pointer',
width:'16px',
height:'16px',
background: linb.UI.$bg('cmds.gif', ' no-repeat -112px top', true)
},
PROGRESS:{
height:'100%',
'background-color':'#00ffff',
'text-align':'center',
overflow:'visible',
opacity:0.7,
'*filter':'alpha(opacity=70)'
},
'CELL-mouseover CHECKBOX':{
$order:1,
'background-position': '-112px -17px'
},
'CELL-mousedown CHECKBOX':{
$order:2,
'background-position': '-112px -34px'
},
'CHECKBOX-checked':{
$order:3,
'background-position': '-96px top'
},
'CELL-mouseover CHECKBOX-checked':{
$order:4,
'background-position': '-96px -17px'
},
'CELL-mousedown CHECKBOX-checked':{
$order:5,
'background-position': '-96px -34px'
},
SUB:{
//for ie bug: relative , height='auto' will disppear
'*zoom':'1',
'_position':'relative',
'border-left': '1px solid #ACA899',
'margin-left':'15px',
display:'none'
},
FIRSTCELLNO:{
'font-weight':'normal'
}
},
Behaviors:{
HoverEffected:{TOGGLE:'TOGGLE', HCELL:'HCELL'},
ClickEffected:{TOGGLE:'TOGGLE', CELL:'CELL', HCELL:'HCELL'},
DropableKeys:['SCROLL','CELLS','TOGGLE'],
DragableKeys:['FIRSTCELL'],
onSize:function(profile,e){
var o = profile.root;
linb.UI.$tryResize(profile, e.width?o.width():null, o.height?o.height():null);
},
HCELL0A:{
onClick:function(profile,e,src){
profile.getSubNode('COLLIST').onClick(true);
}
},
//key navigator
SCROLL:{
onScroll:function(profile, e, src){
var l=src.scrollLeft||0;
if(profile.$sl!=l)
profile.getSubNode('HEADER').get(0).scrollLeft=profile.$sl=l;
}
},
//colomn resizer
HHANDLER:{
onMousedown:function(profile, e, src){
var p=profile.properties,
o=linb(src),
minW =o.parent(2).width()-p._minColW,
scroll = profile.getSubNode('SCROLL'),
maxW = scroll.offset().left + scroll.width() - linb.Event.getPos(e).left - 4,
id = profile.getSubId(src.id),
col = profile.colMap[id];
if(p.disabled)return false;
if(col && col.disabled)return false;
o.startDrag(e, {
horizontalOnly:true,
dragType:'blank',
dragDefer:2,
maxLeftOffset:minW,
maxRightOffset:maxW,
targetReposition:false
});
linb([src.parentNode.parentNode]).onMouseout(true,{$force:true}).onMouseup(true);
},
onDragbegin:function(profile, e, src){
linb.DragDrop.getProfile().proxyNode
.css({
height:profile.root.height()+'px',
width:'4px',
backgroundColor:'#ddd',
cursor:'e-resize'
});
},
onDrag:function(profile, e, src){
var d=linb.DragDrop,p=d.getProfile(),b=0;
if(p.x<=p.restrictedLeft || p.x>=p.restrictedRight)b=true;
if(b){
if(!profile._limited){
p.proxyNode.css('backgroundColor','#ff6600');
profile._limited=true;
}
}else{
if(profile._limited){
p.proxyNode.css('backgroundColor','#ddd');
profile._limited=0;
}
}
},
onDragstop:function(profile, e, src){
var o=linb(src).parent(2),
w=o.width() + linb.DragDrop.getProfile().offset.x,
col=profile.colMap[profile.getSubId(src.id)];
o.width(w);
if(col)col.width=w;
//collect cell id
var ids=[],ws=[];
if(_.str.startWith(src.parentNode.id,profile.keys.HCELL0A))
profile.box._asy0(profile,w);
else{
var cells = profile.colMap[profile.getSubId(src.id)]._cells;
_.each(cells,function(o){
ids.push(profile.getSubNode(profile.keys.CELL,o).id())
});
linb(ids).width(w);
}
profile.getSubNode('SCROLL').onScroll();
profile.box._ajdustBody(profile);
profile._limited=0;
},
onClick:function(){
return false
},
onDblclick:function(profile, e, src){
//for row0
if(profile.getKey(src.parentNode.id)==profile.keys['HCELL0A']){
profile.box._asy0(profile,true);
return;
}
//for other rows
var p = profile.properties,
sid = profile.getSubId(src.id),
header = profile.colMap[sid],
cells=header._cells,
cls=profile.getClass('CELLA','-inline'),
n,ns=[],ws=[],w;
_.each(cells,function(o){
n=profile.getSubNode('CELLA',o);
ns.push(n.get(0));
ws.push(n.addClass(cls).width());
});
ws.push(p._minColW);
w=parseInt(Math.max.apply(null,ws));
if(w>p._maxColW)w=p._maxColW;
linb(ns).parent().width(w);
linb(src.parentNode.parentNode).width(header.width=w);
linb(ns).removeClass(cls);
profile.box._ajdustBody(profile);
return false;
}
},
//row resizer
ROWHANDLER:{
onMousedown:function(profile, e, src){
var p=profile.properties,
row = profile.rowMap[profile.getSubId(src.id)],
o=linb(src),
minH =o.parent(3).height()-p._minRowH,
scroll = profile.getSubNode('SCROLL'),
maxH = scroll.offset().top + scroll.height() - linb.Event.getPos(e).top - 4;
if(p.disabled || (row&&row.disabled))return false;
o.startDrag(e, {
verticalOnly:true,
dragType:'blank',
dragDefer:2,
maxTopOffset:minH,
maxBottomOffset:maxH ,
targetReposition:false
});
linb([src.parentNode.parentNode]).onMouseout(true,{$force:true}).onMouseup(true);
},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -