-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(material-experimental/mdc-table): add mat-table selector #20994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* Flex-based table structure | ||
*/ | ||
$mat-header-row-height: 56px; | ||
$mat-row-height: 48px; | ||
$mat-row-horizontal-padding: 24px; | ||
|
||
// Only use tag name selectors here since the styles are shared between MDC and non-MDC | ||
@mixin mat-private-table-flex-styles { | ||
mat-table { | ||
display: block; | ||
} | ||
|
||
mat-header-row { | ||
min-height: $mat-header-row-height; | ||
} | ||
|
||
mat-row, mat-footer-row { | ||
min-height: $mat-row-height; | ||
} | ||
|
||
mat-row, mat-header-row, mat-footer-row { | ||
display: flex; | ||
// Define a border style, but then widths default to 3px. Reset them to 0px except the bottom | ||
// which should be 1px; | ||
border-width: 0; | ||
border-bottom-width: 1px; | ||
border-style: solid; | ||
align-items: center; | ||
box-sizing: border-box; | ||
|
||
// Workaround for https://goo.gl/pFmjJD in IE 11. Adds a pseudo | ||
// element that will stretch the row the correct height. See: | ||
// https://connect.microsoft.com/IE/feedback/details/802625 | ||
&::after { | ||
display: inline-block; | ||
min-height: inherit; | ||
content: ''; | ||
} | ||
} | ||
|
||
mat-cell, mat-header-cell, mat-footer-cell { | ||
// Note: we use `first-of-type`/`last-of-type` here in order to prevent extra | ||
// elements like ripples or badges from throwing off the layout (see #11165). | ||
&:first-of-type { | ||
padding-left: $mat-row-horizontal-padding; | ||
|
||
[dir='rtl'] &:not(:only-of-type) { | ||
padding-left: 0; | ||
padding-right: $mat-row-horizontal-padding; | ||
} | ||
} | ||
|
||
&:last-of-type { | ||
padding-right: $mat-row-horizontal-padding; | ||
|
||
[dir='rtl'] &:not(:only-of-type) { | ||
padding-right: 0; | ||
padding-left: $mat-row-horizontal-padding; | ||
} | ||
} | ||
} | ||
|
||
mat-cell, mat-header-cell, mat-footer-cell { | ||
flex: 1; | ||
display: flex; | ||
align-items: center; | ||
overflow: hidden; | ||
word-wrap: break-word; | ||
min-height: inherit; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking through this again, do you think that we should make these selectors a bit more specific? Currently
mat-table {}
will match both the MDC and non-MDC elements which could interfere with each other. We could change it to something likemat-table.mat-mdc-table
, but I'm not familiar enough to know whether it'll make much of a difference.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for extracting the flex styles into a mixin is so that both MDC and non-MDC table can use the styles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we want the MDC version to be using MDC's styles though? Otherwise it's basically a duplicate of our current table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MDC only has native table styles. The flexbox-based table is an Angular special.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we still want to make it work using MDC's styles? Not necessarily in this PR, but we can work with the MDC team to split their styles up into more granular mixins so we can apply it to our flexbox table too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had been assuming the only styles we were applying exclusively to the flex table were the actual flexbox styles. If there are styles common between them, we should just use the appropriate css classes for those.