Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
auto position mode when contextMenu
- Loading branch information
|
@@ -25,7 +25,7 @@ const menu = ( |
|
|
); |
|
|
|
|
|
ReactDOM.render( |
|
|
<Dropdown overlay={menu} trigger={['contextMenu']} alignPoint> |
|
|
<Dropdown overlay={menu} trigger={['contextMenu']}> |
|
|
<span style={{ userSelect: 'none' }}>Right Click on Me</span> |
|
|
</Dropdown> |
|
|
, mountNode); |
|
|
|
@@ -68,11 +68,19 @@ export default class Dropdown extends React.Component<DropDownProps, any> { |
|
|
selectable, |
|
|
focusable, |
|
|
}); |
|
|
|
|
|
const triggerActions = disabled ? [] : trigger; |
|
|
let alignPoint; |
|
|
if (triggerActions && triggerActions.indexOf('contextMenu') !== -1) { |
|
|
alignPoint = true; |
|
|
} |
|
|
|
|
|
return ( |
|
|
<RcDropdown |
|
|
alignPoint={alignPoint} |
|
|
{...this.props} |
|
|
transitionName={this.getTransitionName()} |
|
|
trigger={disabled ? [] : trigger} |
|
|
trigger={triggerActions} |
|
|
overlay={fixedModeOverlay} |
|
|
> |
|
|
{dropdownTrigger} |
|
|
|
@@ -23,7 +23,6 @@ If there are too many operations to display, you can wrap them in a `Dropdown`. |
|
|
| trigger | the trigger mode which executes the drop-down action | Array<`click`\|`hover`\|`contextMenu`> | `['hover']` | |
|
|
| visible | whether the dropdown menu is visible | boolean | - | |
|
|
| onVisibleChange | a callback function takes an argument: `visible`, is executed when the visible state is changed | Function(visible) | - | |
|
|
| alignPoint | whether the dropdown menu follow the mouse position | bool | - | |
|
|
|
|
|
You should use [Menu](/components/menu/) as `overlay`. The menu items and dividers are also available by using `Menu.Item` and `Menu.Divider`. |
|
|
|
|
|
|
@@ -24,7 +24,6 @@ title: Dropdown |
|
|
| trigger | 触发下拉的行为 | Array<`click`\|`hover`\|`contextMenu`> | `['hover']` | |
|
|
| visible | 菜单是否显示 | boolean | - | |
|
|
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function(visible) | - | |
|
|
| alignPoint | 菜单是否跟随鼠标位置 | bool | - | |
|
|
|
|
|
`overlay` 菜单使用 [Menu](/components/menu/),还包括菜单项 `Menu.Item`,分割线 `Menu.Divider`。 |
|
|
|
|
|