mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-05 05:28:37 +08:00
9a75b1330a
* feat:图片上传支持配置占位图样式及其比例等 * fix conflict * feat:表格中图片上传支持默认图片 * 增加fixedSize配置项支持用户自定义图片框尺寸 * 拆分fixedSize配置项 * 删除无用代码 * 默认背景图片自动获取宽度&frameImage&图片静态展示超出省略 Co-authored-by: 邓黔川 <dengqianchuan@baidu.com> Co-authored-by: dqc <qianchuan.deng@gmail.com>
154 lines
3.3 KiB
SCSS
154 lines
3.3 KiB
SCSS
.#{$ns}Images {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
margin: calc(var(--gap-xs) * -1);
|
|
|
|
&-item {
|
|
display: flex;
|
|
margin: var(--gap-xs);
|
|
}
|
|
}
|
|
|
|
.#{$ns}Image {
|
|
display: inline-block;
|
|
border: var(--borderWidth) solid var(--borderColor);
|
|
padding: var(--gap-xs);
|
|
|
|
&-thumb {
|
|
width: px2rem(108px);
|
|
height: px2rem(108px);
|
|
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwMCIgaGVpZ2h0PSI0MDAiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgICAgICAgIDxyZWN0IGZpbGw9ImJsYWNrIiB4PSIwIiB5PSIwIiB3aWR0aD0iMTAiIGhlaWdodD0iMTAiIG9wYWNpdHk9IjAuMSIgLz4KICAgICAgICAgICAgPHJlY3QgZmlsbD0id2hpdGUiIHg9IjEwIiB5PSIwIiB3aWR0aD0iMTAiIGhlaWdodD0iMTAiIC8+CiAgICAgICAgICAgIDxyZWN0IGZpbGw9ImJsYWNrIiB4PSIxMCIgeT0iMTAiIHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCIgb3BhY2l0eT0iMC4xIiAvPgogICAgICAgICAgICA8cmVjdCBmaWxsPSJ3aGl0ZSIgeD0iMCIgeT0iMTAiIHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCIgLz4KICAgICAgICA8L3BhdHRlcm4+CiAgICA8L2RlZnM+CiAgICA8cmVjdCBmaWxsPSJ1cmwoI2dyaWQpIiB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiAvPgo8L3N2Zz4=');
|
|
overflow: hidden;
|
|
position: relative;
|
|
|
|
> img {
|
|
position: absolute;
|
|
left: 50%;
|
|
top: 50%;
|
|
max-height: 100%;
|
|
width: auto;
|
|
transform: translate(-50%, -50%);
|
|
}
|
|
}
|
|
|
|
&-info {
|
|
width: px2rem(108px);
|
|
}
|
|
|
|
&-thumb--4-3 {
|
|
height: px2rem(108px * 3 / 4);
|
|
}
|
|
|
|
&-thumb--16-9 {
|
|
height: px2rem(108px * 9 / 16);
|
|
}
|
|
|
|
&-thumb--fixed-size {
|
|
min-width: px2rem(108px);
|
|
min-height: px2rem(108px);
|
|
width: 100%;
|
|
padding: 0;
|
|
height: 100%;
|
|
}
|
|
|
|
&-thumb--fixed-size &-thumb {
|
|
width: 100%;
|
|
height: 100%;
|
|
|
|
> img {
|
|
width: auto;
|
|
height: 100%;
|
|
}
|
|
}
|
|
|
|
&-thumb--w-full > img {
|
|
width: 100%;
|
|
height: auto;
|
|
}
|
|
|
|
@supports (object-fit: contain) {
|
|
&-thumb--contain > img {
|
|
position: static;
|
|
width: 100% !important;
|
|
height: 100% !important;
|
|
transform: translate(0, 0);
|
|
top: 0;
|
|
left: 0;
|
|
object-fit: contain;
|
|
}
|
|
}
|
|
|
|
@supports (object-fit: cover) {
|
|
&-thumb--cover > img {
|
|
position: static;
|
|
width: 100% !important;
|
|
height: 100% !important;
|
|
transform: translate(0, 0);
|
|
top: 0;
|
|
left: 0;
|
|
object-fit: cover;
|
|
}
|
|
}
|
|
|
|
&-caption {
|
|
font-size: var(--fontSizeSm);
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
&-title {
|
|
font-size: var(--fontSizeSm);
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
&-overlay {
|
|
background: rgba(0, 0, 0, 0.6);
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
display: none;
|
|
top: 0;
|
|
left: 0;
|
|
|
|
justify-content: center;
|
|
align-items: center;
|
|
align-content: center;
|
|
flex-wrap: wrap;
|
|
color: #fff;
|
|
|
|
> div {
|
|
width: 100%;
|
|
text-align: center;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
> a {
|
|
cursor: pointer;
|
|
color: #fff;
|
|
display: inline-block;
|
|
padding: 0 5px;
|
|
line-height: 1;
|
|
font-size: px2rem(16px);
|
|
}
|
|
}
|
|
|
|
&-thumb:hover &-overlay {
|
|
display: flex;
|
|
}
|
|
}
|
|
|
|
.#{$ns}ImageField {
|
|
display: inline-block;
|
|
position: relative;
|
|
@include clearfix();
|
|
// margin-bottom: var(--gap-md);
|
|
}
|
|
|
|
.#{$ns}ImagesField {
|
|
position: relative;
|
|
@include clearfix();
|
|
}
|