Skip to content

Commit b803cf4

Browse files
authored
Revert "fix(material/table): switch back to class-based styling for flex tables (#22350)"
This reverts commit c76a09e.
1 parent 0496cfe commit b803cf4

File tree

5 files changed

+35
-40
lines changed

5 files changed

+35
-40
lines changed

src/components-examples/material/table/table-expandable-rows/table-expandable-rows-example.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ table {
44

55
tr.example-detail-row {
66
height: 0;
7-
min-height: 0;
87
}
98

109
tr.example-element-row:not(.example-expanded-row):hover {

src/material-experimental/mdc-table/table.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
@use '../mdc-helpers/mdc-helpers';
44
@use '../../material/table/table-flex-styles';
55

6-
@include table-flex-styles.private-table-flex-styles('mat-mdc');
76
@include mdc-data-table.core-styles($query: mdc-helpers.$mat-base-styles-without-animation-query);
7+
@include table-flex-styles.private-table-flex-styles();
88

99
.mat-mdc-table-sticky {
1010
// Note that the table can either set this class or an inline style to make something sticky.
@@ -24,7 +24,7 @@
2424
// MDC table rows are styled with a top border, whereas our legacy flex table styles rows with
2525
// a bottom border. Remove the bottom border style from the rows and let MDC display its top
2626
// border.
27-
.mat-mdc-row, .mat-mdc-header-row, .mdc-mdc-footer-row {
27+
mat-row.mat-mdc-row, mat-header-row.mat-mdc-header-row, mat-footer-row.mat-mdc-footer-row {
2828
border-bottom: none;
2929
}
3030

src/material/table/_table-flex-styles.scss

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,41 @@ $header-row-height: 56px;
33
$row-height: 48px;
44
$row-horizontal-padding: 24px;
55

6-
@mixin private-table-flex-styles($prefix) {
7-
// These styles are nested under a `:not(table)`, because
8-
// they can break the non-flex table if they leak out.
9-
.#{$prefix}-table:not(table) {
6+
// Only use tag name selectors here since the styles are shared between MDC and non-MDC
7+
@mixin private-table-flex-styles {
8+
mat-table {
109
display: block;
11-
12-
.#{$prefix}-cell, .#{$prefix}-header-cell, .#{$prefix}-footer-cell {
13-
display: flex;
14-
}
15-
16-
.#{$prefix}-row, .#{$prefix}-header-row, .#{$prefix}-footer-row {
17-
display: flex;
18-
19-
// Workaround for https://goo.gl/pFmjJD in IE 11. Adds a pseudo
20-
// element that will stretch the row the correct height. See:
21-
// https://connect.microsoft.com/IE/feedback/details/802625
22-
&::after {
23-
display: inline-block;
24-
min-height: inherit;
25-
content: '';
26-
}
27-
}
2810
}
2911

30-
// The remaining styles can leak to the native table without affecting it.
31-
// We keep them outside to lower the specificity.
32-
.#{$prefix}-header-row {
12+
mat-header-row {
3313
min-height: $header-row-height;
3414
}
3515

36-
.#{$prefix}-row, .#{$prefix}-footer-row {
16+
mat-row, mat-footer-row {
3717
min-height: $row-height;
3818
}
3919

40-
.#{$prefix}-row, .#{$prefix}-header-row, .#{$prefix}-footer-row {
20+
mat-row, mat-header-row, mat-footer-row {
21+
display: flex;
22+
// Define a border style, but then widths default to 3px. Reset them to 0px except the bottom
23+
// which should be 1px;
24+
border-width: 0;
4125
border-bottom-width: 1px;
42-
border-bottom-style: solid;
26+
border-style: solid;
4327
align-items: center;
4428
box-sizing: border-box;
45-
}
4629

47-
.#{$prefix}-cell, .#{$prefix}-header-cell, .#{$prefix}-footer-cell {
48-
flex: 1;
49-
overflow: hidden;
50-
word-wrap: break-word;
51-
min-height: inherit;
52-
align-items: center;
30+
// Workaround for https://goo.gl/pFmjJD in IE 11. Adds a pseudo
31+
// element that will stretch the row the correct height. See:
32+
// https://connect.microsoft.com/IE/feedback/details/802625
33+
&::after {
34+
display: inline-block;
35+
min-height: inherit;
36+
content: '';
37+
}
38+
}
5339

40+
mat-cell, mat-header-cell, mat-footer-cell {
5441
// Note: we use `first-of-type`/`last-of-type` here in order to prevent extra
5542
// elements like ripples or badges from throwing off the layout (see #11165).
5643
&:first-of-type {
@@ -71,4 +58,13 @@ $row-horizontal-padding: 24px;
7158
}
7259
}
7360
}
61+
62+
mat-cell, mat-header-cell, mat-footer-cell {
63+
flex: 1;
64+
display: flex;
65+
align-items: center;
66+
overflow: hidden;
67+
word-wrap: break-word;
68+
min-height: inherit;
69+
}
7470
}

src/material/table/_table-theme.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
}
1414

1515
.mat-table thead, .mat-table tbody, .mat-table tfoot,
16-
.mat-header-row, .mat-row, .mat-footer-row,
16+
mat-header-row, mat-row, mat-footer-row,
1717
[mat-header-row], [mat-row], [mat-footer-row],
1818
.mat-table-sticky {
1919
background: inherit;
2020
}
2121

22-
.mat-row, .mat-header-row, .mat-footer-row,
22+
mat-row, mat-header-row, mat-footer-row,
2323
th.mat-header-cell, td.mat-cell, td.mat-footer-cell {
2424
border-bottom-color: theming.get-color-from-palette($foreground, divider);
2525
}

src/material/table/table.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@use '../core/style/vendor-prefixes';
22
@use './table-flex-styles';
33

4-
@include table-flex-styles.private-table-flex-styles('mat');
4+
@include table-flex-styles.private-table-flex-styles();
55

66
// Native HTML table structure
77
table.mat-table {

0 commit comments

Comments
 (0)