table.scss 15 KB

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