naive-ui/styles/DataTable.scss

399 lines
12 KiB
SCSS
Raw Normal View History

@import "./mixins/mixins.scss";
2020-02-11 14:44:29 +08:00
2020-03-02 15:04:20 +08:00
@mixin data-table-size-mixin () {
@include m(small-size) {
font-size: map-get($--n-font-size, 'medium');
@include b(data-table-th) {
padding: 5px 5px 5px 11px;
}
@include b(data-table-td) {
padding: 5px 5px 5px 11px;
}
}
@include m(medium-size) {
font-size: map-get($--n-font-size, 'medium');
@include b(data-table-th) {
padding: 10px 10px 10px 16px;
}
@include b(data-table-td) {
padding: 10px 10px 10px 16px;
}
}
@include m(large-size) {
font-size: map-get($--n-font-size, 'large');
@include b(data-table-th) {
padding: 15px 15px 15px 20px;
}
@include b(data-table-td) {
padding: 15px 15px 15px 20px;
}
}
}
@include themes-mixin {
@include b(data-table) {
2020-02-24 16:25:02 +08:00
@include once {
2020-03-02 15:04:20 +08:00
@include data-table-size-mixin();
2020-02-24 16:25:02 +08:00
width: 100%;
font-size: 14px;
padding-bottom: 8px;
2020-03-01 15:16:30 +08:00
@include e(empty) {
padding: 24px 0;
opacity: 1;
transition: opacity .3s $--n-ease-in-out-cubic-bezier;
@include m(hide) {
opacity: 0;
}
}
@include e(pagination) {
margin-top: 24px;
display: flex;
justify-content: flex-end;
}
2020-02-24 16:25:02 +08:00
}
@include b(data-table-tables-wrapper) {
2020-02-24 16:25:02 +08:00
@include once {
position: relative;
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
2020-02-28 22:57:10 +08:00
border-top-left-radius: $--n-data-table-border-radius;
border-top-right-radius: $--n-data-table-border-radius;
overflow: hidden;
2020-02-24 15:31:39 +08:00
line-height: 1.75;
2020-02-24 16:25:02 +08:00
}
@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;
}
}
2020-01-08 16:22:04 +08:00
@include b(data-table-table) {
2020-02-24 16:25:02 +08:00
@include once {
width: 100%;
word-wrap: break-word;
word-break: break-all;
table-layout: fixed;
2020-01-08 16:22:04 +08:00
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
2020-02-24 16:25:02 +08:00
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;
}
2020-02-21 15:26:51 +08:00
@include b(data-table-tbody) {
@include b(data-table-tr) {
&:hover {
2020-02-24 16:25:02 +08:00
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');
}
2020-02-21 15:26:51 +08:00
}
@include m(hover) {
2020-02-24 16:25:02 +08:00
background-color: map-get($--data-table-row-background-color, 'hover');
2020-02-21 15:26:51 +08:00
}
}
}
2020-01-08 16:22:04 +08:00
@include b(data-table-tr) {
2020-02-24 16:25:02 +08:00
@include once {
box-sizing: border-box;
transition: background-color 0.3s $--n-ease-in-out-cubic-bezier;
background-clip: padding-box;
}
2020-01-08 16:22:04 +08:00
}
@include b(data-table-td) {
2020-02-24 16:25:02 +08:00
@include once {
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,
2020-03-02 15:04:20 +08:00
border-color .3s $--n-ease-in-out-cubic-bezier,
2020-02-24 16:25:02 +08:00
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;
2020-02-24 16:25:02 +08:00
color: $--data-table-body-text-color;
border-bottom: 1px solid $--data-table-border-color;
2020-01-08 16:22:04 +08:00
}
@include b(data-table-th) {
2020-02-24 16:25:02 +08:00
@include once {
position: relative;
text-align: left;
2020-02-27 23:02:58 +08:00
font-weight: $--n-strong-weight;
2020-02-24 16:25:02 +08:00
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;
2020-02-24 16:25:02 +08:00
color: $--data-table-header-text-color;
2020-01-08 16:22:04 +08:00
@include m(sortable) {
cursor: pointer;
&:hover {
2020-02-24 16:25:02 +08:00
background-color: map-get($--data-table-header-cell-background-color, 'hover');
2020-01-08 16:22:04 +08:00
}
}
@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;
}
}
}
2020-01-08 16:22:04 +08:00
}
2020-02-24 16:25:02 +08:00
@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;
}
2020-01-08 16:22:04 +08:00
}
}
2020-02-24 16:25:02 +08:00
}
}
@include m(bordered) {
@include b(data-table-tables-wrapper) {
overflow: hidden;
2020-02-24 16:25:02 +08:00
border: 1px solid $--data-table-border-color;
2020-02-28 22:57:10 +08:00
border-bottom-left-radius: $--n-data-table-border-radius;
border-bottom-right-radius: $--n-data-table-border-radius;
2020-02-24 16:25:02 +08:00
@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;
}
}
2020-01-08 16:22:04 +08:00
}
}
}
}
@include b(scrollbar-content) {
overflow: visible;
}
@include b(data-table-base-table-header) {
2020-02-24 16:25:02 +08:00
@include once {
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
&::-webkit-scrollbar {
width: 0;
height: 0;
}
scrollbar-width: none;
}
2020-02-24 16:25:02 +08:00
border-bottom: 1px solid $--data-table-border-color;
2020-01-08 16:22:04 +08:00
@include b(data-table-th) {
@include b(data-table-sort-button) {
2020-02-24 16:25:02 +08:00
@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) {
2020-02-24 16:25:02 +08:00
fill: map-get($--data-table-button-color, 'active');
}
}
@include m(desc) {
@include e(desc-icon) {
2020-02-24 16:25:02 +08:00
fill: map-get($--data-table-button-color, 'active');
}
}
@include e(asc-icon, desc-icon) {
2020-02-24 16:25:02 +08:00
@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) {
2020-02-24 16:25:02 +08:00
@include once {
2020-01-08 16:22:04 +08:00
position: absolute;
right: 0;
2020-02-24 16:25:02 +08:00
width: 36px;
2020-01-08 16:22:04 +08:00
top: 0;
bottom: 0;
2020-02-24 16:25:02 +08:00
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;
}
2020-01-08 16:22:04 +08:00
&:hover {
2020-02-24 16:25:02 +08:00
background-color: map-get($--data-table-header-cell-background-color, 'hover');
2020-01-08 16:22:04 +08:00
}
@include b(icon) {
2020-02-24 16:25:02 +08:00
@include once {
2020-03-01 15:16:30 +08:00
font-size: 12px;
2020-02-24 16:25:02 +08:00
}
fill: map-get($--data-table-button-color, 'default');
stroke: map-get($--data-table-button-color, 'default');
}
}
2020-01-08 16:22:04 +08:00
@include m(popover-visible) {
@include e(icon-wrapper) {
2020-02-24 16:25:02 +08:00
background-color: map-get($--data-table-header-cell-background-color, 'hover');
}
}
2020-01-08 16:22:04 +08:00
@include m(active) {
@include e(icon-wrapper) {
2020-02-24 16:25:02 +08:00
background-color: map-get($--data-table-header-cell-background-color, 'hover');
2020-01-08 16:22:04 +08:00
@include b(icon) {
2020-02-24 16:25:02 +08:00
fill: map-get($--data-table-button-color, 'active');
stroke: map-get($--data-table-button-color, 'active');
}
}
}
}
}
}
}
2020-03-01 15:16:30 +08:00
}
@include b(data-table-filter-menu) {
@include e(group) {
display: flex;
flex-direction: column;
padding: 12px 12px 0 12px;
@include b(checkbox) {
margin-bottom: 12px;
}
@include b(radio) {
margin-bottom: 12px;
}
}
@include b(divider) {
margin: 0;
}
@include e(action) {
padding: 8px 12px;
display: flex;
flex-wrap: no-wrap;
justify-content: space-evenly;
@include b(button) {
&:not(:last-child) {
margin-right: 8px;
}
}
}
}