📄 timeline.js
字号:
if(profile.onClickTask)
profile.boxing().onClickTask(profile, profile.getItemByDom(src), e, src);
},
onDragbegin:function(profile, e, src){
var t=profile.getItemByDom(src),
type=profile.$dd_type,
cursor=type?'e-resize':'move',
ac=profile.$active;
profile.$dd_ox = linb.DragDrop.getProfile().x;
profile.$dd_oleft = parseInt(src.style.left);
profile.$dd_owidth = parseInt(src.style.width);
linb([ac]).css('display','block').cssPos({left :profile.$dd_oleft, top :null}).width(profile.$dd_owidth-2);
linb([ac,ac.parentNode]).css('cursor',cursor);
},
onDrag:function(profile, e, src){
var x,w,
offset =linb.DragDrop.getProfile().x-profile.$dd_ox,
ddl=profile.$dd_oleft,
ddw=profile.$dd_owidth,
type=profile.$dd_type;
if(type=="left"){
if(offset < ddw){
x = ddl + offset;
w = ddl + ddw - x;
}else{
x = ddl + ddw;
w = offset - ddw;
}
}else if(type == "right"){
if(-offset < ddw){
x = ddl;
w = ddw + offset;
}else{
x = ddl + offset + ddw;
w = -offset - ddw;
}
}else{
x = ddl + offset;
w = ddw;
}
profile.box._moveActive(profile, profile.$active, x, w);
},
onDragstop:function(profile, e, src){
var box=profile.box,
r = profile.box._deActive(profile),
ac=profile.$active;
var from=box._getTime(profile, r.left),
to=box._getTime(profile,r.left+r.width);
if(profile.properties.multiTasks){
if(profile.beforeTaskUpdated && false===profile.boxing().beforeTaskUpdated(profile, profile.getItemByDom(src), from, to)){}else
box._resetItem(profile,r,src);
}else
profile.boxing().setUIValue(from+":"+to);
profile.$dd_type = null;
linb([ac,ac.parentNode]).css('cursor','');
}
},
HEAD:{
onMousedown:function(profile, e, src){
var ps=profile.properties, item=profile.getItemByDom(src);
if(ps.disabled || item.disabled)return;
if(profile.beforeDragTask && false===profile.boxing().beforeDragTask(profile, item, e, src))
return;
if(ps.readonly||item.readonly)return;
linb([src]).parent(2).startDrag(e, {
dragDefer:1,
dragType:'none'
});
}
},
LEFT:{
onMousedown:function(profile, e, src){
var ps=profile.properties, item=profile.getItemByDom(src);
if(ps.disabled || ps.readonly || item.readonly || item.disabled)return;
profile.$dd_type='left';
linb([src]).parent(2).startDrag(e, {
dragDefer:1,
dragType:'none'
});
}
},
RIGHT:{
onMousedown:function(profile, e, src){
var ps=profile.properties, item=profile.getItemByDom(src);
if(ps.disabled || ps.readonly || item.readonly || item.disabled)return;
profile.$dd_type='right';
linb([src]).parent(2).startDrag(e, {
dragDefer:1,
dragType:'none'
});
}
}
},
DataModel:{
$borderW : 0,
readonly:false,
// control width and height
width : 400,
height : 200,
//invisible band count (left,right)
//if it's zero, leftSpanCount will be equal to the visible span count(based on widget width)
leftSpanCount:{
ini:0,
inner:1
},
rightSpanCount:{
ini:0,
inner:1
},
increment:0,
zoomable:{
ini:true,
action:function(v){
if(this.properties.timeSpanKey)
this.getSubNodes(['ZOOMIN','ZOOMOUT']).css('display',v?'':'none');
}
},
dftTaskName:'task',
taskHeight:{
ini:16,
action:function(v){
this.getSubNode('ITEM',true).height(v);
}
},
//time span key
timeSpanKey : {
ini:'1 d',
action:function(){
this.box._refresh(this);
}
},
// how much px to represent a unit
// defalut value is from timeSpanKey
unitPixs : {
action:function(){
this.box._refresh(this);
}
},
/*
*inner properties
*defalut value is from timeSpanKey
*/
//time span count
smallLabelCount:{
inner:1
},
//time span unit
smallLabelUnit:{
inner:1,
listbox:_.toArr(linb.Date.$TIMEUNIT,true)
},
//small label format
smallLabelFormat:{
inner:1,
listbox:_.toArr(linb.Date.$TEXTFORMAT,true)
},
bigLabelCount:{
inner:1
},
//time span unit
bigLabelUnit:{
inner:1,
listbox:_.toArr(linb.Date.$TIMEUNIT,true)
},
//big label format
bigLabelFormat:{
inner:1,
listbox:_.toArr(linb.Date.$TEXTFORMAT,true)
},
//time format
timeFormat:{
inner:1,
listbox:_.toArr(linb.Date.$TEXTFORMAT,true)
},
/*inner properties*/
//bar
showBar:{
ini:true,
action:function(v){
this.getSubNode('TBAR').css('display',v?'':'none');
var p=this.properties,w=p.width,h=p.height;
p.width=p.height=0;
linb.UI.$tryResize(this,w,h);
p.width=w,p.height=h;
}
},
//tips
showTips:{
ini:true,
action:function(v){
this.getSubNode('TIPS').css('display',v?'':'none');
var p=this.properties,w=p.width,h=p.height;
p.width=p.height=0;
linb.UI.$tryResize(this,w,h);
p.width=w,p.height=h;
}
},
//big label
showBigLabel: {
ini:true,
action:function(v){
this.getSubNode('BIGLABEL').css('display',v?'':'none');
var p=this.properties,w=p.width,h=p.height;
p.width=p.height=0;
linb.UI.$tryResize(this,w,h);
p.width=w,p.height=h;
}
},
_scrollRate:5,
multiTasks: {
ini:false,
action:function(){
this.box._refresh(this);
}
},
minDate:{
ini:null,
action:function(value){
if(value>this.properties.dateStart)
this.box._refresh(this);
}
},
maxDate:{
ini:null,
action:function(value){
var p=this.properties;
if(value<linb.Date.add(p.dateStart,'ms',p.width*p._rate))
this.box._refresh(this);
}
},
dateBtn:{
ini:true,
action:function(v){
this.getSubNode('DATE').css('display',v?'':'none');
}
},
closeBtn:{
ini:false,
action:function(v){
this.getSubNode('CLOSE').css('display',v?'':'none');
}
},
optBtn:{
ini:false,
action:function(v){
this.getSubNode('OPT').css('display',v?'':'none');
}
},
fixWidth:true,
dateStart : {
ini:new Date,
action:function(){
this.box._refresh(this);
}
}
},
EventHandlers:{
beforeClose:function(profile, src){},
onShowOptions:function(profile, e, src){},
onGetContent:function(profile, from, to, minMs, type, callback){},
beforeTaskUpdated:function(profile, task, from, to){},
beforeNewTasks:function(profile, tasks){},
beforeDelTasks:function(profile, arr){},
beforeDragTask:function(profile, task, e, src){},
onClickTask:function(profile, task, e, src){}
},
Appearances:{
'.setting-timeline':{
height:'6px'
},
MAINI:{
'padding-top':'4px'
},
MAINC:{
border:'solid 1px #648CB4',
background:'#fff'
},
'BARCMDL span':{
$order:0,
position:'relative',
width:'15px',
height:'15px',
margin:'2px',
'vertical-align': 'middle',
cursor:'default'
},
FOCUS:{
position:'absolute',
'font-size':'0',
width:'1px',
height:'1px',
left:'-100px',
top:'-100px',
'line-height':'0',
border:'0'
},
'MAINP, BAND, VIEW, BIGLABEL, SMALLLABEL':{
position:'relative'
},
'VIEW, MAINP':{
width:linb.browser.ie6?'100%':null,
overflow:'hidden'
},
SCROLL:{
'z-index':500,
position:'absolute',
'font-size':'0',
'line-height':'0',
right:0,
top:0,
height:'100%',
width:'18px',
overflow:'auto',
'overflow-x':linb.browser.opr?null:'hidden'
},
SCROLLI:{
height:'1000px',
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -