@@ -10,26 +10,27 @@ import { UtilsService } from '../../services/utils/utils.service';
1010import { SCROLLBAR_WIDTH } from '../../symbols' ;
1111
1212export interface PositionState {
13- key : string ;
14- opened : boolean ;
13+ key : string | null ;
14+ opened : boolean | null ;
1515 position : MousePosition ;
1616}
1717
18+ // eslint-disable-next-line
1819export abstract class ModalViewLayer < T extends PositionState > implements OnDestroy {
19- public width : number = null ;
20- public height : number = null ;
20+ public width : number | null = null ;
21+ public height : number | null = null ;
2122 public isViewed : boolean = false ;
2223 public isRendered : boolean = false ;
23- public minHeight : number ;
24- protected subscription : Subscription = null ;
24+ public minHeight : number | null = null ;
25+ protected subscription : Subscription | null = null ;
2526 protected readonly app : ApplicationRef ;
2627 protected readonly utils : UtilsService ;
2728 protected readonly filterable : FilterableService ;
2829 protected readonly ngZone : NgZone ;
2930 protected readonly contextMenu : ContextMenuService ;
3031
3132 @ViewChild ( 'menu' , { static : false } )
32- protected menu : ElementRef < HTMLDivElement > ;
33+ protected menu ! : ElementRef < HTMLDivElement > ;
3334
3435 protected constructor ( protected readonly cd : ChangeDetectorRef , injector : Injector ) {
3536 this . app = injector . get < ApplicationRef > ( ApplicationRef ) ;
@@ -48,19 +49,19 @@ export abstract class ModalViewLayer<T extends PositionState> implements OnDestr
4849 }
4950
5051 public get overflowX ( ) : number {
51- const overflowX : number = this . width + this . left - this . utils . bodyRect . width ;
52+ const overflowX : number = this . width ! + this . left - this . utils . bodyRect ? .width ! ;
5253 return overflowX > 0 ? overflowX + SCROLLBAR_WIDTH : 0 ;
5354 }
5455
5556 public get overflowY ( ) : number {
56- const overflowY : number = this . calculatedHeight + this . top - this . utils . bodyRect . height ;
57+ const overflowY : number = this . calculatedHeight + this . top - this . utils . bodyRect ? .height ! ;
5758 return overflowY > 0 ? overflowY + SCROLLBAR_WIDTH : 0 ;
5859 }
5960
6061 public abstract get state ( ) : Partial < T > ;
6162
6263 public get calculatedHeight ( ) : number {
63- let height : number ;
64+ let height : number | null ;
6465
6566 try {
6667 if ( this . height ) {
@@ -75,7 +76,7 @@ export abstract class ModalViewLayer<T extends PositionState> implements OnDestr
7576 height = this . height ;
7677 }
7778
78- return height ;
79+ return height ! ;
7980 }
8081
8182 public updateView ( ) : void {
@@ -90,8 +91,8 @@ export abstract class ModalViewLayer<T extends PositionState> implements OnDestr
9091 }
9192
9293 public ngOnDestroy ( ) : void {
93- if ( ! this . subscription . closed ) {
94- this . subscription . unsubscribe ( ) ;
94+ if ( ! this . subscription ? .closed ) {
95+ this . subscription ? .unsubscribe ( ) ;
9596 }
9697 }
9798
@@ -100,7 +101,7 @@ export abstract class ModalViewLayer<T extends PositionState> implements OnDestr
100101 protected update ( ) : void {
101102 this . ngZone . runOutsideAngular ( ( ) : void => {
102103 window . setTimeout ( ( ) : void => {
103- this . isViewed = this . state . opened ;
104+ this . isViewed = ! ! this . state . opened ;
104105 this . updateView ( ) ;
105106 window . setTimeout ( ( ) : void => this . updateView ( ) ) ;
106107 } ) ;
0 commit comments