ant-design/components/upload/style/index.less

472 lines
9.3 KiB
Plaintext
Raw Normal View History

2018-12-07 20:02:01 +08:00
@import '../../style/themes/default';
@import '../../style/mixins/index';
2018-12-07 20:02:01 +08:00
@upload-prefix-cls: ~'@{ant-prefix}-upload';
@upload-item: ~'@{ant-prefix}-upload-list-item';
2018-12-26 15:19:24 +08:00
@upload-picture-card-size: 104px;
@upload-picture-card-border-style: @border-style-base;
2015-08-08 23:37:35 +08:00
2015-08-20 16:55:42 +08:00
.@{upload-prefix-cls} {
.reset-component;
outline: 0;
p {
margin: 0;
}
2016-08-16 17:54:59 +08:00
&-btn {
display: block;
width: 100%;
2016-01-15 16:44:07 +08:00
outline: none;
}
2018-12-07 20:02:01 +08:00
input[type='file'] {
cursor: pointer;
}
2015-12-12 15:25:54 +08:00
&&-select {
display: inline-block;
}
&&-select-picture-card {
display: table;
2018-12-26 15:19:24 +08:00
width: @upload-picture-card-size;
height: @upload-picture-card-size;
margin-right: 8px;
margin-bottom: 8px;
text-align: center;
vertical-align: top;
background-color: @background-color-light;
border: @border-width-base dashed @border-color-base;
border-radius: @border-radius-base;
cursor: pointer;
transition: border-color 0.3s ease;
> .@{upload-prefix-cls} {
display: table-cell;
width: 100%;
height: 100%;
padding: 8px;
2017-10-17 14:43:52 +08:00
text-align: center;
vertical-align: middle;
}
&:hover {
border-color: @primary-color;
}
}
2015-12-12 15:25:54 +08:00
&&-drag {
position: relative;
width: 100%;
2015-11-13 16:09:39 +08:00
height: 100%;
text-align: center;
2017-10-17 20:56:29 +08:00
background: @background-color-light;
border: @border-width-base dashed @border-color-base;
border-radius: @border-radius-base;
cursor: pointer;
transition: border-color 0.3s;
.@{upload-prefix-cls} {
padding: 16px 0;
}
&.@{upload-prefix-cls}-drag-hover:not(.@{upload-prefix-cls}-disabled) {
border-color: @primary-7;
2015-11-11 00:28:05 +08:00
}
&.@{upload-prefix-cls}-disabled {
cursor: not-allowed;
}
2016-08-16 17:54:59 +08:00
.@{upload-prefix-cls}-btn {
display: table;
2015-10-31 13:27:58 +08:00
height: 100%;
}
2015-08-20 16:55:42 +08:00
.@{upload-prefix-cls}-drag-container {
display: table-cell;
vertical-align: middle;
}
&:not(.@{upload-prefix-cls}-disabled):hover {
border-color: @primary-5;
2015-10-31 13:27:58 +08:00
}
2015-08-20 16:55:42 +08:00
p.@{upload-prefix-cls}-drag-icon {
.@{iconfont-css-prefix} {
color: @primary-5;
font-size: 48px;
2015-08-08 23:37:35 +08:00
}
2017-10-17 14:43:52 +08:00
margin-bottom: 20px;
2015-08-08 23:37:35 +08:00
}
2015-08-20 16:55:42 +08:00
p.@{upload-prefix-cls}-text {
margin: 0 0 4px;
color: @heading-color;
font-size: @font-size-lg;
2015-08-08 23:37:35 +08:00
}
2015-08-20 16:55:42 +08:00
p.@{upload-prefix-cls}-hint {
color: @text-color-secondary;
font-size: @font-size-base;
2015-08-08 23:37:35 +08:00
}
.@{iconfont-css-prefix}-plus {
color: @disabled-color;
2015-08-08 23:37:35 +08:00
font-size: 30px;
2018-12-07 20:02:01 +08:00
transition: all 0.3s;
&:hover {
color: @text-color-secondary;
}
2015-08-08 23:37:35 +08:00
}
&:hover .@{iconfont-css-prefix}-plus {
color: @text-color-secondary;
2015-08-08 23:37:35 +08:00
}
}
}
2015-08-08 23:37:35 +08:00
2015-08-20 16:55:42 +08:00
.@{upload-prefix-cls}-list {
.reset-component;
2017-10-18 21:30:48 +08:00
.clearfix;
2015-12-12 15:25:54 +08:00
&-item {
2017-03-08 12:11:31 +08:00
position: relative;
2017-10-17 14:43:52 +08:00
height: 22px;
margin-top: 8px;
font-size: @font-size-base;
2017-03-08 12:11:31 +08:00
&-name {
display: inline-block;
width: 100%;
padding-left: @font-size-base + 8px;
2017-03-08 12:11:31 +08:00
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
2017-03-08 12:11:31 +08:00
}
2015-11-04 12:00:49 +08:00
2015-12-12 15:25:54 +08:00
&-info {
2017-10-17 14:43:52 +08:00
height: 100%;
2017-03-08 12:11:31 +08:00
padding: 0 12px 0 4px;
2018-12-07 20:02:01 +08:00
transition: background-color 0.3s;
2015-11-04 12:00:49 +08:00
> span {
display: block;
}
.@{iconfont-css-prefix}-loading,
.@{iconfont-css-prefix}-paper-clip {
2017-03-08 12:11:31 +08:00
position: absolute;
2017-10-17 14:43:52 +08:00
top: @font-size-base / 2 - 2px;
color: @text-color-secondary;
font-size: @font-size-base;
2015-10-31 13:27:58 +08:00
}
}
2017-03-08 12:11:31 +08:00
2018-08-24 18:36:08 +08:00
.@{iconfont-css-prefix}-close {
.iconfont-size-under-12px(10px);
position: absolute;
top: 6px;
right: 4px;
color: @text-color-secondary;
line-height: 0;
cursor: pointer;
opacity: 0;
transition: all 0.3s;
&:hover {
color: @text-color;
}
2015-08-08 23:37:35 +08:00
}
2015-10-31 13:27:58 +08:00
2015-12-12 15:25:54 +08:00
&:hover &-info {
background-color: @item-hover-bg;
2015-12-12 15:25:54 +08:00
}
2018-08-24 18:36:08 +08:00
&:hover .@{iconfont-css-prefix}-close {
2015-12-12 15:25:54 +08:00
opacity: 1;
}
2015-12-14 11:56:00 +08:00
&-error,
2017-02-19 01:39:41 +08:00
&-error .@{iconfont-css-prefix}-paper-clip,
2017-02-27 14:18:00 +08:00
&-error &-name {
2015-12-14 11:56:00 +08:00
color: @error-color;
}
2018-08-24 18:36:08 +08:00
&-error .@{iconfont-css-prefix}-close {
color: @error-color !important;
opacity: 1;
2015-12-14 11:56:00 +08:00
}
2015-12-12 15:25:54 +08:00
&-progress {
2017-03-20 16:44:29 +08:00
position: absolute;
2017-10-17 14:43:52 +08:00
bottom: -12px;
width: 100%;
2017-10-17 14:43:52 +08:00
padding-left: @font-size-base + 12px;
font-size: @font-size-base;
line-height: 0;
2015-10-31 13:27:58 +08:00
}
2015-12-12 15:25:54 +08:00
}
2016-01-15 15:56:06 +08:00
&-picture,
&-picture-card {
.@{upload-item} {
position: relative;
height: 66px;
2016-01-15 15:56:06 +08:00
padding: 8px;
border: @border-width-base @upload-picture-card-border-style @border-color-base;
border-radius: @border-radius-base;
2016-01-15 15:56:06 +08:00
&:hover {
background: transparent;
}
&-error {
border-color: @error-color;
}
2016-01-15 15:56:06 +08:00
}
.@{upload-item}-info {
padding: 0;
}
.@{upload-item}:hover .@{upload-item}-info {
2015-12-12 15:25:54 +08:00
background: transparent;
}
2015-10-31 13:27:58 +08:00
2016-01-15 15:56:06 +08:00
.@{upload-item}-uploading {
border-style: dashed;
}
2015-12-12 15:25:54 +08:00
2016-01-15 15:56:06 +08:00
.@{upload-item}-thumbnail {
2016-01-15 16:11:31 +08:00
position: absolute;
top: 8px;
left: 8px;
width: 48px;
height: 48px;
font-size: 26px;
line-height: 54px;
text-align: center;
2018-12-07 20:02:01 +08:00
opacity: 0.8;
}
.@{upload-item}-icon {
position: absolute;
top: 50%;
left: 50%;
font-size: 26px;
transform: translate(-50%, -50%);
2016-01-15 15:56:06 +08:00
}
.@{upload-item}-thumbnail img {
display: block;
2016-01-15 15:56:06 +08:00
width: 48px;
height: 48px;
2016-11-22 14:21:42 +08:00
overflow: hidden;
2016-01-15 15:56:06 +08:00
}
2015-12-12 15:25:54 +08:00
2016-01-15 15:56:06 +08:00
.@{upload-item}-name {
display: inline-block;
box-sizing: border-box;
max-width: 100%;
2016-01-15 15:56:06 +08:00
margin: 0 0 0 8px;
padding-right: 8px;
padding-left: 48px;
overflow: hidden;
2016-11-22 14:21:42 +08:00
line-height: 44px;
white-space: nowrap;
text-overflow: ellipsis;
2018-12-07 20:02:01 +08:00
transition: all 0.3s;
2016-01-15 15:56:06 +08:00
}
.@{upload-item}-uploading .@{upload-item}-name {
line-height: 28px;
}
.@{upload-item}-progress {
2017-10-17 14:43:52 +08:00
bottom: 14px;
2018-12-07 20:02:01 +08:00
width: ~'calc(100% - 24px)';
margin-top: 0;
padding-left: 56px;
2016-01-15 15:56:06 +08:00
}
2018-08-24 18:36:08 +08:00
.@{iconfont-css-prefix}-close {
2016-01-15 15:56:06 +08:00
position: absolute;
top: 8px;
right: 8px;
2016-01-15 15:56:06 +08:00
line-height: 1;
opacity: 1;
2016-01-15 15:56:06 +08:00
}
2015-12-12 15:25:54 +08:00
}
2016-01-15 15:56:06 +08:00
&-picture-card {
// https://github.com/ant-design/ant-design/issues/11183
float: left;
&.@{upload-prefix-cls}-list::after {
2017-10-26 11:47:05 +08:00
display: none;
}
2016-01-15 15:56:06 +08:00
.@{upload-item} {
float: left;
2018-12-26 15:19:24 +08:00
width: @upload-picture-card-size;
height: @upload-picture-card-size;
margin: 0 8px 8px 0;
2016-01-15 15:56:06 +08:00
}
2015-12-12 15:25:54 +08:00
2016-01-15 15:56:06 +08:00
.@{upload-item}-info {
position: relative;
height: 100%;
2017-10-10 16:23:25 +08:00
overflow: hidden;
2015-12-12 15:25:54 +08:00
&::before {
2016-01-15 15:56:06 +08:00
position: absolute;
2016-01-15 16:11:31 +08:00
z-index: 1;
width: 100%;
height: 100%;
background-color: fade(@black, 50%);
2017-03-13 11:16:22 +08:00
opacity: 0;
transition: all 0.3s;
content: ' ';
2016-01-15 15:56:06 +08:00
}
2017-03-13 11:16:22 +08:00
}
2015-12-12 15:25:54 +08:00
.@{upload-item}:hover .@{upload-item}-info::before {
2017-03-13 11:16:22 +08:00
opacity: 1;
2016-01-15 15:56:06 +08:00
}
2015-11-04 12:00:49 +08:00
.@{upload-item}-actions {
position: absolute;
top: 50%;
left: 50%;
z-index: 10;
white-space: nowrap;
transform: translate(-50%, -50%);
opacity: 0;
2018-12-07 20:02:01 +08:00
transition: all 0.3s;
.@{iconfont-css-prefix}-eye-o,
.@{iconfont-css-prefix}-delete {
z-index: 10;
width: 16px;
margin: 0 4px;
color: @text-color-dark;
font-size: 16px;
cursor: pointer;
transition: all 0.3s;
&:hover {
color: @text-color-inverse;
}
}
}
.@{upload-item}-info:hover + .@{upload-item}-actions,
.@{upload-item}-actions:hover {
opacity: 1;
}
.@{upload-item}-thumbnail,
2016-01-15 15:56:06 +08:00
.@{upload-item}-thumbnail img {
position: static;
display: block;
width: 100%;
height: 100%;
2016-01-15 15:56:06 +08:00
}
.@{upload-item}-name {
display: none;
margin: 8px 0 0;
padding: 0;
line-height: @line-height-base;
text-align: center;
2016-01-15 15:56:06 +08:00
}
.anticon-picture + .@{upload-item}-name {
display: block;
}
2016-01-15 15:56:06 +08:00
.@{upload-item}-uploading {
&.@{upload-item} {
2017-10-17 14:43:52 +08:00
background-color: @background-color-light;
2016-01-15 15:56:06 +08:00
}
.@{upload-item}-info {
2016-08-02 14:51:48 +08:00
height: auto;
&::before,
.@{iconfont-css-prefix}-eye-o,
.@{iconfont-css-prefix}-delete {
2016-01-15 15:56:06 +08:00
display: none;
}
}
&-text {
margin-top: 18px;
color: @text-color-secondary;
2016-01-15 15:56:06 +08:00
}
}
.@{upload-item}-progress {
2017-10-10 16:23:25 +08:00
bottom: 32px;
padding-left: 0;
2016-01-15 15:56:06 +08:00
}
}
2015-11-04 12:00:49 +08:00
2015-08-20 16:55:42 +08:00
.@{upload-prefix-cls}-success-icon {
color: @success-color;
font-weight: bold;
}
2015-08-21 17:12:42 +08:00
.@{upload-prefix-cls}-animate-enter,
.@{upload-prefix-cls}-animate-leave,
.@{upload-prefix-cls}-animate-inline-enter,
.@{upload-prefix-cls}-animate-inline-leave {
2018-12-07 20:02:01 +08:00
animation-duration: 0.3s;
animation-fill-mode: @ease-in-out-circ;
2015-08-21 17:37:54 +08:00
}
.@{upload-prefix-cls}-animate-enter {
animation-name: uploadAnimateIn;
}
.@{upload-prefix-cls}-animate-leave {
animation-name: uploadAnimateOut;
}
.@{upload-prefix-cls}-animate-inline-enter {
animation-name: uploadAnimateInlineIn;
}
.@{upload-prefix-cls}-animate-inline-leave {
animation-name: uploadAnimateInlineOut;
}
}
@keyframes uploadAnimateIn {
from {
height: 0;
margin: 0;
padding: 0;
opacity: 0;
}
}
@keyframes uploadAnimateOut {
to {
height: 0;
margin: 0;
padding: 0;
opacity: 0;
2015-08-21 17:12:42 +08:00
}
2015-11-26 19:32:55 +08:00
}
2015-08-21 17:12:42 +08:00
@keyframes uploadAnimateInlineIn {
2015-11-26 19:32:55 +08:00
from {
width: 0;
height: 0;
margin: 0;
padding: 0;
opacity: 0;
2015-08-21 17:37:54 +08:00
}
2015-11-26 19:32:55 +08:00
}
2015-08-21 17:37:54 +08:00
@keyframes uploadAnimateInlineOut {
2015-11-26 19:32:55 +08:00
to {
width: 0;
height: 0;
margin: 0;
padding: 0;
2015-11-26 19:32:55 +08:00
opacity: 0;
2015-08-21 17:12:42 +08:00
}
}