amis2/scss/components/form/_image.scss
2022-02-23 10:21:04 +08:00

253 lines
5.0 KiB
SCSS

.#{$ns}ImageControl {
position: relative;
&-dropzone {
outline: none;
}
&-addBtn {
margin: 0;
width: px2rem(120px);
height: px2rem(120px);
display: inline-flex;
flex-direction: column;
justify-content: center;
align-items: center;
border: var(--borderWidth) solid var(--borderColor);
border-radius: var(--ImageControl-addBtn-borderRadius);
cursor: pointer;
margin-right: var(--gap-base);
@include button-variant(
var(--ImageControl-addBtn-bg),
var(--ImageControl-addBtn-border),
var(--ImageControl-addBtn-color),
var(--ImageControl-addBtn-onHover-bg),
var(--ImageControl-addBtn-onHover-border),
var(--ImageControl-addBtn-onHover-color),
var(--ImageControl-addBtn-onActive-bg),
var(--ImageControl-addBtn-onActive-border),
var(--ImageControl-addBtn-onActive-color)
);
> svg {
width: px2rem(24px);
height: px2rem(24px);
top: 0;
margin-bottom: px2rem(8px);
}
&.is-disabled {
pointer-events: none;
border: px2rem(1px) solid var(--ImageControl-addBtn-onDisabled-border);
background: var(--ImageControl-addBtn-onDisabled-bg);
color: var(--ImageControl-addBtn-onDisabled-color);
}
}
&-pasteTip {
pointer-events: none;
left: 0;
top: 50%;
transform: translateY(-50%);
position: absolute;
font-size: var(--Tooltip--attr-fontSize);
line-height: var(--Tooltip--attr-lineHeigt);
text-align: left;
white-space: nowrap;
background: var(--Tooltip--attr-bg);
border: var(--Tooltip--attr-borderWidth) solid
var(--Tooltip--attr-borderColor);
border-radius: var(--Tooltip--attr-borderRadius);
box-shadow: var(--Tooltip--attr-boxShadow);
left: 100%;
color: var(--Tooltip--attr-color);
padding: var(--Tooltip--attr-paddingY) var(--Tooltip--attr-paddingX);
margin: 30px 0 0 var(--Tooltip--attr-gap);
}
&-dropzone:focus &-addBtn {
border-color: var(--ImageControl-addBtn-onHover-border);
background: var(--ImageControl-addBtn-onHover-bg);
color: var(--ImageControl-addBtn-onHover-color);
}
&-item {
border: var(--borderWidth) solid var(--borderColor);
border-radius: var(--ImageControl-addBtn-borderRadius);
vertical-align: top;
padding: var(--gap-xs);
display: inline-block;
margin-right: var(--gap-base);
margin-bottom: var(--gap-base);
position: relative;
width: px2rem(120px);
&.is-invalid {
padding: 0;
border-color: var(--FileControl-danger-color);
}
svg.icon-refresh {
transform: rotate(180deg);
}
}
&-filename {
display: inline-flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: var(--FileControl-danger-color);
> svg.icon-image {
margin-bottom: 8px;
width: 24px;
height: 24px;
}
> span {
max-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
&-image {
width: 100%;
height: 100%;
padding: 0;
border: none;
display: block;
}
&-itemClear {
position: absolute;
cursor: pointer;
color: #999;
top: 5px;
right: 5px;
line-height: 1;
> svg {
top: 0;
width: 10px;
height: 10px;
}
}
&-itemInfo {
display: inline-flex;
width: 110px;
height: 110px;
justify-content: center;
align-items: center;
align-content: center;
flex-wrap: wrap;
> p {
width: 100%;
text-align: center;
font-size: 12px;
margin-bottom: 5px;
}
}
&-progress {
width: 70px;
height: 5px;
background: #ebebeb;
}
&-progressValue {
height: 5px;
border-radius: var(--ImageControl-progress-borderRadius);
display: block;
background: var(--info);
min-width: 10%;
transition: ease-out width var(--animation-duration);
}
&-item.is-invalid &-itemClear {
display: none;
}
&-item.is-invalid:hover &-itemClear {
display: block;
}
&-errorMsg {
color: var(--danger);
margin: 5px 0 0;
}
&-uploadBtn {
margin-top: 5px;
}
&-cropperWrapper {
position: relative;
img {
max-width: 100%;
max-height: 400px;
}
}
&-croperToolbar {
display: inline-flex;
width: 50px;
position: absolute;
right: 0;
bottom: 0;
flex-direction: column;
align-items: flex-end;
> a {
color: #fff;
padding: 2px 5px;
cursor: pointer;
font-size: 20px;
.icon-retry {
polygon {
fill: #fff;
}
path {
stroke: #fff;
}
}
}
}
&-acceptTip {
height: 120px;
color: #999;
border: 2px dashed var(--borderColor);
// &.is-accept {
border-color: var(--info);
background: #f3f9fe;
// }
border-radius: var(--borderRadius);
line-height: 120px;
text-align: center;
}
&-fixed-size {
width: 100%;
height: 100%;
padding: 0;
}
&-fixed-size &-itemOverlay {
width: 100%;
height: 100%;
}
}