mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
dropdown 菜单可以配置 disabled (#1574)
This commit is contained in:
parent
557b3098cb
commit
568230356d
@ -19,7 +19,8 @@ order: 44
|
||||
"buttons": [
|
||||
{
|
||||
"type": "button",
|
||||
"label": "按钮1"
|
||||
"label": "按钮1",
|
||||
"disabled": true
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
|
@ -561,6 +561,7 @@
|
||||
--DropDown-menuItem-onHover-bg: var(--ListMenu-item--onHover-bg);
|
||||
--DropDown-menuItem-onHover-color: inherit;
|
||||
--DropDown-menuItem-onActive-color: var(--info);
|
||||
--DropDown-menuItem-onDisabled-color: var(--text--muted-color);
|
||||
--DropDown-menuItem-paddingX: var(--gap-sm);
|
||||
--DropDown-menuItem-paddingY: calc(
|
||||
(var(--DropDown-menu-height) - var(--fontSizeBase) * var(--lineHeightBase)) /
|
||||
|
@ -72,6 +72,12 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.is-disabled {
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
color: var(--DropDown-menuItem-onDisabled-color);
|
||||
}
|
||||
|
||||
&.#{$ns}DropDown-divider {
|
||||
height: px2rem(1px);
|
||||
margin: px2rem(9px) 0;
|
||||
@ -82,6 +88,7 @@
|
||||
}
|
||||
|
||||
&-menu > li a {
|
||||
color: inherit;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import Overlay from '../components/Overlay';
|
||||
import PopOver from '../components/PopOver';
|
||||
import TooltipWrapper from '../components/TooltipWrapper';
|
||||
import type {TooltipObject, Trigger} from '../components/TooltipWrapper';
|
||||
import {isVisible, noop} from '../utils/helper';
|
||||
import {isDisabled, isVisible, noop} from '../utils/helper';
|
||||
import {filter} from '../utils/tpl';
|
||||
import {Icon} from '../components/icons';
|
||||
import {BaseSchema, SchemaClassName} from '../Schema';
|
||||
@ -191,7 +191,10 @@ export default class DropDownButton extends React.Component<
|
||||
}
|
||||
|
||||
return (
|
||||
<li key={index}>
|
||||
<li
|
||||
key={index}
|
||||
className={isDisabled(button, data) ? 'is-disabled' : ''}
|
||||
>
|
||||
{render(`button/${index}`, {
|
||||
type: 'button',
|
||||
...(button as any),
|
||||
|
Loading…
Reference in New Issue
Block a user