table.scss 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. @import './animation.scss';
  2. @import './variables.scss';
  3. @import './mixin.scss';
  4. @import './operationPanel.scss';
  5. $module: #{$prefix}-table;
  6. .#{$module} {
  7. width: 100%;
  8. text-align: left;
  9. border-collapse: separate;
  10. border-spacing: 0;
  11. font-size: inherit;
  12. display: table;
  13. &-wrapper {
  14. zoom: 1;
  15. position: relative;
  16. clear: both;
  17. box-sizing: border-box;
  18. margin: 0;
  19. padding: 0;
  20. @include font-size-regular;
  21. color: $color-table-text-default;
  22. width: 100%;
  23. &[data-column-fixed='true'] {
  24. z-index: 1;
  25. }
  26. &-ltr {
  27. direction: ltr;
  28. .#{$prefix}-spin {
  29. direction: ltr;
  30. }
  31. }
  32. }
  33. &-middle {
  34. .#{$module}-tbody > .#{$module}-row > .#{$module}-row-cell {
  35. padding-top: $spacing-table_middle-paddingY;
  36. padding-bottom: $spacing-table_middle-paddingY;
  37. }
  38. }
  39. &-small {
  40. .#{$module}-tbody > .#{$module}-row > .#{$module}-row-cell {
  41. padding-top: $spacing-table_small-paddingY;
  42. padding-bottom: $spacing-table_small-paddingY;
  43. }
  44. }
  45. &-title {
  46. position: relative;
  47. padding-top: $spacing-table_title-paddingY;
  48. padding-bottom: $spacing-table_title-paddingY;
  49. padding-left: $spacing-table_title-paddingX;
  50. padding-right: $spacing-table_title-paddingX;
  51. }
  52. &-container {
  53. position: relative;
  54. }
  55. &-header {
  56. overflow: hidden;
  57. &::-webkit-scrollbar {
  58. background-color: transparent;
  59. border-bottom: $width-table_header_border $border-table_base-borderStyle $color-table_th-border-default;
  60. }
  61. scrollbar-base-color: transparent;
  62. &-sticky {
  63. position: sticky;
  64. z-index: $z-table_fixed_column + 1;
  65. .semi-table-thead > .semi-table-row > .semi-table-row-head {
  66. background-color: $color-table-bg-default;
  67. }
  68. }
  69. }
  70. &-body {
  71. overflow: auto;
  72. width: 100%;
  73. box-sizing: border-box;
  74. }
  75. &-colgroup {
  76. display: table-column-group;
  77. .#{$module}-col {
  78. display: table-column;
  79. }
  80. .#{$module}-column {
  81. &-expand,
  82. &-selection {
  83. width: $width-table_column_selection;
  84. }
  85. }
  86. }
  87. &-thead {
  88. & > .#{$module}-row {
  89. & > .#{$module}-row-head {
  90. background-color: $color-table_th-bg-default;
  91. color: $color-table_th-text-default;
  92. font-weight: $font-weight-bold;
  93. text-align: left;
  94. border-bottom: $width-table_header_border $border-table_base-borderStyle $color-table_th-border-default;
  95. padding-left: $spacing-table_row_head-paddingX;
  96. padding-right: $spacing-table_row_head-paddingX;
  97. padding-top: $spacing-table_row_head-paddingY;
  98. padding-bottom: $spacing-table_row_head-paddingY;
  99. vertical-align: middle;
  100. word-break: break-all;
  101. word-wrap: break-word;
  102. position: relative;
  103. &.#{$module}-cell-fixed {
  104. &-left,
  105. &-right {
  106. z-index: $z-table_fixed_column;
  107. position: sticky;
  108. background-color: $color-table-bg-default;
  109. &::before {
  110. background-color: $color-table_th-bg-default;
  111. content: '';
  112. position: absolute;
  113. left: 0;
  114. top: 0;
  115. right: 0;
  116. bottom: 0;
  117. display: block;
  118. z-index: -1;
  119. }
  120. }
  121. &-left-last {
  122. border-right: $width-table_cell_fixed_left_last solid $color-table_shadow-border-default;
  123. box-shadow: #{$shadow-table_right};
  124. &.resizing {
  125. @include genResizing();
  126. }
  127. }
  128. &-right-first {
  129. border-left: $width-table_cell_fixed_right_first solid $color-table_shadow-border-default;
  130. box-shadow: #{$shadow-table_left};
  131. &.resizing {
  132. @include genResizing();
  133. }
  134. // scroll-bar 列无需有box-shadow
  135. &[x-type='column-scrollbar'] {
  136. box-shadow: none;
  137. border-left: transparent;
  138. }
  139. }
  140. }
  141. &.#{$module}-column-selection {
  142. text-align: center;
  143. }
  144. &[colspan]:not([colspan='1']) {
  145. text-align: center;
  146. }
  147. .#{$module}-header-column {
  148. display: inline-flex;
  149. align-items: center;
  150. }
  151. }
  152. .react-resizable {
  153. position: relative;
  154. background-clip: padding-box;
  155. }
  156. .resizing {
  157. @include genResizing();
  158. }
  159. .react-resizable-handle {
  160. position: absolute;
  161. width: $width-table_react_resizable_handle;
  162. height: calc(100% - #{$spacing-table_resizable-offset-y} * 2);
  163. background-color: $color-table-border-default;
  164. bottom: $spacing-table_resizable-bottom;
  165. right: $spacing-table_react_resizable_handle-right;
  166. cursor: col-resize;
  167. z-index: 0;
  168. &:hover {
  169. background-color: $color-table_resizer-bg-default;
  170. }
  171. }
  172. }
  173. }
  174. &-tbody {
  175. display: table-row-group;
  176. & > .#{$module}-row {
  177. display: table-row;
  178. background-color: $color-table_body-bg-default;
  179. &:hover {
  180. & > .#{$module}-row-cell {
  181. // $color-table_body-bg-hover has transparency,will reveal the background color $color-table_body-bg-default\
  182. // combine background-image and background-color to make the non-fixed column color does not show through the bottom color
  183. background-image: linear-gradient(0deg, $color-table_body-bg-hover, $color-table_body-bg-hover);
  184. background-color: $color-table_cell-bg-hover;
  185. &.#{$module}-cell-fixed {
  186. &-left,
  187. &-right {
  188. background-image: linear-gradient(0deg, $color-table_body-bg-default, $color-table_body-bg-default);
  189. &::before {
  190. background-color: $color-table_body-bg-hover;
  191. content: '';
  192. position: absolute;
  193. left: 0;
  194. top: 0;
  195. right: 0;
  196. bottom: 0;
  197. display: block;
  198. z-index: -1;
  199. }
  200. }
  201. }
  202. }
  203. }
  204. & > .#{$module}-row-cell {
  205. display: table-cell;
  206. word-wrap: break-word;
  207. word-break: break-all;
  208. border-left: none;
  209. border-right: none;
  210. border-bottom: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  211. padding: $spacing-table_tbody_rowCell-padding;
  212. box-sizing: border-box;
  213. position: relative;
  214. vertical-align: middle;
  215. &.resizing {
  216. border-right: $width-table_resizer_border solid $color-table_resizer-bg-default;
  217. }
  218. }
  219. &.#{$module}-row {
  220. &-expand {
  221. & > .#{$module}-row-cell {
  222. background-color: $color-table_row_expanded-bg-default;
  223. }
  224. }
  225. }
  226. & > .#{$module}-cell-fixed {
  227. &-left,
  228. &-right {
  229. z-index: $z-table_fixed_column;
  230. position: sticky;
  231. background-color: $color-table-bg-default;
  232. }
  233. &-left-last {
  234. border-right: $width-table_cell_fixed_left_last solid $color-table_shadow-border-default;
  235. box-shadow: #{$shadow-table_right};
  236. }
  237. &-right-first {
  238. border-left: $width-table_cell_fixed_right_first solid $color-table_shadow-border-default;
  239. box-shadow: #{$shadow-table_left};
  240. }
  241. & > * {
  242. transition: background-color $transition_duration-table_body-bg $transition_function-table_body-bg
  243. $transition_delay-table_body-bg;
  244. }
  245. }
  246. & > * {
  247. transition: background-color $transition_duration-table_body-bg $transition_function-table_body-bg
  248. $transition_delay-table_body-bg;
  249. }
  250. }
  251. & > .#{$module}-row-section {
  252. display: table-row;
  253. & > .#{$module}-row-cell {
  254. background-color: $color-table_selection-bg-default;
  255. border-bottom: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  256. }
  257. & > .#{$module}-row-cell:not(.#{$module}-column-selection) {
  258. padding: $spacing-table_tbody_rowSelection_rowCell_notSelection-paddingY $spacing-table_tbody_rowSelection_rowCell_notSelection-paddingX;
  259. }
  260. .#{$module}-section-inner {
  261. display: inline-flex;
  262. align-items: center;
  263. }
  264. }
  265. }
  266. &-virtualized .#{$module}-tbody {
  267. display: block;
  268. & > .#{$module}-row {
  269. display: flex;
  270. & > .#{$module}-row-cell {
  271. word-wrap: unset;
  272. word-break: unset;
  273. white-space: nowrap;
  274. display: inline-flex;
  275. align-items: center;
  276. overflow: hidden;
  277. }
  278. &-section {
  279. & > .#{$module}-row-cell {
  280. padding-top: $spacing-table-paddingY;
  281. padding-bottom: $spacing-table-paddingY;
  282. display: flex;
  283. }
  284. }
  285. &-expand {
  286. & > .#{$module}-row-cell {
  287. padding: 0;
  288. overflow: unset;
  289. }
  290. }
  291. }
  292. }
  293. &-footer {
  294. background-color: $color-table_footer-bg-default;
  295. padding: $spacing-table_footer-padding;
  296. margin: 0;
  297. position: relative;
  298. }
  299. .#{$module}-selection {
  300. &-wrap {
  301. // inline-flex vertical-align baseline 会导致父元素高度异常
  302. display: inline-flex;
  303. vertical-align: bottom;
  304. }
  305. &-disabled {
  306. cursor: not-allowed;
  307. & > .#{$prefix}-checkbox {
  308. pointer-events: none;
  309. }
  310. }
  311. }
  312. .#{$module}-column {
  313. &-hidden {
  314. display: none;
  315. }
  316. &-selection {
  317. text-align: center;
  318. // width: $width-table_column_selection;
  319. .#{$prefix}-checkbox-inner-display {
  320. .#{$prefix}-icon {
  321. left: 0;
  322. top: 0;
  323. }
  324. }
  325. }
  326. &-expand {
  327. .#{$module}-expand-icon {
  328. transform: translateY(2px);
  329. &:last-child {
  330. margin-right: 0;
  331. }
  332. }
  333. }
  334. &-sorter {
  335. margin-left: $spacing-table_column_sorter-marginLeft;
  336. display: inline-block;
  337. width: $width-table_column_sorter-icon;
  338. height: $height-table_column_sorter-icon;
  339. vertical-align: middle;
  340. text-align: center;
  341. &-wrapper {
  342. display: inline-flex;
  343. align-items: center;
  344. cursor: pointer;
  345. }
  346. &-up,
  347. &-down {
  348. height: 0;
  349. display: block;
  350. color: $color-table_sorter-text-default;
  351. &:hover .anticon {
  352. color: $color-table_sorter-text-hover;
  353. }
  354. svg {
  355. width: $width-table_column_sorter-icon;
  356. height: $height-table_column_sorter-icon;
  357. }
  358. &.on {
  359. .#{$prefix}-icon-caretup,
  360. .#{$prefix}-icon-caretdown {
  361. color: $color-table_sorter_on-text-default;
  362. }
  363. }
  364. }
  365. }
  366. &-filter {
  367. margin-left: $spacing-table_column_filter-marginLeft;
  368. display: inline-flex;
  369. cursor: pointer;
  370. color: $color-table_filter-text-default;
  371. // vertical-align: middle;
  372. align-items: center;
  373. svg {
  374. width: $width-table_column_filter-icon;
  375. height: $height-table_column_filter-icon;
  376. }
  377. &.on {
  378. color: $color-table_filter_on-text-default;
  379. }
  380. }
  381. }
  382. &-bordered {
  383. .#{$module}-title {
  384. padding-left: $spacing-table_bordered_titler-paddingLeft;
  385. padding-right: $spacing-table_bordered_titler-paddingRight;
  386. border-top: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  387. border-right: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  388. border-left: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  389. }
  390. .#{$module}-container {
  391. border: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  392. border-right: 0;
  393. border-bottom: 0;
  394. }
  395. .#{$module}-header {
  396. &::-webkit-scrollbar {
  397. border-right: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  398. }
  399. }
  400. .#{$module}-footer {
  401. border-left: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  402. border-right: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  403. border-bottom: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  404. }
  405. .#{$module}-thead > .#{$module}-row > .#{$module}-row-head {
  406. .react-resizable-handle {
  407. background-color: transparent;
  408. }
  409. }
  410. .#{$module}-thead > .#{$module}-row > .#{$module}-row-head,
  411. .#{$module}-tbody > .#{$module}-row > .#{$module}-row-cell {
  412. border-right: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  413. }
  414. .#{$module}-placeholder {
  415. border-right: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  416. }
  417. }
  418. &-placeholder {
  419. position: sticky;
  420. left: 0px;
  421. z-index: 1;
  422. padding: #{$spacing-table-paddingY} #{$spacing-table-paddingX};
  423. color: $color-table_placeholder-text-default;
  424. font-size: #{$font-table_base-fontSize};
  425. text-align: center;
  426. background: $color-table_pl-bg-default;
  427. border-bottom: $width-table_base_border $border-table_base-borderStyle $color-table-border-default;
  428. border-radius: 0 0 #{$radius-table_base} #{$radius-table_base};
  429. }
  430. &-fixed {
  431. table-layout: fixed;
  432. min-width: 100%;
  433. & > .#{$module}-tbody {
  434. & > .#{$module}-row-expand > .#{$module}-row-cell > .#{$module}-expand-inner,
  435. & > .#{$module}-row-section > .#{$module}-row-cell > .#{$module}-section-inner {
  436. position: sticky;
  437. overflow: auto;
  438. left: 0;
  439. margin-left: -$spacing-table_expand_row-paddingLeft;
  440. margin-right: -$spacing-table_expand_row-paddingRight;
  441. padding-left: $spacing-table_expand_row-paddingLeft;
  442. padding-right: $spacing-table_expand_row-paddingRight;
  443. height: 100%;
  444. display: flex;
  445. align-items: center;
  446. }
  447. }
  448. // when header is fixed, table should use `table-layout: fixed` to avoid align bug
  449. &-header {
  450. table {
  451. table-layout: fixed;
  452. }
  453. }
  454. }
  455. &-scroll {
  456. &-position {
  457. &-left {
  458. .#{$module}-tbody,
  459. .#{$module}-thead {
  460. & > .#{$module}-row > .#{$module}-cell-fixed-left-last {
  461. box-shadow: none;
  462. }
  463. }
  464. }
  465. &-right {
  466. .#{$module}-tbody,
  467. .#{$module}-thead {
  468. & > .#{$module}-row > .#{$module}-cell-fixed-right-first {
  469. box-shadow: none;
  470. }
  471. }
  472. }
  473. }
  474. }
  475. &-pagination-outer {
  476. color: $color-table_page-text-default;
  477. min-height: $height-table_pagination_outer_min;
  478. }
  479. }
  480. .#{$module}-expand-icon {
  481. color: $color-table_expanded_icon-default;
  482. cursor: pointer;
  483. display: inline-flex;
  484. align-items: center;
  485. user-select: none;
  486. background: $color-table_expanded-bg-default;
  487. position: relative;
  488. margin-right: $spacing-table_expand_icon-marginRight;
  489. &-cell {
  490. display: inline-flex;
  491. align-items: center;
  492. justify-content: center;
  493. }
  494. .#{$module}-expandedIcon-show{
  495. transition: transform 150ms cubic-bezier(0.62, 0.05, 0.36, 0.95);
  496. transform: rotate(90deg);
  497. }
  498. .#{$module}-expandedIcon-hide{
  499. transition: transform 150ms cubic-bezier(0.62, 0.05, 0.36, 0.95);
  500. transform: rotate(0deg);
  501. }
  502. }
  503. @import './rtl.scss';