UNPKG

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