// @ts-nocheck import { Component, Input, OnInit, ElementRef } from "@angular/core"; import { initDashboardWidgets } from "mayvio-ui/scripts/components/dashboard-widget.js"; /** * DashboardWidgetComponent * Individual card panel inside the grid. */ @Component({ selector: "mayvio-dashboard-widget", template: `

{{ title }}

` }) export class DashboardWidgetComponent { @Input() id = ""; @Input() title = ""; @Input() collapsed = false; @Input() dismissible = true; visible = true; toggleCollapse(e: MouseEvent) { e.stopPropagation(); this.collapsed = !this.collapsed; } close(e: MouseEvent) { e.stopPropagation(); this.visible = false; } } /** * DashboardWidgetGridComponent * Parent container triggering Drag & Drop orchestration. */ @Component({ selector: "mayvio-dashboard-widget-grid", template: `
` }) export class DashboardWidgetGridComponent implements OnInit { @Input() storageKey = "mayvio-widget-order"; @Input() className = ""; constructor(private el: ElementRef) {} ngOnInit() { const grid = this.el.nativeElement.querySelector(".widget-grid"); if (grid) { setTimeout(() => { initDashboardWidgets(grid, { storageKey: this.storageKey }); }, 0); } } }