table-v2.scss 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. @use 'mixins/mixins' as *;
  2. @use 'mixins/var' as *;
  3. @use 'common/var' as *;
  4. @mixin center-flex() {
  5. display: flex;
  6. align-items: center;
  7. }
  8. @mixin cell-padding() {
  9. padding: 0 8px;
  10. }
  11. @mixin safe-padding() {
  12. padding-inline-end: getCssVar('table-scrollbar-size');
  13. }
  14. @mixin cell-alignment() {
  15. @include when('align-center') {
  16. justify-content: center;
  17. text-align: center;
  18. }
  19. @include when('align-right') {
  20. justify-content: flex-end;
  21. text-align: right;
  22. }
  23. }
  24. @mixin table-root() {
  25. display: flex;
  26. flex-direction: column-reverse;
  27. position: absolute;
  28. overflow: hidden;
  29. top: 0;
  30. background-color: getCssVar('bg', 'color');
  31. }
  32. @mixin hidden-scrollbar {
  33. .#{$namespace}-virtual-scrollbar {
  34. opacity: 0;
  35. }
  36. .#{$namespace}-vl__vertical,
  37. .#{$namespace}-vl__horizontal {
  38. z-index: -1;
  39. }
  40. }
  41. @include b('table-v2') {
  42. @include set-component-css-var('table', $table);
  43. }
  44. @include b('table-v2') {
  45. font-size: getCssVar('font-size', 'base');
  46. * {
  47. box-sizing: border-box;
  48. }
  49. @include e('root') {
  50. position: relative;
  51. // for showing the scrollbar when mouse is on the root table
  52. &:hover {
  53. @include e('main') {
  54. .#{$namespace}-virtual-scrollbar {
  55. opacity: 1;
  56. }
  57. }
  58. }
  59. }
  60. @include e('main') {
  61. @include table-root;
  62. left: 0;
  63. .#{$namespace}-vl__horizontal,
  64. .#{$namespace}-vl__vertical {
  65. z-index: 2;
  66. }
  67. }
  68. @include e('left') {
  69. @include table-root;
  70. left: 0;
  71. box-shadow: 2px 0 4px 0 rgb(0 0 0 / 6%);
  72. @include hidden-scrollbar;
  73. }
  74. @include e('right') {
  75. @include table-root;
  76. right: 0;
  77. box-shadow: -2px 0 4px 0 rgb(0 0 0 / 6%);
  78. @include hidden-scrollbar;
  79. @include e('header-row') {
  80. @include safe-padding;
  81. }
  82. @include e('row') {
  83. @include safe-padding;
  84. }
  85. }
  86. @include e('header-wrapper') {
  87. overflow: hidden;
  88. }
  89. @include e('header') {
  90. position: relative;
  91. overflow: hidden;
  92. .#{$namespace}-checkbox {
  93. z-index: 0;
  94. }
  95. }
  96. @include e('footer') {
  97. position: absolute;
  98. left: 0;
  99. right: 0;
  100. bottom: 0;
  101. overflow: hidden;
  102. }
  103. @include e('empty') {
  104. position: absolute;
  105. left: 0;
  106. }
  107. @include e('overlay') {
  108. position: absolute;
  109. left: 0;
  110. right: 0;
  111. top: 0;
  112. bottom: 0;
  113. z-index: 9999;
  114. }
  115. @include e('header-row') {
  116. display: flex;
  117. border-bottom: getCssVar('table', 'border');
  118. @include e('header-cell') {
  119. height: 100%;
  120. user-select: none;
  121. overflow: hidden;
  122. background-color: getCssVar('table-header', 'bg-color');
  123. color: getCssVar('table-header', 'text-color');
  124. font-weight: bold;
  125. @include center-flex;
  126. @include cell-padding;
  127. @include cell-alignment;
  128. @include when(sortable) {
  129. cursor: pointer;
  130. }
  131. &:hover {
  132. .#{$namespace}-icon {
  133. display: block;
  134. }
  135. }
  136. }
  137. @include e('sort-icon') {
  138. @include reset-button();
  139. transition:
  140. opacity,
  141. display getCssVar('transition-duration', '');
  142. opacity: 0.6;
  143. display: none;
  144. @include when(sorting) {
  145. display: flex;
  146. opacity: 1;
  147. }
  148. }
  149. }
  150. @include e('row') {
  151. border-bottom: getCssVar('table', 'border');
  152. @include center-flex;
  153. transition: background-color getCssVar('transition-duration', '');
  154. @include when('hovered') {
  155. background-color: getCssVar('table-row', 'hover-bg-color');
  156. }
  157. &:hover {
  158. background-color: getCssVar('table-row', 'hover-bg-color');
  159. }
  160. @include e('row-cell') {
  161. height: 100%;
  162. overflow: hidden;
  163. @include center-flex;
  164. @include cell-padding;
  165. @include cell-alignment;
  166. }
  167. @include e('expand-icon') {
  168. @include reset-button();
  169. margin: 0 4px;
  170. user-select: none;
  171. svg {
  172. transition: transform getCssVar('transition-duration', '');
  173. }
  174. @include when(expanded) {
  175. svg {
  176. transform: rotate(90deg);
  177. }
  178. }
  179. }
  180. }
  181. &:not(.is-dynamic) {
  182. @include e('cell-text') {
  183. overflow: hidden;
  184. text-overflow: ellipsis;
  185. white-space: nowrap;
  186. }
  187. }
  188. @include when(dynamic) {
  189. @include e('row') {
  190. overflow: hidden;
  191. align-items: stretch;
  192. @include e('row-cell') {
  193. overflow-wrap: break-word;
  194. }
  195. }
  196. }
  197. }