@@ -13,12 +13,12 @@ import type { LaboratoryOrderGroup, ServiceRequest } from 'src/app/model';
1313 standalone : false
1414} )
1515export class LoincOrderComponent implements AfterViewInit , OnDestroy {
16- private readonly compactLayoutBreakpoint = 1400 ;
1716 private readonly searchPanelMinWidth = 1100 ;
17+ private readonly searchPanelWidthRatio = 3 / 5 ;
18+ private readonly compactLayoutBreakpoint = Math . ceil ( this . searchPanelMinWidth / this . searchPanelWidthRatio ) ;
1819 private readonly visualViewportResizeHandler = ( ) => this . updateCompactLayoutFromContainer ( ) ;
1920
2021 @ViewChild ( 'orderLayoutRoot' ) orderLayoutRoot ?: ElementRef < HTMLElement > ;
21- @ViewChild ( 'searchPanelRoot' ) searchPanelRoot ?: ElementRef < HTMLElement > ;
2222 @Input ( ) patient : any = null ;
2323 @Input ( ) showSaveAction = false ;
2424 @Output ( ) orderSaved = new EventEmitter < LaboratoryOrderGroup > ( ) ;
@@ -336,11 +336,7 @@ export class LoincOrderComponent implements AfterViewInit, OnDestroy {
336336 this . updateCompactLayoutFromContainer ( ) ;
337337 }
338338
339- private computeIsCompactLayout ( containerWidth ?: number , searchPanelWidth ?: number ) : boolean {
340- if ( typeof searchPanelWidth === 'number' && searchPanelWidth > 0 ) {
341- return searchPanelWidth <= this . searchPanelMinWidth ;
342- }
343-
339+ private computeIsCompactLayout ( containerWidth ?: number ) : boolean {
344340 if ( typeof containerWidth === 'number' && containerWidth > 0 ) {
345341 return containerWidth <= this . compactLayoutBreakpoint ;
346342 }
@@ -350,8 +346,7 @@ export class LoincOrderComponent implements AfterViewInit, OnDestroy {
350346
351347 private updateCompactLayoutFromContainer ( ) {
352348 const containerWidth = this . orderLayoutRoot ?. nativeElement . getBoundingClientRect ( ) . width ;
353- const searchPanelWidth = this . searchPanelRoot ?. nativeElement . getBoundingClientRect ( ) . width ;
354- this . isCompactLayout = this . computeIsCompactLayout ( containerWidth , searchPanelWidth ) ;
349+ this . isCompactLayout = this . computeIsCompactLayout ( containerWidth ) ;
355350 this . hasMeasuredLayout = true ;
356351 }
357352}
0 commit comments