📄 comboinput.js
字号:
pro.items=[];
if(value=='timepicker'){
var o=linb.SC('linb.UI.TimePicker');
_.merge(profile,{
$compareValue : null,
$getShowValue : function(profile,value){
return value?o._ensureValue(profile,value):'';
},
$getEditValue : null,
$fromEditValue : function(profile,value){
return o._ensureValue(profile,value);
}
},'all');
if(pro.value)
pro.$UIvalue=pro.value=o._ensureValue(profile,pro.value);
}else if(value=='datepicker'){
var date=linb.Date;
_.merge(profile,{
$compareValue : function(p,a,b){
return String(a)==String(b)
},
$getShowValue : function(profile,value){
return value?date.getText(new Date(parseInt(value)), 'ymd'):'';
},
$getEditValue : function(profile,value){
var v=new Date(parseInt(value));
return value?(date.get(v,'m')+1)+'/'+date.get(v,'d')+'/'+date.get(v,'y'):'';
},
$fromEditValue : function(profile,value){
//parse from local text mm/dd/yyyy
var v=linb.Date.parse(value);
if(v)v=linb.Date.getTimSpanStart(v,'d',1);
return v?String(v.getTime()):'0';
}
},'all');
if(pro.value){
var d=new Date(parseInt(pro.value)||0);
pro.$UIvalue=pro.value=String(date.getTimSpanStart(d,'d',1).getTime());
}
}else{
delete profile.$compareValue;
delete profile.$getShowValue;
delete profile.$getEditValue;
delete profile.$fromEditValue;
if(_.isDate(pro.value))
pro.$UIvalue=pro.value=String(pro.value);
}
},
$drop:{},
Appearances:{
POOL:{
position:'absolute',
left:0,
top:0,
width:0,
height:0,
display:'none',
visibility:'hidden'
},
UPLOAD:{
opacity:0,
'*filter':'alpha(opacity=0)',
'z-index':'3',
border:0,
height:'100%',
position:'absolute',
top:0,
right:0,
cursor:'pointer',
'font-size':'12px',
overflow:'hidden'
},
'RBTN,SBTN,BTN':{
display:'block',
'z-index':'1',
cursor:'pointer',
width:'16px',
'font-size':0,
'line-height':0,
position:'relative',
'float':'right'
},
'SBTN,BTN,R1,R2':{
'margin-top':'2px'
},
'R1, R2, BTN, SBTN, STOP, TOP, R1T, R2T, R1B, R2B, SMID,MID':{
background: linb.UI.$bg('bg.gif')
},
'SBTN,BTN':{
$order:1,
'background-position':'left bottom'
},
'R1,R2':{
$order:1,
display:'block',
'font-size':0,
'line-height':0,
cursor:'pointer',
width:'16px',
position:'absolute',
height:'50%',
'background-position':'left bottom',
'margin-top':'2px'
},
R1:{
top:0
},
R2:{
bottom:'-2px'
},
'BTN-mouseover, SBTN-mouseover, R1-mouseover, R2-mouseover':{
$order:2,
'background-position': '-16px bottom'
},
'BTN-mousedown, SBTN-mousedown, R1-mousedown, R2-mousedown':{
$order:3,
'background-position': '-32px bottom'
},
'STOP, TOP, R1T, R2T':{
$order:1,
cursor:'pointer',
width:'16px',
'font-size':0,
'line-height':0,
position:'absolute',
top:'-2px',
left:0,
height:'4px',
'background-position':'left -104px'
},
'BTN-mouseover TOP,SBTN-mouseover STOP, R1-mouseover R1T, R2-mouseover R2T':{
$order:2,
'background-position': '-16px -104px'
},
'BTN-mousedown TOP,SBTN-mousedown STOP, R1-mousedown R1T, R2-mousedown R2T':{
$order:3,
'background-position': '-32px -104px'
},
'R1B,R2B':{
cursor:'pointer',
width:'16px',
'font-size':0,
'line-height':0,
position:'absolute',
left:0,
top:'50%',
'margin-top':'-4px',
height:'6px',
'z-index':2
},
R1B:{
$order:1,
'background-position':'-14px -36px'
},
R2B:{
$order:1,
'background-position':'left -5px'
},
'SMID,MID':{
$order:2,
cursor:'pointer',
width:'16px',
'font-size':0,
'line-height':0,
position:'absolute',
bottom:'0',
left:0,
height:'16px',
'background-position':'0 0'
},
SMID:{
$order:3,
'background-position': '-14px -16px'
},
'.setting-linb-comboinput':{
'border-top-width':'1px',
'border-bottom-width':'1px',
'border-left-width':'1px',
'border-right-width':'1px'
}
},
Behaviors:{
HoverEffected:{BOX:'BOX',BTN:'BTN',SBTN:'SBTN',R1:'R1',R2:'R2'},
ClickEffected:{BTN:'BTN',SBTN:'SBTN',R1:'R1',R2:'R2'},
UPLOAD:{
onClick : function(profile, e, src){
if(profile.onFileDlgOpen)profile.boxing().onFileDlgOpen(profile,src);
},
onChange:function(profile, e, src){
profile.getSubNode('INPUT').attr('value',src.value).onChange();
}
},
BTN:{
onClick : function(profile, e, src){
profile.boxing()._drop(e,src);
}
},
SBTN:{
onClick : function(profile, e, src){
if(profile.onSave)profile.boxing().onSave(profile,src);
}
},
INPUT:{
onChange:function(profile, e, src){
if(profile.$_onedit||profile.$_inner)return;
var o=profile.inValid,
instance=profile.boxing(),
v = instance._fromEditValue(src.value),
uiv=profile.properties.$UIvalue;
if(!instance._compareValue(uiv,v)){
profile.$_inner=1;
delete profile.$_inner;
//give a invalid value in edit mode
if(v===null)
instance._setCtrlValue(uiv);
else{
instance.setUIValue(v);
//input/textarea is special, ctrl value will be set before the $UIvalue
profile.properties.$UIvalue=v;
if(o!==profile.inValid) if(profile.domNode)instance._setDirtyMark();
}
}
},
onKeyup:function(profile, e, src){
var p=profile.properties;
if(p.dynCheck){
if(p.$UIvalue!=src.value)
profile.box._checkValid(profile, src.value);
profile.boxing()._setDirtyMark();
}
},
onFocus:function(profile, e, src){
var p=profile.properties, uiv=p.$UIvalue;
if(p.disabled)return false;
var instance=profile.boxing(),
v = instance._getEditValue(uiv);
//string compare
if(v!==uiv){
//here, dont use $valueFormat, valueFormat or onValueFormat
//use $getShowValue, $getEditValue, $fromEditValue related functions
profile.$_onedit=true;
src.value=v;
delete profile.$_onedit;
}
//set css class
if(profile.onFocus)profile.boxing().onFocus(profile);
profile.getSubNode('BORDER').tagClass('-focus');
//show tips color
profile.boxing()._setTB(3);
},
onBlur:function(profile, e, src){
var p=profile.properties,
instance=profile.boxing(),
uiv=p.$UIvalue,
v = instance._fromEditValue(src.value)
;
if(p.disabled)return false;
if(profile.onFocus)instance.onFocus(profile);
profile.getSubNode('BORDER').tagClass('-focus',false);
//onblur check it
if(instance._compareValue(p.$UIvalue,v)){
profile.box._checkValid(profile, v);
instance._setCtrlValue(uiv);
}
instance._setDirtyMark();
},
onKeydown : function(profile, e, src){
var prop=profile.properties,
m=prop.multiLines,
key=linb.Event.getKey(e);
//fire onchange first
if(key[0]=='enter'&& (!m||key[3]))
linb([src]).onChange();
if(key[0]=='down'|| key[0]=='up'){
if(prop.type=='spin'){
profile.box._spin(profile, key[0]=='up');
return false;
}if(key[1] && prop.type){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -