mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.2 KiB
56 lines
1.2 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Sebastian Stehle. All rights reserved
|
|
*/
|
|
|
|
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
|
|
|
import { slideRightAnimation } from './animations';
|
|
|
|
import { PanelContainerDirective } from './panel-container.directive';
|
|
|
|
@Component({
|
|
selector: 'sqx-panel',
|
|
template: `
|
|
<div #panel>
|
|
<div class="panel panel-{{theme}}" [@slideRight]>
|
|
<ng-content></ng-content>
|
|
</div>
|
|
</div>`,
|
|
animations: [
|
|
slideRightAnimation
|
|
]
|
|
})
|
|
export class PanelComponent implements AfterViewInit, OnDestroy, OnInit {
|
|
public renderWidth = 0;
|
|
|
|
@Input()
|
|
public theme = 'light';
|
|
|
|
@Input()
|
|
public desiredWidth = '10rem';
|
|
|
|
@ViewChild('panel')
|
|
public panel: ElementRef;
|
|
|
|
constructor(
|
|
private readonly container: PanelContainerDirective
|
|
) {
|
|
}
|
|
|
|
public ngOnDestroy() {
|
|
this.container.pop();
|
|
}
|
|
|
|
public ngOnInit() {
|
|
this.container.push(this);
|
|
}
|
|
|
|
public ngAfterViewInit() {
|
|
this.renderWidth = this.panel.nativeElement.getBoundingClientRect().width;
|
|
|
|
this.container.invalidate();
|
|
}
|
|
}
|