table.scss 18 KB

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