66 * found in the LICENSE file at https://angular.io/license
77 */
88
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' ;
922import {
23+ ChangeDetectionStrategy ,
24+ ChangeDetectorRef ,
1025 Component ,
1126 ComponentRef ,
12- EmbeddedViewRef ,
13- ViewChild ,
14- OnDestroy ,
1527 ElementRef ,
16- ChangeDetectionStrategy ,
17- ViewEncapsulation ,
18- ChangeDetectorRef ,
28+ EmbeddedViewRef ,
1929 EventEmitter ,
2030 Inject ,
21- Optional ,
2231 NgZone ,
32+ OnDestroy ,
33+ Optional ,
34+ ViewChild ,
35+ ViewEncapsulation ,
2336} 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' ;
3537import { 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' ;
3940
4041// TODO(crisbeto): consolidate some logic between this, MatDialog and MatSnackBar
4142
@@ -178,8 +179,7 @@ export class MatBottomSheetContainer extends BasePortalOutlet implements OnDestr
178179 }
179180
180181 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 ) ;
183183 }
184184
185185 private _validatePortalAttached ( ) {
@@ -190,14 +190,7 @@ export class MatBottomSheetContainer extends BasePortalOutlet implements OnDestr
190190
191191 private _setPanelClass ( ) {
192192 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 || [ ] ) ) ;
201194 }
202195
203196 /**
0 commit comments