@@ -88,7 +88,7 @@ export class MatSliderThumb implements AfterViewInit {
88
88
// If the foundation has already been initialized, we need to
89
89
// relay any value updates to it so that it can update the UI.
90
90
if ( this . _slider . _initialized ) {
91
- this . _slider . _setValue ( value , this . _thumb ) ;
91
+ this . _slider . _setValue ( value , this . _thumbPosition ) ;
92
92
} else {
93
93
// Setup for the MDC foundation.
94
94
this . _elementRef . nativeElement . setAttribute ( 'value' , `${ value } ` ) ;
@@ -110,7 +110,7 @@ export class MatSliderThumb implements AfterViewInit {
110
110
@Output ( ) readonly _focus : EventEmitter < void > = new EventEmitter < void > ( ) ;
111
111
112
112
/** Indicates which slider thumb this input corresponds to. */
113
- private _thumb : Thumb = this . _elementRef . nativeElement . hasAttribute ( 'matSliderStartThumb' )
113
+ private _thumbPosition : Thumb = this . _elementRef . nativeElement . hasAttribute ( 'matSliderStartThumb' )
114
114
? Thumb . START
115
115
: Thumb . END ;
116
116
@@ -351,8 +351,8 @@ export class MatSlider implements AfterViewInit, OnDestroy {
351
351
}
352
352
353
353
/** Sets the value of a slider thumb. */
354
- _setValue ( value : number , thumb : Thumb ) : void {
355
- thumb === Thumb . START
354
+ _setValue ( value : number , thumbPosition : Thumb ) : void {
355
+ thumbPosition === Thumb . START
356
356
? this . _foundation . setValueStart ( value )
357
357
: this . _foundation . setValue ( value ) ;
358
358
}
@@ -362,41 +362,43 @@ export class MatSlider implements AfterViewInit, OnDestroy {
362
362
return this . _inputs . length === 2 ;
363
363
}
364
364
365
- /** Gets the slider thumb input of the given thumb. */
366
- _getInput ( thumb : Thumb ) : MatSliderThumb {
367
- return thumb === Thumb . END ? this . _inputs . last ! : this . _inputs . first ! ;
365
+ /** Gets the slider thumb input of the given thumb position . */
366
+ _getInput ( thumbPosition : Thumb ) : MatSliderThumb {
367
+ return thumbPosition === Thumb . END ? this . _inputs . last ! : this . _inputs . first ! ;
368
368
}
369
369
370
- /** Gets the slider thumb HTML input element of the given thumb. */
371
- _getInputElement ( thumb : Thumb ) : HTMLInputElement {
372
- return this . _getInput ( thumb ) . _elementRef . nativeElement ;
370
+ /** Gets the slider thumb HTML input element of the given thumb position . */
371
+ _getInputElement ( thumbPosition : Thumb ) : HTMLInputElement {
372
+ return this . _getInput ( thumbPosition ) . _elementRef . nativeElement ;
373
373
}
374
374
375
- /** Gets the slider thumb HTML element of the given thumb. */
376
- _getThumbElement ( thumb : Thumb ) : HTMLElement {
377
- const thumbElementRef = thumb === Thumb . END ? this . _thumbs . last : this . _thumbs . first ;
375
+ /** Gets the slider thumb HTML element of the given thumb position . */
376
+ _getThumbElement ( thumbPosition : Thumb ) : HTMLElement {
377
+ const thumbElementRef = thumbPosition === Thumb . END ? this . _thumbs . last : this . _thumbs . first ;
378
378
return thumbElementRef . nativeElement ;
379
379
}
380
380
381
- /** Gets the slider knob HTML element of the given thumb. */
382
- _getKnobElement ( thumb : Thumb ) : HTMLElement {
383
- const knobElementRef = thumb === Thumb . END ? this . _knobs . last : this . _knobs . first ;
381
+ /** Gets the slider knob HTML element of the given thumb position . */
382
+ _getKnobElement ( thumbPosition : Thumb ) : HTMLElement {
383
+ const knobElementRef = thumbPosition === Thumb . END ? this . _knobs . last : this . _knobs . first ;
384
384
return knobElementRef . nativeElement ;
385
385
}
386
386
387
- _getValueIndicatorText ( thumb : Thumb ) {
388
- return thumb === Thumb . START ? this . _startValueIndicatorText : this . _endValueIndicatorText ;
387
+ _getValueIndicatorText ( thumbPosition : Thumb ) {
388
+ return thumbPosition === Thumb . START
389
+ ? this . _startValueIndicatorText
390
+ : this . _endValueIndicatorText ;
389
391
}
390
392
391
393
/**
392
- * Sets the value indicator text of the given thumb using the given value.
394
+ * Sets the value indicator text of the given thumb position using the given value.
393
395
*
394
396
* Uses the `displayWith` function if one has been provided. Otherwise, it just uses the
395
397
* numeric value as a string.
396
398
*/
397
- _setValueIndicatorText ( value : number , thumb : Thumb ) {
399
+ _setValueIndicatorText ( value : number , thumbPosition : Thumb ) {
398
400
const valueText = this . displayWith ? this . displayWith ( value ) : `${ value } ` ;
399
- thumb === Thumb . START
401
+ thumbPosition === Thumb . START
400
402
? this . _startValueIndicatorText = valueText
401
403
: this . _endValueIndicatorText = valueText ;
402
404
}
@@ -441,40 +443,40 @@ class SliderAdapter implements MDCSliderAdapter {
441
443
getAttribute = ( attribute : string ) : string | null => {
442
444
return this . _delegate . _elementRef . nativeElement . getAttribute ( attribute ) ;
443
445
}
444
- addThumbClass = ( className : string , thumb : Thumb ) : void => {
445
- this . _delegate . _getThumbElement ( thumb ) . classList . add ( className ) ;
446
+ addThumbClass = ( className : string , thumbPosition : Thumb ) : void => {
447
+ this . _delegate . _getThumbElement ( thumbPosition ) . classList . add ( className ) ;
446
448
}
447
- removeThumbClass = ( className : string , thumb : Thumb ) : void => {
448
- this . _delegate . _getThumbElement ( thumb ) . classList . remove ( className ) ;
449
+ removeThumbClass = ( className : string , thumbPosition : Thumb ) : void => {
450
+ this . _delegate . _getThumbElement ( thumbPosition ) . classList . remove ( className ) ;
449
451
}
450
- getInputValue = ( thumb : Thumb ) : string => {
451
- return this . _delegate . _getInputElement ( thumb ) . value ;
452
+ getInputValue = ( thumbPosition : Thumb ) : string => {
453
+ return this . _delegate . _getInputElement ( thumbPosition ) . value ;
452
454
}
453
- setInputValue = ( value : string , thumb : Thumb ) : void => {
454
- this . _delegate . _getInputElement ( thumb ) . value = value ;
455
+ setInputValue = ( value : string , thumbPosition : Thumb ) : void => {
456
+ this . _delegate . _getInputElement ( thumbPosition ) . value = value ;
455
457
}
456
- getInputAttribute = ( attribute : string , thumb : Thumb ) : string | null => {
457
- return this . _delegate . _getInputElement ( thumb ) . getAttribute ( attribute ) ;
458
+ getInputAttribute = ( attribute : string , thumbPosition : Thumb ) : string | null => {
459
+ return this . _delegate . _getInputElement ( thumbPosition ) . getAttribute ( attribute ) ;
458
460
}
459
- setInputAttribute = ( attribute : string , value : string , thumb : Thumb ) : void => {
460
- this . _delegate . _getInputElement ( thumb ) . setAttribute ( attribute , value ) ;
461
+ setInputAttribute = ( attribute : string , value : string , thumbPosition : Thumb ) : void => {
462
+ this . _delegate . _getInputElement ( thumbPosition ) . setAttribute ( attribute , value ) ;
461
463
}
462
- removeInputAttribute = ( attribute : string , thumb : Thumb ) : void => {
463
- this . _delegate . _getInputElement ( thumb ) . removeAttribute ( attribute ) ;
464
+ removeInputAttribute = ( attribute : string , thumbPosition : Thumb ) : void => {
465
+ this . _delegate . _getInputElement ( thumbPosition ) . removeAttribute ( attribute ) ;
464
466
}
465
- focusInput = ( thumb : Thumb ) : void => {
466
- this . _delegate . _getInputElement ( thumb ) . focus ( ) ;
467
+ focusInput = ( thumbPosition : Thumb ) : void => {
468
+ this . _delegate . _getInputElement ( thumbPosition ) . focus ( ) ;
467
469
}
468
- isInputFocused = ( thumb : Thumb ) : boolean => {
469
- return this . _delegate . _getInput ( thumb ) . _isFocused ( ) ;
470
+ isInputFocused = ( thumbPosition : Thumb ) : boolean => {
471
+ return this . _delegate . _getInput ( thumbPosition ) . _isFocused ( ) ;
470
472
}
471
- getThumbKnobWidth = ( thumb : Thumb ) : number => {
473
+ getThumbKnobWidth = ( thumbPosition : Thumb ) : number => {
472
474
// TODO(wagnermaciel): Check if this causes issues for SSR
473
475
// once the mdc-slider is added back to the kitchen sink SSR app.
474
- return this . _delegate . _getKnobElement ( thumb ) . getBoundingClientRect ( ) . width ;
476
+ return this . _delegate . _getKnobElement ( thumbPosition ) . getBoundingClientRect ( ) . width ;
475
477
}
476
- getThumbBoundingClientRect = ( thumb : Thumb ) : ClientRect => {
477
- return this . _delegate . _getThumbElement ( thumb ) . getBoundingClientRect ( ) ;
478
+ getThumbBoundingClientRect = ( thumbPosition : Thumb ) : ClientRect => {
479
+ return this . _delegate . _getThumbElement ( thumbPosition ) . getBoundingClientRect ( ) ;
478
480
}
479
481
getBoundingClientRect = ( ) : ClientRect => {
480
482
return this . _delegate . _elementRef . nativeElement . getBoundingClientRect ( ) ;
@@ -483,20 +485,20 @@ class SliderAdapter implements MDCSliderAdapter {
483
485
// TODO(wagnermaciel): Actually implementing this.
484
486
return false ;
485
487
}
486
- setThumbStyleProperty = ( propertyName : string , value : string , thumb : Thumb ) : void => {
487
- this . _delegate . _getThumbElement ( thumb ) . style . setProperty ( propertyName , value ) ;
488
+ setThumbStyleProperty = ( propertyName : string , value : string , thumbPosition : Thumb ) : void => {
489
+ this . _delegate . _getThumbElement ( thumbPosition ) . style . setProperty ( propertyName , value ) ;
488
490
}
489
- removeThumbStyleProperty = ( propertyName : string , thumb : Thumb ) : void => {
490
- this . _delegate . _getThumbElement ( thumb ) . style . removeProperty ( propertyName ) ;
491
+ removeThumbStyleProperty = ( propertyName : string , thumbPosition : Thumb ) : void => {
492
+ this . _delegate . _getThumbElement ( thumbPosition ) . style . removeProperty ( propertyName ) ;
491
493
}
492
494
setTrackActiveStyleProperty = ( propertyName : string , value : string ) : void => {
493
495
this . _delegate . _trackActive . nativeElement . style . setProperty ( propertyName , value ) ;
494
496
}
495
497
removeTrackActiveStyleProperty = ( propertyName : string ) : void => {
496
498
this . _delegate . _trackActive . nativeElement . style . removeProperty ( propertyName ) ;
497
499
}
498
- setValueIndicatorText = ( value : number , thumb : Thumb ) : void => {
499
- this . _delegate . _setValueIndicatorText ( value , thumb ) ;
500
+ setValueIndicatorText = ( value : number , thumbPosition : Thumb ) : void => {
501
+ this . _delegate . _setValueIndicatorText ( value , thumbPosition ) ;
500
502
}
501
503
getValueToAriaValueTextFn = ( ) : ( ( value : number ) => string ) | null => {
502
504
return this . _delegate . displayWith ;
@@ -510,14 +512,14 @@ class SliderAdapter implements MDCSliderAdapter {
510
512
}
511
513
// We ignore emitChangeEvent and emitInputEvent because the slider inputs
512
514
// are already exposed so users can just listen for those events directly themselves.
513
- emitChangeEvent = ( value : number , thumb : Thumb ) : void => { } ;
514
- emitInputEvent = ( value : number , thumb : Thumb ) : void => { } ;
515
- emitDragStartEvent = ( value : number , thumb : Thumb ) : void => {
516
- const input = this . _delegate . _getInput ( thumb ) ;
515
+ emitChangeEvent = ( value : number , thumbPosition : Thumb ) : void => { } ;
516
+ emitInputEvent = ( value : number , thumbPosition : Thumb ) : void => { } ;
517
+ emitDragStartEvent = ( value : number , thumbPosition : Thumb ) : void => {
518
+ const input = this . _delegate . _getInput ( thumbPosition ) ;
517
519
input . dragStart . emit ( { source : input , parent : this . _delegate , value } ) ;
518
520
}
519
- emitDragEndEvent = ( value : number , thumb : Thumb ) : void => {
520
- const input = this . _delegate . _getInput ( thumb ) ;
521
+ emitDragEndEvent = ( value : number , thumbPosition : Thumb ) : void => {
522
+ const input = this . _delegate . _getInput ( thumbPosition ) ;
521
523
input . dragEnd . emit ( { source : input , parent : this . _delegate , value } ) ;
522
524
}
523
525
registerEventHandler =
@@ -528,21 +530,21 @@ class SliderAdapter implements MDCSliderAdapter {
528
530
< K extends EventType > ( evtType : K , handler : SpecificEventListener < K > ) : void => {
529
531
this . _delegate . _elementRef . nativeElement . removeEventListener ( evtType , handler ) ;
530
532
}
531
- registerThumbEventHandler =
532
- < K extends EventType > ( thumb : Thumb , evtType : K , handler : SpecificEventListener < K > ) : void => {
533
- this . _delegate . _getThumbElement ( thumb ) . addEventListener ( evtType , handler ) ;
533
+ registerThumbEventHandler = < K extends EventType >
534
+ ( thumbPosition : Thumb , evtType : K , handler : SpecificEventListener < K > ) : void => {
535
+ this . _delegate . _getThumbElement ( thumbPosition ) . addEventListener ( evtType , handler ) ;
534
536
}
535
- deregisterThumbEventHandler =
536
- < K extends EventType > ( thumb : Thumb , evtType : K , handler : SpecificEventListener < K > ) : void => {
537
- this . _delegate . _getThumbElement ( thumb ) . removeEventListener ( evtType , handler ) ;
537
+ deregisterThumbEventHandler = < K extends EventType >
538
+ ( thumbPosition : Thumb , evtType : K , handler : SpecificEventListener < K > ) : void => {
539
+ this . _delegate . _getThumbElement ( thumbPosition ) . removeEventListener ( evtType , handler ) ;
538
540
}
539
- registerInputEventHandler =
540
- < K extends EventType > ( thumb : Thumb , evtType : K , handler : SpecificEventListener < K > ) : void => {
541
- this . _delegate . _getInputElement ( thumb ) . addEventListener ( evtType , handler ) ;
541
+ registerInputEventHandler = < K extends EventType >
542
+ ( thumbPosition : Thumb , evtType : K , handler : SpecificEventListener < K > ) : void => {
543
+ this . _delegate . _getInputElement ( thumbPosition ) . addEventListener ( evtType , handler ) ;
542
544
}
543
- deregisterInputEventHandler =
544
- < K extends EventType > ( thumb : Thumb , evtType : K , handler : SpecificEventListener < K > ) : void => {
545
- this . _delegate . _getInputElement ( thumb ) . removeEventListener ( evtType , handler ) ;
545
+ deregisterInputEventHandler = < K extends EventType >
546
+ ( thumbPosition : Thumb , evtType : K , handler : SpecificEventListener < K > ) : void => {
547
+ this . _delegate . _getInputElement ( thumbPosition ) . removeEventListener ( evtType , handler ) ;
546
548
}
547
549
registerBodyEventHandler =
548
550
< K extends EventType > ( evtType : K , handler : SpecificEventListener < K > ) : void => {
0 commit comments