Skip to content

Commit

Permalink
fix(sidebar): sidebar does not save width before closing (#UIM-141) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lskramarov authored and pimenovoleg committed Aug 21, 2019
1 parent a2c53d0 commit 3a4857e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/mosaic/sidebar/sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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<boolean> = new EventEmitter<boolean>();

Expand All @@ -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) {}
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 3a4857e

Please sign in to comment.