table.scss 19 KB

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