naive-ui/styles/DataTable.scss
2020-02-28 22:57:10 +08:00

340 lines
10 KiB
SCSS

@import "./mixins/mixins.scss";
@include themes-mixin {
@include b(data-table) {
@include once {
width: 100%;
font-size: 14px;
padding-bottom: 8px;
}
@include b(data-table-tables-wrapper) {
@include once {
position: relative;
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
border-top-left-radius: $--n-data-table-border-radius;
border-top-right-radius: $--n-data-table-border-radius;
overflow: hidden;
line-height: 1.75;
}
@include b(data-table-table-wrapper) {
@include once {
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
}
background-color: $--data-table-body-background-color;
}
}
@include b(data-table-table) {
@include once {
width: 100%;
word-wrap: break-word;
word-break: break-all;
table-layout: fixed;
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
border-collapse: separate;
border-spacing: 0;
}
background-color: $--data-table-body-background-color;
@include b(data-table-thead) {
@include once {
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
}
background-color: $--data-table-header-background-color;
}
@include b(data-table-tbody) {
@include b(data-table-tr) {
&:hover {
background-color: map-get($--data-table-row-background-color, 'hover');
@include b(data-table-td) {
background-color: map-get($--data-table-row-background-color, 'hover');
}
}
@include m(hover) {
background-color: map-get($--data-table-row-background-color, 'hover');
}
}
}
@include b(data-table-tr) {
@include once {
box-sizing: border-box;
transition: background-color 0.3s $--n-ease-in-out-cubic-bezier;
background-clip: padding-box;
}
}
@include b(data-table-td) {
@include once {
padding: 10px 10px 10px 16px;
text-align: left;
box-sizing: border-box;
border: none;
transition:
box-shadow .3s $--n-ease-in-out-cubic-bezier,
background-color .3s $--n-ease-in-out-cubic-bezier,
color .3s $--n-ease-in-out-cubic-bezier;
@include m(ellipsis) {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
@include m(fixed-left) {
left: 0;
position: sticky;
&::after {
content: "";
width: 16px;
display: inline-block;
position: absolute;
top: 0;
bottom: 0;
transition: box-shadow .2s $--n-ease-in-out-cubic-bezier;
right: -16px;
}
}
@include m(fixed-right) {
right: 0;
position: sticky;
&::before {
content: "";
width: 16px;
display: inline-block;
position: absolute;
top: 0;
bottom: 0;
transition: box-shadow .2s $--n-ease-in-out-cubic-bezier;
left: -16px;
}
}
}
background-color: $--data-table-body-background-color;
@include m(shadow-before) {
&::before {
box-shadow: inset -16px 0 12px -16px $--data-table-fixed-column-box-shadow-color;
}
}
@include m(shadow-after) {
&::after {
box-shadow: inset 16px 0 12px -16px $--data-table-fixed-column-box-shadow-color;
}
}
border-color: $--data-table-border-color;
color: $--data-table-body-text-color;
border-bottom: 1px solid $--data-table-border-color;
}
@include b(data-table-th) {
@include once {
position: relative;
padding: 10px 10px 10px 16px;
text-align: left;
font-weight: $--n-strong-weight;
box-sizing: border-box;
transition:
border-color .3s $--n-ease-in-out-cubic-bezier,
color .3s $--n-ease-in-out-cubic-bezier,
background-color .3s $--n-ease-in-out-cubic-bezier;
@include m(filterable) {
padding-right: 36px;
}
@include m(ellipsis) {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}
border-color: $--data-table-border-color;
color: $--data-table-header-text-color;
@include m(sortable) {
cursor: pointer;
&:hover {
background-color: map-get($--data-table-header-cell-background-color, 'hover');
}
}
@include m(fixed-left) {
left: 0;
position: sticky;
z-index: 1;
background-color: $--data-table-header-fixed-background-color;
&::after {
content: "";
width: 16px;
display: inline-block;
position: absolute;
top: 0;
bottom: 0;
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
right: -16px;
}
}
@include m(fixed-right) {
right: 0;
position: sticky;
z-index: 1;
background-color: $--data-table-header-fixed-background-color;
&::before {
content: "";
width: 16px;
display: inline-block;
position: absolute;
top: 0;
bottom: 0;
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
left: -16px;
}
}
@include m(shadow-before) {
&::before {
box-shadow: inset -16px 0 12px -16px $--data-table-fixed-column-box-shadow-color;
}
}
@include m(shadow-after) {
&::after {
box-shadow: inset 16px 0 12px -16px $--data-table-fixed-column-box-shadow-color;
}
}
}
}
@include not-m(single-line) {
@include b(data-table-tables-wrapper) {
@include b(data-table-table){
@include b(data-table-th) {
border-right: 1px solid $--data-table-border-color;
&:last-child {
border-right: 0px solid $--data-table-border-color;
}
}
@include b(data-table-td) {
border-right: 1px solid $--data-table-border-color;
&:last-child {
border-right: 0px solid $--data-table-border-color;
}
}
}
}
}
@include m(bordered) {
@include b(data-table-tables-wrapper) {
overflow: hidden;
border: 1px solid $--data-table-border-color;
border-bottom-left-radius: $--n-data-table-border-radius;
border-bottom-right-radius: $--n-data-table-border-radius;
@include b(data-table-table){
@include b(data-table-tr) {
&:last-child {
@include b(data-table-td) {
border-bottom: 0px solid $--data-table-border-color;
}
}
}
}
}
}
@include b(scrollbar-content) {
overflow: visible;
}
}
@include b(data-table) {
@include once {
@include e(empty) {
padding: 24px 0;
}
@include e(pagination) {
margin-top: 24px;
display: flex;
justify-content: flex-end;
}
}
@include b(data-table-base-table-header) {
@include once {
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
&::-webkit-scrollbar {
width: 0;
height: 0;
}
scrollbar-width: none;
}
border-bottom: 1px solid $--data-table-border-color;
@include b(data-table-th) {
@include b(data-table-sort-button) {
@include once {
height: 14px;
width: 14px;
margin-left: 4px;
position: relative;
display: inline-block;
vertical-align: middle;
@include e(asc-icon) {
bottom: calc(50% - 2px);
left: 0;
}
@include e(desc-icon) {
top: calc(50% - 2px);
left: 0;
}
}
@include m(asc) {
@include e(asc-icon) {
fill: map-get($--data-table-button-color, 'active');
}
}
@include m(desc) {
@include e(desc-icon) {
fill: map-get($--data-table-button-color, 'active');
}
}
@include e(asc-icon, desc-icon) {
@include once {
transition: fill .3s $--n-ease-in-out-cubic-bezier;
position: absolute;
}
fill: map-get($--data-table-button-color, 'default');
}
}
@include b(data-table-filter-button) {
@include once {
position: absolute;
right: 0;
width: 36px;
top: 0;
bottom: 0;
cursor: pointer;
}
@include e(icon-wrapper) {
@include once {
position: absolute;
right: 0;
left: 0;
top: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
}
&:hover {
background-color: map-get($--data-table-header-cell-background-color, 'hover');
}
@include b(icon) {
@include once {
font-size: 14px;
}
fill: map-get($--data-table-button-color, 'default');
stroke: map-get($--data-table-button-color, 'default');
}
}
@include m(popover-visible) {
@include e(icon-wrapper) {
background-color: map-get($--data-table-header-cell-background-color, 'hover');
}
}
@include m(active) {
@include e(icon-wrapper) {
background-color: map-get($--data-table-header-cell-background-color, 'hover');
@include b(icon) {
fill: map-get($--data-table-button-color, 'active');
stroke: map-get($--data-table-button-color, 'active');
}
}
}
}
}
}
}
}