amis/scss/components/_context-menu.scss

214 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 {
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: 0.35s;
animation-fill-mode: both;
}
&.in {
animation-name: contextMenuInSpecial;
animation-duration: 0.5s;
2019-11-19 16:35:52 +08:00
}
&.out {
animation-name: contextMenuOut;
}
display: block;
position: absolute;
margin: 0;
padding: 4px 0 5px;
background: rgba(239, 239, 239, 0.95);
box-shadow: 0px 4px 9px rgba(0, 0, 0, 0.34);
color: rgba(0, 0, 0, 0.75);
2019-11-22 14:47:55 +08:00
font-family: -apple-system, Lucida Grande;
2019-11-19 16:35:52 +08:00
font-size: 14px;
line-height: 15px;
&::before {
display: block;
position: absolute;
content: '';
top: -1px;
left: -1px;
bottom: -1px;
right: -1px;
border-radius: 4px;
border: 1px solid rgba(0, 0, 0, 0.125);
z-index: -1;
}
}
&-divider {
border: none;
height: 1px;
background: rgba(0, 0, 0, 0.1);
margin: 6px 1px 5px;
padding: 0;
}
&-list {
list-style: none;
margin: 0;
padding: 0;
width: 185px;
}
&-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: 0 20px;
border-top: 1px solid rgba(0, 0, 0, 0);
border-bottom: 1px solid rgba(0, 0, 0, 0);
color: inherit;
}
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: #fff;
background: -webkit-linear-gradient(top, #648bf5, #2866f2);
background: linear-gradient(to bottom, #648bf5 0%, #2866f2 100%);
border-top: 1px solid #5a82eb;
border-bottom: 1px solid #1758e7;
2019-11-19 18:59:06 +08:00
cursor: pointer;
2019-11-19 16:35:52 +08:00
}
2019-11-22 14:47:55 +08:00
&.is-disabled > a {
2019-11-19 16:35:52 +08:00
color: #999;
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 rgba(0, 0, 0, 0.75);
text-shadow: 0px 4px 9px rgba(0, 0, 0, 0.34);
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 {
2019-11-19 16:35:52 +08:00
border-color: transparent transparent transparent #fff;
}
}
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;
}
2019-11-22 14:47:55 +08:00
&-item:hover > &-subList {
2019-11-19 16:35:52 +08:00
display: block;
animation-duration: 0.35s;
animation-fill-mode: both;
animation-name: contextMenuIn;
display: block;
position: absolute;
left: 100%;
top: -3px;
margin: 0;
padding: 4px 0 5px;
background: rgba(239, 239, 239, 0.95);
box-shadow: 0px 4px 9px rgba(0, 0, 0, 0.34);
border-radius: 7px;
color: rgba(0, 0, 0, 0.75);
font-family: -apple-system, Lucida Grande;
font-size: 14px;
line-height: 15px;
&::before {
display: block;
position: absolute;
content: '';
top: -1px;
left: -1px;
bottom: -1px;
right: -1px;
border-radius: 4px;
border: 1px solid rgba(0, 0, 0, 0.125);
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;
}
2019-11-22 14:47:55 +08:00
}