amis/packages/amis-ui/scss/components/_context-menu.scss

207 lines
3.8 KiB
SCSS
Raw Normal View History

// 为了提示用户这不是系统菜单。
@keyframes contextMenuInSpecial {
from {
transform: scale3d(1, 1, 1);
}
50% {
transform: scale3d(1.05, 1.05, 1.05);
}
to {
transform: scale3d(1, 1, 1);
}
}
2019-11-19 16:35:52 +08:00
@keyframes contextMenuIn {
from {
opacity: 0;
}
}
@keyframes contextMenuOut {
to {
opacity: 0;
}
}
.#{$ns}ContextMenu {
z-index: $zindex-contextmenu;
position: fixed;
left: 0;
top: 0;
// pointer-events: none;
2019-11-19 16:35:52 +08:00
&-menu {
position: absolute;
z-index: $zindex-contextmenu;
&.in,
&.out {
// opacity: 1;
// transform: translateY(0) scale(1);
animation-duration: var(--animation-duration);
2019-11-19 16:35:52 +08:00
animation-fill-mode: both;
}
&.in {
animation-name: contextMenuInSpecial;
animation-duration: var(--animation-duration);
2019-11-19 16:35:52 +08:00
}
&.out {
animation-name: contextMenuOut;
}
display: block;
position: absolute;
margin: 0;
padding: 4px 0;
2019-11-19 16:35:52 +08:00
background: var(--menu-background);
box-shadow: var(--menu-box-shadow);
2019-11-19 16:35:52 +08:00
color: var(--menu-font-color);
font-family: var(--menu-font-family);
font-size: 12px;
line-height: 20px;
2019-11-19 16:35:52 +08:00
}
&-divider {
border: none;
height: 1px;
background: var(--menu-border-color);
margin: 4px 1px;
2019-11-19 16:35:52 +08:00
padding: 0;
}
&-list {
list-style: none;
margin: 0;
padding: 0;
min-width: var(--menu-min-width);
2019-11-19 16:35:52 +08:00
}
&-item {
position: relative;
2019-11-20 10:35:31 +08:00
2019-11-22 14:47:55 +08:00
> a {
2019-11-19 16:35:52 +08:00
white-space: nowrap;
display: block;
padding: var(--default-padding);
2019-11-19 16:35:52 +08:00
color: inherit;
border-top: none;
border-bottom: none;
2019-11-19 16:35:52 +08:00
}
2019-11-22 14:47:55 +08:00
&:not(.is-disabled):hover > a {
2019-11-19 16:35:52 +08:00
text-decoration: none;
color: var(--menu-active-color);
background: var(--menu-hover-bg-color);
2019-11-19 18:59:06 +08:00
cursor: pointer;
border-top: none;
border-bottom: none;
2019-11-19 16:35:52 +08:00
}
2019-11-22 14:47:55 +08:00
&.is-disabled > a {
color: var(--menu-disabled-color);
2019-11-19 16:35:52 +08:00
pointer-events: none;
}
2019-11-22 14:47:55 +08:00
&.has-child > a::after {
2019-11-19 16:35:52 +08:00
content: '';
width: 0;
height: 0;
border-width: 4px 7px;
border-style: solid;
border-color: transparent transparent transparent
var(--default-icon-color);
text-shadow: var(--menu-box-shadow);
2019-11-19 16:35:52 +08:00
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
}
2019-11-20 10:35:31 +08:00
2019-11-22 14:47:55 +08:00
&.has-child:hover > a::after {
border-color: transparent transparent transparent var(--menu-active-color);
2019-11-19 16:35:52 +08:00
}
}
2019-11-22 14:47:55 +08:00
&-itemIcon {
margin-right: 5px;
}
2019-11-19 16:35:52 +08:00
&-subList {
display: none;
list-style: none;
transition: display ease-out 0.25s;
2019-11-19 16:35:52 +08:00
}
2019-11-22 14:47:55 +08:00
&-item:hover > &-subList {
2019-11-19 16:35:52 +08:00
display: block;
animation-duration: var(--animation-duration);
2019-11-19 16:35:52 +08:00
animation-fill-mode: both;
animation-name: contextMenuIn;
position: absolute;
left: 100%; // calc(100% + 3px);
2019-11-19 16:35:52 +08:00
top: -3px;
min-width: var(--menu-sub-min-width);
2019-11-19 16:35:52 +08:00
margin: 0;
padding: 0;
background: var(--menu-background);
box-shadow: var(--menu-box-shadow);
border-radius: var(--menu-border-radius);
2019-11-19 16:35:52 +08:00
color: var(--menu-font-color);
font-family: var(--menu-font-family);
font-size: 12px;
line-height: 20px;
2019-11-19 16:35:52 +08:00
&:hover {
display: block;
}
2019-11-19 16:35:52 +08:00
// 附加的边框线
2019-11-19 16:35:52 +08:00
&::before {
display: block;
position: absolute;
content: '';
top: -1px;
left: -1px;
bottom: -1px;
right: -1px;
border-radius: var(--menu-border-radius);
border: 1px solid var(--menu-border-color);
2019-11-19 16:35:52 +08:00
z-index: -1;
}
}
2019-11-22 14:47:55 +08:00
&--left &-item:hover > &-subList {
2019-11-20 10:35:31 +08:00
left: auto;
right: 100%;
}
2019-11-24 10:21:12 +08:00
&-cursor {
position: absolute;
width: 1px;
height: 1px;
z-index: -1;
}
2019-11-19 16:35:52 +08:00
&-overlay {
position: fixed !important;
2019-11-26 14:49:22 +08:00
z-index: $zindex-contextmenu - 1;
2019-11-19 16:35:52 +08:00
top: 0;
left: 0;
right: 0;
bottom: 0;
background: transparent;
2020-05-11 14:02:10 +08:00
pointer-events: none;
2019-11-19 16:35:52 +08:00
}
2019-11-22 14:47:55 +08:00
}