6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
+ import { AnimationEvent } from '@angular/animations' ;
10
+ import { FocusTrap , FocusTrapFactory , InteractivityChecker } from '@angular/cdk/a11y' ;
11
+ import { coerceArray } from '@angular/cdk/coercion' ;
12
+ import { BreakpointObserver , Breakpoints } from '@angular/cdk/layout' ;
13
+ import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform' ;
14
+ import {
15
+ BasePortalOutlet ,
16
+ CdkPortalOutlet ,
17
+ ComponentPortal ,
18
+ DomPortal ,
19
+ TemplatePortal ,
20
+ } from '@angular/cdk/portal' ;
21
+ import { DOCUMENT } from '@angular/common' ;
9
22
import {
23
+ ChangeDetectionStrategy ,
24
+ ChangeDetectorRef ,
10
25
Component ,
11
26
ComponentRef ,
12
- EmbeddedViewRef ,
13
- ViewChild ,
14
- OnDestroy ,
15
27
ElementRef ,
16
- ChangeDetectionStrategy ,
17
- ViewEncapsulation ,
18
- ChangeDetectorRef ,
28
+ EmbeddedViewRef ,
19
29
EventEmitter ,
20
30
Inject ,
21
- Optional ,
22
31
NgZone ,
32
+ OnDestroy ,
33
+ Optional ,
34
+ ViewChild ,
35
+ ViewEncapsulation ,
23
36
} from '@angular/core' ;
24
- import { AnimationEvent } from '@angular/animations' ;
25
- import {
26
- BasePortalOutlet ,
27
- ComponentPortal ,
28
- TemplatePortal ,
29
- CdkPortalOutlet ,
30
- DomPortal ,
31
- } from '@angular/cdk/portal' ;
32
- import { BreakpointObserver , Breakpoints } from '@angular/cdk/layout' ;
33
- import { MatBottomSheetConfig } from './bottom-sheet-config' ;
34
- import { matBottomSheetAnimations } from './bottom-sheet-animations' ;
35
37
import { Subscription } from 'rxjs' ;
36
- import { DOCUMENT } from '@angular/common' ;
37
- import { FocusTrap , FocusTrapFactory , InteractivityChecker } from '@angular/cdk/a11y' ;
38
- import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform' ;
38
+ import { matBottomSheetAnimations } from './bottom-sheet-animations' ;
39
+ import { MatBottomSheetConfig } from './bottom-sheet-config' ;
39
40
40
41
// TODO(crisbeto): consolidate some logic between this, MatDialog and MatSnackBar
41
42
@@ -178,8 +179,7 @@ export class MatBottomSheetContainer extends BasePortalOutlet implements OnDestr
178
179
}
179
180
180
181
private _toggleClass ( cssClass : string , add : boolean ) {
181
- const classList = this . _elementRef . nativeElement . classList ;
182
- add ? classList . add ( cssClass ) : classList . remove ( cssClass ) ;
182
+ this . _elementRef . nativeElement . classList . toggle ( cssClass , add ) ;
183
183
}
184
184
185
185
private _validatePortalAttached ( ) {
@@ -190,14 +190,7 @@ export class MatBottomSheetContainer extends BasePortalOutlet implements OnDestr
190
190
191
191
private _setPanelClass ( ) {
192
192
const element : HTMLElement = this . _elementRef . nativeElement ;
193
- const panelClass = this . bottomSheetConfig . panelClass ;
194
-
195
- if ( Array . isArray ( panelClass ) ) {
196
- // Note that we can't use a spread here, because IE doesn't support multiple arguments.
197
- panelClass . forEach ( cssClass => element . classList . add ( cssClass ) ) ;
198
- } else if ( panelClass ) {
199
- element . classList . add ( panelClass ) ;
200
- }
193
+ element . classList . add ( ...coerceArray ( this . bottomSheetConfig . panelClass || [ ] ) ) ;
201
194
}
202
195
203
196
/**
0 commit comments