@memberjunction/ng-base-application 0.0.1 → 2.122.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Root configuration stored in Workspace.Configuration
3
+ */
4
+ export interface WorkspaceConfiguration {
5
+ /** Schema version for future migrations */
6
+ version: number;
7
+ /** Golden Layout state */
8
+ layout: LayoutConfig;
9
+ /** ID of currently active tab */
10
+ activeTabId: string | null;
11
+ /** UI theme */
12
+ theme: 'light' | 'dark';
13
+ /** User preferences */
14
+ preferences: WorkspacePreferences;
15
+ /** All tabs (replaces WorkspaceItem table) */
16
+ tabs: WorkspaceTab[];
17
+ }
18
+ /**
19
+ * Layout configuration (Golden Layout serialized state)
20
+ */
21
+ export interface LayoutConfig {
22
+ root: LayoutNode;
23
+ dimensions?: {
24
+ headerHeight: number;
25
+ borderWidth: number;
26
+ };
27
+ }
28
+ /**
29
+ * Node in the layout tree
30
+ */
31
+ export interface LayoutNode {
32
+ type: 'row' | 'column' | 'stack' | 'component';
33
+ content?: LayoutNode[];
34
+ componentType?: string;
35
+ componentState?: Record<string, unknown>;
36
+ width?: number;
37
+ height?: number;
38
+ isClosable?: boolean;
39
+ title?: string;
40
+ }
41
+ /**
42
+ * User preferences for workspace behavior
43
+ */
44
+ export interface WorkspacePreferences {
45
+ tabPosition: 'top' | 'bottom';
46
+ showTabIcons: boolean;
47
+ autoSaveInterval: number;
48
+ }
49
+ /**
50
+ * Individual tab definition (replaces WorkspaceItem row)
51
+ */
52
+ export interface WorkspaceTab {
53
+ /** Unique ID for this tab */
54
+ id: string;
55
+ /** Application this tab belongs to */
56
+ applicationId: string;
57
+ /** Display title */
58
+ title: string;
59
+ /** Resource type for matching */
60
+ resourceTypeId: string;
61
+ /** Resource record for matching */
62
+ resourceRecordId: string;
63
+ /** Whether tab is pinned (permanent) */
64
+ isPinned: boolean;
65
+ /** Display order */
66
+ sequence: number;
67
+ /** Last accessed timestamp (ISO string) */
68
+ lastAccessedAt: string;
69
+ /** Tab-specific configuration */
70
+ configuration: TabConfiguration;
71
+ /** Layout position reference */
72
+ layoutPosition?: string;
73
+ }
74
+ /**
75
+ * Tab-specific configuration (extensible)
76
+ */
77
+ export interface TabConfiguration {
78
+ /** Entity name for entity-based tabs */
79
+ entity?: string;
80
+ /** Additional filter for views */
81
+ extraFilter?: string;
82
+ /** View ID for saved views */
83
+ viewId?: string;
84
+ /** Search input state */
85
+ searchInput?: string;
86
+ /** Scroll position for restoration */
87
+ scrollPosition?: number;
88
+ /** Expanded sections state */
89
+ expandedSections?: string[];
90
+ /** Custom title override */
91
+ customTitle?: string;
92
+ /** Allow additional properties */
93
+ [key: string]: unknown;
94
+ }
95
+ /**
96
+ * Create default workspace configuration
97
+ */
98
+ export declare function createDefaultWorkspaceConfiguration(): WorkspaceConfiguration;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Create default workspace configuration
3
+ */
4
+ export function createDefaultWorkspaceConfiguration() {
5
+ return {
6
+ version: 1,
7
+ layout: {
8
+ root: {
9
+ type: 'row',
10
+ content: []
11
+ }
12
+ },
13
+ activeTabId: null,
14
+ theme: 'light',
15
+ preferences: {
16
+ tabPosition: 'top',
17
+ showTabIcons: true,
18
+ autoSaveInterval: 5000
19
+ },
20
+ tabs: []
21
+ };
22
+ }
23
+ //# sourceMappingURL=workspace-configuration.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-configuration.interface.js","sourceRoot":"","sources":["../../../src/lib/interfaces/workspace-configuration.interface.ts"],"names":[],"mappings":"AAyHA;;GAEG;AACH,MAAM,UAAU,mCAAmC;IACjD,OAAO;QACL,OAAO,EAAE,CAAC;QACV,MAAM,EAAE;YACN,IAAI,EAAE;gBACJ,IAAI,EAAE,KAAK;gBACX,OAAO,EAAE,EAAE;aACZ;SACF;QACD,WAAW,EAAE,IAAI;QACjB,KAAK,EAAE,OAAO;QACd,WAAW,EAAE;YACX,WAAW,EAAE,KAAK;YAClB,YAAY,EAAE,IAAI;YAClB,gBAAgB,EAAE,IAAI;SACvB;QACD,IAAI,EAAE,EAAE;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { Observable } from 'rxjs';
2
+ import { TabRequest } from './interfaces/tab-request.interface';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Service for requesting tabs to be opened.
6
+ *
7
+ * This service provides a way for any component in the app to request
8
+ * that a new tab be opened without needing direct access to the
9
+ * WorkspaceStateManager.
10
+ *
11
+ * Tab requests are queued and can be replayed when subscribers connect.
12
+ * This ensures requests aren't lost if they arrive before the shell is ready.
13
+ */
14
+ export declare class TabService {
15
+ private tabRequest$;
16
+ private queuedRequests;
17
+ /**
18
+ * Observable of tab open requests
19
+ */
20
+ get TabRequests(): Observable<TabRequest>;
21
+ /**
22
+ * Request that a new tab be opened
23
+ */
24
+ OpenTab(request: TabRequest): void;
25
+ /**
26
+ * Get all queued tab requests (for replay on subscription)
27
+ */
28
+ GetQueuedRequests(): TabRequest[];
29
+ /**
30
+ * Clear the queue after requests have been processed
31
+ */
32
+ ClearQueue(): void;
33
+ /**
34
+ * Helper method to open a record in a tab
35
+ */
36
+ OpenRecord(entityName: string, recordId: string, applicationId: string): void;
37
+ /**
38
+ * Helper method to open a view in a tab
39
+ */
40
+ OpenView(viewId: string, viewName: string, applicationId: string): void;
41
+ /**
42
+ * Helper method to open a dashboard in a tab
43
+ */
44
+ OpenDashboard(dashboardId: string, dashboardName: string, applicationId: string): void;
45
+ /**
46
+ * Helper method to open a report in a tab
47
+ */
48
+ OpenReport(reportId: string, reportName: string, applicationId: string): void;
49
+ /**
50
+ * Helper method to open a query in a tab
51
+ */
52
+ OpenQuery(queryId: string, queryName: string, applicationId: string): void;
53
+ static ɵfac: i0.ɵɵFactoryDeclaration<TabService, never>;
54
+ static ɵprov: i0.ɵɵInjectableDeclaration<TabService>;
55
+ }
@@ -0,0 +1,132 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Subject } from 'rxjs';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Service for requesting tabs to be opened.
6
+ *
7
+ * This service provides a way for any component in the app to request
8
+ * that a new tab be opened without needing direct access to the
9
+ * WorkspaceStateManager.
10
+ *
11
+ * Tab requests are queued and can be replayed when subscribers connect.
12
+ * This ensures requests aren't lost if they arrive before the shell is ready.
13
+ */
14
+ export class TabService {
15
+ tabRequest$ = new Subject();
16
+ queuedRequests = [];
17
+ /**
18
+ * Observable of tab open requests
19
+ */
20
+ get TabRequests() {
21
+ return this.tabRequest$.asObservable();
22
+ }
23
+ /**
24
+ * Request that a new tab be opened
25
+ */
26
+ OpenTab(request) {
27
+ console.log('[TabService.OpenTab] Tab request queued:', {
28
+ appId: request.ApplicationId,
29
+ title: request.Title,
30
+ config: request.Configuration
31
+ });
32
+ // Store in queue for replay
33
+ this.queuedRequests.push(request);
34
+ console.log('[TabService.OpenTab] Queue size:', this.queuedRequests.length);
35
+ // Emit to current subscribers
36
+ this.tabRequest$.next(request);
37
+ }
38
+ /**
39
+ * Get all queued tab requests (for replay on subscription)
40
+ */
41
+ GetQueuedRequests() {
42
+ console.log('[TabService.GetQueuedRequests] Returning', this.queuedRequests.length, 'queued requests');
43
+ return [...this.queuedRequests];
44
+ }
45
+ /**
46
+ * Clear the queue after requests have been processed
47
+ */
48
+ ClearQueue() {
49
+ console.log('[TabService.ClearQueue] Clearing', this.queuedRequests.length, 'processed requests');
50
+ this.queuedRequests = [];
51
+ }
52
+ /**
53
+ * Helper method to open a record in a tab
54
+ */
55
+ OpenRecord(entityName, recordId, applicationId) {
56
+ this.OpenTab({
57
+ ApplicationId: applicationId,
58
+ Title: `${entityName}`,
59
+ Route: `/record/${entityName}/${recordId}`,
60
+ Configuration: {
61
+ resourceType: 'record',
62
+ entityName,
63
+ recordId
64
+ }
65
+ });
66
+ }
67
+ /**
68
+ * Helper method to open a view in a tab
69
+ */
70
+ OpenView(viewId, viewName, applicationId) {
71
+ this.OpenTab({
72
+ ApplicationId: applicationId,
73
+ Title: viewName,
74
+ Route: `/view/${viewId}`,
75
+ Configuration: {
76
+ resourceType: 'view',
77
+ viewId
78
+ }
79
+ });
80
+ }
81
+ /**
82
+ * Helper method to open a dashboard in a tab
83
+ */
84
+ OpenDashboard(dashboardId, dashboardName, applicationId) {
85
+ this.OpenTab({
86
+ ApplicationId: applicationId,
87
+ Title: dashboardName,
88
+ Route: `/dashboard/${dashboardId}`,
89
+ Configuration: {
90
+ resourceType: 'dashboard',
91
+ dashboardId
92
+ }
93
+ });
94
+ }
95
+ /**
96
+ * Helper method to open a report in a tab
97
+ */
98
+ OpenReport(reportId, reportName, applicationId) {
99
+ this.OpenTab({
100
+ ApplicationId: applicationId,
101
+ Title: reportName,
102
+ Route: `/report/${reportId}`,
103
+ Configuration: {
104
+ resourceType: 'report',
105
+ reportId
106
+ }
107
+ });
108
+ }
109
+ /**
110
+ * Helper method to open a query in a tab
111
+ */
112
+ OpenQuery(queryId, queryName, applicationId) {
113
+ this.OpenTab({
114
+ ApplicationId: applicationId,
115
+ Title: queryName,
116
+ Route: `/query/${queryId}`,
117
+ Configuration: {
118
+ resourceType: 'query',
119
+ queryId
120
+ }
121
+ });
122
+ }
123
+ static ɵfac = function TabService_Factory(t) { return new (t || TabService)(); };
124
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TabService, factory: TabService.ɵfac, providedIn: 'root' });
125
+ }
126
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TabService, [{
127
+ type: Injectable,
128
+ args: [{
129
+ providedIn: 'root'
130
+ }]
131
+ }], null, null); })();
132
+ //# sourceMappingURL=tab.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tab.service.js","sourceRoot":"","sources":["../../src/lib/tab.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAc,MAAM,MAAM,CAAC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T,MAAM;;iFAEP,UAAU;cAHtB,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB"}
@@ -0,0 +1,118 @@
1
+ import { Observable } from 'rxjs';
2
+ import { WorkspaceConfiguration, WorkspaceTab } from './interfaces/workspace-configuration.interface';
3
+ import { TabRequest } from './interfaces/tab-request.interface';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Manages workspace state including tabs, layout, and persistence.
7
+ *
8
+ * Uses a single Workspace.Configuration JSON blob for all state,
9
+ * with debounced saves to minimize database writes.
10
+ */
11
+ export declare class WorkspaceStateManager {
12
+ private workspace$;
13
+ private configuration$;
14
+ private saveRequest$;
15
+ private loading$;
16
+ private tabBarVisible$;
17
+ private initialized;
18
+ constructor();
19
+ /**
20
+ * Observable of the current workspace configuration
21
+ */
22
+ get Configuration(): Observable<WorkspaceConfiguration | null>;
23
+ /**
24
+ * Observable of loading state
25
+ */
26
+ get Loading(): Observable<boolean>;
27
+ /**
28
+ * Observable of tab bar visibility
29
+ * Returns false when only 1 tab exists and no tabs are pinned
30
+ * Returns true when 2+ tabs exist OR any tabs are pinned
31
+ */
32
+ get TabBarVisible(): Observable<boolean>;
33
+ /**
34
+ * Get current configuration synchronously
35
+ */
36
+ GetConfiguration(): WorkspaceConfiguration | null;
37
+ /**
38
+ * Determine if tab bar should be visible
39
+ * - Hide if only 1 tab and no pinned tabs (single-resource view)
40
+ * - Show if 2+ tabs OR any pinned tabs exist
41
+ */
42
+ private shouldShowTabs;
43
+ /**
44
+ * Initialize the workspace state for a user
45
+ */
46
+ Initialize(userId: string): Promise<void>;
47
+ /**
48
+ * Load workspace from database
49
+ */
50
+ private loadWorkspace;
51
+ /**
52
+ * Persist configuration to database (debounced)
53
+ */
54
+ private persistConfiguration;
55
+ /**
56
+ * Request a save (will be debounced)
57
+ */
58
+ private requestSave;
59
+ /**
60
+ * Update configuration and request save
61
+ */
62
+ UpdateConfiguration(config: WorkspaceConfiguration): void;
63
+ /**
64
+ * Force creation of a new tab, never replacing temporary tabs
65
+ * Used for Shift+Click behavior - checks for existing tab first, only creates new if none exists
66
+ */
67
+ OpenTabForced(request: TabRequest, appColor: string): string;
68
+ /**
69
+ * Open a tab (new or focus existing)
70
+ */
71
+ OpenTab(request: TabRequest, appColor: string): string;
72
+ /**
73
+ * Close a tab
74
+ */
75
+ CloseTab(tabId: string): void;
76
+ /**
77
+ * Close all tabs except the specified one
78
+ */
79
+ CloseOtherTabs(tabId: string): void;
80
+ /**
81
+ * Close all tabs to the right of the specified tab
82
+ */
83
+ CloseTabsToRight(tabId: string): void;
84
+ /**
85
+ * Toggle pin state of a tab
86
+ */
87
+ TogglePin(tabId: string): void;
88
+ /**
89
+ * Set active tab
90
+ */
91
+ SetActiveTab(tabId: string): void;
92
+ /**
93
+ * Update tab sequences after reorder
94
+ */
95
+ UpdateTabSequences(tabIds: string[]): void;
96
+ /**
97
+ * Update layout configuration
98
+ */
99
+ UpdateLayout(layout: WorkspaceConfiguration['layout']): void;
100
+ /**
101
+ * Get tab by ID
102
+ */
103
+ GetTab(tabId: string): WorkspaceTab | undefined;
104
+ /**
105
+ * Get tabs for a specific application
106
+ */
107
+ GetAppTabs(appId: string): WorkspaceTab[];
108
+ /**
109
+ * Update the title of a specific tab
110
+ */
111
+ UpdateTabTitle(tabId: string, newTitle: string): void;
112
+ /**
113
+ * Generate UUID for new tabs
114
+ */
115
+ private generateUUID;
116
+ static ɵfac: i0.ɵɵFactoryDeclaration<WorkspaceStateManager, never>;
117
+ static ɵprov: i0.ɵɵInjectableDeclaration<WorkspaceStateManager>;
118
+ }