@ -12,7 +12,7 @@
attributes : {
attributes : {
tabIndex : - 1
tabIndex : - 1
} ,
} ,
trigger : "click" ,
trigger : "click" , // click || hover || click-hover || ""
toggle : true ,
toggle : true ,
direction : "bottom" , // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight||right,innerLeft||innerRight||innerLeft
direction : "bottom" , // top||bottom||left||right||top,left||top,right||bottom,left||bottom,right||right,innerRight||right,innerLeft||innerRight||innerLeft
logic : {
logic : {
@ -182,62 +182,16 @@
} ) ;
} ) ;
break ;
break ;
case "click-hover" :
case "click-hover" :
case "click-blur" :
// IE走click-hover逻辑
if ( BI . isIE ( ) || ev === "click-hover" ) {
var debounce = BI . debounce ( function ( e ) {
if ( self . combo . element . _ _isMouseInBounds _ _ ( e ) ) {
if ( self . isEnabled ( ) && self . isValid ( ) && self . combo . isEnabled ( ) && self . combo . isValid ( ) ) {
// if (self.isViewVisible()) {
// return;
// }
self . _popupView ( e ) ;
if ( self . isViewVisible ( ) ) {
self . fireEvent ( BI . Controller . EVENT _CHANGE , BI . Events . EXPAND , "" , self . combo ) ;
self . fireEvent ( BI . Combo . EVENT _EXPAND ) ;
}
}
}
} , BI . EVENT _RESPONSE _TIME , {
"leading" : true ,
"trailing" : false
} ) ;
self . element . off ( "click." + self . getName ( ) ) . on ( "click." + self . getName ( ) , function ( e ) {
debounce ( e ) ;
st ( e ) ;
} ) ;
self . element . on ( "mouseleave." + self . getName ( ) , function ( e ) {
if ( self . popupView ) {
self . popupView . element . on ( "mouseenter." + self . getName ( ) , function ( e ) {
enterPopup = true ;
self . popupView . element . on ( "mouseleave." + self . getName ( ) , function ( e ) {
hide ( e ) ;
} ) ;
self . popupView . element . off ( "mouseenter." + self . getName ( ) ) ;
} ) ;
BI . defer ( function ( ) {
if ( ! enterPopup ) {
hide ( e ) ;
}
} , 50 ) ;
}
} ) ;
break ;
}
var debounce = BI . debounce ( function ( e ) {
var debounce = BI . debounce ( function ( e ) {
if ( self . combo . element . _ _isMouseInBounds _ _ ( e ) ) {
if ( self . combo . element . _ _isMouseInBounds _ _ ( e ) ) {
if ( self . isEnabled ( ) && self . isValid ( ) && self . combo . isEnabled ( ) && self . combo . isValid ( ) ) {
if ( self . isEnabled ( ) && self . isValid ( ) && self . combo . isEnabled ( ) && self . combo . isValid ( ) ) {
// if (!o.toggle && self.isViewVisible()) {
// if (self.isViewVisible()) {
// return;
// return;
// }
// }
o . toggle ? self . _toggle ( e ) : self . _popupView ( e ) ;
self . _popupView ( e ) ;
if ( self . isViewVisible ( ) ) {
if ( self . isViewVisible ( ) ) {
self . fireEvent ( BI . Controller . EVENT _CHANGE , BI . Events . EXPAND , "" , self . combo ) ;
self . fireEvent ( BI . Controller . EVENT _CHANGE , BI . Events . EXPAND , "" , self . combo ) ;
self . fireEvent ( BI . Combo . EVENT _EXPAND ) ;
self . fireEvent ( BI . Combo . EVENT _EXPAND ) ;
} else {
self . fireEvent ( BI . Controller . EVENT _CHANGE , BI . Events . COLLAPSE , "" , self . combo ) ;
self . fireEvent ( BI . Combo . EVENT _COLLAPSE ) ;
}
}
}
}
}
}
@ -247,18 +201,23 @@
} ) ;
} ) ;
self . element . off ( "click." + self . getName ( ) ) . on ( "click." + self . getName ( ) , function ( e ) {
self . element . off ( "click." + self . getName ( ) ) . on ( "click." + self . getName ( ) , function ( e ) {
debounce ( e ) ;
debounce ( e ) ;
try {
self . element [ 0 ] . focus ( ) ;
} catch ( e ) {
}
st ( e ) ;
st ( e ) ;
} ) ;
} ) ;
self . element . off ( "blur." + self . getName ( ) ) . on ( "blur." + self . getName ( ) , function ( e ) {
self . element . on ( "mouseleave." + self . getName ( ) , function ( e ) {
if ( self . isViewVisible ( ) ) {
if ( self . popupView ) {
self . _hideView ( e ) ;
self . popupView . element . on ( "mouseenter." + self . getName ( ) , function ( e ) {
enterPopup = true ;
self . popupView . element . on ( "mouseleave." + self . getName ( ) , function ( e ) {
hide ( e ) ;
} ) ;
self . popupView . element . off ( "mouseenter." + self . getName ( ) ) ;
} ) ;
BI . delay ( function ( ) {
if ( ! enterPopup ) {
hide ( e ) ;
}
} , 50 ) ;
}
}
st ( e ) ;
} ) ;
} ) ;
break ;
break ;
}
}
@ -353,7 +312,7 @@
this . _assertPopupViewRender ( ) ;
this . _assertPopupViewRender ( ) ;
this . fireEvent ( BI . Combo . EVENT _BEFORE _POPUPVIEW ) ;
this . fireEvent ( BI . Combo . EVENT _BEFORE _POPUPVIEW ) ;
// popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下
// popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下
this . popupView . css ( { left : - 999999999 , top : - 99999999 } ) ;
this . popupView . css ( { left : - 999999999 , top : - 99999999 } ) ;
this . popupView . visible ( ) ;
this . popupView . visible ( ) ;
BI . each ( needHideWhenAnotherComboOpen , function ( i , combo ) {
BI . each ( needHideWhenAnotherComboOpen , function ( i , combo ) {
if ( i !== self . getName ( ) ) {
if ( i !== self . getName ( ) ) {