-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
feat(material-experimental/mdc-slider): implement MatSlider #21680
Conversation
188b1d9
to
6b3230c
Compare
* 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
6b3230c
to
4dfee9b
Compare
host: { | ||
'class': 'mdc-slider__thumb', | ||
'(mouseenter)': '_mouseenter.emit()', | ||
'(mouseleave)': '_mouseleave.emit()', |
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.
Would these need to account for touch devices?
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.
Yes. Would it be acceptable for me to add a TODO here and implement the support for this in a later PR?
@crisbeto Ready for re-review 👍🏽 |
@mmalerba Ready for re-review 👍🏽 |
src/material-experimental/mdc-slider/slider-thumb-decorator.html
Outdated
Show resolved
Hide resolved
src/material-experimental/mdc-slider/slider-thumb-decorator.html
Outdated
Show resolved
Hide resolved
2eb606f
to
290a7e9
Compare
290a7e9
to
4aadced
Compare
4aadced
to
9fd3f2e
Compare
@Input() displayWith: ((value: number) => string) | null; | ||
|
||
/** Event emitted when a slider thumb value has changed. */ | ||
@Output() readonly change: EventEmitter<MatSliderChange> = new EventEmitter<MatSliderChange>(); |
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.
Do we need these on the container? Can't the user just listen to change
, input
, etc. events on the individual thumbs?
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 was just matching the old API. I can remove them if you'd like
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.
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?
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.
Let's go with that since there are relatively few usages in Google so it should be pretty straightforward to swap
|
||
/** Whether the slider displays tick marks along the slider track. */ | ||
@Input() | ||
get hasTickMarks(): boolean { return this._hasTickMarks; } |
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.
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
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 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 { |
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.
What is this needed for?
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.
It is used by SliderAdapter
. It will be changed to a property. See this comment
@jelbourn Ready for re-review 👍🏽 |
1566368
to
373958d
Compare
* 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
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. ℹ️ Googlers: Go here for more info. |
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. ℹ️ Googlers: Go here for more info. |
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. ℹ️ Googlers: Go here for more info. |
1 similar comment
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. ℹ️ Googlers: Go here for more info. |
* 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
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. ℹ️ Googlers: Go here for more info. |
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
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. |
No description provided.