bee-table/src/Table.scss

292 lines
5.1 KiB
SCSS
Raw Normal View History

2017-01-12 08:53:51 +08:00
@import "../node_modules/tinper-bee-core/scss/minxin-variables";
@import "../node_modules/tinper-bee-core/scss/minxin-mixins";
2016-12-26 22:04:16 +08:00
$text-color : #666;
$font-size-base : 12px;
$line-height: 1.5;
2017-01-11 17:01:50 +08:00
$table-border-color: $border-color-base;
2016-12-26 22:04:16 +08:00
$table-head-background-color: #f7f7f7;
$vertical-padding: 16px;
$horizontal-padding: 8px;
2017-01-11 17:01:50 +08:00
$table-border-color: #e9e9e9;
$table-hover-color: unquote("rgb(#{$palette-blue-50})") !default;
$table-move-in-color: $bg-color-base;
2016-12-26 22:04:16 +08:00
.u-table {
font-size: $font-size-base;
color: $text-color;
2016-12-26 16:52:39 +08:00
transition: opacity 0.3s ease;
position: relative;
2016-12-26 22:04:16 +08:00
line-height: $line-height;
2016-12-26 16:52:39 +08:00
overflow: hidden;
2017-01-11 17:01:50 +08:00
table {
width: 100%;
border-collapse: collapse;
text-align: left;
}
th {
background: $table-head-background-color;
font-weight: bold;
transition: background .3s ease;
}
td {
border-bottom: 1px solid $table-border-color;
}
tr {
transition: all .3s ease;
&:hover {
background: $table-hover-color;
}
}
tr.tr-row-hover {
background: $table-hover-color;
}
th, td {
padding: $vertical-padding $horizontal-padding;
}
2016-12-26 22:04:16 +08:00
&-scroll {
2016-12-26 16:52:39 +08:00
overflow: auto;
}
2016-12-26 22:04:16 +08:00
&-header {
2016-12-26 16:52:39 +08:00
overflow: hidden;
2016-12-26 22:04:16 +08:00
background: $table-head-background-color;
2016-12-26 16:52:39 +08:00
}
&-fixed-header &-body {
background: #fff;
position: relative;
}
&-fixed-header &-body-inner {
height: 100%;
overflow: scroll;
}
&-fixed-header &-scroll &-header {
overflow-x: scroll;
padding-bottom: 20px;
margin-bottom: -20px;
overflow-y: scroll;
box-sizing: border-box;
}
2016-12-26 22:04:16 +08:00
&-title {
padding: $vertical-padding $horizontal-padding;
border-top: 1px solid $table-border-color;
2016-12-26 16:52:39 +08:00
}
2016-12-26 22:04:16 +08:00
&-content {
2016-12-26 16:52:39 +08:00
position: relative;
}
2016-12-26 22:04:16 +08:00
&-footer {
// padding: $vertical-padding $horizontal-padding;
// border-bottom: 1px solid $table-border-color;
2016-12-26 16:52:39 +08:00
}
2016-12-26 22:04:16 +08:00
&-placeholder {
2016-12-26 16:52:39 +08:00
padding: 16px 8px;
background: #fff;
2016-12-26 22:04:16 +08:00
border-bottom: 1px solid $table-border-color;
2016-12-26 16:52:39 +08:00
text-align: center;
position: relative;
}
&-expand-icon-col {
width: 10px;
}
&-row, &-expanded-row {
&-expand-icon {
cursor: pointer;
display: inline-block;
width: 16px;
height: 16px;
text-align: center;
line-height: 16px;
2016-12-26 22:04:16 +08:00
border: 1px solid $table-border-color;
2016-12-26 16:52:39 +08:00
user-select: none;
background: #fff;
}
&-spaced {
visibility: hidden;
}
&-spaced:after {
content: '.'
}
&-expanded:after {
content: '-'
}
&-collapsed:after {
content: '+'
}
}
2016-12-26 22:04:16 +08:00
tr.u-table-expanded-row {
2016-12-26 16:52:39 +08:00
background: #f7f7f7;
&:hover {
background: #f7f7f7;
}
}
&-column-hidden {
display: none;
}
&-prev-columns-page,
&-next-columns-page {
cursor: pointer;
color: #666;
z-index: 1;
&:hover {
color: #2db7f5;
}
&-disabled {
cursor: not-allowed;
color: #999;
&:hover {
color: #999;
}
}
}
&-prev-columns-page {
margin-right: 8px;
&:before {
content: '<';
}
}
&-next-columns-page {
float: right;
&:before {
content: '>';
}
}
&-fixed-left,
&-fixed-right {
position: absolute;
top: 0;
overflow: hidden;
z-index: 1;
table {
width: auto;
background: #fff;
}
}
&-fixed-left {
left: 0;
box-shadow: 4px 0 4px rgba(100, 100, 100, 0.1);
2016-12-26 22:04:16 +08:00
& &-body-inner {
2016-12-26 16:52:39 +08:00
margin-right: -20px;
padding-right: 20px;
}
2016-12-26 22:04:16 +08:00
&-fixed-header & &-body-inner {
2016-12-26 16:52:39 +08:00
padding-right: 0;
}
}
&-fixed-right {
right: 0;
box-shadow: -4px 0 4px rgba(100, 100, 100, 0.1);
// hide expand row content in right fixed Table
// https://github.com/ant-design/ant-design/issues/1898
2016-12-26 22:04:16 +08:00
&-expanded-row {
2016-12-26 16:52:39 +08:00
color: transparent;
pointer-events: none;
}
}
2016-12-26 22:04:16 +08:00
& &-scroll-position-left &-fixed-left {
2016-12-26 16:52:39 +08:00
box-shadow: none;
}
2016-12-26 22:04:16 +08:00
& &-scroll-position-right &-fixed-right {
2016-12-26 16:52:39 +08:00
box-shadow: none;
}
}
2017-01-11 17:01:50 +08:00
.u-table.bordered {
table {
border-collapse: collapse;
}
th, td {
border: 1px solid $table-border-color;
}
}
.move-enter, .move-appear {
opacity: 0;
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-duration: 2.5s;
animation-fill-mode: both;
animation-play-state: paused;
}
.move-leave {
animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
animation-duration: .5s;
animation-fill-mode: both;
animation-play-state: paused;
}
.move-enter.move-enter-active, .move-appear.move-enter-active {
animation-name: moveLeftIn;
animation-play-state: running;
}
.move-leave.move-leave-active {
animation-name: moveRightOut;
animation-play-state: running;
}
@keyframes moveLeftIn {
0% {
transform-origin: 0 0;
transform: translateX(30px);
opacity: 0;
background: $table-move-in-color;
}
20% {
transform-origin: 0 0;
transform: translateX(0);
opacity: 1;
}
80%{
background: $table-move-in-color;
}
100%{
background: transparent;
opacity: 1;
}
}
@keyframes moveRightOut {
0% {
transform-origin: 0 0;
transform: translateX(0);
opacity: 1;
}
100% {
transform-origin: 0 0;
transform: translateX(-30px);
opacity: 0;
}
}