table-v2.scss 4.2 KB

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