@import 'mixins/overwrite';
$table-filter-option-height: 32px;
@include b(table) {
--#{$rd-prefix}table-padding-size: 16px;
--#{$rd-prefix}table-border-color: var(--#{$rd-prefix}color-divider);
position: relative;
width: 100%;
table {
width: 100%;
table-layout: auto;
border-spacing: 0;
border-collapse: separate;
table {
margin-bottom: -1px;
}
}
caption {
margin-bottom: 10px;
font-size: 1.1em;
font-weight: $rd-font-weight-bold;
}
th {
padding: var(--#{$rd-prefix}table-padding-size);
font-weight: $rd-font-weight-bold;
background-color: var(--#{$rd-prefix}background-color-light-gray);
}
td {
padding: var(--#{$rd-prefix}table-padding-size);
background-color: var(--#{$rd-prefix}background-color);
border-bottom: 1px solid var(--#{$rd-prefix}table-border-color);
}
thead {
th {
border-bottom: 1px solid var(--#{$rd-prefix}color-border);
&:not(:last-child)::after {
position: absolute;
top: 50%;
right: 0;
width: 1px;
height: 1.6em;
content: '';
background-color: var(--#{$rd-prefix}color-border);
transform: translateY(-50%);
}
}
}
tbody {
th {
border-bottom: 1px solid var(--#{$rd-prefix}table-border-color);
}
}
@include m(border) {
--#{$rd-prefix}table-border-color: var(--#{$rd-prefix}color-border);
table {
border-top: 1px solid var(--#{$rd-prefix}table-border-color);
border-left: 1px solid var(--#{$rd-prefix}table-border-color);
}
thead {
th:not(:last-child)::after {
content: none;
}
}
th {
border-right: 1px solid var(--#{$rd-prefix}table-border-color);
}
td {
border-right: 1px solid var(--#{$rd-prefix}table-border-color);
}
}
@include e(cell) {
position: relative;
@include m(fixed-left) {
&::before {
position: absolute;
top: 0;
right: 0;
bottom: -1px;
width: 30px;
pointer-events: none;
content: '';
transition: box-shadow var(--#{$rd-prefix}animation-duration-base) linear;
transform: translateX(100%);
}
&.#{$rd-prefix}table__cell--fixed-shadow {
$selector: &;
&::before {
box-shadow: inset 8px 0 12px -10px var(--#{$rd-prefix}shadow-color);
}
@at-root {
th#{$selector} {
&::after {
content: none !important;
}
}
}
}
}
@include m(fixed-right) {
&::before {
position: absolute;
top: 0;
bottom: -1px;
left: 0;
width: 30px;
pointer-events: none;
content: '';
transition: box-shadow var(--#{$rd-prefix}animation-duration-base) linear;
transform: translateX(-100%);
}
&.#{$rd-prefix}table__cell--fixed-shadow {
&::before {
box-shadow: inset -8px 0 12px -10px var(--#{$rd-prefix}shadow-color);
}
}
}
@include m(right) {
@include e(cell-content) {
justify-content: flex-end !important;
}
@include e(cell-text) {
text-align: right;
}
}
@include m(center) {
@include e(cell-content) {
justify-content: center !important;
}
@include e(cell-text) {
text-align: center;
}
}
@include m(ellipsis) {
@include e(cell-text) {
@include utils-ellipsis;
overflow-wrap: unset;
}
}
@include m(nowrap) {
white-space: nowrap;
}
@include m(th-sort) {
cursor: pointer;
}
@include m(th-empty) {
&::after {
content: none !important;
}
}
}
@include e(cell-content) {
$selector: &;
display: flex;
align-items: center;
@at-root {
th #{$selector} {
justify-content: space-between;
}
}
}
@include e(cell-text) {
overflow-wrap: break-word;
}
@include e(th-actions) {
display: inline-flex;
margin-left: 4px;
}
@include e(th-action) {
@include utils-button;
min-width: 20px;
min-height: 20px;
padding: 0;
margin: 0;
color: rgb(var(--#{$rd-prefix}text-color-rgb) / 28%);
background-color: transparent;
border: none;
transition: color var(--#{$rd-prefix}animation-duration-base) linear;
&:hover,
&:focus {
color: rgb(var(--#{$rd-prefix}text-color-rgb) / 42%);
}
&:active {
color: rgb(var(--#{$rd-prefix}text-color-rgb) / 42%);
}
@include when(active) {
color: var(--#{$rd-prefix}color-primary);
}
@include m(sort) {
flex-direction: column;
min-width: 16px;
}
}
@include e(th-sort-icon) {
@include overwrite-component(icon) {
font-size: 12px;
}
@include when(active) {
color: var(--#{$rd-prefix}color-primary);
}
}
@include e(expand) {
@include utils-button;
position: relative;
width: 17px;
height: 17px;
padding: 0;
margin: 0;
color: var(--#{$rd-prefix}text-color);
background-color: transparent;
border: 1px solid var(--#{$rd-prefix}color-border);
border-radius: var(--#{$rd-prefix}border-radius);
transition: border-color var(--#{$rd-prefix}animation-duration-base) linear;
&:hover,
&:focus {
border-color: var(--#{$rd-prefix}color-primary-lighter);
}
&:active {
border-color: var(--#{$rd-prefix}color-primary-darker);
}
&::before {
position: absolute;
top: 7px;
right: 3px;
left: 3px;
height: 1px;
content: '';
background-color: currentcolor;
transition: transform var(--#{$rd-prefix}animation-duration-base) linear;
}
&::after {
position: absolute;
top: 3px;
bottom: 3px;
left: 7px;
width: 1px;
content: '';
background-color: currentcolor;
transition: transform var(--#{$rd-prefix}animation-duration-base) linear;
}
@include when(expand) {
&::before {
transform: rotate(180deg);
}
&::after {
transform: rotate(90deg);
}
}
}
@include e(empty-content) {
display: flex;
align-items: center;
justify-content: center;
min-height: 160px;
}
@include e(filter-popup) {
.#{$rd-prefix}popover__body {
padding: 0;
}
.#{$rd-prefix}popover__footer {
justify-content: space-between;
padding: 10px 12px;
border-top: 1px solid var(--#{$rd-prefix}color-divider);
}
}
@include e(filter-search) {
@include overwrite-component(input) {
--#{$rd-prefix}size: 30px;
--#{$rd-prefix}horizontal-space-size: 8px;
display: flex;
margin: 10px 12px;
}
}
@include e(filter-list) {
position: relative;
min-width: 140px;
max-height: 200px;
padding: 4px 0;
margin: 0;
overflow: hidden auto;
list-style: none;
}
@include e(filter-option) {
@include polyfill-column-gap(8px);
position: relative;
display: flex;
align-items: center;
width: 100%;
height: $table-filter-option-height;
padding: 0 12px;
cursor: pointer;
transition: background-color var(--#{$rd-prefix}animation-duration-base) linear;
&:hover {
background-color: var(--#{$rd-prefix}background-color-hover);
}
@include when(disabled) {
color: var(--#{$rd-prefix}color-disabled);
pointer-events: none;
}
}
@include e(filter-empty) {
display: flex;
align-items: center;
height: $table-filter-option-height;
padding: 0 12px;
color: var(--#{$rd-prefix}color-disabled);
}
@include e(loading) {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 5;
display: flex;
align-items: center;
justify-content: center;
padding: 0 12px;
color: var(--#{$rd-prefix}color-primary);
background-color: rgb(var(--#{$rd-prefix}background-color-rgb) / 80%);
@include m(empty) {
justify-content: flex-start;
background-color: var(--#{$rd-prefix}background-color);
}
}
}