index.less 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @import './size';
  4. @import './bordered';
  5. @table-prefix-cls: ~'@{ant-prefix}-table';
  6. @tree-prefix-cls: ~'@{ant-prefix}-tree';
  7. @dropdown-prefix-cls: ~'@{ant-prefix}-dropdown';
  8. @descriptions-prefix-cls: ~'@{ant-prefix}-descriptions';
  9. @table-header-icon-color: #bfbfbf;
  10. @table-header-icon-color-hover: darken(@table-header-icon-color, 10%);
  11. @table-sticky-zindex: calc(@zindex-table-fixed + 1);
  12. @table-sticky-scroll-bar-active-bg: fade(@table-sticky-scroll-bar-bg, 80%);
  13. @table-filter-dropdown-max-height: 264px;
  14. @table-expand-column-width: 48px;
  15. .@{table-prefix-cls}-wrapper {
  16. clear: both;
  17. max-width: 100%;
  18. .clearfix();
  19. }
  20. .@{table-prefix-cls} {
  21. .reset-component();
  22. position: relative;
  23. font-size: @table-font-size;
  24. background: @table-bg;
  25. border-radius: @table-border-radius-base;
  26. // https://github.com/ant-design/ant-design/issues/17611
  27. table {
  28. width: 100%;
  29. text-align: left;
  30. border-radius: @table-border-radius-base @table-border-radius-base 0 0;
  31. border-collapse: separate;
  32. border-spacing: 0;
  33. }
  34. // ============================= Cell =============================
  35. &-thead > tr > th,
  36. &-tbody > tr > td,
  37. tfoot > tr > th,
  38. tfoot > tr > td {
  39. position: relative;
  40. padding: @table-padding-vertical @table-padding-horizontal;
  41. overflow-wrap: break-word;
  42. }
  43. &-cell-ellipsis {
  44. overflow: hidden;
  45. white-space: nowrap;
  46. text-overflow: ellipsis;
  47. word-break: keep-all;
  48. // Fixed first or last should special process
  49. &.@{table-prefix-cls}-cell-fix-left-last,
  50. &.@{table-prefix-cls}-cell-fix-right-first {
  51. overflow: visible;
  52. .@{table-prefix-cls}-cell-content {
  53. display: block;
  54. overflow: hidden;
  55. text-overflow: ellipsis;
  56. }
  57. }
  58. .@{table-prefix-cls}-column-title {
  59. overflow: hidden;
  60. text-overflow: ellipsis;
  61. word-break: keep-all;
  62. }
  63. }
  64. // ============================ Title =============================
  65. &-title {
  66. padding: @table-padding-vertical @table-padding-horizontal;
  67. }
  68. // ============================ Footer ============================
  69. &-footer {
  70. padding: @table-padding-vertical @table-padding-horizontal;
  71. color: @table-footer-color;
  72. background: @table-footer-bg;
  73. }
  74. // ============================ Header ============================
  75. &-thead {
  76. > tr {
  77. > th {
  78. position: relative;
  79. color: @table-header-color;
  80. font-weight: 500;
  81. text-align: left;
  82. background: @table-header-bg;
  83. border-bottom: @border-width-base @border-style-base @table-border-color;
  84. transition: background 0.3s ease;
  85. &[colspan]:not([colspan='1']) {
  86. text-align: center;
  87. }
  88. &:not(:last-child):not(.@{table-prefix-cls}-selection-column):not(.@{table-prefix-cls}-row-expand-icon-cell):not([colspan])::before {
  89. position: absolute;
  90. top: 50%;
  91. right: 0;
  92. width: 1px;
  93. height: 1.6em;
  94. background-color: @table-header-cell-split-color;
  95. transform: translateY(-50%);
  96. transition: background-color 0.3s;
  97. content: '';
  98. }
  99. }
  100. }
  101. > tr:not(:last-child) > th {
  102. &[colspan] {
  103. border-bottom: 0;
  104. }
  105. }
  106. }
  107. // ============================= Body =============================
  108. &-tbody {
  109. > tr {
  110. > td {
  111. border-bottom: @border-width-base @border-style-base @table-border-color;
  112. transition: background 0.3s;
  113. // ========================= Nest Table ===========================
  114. > .@{table-prefix-cls}-wrapper:only-child,
  115. > .@{table-prefix-cls}-expanded-row-fixed > .@{table-prefix-cls}-wrapper:only-child {
  116. .@{table-prefix-cls} {
  117. margin: -@table-padding-vertical -@table-padding-horizontal -@table-padding-vertical (@table-expand-column-width -
  118. @table-padding-horizontal);
  119. &-tbody > tr:last-child > td {
  120. border-bottom: 0;
  121. &:first-child,
  122. &:last-child {
  123. border-radius: 0;
  124. }
  125. }
  126. }
  127. }
  128. }
  129. &.@{table-prefix-cls}-row:hover > td,
  130. > td.@{table-prefix-cls}-cell-row-hover {
  131. background: @table-row-hover-bg;
  132. }
  133. &.@{table-prefix-cls}-row-selected {
  134. > td {
  135. background: @table-selected-row-bg;
  136. border-color: rgba(0, 0, 0, 0.03);
  137. }
  138. &:hover {
  139. > td {
  140. background: @table-selected-row-hover-bg;
  141. }
  142. }
  143. }
  144. }
  145. }
  146. // =========================== Summary ============================
  147. &-summary {
  148. position: relative;
  149. z-index: @zindex-table-fixed;
  150. background: @table-bg;
  151. div& {
  152. box-shadow: 0 -@border-width-base 0 @table-border-color;
  153. }
  154. > tr {
  155. > th,
  156. > td {
  157. border-bottom: @border-width-base @border-style-base @table-border-color;
  158. }
  159. }
  160. }
  161. // ========================== Pagination ==========================
  162. &-pagination.@{ant-prefix}-pagination {
  163. margin: 16px 0;
  164. }
  165. &-pagination {
  166. display: flex;
  167. flex-wrap: wrap;
  168. row-gap: @padding-xs;
  169. > * {
  170. flex: none;
  171. }
  172. &-left {
  173. justify-content: flex-start;
  174. }
  175. &-center {
  176. justify-content: center;
  177. }
  178. &-right {
  179. justify-content: flex-end;
  180. }
  181. }
  182. // ================================================================
  183. // = Function =
  184. // ================================================================
  185. // ============================ Sorter ============================
  186. &-thead th.@{table-prefix-cls}-column-has-sorters {
  187. outline: none;
  188. cursor: pointer;
  189. transition: all 0.3s;
  190. &:hover {
  191. background: @table-header-sort-active-bg;
  192. &::before {
  193. background-color: transparent !important;
  194. }
  195. }
  196. &:focus-visible {
  197. color: @primary-color;
  198. }
  199. // https://github.com/ant-design/ant-design/issues/30969
  200. &.@{table-prefix-cls}-cell-fix-left:hover,
  201. &.@{table-prefix-cls}-cell-fix-right:hover {
  202. background: @table-fixed-header-sort-active-bg;
  203. }
  204. }
  205. &-thead th.@{table-prefix-cls}-column-sort {
  206. background: @table-header-sort-bg;
  207. &::before {
  208. background-color: transparent !important;
  209. }
  210. }
  211. td&-column-sort {
  212. background: @table-body-sort-bg;
  213. }
  214. &-column-title {
  215. position: relative;
  216. z-index: 1;
  217. flex: 1;
  218. }
  219. &-column-sorters {
  220. display: flex;
  221. flex: auto;
  222. align-items: center;
  223. justify-content: space-between;
  224. &::after {
  225. position: absolute;
  226. top: 0;
  227. right: 0;
  228. bottom: 0;
  229. left: 0;
  230. width: 100%;
  231. height: 100%;
  232. content: '';
  233. }
  234. }
  235. &-column-sorter {
  236. margin-left: 4px;
  237. color: @table-header-icon-color;
  238. font-size: 0;
  239. transition: color 0.3s;
  240. &-inner {
  241. display: inline-flex;
  242. flex-direction: column;
  243. align-items: center;
  244. }
  245. &-up,
  246. &-down {
  247. font-size: 11px;
  248. &.active {
  249. color: @primary-color;
  250. }
  251. }
  252. &-up + &-down {
  253. margin-top: -0.3em;
  254. }
  255. }
  256. &-column-sorters:hover &-column-sorter {
  257. color: darken(@table-header-icon-color, 10%);
  258. }
  259. // ============================ Filter ============================
  260. &-filter-column {
  261. display: flex;
  262. justify-content: space-between;
  263. }
  264. &-filter-trigger {
  265. position: relative;
  266. display: flex;
  267. align-items: center;
  268. margin: -4px (-@table-padding-horizontal / 2) -4px 4px;
  269. padding: 0 4px;
  270. color: @table-header-icon-color;
  271. font-size: @font-size-sm;
  272. border-radius: @border-radius-base;
  273. cursor: pointer;
  274. transition: all 0.3s;
  275. &:hover {
  276. color: @text-color-secondary;
  277. background: @table-header-filter-active-bg;
  278. }
  279. &.active {
  280. color: @primary-color;
  281. }
  282. }
  283. // Dropdown
  284. &-filter-dropdown {
  285. .reset-component();
  286. min-width: 120px;
  287. background-color: @table-filter-dropdown-bg;
  288. border-radius: @border-radius-base;
  289. box-shadow: @box-shadow-base;
  290. // Reset menu
  291. .@{dropdown-prefix-cls}-menu {
  292. // https://github.com/ant-design/ant-design/issues/4916
  293. // https://github.com/ant-design/ant-design/issues/19542
  294. max-height: @table-filter-dropdown-max-height;
  295. overflow-x: hidden;
  296. border: 0;
  297. box-shadow: none;
  298. &:empty::after {
  299. display: block;
  300. padding: 8px 0;
  301. color: @disabled-color;
  302. font-size: @font-size-sm;
  303. text-align: center;
  304. content: 'Not Found';
  305. }
  306. }
  307. &-tree {
  308. padding: 8px 8px 0;
  309. .@{tree-prefix-cls}-treenode .@{tree-prefix-cls}-node-content-wrapper:hover {
  310. background-color: @tree-node-hover-bg;
  311. }
  312. .@{tree-prefix-cls}-treenode-checkbox-checked .@{tree-prefix-cls}-node-content-wrapper {
  313. &,
  314. &:hover {
  315. background-color: @tree-node-selected-bg;
  316. }
  317. }
  318. }
  319. &-search {
  320. padding: 8px;
  321. border-bottom: @border-width-base @border-color-split @border-style-base;
  322. &-input {
  323. input {
  324. min-width: 140px;
  325. }
  326. .@{iconfont-css-prefix} {
  327. color: @disabled-color;
  328. }
  329. }
  330. }
  331. &-checkall {
  332. width: 100%;
  333. margin-bottom: 4px;
  334. margin-left: 4px;
  335. }
  336. &-submenu > ul {
  337. max-height: calc(100vh - 130px);
  338. overflow-x: hidden;
  339. overflow-y: auto;
  340. }
  341. // Checkbox
  342. &,
  343. &-submenu {
  344. .@{ant-prefix}-checkbox-wrapper + span {
  345. padding-left: 8px;
  346. }
  347. }
  348. // Operation
  349. &-btns {
  350. display: flex;
  351. justify-content: space-between;
  352. padding: 7px 8px;
  353. overflow: hidden;
  354. background-color: @table-filter-btns-bg;
  355. border-top: @border-width-base @border-style-base @table-border-color;
  356. }
  357. }
  358. // ========================== Selections ==========================
  359. &-selection-col {
  360. width: @table-selection-column-width;
  361. }
  362. &-bordered &-selection-col {
  363. width: @table-selection-column-width + 18px;
  364. }
  365. table tr th&-selection-column,
  366. table tr td&-selection-column {
  367. padding-right: @padding-xs;
  368. padding-left: @padding-xs;
  369. text-align: center;
  370. .@{ant-prefix}-radio-wrapper {
  371. margin-right: 0;
  372. }
  373. }
  374. table tr th&-selection-column&-cell-fix-left {
  375. z-index: 3;
  376. }
  377. table tr th&-selection-column::after {
  378. background-color: transparent !important;
  379. }
  380. &-selection {
  381. position: relative;
  382. display: inline-flex;
  383. flex-direction: column;
  384. &-extra {
  385. position: absolute;
  386. top: 0;
  387. z-index: 1;
  388. cursor: pointer;
  389. transition: all 0.3s;
  390. margin-inline-start: 100%;
  391. padding-inline-start: (@table-padding-horizontal / 4);
  392. .@{iconfont-css-prefix} {
  393. color: @table-header-icon-color;
  394. font-size: 10px;
  395. &:hover {
  396. color: @table-header-icon-color-hover;
  397. }
  398. }
  399. }
  400. }
  401. // ========================== Expandable ==========================
  402. &-expand-icon-col {
  403. width: @table-expand-column-width;
  404. }
  405. &-row-expand-icon-cell {
  406. text-align: center;
  407. .@{table-prefix-cls}-row-expand-icon {
  408. display: inline-flex;
  409. float: none;
  410. vertical-align: sub;
  411. }
  412. }
  413. &-row-indent {
  414. float: left;
  415. height: 1px;
  416. }
  417. &-row-expand-icon {
  418. .operation-unit();
  419. position: relative;
  420. float: left;
  421. box-sizing: border-box;
  422. width: @expand-icon-size;
  423. height: @expand-icon-size;
  424. padding: 0;
  425. color: inherit;
  426. line-height: ceil(((@font-size-sm * 1.4 - @border-width-base * 3) / 2)) * 2 + @border-width-base *
  427. 3;
  428. background: @table-expand-icon-bg;
  429. border: @border-width-base @border-style-base @table-border-color;
  430. border-radius: @border-radius-base;
  431. transform: scale((unit(@checkbox-size) / unit(@expand-icon-size)));
  432. transition: all 0.3s;
  433. user-select: none;
  434. @expand-icon-size: ceil(((@font-size-sm * 1.4 - @border-width-base * 3) / 2)) * 2 +
  435. @border-width-base * 3;
  436. &:focus,
  437. &:hover,
  438. &:active {
  439. border-color: currentcolor;
  440. }
  441. &::before,
  442. &::after {
  443. position: absolute;
  444. background: currentcolor;
  445. transition: transform 0.3s ease-out;
  446. content: '';
  447. }
  448. &::before {
  449. top: ceil(((@font-size-sm * 1.4 - @border-width-base * 3) / 2));
  450. right: 3px;
  451. left: 3px;
  452. height: @border-width-base;
  453. }
  454. &::after {
  455. top: 3px;
  456. bottom: 3px;
  457. left: ceil(((@font-size-sm * 1.4 - @border-width-base * 3) / 2));
  458. width: @border-width-base;
  459. transform: rotate(90deg);
  460. }
  461. // Motion effect
  462. &-collapsed::before {
  463. transform: rotate(-180deg);
  464. }
  465. &-collapsed::after {
  466. transform: rotate(0deg);
  467. }
  468. &-spaced {
  469. &::before,
  470. &::after {
  471. display: none;
  472. content: none;
  473. }
  474. background: transparent;
  475. border: 0;
  476. visibility: hidden;
  477. }
  478. .@{table-prefix-cls}-row-indent + & {
  479. margin-top: ((@font-size-base * @line-height-base - @border-width-base * 3) / 2) -
  480. ceil(((@font-size-sm * 1.4 - @border-width-base * 3) / 2));
  481. margin-right: @padding-xs;
  482. }
  483. }
  484. tr&-expanded-row {
  485. &,
  486. &:hover {
  487. > td {
  488. background: @table-expanded-row-bg;
  489. }
  490. }
  491. // https://github.com/ant-design/ant-design/issues/25573
  492. .@{descriptions-prefix-cls}-view {
  493. display: flex;
  494. table {
  495. flex: auto;
  496. width: auto;
  497. }
  498. }
  499. }
  500. // With fixed
  501. .@{table-prefix-cls}-expanded-row-fixed {
  502. position: relative;
  503. margin: -@table-padding-vertical -@table-padding-horizontal;
  504. padding: @table-padding-vertical @table-padding-horizontal;
  505. }
  506. // ========================= Placeholder ==========================
  507. &-tbody > tr&-placeholder {
  508. text-align: center;
  509. .@{table-prefix-cls}-empty & {
  510. color: @disabled-color;
  511. }
  512. &:hover {
  513. > td {
  514. background: @component-background;
  515. }
  516. }
  517. }
  518. // ============================ Fixed =============================
  519. &-cell-fix-left,
  520. &-cell-fix-right {
  521. position: sticky !important;
  522. z-index: @zindex-table-fixed;
  523. background: @table-bg;
  524. }
  525. &-cell-fix-left-first::after,
  526. &-cell-fix-left-last::after {
  527. position: absolute;
  528. top: 0;
  529. right: 0;
  530. bottom: -1px;
  531. width: 30px;
  532. transform: translateX(100%);
  533. transition: box-shadow 0.3s;
  534. content: '';
  535. pointer-events: none;
  536. }
  537. &-cell-fix-left-all::after {
  538. display: none;
  539. }
  540. &-cell-fix-right-first::after,
  541. &-cell-fix-right-last::after {
  542. position: absolute;
  543. top: 0;
  544. bottom: -1px;
  545. left: 0;
  546. width: 30px;
  547. transform: translateX(-100%);
  548. transition: box-shadow 0.3s;
  549. content: '';
  550. pointer-events: none;
  551. }
  552. .@{table-prefix-cls}-container {
  553. &::before,
  554. &::after {
  555. position: absolute;
  556. top: 0;
  557. bottom: 0;
  558. z-index: calc(@table-sticky-zindex + 1);
  559. width: 30px;
  560. transition: box-shadow 0.3s;
  561. content: '';
  562. pointer-events: none;
  563. }
  564. &::before {
  565. left: 0;
  566. }
  567. &::after {
  568. right: 0;
  569. }
  570. }
  571. &-ping-left {
  572. &:not(.@{table-prefix-cls}-has-fix-left) > .@{table-prefix-cls}-container {
  573. position: relative;
  574. &::before {
  575. box-shadow: inset 10px 0 8px -8px darken(@shadow-color, 5%);
  576. }
  577. }
  578. .@{table-prefix-cls}-cell-fix-left-first::after,
  579. .@{table-prefix-cls}-cell-fix-left-last::after {
  580. box-shadow: inset 10px 0 8px -8px darken(@shadow-color, 5%);
  581. }
  582. .@{table-prefix-cls}-cell-fix-left-last::before {
  583. background-color: transparent !important;
  584. }
  585. }
  586. &-ping-right {
  587. &:not(.@{table-prefix-cls}-has-fix-right) > .@{table-prefix-cls}-container {
  588. position: relative;
  589. &::after {
  590. box-shadow: inset -10px 0 8px -8px darken(@shadow-color, 5%);
  591. }
  592. }
  593. .@{table-prefix-cls}-cell-fix-right-first::after,
  594. .@{table-prefix-cls}-cell-fix-right-last::after {
  595. box-shadow: inset -10px 0 8px -8px darken(@shadow-color, 5%);
  596. }
  597. }
  598. &-sticky {
  599. &-holder {
  600. position: sticky;
  601. z-index: @table-sticky-zindex;
  602. background: @component-background;
  603. }
  604. &-scroll {
  605. position: sticky;
  606. bottom: 0;
  607. z-index: @table-sticky-zindex;
  608. display: flex;
  609. align-items: center;
  610. background: lighten(@table-border-color, 80%);
  611. border-top: 1px solid @table-border-color;
  612. opacity: 0.6;
  613. &:hover {
  614. transform-origin: center bottom;
  615. }
  616. &-bar {
  617. height: 8px;
  618. background-color: @table-sticky-scroll-bar-bg;
  619. border-radius: @table-sticky-scroll-bar-radius;
  620. &:hover {
  621. background-color: @table-sticky-scroll-bar-active-bg;
  622. }
  623. &-active {
  624. background-color: @table-sticky-scroll-bar-active-bg;
  625. }
  626. }
  627. }
  628. }
  629. }
  630. @media all and (-ms-high-contrast: none) {
  631. .@{table-prefix-cls} {
  632. &-ping-left {
  633. .@{table-prefix-cls}-cell-fix-left-last::after {
  634. box-shadow: none !important;
  635. }
  636. }
  637. &-ping-right {
  638. .@{table-prefix-cls}-cell-fix-right-first::after {
  639. box-shadow: none !important;
  640. }
  641. }
  642. }
  643. }
  644. @import './radius';
  645. @import './rtl';