|
|
@ -5,7 +5,7 @@ |
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; |
|
|
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, Renderer, ViewChild } from '@angular/core'; |
|
|
|
|
|
|
|
|
import { slideRightAnimation } from './animations'; |
|
|
import { slideRightAnimation } from './animations'; |
|
|
|
|
|
|
|
|
@ -20,6 +20,8 @@ import { PanelContainerDirective } from './panel-container.directive'; |
|
|
] |
|
|
] |
|
|
}) |
|
|
}) |
|
|
export class PanelComponent implements AfterViewInit, OnDestroy, OnInit { |
|
|
export class PanelComponent implements AfterViewInit, OnDestroy, OnInit { |
|
|
|
|
|
private styleWidth: string; |
|
|
|
|
|
|
|
|
public renderWidth = 0; |
|
|
public renderWidth = 0; |
|
|
|
|
|
|
|
|
@Input() |
|
|
@Input() |
|
|
@ -34,6 +36,9 @@ export class PanelComponent implements AfterViewInit, OnDestroy, OnInit { |
|
|
@Input() |
|
|
@Input() |
|
|
public isFullSize = false; |
|
|
public isFullSize = false; |
|
|
|
|
|
|
|
|
|
|
|
@Input() |
|
|
|
|
|
public isLazyLoaded = true; |
|
|
|
|
|
|
|
|
@Input() |
|
|
@Input() |
|
|
public showScrollbar = false; |
|
|
public showScrollbar = false; |
|
|
|
|
|
|
|
|
@ -53,7 +58,8 @@ export class PanelComponent implements AfterViewInit, OnDestroy, OnInit { |
|
|
public panel: ElementRef; |
|
|
public panel: ElementRef; |
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
|
private readonly container: PanelContainerDirective |
|
|
private readonly container: PanelContainerDirective, |
|
|
|
|
|
private readonly renderer: Renderer |
|
|
) { |
|
|
) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -66,8 +72,24 @@ export class PanelComponent implements AfterViewInit, OnDestroy, OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ngAfterViewInit() { |
|
|
public ngAfterViewInit() { |
|
|
this.renderWidth = this.panel.nativeElement.getBoundingClientRect().width; |
|
|
|
|
|
|
|
|
|
|
|
this.container.invalidate(); |
|
|
this.container.invalidate(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public measure(size: string) { |
|
|
|
|
|
if (this.styleWidth !== size) { |
|
|
|
|
|
this.styleWidth = size; |
|
|
|
|
|
|
|
|
|
|
|
this.renderer.setElementStyle(this.panel.nativeElement, 'width', size); |
|
|
|
|
|
|
|
|
|
|
|
this.renderWidth = this.panel.nativeElement.getBoundingClientRect().width; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public arrange(left: any, layer: any) { |
|
|
|
|
|
this.renderer.setElementStyle(this.panel.nativeElement, 'top', '0px'); |
|
|
|
|
|
this.renderer.setElementStyle(this.panel.nativeElement, 'left', left); |
|
|
|
|
|
this.renderer.setElementStyle(this.panel.nativeElement, 'bottom', '0px'); |
|
|
|
|
|
this.renderer.setElementStyle(this.panel.nativeElement, 'position', 'absolute'); |
|
|
|
|
|
this.renderer.setElementStyle(this.panel.nativeElement, 'z-index', layer); |
|
|
|
|
|
} |
|
|
} |
|
|
} |