Skip to content

feat(material-experimental/mdc-slider): implement MatSlider #21680

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

Conversation

wagnermaciel
Copy link
Contributor

No description provided.

@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 23, 2021
@wagnermaciel wagnermaciel added merge safe target: feature This PR is targeted for a feature branch (outside of main and semver branches) labels Jan 23, 2021
@wagnermaciel wagnermaciel force-pushed the slider-thumb-decorator branch from 188b1d9 to 6b3230c Compare January 23, 2021 16:12
* mouseenter and mouseleave events are needed for displaying ripples
* _knob and _getHostElement() will be needed for the SliderAdapter implementation
* _getThumb() will be needed to implement the ripples
@wagnermaciel wagnermaciel force-pushed the slider-thumb-decorator branch from 6b3230c to 4dfee9b Compare January 23, 2021 16:15
@wagnermaciel wagnermaciel marked this pull request as ready for review January 23, 2021 16:17
host: {
'class': 'mdc-slider__thumb',
'(mouseenter)': '_mouseenter.emit()',
'(mouseleave)': '_mouseleave.emit()',
Copy link
Member

Choose a reason for hiding this comment

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

Would these need to account for touch devices?

Copy link
Contributor Author

@wagnermaciel wagnermaciel Jan 25, 2021

Choose a reason for hiding this comment

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

Yes. Would it be acceptable for me to add a TODO here and implement the support for this in a later PR?

@wagnermaciel wagnermaciel requested a review from crisbeto January 25, 2021 16:20
@wagnermaciel
Copy link
Contributor Author

@crisbeto Ready for re-review 👍🏽

@wagnermaciel
Copy link
Contributor Author

@mmalerba Ready for re-review 👍🏽

@wagnermaciel wagnermaciel force-pushed the slider-thumb-decorator branch 2 times, most recently from 2eb606f to 290a7e9 Compare January 27, 2021 04:35
@wagnermaciel wagnermaciel requested a review from jelbourn January 27, 2021 04:36
@wagnermaciel wagnermaciel force-pushed the slider-thumb-decorator branch from 290a7e9 to 4aadced Compare January 27, 2021 16:15
@wagnermaciel wagnermaciel force-pushed the slider-thumb-decorator branch from 4aadced to 9fd3f2e Compare January 27, 2021 16:29
@wagnermaciel
Copy link
Contributor Author

@jelbourn @mmalerba Ready for re-review 👍🏽

@Input() displayWith: ((value: number) => string) | null;

/** Event emitted when a slider thumb value has changed. */
@Output() readonly change: EventEmitter<MatSliderChange> = new EventEmitter<MatSliderChange>();
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 these on the container? Can't the user just listen to change, input, etc. events on the individual thumbs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just matching the old API. I can remove them if you'd like

Copy link
Contributor

Choose a reason for hiding this comment

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

It's been a while since we discussed the API. I think we decided that we were going to try to keep most of the API but split it between the container and thumbs. That way people would need to make some changes, but hopefully they would be fairly straightforward, just adding the wrapper and moving a few properties to it. @jelbourn is that what you remember too?

Copy link
Member

Choose a reason for hiding this comment

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

Let's go with that since there are relatively few usages in Google so it should be pretty straightforward to swap

@wagnermaciel wagnermaciel requested a review from mmalerba January 27, 2021 18:46

/** Whether the slider displays tick marks along the slider track. */
@Input()
get hasTickMarks(): boolean { return this._hasTickMarks; }
Copy link
Member

Choose a reason for hiding this comment

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

What was the rationale for changing this API from the current MatSlider (which uses tickInterval for this? I also think the API would probably be something like showTickMarks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't implement tickInterval because it is not part of the MDC implementation. We'd have to add that functionality ourselves

I'm ok with renaming this to showTickMarks (again, I was just copying the variable name from the MDC foundation)

* Returns the defaultView of the injected document
* if available or fallback to global window reference.
*/
_getWindow(): Window {
Copy link
Member

Choose a reason for hiding this comment

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

What is this needed for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is used by SliderAdapter. It will be changed to a property. See this comment

@wagnermaciel
Copy link
Contributor Author

@jelbourn Ready for re-review 👍🏽

@wagnermaciel wagnermaciel force-pushed the slider-thumb-decorator branch 2 times, most recently from 1566368 to 373958d Compare January 27, 2021 22:40
* omitted code in kitchen-sink-mdc.html instead of commenting it out
* deleted the MatSliderChange class
* renamed MatSliderInteraction to MatSliderThumbInteractionEvent and made it an interface instead of a class
* renamed isDisabled to disabled
* renamed isDiscrete to discrete
* renamed hasTickMarks to showTickMarks
* removed spaces from object literals
* deleted change and input @outputs
* use properties instead of getters for _document, _window, and _hostElement
@wagnermaciel wagnermaciel added the cla: yes PR author has agreed to Google's Contributor License Agreement label Feb 2, 2021
@angular angular deleted a comment from google-cla bot Feb 2, 2021
@google-cla
Copy link

google-cla bot commented Feb 2, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla and removed cla: yes PR author has agreed to Google's Contributor License Agreement labels Feb 2, 2021
@angular angular deleted a comment from google-cla bot Feb 2, 2021
@angular angular deleted a comment from google-cla bot Feb 2, 2021
@google-cla
Copy link

google-cla bot commented Feb 2, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@angular angular deleted a comment from google-cla bot Feb 2, 2021
@google-cla
Copy link

google-cla bot commented Feb 2, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

1 similar comment
@google-cla
Copy link

google-cla bot commented Feb 2, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@wagnermaciel wagnermaciel added cla: yes PR author has agreed to Google's Contributor License Agreement and removed cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla labels Feb 2, 2021
* move MatSliderDragEvent to slider-thumb.ts
* move drag events from MatSlider to the MatSliderThumbs
* deleted _hostElement conveniece variables
* unbinded  from MatSlider
* added underscores to getValue and setValue
@google-cla
Copy link

google-cla bot commented Feb 8, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla and removed cla: yes PR author has agreed to Google's Contributor License Agreement labels Feb 8, 2021
@wagnermaciel wagnermaciel added cla: yes PR author has agreed to Google's Contributor License Agreement and removed cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla labels Feb 8, 2021
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 the action: merge The PR is ready for merge by the caretaker label Feb 8, 2021
@wagnermaciel wagnermaciel changed the title feat(material-experimental/mdc-slider): create MatSliderThumbDecorator feat(material-experimental/mdc-slider): implement MatSlider Feb 8, 2021
@wagnermaciel wagnermaciel merged commit 48c8f40 into angular:mdc-slider Feb 8, 2021
wagnermaciel added a commit to wagnermaciel/components that referenced this pull request Feb 8, 2021
wagnermaciel added a commit to wagnermaciel/components that referenced this pull request Feb 17, 2021
wagnermaciel added a commit to wagnermaciel/components that referenced this pull request Feb 17, 2021
wagnermaciel added a commit to wagnermaciel/components that referenced this pull request Mar 4, 2021
@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 Mar 11, 2021
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 target: feature This PR is targeted for a feature branch (outside of main and semver branches)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants