index-pure.less 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @import './size';
  4. @import './bordered';
  5. @import './resize.less';
  6. @table-prefix-cls: ~'@{ant-prefix}-table';
  7. @tree-prefix-cls: ~'@{ant-prefix}-tree';
  8. @dropdown-prefix-cls: ~'@{ant-prefix}-dropdown';
  9. @descriptions-prefix-cls: ~'@{ant-prefix}-descriptions';
  10. @table-header-icon-color: #bfbfbf;
  11. @table-header-icon-color-hover: darken(@table-header-icon-color, 10%);
  12. @table-sticky-zindex: calc(@zindex-table-fixed + 1);
  13. @table-sticky-scroll-bar-active-bg: fade(@table-sticky-scroll-bar-bg, 80%);
  14. @table-filter-dropdown-max-height: 264px;
  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-padding-horizontal +
  118. ceil(@font-size-sm * 1.4));
  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. cursor: pointer;
  188. transition: all 0.3s;
  189. &:hover {
  190. background: @table-header-sort-active-bg;
  191. &::before {
  192. background-color: transparent !important;
  193. }
  194. }
  195. // https://github.com/ant-design/ant-design/issues/30969
  196. &.@{table-prefix-cls}-cell-fix-left:hover,
  197. &.@{table-prefix-cls}-cell-fix-right:hover {
  198. background: @table-fixed-header-sort-active-bg;
  199. }
  200. }
  201. &-thead th.@{table-prefix-cls}-column-sort {
  202. background: @table-header-sort-bg;
  203. &::before {
  204. background-color: transparent !important;
  205. }
  206. }
  207. td&-column-sort {
  208. background: @table-body-sort-bg;
  209. }
  210. &-column-title {
  211. position: relative;
  212. z-index: 1;
  213. flex: 1;
  214. }
  215. &-column-sorters {
  216. display: flex;
  217. flex: auto;
  218. align-items: center;
  219. justify-content: space-between;
  220. &::after {
  221. position: absolute;
  222. top: 0;
  223. right: 0;
  224. bottom: 0;
  225. left: 0;
  226. width: 100%;
  227. height: 100%;
  228. content: '';
  229. }
  230. }
  231. &-column-sorter {
  232. margin-left: 4px;
  233. color: @table-header-icon-color;
  234. font-size: 0;
  235. transition: color 0.3s;
  236. &-inner {
  237. display: inline-flex;
  238. flex-direction: column;
  239. align-items: center;
  240. }
  241. &-up,
  242. &-down {
  243. font-size: 11px;
  244. &.active {
  245. color: @primary-color;
  246. }
  247. }
  248. &-up + &-down {
  249. margin-top: -0.3em;
  250. }
  251. }
  252. &-column-sorters:hover &-column-sorter {
  253. color: darken(@table-header-icon-color, 10%);
  254. }
  255. // ============================ Filter ============================
  256. &-filter-column {
  257. display: flex;
  258. justify-content: space-between;
  259. }
  260. &-filter-trigger {
  261. position: relative;
  262. display: flex;
  263. align-items: center;
  264. margin: -4px (-@table-padding-horizontal / 2) -4px 4px;
  265. padding: 0 4px;
  266. color: @table-header-icon-color;
  267. font-size: @font-size-sm;
  268. border-radius: @border-radius-base;
  269. cursor: pointer;
  270. transition: all 0.3s;
  271. &:hover {
  272. color: @text-color-secondary;
  273. background: @table-header-filter-active-bg;
  274. }
  275. &.active {
  276. color: @primary-color;
  277. }
  278. }
  279. // Dropdown
  280. &-filter-dropdown {
  281. .reset-component();
  282. min-width: 120px;
  283. background-color: @table-filter-dropdown-bg;
  284. border-radius: @border-radius-base;
  285. box-shadow: @box-shadow-base;
  286. // Reset menu
  287. .@{dropdown-prefix-cls}-menu {
  288. // https://github.com/ant-design/ant-design/issues/4916
  289. // https://github.com/ant-design/ant-design/issues/19542
  290. max-height: @table-filter-dropdown-max-height;
  291. overflow-x: hidden;
  292. border: 0;
  293. box-shadow: none;
  294. &:empty::after {
  295. display: block;
  296. padding: 8px 0;
  297. color: @disabled-color;
  298. font-size: @font-size-sm;
  299. text-align: center;
  300. content: 'Not Found';
  301. }
  302. }
  303. &-tree {
  304. padding: 8px 8px 0;
  305. .@{tree-prefix-cls}-treenode .@{tree-prefix-cls}-node-content-wrapper:hover {
  306. background-color: @tree-node-hover-bg;
  307. }
  308. .@{tree-prefix-cls}-treenode-checkbox-checked .@{tree-prefix-cls}-node-content-wrapper {
  309. &,
  310. &:hover {
  311. background-color: @tree-node-selected-bg;
  312. }
  313. }
  314. }
  315. &-search {
  316. padding: 8px;
  317. border-bottom: @border-width-base @border-color-split @border-style-base;
  318. &-input {
  319. input {
  320. min-width: 140px;
  321. }
  322. .@{iconfont-css-prefix} {
  323. color: @disabled-color;
  324. }
  325. }
  326. }
  327. &-checkall {
  328. width: 100%;
  329. margin-bottom: 4px;
  330. margin-left: 4px;
  331. }
  332. &-submenu > ul {
  333. max-height: calc(100vh - 130px);
  334. overflow-x: hidden;
  335. overflow-y: auto;
  336. }
  337. // Checkbox
  338. &,
  339. &-submenu {
  340. .@{ant-prefix}-checkbox-wrapper + span {
  341. padding-left: 8px;
  342. }
  343. }
  344. // Operation
  345. &-btns {
  346. display: flex;
  347. justify-content: space-between;
  348. padding: 7px 8px;
  349. overflow: hidden;
  350. background-color: @table-filter-btns-bg;
  351. border-top: @border-width-base @border-style-base @table-border-color;
  352. }
  353. }
  354. // ========================== Selections ==========================
  355. &-selection-col {
  356. width: @table-selection-column-width;
  357. }
  358. &-bordered &-selection-col {
  359. width: @table-selection-column-width + 18px;
  360. }
  361. table tr th&-selection-column,
  362. table tr td&-selection-column {
  363. padding-right: @padding-xs;
  364. padding-left: @padding-xs;
  365. text-align: center;
  366. .@{ant-prefix}-radio-wrapper {
  367. margin-right: 0;
  368. }
  369. }
  370. table tr th&-selection-column&-cell-fix-left {
  371. z-index: 3;
  372. }
  373. table tr th&-selection-column::after {
  374. background-color: transparent !important;
  375. }
  376. &-selection {
  377. position: relative;
  378. display: inline-flex;
  379. flex-direction: column;
  380. &-extra {
  381. position: absolute;
  382. top: 0;
  383. z-index: 1;
  384. cursor: pointer;
  385. transition: all 0.3s;
  386. margin-inline-start: 100%;
  387. padding-inline-start: @padding-xss;
  388. .@{iconfont-css-prefix} {
  389. color: @table-header-icon-color;
  390. font-size: 10px;
  391. &:hover {
  392. color: @table-header-icon-color-hover;
  393. }
  394. }
  395. }
  396. }
  397. // ========================== Expandable ==========================
  398. &-expand-icon-col {
  399. width: 48px;
  400. }
  401. &-row-expand-icon-cell {
  402. text-align: center;
  403. }
  404. &-row-indent {
  405. float: left;
  406. height: 1px;
  407. }
  408. &-row-expand-icon {
  409. .operation-unit();
  410. position: relative;
  411. display: inline-flex;
  412. float: left;
  413. box-sizing: border-box;
  414. width: @expand-icon-size;
  415. height: @expand-icon-size;
  416. padding: 0;
  417. color: inherit;
  418. line-height: ceil(((@font-size-sm * 1.4 - @border-width-base * 3) / 2)) * 2 + @border-width-base *
  419. 3;
  420. background: @table-expand-icon-bg;
  421. border: @border-width-base @border-style-base @table-border-color;
  422. border-radius: @border-radius-base;
  423. outline: none;
  424. transform: scale((unit(@checkbox-size) / unit(@expand-icon-size)));
  425. transition: all 0.3s;
  426. user-select: none;
  427. @expand-icon-size: ceil(((@font-size-sm * 1.4 - @border-width-base * 3) / 2)) * 2 +
  428. @border-width-base * 3;
  429. &:focus,
  430. &:hover,
  431. &:active {
  432. border-color: currentcolor;
  433. }
  434. &::before,
  435. &::after {
  436. position: absolute;
  437. background: currentcolor;
  438. transition: transform 0.3s ease-out;
  439. content: '';
  440. }
  441. &::before {
  442. top: ceil(((@font-size-sm * 1.4 - @border-width-base * 3) / 2));
  443. right: 3px;
  444. left: 3px;
  445. height: @border-width-base;
  446. }
  447. &::after {
  448. top: 3px;
  449. bottom: 3px;
  450. left: ceil(((@font-size-sm * 1.4 - @border-width-base * 3) / 2));
  451. width: @border-width-base;
  452. transform: rotate(90deg);
  453. }
  454. // Motion effect
  455. &-collapsed::before {
  456. transform: rotate(-180deg);
  457. }
  458. &-collapsed::after {
  459. transform: rotate(0deg);
  460. }
  461. &-spaced {
  462. &::before,
  463. &::after {
  464. display: none;
  465. content: none;
  466. }
  467. background: transparent;
  468. border: 0;
  469. visibility: hidden;
  470. }
  471. .@{table-prefix-cls}-row-indent + & {
  472. margin-top: ((@font-size-base * @line-height-base - @border-width-base * 3) / 2) -
  473. ceil(((@font-size-sm * 1.4 - @border-width-base * 3) / 2));
  474. margin-right: @padding-xs;
  475. }
  476. }
  477. tr&-expanded-row {
  478. &,
  479. &:hover {
  480. > td {
  481. background: @table-expanded-row-bg;
  482. }
  483. }
  484. // https://github.com/ant-design/ant-design/issues/25573
  485. .@{descriptions-prefix-cls}-view {
  486. display: flex;
  487. table {
  488. flex: auto;
  489. width: auto;
  490. }
  491. }
  492. }
  493. // With fixed
  494. .@{table-prefix-cls}-expanded-row-fixed {
  495. position: relative;
  496. margin: -@table-padding-vertical -@table-padding-horizontal;
  497. padding: @table-padding-vertical @table-padding-horizontal;
  498. }
  499. // ========================= Placeholder ==========================
  500. &-tbody > tr&-placeholder {
  501. text-align: center;
  502. .@{table-prefix-cls}-empty & {
  503. color: @disabled-color;
  504. }
  505. &:hover {
  506. > td {
  507. background: @component-background;
  508. }
  509. }
  510. }
  511. // ============================ Fixed =============================
  512. &-cell-fix-left,
  513. &-cell-fix-right {
  514. position: sticky !important;
  515. z-index: @zindex-table-fixed;
  516. background: @table-bg;
  517. }
  518. &-cell-fix-left-first::after,
  519. &-cell-fix-left-last::after {
  520. position: absolute;
  521. top: 0;
  522. right: 0;
  523. bottom: -1px;
  524. width: 30px;
  525. transform: translateX(100%);
  526. transition: box-shadow 0.3s;
  527. content: '';
  528. pointer-events: none;
  529. }
  530. &-cell-fix-right-first::after,
  531. &-cell-fix-right-last::after {
  532. position: absolute;
  533. top: 0;
  534. bottom: -1px;
  535. left: 0;
  536. width: 30px;
  537. transform: translateX(-100%);
  538. transition: box-shadow 0.3s;
  539. content: '';
  540. pointer-events: none;
  541. }
  542. .@{table-prefix-cls}-container {
  543. &::before,
  544. &::after {
  545. position: absolute;
  546. top: 0;
  547. bottom: 0;
  548. z-index: @zindex-table-fixed;
  549. width: 30px;
  550. transition: box-shadow 0.3s;
  551. content: '';
  552. pointer-events: none;
  553. }
  554. &::before {
  555. left: 0;
  556. }
  557. &::after {
  558. right: 0;
  559. }
  560. }
  561. &-ping-left {
  562. &:not(.@{table-prefix-cls}-has-fix-left) .@{table-prefix-cls}-container {
  563. position: relative;
  564. &::before {
  565. box-shadow: inset 10px 0 8px -8px darken(@shadow-color, 5%);
  566. }
  567. }
  568. .@{table-prefix-cls}-cell-fix-left-first::after,
  569. .@{table-prefix-cls}-cell-fix-left-last::after {
  570. box-shadow: inset 10px 0 8px -8px darken(@shadow-color, 5%);
  571. }
  572. .@{table-prefix-cls}-cell-fix-left-last::before {
  573. background-color: transparent !important;
  574. }
  575. }
  576. &-ping-right {
  577. &:not(.@{table-prefix-cls}-has-fix-right) .@{table-prefix-cls}-container {
  578. position: relative;
  579. &::after {
  580. box-shadow: inset -10px 0 8px -8px darken(@shadow-color, 5%);
  581. }
  582. }
  583. .@{table-prefix-cls}-cell-fix-right-first::after,
  584. .@{table-prefix-cls}-cell-fix-right-last::after {
  585. box-shadow: inset -10px 0 8px -8px darken(@shadow-color, 5%);
  586. }
  587. }
  588. &-sticky {
  589. &-holder {
  590. position: sticky;
  591. z-index: @table-sticky-zindex;
  592. background: @component-background;
  593. }
  594. &-scroll {
  595. position: sticky;
  596. bottom: 0;
  597. z-index: @table-sticky-zindex;
  598. display: flex;
  599. align-items: center;
  600. background: lighten(@table-border-color, 80%);
  601. border-top: 1px solid @table-border-color;
  602. opacity: 0.6;
  603. &:hover {
  604. transform-origin: center bottom;
  605. }
  606. &-bar {
  607. height: 8px;
  608. background-color: @table-sticky-scroll-bar-bg;
  609. border-radius: @table-sticky-scroll-bar-radius;
  610. &:hover {
  611. background-color: @table-sticky-scroll-bar-active-bg;
  612. }
  613. &-active {
  614. background-color: @table-sticky-scroll-bar-active-bg;
  615. }
  616. }
  617. }
  618. }
  619. }
  620. @media all and (-ms-high-contrast: none) {
  621. .@{table-prefix-cls} {
  622. &-ping-left {
  623. .@{table-prefix-cls}-cell-fix-left-last::after {
  624. box-shadow: none !important;
  625. }
  626. }
  627. &-ping-right {
  628. .@{table-prefix-cls}-cell-fix-right-first::after {
  629. box-shadow: none !important;
  630. }
  631. }
  632. }
  633. }
  634. @import './radius';
  635. @import './rtl';