ajax-table
Version:
Handles a table loading with AJAX
274 lines (236 loc) • 6.63 kB
text/less
@border: #ddd;
@header: #BBB;
@ajaxTable: {
@-webkit-keyframes ajax-table-loader {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
@keyframes ajax-table-loader {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
.ajax-table-processed{
width: 100%;
border-collapse: separate;
border: 1px solid @border;
border-spacing: 0;
font-family: sans-serif;
thead{
tr{
th{
position: relative;
border: 1px solid @border;
border-top: none;
padding: 8px;
padding-right: 30px;
cursor: pointer;
background: @header;
font-weight: bold;
vertical-align: middle;
&:after{
position: absolute;
right: 11px;
top: 50%;
transform: translateY(-50%);
content: '\2193';
opacity: 0.5;
}
&.sorted{
&:after{
opacity: 1;
}
&.inverted{
&:after{
content: '\2191';
}
}
}
}
}
}
tfoot{
display: table-header-group;
tr{
td{
border: 1px solid @border;
padding: 8px;
background: @header;
input{
width: 100%;
padding: 3px;
box-sizing: border-box;
font-weight: bold;
&::placeholder{
color: red;
font-size: 11px;
}
}
}
}
}
tbody{
tr{
&:last-of-type{
td{
border-bottom: none;
}
}
td{
border-left: 1px solid @border;
border-bottom: 1px solid @border;
padding: 8px;
&:first-of-type{
border-left: none;
}
&.empty{
text-align: center;
}
}
}
}
}
.ajax-table-utilities{
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-display: flex;
-moz-display: flex;
-ms-display: flex;
-o-display: flex;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
margin-top: 10px;
//PAGINATION
.ajax-table-pagination,.ajax-table-buttons{
position: relative;
display: inline-block;
min-width: -moz-fit-content;
min-width: fit-content;
margin: 5px;
ul{
position: relative;
top: 50%;
transform: translateY(-50%);
list-style-type: none;
padding-left: 0;
margin: 0;
-webkit-display: inline-flex;
-moz-display: inline-flex;
-ms-display: inline-flex;
-o-display: inline-flex;
display: inline-flex;
li{
display: inline-block;
border: 1px solid @border;
border-right: none;
height: 28px;
width: 28px;
text-align: center;
line-height: 28px;
cursor: not-allowed;
background: #fff;
min-width: fit-content;
min-width: -moz-fit-content;
padding: 0 5px;
&:first-of-type{
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}
&:last-of-type{
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
border-right: 1px solid @border;
}
&.pagination-page,&.pagination-prev:not(.disabled),&.pagination-next:not(.disabled),&.export{
cursor: pointer;
}
&.active{
background: fade(grey,40%);
}
&.disabled{
color: grey;
}
}
}
}
.ajax-table-pagination{
text-align: right;
}
.ajax-table-buttons-loader>div,.ajax-table-buttons-loader>div:before,.ajax-table-buttons-loader>div:after{
background: grey;
-webkit-animation: ajax-table-loader 1s infinite ease-in-out;
animation: ajax-table-loader 1s infinite ease-in-out;
width: 1em;
height: 30px;
}
.ajax-table-buttons-loader{
&>div{
position: relative;
top: 50%;
transform: translateY(-50%);
color: grey;
text-indent: -9999em;
position: relative;
font-size: 4px;
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
margin-left: 12px;
&:before,&:after{
position: absolute;
top: 0;
content: '';
}
&:before{
left: -1.5em;
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
&:after{
left: 1.5em;
}
}
&.loaded{
display: none;
}
}
.ajax-table-buttons{
display: none;
width: 130px;
&.available{
display: inline-block;
}
}
.ajax-table-count{
display: inline-block;
&>div{
position: relative;
top: 50%;
transform: translateY(-50%);
}
}
}
};
body{
@ajaxTable();
}
@media print {
@ajaxTable();
}