|
|
@ -109,7 +109,7 @@ const Dropdown: DropdownInterface = props => { |
|
|
|
if (transitionName !== undefined) { |
|
|
|
return transitionName; |
|
|
|
} |
|
|
|
if (placement.indexOf('top') >= 0) { |
|
|
|
if (placement.includes('top')) { |
|
|
|
return `${rootPrefixCls}-slide-down`; |
|
|
|
} |
|
|
|
return `${rootPrefixCls}-slide-up`; |
|
|
@ -118,7 +118,7 @@ const Dropdown: DropdownInterface = props => { |
|
|
|
const getPlacement = () => { |
|
|
|
const { placement } = props; |
|
|
|
if (!placement) { |
|
|
|
return direction === 'rtl' ? ('bottomRight' as Placement) : ('bottomLeft' as Placement); |
|
|
|
return direction === 'rtl' ? 'bottomRight' : 'bottomLeft'; |
|
|
|
} |
|
|
|
|
|
|
|
if (placement.includes('Center')) { |
|
|
@ -146,6 +146,8 @@ const Dropdown: DropdownInterface = props => { |
|
|
|
open, |
|
|
|
onVisibleChange, |
|
|
|
onOpenChange, |
|
|
|
mouseEnterDelay = 0.15, |
|
|
|
mouseLeaveDelay = 0.1, |
|
|
|
} = props; |
|
|
|
|
|
|
|
const prefixCls = getPrefixCls('dropdown', customizePrefixCls); |
|
|
@ -163,8 +165,8 @@ const Dropdown: DropdownInterface = props => { |
|
|
|
}); |
|
|
|
|
|
|
|
const triggerActions = disabled ? [] : trigger; |
|
|
|
let alignPoint; |
|
|
|
if (triggerActions && triggerActions.indexOf('contextMenu') !== -1) { |
|
|
|
let alignPoint: boolean; |
|
|
|
if (triggerActions && triggerActions.includes('contextMenu')) { |
|
|
|
alignPoint = true; |
|
|
|
} |
|
|
|
|
|
|
@ -198,9 +200,9 @@ const Dropdown: DropdownInterface = props => { |
|
|
|
// So we need render the element to check and pass back to rc-dropdown.
|
|
|
|
const { overlay } = props; |
|
|
|
|
|
|
|
let overlayNode; |
|
|
|
let overlayNode: React.ReactNode; |
|
|
|
if (typeof overlay === 'function') { |
|
|
|
overlayNode = (overlay as OverlayFunc)(); |
|
|
|
overlayNode = overlay(); |
|
|
|
} else { |
|
|
|
overlayNode = overlay; |
|
|
|
} |
|
|
@ -236,8 +238,10 @@ const Dropdown: DropdownInterface = props => { |
|
|
|
// ============================ Render ============================
|
|
|
|
return ( |
|
|
|
<RcDropdown |
|
|
|
alignPoint={alignPoint} |
|
|
|
alignPoint={alignPoint!} |
|
|
|
{...props} |
|
|
|
mouseEnterDelay={mouseEnterDelay} |
|
|
|
mouseLeaveDelay={mouseLeaveDelay} |
|
|
|
visible={mergedOpen} |
|
|
|
builtinPlacements={builtinPlacements} |
|
|
|
arrow={!!arrow} |
|
|
@ -257,9 +261,4 @@ const Dropdown: DropdownInterface = props => { |
|
|
|
|
|
|
|
Dropdown.Button = DropdownButton; |
|
|
|
|
|
|
|
Dropdown.defaultProps = { |
|
|
|
mouseEnterDelay: 0.15, |
|
|
|
mouseLeaveDelay: 0.1, |
|
|
|
}; |
|
|
|
|
|
|
|
export default Dropdown; |
|
|
|