Skip to content

feat(material-experimental): add MDC-based mat-option and mdc-core entry point #19557

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 1 commit into from
Jul 29, 2020

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Jun 7, 2020

  • Sets up the MDC-based mat-option and mat-optgroup which are a prerequisite for the MDC-based mat-select and mat-autocomplete.
  • Adds a new mdc-core entry point which is the equivalent of material/core. We'll need this in the future for other things like an MDC-based mat-core-theme and for the elevation styles.

@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release labels Jun 7, 2020
@crisbeto crisbeto requested review from jelbourn, mmalerba and a team as code owners June 7, 2020 07:06
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 7, 2020
@crisbeto crisbeto force-pushed the mdc-option branch 2 times, most recently from 02af64c to 1bb841e Compare June 7, 2020 07:33
MatOptionSelectionChange,
MatOptionParentComponent,
MAT_OPTION_PARENT_COMPONENT,
_countGroupLabelsBeforeOption,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to re-export these internal things?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's something we're reusing in mat-select and mat-autocomplete.

<span class="mdc-list-item__text">{{ label }} <ng-content></ng-content></span>
</label>

<ng-content select="mat-option, ng-container"></ng-content>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, do we include ng-container in the existing version too? Feels kinda yucky, but I can see why we'd do that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what we have in the current version. It's there, because sometimes people wrap multiple options in an ng-container so they can use a single ngIf rather than having to repeat it on each option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I figured, wish Angular could fix it somehow instead of us trying to work around it. It works in this case because we can pretty much assume we know where the user is trying to put the ng-container, but its not always so clear

@crisbeto
Copy link
Member Author

crisbeto commented Jun 9, 2020

I've reworked the PR based on the feedback.

Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mmalerba mmalerba added lgtm action: merge The PR is ready for merge by the caretaker labels Jun 9, 2020

.mat-mdc-option {
// Note that we include this private mixin, because the public
// one adds a bunch of styles that we aren't using for the menu.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a follow-up: It might be good capturing things we actually need. If we come back to this in the future, we don't know what is actually needed / what the public mixin currently provides that we don't need.

…try point

- Sets up the MDC-based `mat-option` and `mat-optgroup` which are a prerequisite for the MDC-based `mat-select` and `mat-autocomplete`.
- Adds a new `mdc-core` entry point which is the equivalent of `material/core`. We'll need this in the future for other things like an MDC-based `mat-core-theme` and for the elevation styles.
@jelbourn jelbourn merged commit d1607cb into angular:master Jul 29, 2020
jelbourn pushed a commit that referenced this pull request Jul 29, 2020
…try point (#19557)

- Sets up the MDC-based `mat-option` and `mat-optgroup` which are a prerequisite for the MDC-based `mat-select` and `mat-autocomplete`.
- Adds a new `mdc-core` entry point which is the equivalent of `material/core`. We'll need this in the future for other things like an MDC-based `mat-core-theme` and for the elevation styles.

(cherry picked from commit d1607cb)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants