9
9
OnInit ,
10
10
Output ,
11
11
Renderer2 ,
12
- SimpleChanges ,
12
+ SimpleChanges
13
13
} from '@angular/core' ;
14
14
import { DOCUMENT } from '@angular/common' ;
15
15
import { BooleanInput , coerceBooleanProperty } from '@angular/cdk/coercion' ;
@@ -40,13 +40,13 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
40
40
#stateToggleSubscription! : Subscription ;
41
41
42
42
state : ISidebarAction = {
43
- sidebar : this ,
43
+ sidebar : this
44
44
} ;
45
45
46
46
#stateInitial = {
47
47
narrow : false ,
48
48
visible : false ,
49
- unfoldable : false ,
49
+ unfoldable : false
50
50
} ;
51
51
52
52
/**
@@ -155,11 +155,11 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
155
155
}
156
156
this . state = {
157
157
...this . state ,
158
- ...newState ,
158
+ ...newState
159
159
} ;
160
160
this . state . mobile && this . state . visible
161
- ? this . backdropService . setBackdrop ( this )
162
- : this . backdropService . clearBackdrop ( ) ;
161
+ ? this . backdropService . setBackdrop ( this )
162
+ : this . backdropService . clearBackdrop ( ) ;
163
163
}
164
164
165
165
get sidebarState ( ) : ISidebarAction {
@@ -168,13 +168,8 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
168
168
169
169
get getMobileBreakpoint ( ) : string {
170
170
const element : Element = this . document . documentElement ;
171
- const mobileBreakpoint =
172
- getComputedStyle ( element ) . getPropertyValue ( '--cui-mobile-breakpoint' ) ||
173
- 'md' ;
174
- const breakpointValue =
175
- getComputedStyle ( element ) . getPropertyValue (
176
- `--cui-breakpoint-${ mobileBreakpoint . trim ( ) } `
177
- ) || '768px' ;
171
+ const mobileBreakpoint = this . document . defaultView ?. getComputedStyle ( element ) ?. getPropertyValue ( '--cui-mobile-breakpoint' ) ?? 'md' ;
172
+ const breakpointValue = this . document . defaultView ?. getComputedStyle ( element ) ?. getPropertyValue ( `--cui-breakpoint-${ mobileBreakpoint . trim ( ) } ` ) ?? '768px' ;
178
173
return `${ parseFloat ( breakpointValue . trim ( ) ) - 0.02 } px` || '767.98px' ;
179
174
}
180
175
@@ -199,7 +194,7 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
199
194
'sidebar-overlaid' : this . overlaid ,
200
195
[ `sidebar-${ this . size } ` ] : ! ! this . size ,
201
196
show : visible && this . #onMobile,
202
- hide : ! visible ,
197
+ hide : ! visible
203
198
} ;
204
199
}
205
200
@@ -242,11 +237,11 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
242
237
this . #stateInitial = {
243
238
narrow : this . narrow ,
244
239
visible : this . visible ,
245
- unfoldable : this . unfoldable ,
240
+ unfoldable : this . unfoldable
246
241
} ;
247
242
this . sidebarService . toggle ( {
248
243
...this . #stateInitial,
249
- sidebar : this ,
244
+ sidebar : this
250
245
} ) ;
251
246
}
252
247
@@ -279,7 +274,7 @@ export class SidebarComponent implements OnChanges, OnDestroy, OnInit {
279
274
mobile : isOnMobile ,
280
275
unfoldable : isUnfoldable ,
281
276
visible : isOnMobile ? ! isOnMobile : this . #stateInitial. visible ,
282
- sidebar : this ,
277
+ sidebar : this
283
278
} ) ;
284
279
}
285
280
}
0 commit comments