Skip to content

Commit

Permalink
feat(slider): rename isDiscrete to discrete; hasMarkers to markers
Browse files Browse the repository at this point in the history
BREAKING CHANGE: rename mdcSlider property isDiscrete to discrete,
rename mdcSlider property hasMarkers to markers
  • Loading branch information
gjdev committed May 22, 2018
1 parent 03ca89e commit 5c9fa82
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions bundle/src/components/slider/mdc.slider.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class MdcSliderDirective implements AfterContentInit, AfterViewInit, OnCh

_onChanges(changes: SimpleChanges, callValueAccessorOnValueChange = true) {
if (this._initialized) {
if (this.isChanged('isDiscrete', changes) || this.isChanged('hasMarkers', changes)) {
if (this.isChanged('discrete', changes) || this.isChanged('markers', changes)) {
for (let handlerInfo of this._interactionHandlers)
// workaround for uspstream bug: https://github.com/material-components/material-components-web/issues/1429
this._registry.unlisten(handlerInfo.type, handlerInfo.handler);
Expand Down Expand Up @@ -355,25 +355,25 @@ export class MdcSliderDirective implements AfterContentInit, AfterViewInit, OnCh
* "Discrete slider" is a UX treatment, while having a step value is behavioral.</blockquote>
*/
@Input() @HostBinding('class.mdc-slider--discrete')
get isDiscrete() {
get discrete() {
return this._discrete;
}

set isDiscrete(value: any) {
set discrete(value: any) {
this._discrete = asBoolean(value);
}

/**
* Property to enable/disable the display of track markers. Display markers
* are only supported for discrete sliders. Thus they are only shown when the values
* of both hasMarkers and isDiscrete equal true.
* of both markers and discrete equal true.
*/
@Input() @HostBinding('class.mdc-slider--display-markers')
get hasMarkers() {
get markers() {
return this._markers;
}

set hasMarkers(value: any) {
set markers(value: any) {
this._markers = asBoolean(value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div [mdcElevation]="elevation" [animateTransition]="animate" class="blox-elevation-surface">Elevated {{elevation}}dp</div>
<section>
<div mdcSlider aria-label="Change Elevation" mdcScrollbarResize
minValue="0" maxValue="24" stepValue="1" isDiscrete hasMarkers [(value)]="elevation"></div>
minValue="0" maxValue="24" stepValue="1" discrete markers [(value)]="elevation"></div>
<div mdcFormField>
<div mdcCheckbox>
<input mdcCheckboxInput type="checkbox" [(ngModel)]="animate"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<div mdcSlider aria-label="Select Value"
[(minValue)]="min" [(maxValue)]="max" [(stepValue)]="step"
[isDiscrete]="discrete" [hasMarkers]="markers"
[discrete]="discrete" [markers]="markers"
[(ngModel)]="value" [disabled]="disabled"></div>
</div>
<p>Customize slider:</p>
Expand Down

0 comments on commit 5c9fa82

Please sign in to comment.