|
6 | 6 | * found in the LICENSE file at https://angular.io/license |
7 | 7 | */ |
8 | 8 |
|
| 9 | +import {Directionality} from '@angular/cdk/bidi'; |
9 | 10 | import { |
| 11 | + AfterViewInit, |
10 | 12 | ChangeDetectionStrategy, |
11 | 13 | Component, |
12 | | - ViewEncapsulation, |
13 | 14 | ElementRef, |
14 | | - NgZone, |
15 | | - Optional, |
| 15 | + EventEmitter, |
16 | 16 | Inject, |
17 | 17 | Input, |
18 | | - Output, |
19 | | - EventEmitter, |
20 | | - AfterViewInit, |
| 18 | + NgZone, |
21 | 19 | OnDestroy, |
| 20 | + Optional, |
| 21 | + Output, |
| 22 | + ViewEncapsulation, |
22 | 23 | } from '@angular/core'; |
23 | 24 | import {CanColor, CanColorCtor, mixinColor} from '@angular/material-experimental/mdc-core'; |
24 | | -import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations'; |
25 | 25 | import {ProgressAnimationEnd} from '@angular/material/progress-bar'; |
26 | | -import {MDCLinearProgressAdapter, MDCLinearProgressFoundation} from '@material/linear-progress'; |
27 | | -import {Subscription, fromEvent, Observable} from 'rxjs'; |
| 26 | +import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations'; |
| 27 | +import { |
| 28 | + MDCLinearProgressAdapter, |
| 29 | + MDCLinearProgressFoundation, |
| 30 | + WithMDCResizeObserver |
| 31 | +} from '@material/linear-progress'; |
| 32 | +import {fromEvent, Observable, Subscription} from 'rxjs'; |
28 | 33 | import {filter} from 'rxjs/operators'; |
29 | | -import {Directionality} from '@angular/cdk/bidi'; |
| 34 | + |
30 | 35 |
|
31 | 36 | // Boilerplate for applying mixins to MatProgressBar. |
32 | 37 | /** @docs-private */ |
@@ -93,10 +98,12 @@ export class MatProgressBar extends _MatProgressBarMixinBase implements AfterVie |
93 | 98 | }, |
94 | 99 | getWidth: () => this._rootElement.offsetWidth, |
95 | 100 | attachResizeObserver: (callback) => { |
96 | | - if ((typeof window !== 'undefined') && window.ResizeObserver) { |
97 | | - const ro = new ResizeObserver(callback); |
98 | | - ro.observe(this._rootElement); |
99 | | - return ro; |
| 101 | + if ((typeof window !== 'undefined') && |
| 102 | + (window as unknown as WithMDCResizeObserver).ResizeObserver) { |
| 103 | + const ResizeObserver = (window as unknown as WithMDCResizeObserver).ResizeObserver; |
| 104 | + const resizeObserver = new ResizeObserver(callback); |
| 105 | + resizeObserver.observe(this._rootElement); |
| 106 | + return resizeObserver; |
100 | 107 | } |
101 | 108 |
|
102 | 109 | return null; |
|
0 commit comments