@@ -87,17 +87,17 @@ class ProgressSpinnerAdapter implements MDCCircularProgressAdapter {
87
87
}
88
88
89
89
@Component ( {
90
- selector : 'mat-progress-spinner' ,
90
+ selector : 'mat-progress-spinner, mat-spinner ' ,
91
91
exportAs : 'matProgressSpinner' ,
92
92
host : {
93
93
'role' : 'progressbar' ,
94
94
'class' : 'mat-mdc-progress-spinner' ,
95
95
'[class._mat-animation-noopable]' : `_noopAnimations` ,
96
96
'[style.width.px]' : 'diameter' ,
97
97
'[style.height.px]' : 'diameter' ,
98
- '[attr.aria-valuemin]' : 'mode === "determinate" ? 0 : null ' ,
99
- '[attr.aria-valuemax]' : 'mode === "determinate" ? 100 : null ' ,
100
- '[attr.aria-valuenow]' : 'mode === "determinate" ? value : null' ,
98
+ '[attr.aria-valuemin]' : '0 ' ,
99
+ '[attr.aria-valuemax]' : '1 ' ,
100
+ '[attr.aria-valuenow]' : 'mode === "determinate" ? value / 100 : null' ,
101
101
'[attr.mode]' : 'mode' ,
102
102
} ,
103
103
inputs : [ 'color' ] ,
@@ -108,9 +108,6 @@ class ProgressSpinnerAdapter implements MDCCircularProgressAdapter {
108
108
} )
109
109
export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements AfterViewInit ,
110
110
OnDestroy , CanColor {
111
- static ngAcceptInputType_diameter : NumberInput ;
112
- static ngAcceptInputType_strokeWidth : NumberInput ;
113
- static ngAcceptInputType_value : NumberInput ;
114
111
115
112
/** Whether the _mat-animation-noopable class should be applied, disabling animations. */
116
113
_noopAnimations : boolean ;
@@ -155,7 +152,8 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
155
152
}
156
153
}
157
154
158
- private _mode : ProgressSpinnerMode = 'determinate' ;
155
+ private _mode : ProgressSpinnerMode = this . _elementRef . nativeElement . nodeName . toLowerCase ( ) ===
156
+ 'mat-spinner' ? 'indeterminate' : 'determinate' ;
159
157
160
158
/**
161
159
* Mode of the progress bar.
@@ -165,13 +163,9 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
165
163
* Mirrored to mode attribute.
166
164
*/
167
165
@Input ( )
168
- get mode ( ) : ProgressSpinnerMode {
169
- return this . _mode ;
170
- }
166
+ get mode ( ) : ProgressSpinnerMode { return this . _mode ; }
171
167
172
168
set mode ( value : ProgressSpinnerMode ) {
173
- // Note that we don't technically need a getter and a setter here,
174
- // but we use it to match the behavior of the existing mat-progress-bar.
175
169
this . _mode = value ;
176
170
this . _syncFoundation ( ) ;
177
171
}
@@ -265,6 +259,10 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
265
259
foundation . setDeterminate ( mode === 'determinate' ) ;
266
260
}
267
261
}
262
+
263
+ static ngAcceptInputType_diameter : NumberInput ;
264
+ static ngAcceptInputType_strokeWidth : NumberInput ;
265
+ static ngAcceptInputType_value : NumberInput ;
268
266
}
269
267
270
268
/**
@@ -273,28 +271,4 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
273
271
* This is a component definition to be used as a convenience reference to create an
274
272
* indeterminate `<mat-progress-spinner>` instance.
275
273
*/
276
- @Component ( {
277
- selector : 'mat-spinner' ,
278
- host : {
279
- 'role' : 'progressbar' ,
280
- 'mode' : 'indeterminate' ,
281
- 'class' : 'mat-mdc-spinner mat-mdc-progress-spinner' ,
282
- '[class._mat-animation-noopable]' : `_noopAnimations` ,
283
- '[style.width.px]' : 'diameter' ,
284
- '[style.height.px]' : 'diameter' ,
285
- } ,
286
- inputs : [ 'color' ] ,
287
- templateUrl : 'progress-spinner.html' ,
288
- styleUrls : [ 'progress-spinner.css' ] ,
289
- changeDetection : ChangeDetectionStrategy . OnPush ,
290
- encapsulation : ViewEncapsulation . None ,
291
- } )
292
- export class MatSpinner extends MatProgressSpinner {
293
- constructor ( elementRef : ElementRef < HTMLElement > ,
294
- @Optional ( ) @Inject ( ANIMATION_MODULE_TYPE ) animationMode : string ,
295
- @Inject ( MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS )
296
- defaults ?: MatProgressSpinnerDefaultOptions ) {
297
- super ( elementRef , animationMode , defaults ) ;
298
- this . mode = 'indeterminate' ;
299
- }
300
- }
274
+ export { MatProgressSpinner as MatSpinner }
0 commit comments