Files
smart-table/lib/index.scss
2020-02-12 11:18:28 +08:00

305 lines
5.8 KiB
SCSS

.smart-table {
position: relative;
overflow: hidden;
box-sizing: border-box;
width: 100%;
max-width: 100%;
background-color: #fff;
color: #6A6B6F;
border: 1px solid #ECF0F5;
border-right: none;
border-bottom: none;
&:after,
&:before {
content: "";
position: absolute;
background-color: #ECF0F5;
z-index: 1;
}
&:before {
left: 0;
bottom: 0;
width: 100%;
height: 1px;
}
&:after {
top: 0;
right: 0;
width: 1px;
height: 100%;
}
table {
border-spacing: 0;
border: 0;
}
thead {
background: #F5F7FB;
font-size: 13px;
}
tr {
transition: background-color .25s ease;
}
tbody {
font-size: 12px;
tr[expand] {
td:first-child {
cursor: pointer;
:before {
transition: 0.35s ease transform;
transform-origin: 25% 50%;
content: '';
float: left;
width: 0;
height: 0;
border-width: 6px;
border-style: solid;
border-color: transparent transparent transparent #c0c4cc;
margin: 5px 0 0 5px;
}
}
&[expanded]>td:first-child>:before {
transform: rotate(90deg);
}
}
&.stripe {
tr:nth-child(2n) {
background-color: #F9FBFF;
}
}
}
td,
th {
padding: 5px 0;
text-overflow: ellipsis;
vertical-align: middle;
position: relative;
border-bottom: 1px solid #ECF0F5;
border-right: 1px solid #ECF0F5;
text-align: center;
&.is-hidden>* {
visibility: hidden;
}
}
th {
user-select: none;
overflow: hidden;
&[sort] {
cursor: pointer;
:before,
:after {
content: '';
float: right;
width: 0;
height: 0;
border-width: 5px;
border-style: solid;
}
:before {
margin: 1px 0 0 -10px;
border-color: transparent transparent #c0c4cc transparent;
}
:after {
margin: 12px 0 0 4px;
border-color: #c0c4cc transparent transparent transparent;
}
&.desc {
:after {
border-top-color: #409eff;
}
}
&.asc {
:before {
border-bottom-color: #409eff;
}
}
}
}
&.stb-cust-large {
thead {
font-size: 16px;
}
tbody {
font-size: 15px;
}
td,
th {
padding: 12px 0;
}
}
&.stb-cust-middle {
thead {
font-size: 15px;
}
tbody {
font-size: 14px;
}
td,
th {
padding: 10px 0;
}
}
&.stb-cust-left {
td,
th {
text-align: left;
}
}
&.stb-cust-right {
td,
th {
text-align: right;
}
}
th[align="left"],
td[align="left"] {
text-align: left;
}
th[align="center"],
td[align="center"] {
text-align: center;
}
th[align="right"],
td[align="right"] {
text-align: right;
}
th[nowrap],
td[nowrap] {
.stb_cell {
white-space: nowrap;
}
}
.std-checkbox_inner {
display: inline-block;
position: relative;
border: 1px solid #dcdfe6;
border-radius: 2px;
box-sizing: border-box;
width: 14px;
height: 14px;
background-color: #fff;
z-index: 1;
transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46);
&:after {
box-sizing: content-box;
content: "";
border: 1px solid #fff;
border-left: 0;
border-top: 0;
height: 7px;
left: 4px;
position: absolute;
top: 1px;
transform: rotate(45deg) scaleY(0);
width: 3px;
transition: transform .15s ease-in .05s;
transform-origin: center;
}
}
.std-checkbox_input {
white-space: nowrap;
cursor: pointer;
outline: none;
display: inline-block;
line-height: 1;
position: relative;
vertical-align: middle;
}
.std-checkbox {
color: #606266;
font-weight: 500;
font-size: 14px;
position: relative;
cursor: pointer;
display: inline-block;
white-space: nowrap;
user-select: none;
&[checked]>.std-checkbox_input>.std-checkbox_inner {
background-color: #409eff;
border-color: #409eff;
&:after {
transform: rotate(45deg) scaleY(1);
}
}
}
.stb_cell {
overflow: hidden;
text-overflow: ellipsis;
white-space: normal;
word-break: break-all;
padding: 0 4px;
line-height: 23px;
}
th>.stb_cell {
display: inline-block;
position: relative;
vertical-align: middle;
}
.stb_body,
.stb_footer,
.stb_header {
table-layout: fixed;
border-collapse: separate;
background: #fff;
}
.stb_header-wrapper {
overflow: hidden;
}
.stb_body-wrapper {
overflow: auto;
}
.stb_fixed,
.stb_fixed-right {
position: absolute;
top: 0;
left: 0;
overflow-x: hidden;
overflow-y: hidden;
box-shadow: 0 -1px 8px rgba(0, 0, 0, .08);
}
.stb_fixed-right {
top: 0;
left: auto;
right: 0;
box-shadow: -1px 0 8px rgba(0, 0, 0, .08);
.stb_fixed-body-wrapper,
.stb_fixed-footer-wrapper,
.stb_fixed-header-wrapper {
left: auto;
right: 0;
}
}
.stb_fixed-right-patch {
position: absolute;
top: -1px;
right: 0;
background-color: #F5F7FB;
}
.stb_fixed-header-wrapper {
position: absolute;
left: 0;
top: 0;
z-index: 3;
}
.stb_fixed-body-wrapper {
position: absolute;
left: 0;
top: 37px;
overflow: hidden;
z-index: 3;
}
::-webkit-scrollbar {
width: 8px;
height: 8px;
background-color: #e9edf4;
}
::-webkit-scrollbar-thumb {
background-color: #ccc;
border-radius: 2em;
}
::-webkit-scrollbar-thumb:hover {
background-color: #919191;
}
* {
box-sizing: border-box;
}
}