38 lines
5.5 KiB
JavaScript
38 lines
5.5 KiB
JavaScript
import { Component, ElementRef, EventEmitter, Input, Renderer2, ViewEncapsulation } from '@angular/core';
|
|
import { GridsterRenderer } from './gridsterRenderer.service';
|
|
import * as i0 from "@angular/core";
|
|
class GridsterPreviewComponent {
|
|
constructor(el, renderer) {
|
|
this.renderer = renderer;
|
|
this.el = el.nativeElement;
|
|
}
|
|
ngOnInit() {
|
|
this.sub = this.previewStyle$.subscribe(options => this.previewStyle(options));
|
|
}
|
|
ngOnDestroy() {
|
|
if (this.sub) {
|
|
this.sub.unsubscribe();
|
|
}
|
|
}
|
|
previewStyle(item) {
|
|
if (item) {
|
|
this.renderer.setStyle(this.el, 'display', 'block');
|
|
this.gridRenderer.updateItem(this.el, item, this.renderer);
|
|
}
|
|
else {
|
|
this.renderer.setStyle(this.el, 'display', '');
|
|
}
|
|
}
|
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: GridsterPreviewComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: GridsterPreviewComponent, isStandalone: true, selector: "gridster-preview", inputs: { previewStyle$: "previewStyle$", gridRenderer: "gridRenderer" }, ngImport: i0, template: '', isInline: true, styles: ["gridster-preview{position:absolute;display:none;background:rgba(0,0,0,.15)}\n"], encapsulation: i0.ViewEncapsulation.None }); }
|
|
}
|
|
export { GridsterPreviewComponent };
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: GridsterPreviewComponent, decorators: [{
|
|
type: Component,
|
|
args: [{ selector: 'gridster-preview', template: '', encapsulation: ViewEncapsulation.None, standalone: true, styles: ["gridster-preview{position:absolute;display:none;background:rgba(0,0,0,.15)}\n"] }]
|
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }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