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>
|
||||||
<button
|
<button
|
||||||
class="ant-btn ant-dropdown-trigger ant-btn-default"
|
class="ant-btn ant-dropdown-trigger ant-btn-default"
|
||||||
disabled=""
|
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
|
@ -10,6 +10,7 @@ export interface DropDownProps {
|
|||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
onVisibleChange?: (visible?: boolean) => void;
|
onVisibleChange?: (visible?: boolean) => void;
|
||||||
visible?: boolean;
|
visible?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
align?: Object;
|
align?: Object;
|
||||||
getPopupContainer?: (triggerNode: Element) => HTMLElement;
|
getPopupContainer?: (triggerNode: Element) => HTMLElement;
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
@ -44,9 +45,10 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { children, prefixCls, overlay } = this.props;
|
const { children, prefixCls, overlay, trigger, disabled } = this.props;
|
||||||
const dropdownTrigger = cloneElement(children as any, {
|
const dropdownTrigger = cloneElement(children as any, {
|
||||||
className: classNames((children as any).props.className, `${prefixCls}-trigger`),
|
className: classNames((children as any).props.className, `${prefixCls}-trigger`),
|
||||||
|
disabled,
|
||||||
});
|
});
|
||||||
const fixedModeOverlay = cloneElement(overlay as any, {
|
const fixedModeOverlay = cloneElement(overlay as any, {
|
||||||
mode: 'vertical',
|
mode: 'vertical',
|
||||||
@ -54,8 +56,9 @@ export default class Dropdown extends React.Component<DropDownProps, any> {
|
|||||||
return (
|
return (
|
||||||
<RcDropdown
|
<RcDropdown
|
||||||
transitionName={this.getTransitionName()}
|
transitionName={this.getTransitionName()}
|
||||||
{...this.props}
|
trigger={disabled ? [] : trigger}
|
||||||
overlay={fixedModeOverlay}
|
overlay={fixedModeOverlay}
|
||||||
|
{...this.props}
|
||||||
>
|
>
|
||||||
{dropdownTrigger}
|
{dropdownTrigger}
|
||||||
</RcDropdown>
|
</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) | - |
|
| 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 |
|
| 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 | - |
|
| 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) | - |
|
| 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` |
|
| 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'] |
|
| trigger | the trigger mode which can execute the drop-down action | Array<'click'\|'hover'> | ['hover'] |
|
||||||
| overlay | the dropdown menu | [Menu](/components/menu) | - |
|
| overlay | the dropdown menu | [Menu](/components/menu) | - |
|
||||||
| visible | determine whether the dropdown menu is visible | boolean | - |
|
| 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 | - |
|
| 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` |
|
| placement | placement of pop menu: `bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||||
|
@ -21,6 +21,7 @@ title: Dropdown
|
|||||||
| overlay | 菜单 | [Menu](/components/menu) | - |
|
| overlay | 菜单 | [Menu](/components/menu) | - |
|
||||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body |
|
||||||
| visible | 菜单是否显示 | boolean | - |
|
| visible | 菜单是否显示 | boolean | - |
|
||||||
|
| disabled | 菜单是否禁用 | boolean | - |
|
||||||
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function(visible) | - |
|
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function(visible) | - |
|
||||||
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||||
|
|
||||||
@ -40,5 +41,6 @@ title: Dropdown
|
|||||||
| trigger | 触发下拉的行为 | Array<'click'\|'hover'> | ['hover'] |
|
| trigger | 触发下拉的行为 | Array<'click'\|'hover'> | ['hover'] |
|
||||||
| overlay | 菜单 | [Menu](/components/menu/) | - |
|
| overlay | 菜单 | [Menu](/components/menu/) | - |
|
||||||
| visible | 菜单是否显示 | boolean | - |
|
| visible | 菜单是否显示 | boolean | - |
|
||||||
|
| disabled | 菜单是否禁用 | boolean | - |
|
||||||
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function | - |
|
| onVisibleChange | 菜单显示状态改变时调用,参数为 visible | Function | - |
|
||||||
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
| placement | 菜单弹出位置:`bottomLeft` `bottomCenter` `bottomRight` `topLeft` `topCenter` `topRight` | String | `bottomLeft` |
|
||||||
|
Loading…
Reference in New Issue
Block a user