metro4
Version:
The front-end framework for Build responsive, mobile-first projects on the web with the first front-end component library in Metro Style
400 lines (346 loc) • 8.37 kB
text/less
@import (once) "include/vars";
@import (once) "include/mixins";
.table-container {
display: block;
position: relative;
&.horizontal-scroll {
overflow: hidden;
overflow-x: auto;
.table {
width: auto;
min-width: 100%;
}
}
}
.table {display: table;}
.thead {display: table-header-group}
.tfoot {display: table-footer-group}
.tbody {display: table-row-group}
.tr {display: table-row}
.th, .td {display: table-cell}
.table {
width: 100%;
margin-bottom: 1rem;
th, .th, td, .td {
padding: 0.625rem;
}
&.fixed-layout {
table-layout: fixed;
th, .th, td, .td {
white-space: nowrap;
overflow: hidden;
}
}
thead, tfoot, .thead, .tfoot {
border-bottom: 4px solid @lightGray;
th, td, .th, .td {
cursor: default;
color: @dark;
border-color: transparent;
text-align: left;
font-weight: bold;
line-height: 1.2;
}
}
tfoot, .tfoot {
border-top: 4px solid @lightGray;
}
tbody, .tbody {
td, .td {
padding: 0.625rem;
vertical-align: middle;
}
}
.sortable-column, .sorting {
position: relative;
cursor: pointer;
&:after {
position: absolute;
content: "\21C5";
width: 1rem;
height: 1rem;
left: 100%;
.px2rem(margin-left, -20px);
top: 50%;
margin-top: -.3rem;
color: inherit;
font-size: .8em;
font-weight: 100;
line-height: 1;
opacity: .7;
}
&.sort-asc, &.sort-desc, &.sorting_asc, &.sorting_desc {
background-color: darken(@light, 5%);
&:after {
color: @dark;
opacity: 1;
font-weight: 700;
font-size: 1em;
margin-top: -.5rem;
}
}
&.sort-asc, &.sorting_asc {
&:after {
content: "\2191";
}
}
&.sort-desc, &.sorting_desc {
&:after {
content: "\2193";
}
}
}
&.sortable-markers-on-left {
.sortable-column, .sorting {
.px2rem(padding-left, 30px);
&:before, &:after {
left: 0;
.px2rem(margin-left, 10px);
}
}
}
tr.selected, .tr.selected {
td, .td {background-color: rgba(28, 183, 236, 0.10);}
}
td.selected, .td.selected {
background-color: rgba(28, 183, 236, 0.30);
}
&.striped {
tbody tr:nth-child(odd),
.tbody .tr:nth-child(odd) {
background: @light;
}
}
&.row-hover {
tbody, .tbody {
tr, .tr {
&:hover {
background-color: rgba(28, 183, 236, 0.10);
}
}
}
}
&.cell-hover {
tbody, .tbody {
td, .td {
&:hover {
background-color: rgba(28, 183, 236, 0.30);
}
}
}
}
&.table-border {
border: 1px @borderColor solid;
}
&.cell-border {
th, td, .th, .td {
border: 1px @borderColor solid;
}
thead, .thead {
tr:first-child, .tr:first-child {
th, td, .th, .td {
border-top: none;
&:first-child {
border-left: none;
}
&:last-child {
border-right: none;
}
}
}
}
tbody, .tbody {
tr, .tr {
&:first-child {
td, .td {
border-top: none;
}
}
td, .td {
&:first-child {
border-left: none;
}
&:last-child {
border-right: none;
}
}
&:last-child {
td, .td {
border-bottom: none;
}
}
}
}
}
&.row-border {
tr + tr, .tr + .tr {
border-top: 1px @borderColor solid;
}
}
&.subcompact {
th, td, .th, .td {
padding: 3px 8px;
font-size: 80%;
}
}
&.compact {
th, td, .th, .td {
padding: 7px 8px;
font-size: 80%;
}
}
.check-cell, .rownum-cell {
width: 36px;
text-align: center;
}
thead, tbody, .thead, .tbody {
td, th, .th, .td {
&.hidden {
display: none ;
}
}
}
.cell-wrapper {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.checkbox, .radio, .switch {
height: initial;
}
}
.table-component {
display: block;
position: relative;
}
.table-bottom {
margin-left: 0;
margin-right: 0;
}
.table-info, .table-pagination {
flex-basis: auto;
}
.table-progress {
width: 64px;
height: 64px;
position: absolute;
top: 200px;
left: 50%;
.translateX(-50%);
display: none;
z-index: 2;
[class*=activity-] {
margin: 0 auto;
}
}
.table-inspector {
display: none;
position: absolute;
top: 0;
left: 0;
//.translateX(-50%);
background-color: @white;
color: @dark;
z-index: @zindex-absolute;
border: 1px double @borderColor;
width: auto;
padding: 10px;
max-height: ~"calc(100vh - 40px)";
.win-shadow();
.table-inspector-header {
display: block;
position: relative;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 0 .5rem .5rem;
border-bottom: 1px solid @borderColor;
font-size: 24px;
font-weight: 100;
margin-bottom: .5rem;
}
.table-wrap {
display: block;
height: ~"calc(100% - 110px)";
overflow-x: hidden;
overflow-y: auto;
}
.table-inspector-actions {
display: block;
position: relative;
border-top: 1px solid @borderColor;
padding: .5rem .5rem 0;
margin-top: .5rem;
}
table, .table {
margin-bottom: 0;
td, .td {
vertical-align: middle;
}
tr.flash, .tr.flash {
animation: flash-bg 1s ease-out;
animation-iteration-count: 1;
}
}
.spinner {
width: 120px;
input {
font-size: 14px;
}
}
&.open {
display: block;
}
}
.table-form {
display: block;
position: absolute;
z-index: @zindex-absolute;
height: auto;
max-height: ~"calc(100vh - 40px)";
width: auto;
max-width: ~"calc(100vw - 40px)";
top: 50%;
left: 50%;
.translate3d(-50%, -50%);
border: 1px solid @borderColor;
.win-shadow();
}
@keyframes flash-bg {
0% {
background-color: @white;
}
30% {
background-color: @gray;
}
100% {
background-color: @white;
}
}
.generate-table-media-options(@mediaBreakpointListMobileLength);
.generate-table-media-options(@name, @i: 1) when (@i <= @mediaBreakpointListMobileLength) {
@m: extract(@mediaBreakpointListMobile, @i);
@media screen and (min-width: @@m) {
.table {
&.normal-@{m} {
th, td, .th, .td {
padding: 0.625rem;
font-size: 1em;
}
}
&.compact-@{m} {
th, td, .th, .td {
padding: 7px 8px;
font-size: 80%;
}
}
&.subcompact-@{m} {
th, td, .th, .td {
padding: 3px 8px;
font-size: 80%;
}
}
}
}
.generate-table-media-options(@name, @i + 1);
}