File tree Expand file tree Collapse file tree 2 files changed +10
-13
lines changed
projects/igniteui-angular/src/lib/core Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -81,22 +81,18 @@ export class DisplayDensityBase implements DoCheck, OnInit {
8181 */
8282 @Input ( )
8383 public get displayDensity ( ) : DisplayDensity {
84- if ( ! this . size ) {
85- return (
86- this . _displayDensity ??
87- this . displayDensityOptions ?. displayDensity ??
88- DisplayDensity . comfortable
89- ) ;
90- }
91-
9284 switch ( this . size ) {
9385 case '1' :
9486 return DisplayDensity . compact ;
9587 case '2' :
9688 return DisplayDensity . cosy ;
9789 case '3' :
9890 default :
99- return DisplayDensity . comfortable ;
91+ return (
92+ this . _displayDensity ??
93+ this . displayDensityOptions ?. displayDensity ??
94+ DisplayDensity . comfortable
95+ ) ;
10096 }
10197 }
10298
@@ -118,7 +114,7 @@ export class DisplayDensityBase implements DoCheck, OnInit {
118114 }
119115
120116 public get size ( ) {
121- return globalThis . document . defaultView
117+ return globalThis . document ? .defaultView
122118 . getComputedStyle ( this . _host . nativeElement )
123119 . getPropertyValue ( '--ig-size' )
124120 . trim ( ) ;
@@ -131,7 +127,8 @@ export class DisplayDensityBase implements DoCheck, OnInit {
131127
132128 protected oldDisplayDensityOptions : IDisplayDensityOptions = {
133129 displayDensity : DisplayDensity . comfortable ,
134- } ;
130+ }
131+
135132 protected _displayDensity : DisplayDensity ;
136133
137134 constructor (
Original file line number Diff line number Diff line change @@ -831,11 +831,11 @@ export const formatCurrency = new CurrencyPipe(undefined).transform;
831831
832832/** Converts pixel values to their rem counterparts for a base value */
833833export const rem = ( value : number | string ) => {
834- const base = parseFloat ( getComputedStyle ( document . documentElement ) . getPropertyValue ( '--ig-base-font-size' ) )
834+ const base = parseFloat ( getComputedStyle ( globalThis . document ? .documentElement ) . getPropertyValue ( '--ig-base-font-size' ) )
835835 return Number ( value ) / base ;
836836}
837837
838838/** Get the size of the component as derived from the CSS size variable */
839839export function getComponentSize ( el : Element ) {
840- return window . getComputedStyle ( el ) . getPropertyValue ( '--component-size' ) ;
840+ return globalThis . window ? .getComputedStyle ( el ) . getPropertyValue ( '--component-size' ) ;
841841}
You can’t perform that action at this time.
0 commit comments