import { EventEmitter, ChangeDetectorRef, OnInit, OnDestroy } from '@angular/core'; import { MJDashboardPartTypeEntity } from '@memberjunction/core-entities'; import { BaseAngularComponent } from '@memberjunction/ng-base-types'; import { PanelConfig, DashboardPanel, DashboardNavRequest, DashboardNavRequestEvent } from '../models/dashboard-types'; import * as i0 from "@angular/core"; /** * Event emitted when a part requests configuration */ export interface PartConfigureEvent { /** The panel requesting configuration */ Panel: DashboardPanel; /** The part type */ PartType: MJDashboardPartTypeEntity; } /** * Event emitted when a part requests removal */ export interface PartRemoveEvent { /** The panel to remove */ Panel: DashboardPanel; } /** * Event emitted when a part's data changes */ export interface PartDataChangeEvent { /** The panel whose data changed */ Panel: DashboardPanel; /** The new data (type depends on part type) */ Data: unknown; } /** * Base class for dashboard part renderers. * * Each part type (View, Query, Artifact, WebURL, etc.) has a renderer component * that extends this class. The renderer is responsible for: * 1. Displaying the part's content based on its configuration * 2. Handling edit mode UI (configure/remove buttons) * 3. Emitting events for user interactions * * Subclasses are registered with @RegisterClass(BaseDashboardPart, 'PartTypeName') * and instantiated via ClassFactory using the DashboardPartType.DriverClass field. * * This allows new part types to be added by: * 1. Creating a new component that extends BaseDashboardPart * 2. Registering it with @RegisterClass * 3. Adding a DashboardPartType record with the DriverClass set to the registered name */ export declare abstract class BaseDashboardPart extends BaseAngularComponent implements OnInit, OnDestroy { protected cdr: ChangeDetectorRef; /** * The panel data including ID, title, icon, and configuration */ set Panel(value: DashboardPanel | null); get Panel(): DashboardPanel | null; private _panel; /** * The part type metadata */ PartType: MJDashboardPartTypeEntity | null; /** * Whether the dashboard is in edit mode */ set IsEditing(value: boolean); get IsEditing(): boolean; private _isEditing; /** * Emitted when user clicks configure button */ ConfigureRequested: EventEmitter; /** * Emitted when user clicks remove button */ RemoveRequested: EventEmitter; /** * Emitted when the part's data changes (e.g., selection in a grid) */ DataChanged: EventEmitter; /** * Emitted when the part requests navigation to another resource. * Parent component handles actual routing based on the request type. */ NavigationRequested: EventEmitter; /** * Whether the part is currently loading */ IsLoading: boolean; /** * Error message if the part failed to load */ ErrorMessage: string | null; constructor(cdr: ChangeDetectorRef); ngOnInit(): void; ngOnDestroy(): void; /** * Initialize the part. Called in ngOnInit. * Override to perform async initialization like loading data. */ protected initialize(): void; /** * Cleanup resources. Called in ngOnDestroy. * Override to unsubscribe from observables, etc. */ protected cleanup(): void; /** * Called when the panel input changes. * Override to react to configuration changes. */ protected onPanelChanged(newPanel: DashboardPanel | null, oldPanel: DashboardPanel | null): void; /** * Called when edit mode changes. * Override to adjust UI for edit mode. */ protected onEditModeChanged(isEditing: boolean): void; /** * Load or reload the part's content based on current configuration. * Override to implement actual data loading. */ abstract loadContent(): Promise; /** * Get the typed configuration for this part. * Subclasses should override to return the specific config type. */ getConfig(): T | null; /** * Request configuration (edit the part settings) */ requestConfigure(): void; /** * Request removal of this part */ requestRemove(): void; /** * Emit a data change event */ protected emitDataChanged(data: unknown): void; /** * Set loading state */ protected setLoading(loading: boolean): void; /** * Set error state */ protected setError(message: string | null): void; /** * Request navigation to open a specific entity record */ RequestOpenEntityRecord(entityName: string, recordId: string, mode?: 'view' | 'edit', openInNewTab?: boolean): void; /** * Request navigation to another dashboard */ RequestOpenDashboard(dashboardId: string, categoryId?: string, openInNewTab?: boolean): void; /** * Request navigation to a query */ RequestOpenQuery(queryId: string, parameters?: Record, autoExecute?: boolean, openInNewTab?: boolean): void; /** * Request navigation to another application */ RequestOpenApplication(applicationId: string, resourceName?: string, openInNewTab?: boolean): void; /** * Request navigation to a specific nav item within an application. * Supports setting URL query parameters after navigation. */ RequestOpenNavItem(navItemName: string, appName?: string, queryParams?: Record, openInNewTab?: boolean): void; /** * Emit a navigation request event */ protected emitNavigationRequest(request: DashboardNavRequest): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } //# sourceMappingURL=base-dashboard-part.d.ts.map