import { Subject, BehaviorSubject } from 'rxjs'; import { ResolvedLayoutConfig } from 'golden-layout'; import { DashboardPanel, LayoutChangedEvent } from '../models/dashboard-types'; import * as i0 from "@angular/core"; /** * Location specifier for adding panels */ export interface LayoutLocation { /** Target panel ID (add next to this panel) */ targetPanelId?: string; /** Position relative to target */ position?: 'left' | 'right' | 'top' | 'bottom' | 'tab'; } /** * Panel component factory function type. * Receives the full DashboardPanel from GL's componentState (single source of truth). */ export type PanelComponentFactory = (panel: DashboardPanel, container: HTMLElement) => void; /** * Service that wraps Golden Layout for Angular integration. * Uses Golden Layout 2.6.0 VirtualLayout API. * * DESIGN: This service works with GL's native ResolvedLayoutConfig format. * Full DashboardPanel objects are stored in componentState - no conversion needed. */ export declare class GoldenLayoutWrapperService { private _initialized; private _layout; private _containerElement; private _componentFactory; private _containerMap; private _isEditing; /** Tracks which panels have been lazily loaded (content created) */ private _loadedPanels; /** Emitted when layout configuration changes */ onLayoutChanged: Subject; /** Emitted when a panel is closed */ onPanelClosed: Subject; /** Emitted when a panel is maximized/restored */ onPanelMaximized: Subject<{ panelId: string; maximized: boolean; }>; /** Emitted when a panel is selected (in a stack) */ onPanelSelected: Subject; /** Current panels in layout */ panels$: BehaviorSubject; /** Whether layout editing (drag/drop/resize/close) is enabled */ get isEditing(): boolean; /** * Initialize Golden Layout in the specified container. * @param container The HTML element to render Golden Layout in * @param savedLayout Previously saved layout (from saveLayout()) or null for empty * @param componentFactory Factory function to create panel content * @param isEditing Whether editing (drag/drop/resize/close) is enabled */ initialize(container: HTMLElement, savedLayout: ResolvedLayoutConfig | null, componentFactory: PanelComponentFactory, isEditing?: boolean): void; /** * Build LayoutConfig from saved ResolvedLayoutConfig. * Uses GL's LayoutConfig.fromResolved() for proper conversion, * then applies current edit mode settings. */ private buildLayoutConfig; /** * Validate that a saved layout config has the required structure for GL conversion. * GL's fromResolved() can crash if certain properties are undefined. */ private isValidLayoutConfig; /** * Recursively validate a layout item and its children. */ private validateLayoutItem; /** * Update layout size to match container. */ updateSize(): void; /** * Bind component event listener (called by Golden Layout VirtualLayout). * The componentState contains the full DashboardPanel object. */ private bindComponentEventListener; /** * Unbind component event listener (called by Golden Layout VirtualLayout) */ private unbindComponentEventListener; /** * Check if Golden Layout is initialized */ isInitialized(): boolean; /** * Destroy Golden Layout and clean up */ destroy(): void; /** * Add a panel to the layout. * The full DashboardPanel is stored in componentState. */ addPanel(panel: DashboardPanel, _location?: LayoutLocation): void; /** * Find first stack in layout */ private findFirstStack; /** * Remove a panel from the layout */ removePanel(panelId: string): void; /** * Split a panel horizontally (add panel to the right) */ splitHorizontal(panelId: string, newPanel: DashboardPanel): void; /** * Split a panel vertically (add panel below) */ splitVertical(panelId: string, newPanel: DashboardPanel): void; /** * Add a panel as a tab to an existing stack */ addToStack(panelId: string, newPanel: DashboardPanel): void; /** * Maximize a panel */ maximizePanel(panelId: string): void; /** * Restore a maximized panel */ restorePanel(panelId: string): void; /** * Focus a panel by ID */ focusPanel(panelId: string): void; /** * Get the current layout configuration. * Returns GL's native ResolvedLayoutConfig - no conversion. */ getLayoutConfig(): ResolvedLayoutConfig | null; /** * Get the container element for a panel */ getPanelContainer(panelId: string): HTMLElement | null; /** * Get all panel IDs in the current layout */ getPanelIds(): string[]; /** * Set editing mode. * Note: Golden Layout 2 doesn't support changing settings after initialization. * The layout must be reinitialized to apply new settings. */ setEditingMode(isEditing: boolean): void; private updatePanelsList; private emitLayoutChanged; /** * Add an icon to a tab element via DOM manipulation. * IMPORTANT: We append to tabElement, NOT modify .lm_title, to preserve GL's drag/drop. * This follows the same pattern as the shell's GoldenLayoutManager. */ private addIconToTab; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } //# sourceMappingURL=golden-layout-wrapper.service.d.ts.map