1
1
import { ChangeDetectionStrategy , Component , HostListener , Inject , Injector , TemplateRef , Type } from '@angular/core' ;
2
2
import { IconType } from '@hypertrace/assets-library' ;
3
- import { ExternalNavigationParams , LayoutChangeService } from '@hypertrace/common' ;
3
+ import { ExternalNavigationParams , GLOBAL_HEADER_HEIGHT , LayoutChangeService } from '@hypertrace/common' ;
4
4
import { ButtonStyle } from '../../button/button' ;
5
5
import { IconSize } from '../../icon/icon-size' ;
6
- import { POPOVER_DATA } from '../../popover/popover' ;
6
+ import { PopoverFixedPositionLocation , POPOVER_DATA } from '../../popover/popover' ;
7
7
import { PopoverRef } from '../../popover/popover-ref' ;
8
8
import { SheetConstructionData } from '../overlay.service' ;
9
9
import { SheetOverlayConfig , SheetSize } from './sheet' ;
@@ -72,6 +72,7 @@ export class SheetOverlayComponent {
72
72
public constructor (
73
73
private readonly popoverRef : PopoverRef ,
74
74
@Inject ( POPOVER_DATA ) sheetData : SheetConstructionData ,
75
+ @Inject ( GLOBAL_HEADER_HEIGHT ) globalHeaderHeight : string ,
75
76
layoutChange : LayoutChangeService
76
77
) {
77
78
const sheetConfig : SheetOverlayConfig = sheetData . config ;
@@ -84,7 +85,7 @@ export class SheetOverlayComponent {
84
85
85
86
this . isComponentSheet = ! ( sheetConfig . content instanceof TemplateRef ) ;
86
87
this . renderer = sheetConfig . content ;
87
- this . popoverRef . height ( '100vh' ) ;
88
+ this . popoverRef . height ( this . getHeightForPopover ( globalHeaderHeight , sheetConfig . position ) ) ;
88
89
this . setWidth ( ) ;
89
90
this . navigationParams = sheetConfig . pageNavParams ;
90
91
this . rendererInjector = Injector . create ( {
@@ -136,4 +137,8 @@ export class SheetOverlayComponent {
136
137
return '100%' ;
137
138
}
138
139
}
140
+
141
+ private getHeightForPopover ( globalHeaderHeight : string , position ?: PopoverFixedPositionLocation ) : string {
142
+ return position === PopoverFixedPositionLocation . Right ? '100vh' : `calc(100vh - ${ globalHeaderHeight } )` ;
143
+ }
139
144
}
0 commit comments