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

460 lines
9.0 KiB
Plaintext
Raw Normal View History

@import "../../style/themes/default";
@import "../../style/mixins/index";
@upload-prefix-cls: ~"@{ant-prefix}-upload";
@upload-item: ~"@{ant-prefix}-upload-list-item";
2017-10-17 14:43:52 +08:00
@upload-pictrue-card-size: 104px;
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;
}
2015-11-26 19:32:55 +08:00
input[type="file"] {
cursor: pointer;
}
2015-12-12 15:25:54 +08:00
&&-select {
display: inline-block;
}
&&-select-picture-card {
border: @border-width-base dashed @border-color-base;
width: @upload-pictrue-card-size;
height: @upload-pictrue-card-size;
border-radius: @border-radius-base;
2017-10-17 14:43:52 +08:00
background-color: @background-color-light;
text-align: center;
cursor: pointer;
transition: border-color 0.3s ease;
vertical-align: top;
margin-right: 8px;
margin-bottom: 8px;
2017-10-17 14:43:52 +08:00
display: table;
> .@{upload-prefix-cls} {
width: 100%;
height: 100%;
2017-10-17 14:43:52 +08:00
display: table-cell;
text-align: center;
vertical-align: middle;
padding: 8px;
}
&:hover {
border-color: @primary-color;
}
}
2015-12-12 15:25:54 +08:00
&&-drag {
border: @border-width-base dashed @border-color-base;
transition: border-color .3s;
cursor: pointer;
2015-08-08 23:37:35 +08:00
border-radius: @border-radius-base;
text-align: center;
width: 100%;
2015-11-13 16:09:39 +08:00
height: 100%;
position: relative;
padding: 16px 0;
2017-10-17 20:56:29 +08:00
background: @background-color-light;
&.@{upload-prefix-cls}-drag-hover:not(.@{upload-prefix-cls}-disabled) {
border: 2px dashed @primary-5;
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} {
2017-10-17 14:43:52 +08:00
font-size: 48px;
color: @primary-5;
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 {
2016-11-08 21:07:01 +08:00
font-size: @font-size-lg;
margin: 0 0 4px;
color: @heading-color;
2015-08-08 23:37:35 +08:00
}
2015-08-20 16:55:42 +08:00
p.@{upload-prefix-cls}-hint {
2016-11-08 20:57:07 +08:00
font-size: @font-size-base;
color: @text-color-secondary;
2015-08-08 23:37:35 +08:00
}
.@{iconfont-css-prefix}-plus {
2015-08-08 23:37:35 +08:00
font-size: 30px;
transition: all .3s;
color: @disabled-color;
&: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 {
2015-10-31 13:27:58 +08:00
margin-top: 8px;
2016-11-08 20:57:07 +08:00
font-size: @font-size-base;
2017-03-08 12:11:31 +08:00
position: relative;
2017-10-17 14:43:52 +08:00
height: 22px;
2017-03-08 12:11:31 +08:00
&-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2017-10-17 14:43:52 +08:00
padding-left: @font-size-base + 8px;
2017-03-08 12:11:31 +08:00
width: 100%;
display: inline-block;
}
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;
transition: background-color .3s;
2015-11-04 12:00:49 +08:00
> span {
display: block;
}
.@{iconfont-css-prefix}-loading,
.@{iconfont-css-prefix}-paper-clip {
2016-11-08 20:57:07 +08:00
font-size: @font-size-base;
color: @text-color-secondary;
2017-03-08 12:11:31 +08:00
position: absolute;
2017-10-17 14:43:52 +08:00
top: @font-size-base / 2 - 2px;
2015-10-31 13:27:58 +08:00
}
}
2017-03-08 12:11:31 +08:00
.@{iconfont-css-prefix}-cross {
.iconfont-size-under-12px(10px);
transition: all .3s;
opacity: 0;
cursor: pointer;
position: absolute;
top: 0;
right: 4px;
color: @text-color-secondary;
2017-10-17 14:43:52 +08:00
line-height: 22px;
&: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
}
&:hover .@{iconfont-css-prefix}-cross {
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;
}
&-error .@{iconfont-css-prefix}-cross {
2015-12-14 11:56:00 +08:00
opacity: 1;
color: @error-color !important;
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
line-height: 0;
2016-11-08 20:57:07 +08:00
font-size: @font-size-base;
2017-03-20 16:44:29 +08:00
position: absolute;
width: 100%;
2017-10-17 14:43:52 +08:00
bottom: -12px;
padding-left: @font-size-base + 12px;
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} {
padding: 8px;
border-radius: @border-radius-base;
border: @border-width-base @border-style-base @border-color-base;
2016-01-15 15:56:06 +08:00
height: 66px;
position: relative;
&: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 {
width: 48px;
height: 48px;
2016-01-15 16:11:31 +08:00
position: absolute;
top: 8px;
left: 8px;
2016-01-15 15:56:06 +08:00
}
.@{upload-item}-thumbnail img {
width: 48px;
height: 48px;
display: block;
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
.@{upload-item}-thumbnail.@{iconfont-css-prefix}:before {
2016-01-15 15:56:06 +08:00
line-height: 48px;
font-size: 24px;
color: @text-color-secondary;
2016-01-15 15:56:06 +08:00
}
.@{upload-item}-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin: 0 0 0 8px;
2016-11-22 14:21:42 +08:00
line-height: 44px;
2017-03-08 12:11:31 +08:00
transition: all .3s;
2016-01-15 16:11:31 +08:00
padding-left: 48px;
padding-right: 8px;
max-width: 100%;
display: inline-block;
box-sizing: border-box;
2016-01-15 15:56:06 +08:00
}
.@{upload-item}-uploading .@{upload-item}-name {
line-height: 28px;
}
.@{upload-item}-progress {
padding-left: 56px;
margin-top: 0;
2017-10-17 14:43:52 +08:00
bottom: 14px;
2017-10-10 16:23:25 +08:00
width: ~"calc(100% - 24px)";
2016-01-15 15:56:06 +08:00
}
.@{iconfont-css-prefix}-cross {
2016-01-15 15:56:06 +08:00
position: absolute;
right: 8px;
top: 8px;
line-height: 1;
}
2015-12-12 15:25:54 +08:00
}
2016-01-15 15:56:06 +08:00
&-picture-card {
2016-08-02 14:51:48 +08:00
display: inline;
2016-01-15 15:56:06 +08:00
2017-10-26 11:47:05 +08:00
&.@{upload-prefix-cls}-list:after {
display: none;
}
2016-01-15 15:56:06 +08:00
.@{upload-item} {
float: left;
width: @upload-pictrue-card-size;
height: @upload-pictrue-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 {
height: 100%;
position: relative;
2017-10-10 16:23:25 +08:00
overflow: hidden;
2015-12-12 15:25:54 +08:00
2016-01-15 15:56:06 +08:00
&:before {
content: ' ';
position: absolute;
2016-01-15 16:11:31 +08:00
z-index: 1;
background-color: rgba(0, 0, 0, 0.5);
transition: all .3s;
width: 100%;
height: 100%;
2017-03-13 11:16:22 +08:00
opacity: 0;
2016-01-15 15:56:06 +08:00
}
2017-03-13 11:16:22 +08:00
}
2015-12-12 15:25:54 +08:00
2017-03-13 11:16:22 +08:00
.@{upload-item}:hover .@{upload-item}-info:before {
opacity: 1;
2016-01-15 15:56:06 +08:00
}
2015-11-04 12:00:49 +08:00
.@{upload-item}-actions {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 10;
white-space: nowrap;
opacity: 0;
transition: all .3s;
.@{iconfont-css-prefix}-eye-o,
.@{iconfont-css-prefix}-delete {
z-index: 10;
transition: all .3s;
cursor: pointer;
font-size: 16px;
width: 16px;
color: @text-color-dark;
margin: 0 4px;
&:hover {
color: #fff;
}
}
}
.@{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 {
display: block;
width: 100%;
height: 100%;
position: static;
2016-01-15 15:56:06 +08:00
}
.@{upload-item}-name {
margin: 8px 0 0;
padding: 0;
text-align: center;
line-height: @line-height-base;
2016-01-15 15:56:06 +08:00
display: none;
}
.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;
2016-01-15 15:56:06 +08:00
&: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 {
padding-left: 0;
2017-10-10 16:23:25 +08:00
bottom: 32px;
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 {
animation-duration: .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;
opacity: 0;
padding: 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;
2015-11-26 19:32:55 +08:00
opacity: 0;
padding: 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
}
}