UNPKG

@memberjunction/ng-shared

Version:

MemberJunction: MJ Explorer Angular Shared Package - utility functions and other reusable elements used across other MJ Angular packages within the MJ Explorer App - do not use outside of MJ Explorer.

112 lines 5.64 kB
import { OnInit, OnDestroy } from "@angular/core"; import { Subject } from "rxjs"; import { BaseEntity } from "@memberjunction/core"; import { BaseNavigationComponent } from "./base-navigation-component"; import { ResourceData } from "@memberjunction/core-entities"; import { NavigationService } from "./navigation.service"; import * as i0 from "@angular/core"; export declare abstract class BaseResourceComponent extends BaseNavigationComponent implements OnInit, OnDestroy { private _data; private _suppressQueryParamSync; /** Stable key of the most recently delivered query params, used to de-duplicate * delivery across the reactive (initial/deep-link) and popstate paths. */ private _lastDeliveredParamsKey; protected destroy$: Subject<void>; protected navigationService: NavigationService; /** * Tab ID for query param notification scoping. Set by resource wrappers * that render child dashboards, so the child knows which tab it belongs to. * If not set, falls back to Data.Configuration.tabId. */ ParentTabId: string | null; get Data(): ResourceData; set Data(value: ResourceData); private _loadComplete; get LoadComplete(): boolean; private _loadStarted; get LoadStarted(): boolean; private _loadCompleteEvent; get LoadCompleteEvent(): any; set LoadCompleteEvent(value: any); private _loadStartedEvent; get LoadStartedEvent(): any; set LoadStartedEvent(value: any); private _resourceRecordSavedEvent; get ResourceRecordSavedEvent(): any; set ResourceRecordSavedEvent(value: any); private _resourceCloseRequestedEvent; get ResourceCloseRequestedEvent(): (() => void) | null; set ResourceCloseRequestedEvent(value: (() => void) | null); private _displayNameChangedEvent; get DisplayNameChangedEvent(): ((newName: string) => void) | null; set DisplayNameChangedEvent(value: ((newName: string) => void) | null); ngOnInit(): void; ngOnDestroy(): void; /** * Called by the framework when query params change from an external source * (browser back/forward, deep link navigation). * Override in subclasses to react to query param changes. * @param params The new query params from the URL * @param source 'popstate' for back/forward, 'deeplink' for external URL entry */ protected OnQueryParamsChanged(params: Record<string, string>, source: 'popstate' | 'deeplink'): void; /** * Push query param changes to the URL. Creates a browser history entry. * Safe to call during OnQueryParamsChanged — auto-suppressed to prevent loops. */ protected UpdateQueryParams(params: Record<string, string | null>): void; /** * Read current query params from tab configuration. * Use in initDashboard() / ngOnInit() to get initial URL state. */ protected GetQueryParams(): Record<string, string>; /** * Internal: subscribe to NavigationService query param notifications. * Filters to only this component's tab to prevent cross-tab leakage. * This is the explicit back/forward (popstate) path. */ private setupQueryParamSubscription; /** * Internal: reactively deliver this tab's query params from the workspace * BehaviorSubject. Because the source replays the current value on subscribe and * emits future changes, this delivers initial deep-link params even when the * component mounts (e.g. from workspace restoration) before the URL params have * been merged into the tab configuration — closing the cold-load race that the * popstate-only path could not. */ private setupInitialParamDelivery; /** * Internal: funnel point for both the reactive and popstate paths. De-duplicates * identical deliveries (the two paths overlap on back/forward) and labels the first * meaningful delivery as a 'deeplink', subsequent ones as 'popstate'. */ private deliverQueryParams; /** Stable, order-independent string key for a query param record. */ private queryParamsKey; /** * Get this component's tab ID. Checks ParentTabId input first (set by resource * wrappers for child dashboards), then falls back to Data.Configuration.tabId. */ getTabId(): string; protected NotifyLoadComplete(): void; protected NotifyLoadStarted(): void; /** * Call this to notify the tab system that the resource's display name has changed. * The tab container will update the tab title and browser title accordingly. */ protected NotifyDisplayNameChanged(newName: string): void; protected ResourceRecordSaved(resourceRecordEntity: BaseEntity): void; /** * Ask the host shell to close/dismiss this resource (typically: close the tab). * Called by subclasses that hosted a form that emitted a 'dismiss' navigation * event — most often, a brand-new record where the user clicked Discard. The * record was never saved, the form is empty, and leaving it open serves no * purpose. The tab-container listens for this and closes the workspace tab. */ protected NotifyCloseRequested(): void; abstract GetResourceDisplayName(data: ResourceData): Promise<string>; abstract GetResourceIconClass(data: ResourceData): Promise<string>; static ɵfac: i0.ɵɵFactoryDeclaration<BaseResourceComponent, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<BaseResourceComponent, never, never, { "ParentTabId": { "alias": "ParentTabId"; "required": false; }; }, {}, never, never, true, never>; } //# sourceMappingURL=base-resource-component.d.ts.map