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
feat(material-experimental/mdc-select): implement MDC-based mat-select #20502
Conversation
export declare const MAT_SELECT_TRIGGER: InjectionToken<MatSelectTrigger>; | ||
|
||
export declare class MatSelect extends _MatSelectMixinBase implements AfterContentInit, OnChanges, OnDestroy, OnInit, DoCheck, ControlValueAccessor, CanDisable, HasTabIndex, MatFormFieldControl<any>, CanUpdateErrorState, CanDisableRipple { | ||
export declare abstract class _MatSelectBase extends _MatSelectMixinBase implements AfterContentInit, OnChanges, OnDestroy, OnInit, DoCheck, ControlValueAccessor, CanDisable, HasTabIndex, MatFormFieldControl<any>, CanUpdateErrorState, CanDisableRipple { |
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.
All of these API changes are due to me moving the logic into a base class.
150d402
to
2aa1adc
Compare
2aa1adc
to
6db9de9
Compare
The feedback has been addressed. |
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.
LGTM
Please address the last comment before marking merge ready |
6db9de9
to
1339ad7
Compare
@crisbeto Is |
@wagnermaciel does that case throw a compilation error? I would've expected it not to complain since |
@crisbeto Yes, I ended up getting a compilation error shortly after writing that comment but I didn't get a chance to update you. It is blocking so please let me know what that line should now look like |
1339ad7
to
fb51226
Compare
I've reworked it to avoid the compilation error. |
be3b862
to
de82de6
Compare
de82de6
to
b6b3f2b
Compare
Implements `mat-select` on top of MDC Web's styles. The new select is functionally identical to the current one since both are implemented on top of the same base class, but they have the following differences: * The logic that tries to position the selected option on top of the trigger has been removed from the MDC version. Now we only position the panel above or below, depending on the available space. * Since we don't have to deal with the panel positioning logic anymore, we can now allow the text of `mat-option` to wrap to multiple lines inside the MDC version. * The animations of the MDC version are simplified to mimic the ones from `mat-menu`, because the previous animations where tightly coupled to the old overlay positioning logic. Aside from the new select, this PR includes the following fixes: * The `MatOptionSelectionChange.source` is now typed to the generic `_MatOptionBase` rather than the non-MDC implementation. This was an oversight when the base class was first implemented. * Uses `min-height` instead of `height` for the MDC `mat-option` in order to handle multi-line text better. * Adds the `mat-form-field-hide-placeholder`, `mat-form-field-appearance-outline` and `mat-form-field-appearance-fill` classes which were missing from the MDC form field. They're necessary so that the select can be styled to look correctly across all supported use cases. * The dev app for the select has been reorganized to emphasize `mat-select`, instead of `mat-form-field` with a native `select`. I've also cleaned up the styles so everything aligns better and nicer to look at.
b6b3f2b
to
b2fb859
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Implements
mat-select
on top of MDC Web's styles. The new select is functionally identical to the current one since both are implemented on top of the same base class, but they have the following differences:mat-option
to wrap to multiple lines inside the MDC version.mat-menu
, because the previous animations were tightly coupled to the old overlay positioning logic.Aside from the new select, this PR includes the following fixes:
MatOptionSelectionChange.source
is now typed to the generic_MatOptionBase
rather than the non-MDC implementation. This was an oversight when the base class was first implemented.min-height
instead ofheight
for the MDCmat-option
in order to handle multi-line text better.mat-form-field-hide-placeholder
,mat-form-field-appearance-outline
andmat-form-field-appearance-fill
classes which were missing from the MDC form field. They're necessary so that the select can be styled to look correctly across all supported use cases.mat-select
, instead ofmat-form-field
with a nativeselect
. I've also cleaned up the styles so everything aligns better and is nicer to look at.Note: I'll add the test harness as a follow-up since the PR is fairly large already.