table.scss 20 KB

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