All files / src/components/u-table.vue index.vue

100% Statements 19/19
50% Branches 3/6
100% Functions 3/3
100% Lines 18/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179      7x     7x             7x           7x 7x 1584x 1584x     1584x   7x 7x 7x 7x 7x 7x 295x 295x   295x     7x                                                                                                                                                                                                                                                                                      
<template>
<table :class="$style.root">
    <slot></slot>
</table>
</template>
 
<script>
export default {
    name: 'u-table',
};
</script>
 
<style module>
.root {
    width: 100%;
    table-layout: fixed;
    /* background: var(--table-view-background); */
}
 
.root th {
    position: relative;
    line-height: var(--table-view-th-line-height);
    padding: var(--table-view-th-padding);
    /* background: var(--table-view-th-background); */
 
    background-color: var(--table-view-th-background-color);
    background-image: var(--table-view-th-background-image);
    background-size: var(--table-view-th-background-size);
    background-repeat: var(--table-view-th-background-repeat);
    background-position: var(--table-view-th-background-position);
}
 
.root td {
    position: relative;E
    line-height: var(--table-view-td-line-height);
    color: var(--table-view-td-color);
    padding: var(--table-view-td-padding);
    /* background: var(--table-view-td-background); */
 
    background-color: var(--table-view-td-background-color);
    background-image: var(--table-view-td-background-image);
    background-size: var(--table-view-td-background-size);
    background-repeat: var(--table-view-td-background-repeat);
    background-position: var(--table-view-td-background-position);
}
 
.root td[vusion-slot-name="empty"] {
    color: #999;
}
 
.root thead tr {
    background-color: var(--table-view-head-background);
    background-clip: padding-box;
}
.root[color="light"] thead tr {
    background-color: var(--table-view-head-background-light);
}
.root thead tr th {
    border-bottom: 1px solid var(--table-view-border-color);
}
 
.root thead th {
    text-align: var(--table-view-th-text-align);
    color: var(--table-head-color);
    font-weight: var(--table-head-font-weight);
}
 
.root tbody td {
    border-bottom: 1px solid var(--table-view-border-color);
}
 
/* .root tbody > tr:hover > td::before {
    content: '';
    width: 100%;
    height: 6px;
    position: absolute;
    top: -6px;
    left: 0;
    background: url("../../assets/images/shadow-up.png") repeat-x;
    z-index: 100;
    display: var(--table-hover-border-shadow-display);
}
 
.root tbody > tr:hover > td::after {
    content: '';
    width: 100%;
    height: 6px;
    position: absolute;
    bottom: -6px;
    left: 0;
    background: url("../../assets/images/shadow-down.png") repeat-x;
    z-index: 100;
    display: var(--table-hover-border-shadow-display);
} */
 
.root tbody > tr:hover{
    background-color: var(--table-view-row-hover-background);
}
.root tbody > tr:hover td {
    background-color: var(--table-view-row-hover-background);
}
 
/* .root tbody > tr:first-child:hover > td::before {
    display: none;
}
 
.root tbody > tr:last-child:hover > td::after {
    display: none;
} */
/** 固定列position: sticky,th,td的border没有效果,所以改成box-shadow */
.root[line] th {
    box-shadow: inset 0 1px 0 var(--table-view-border-color), inset 0 -1px 0 var(--table-view-border-color), inset 1px 0 0 var(--table-view-border-color);
}
.root[line] th:last-child {
    /**上、右、下、左 */
    box-shadow: inset 0 1px 0 var(--table-view-border-color), inset -1px 0 0 var(--table-view-border-color), inset 0 -1px 0 var(--table-view-border-color), inset 1px 0 0 var(--table-view-border-color);
}
.root[line] td {
    box-shadow: inset 1px 0 0 var(--table-view-border-color);
}
.root[line] td:last-child {
    box-shadow: inset 1px 0 0 var(--table-view-border-color), inset -1px 0 0 var(--table-view-border-color);
}
.root[line] th, .root[line] thead tr {
    border-bottom: none;
}
 
/* 下一个大版本放开 */
.root[striped] thead tr {
    border-top: 1px solid var(--table-view-border-color);
}
 
.root[striped] tbody tr:nth-of-type(even) {
    background: var(--table-row-background-striped);
}
.root[striped] tbody tr:nth-of-type(even) td{
    background: var(--table-row-background-striped);
}
 
.root tbody > tr[color="light"] {
    background: var(--table-row-background-light);
}
.root tbody > tr[color="light"] td{
    background: var(--table-row-background-light);
}
 
.root tbody > tr[color="normal"] {
    background: var(--table-row-background);
}
.root tbody > tr[color="normal"] td{
    background: var(--table-row-background);
}
 
.root tbody > tr[color="dark"] {
    background: var(--table-row-background-dark);
}
.root tbody > tr[color="dark"] td{
    background: var(--table-row-background-dark);
}
 
.root tbody > tr[color="primary"] {
    background: var(--table-row-background-primary);
}
.root tbody > tr[color="primary"] td{
    background: var(--table-row-background-primary);
}
 
.root tbody > tr[color="error"] {
    background: var(--table-row-background-error);
}
.root tbody > tr[color="error"] td{
    background: var(--table-row-background-error);
}
.root[sticky-fixed="true"] {
    border-collapse: separate;
    border-spacing: 0;
}
</style>