1
1
@use ' @material/data-table/data-table' as mdc-data-table ;
2
+ @use ' @material/data-table/data-table-cell' as mdc-data-table-cell ;
3
+ @use ' @material/data-table/data-table-header-cell' as mdc-data-table-header-cell ;
4
+ @use ' @material/data-table' as mdc-data-table-theme ;
2
5
@use ' ../core/mdc-helpers/mdc-helpers' ;
6
+ @use ' ../core/tokens/token-utils' ;
7
+ @use ' ../core/tokens/m2/mat/table' as tokens-mat-table ;
3
8
@use ' ./table-flex-styles' ;
4
9
5
- @include mdc-helpers .disable-mdc-fallback-declarations {
6
- @include mdc-data-table .table-styles (
7
- $query : mdc-helpers .$mdc-base-styles-without-animation-query );
8
- @include table-flex-styles .private-table-flex-styles ();
9
- }
10
-
11
10
.mat-mdc-table-sticky {
12
11
// Note that the table can either set this class or an inline style to make something sticky.
13
12
// We set the style as `!important` so that we get an identical specificity in both cases
14
13
// and to avoid cases where user styles have a higher specificity.
15
14
position : sticky !important ;
16
15
}
17
16
17
+ @mixin _cell-border {
18
+ @include token-utils .create-token-slot (border-bottom-color , row- item- outline- color, true);
19
+ @include token-utils .create-token-slot (border-bottom-width , row- item- outline- width, true);
20
+ border-bottom-style : solid ;
21
+ }
22
+
23
+ @include mdc-data-table .static-styles ($query : mdc-helpers .$mdc-base-styles-query );
24
+ @include mdc-data-table-cell .static-styles ($query : mdc-helpers .$mdc-base-styles-query );
25
+ @include mdc-data-table-header-cell .static-styles ($query : mdc-helpers .$mdc-base-styles-query );
26
+ @include mdc-data-table-theme .cell-padding (
27
+ $leading-padding : mdc-data-table-theme .$cell-leading-padding ,
28
+ $trailing-padding : mdc-data-table-theme .$cell-trailing-padding ,
29
+ $query : mdc-helpers .$mdc-base-styles-query
30
+ );
31
+ @include table-flex-styles .private-table-flex-styles ();
32
+
18
33
.mat-mdc-table {
34
+ @include token-utils .create-token-values (
35
+ tokens-mat-table .$prefix , tokens-mat-table .get-unthemable-tokens ());
36
+
19
37
// MDC Table applies `table-layout: fixed`, but this is a backwards incompatible
20
38
// change since the table did not previously apply it.
21
39
// TODO: Add a mixin to MDC to set the layout instead of including this override,
25
43
// The MDC table does not allow text to wrap within the cell. This allows for text to
26
44
// wrap when the cell reaches its maximum width.
27
45
white-space : normal ;
46
+
47
+ @include token-utils .use-tokens (tokens-mat-table .$prefix , tokens-mat-table .get-token-slots ()) {
48
+ @include token-utils .create-token-slot (background-color , background-color );
49
+ }
50
+ }
51
+
52
+ @include mdc-helpers .disable-mdc-fallback-declarations {
53
+ @include token-utils .use-tokens (tokens-mat-table .$prefix , tokens-mat-table .get-token-slots ()) {
54
+ .mat-mdc-header-row {
55
+ @include token-utils .create-token-slot (height , header- container- height, true);
56
+ @include token-utils .create-token-slot (color , header- headline- color, true);
57
+ @include token-utils .create-token-slot (font-family , header- headline- font, true);
58
+ @include token-utils .create-token-slot (line-height , header- headline- line- height, true);
59
+ @include token-utils .create-token-slot (font-size , header- headline- size, true);
60
+ @include token-utils .create-token-slot (letter-spacing , header- headline- tracking, true);
61
+ @include token-utils .create-token-slot (font-weight , header- headline- weight, 500 );
62
+ }
63
+
64
+ .mat-mdc-row {
65
+ @include token-utils .create-token-slot (height , row- item- container- height, true);
66
+ @include token-utils .create-token-slot (color , row- item- label- text- color, true);
67
+ @include token-utils .create-token-slot (font-family , row- item- label- text- font, true);
68
+ @include token-utils .create-token-slot (line-height , row- item- label- text- line- height);
69
+ @include token-utils .create-token-slot (font-size , row- item- label- text- size);
70
+ @include token-utils .create-token-slot (letter-spacing , row- item- label- text- tracking);
71
+ @include token-utils .create-token-slot (font-weight , row- item- label- text- weight);
72
+ }
73
+
74
+ .mat-mdc-footer-row {
75
+ @include token-utils .create-token-slot (height , footer- container- height, true);
76
+ @include token-utils .create-token-slot (color , row- item- label- text- color, true);
77
+ @include token-utils .create-token-slot (font-family , footer- supporting- text- font, true);
78
+ @include token-utils .create-token-slot (line-height , footer- supporting- text- line- height);
79
+ @include token-utils .create-token-slot (font-size , footer- supporting- text- size);
80
+ @include token-utils .create-token-slot (letter-spacing , footer- supporting- text- tracking);
81
+ @include token-utils .create-token-slot (font-weight , footer- supporting- text- weight);
82
+ }
83
+
84
+ .mat-mdc-header-cell {
85
+ @include _cell-border ;
86
+ font-weight : inherit ;
87
+ }
88
+
89
+ .mat-mdc-cell {
90
+ @include _cell-border ;
91
+
92
+ .mdc-data-table__row :last-child & {
93
+ border-bottom : none ;
94
+ }
95
+ }
96
+ }
28
97
}
29
98
30
99
// MDC table rows are styled with a top border, whereas our legacy flex table styles rows with
@@ -43,13 +112,6 @@ mat-row.mat-mdc-row, mat-header-row.mat-mdc-header-row, mat-footer-row.mat-mdc-f
43
112
background : inherit ;
44
113
}
45
114
46
- // Disable hover styling while MDC uses an opacity for its color.
47
- // When the hover style is used with sticky cells, the opacity shows the cells overlapping.
48
- .mat-mdc-table .mat-mdc-row :hover ,
49
- .mat-mdc-table .mat-mdc-footer-row :hover {
50
- background-color : inherit ;
51
- }
52
-
53
115
// Flex rows should not set a definite height, but instead stretch to the height of their
54
116
// children. Otherwise, the cells grow larger than the row and the layout breaks.
55
117
.mat-mdc-table mat-header-row .mat-mdc-header-row ,
0 commit comments