@@ -55,7 +55,7 @@ export type ProgressBarMode = 'determinate' | 'indeterminate' | 'buffer' | 'quer
55
55
'tabindex' : '-1' ,
56
56
'[attr.aria-valuenow]' : '(mode === "indeterminate" || mode === "query") ? null : value' ,
57
57
'[attr.mode]' : 'mode' ,
58
- 'class' : 'mat-mdc-progress-bar' ,
58
+ 'class' : 'mat-mdc-progress-bar mdc-linear-progress ' ,
59
59
'[class._mat-animation-noopable]' : '_isNoopAnimation' ,
60
60
} ,
61
61
inputs : [ 'color' ] ,
@@ -83,22 +83,26 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
83
83
84
84
/** Adapter used by MDC to interact with the DOM. */
85
85
private _adapter : MDCLinearProgressAdapter = {
86
- addClass : ( className : string ) => this . _rootElement . classList . add ( className ) ,
87
- forceLayout : ( ) => this . _rootElement . offsetWidth ,
88
- removeAttribute : ( name : string ) => this . _rootElement . removeAttribute ( name ) ,
89
- setAttribute : ( name : string , value : string ) => this . _rootElement . setAttribute ( name , value ) ,
90
- hasClass : ( className : string ) => this . _rootElement . classList . contains ( className ) ,
91
- removeClass : ( className : string ) => this . _rootElement . classList . remove ( className ) ,
86
+ addClass : ( className : string ) => this . _elementRef . nativeElement . classList . add ( className ) ,
87
+ forceLayout : ( ) => this . _elementRef . nativeElement . offsetWidth ,
88
+ removeAttribute : ( name : string ) => this . _elementRef . nativeElement . removeAttribute ( name ) ,
89
+ setAttribute : ( name : string , value : string ) => {
90
+ if ( name !== 'aria-valuenow' ) {
91
+ this . _elementRef . nativeElement . setAttribute ( name , value ) ;
92
+ }
93
+ } ,
94
+ hasClass : ( className : string ) => this . _elementRef . nativeElement . classList . contains ( className ) ,
95
+ removeClass : ( className : string ) => this . _elementRef . nativeElement . classList . remove ( className ) ,
92
96
setPrimaryBarStyle : ( styleProperty : string , value : string ) => {
93
97
( this . _primaryBar . style as any ) [ styleProperty ] = value ;
94
98
} ,
95
99
setBufferBarStyle : ( styleProperty : string , value : string ) => {
96
100
( this . _bufferBar . style as any ) [ styleProperty ] = value ;
97
101
} ,
98
102
setStyle : ( styleProperty : string , value : string ) => {
99
- ( this . _rootElement . style as any ) [ styleProperty ] = value ;
103
+ ( this . _elementRef . nativeElement . style as any ) [ styleProperty ] = value ;
100
104
} ,
101
- getWidth : ( ) => this . _rootElement . offsetWidth ,
105
+ getWidth : ( ) => this . _elementRef . nativeElement . offsetWidth ,
102
106
attachResizeObserver : ( callback ) => {
103
107
const resizeObserverConstructor = ( typeof window !== 'undefined' ) &&
104
108
( window as unknown as WithMDCResizeObserver ) . ResizeObserver ;
@@ -111,7 +115,7 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
111
115
// on the constructed `observer`. This should not happen, but adding this check for this
112
116
// edge case.
113
117
if ( typeof observer . observe === 'function' ) {
114
- observer . observe ( this . _rootElement ) ;
118
+ observer . observe ( this . _elementRef . nativeElement ) ;
115
119
return observer ;
116
120
}
117
121
@@ -144,7 +148,6 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
144
148
}
145
149
private _bufferValue = 0 ;
146
150
147
- private _rootElement : HTMLElement ;
148
151
private _primaryBar : HTMLElement ;
149
152
private _bufferBar : HTMLElement ;
150
153
@@ -181,7 +184,6 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
181
184
ngAfterViewInit ( ) {
182
185
const element = this . _elementRef . nativeElement ;
183
186
184
- this . _rootElement = element . querySelector ( '.mdc-linear-progress' ) as HTMLElement ;
185
187
this . _primaryBar = element . querySelector ( '.mdc-linear-progress__primary-bar' ) as HTMLElement ;
186
188
this . _bufferBar = element . querySelector ( '.mdc-linear-progress__buffer-bar' ) as HTMLElement ;
187
189
@@ -221,9 +223,9 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie
221
223
222
224
const reverse = direction === 'rtl' ? mode !== 'query' : mode === 'query' ;
223
225
const progressDirection = reverse ? 'rtl' : 'ltr' ;
224
- const currentDirection = this . _rootElement . getAttribute ( 'dir' ) ;
226
+ const currentDirection = this . _elementRef . nativeElement . getAttribute ( 'dir' ) ;
225
227
if ( currentDirection !== progressDirection ) {
226
- this . _rootElement . setAttribute ( 'dir' , progressDirection ) ;
228
+ this . _elementRef . nativeElement . setAttribute ( 'dir' , progressDirection ) ;
227
229
foundation . restartAnimation ( ) ;
228
230
}
229
231
0 commit comments