mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
Disabled Dropdown is showing Menu on hover (#7102)
* disabled dropdown is showing menu on hover * fix cr error * update snap * update document
This commit is contained in:
parent
b69a6886d7
commit
e633f91c27
@ -49,7 +49,6 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-dropdown-trigger ant-btn-default"
|
||||
disabled=""
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
|
@ -10,6 +10,7 @@ export interface DropDownProps {
|
||||
style?: React.CSSProperties;
|
||||
onVisibleChange?: (visible?: boolean) => void;
|
||||
visible?: boolean;
|
||||
disabled?: boolean;
|
||||
align?: Object;
|
||||
getPopupContainer?: (triggerNode: Element) => HTMLElement;
|
||||
prefixCls?: string;
|
||||
@ -44,9 +45,10 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children, prefixCls, overlay } = this.props;
|
||||
const { children, prefixCls, overlay, trigger, disabled } = this.props;
|
||||
const dropdownTrigger = cloneElement(children as any, {
|
||||
className: classNames((children as any).props.className, `${prefixCls}-trigger`),
|
||||
disabled,
|
||||
});
|
||||
const fixedModeOverlay = cloneElement(overlay as any, {
|
||||
mode: 'vertical',
|
||||
@ -54,8 +56,9 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
|
||||
return (
|
||||
<RcDropdown
|
||||
transitionName={this.getTransitionName()}
|
||||
{...this.props}
|
||||
trigger={disabled ? [] : trigger}
|
||||
overlay={fixedModeOverlay}
|
||||
{...this.props}
|
||||
>
|
||||
{dropdownTrigger}
|
||||
</RcDropdown>
|
||||
|
@ -20,6 +20,7 @@ If there are too many operations to display, you can wrap them in a `Dropdown`.
|
||||
| overlay | the dropdown menu | [Menu](/components/menu) | - |
|
||||
| getPopupContainer | to set the container of the dropdown menu. The default is to create a `div` element in `body`, you can reset it to the scrolling area and make a relative reposition. [example](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
||||
| visible | determine whether the dropdown menu is visible | boolean | - |
|
||||
| disabled| determine whether the dropdown menu is disabled| boolean | - |
|
||||
| onVisibleChange | a callback function takes an argument: `visible`, can be executed when the visible state is changing | Function(visible) | - |
|
||||
| placement | placement of pop menu: `bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
||||
@ -39,5 +40,6 @@ You can get the menu list by `antd.Menu`, and set a callback function `onSelect`
|
||||
| trigger | the trigger mode which can execute the drop-down action | Array<'click'\|'hover'> | ['hover'] |
|
||||
| overlay | the dropdown menu | [Menu](/components/menu) | - |
|
||||
| visible | determine whether the dropdown menu is visible | boolean | - |
|
||||
| disabled | determine whether the dropdown menu is disabled| boolean | - |
|
||||
| onVisibleChange | a callback function takes an argument: `visible`, can be executed when the visible state is changing | Function | - |
|
||||
| placement | placement of pop menu: `bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
@ -21,6 +21,7 @@ title: Dropdown
|
||||
| overlay | 菜单 | [Menu](/components/menu) | - |
|
||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
||||
| visible | 菜单是否显示 | boolean | - |
|
||||
| disabled | 菜单是否禁用 | boolean | - |
|
||||
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function(visible) | - |
|
||||
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
||||
@ -40,5 +41,6 @@ title: Dropdown
|
||||
| trigger | 触发下拉的行为 | Array<'click'\|'hover'> | ['hover'] |
|
||||
| overlay | 菜单 | [Menu](/components/menu/) | - |
|
||||
| visible | 菜单是否显示 | boolean | - |
|
||||
| disabled | 菜单是否禁用 | boolean | - |
|
||||
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function | - |
|
||||
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||
|
Loading…
Reference in New Issue
Block a user