_table.scss 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. .vb-table {
  2. --table-footer-height: 50px;
  3. --table-radius: var(--bs-card-inner-border-radius);
  4. --table-bg: var(--bs-app-header-minimize-bg-color);
  5. width: 100%;
  6. position: relative;
  7. background-color: var(--table-bg);
  8. border-radius: var(--table-radius);
  9. display: flex;
  10. flex-direction: column;
  11. justify-content: flex-start;
  12. align-items: center;
  13. overflow-y: auto;
  14. overflow-x: hidden;
  15. .table-tool {
  16. width: 100%;
  17. padding: 0 20px;
  18. border-radius: var(--table-radius) var(--table-radius) 0 0;
  19. }
  20. .table-responsive {
  21. width: 100%;
  22. }
  23. .table-box {
  24. position: relative;
  25. width: 100%;
  26. min-height: 90px;
  27. > div {
  28. overflow-y: auto;
  29. height: 100%;
  30. }
  31. .fixed-columns,
  32. .fixed-columns-right {
  33. position: absolute;
  34. top: 0;
  35. height: calc(100% - 10px);
  36. box-sizing: border-box;
  37. background-color: var(--table-bg);
  38. z-index: 2;
  39. overflow: hidden !important;
  40. // 使用 will-change 提示浏览器优化性能
  41. will-change: transform;
  42. // 启用硬件加速
  43. transform: translateZ(0);
  44. &.no-shadow {
  45. box-shadow: none;
  46. }
  47. // 确保内部内容可以正确应用transform
  48. > div {
  49. will-change: transform;
  50. transform: translateZ(0);
  51. }
  52. }
  53. .fixed-columns {
  54. left: 0;
  55. box-shadow: 20px -2px 10px -13px #ddd;
  56. }
  57. .fixed-columns-right {
  58. right: 0;
  59. box-shadow: -20px -2px 10px -13px #ddd;
  60. }
  61. &.radius {
  62. border-radius: var(--table-radius) var(--table-radius) 0 0;
  63. .fixed-columns,
  64. .table-responsive,
  65. .fixed-columns-right {
  66. border-radius: var(--table-radius) var(--table-radius) 0 0;
  67. }
  68. }
  69. table {
  70. table-layout: fixed;
  71. border-collapse: collapse;
  72. width: 100%;
  73. --h: 37px;
  74. thead {
  75. vertical-align: middle;
  76. table-layout: fixed;
  77. &.fixed {
  78. position: sticky;
  79. top: 0px;
  80. z-index: 10;
  81. tr {
  82. &:first-child {
  83. border-top: none !important;
  84. }
  85. }
  86. }
  87. tr {
  88. th {
  89. height: calc(var(--h) + 8px);
  90. line-height: calc(var(--h) + 8px);
  91. padding-top: 0px;
  92. padding-bottom: 0px;
  93. background-color: #fff;
  94. font-size: 110%;
  95. vertical-align: middle;
  96. // background-image: linear-gradient(rgba(0,0,0,.02),rgba(0,0,0,.02));
  97. }
  98. }
  99. }
  100. tbody {
  101. overflow-y: auto;
  102. tr {
  103. &:nth-child(even) {
  104. background-color: var(--vb-tr-even-bg-color);
  105. }
  106. td {
  107. padding-top: 0px;
  108. padding-bottom: 0px;
  109. height: var(--h);
  110. line-height: var(--h);
  111. .table-action {
  112. padding: 2px 4px;
  113. margin: 0 4px;
  114. color: var(--bs-text-primary);
  115. cursor: pointer;
  116. &:hover {
  117. border-bottom: 2px solid;
  118. }
  119. }
  120. }
  121. }
  122. }
  123. }
  124. }
  125. .table-footer {
  126. width: 100%;
  127. height: var(--table-footer-height);
  128. align-items: center;
  129. border-radius: 0 0 var(--table-radius) var(--table-radius);
  130. }
  131. tr.text-center {
  132. th,
  133. td {
  134. text-align: center;
  135. }
  136. }
  137. // &.pagination{
  138. // .fixed-columns, .fixed-columns-right{
  139. // height:calc(100% - var(--table-footer-height) - 10px);
  140. // }
  141. // }
  142. }
  143. .vb-table.vb-tree-table {
  144. tr {
  145. &.hide {
  146. display: none;
  147. animation: hideTr 0.5s linear;
  148. }
  149. &.show {
  150. animation: showTr 0.5s linear;
  151. }
  152. .tree-icon {
  153. .icon {
  154. cursor: pointer;
  155. }
  156. }
  157. }
  158. }
  159. @keyframes showTr {
  160. 0% {
  161. display: none;
  162. opacity: 0;
  163. }
  164. 100% {
  165. opacity: 1;
  166. display: table-row;
  167. }
  168. }
  169. @keyframes hideTr {
  170. 0% {
  171. opacity: 1;
  172. display: table-row;
  173. }
  174. 100% {
  175. display: none;
  176. opacity: 0;
  177. }
  178. }