table-v2.scss 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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: 14px;
  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. }
  93. @include e('footer') {
  94. position: absolute;
  95. left: 0;
  96. right: 0;
  97. bottom: 0;
  98. overflow: hidden;
  99. }
  100. @include e('empty') {
  101. position: absolute;
  102. left: 0;
  103. }
  104. @include e('overlay') {
  105. position: absolute;
  106. left: 0;
  107. right: 0;
  108. top: 0;
  109. bottom: 0;
  110. z-index: 9999;
  111. }
  112. @include e('header-row') {
  113. display: flex;
  114. border-bottom: getCssVar('table', 'border');
  115. @include e('header-cell') {
  116. @include center-flex;
  117. @include cell-padding;
  118. @include cell-alignment;
  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 when(sortable) {
  126. cursor: pointer;
  127. }
  128. &:hover {
  129. .#{$namespace}-icon {
  130. display: block;
  131. }
  132. }
  133. }
  134. @include e('sort-icon') {
  135. transition: opacity, display getCssVar('transition-duration', '');
  136. opacity: 0.6;
  137. display: none;
  138. @include when(sorting) {
  139. display: block;
  140. opacity: 1;
  141. }
  142. }
  143. }
  144. @include e('row') {
  145. border-bottom: getCssVar('table', 'border');
  146. @include center-flex;
  147. transition: background-color getCssVar('transition-duration', '');
  148. @include when('hovered') {
  149. background-color: getCssVar('table-row', 'hover-bg-color');
  150. }
  151. &:hover {
  152. background-color: getCssVar('table-row', 'hover-bg-color');
  153. }
  154. @include e('row-cell') {
  155. height: 100%;
  156. overflow: hidden;
  157. @include center-flex;
  158. @include cell-padding;
  159. @include cell-alignment;
  160. }
  161. @include e('expand-icon') {
  162. margin: 0 4px;
  163. cursor: pointer;
  164. user-select: none;
  165. svg {
  166. transition: transform getCssVar('transition-duration', '');
  167. }
  168. @include when(expanded) {
  169. svg {
  170. transform: rotate(90deg);
  171. }
  172. }
  173. }
  174. }
  175. &:not(.is-dynamic) {
  176. @include e('cell-text') {
  177. overflow: hidden;
  178. text-overflow: ellipsis;
  179. white-space: nowrap;
  180. }
  181. }
  182. @include when(dynamic) {
  183. @include e('row') {
  184. overflow: hidden;
  185. align-items: stretch;
  186. @include e('row-cell') {
  187. overflow-wrap: break-word;
  188. }
  189. }
  190. }
  191. }