@@ -74,33 +74,33 @@ class SliderAdapter implements MDCSliderAdapter {
74
74
constructor ( private _delegate : MatSlider ) { }
75
75
76
76
hasClass = ( className : string ) =>
77
- this . _delegate . getElementRef ( ) . nativeElement . classList . contains ( className ) ;
77
+ this . _delegate . _elementRef . nativeElement . classList . contains ( className )
78
78
addClass = ( className : string ) =>
79
- this . _delegate . getElementRef ( ) . nativeElement . classList . add ( className ) ;
79
+ this . _delegate . _elementRef . nativeElement . classList . add ( className )
80
80
removeClass = ( className : string ) =>
81
- this . _delegate . getElementRef ( ) . nativeElement . classList . remove ( className ) ;
82
- getAttribute = ( name : string ) => this . _delegate . getElementRef ( ) . nativeElement . getAttribute ( name ) ;
81
+ this . _delegate . _elementRef . nativeElement . classList . remove ( className )
82
+ getAttribute = ( name : string ) => this . _delegate . _elementRef . nativeElement . getAttribute ( name ) ;
83
83
setAttribute = ( name : string , value : string ) =>
84
- this . _delegate . getElementRef ( ) . nativeElement . setAttribute ( name , value ) ;
84
+ this . _delegate . _elementRef . nativeElement . setAttribute ( name , value )
85
85
removeAttribute = ( name : string ) =>
86
- this . _delegate . getElementRef ( ) . nativeElement . removeAttribute ( name ) ;
87
- computeBoundingRect = ( ) => this . _delegate . getElementRef ( ) . nativeElement . getBoundingClientRect ( ) ;
88
- getTabIndex = ( ) => this . _delegate . getElementRef ( ) . nativeElement . tabIndex ;
86
+ this . _delegate . _elementRef . nativeElement . removeAttribute ( name )
87
+ computeBoundingRect = ( ) => this . _delegate . _elementRef . nativeElement . getBoundingClientRect ( ) ;
88
+ getTabIndex = ( ) => this . _delegate . _elementRef . nativeElement . tabIndex ;
89
89
registerInteractionHandler = ( evtType : any , handler : ( this : HTMLElement , ev : any ) => any ) =>
90
90
// Interaction event handlers (which handle keyboard interaction) cannot be passive
91
91
// as they will prevent the default behavior. Additionally we can't run these event
92
92
// handlers outside of the Angular zone because we rely on the events to cause the
93
93
// component tree to be re-checked.
94
94
// TODO: take in the event listener options from the adapter once MDC supports it.
95
- this . _delegate . getElementRef ( ) . nativeElement . addEventListener (
95
+ this . _delegate . _elementRef . nativeElement . addEventListener (
96
96
evtType , handler , activeListenerOptions )
97
97
deregisterInteractionHandler = ( evtType : any , handler : ( this : HTMLElement , ev : any ) => any ) =>
98
- this . _delegate . getElementRef ( ) . nativeElement . removeEventListener ( evtType , handler )
98
+ this . _delegate . _elementRef . nativeElement . removeEventListener ( evtType , handler )
99
99
registerThumbContainerInteractionHandler =
100
100
( evtType : any , handler : ( this : HTMLElement , ev : any ) => any ) => {
101
101
// The thumb container interaction handlers are currently just used for transition
102
102
// events which don't need to run in the Angular zone.
103
- this . _delegate . getNgZone ( ) . runOutsideAngular ( ( ) => {
103
+ this . _delegate . _ngZone . runOutsideAngular ( ( ) => {
104
104
this . _delegate . _thumbContainer . nativeElement
105
105
. addEventListener ( evtType , handler , passiveListenerOptions ) ;
106
106
} ) ;
@@ -115,35 +115,35 @@ class SliderAdapter implements MDCSliderAdapter {
115
115
// prevent the default behavior. Additionally we can't run these event handlers
116
116
// outside of the Angular zone because we rely on the events to cause the component
117
117
// tree to be re-checked.
118
- document . body . addEventListener ( evtType , handler ) ;
118
+ document . body . addEventListener ( evtType , handler )
119
119
deregisterBodyInteractionHandler = ( evtType : any , handler : ( this : HTMLElement , ev : any ) => any ) =>
120
- document . body . removeEventListener ( evtType , handler ) ;
120
+ document . body . removeEventListener ( evtType , handler )
121
121
registerResizeHandler = ( handler : ( this : Window , ev : UIEvent ) => any ) => {
122
122
// The resize handler is currently responsible for detecting slider dimension
123
123
// changes and therefore doesn't cause a value change that needs to be propagated.
124
- this . _delegate . getNgZone ( ) . runOutsideAngular ( ( ) => window . addEventListener ( 'resize' , handler ) ) ;
124
+ this . _delegate . _ngZone . runOutsideAngular ( ( ) => window . addEventListener ( 'resize' , handler ) ) ;
125
125
}
126
126
deregisterResizeHandler =
127
127
( handler : ( this : Window , ev : UIEvent ) => any ) => window . removeEventListener ( 'resize' , handler )
128
128
notifyInput =
129
129
( ) => {
130
- const newValue = this . _delegate . getFoundation ( ) . getValue ( ) ;
130
+ const newValue = this . _delegate . _foundation . getValue ( ) ;
131
131
// MDC currently fires the input event multiple times.
132
132
// TODO(devversion): remove this check once the input notifications are fixed.
133
133
if ( newValue !== this . _delegate . value ) {
134
134
this . _delegate . value = newValue ;
135
135
this . _delegate . input . emit ( this . _delegate . _createChangeEvent ( newValue ) ) ;
136
136
}
137
- } ;
137
+ }
138
138
notifyChange =
139
139
( ) => {
140
140
// TODO(devversion): bug in MDC where only the "change" event is emitted if a keypress
141
141
// updated the value. Material and native range sliders also emit an input event.
142
142
// Usually we sync the "value" in the "input" event, but as a workaround we now sync
143
143
// the value in the "change" event.
144
- this . _delegate . value = this . _delegate . getFoundation ( ) . getValue ( ) ;
144
+ this . _delegate . value = this . _delegate . _foundation . getValue ( ) ;
145
145
this . _delegate . _emitChangeEvent ( this . _delegate . value ! ) ;
146
- } ;
146
+ }
147
147
setThumbContainerStyleProperty =
148
148
( propertyName : string , value : string | null ) => {
149
149
this . _delegate . _thumbContainer . nativeElement . style . setProperty ( propertyName , value ) ;
@@ -155,14 +155,14 @@ class SliderAdapter implements MDCSliderAdapter {
155
155
setMarkerValue =
156
156
( ) => {
157
157
// Mark the component for check as the thumb label needs to be re-rendered.
158
- this . _delegate . getChangeDetectorRef ( ) . markForCheck ( ) ;
158
+ this . _delegate . _changeDetectorRef . markForCheck ( ) ;
159
159
}
160
160
setTrackMarkers =
161
161
( step : number , max : number , min : number ) => {
162
162
this . _delegate . _trackMarker . nativeElement . style . setProperty (
163
163
'background' , this . _delegate . _getTrackMarkersBackground ( min , max , step ) ) ;
164
164
}
165
- isRTL = ( ) => this . _delegate . _isRtl ( )
165
+ isRTL = ( ) => this . _delegate . _isRtl ( ) ;
166
166
}
167
167
168
168
/** A simple change event emitted by the MatSlider component. */
@@ -319,7 +319,7 @@ export class MatSlider implements AfterViewInit, OnChanges, OnDestroy, ControlVa
319
319
private _sliderAdapter : MDCSliderAdapter = new SliderAdapter ( this ) ;
320
320
321
321
/** Instance of the MDC slider foundation for this slider. */
322
- private _foundation = new MDCSliderFoundation ( this . _sliderAdapter ) ;
322
+ _foundation = new MDCSliderFoundation ( this . _sliderAdapter ) ;
323
323
324
324
/** Whether the MDC foundation has been initialized. */
325
325
private _isInitialized = false ;
@@ -339,10 +339,10 @@ export class MatSlider implements AfterViewInit, OnChanges, OnDestroy, ControlVa
339
339
@ViewChild ( 'trackMarker' ) _trackMarker : ElementRef < HTMLElement > ;
340
340
341
341
constructor (
342
- private _elementRef : ElementRef < HTMLElement > ,
343
- private _changeDetectorRef : ChangeDetectorRef ,
344
- private _ngZone : NgZone ,
345
- private _platform : Platform ,
342
+ public _elementRef : ElementRef < HTMLElement > ,
343
+ public _changeDetectorRef : ChangeDetectorRef ,
344
+ public _ngZone : NgZone ,
345
+ public _platform : Platform ,
346
346
@Optional ( ) private _dir : Directionality ,
347
347
@Attribute ( 'tabindex' ) tabIndex : string ,
348
348
@Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) public _animationMode ?: string ) {
@@ -424,22 +424,6 @@ export class MatSlider implements AfterViewInit, OnChanges, OnDestroy, ControlVa
424
424
}
425
425
}
426
426
427
- getChangeDetectorRef ( ) {
428
- return this . _changeDetectorRef ;
429
- }
430
-
431
- getElementRef ( ) {
432
- return this . _elementRef ;
433
- }
434
-
435
- getFoundation ( ) {
436
- return this . _foundation ;
437
- }
438
-
439
- getNgZone ( ) {
440
- return this . _ngZone ;
441
- }
442
-
443
427
/** Focuses the slider. */
444
428
focus ( options ?: FocusOptions ) {
445
429
this . _elementRef . nativeElement . focus ( options ) ;
0 commit comments