From 3a4857e9da73f527148a917bbeee3dbf0ba61990 Mon Sep 17 00:00:00 2001 From: lskramarov Date: Wed, 21 Aug 2019 16:01:17 +0300 Subject: [PATCH] fix(sidebar): sidebar does not save width before closing (#UIM-141) (#207) --- packages/mosaic/sidebar/sidebar.component.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/mosaic/sidebar/sidebar.component.ts b/packages/mosaic/sidebar/sidebar.component.ts index 6d3f2eb65..3eb39e8e2 100644 --- a/packages/mosaic/sidebar/sidebar.component.ts +++ b/packages/mosaic/sidebar/sidebar.component.ts @@ -75,7 +75,7 @@ export class McSidebar implements OnDestroy, OnInit, AfterContentInit { } set opened(value: boolean) { - if (this.needSaveAndRestoreWidth && this._opened) { + if (this._opened) { this.saveWidth(); } @@ -85,7 +85,13 @@ export class McSidebar implements OnDestroy, OnInit, AfterContentInit { @Input() position: SidebarPositions; - params: McSidebarParams; + params: McSidebarParams = { + openedStateWidth: 'inherit', + openedStateMinWidth: 'inherit', + openedStateMaxWidth: 'inherit', + + closedStateWidth: '32px' + }; @Output() readonly stateChanged: EventEmitter = new EventEmitter(); @@ -100,8 +106,6 @@ export class McSidebar implements OnDestroy, OnInit, AfterContentInit { internalState: boolean = true; - private needSaveAndRestoreWidth: boolean = false; - private documentKeydownListener: (event: KeyboardEvent) => void; constructor(private ngZone: NgZone, private elementRef: ElementRef) {} @@ -135,10 +139,6 @@ export class McSidebar implements OnDestroy, OnInit, AfterContentInit { } ngAfterContentInit(): void { - if (!this.openedContent.width) { - this.needSaveAndRestoreWidth = true; - } - this.params = { openedStateWidth: this.openedContent.width || 'inherit', openedStateMinWidth: this.openedContent.minWidth || 'inherit',