@memberjunction/ng-explorer-core 5.51.0 → 6.1.0-edge.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.
Files changed (47) hide show
  1. package/LICENSE +7 -0
  2. package/dist/app-routing.module.d.ts.map +1 -1
  3. package/dist/app-routing.module.js +5 -5
  4. package/dist/app-routing.module.js.map +1 -1
  5. package/dist/lib/resource-wrappers/dashboard-resource.component.d.ts.map +1 -1
  6. package/dist/lib/resource-wrappers/dashboard-resource.component.js +28 -0
  7. package/dist/lib/resource-wrappers/dashboard-resource.component.js.map +1 -1
  8. package/dist/lib/shell/components/header/app-nav.component.d.ts +2 -1
  9. package/dist/lib/shell/components/header/app-nav.component.d.ts.map +1 -1
  10. package/dist/lib/shell/components/header/app-nav.component.js +58 -42
  11. package/dist/lib/shell/components/header/app-nav.component.js.map +1 -1
  12. package/dist/lib/shell/components/record-open/record-bar.component.d.ts +29 -0
  13. package/dist/lib/shell/components/record-open/record-bar.component.d.ts.map +1 -0
  14. package/dist/lib/shell/components/record-open/record-bar.component.js +72 -0
  15. package/dist/lib/shell/components/record-open/record-bar.component.js.map +1 -0
  16. package/dist/lib/shell/components/record-open/record-origin-crumb.component.d.ts +26 -0
  17. package/dist/lib/shell/components/record-open/record-origin-crumb.component.d.ts.map +1 -0
  18. package/dist/lib/shell/components/record-open/record-origin-crumb.component.js +140 -0
  19. package/dist/lib/shell/components/record-open/record-origin-crumb.component.js.map +1 -0
  20. package/dist/lib/shell/components/record-open/record-switcher-sheet.component.d.ts +43 -0
  21. package/dist/lib/shell/components/record-open/record-switcher-sheet.component.d.ts.map +1 -0
  22. package/dist/lib/shell/components/record-open/record-switcher-sheet.component.js +102 -0
  23. package/dist/lib/shell/components/record-open/record-switcher-sheet.component.js.map +1 -0
  24. package/dist/lib/shell/components/record-open/record-switcher.service.d.ts +21 -0
  25. package/dist/lib/shell/components/record-open/record-switcher.service.d.ts.map +1 -0
  26. package/dist/lib/shell/components/record-open/record-switcher.service.js +30 -0
  27. package/dist/lib/shell/components/record-open/record-switcher.service.js.map +1 -0
  28. package/dist/lib/shell/components/record-open/records-hub-pill.component.d.ts +63 -0
  29. package/dist/lib/shell/components/record-open/records-hub-pill.component.d.ts.map +1 -0
  30. package/dist/lib/shell/components/record-open/records-hub-pill.component.js +143 -0
  31. package/dist/lib/shell/components/record-open/records-hub-pill.component.js.map +1 -0
  32. package/dist/lib/shell/components/tabs/tab-container.component.d.ts +228 -2
  33. package/dist/lib/shell/components/tabs/tab-container.component.d.ts.map +1 -1
  34. package/dist/lib/shell/components/tabs/tab-container.component.js +1073 -113
  35. package/dist/lib/shell/components/tabs/tab-container.component.js.map +1 -1
  36. package/dist/lib/shell/services/sharing-center-dialog-host.component.d.ts.map +1 -1
  37. package/dist/lib/shell/services/sharing-center-dialog-host.component.js +2 -0
  38. package/dist/lib/shell/services/sharing-center-dialog-host.component.js.map +1 -1
  39. package/dist/lib/shell/shell.component.d.ts +41 -4
  40. package/dist/lib/shell/shell.component.d.ts.map +1 -1
  41. package/dist/lib/shell/shell.component.js +400 -240
  42. package/dist/lib/shell/shell.component.js.map +1 -1
  43. package/dist/lib/shell/shell.module.d.ts +4 -1
  44. package/dist/lib/shell/shell.module.d.ts.map +1 -1
  45. package/dist/lib/shell/shell.module.js +14 -3
  46. package/dist/lib/shell/shell.module.js.map +1 -1
  47. package/package.json +62 -59
@@ -1 +1 @@
1
- {"version":3,"file":"tab-container.component.js","sourceRoot":"","sources":["../../../../../src/lib/shell/components/tabs/tab-container.component.ts","../../../../../src/lib/shell/components/tabs/tab-container.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAIT,SAAS,EAIT,qBAAqB,EACrB,eAAe,EAEf,iBAAiB,EAEjB,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,MAAM,EACP,MAAM,eAAe,CAAC;AAWvB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,qBAAq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,8EAA8E,CAAC;QAEpG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACxB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACvB,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAE1B,qEAAqE;QACrE,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACnC,CAAC;+GA7uDU,qBAAqB;6DAArB,qBAAqB;;;;;;;YAArB,4FAAA,oBAAgB,wBAAK;;YCtDlC,8BAA2B;YAMvB,AAFF,uFAA6B,iEAEpB;YAMT,yFAA0B;YAkC5B,iBAAM;;YA1CJ,cAKC;YALD,mDAKC;YAGD,eAiCC;YAjCD,iDAiCC;;;iFDSU,qBAAqB;cAPjC,SAAS;6BACI,KAAK,YACP,kBAAkB,iBAGb,iBAAiB,CAAC,IAAI;;kBAGpC,SAAS;mBAAC,aAAa,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;kBAC1C,SAAS;mBAAC,wBAAwB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;kBAOrD,MAAM;;kBAMN,MAAM;;kBAyUN,YAAY;mBAAC,eAAe;;kFAxVlB,qBAAqB","sourcesContent":["import {\n Component,\n OnInit,\n OnDestroy,\n AfterViewInit,\n ViewChild,\n ElementRef,\n ApplicationRef,\n EnvironmentInjector,\n runInInjectionContext,\n createComponent,\n ComponentRef,\n ViewEncapsulation,\n ChangeDetectorRef,\n HostListener,\n Output,\n EventEmitter,\n inject\n} from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport {\n GoldenLayoutManager,\n WorkspaceStateManager,\n ApplicationManager,\n TabComponentState,\n TabShownEvent,\n WorkspaceTab,\n LayoutNode\n} from '@memberjunction/ng-base-application';\nimport { MJGlobal } from '@memberjunction/global';\nimport { BaseResourceComponent, HomeAppPinService, NavigationService } from '@memberjunction/ng-shared';\nimport { ResourceData, MJResourceTypeEntity, ResourcePermissionEngine } from '@memberjunction/core-entities';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { BaseEntity, DatasetResultType, LogError, Metadata } from '@memberjunction/core';\nimport { ComponentCacheManager, CachedComponentInfo } from './component-cache-manager';\n\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\n/**\n * Container for Golden Layout tabs with app-colored styling.\n *\n * Handles:\n * - Golden Layout initialization\n * - Tab creation and styling\n * - Lazy loading of tab content\n * - Context menu for pin/close\n * - Layout persistence\n */\n@Component({\n standalone: false,\n selector: 'mj-tab-container',\n templateUrl: './tab-container.component.html',\n styleUrls: ['./tab-container.component.css'],\n encapsulation: ViewEncapsulation.None\n})\nexport class TabContainerComponent extends BaseAngularComponent implements OnInit, OnDestroy, AfterViewInit {\n @ViewChild('glContainer', { static: false }) glContainer!: ElementRef<HTMLDivElement>;\n @ViewChild('directContentContainer', { static: false }) directContentContainer!: ElementRef<HTMLDivElement>;\n\n /**\n * Emitted when the first resource component finishes loading.\n * This allows the shell to keep showing its loading indicator until the first\n * resource is ready, eliminating the visual gap between shell loading and resource loading.\n */\n @Output() firstResourceLoadComplete = new EventEmitter<void>();\n\n /**\n * Emitted when Golden Layout fails to initialize after multiple retries.\n * The shell can use this to show an error dialog and redirect.\n */\n @Output() layoutInitError = new EventEmitter<void>();\n\n private pinService = inject(HomeAppPinService);\n private navigationService = inject(NavigationService);\n private subscriptions: Subscription[] = [];\n private layoutInitRetryCount = 0;\n private readonly MAX_LAYOUT_INIT_RETRIES = 5;\n private layoutInitialized = false;\n private layoutRestorationComplete = false; // True only AFTER layout is fully restored/created\n\n // Track component references for cleanup (legacy - keep for backward compat during transition)\n private componentRefs = new Map<string, ComponentRef<BaseResourceComponent>>();\n\n // Guard against concurrent loadTabContent calls for the same tab.\n // When a tab's content changes while active, both the reload path (workspace config subscription)\n // and onTabShown can race to call loadTabContent, resulting in duplicate component rendering.\n private tabsCurrentlyLoading = new Set<string>();\n\n // NEW: Smart component cache for preserving state across tab switches\n private cacheManager: ComponentCacheManager;\n\n // Single-resource mode: render component directly without Golden Layout\n // This avoids the 20px height issue when GL header is hidden\n useSingleResourceMode = false;\n private singleResourceComponentRef: ComponentRef<BaseResourceComponent> | null = null;\n /** Cache identity of the current single-resource component for detachment */\n private singleResourceCacheIdentity: { driverClass: string; recordId: string; appId: string; tabId: string; discriminator?: string } | null = null;\n private previousTabBarVisible: boolean | null = null;\n private currentSingleResourceSignature: string | null = null; // Track loaded content signature to avoid unnecessary reloads\n private isCreatingInitialTabs = false; // Flag to prevent syncTabsWithConfiguration during initial tab creation\n\n // Context menu state\n contextMenuVisible = false;\n contextMenuX = 0;\n contextMenuY = 0;\n contextMenuTabId: string | null = null;\n\n constructor(\n private layoutManager: GoldenLayoutManager,\n private workspaceManager: WorkspaceStateManager,\n private appManager: ApplicationManager,\n private appRef: ApplicationRef,\n private environmentInjector: EnvironmentInjector,\n private cdr: ChangeDetectorRef\n ) {\n super();\n // Initialize component cache manager\n this.cacheManager = new ComponentCacheManager(this.appRef, this.navigationService);\n }\n\n ngOnInit(): void {\n // Subscribe to tab events\n this.subscriptions.push(\n this.layoutManager.TabShown.subscribe(event => {\n this.onTabShown(event);\n }),\n this.layoutManager.TabClosed.subscribe(tabId => {\n this.cleanupTabComponent(tabId);\n this.workspaceManager.CloseTab(tabId);\n }),\n this.layoutManager.LayoutChanged.subscribe(event => {\n const layout = this.layoutManager.SaveLayout();\n this.workspaceManager.UpdateLayout(layout);\n }),\n this.layoutManager.ActiveTab.subscribe(tabId => {\n if (tabId) {\n this.workspaceManager.SetActiveTab(tabId);\n }\n }),\n this.layoutManager.TabDoubleClicked.subscribe(tabId => {\n this.workspaceManager.TogglePin(tabId);\n }),\n this.layoutManager.TabRightClicked.subscribe(event => {\n this.showContextMenu(event.x, event.y, event.tabId);\n })\n );\n\n // Subscribe to configuration changes to sync tabs\n this.subscriptions.push(\n this.workspaceManager.Configuration.subscribe(config => {\n if (config) {\n if (this.useSingleResourceMode) {\n // In single-resource mode, reload content if the tab content changed\n // The same tab ID can have different content (tab gets reused)\n const activeTab = config.tabs.find(t => t.id === config.activeTabId) || config.tabs[0];\n if (activeTab) {\n const signature = this.getTabContentSignature(activeTab);\n if (signature !== this.currentSingleResourceSignature) {\n // DO NOT call saveCurrentComponentQueryParams() here — by the time this\n // subscription fires, OpenTab has already replaced the tab config with the\n // new nav item's config, so queryParams are gone. The cache entry already\n // has the correct queryParams from the most recent unchanged-signature save.\n this.loadSingleResourceContent();\n } else {\n // Signature unchanged — sync queryParams to cache entry so it stays current.\n // This catches incremental queryParam updates (e.g., user selects a conversation).\n this.saveCurrentComponentQueryParams();\n }\n }\n } else if (this.layoutRestorationComplete && !this.isCreatingInitialTabs) {\n // In multi-tab mode, sync with Golden Layout\n // IMPORTANT: Only sync AFTER layout restoration is complete to avoid creating duplicate tabs\n // layoutRestorationComplete is set to true only after initializeGoldenLayout finishes\n this.syncTabsWithConfiguration(config.tabs);\n }\n }\n })\n );\n\n // Subscribe to tab bar visibility changes for single-resource mode\n this.subscriptions.push(\n this.workspaceManager.TabBarVisible.subscribe(tabBarVisible => {\n this.handleTabBarVisibilityChange(tabBarVisible);\n })\n );\n }\n\n ngAfterViewInit(): void {\n // Initialize Golden Layout only if we're not in single-resource mode\n if (!this.useSingleResourceMode) {\n this.initializeGoldenLayout();\n } else {\n // In single-resource mode, load content directly\n this.loadSingleResourceContent();\n }\n }\n\n /**\n * Initialize Golden Layout and load tabs\n * @param forceCreateTabs - If true, always creates tabs fresh from config.tabs instead of restoring saved layout\n */\n private initializeGoldenLayout(forceCreateTabs = false): void {\n // If we are in single resource mode we do NOT need to do this work as golden layout should not exist in that state\n if (this.useSingleResourceMode)\n return;\n\n if (!this.glContainer?.nativeElement) {\n this.layoutInitRetryCount++;\n\n if (this.layoutInitRetryCount > this.MAX_LAYOUT_INIT_RETRIES) {\n console.error(`Golden Layout container not available after ${this.MAX_LAYOUT_INIT_RETRIES} retries, emitting error`);\n this.layoutInitError.emit();\n return;\n }\n\n console.warn(`Golden Layout container not available, retry ${this.layoutInitRetryCount}/${this.MAX_LAYOUT_INIT_RETRIES}...`);\n setTimeout(() => this.initializeGoldenLayout(forceCreateTabs), 50);\n return;\n }\n\n // Reset retry counter on success\n this.layoutInitRetryCount = 0;\n\n if (this.layoutInitialized) {\n return; // Already initialized\n }\n\n // Check if configuration is available\n // If not, wait for it to be loaded before proceeding\n const config = this.workspaceManager.GetConfiguration();\n if (!config) {\n // Configuration not loaded yet - wait for it\n const configSub = this.workspaceManager.Configuration.subscribe(loadedConfig => {\n if (loadedConfig) {\n configSub.unsubscribe();\n // Re-call initializeGoldenLayout now that config is available\n this.initializeGoldenLayout(forceCreateTabs);\n }\n });\n return;\n }\n\n // Initialize Golden Layout (we have config now)\n this.layoutManager.Initialize(this.glContainer.nativeElement);\n\n // Mark layout as initialized\n this.layoutInitialized = true;\n\n // Check if config has no tabs\n if (config.tabs.length === 0) {\n // No tabs to load, but mark restoration as complete\n this.layoutRestorationComplete = true;\n return;\n }\n\n // Check if we have a saved layout structure with actual content\n const hasSavedLayout = config.layout?.root?.content && config.layout.root.content.length > 0;\n\n if (hasSavedLayout && !forceCreateTabs && config.layout) {\n // VALIDATE: Check that layout component count matches tabs array count\n const layoutComponentCount = this.countLayoutComponents(config.layout.root);\n if (layoutComponentCount !== config.tabs.length) {\n console.warn(`[TabContainer.initializeGoldenLayout] Layout/tabs mismatch: layout has ${layoutComponentCount} components but tabs array has ${config.tabs.length} tabs. Clearing layout.`);\n this.workspaceManager.ClearLayout();\n // Fall through to create fresh tabs\n } else {\n // RESTORE SAVED LAYOUT - preserves drag/drop arrangements (stacks, columns, rows)\n // This is the single source of truth for visual arrangement\n const layoutLoaded = this.layoutManager.LoadLayout(config.layout);\n\n if (layoutLoaded) {\n // Mark layout restoration as complete AFTER layout is loaded\n this.layoutRestorationComplete = true;\n\n // Focus active tab and ensure proper sizing\n // Also trigger updateSize() to force Golden Layout to fire 'show' events\n // for the active tab in ALL stacks (not just the globally active tab)\n setTimeout(() => {\n if (config.activeTabId) {\n this.layoutManager.FocusTab(config.activeTabId);\n }\n // Trigger resize to ensure all visible tabs in all stacks render their content\n this.layoutManager.updateSize();\n }, 50);\n return; // Layout restored successfully\n }\n\n // Layout load FAILED - clear the corrupted layout and fall through to create tabs fresh\n console.warn('[TabContainer] Saved layout was corrupted, clearing and recreating tabs');\n this.workspaceManager.ClearLayout();\n }\n }\n\n // CREATE FRESH - no saved layout, forceCreateTabs=true, or layout load failed\n // Use config.tabs sorted by sequence to build a simple single-stack layout\n const sortedTabs = [...config.tabs].sort((a, b) => a.sequence - b.sequence);\n\n this.isCreatingInitialTabs = true;\n try {\n sortedTabs.forEach(tab => {\n this.createTab(tab);\n });\n } finally {\n this.isCreatingInitialTabs = false;\n }\n\n // Mark layout restoration as complete AFTER tabs are created\n this.layoutRestorationComplete = true;\n\n setTimeout(() => {\n if (config.activeTabId) {\n this.layoutManager.FocusTab(config.activeTabId);\n }\n }, 50);\n }\n\n /**\n * Clear cached components matching a predicate. Components that match are\n * destroyed; others are kept. Use for tenant switching — clear org-scoped\n * components while keeping system/global components alive.\n *\n * @param predicate Return true for components that should be destroyed.\n * If omitted, clears ALL cached components.\n * @returns Number of components destroyed.\n */\n public ClearComponentCache(predicate?: (info: CachedComponentInfo) => boolean): number {\n if (predicate) {\n return this.cacheManager.ClearCacheByPredicate(predicate);\n }\n const stats = this.cacheManager.getCacheStats();\n this.cacheManager.clearCache();\n return stats.total;\n }\n\n /**\n * Destroy all cached components and reload open tabs.\n *\n * In single-resource mode: clears the signature to force a reload, then\n * re-invokes loadSingleResourceContent().\n *\n * In multi-tab mode: destroys all cached components, marks all tabs as\n * not-loaded, then reloads the currently active tab immediately. Other\n * tabs reload lazily when the user switches to them (onTabShown fires\n * with isFirstShow=true after MarkTabNotLoaded).\n *\n * Use this for tenant switching — tabs stay open but their components\n * are recreated fresh with the new org context.\n */\n public async ReloadAllTabs(): Promise<void> {\n // Destroy all cached component instances\n this.cacheManager.clearCache();\n\n if (this.useSingleResourceMode) {\n // Force reload by clearing the signature check\n this.currentSingleResourceSignature = null;\n this.singleResourceComponentRef = null;\n this.singleResourceCacheIdentity = null;\n await this.loadSingleResourceContent();\n } else {\n // Mark all tabs as not-loaded so onTabShown will trigger loadTabContent\n const tabIds = this.layoutManager.GetAllTabIds();\n for (const tabId of tabIds) {\n this.layoutManager.MarkTabNotLoaded(tabId);\n }\n\n // Reload the currently active tab immediately\n const activeTabId = this.workspaceManager.GetActiveTabId();\n if (activeTabId && this.layoutManager.IsInitialized) {\n const container = this.layoutManager.GetContainer(activeTabId);\n if (container) {\n await this.loadTabContent(activeTabId, container);\n this.layoutManager.MarkTabLoaded(activeTabId);\n }\n }\n }\n }\n\n ngOnDestroy(): void {\n this.subscriptions.forEach(sub => sub.unsubscribe());\n\n // Cleanup single-resource mode component if exists\n this.cleanupSingleResourceComponent();\n\n // Clear the component cache (destroys all components)\n this.cacheManager.clearCache();\n\n // Cleanup any legacy componentRefs\n this.componentRefs.forEach((ref, _tabId) => {\n this.appRef.detachView(ref.hostView);\n ref.destroy();\n });\n this.componentRefs.clear();\n }\n\n /**\n * Handle window resize events as a fallback safety mechanism.\n * Golden Layout's ResizeObserver should handle most cases, but this\n * ensures the layout is properly sized after browser window changes.\n */\n @HostListener('window:resize')\n onWindowResize(): void {\n if (this.layoutInitialized && !this.useSingleResourceMode) {\n this.layoutManager.updateSize();\n }\n }\n\n /**\n * Handle changes to tab bar visibility - switches between single-resource and multi-tab modes\n */\n private handleTabBarVisibilityChange(tabBarVisible: boolean): void {\n // Skip if no change\n if (this.previousTabBarVisible === tabBarVisible) {\n return;\n }\n this.previousTabBarVisible = tabBarVisible;\n\n // Determine if we should use single-resource mode\n const shouldUseSingleResourceMode = !tabBarVisible;\n\n if (shouldUseSingleResourceMode !== this.useSingleResourceMode) {\n this.useSingleResourceMode = shouldUseSingleResourceMode;\n // Defer detectChanges to next microtask to avoid ExpressionChangedAfterItHasBeenCheckedError\n // when this handler fires during an already-running change detection cycle.\n Promise.resolve().then(() => this.cdr.detectChanges());\n\n if (this.useSingleResourceMode) {\n // Transitioning to single-resource mode\n // **CRITICAL FIX**: Wait for the template to render directContentContainer\n // before trying to load content. detectChanges() only marks dirty, doesn't render immediately.\n setTimeout(() => {\n // First, destroy Golden Layout if it was initialized (prevents stale state)\n if (this.layoutInitialized) {\n this.layoutManager.Destroy();\n this.layoutInitialized = false;\n // Reset restoration flag too — otherwise a subsequent flip back to multi-tab\n // mode will let the Configuration subscription take the \"restoration-complete\"\n // branch and try to mutate a non-existent layout, producing\n // \"GoldenLayoutManager: Layout not initialized\" on the next AddTab.\n this.layoutRestorationComplete = false;\n }\n // Load the active tab's content directly (now container will exist)\n this.loadSingleResourceContent();\n }, 0);\n } else {\n // Transitioning to multi-tab mode\n // Pin the previously displayed tab (it was the \"current\" content in single-resource mode)\n // This ensures we only have ONE temporary tab at a time\n const config = this.workspaceManager.GetConfiguration();\n if (config && config.tabs.length > 0) {\n // The new tab (just added via OpenTabForced) is now the activeTabId\n // All OTHER unpinned tabs should be pinned since they represent content\n // the user explicitly kept open\n const updatedTabs = config.tabs.map(tab => {\n // Pin all tabs except the newly active one (which is the temporary tab)\n if (tab.id !== config.activeTabId && !tab.isPinned) {\n return { ...tab, isPinned: true };\n }\n return tab;\n });\n\n // Only update if we actually changed something\n const hasChanges = updatedTabs.some((tab, i) => tab.isPinned !== config.tabs[i].isPinned);\n if (hasChanges) {\n this.workspaceManager.UpdateConfiguration({\n ...config,\n tabs: updatedTabs\n });\n }\n }\n\n // Clean up direct component, Golden Layout will handle tabs\n this.cleanupSingleResourceComponent();\n this.currentSingleResourceSignature = null; // Reset tracking\n\n // Reset layout initialized flag since we're switching from single-resource mode\n // The gl-container is a new DOM element (due to @if), so we need fresh initialization\n this.layoutInitialized = false;\n // Restoration is also undone — see comment above on the single-resource branch.\n this.layoutRestorationComplete = false;\n\n // Initialize Golden Layout - use setTimeout to allow the template to update first\n // and ensure the gl-container div exists in the DOM\n // IMPORTANT: Use forceCreateTabs=true to create tabs fresh from config.tabs\n // instead of restoring potentially stale saved layout structure\n setTimeout(() => {\n this.initializeGoldenLayout(true /* forceCreateTabs */);\n }, 0);\n }\n }\n }\n\n /**\n * Load content directly for single-resource mode (bypasses Golden Layout)\n */\n private async loadSingleResourceContent(): Promise<void> {\n // Wait for next tick to ensure the container is rendered\n await Promise.resolve();\n\n const config = this.workspaceManager.GetConfiguration();\n if (!config || config.tabs.length === 0) {\n return;\n }\n\n // Get the active tab (or first tab)\n const activeTab = config.tabs.find(t => t.id === config.activeTabId) || config.tabs[0];\n if (!activeTab) {\n // Config has tabs but none match activeTabId and the array fallback failed.\n // This shouldn't happen, but if it does, unblock the loading screen.\n this.emitFirstLoadCompleteOnce();\n return;\n }\n\n // Track which content we're loading (signature includes resource type and record ID)\n const newSignature = this.getTabContentSignature(activeTab);\n if (this.currentSingleResourceSignature === newSignature) {\n // Content already loaded, no action needed\n return;\n }\n this.currentSingleResourceSignature = newSignature;\n\n // Get the container element\n const container = this.directContentContainer?.nativeElement;\n if (!container) {\n // Retry after view is updated\n setTimeout(() => this.loadSingleResourceContent(), 50);\n return;\n }\n\n // Create ResourceData from tab\n const resourceData = await this.getResourceDataFromTab(activeTab);\n if (!resourceData) {\n LogError(`Unable to create ResourceData for tab: ${activeTab.title}`);\n // Unblock the shell's loading overlay — stale or malformed tab config shouldn't\n // leave the user stuck on the loading screen forever\n this.emitFirstLoadCompleteOnce();\n return;\n }\n\n // Get driver class for component lookup\n const driverClass = resourceData.Configuration?.resourceTypeDriverClass || resourceData.ResourceType;\n // Entity name discriminates between \"new record\" tabs of different entities (all\n // have empty ResourceRecordID otherwise). For non-Records resources this is undefined.\n const cacheDiscriminator = resourceData.Configuration?.Entity as string | undefined;\n\n // **OPTIMIZATION: Check cache first to reuse existing loaded component**\n const cached = this.cacheManager.getCachedComponent(\n driverClass,\n resourceData.ResourceRecordID || '',\n activeTab.applicationId,\n cacheDiscriminator\n );\n\n if (cached) {\n // Clean up previous single-resource component (if different)\n this.cleanupSingleResourceComponent();\n\n // Mark cached component as attached to this tab (it was detached / available for reuse).\n // IMPORTANT: We use markAsAttached here, NOT markAsDetached — the component is being\n // reattached to the DOM and should NOT be eligible for LRU eviction.\n this.cacheManager.markAsAttached(\n driverClass,\n resourceData.ResourceRecordID || '',\n activeTab.applicationId,\n activeTab.id,\n cacheDiscriminator\n );\n\n // Reattach the cached wrapper element to single-resource container\n cached.wrapperElement.style.height = \"100%\"; // Ensure full height\n container.appendChild(cached.wrapperElement);\n\n // Store reference and identity for cleanup/detachment\n this.singleResourceComponentRef = cached.componentRef;\n this.singleResourceCacheIdentity = { driverClass, recordId: resourceData.ResourceRecordID || '', appId: activeTab.applicationId, tabId: activeTab.id, discriminator: cacheDiscriminator };\n\n // Reconcile the cached component's preserved queryParams with any INCOMING navigation\n // intent already on the tab config (e.g. a Home pin / deep link that targeted a specific\n // conversation via SwitchToApp before we got here).\n //\n // - If the tab has incoming queryParams, those are the source of truth: keep them and\n // sync the cache's snapshot to match. The component's reactive query-param subscription\n // (alive while detached) delivers them, so it switches to the requested state. Restoring\n // savedQueryParams here instead would clobber the navigation intent — the bug where two\n // conversation pins both reopened whatever chat was already cached.\n // - Only when there's NO incoming intent (a plain tab re-focus) do we restore the\n // component's own preserved params so the URL reflects its retained state.\n const incomingQP = activeTab.configuration?.['queryParams'] as Record<string, string> | undefined;\n const hasIncomingQP = incomingQP != null && Object.keys(incomingQP).length > 0;\n if (hasIncomingQP) {\n cached.savedQueryParams = { ...incomingQP };\n } else if (cached.savedQueryParams) {\n this.workspaceManager.UpdateTabConfiguration(activeTab.id, {\n queryParams: cached.savedQueryParams\n });\n // Do NOT clear savedQueryParams here — the else branch (unchanged-signature saves)\n // will keep it current while the component is active. Clearing it would cause the\n // queryParams to be lost on the next detach/reattach cycle.\n }\n\n // Cached component is already loaded — emit load-complete so the shell clears its\n // loading overlay. Without this, single-tab mode navigation to a cached resource\n // leaves the overlay blocking all user interaction.\n this.emitFirstLoadCompleteOnce();\n\n return;\n }\n\n // Get the component registration (with lazy loading fallback via ClassFactory)\n const resourceReg = await MJGlobal.Instance.ClassFactory.GetRegistrationAsync(\n BaseResourceComponent,\n driverClass\n );\n\n if (!resourceReg) {\n LogError(`Unable to find resource registration for driver class: ${driverClass}`);\n // Show the user something actionable instead of an empty pane, and unblock the\n // shell's first-load gate so the loading overlay clears.\n this.cleanupSingleResourceComponent();\n this.renderMissingResourceError(container, driverClass, {\n mode: 'single-resource',\n appId: activeTab.applicationId,\n tabId: activeTab.id,\n resourceType: resourceData.ResourceType,\n recordId: resourceData.ResourceRecordID || null,\n });\n return;\n }\n\n // Clean up previous component if any\n this.cleanupSingleResourceComponent();\n\n // Create the component dynamically\n const componentRef = createComponent(resourceReg.SubClass, {\n environmentInjector: this.environmentInjector\n });\n\n // Attach to Angular's change detection\n this.appRef.attachView(componentRef.hostView);\n\n // Set the resource data on the component\n const instance = componentRef.instance as BaseResourceComponent;\n instance.Data = resourceData;\n\n // Wire up events\n instance.LoadCompleteEvent = () => {\n this.emitFirstLoadCompleteOnce();\n };\n\n // Wire up display name change for single-resource mode.\n // Guard: only update the title if THIS component is the currently displayed one.\n // Without this guard, cached components (detached but alive) can fire this callback\n // and overwrite the active tab's title with a stale name.\n instance.DisplayNameChangedEvent = (newName: string) => {\n if (this.singleResourceComponentRef?.instance === instance) {\n const tabId = this.workspaceManager.GetActiveTabId();\n if (tabId) {\n this.workspaceManager.UpdateTabTitle(tabId, newName);\n }\n }\n };\n\n // When a record is saved, re-key the tab and cache (new-record → saved transition)\n // and refresh the tab title to reflect the entity's current display name.\n instance.ResourceRecordSavedEvent = (entity: BaseEntity) => {\n this.handleResourceRecordSaved(driverClass, activeTab.applicationId, activeTab.id, instance, entity);\n };\n\n // Resource asked to be closed (e.g., user discarded a brand-new record — there's\n // no actual record to view, so leaving the tab open serves no purpose and would\n // also poison the cache for the next \"Create New\" click of the same entity).\n instance.ResourceCloseRequestedEvent = () => {\n this.handleResourceCloseRequested(activeTab.id, instance);\n };\n\n // Get the native element and append to container\n const nativeElement = (componentRef.hostView as unknown as { rootNodes: HTMLElement[] }).rootNodes[0];\n container.appendChild(nativeElement);\n // now make sure that the container's direct child is 100% height\n if (container.children?.length > 0) {\n (container.children[0] as any).style.height = \"100%\";\n }\n\n // Cache the component for reuse when switching between nav items within the same app.\n // Without this, every nav switch creates a brand new component from scratch.\n const wrapperElement = nativeElement;\n this.cacheManager.cacheComponent(\n componentRef as ComponentRef<BaseResourceComponent>,\n wrapperElement,\n resourceData,\n activeTab.id\n );\n\n // Store reference and identity for cleanup/detachment\n this.singleResourceComponentRef = componentRef as ComponentRef<BaseResourceComponent>;\n this.singleResourceCacheIdentity = { driverClass, recordId: resourceData.ResourceRecordID || '', appId: activeTab.applicationId, tabId: activeTab.id, discriminator: cacheDiscriminator };\n }\n\n /**\n * Clean up single-resource mode component\n */\n /**\n * Detaches the current single-resource component from the DOM and marks it as\n * available for reuse in the component cache.\n *\n * ╔══════════════════════════════════════════════════════════════════════════╗\n * ║ ⚠️ DO NOT DESTROY THE COMPONENT HERE — INTENTIONAL DESIGN CHOICE ⚠️ ║\n * ║ ║\n * ║ The component is DETACHED from the DOM, NOT destroyed. It stays alive ║\n * ║ in the ComponentCacheManager with its full Angular state preserved ║\n * ║ (properties, subscriptions, loaded data, scroll position, etc). ║\n * ║ ║\n * ║ When the user returns to this tab, the cached component is reattached ║\n * ║ instantly — no data reload, no API calls, no flash of empty content. ║\n * ║ ║\n * ║ Destroying components here \"for memory optimization\" is a net ║\n * ║ NEGATIVE: the reload on return is far more expensive (DB queries, ║\n * ║ API calls, re-rendering) than keeping the component in memory. ║\n * ║ The LRU eviction in ComponentCacheManager handles memory limits — ║\n * ║ when MaxDetachedComponents is exceeded, the LEAST recently used ║\n * ║ components are evicted automatically. ║\n * ║ ║\n * ║ If you think memory is a problem, adjust MaxDetachedComponents ║\n * ║ instead of destroying components here. ║\n * ╚══════════════════════════════════════════════════════════════════════════╝\n */\n /**\n * Save the currently displayed component's queryParams to its cache entry.\n * Called on every config change so the cache entry always has the latest queryParams,\n * even after the tab config is overwritten by a new nav item.\n */\n private saveCurrentComponentQueryParams(): void {\n if (!this.singleResourceCacheIdentity) return;\n\n const { tabId } = this.singleResourceCacheIdentity;\n const tab = this.workspaceManager.GetTab(tabId);\n const qp = tab?.configuration?.['queryParams'] as Record<string, string> | undefined;\n const cached = this.cacheManager.getComponentByTabId(tabId);\n if (cached) {\n cached.savedQueryParams = (qp && Object.keys(qp).length > 0) ? { ...qp } : undefined;\n }\n }\n\n private cleanupSingleResourceComponent(): void {\n if (this.singleResourceComponentRef) {\n if (this.singleResourceCacheIdentity) {\n const { driverClass, recordId, appId, discriminator } = this.singleResourceCacheIdentity;\n // Mark as DETACHED by resource identity — the ONE consistent key used everywhere.\n this.cacheManager.markAsDetached(driverClass, recordId, appId, discriminator);\n }\n this.singleResourceComponentRef = null;\n this.singleResourceCacheIdentity = null;\n }\n\n // Remove children from the container. This detaches the wrapper DOM element\n // without destroying the Angular component — it lives on in the cache.\n // Using removeChild (not innerHTML='') to avoid aggressive DOM cleanup.\n const container = this.directContentContainer?.nativeElement;\n if (container) {\n while (container.firstChild) {\n container.removeChild(container.firstChild);\n }\n }\n }\n\n /**\n * Handle a record-saved event from a hosted resource component.\n *\n * Does two things on every save:\n *\n * 1. **Re-key new-record tabs.** When a tab opened as \"Create New Record\" (empty\n * `resourceRecordId`) transitions to a saved record, we update both the workspace\n * tab's id and the component-cache key to the new PK. Without this, the next\n * `OpenNewEntityRecord(<sameEntity>)` would match this tab (both have empty\n * `resourceRecordId`) and focus the stale form instead of opening a fresh one.\n * For existing records being re-saved, this step is a no-op.\n *\n * 2. **Refresh the tab title.** Whether new or existing, the entity's display name\n * (typically its `Name` field) may have changed. We call the resource component's\n * `GetResourceDisplayName` and push the result to the tab — so a tab that read\n * \"New Foo Record\" before save now reads the actual entered name.\n */\n private handleResourceRecordSaved(\n driverClass: string,\n appId: string,\n tabId: string,\n instance: BaseResourceComponent,\n entity: BaseEntity\n ): void {\n const tab = this.workspaceManager.GetTab(tabId);\n if (!tab) {\n return;\n }\n\n const oldRecordId = tab.resourceRecordId || '';\n // ToURLSegment, NOT ToString — must match the format NavigationService.OpenEntityRecord\n // uses and that EntityRecordResource.GetPrimaryKey expects via LoadFromURLSegment.\n const newRecordId = entity?.PrimaryKey?.ToURLSegment?.() ?? '';\n const isNewRecordTransition = oldRecordId === '' && !!newRecordId;\n // The cache entry for an empty-recordId tab was keyed with the entity name as\n // discriminator (to avoid new-record collisions across entities). Re-key has to\n // pass that same old discriminator to find the entry. After save the record has\n // a real PK, so the new key needs no discriminator.\n const oldDiscriminator = tab.configuration?.['Entity'] as string | undefined;\n\n if (isNewRecordTransition) {\n // Re-key the cache entry first, so when the workspace config emission triggers\n // signature/needsReload checks below, the cache lookup at the new id succeeds.\n this.cacheManager.rekeyComponent(driverClass, oldRecordId, newRecordId, appId, oldDiscriminator, undefined);\n\n // Keep the in-memory single-resource identity in sync so detach uses the correct key.\n if (this.singleResourceCacheIdentity?.tabId === tabId) {\n this.singleResourceCacheIdentity = {\n ...this.singleResourceCacheIdentity,\n recordId: newRecordId,\n discriminator: undefined\n };\n }\n\n // Pre-compute and stamp the new signature so the configuration-subscription path\n // in single-resource mode doesn't see a \"content changed\" delta and trigger a\n // needless reload cycle (which would destroy the currently attached component).\n if (this.useSingleResourceMode && this.currentSingleResourceSignature !== null) {\n const updatedTab: WorkspaceTab = {\n ...tab,\n resourceRecordId: newRecordId,\n configuration: { ...tab.configuration, recordId: newRecordId, isNew: undefined }\n };\n this.currentSingleResourceSignature = this.getTabContentSignature(updatedTab);\n }\n\n // Propagate the new id to the workspace tab.\n this.workspaceManager.UpdateTabResourceRecordId(tabId, newRecordId);\n }\n\n // Always refresh the tab title — the entity's display-name field (typically Name)\n // may have just been set or changed. Done after the rekey so the resource component's\n // Data.ResourceRecordID reflects the saved PK before GetResourceDisplayName reads it.\n //\n // ProviderBase caches GetEntityRecordName results, so a plain call here would return\n // the pre-edit name. Pre-warm the cache with a forceRefresh so the downstream read\n // inside GetResourceDisplayName picks up the saved name. Only meaningful for entity\n // records with a PK; other resource types' GetResourceDisplayName doesn't hit the\n // record-name cache and will work either way.\n void this.refreshTabTitleAfterSave(tabId, instance, entity);\n }\n\n /**\n * After a save, invalidate the entity-record-name cache for the saved record and then\n * push the resource component's current display name into the tab title.\n *\n * Errors are swallowed (logged via the inner call paths) — failing to refresh a tab\n * title should never break the save flow.\n */\n private async refreshTabTitleAfterSave(\n tabId: string,\n instance: BaseResourceComponent,\n entity: BaseEntity\n ): Promise<void> {\n try {\n const entityName = entity?.EntityInfo?.Name;\n const pk = entity?.PrimaryKey;\n if (entityName && pk?.HasValue) {\n // forceRefresh: true overwrites the cached (pre-edit) name with the fresh one.\n // GetResourceDisplayName (called next) reads the same cache and now sees fresh data.\n const md = instance.ProviderToUse;\n await md.GetEntityRecordName(entityName, pk, md.CurrentUser, true);\n }\n } catch {\n // Cache pre-warm failures are non-fatal — the title update below will fall back\n // to whatever the cache has and the user can still interact with the form.\n }\n await this.updateTabTitleFromResource(tabId, instance, instance.Data);\n }\n\n /**\n * A resource component asked to be dismissed — typically the user clicked Discard\n * on a brand-new record. Behavior depends on workspace state:\n *\n * - **Multi-tab mode (or > 1 tab)**: just close the tab. `WorkspaceStateManager.CloseTab`\n * activates the next tab, `syncTabsWithConfiguration` removes the tab from Golden\n * Layout, and the user lands on whatever tab was previously active.\n *\n * - **Last tab in the workspace**: `CloseTab` intentionally keeps the last tab around\n * (just unpins it) so the workspace is never empty — correct for the\n * user-clicked-X-button case, wrong here. We want the user OFF this discarded form.\n * Workaround: `CloseTab` makes the tab unpinned (= a temp tab), then we open the\n * app's default tab via `CreateDefaultTab()` which goes through `OpenTab` and\n * replaces the now-temp tab. End result: user lands on the app's home/default view.\n */\n private async handleResourceCloseRequested(tabId: string, _instance: BaseResourceComponent): Promise<void> {\n const config = this.workspaceManager.GetConfiguration();\n const tab = config?.tabs.find(t => t.id === tabId);\n const isLastTab = config?.tabs.length === 1 && config.tabs[0].id === tabId;\n\n // DESTROY (not just detach) the cached component before closing. The default\n // tab-close path detaches and keeps components alive for reuse — but the\n // discarded form is exactly what we DON'T want to keep: it holds a stale\n // BaseEntity in view mode. The next \"Create New Record\" click for the same\n // entity would otherwise hit the cache discriminator lookup, find this stale\n // component, and reattach it — surfacing a blank form in view mode instead\n // of a fresh edit-mode form. Destroy here forces a cache miss on the next click.\n if (this.singleResourceCacheIdentity?.tabId === tabId) {\n // Single-resource mode: the component is tracked via singleResource* fields,\n // and its cache entry is currently marked attached. Use the identity directly\n // to destroy it (markAsDetached would clear attachedToTabId and break a\n // subsequent destroyComponentByTabId lookup).\n const { driverClass, recordId, appId, discriminator } = this.singleResourceCacheIdentity;\n this.cacheManager.destroyComponent(driverClass, recordId, appId, discriminator);\n this.singleResourceComponentRef = null;\n this.singleResourceCacheIdentity = null;\n // Clear the host container's DOM so the user isn't briefly looking at the\n // destroyed component's wrapper between CloseTab and the default-tab load.\n const directContainer = this.directContentContainer?.nativeElement;\n if (directContainer) {\n while (directContainer.firstChild) directContainer.removeChild(directContainer.firstChild);\n }\n } else {\n // Multi-tab mode: cache entry is keyed by attachedToTabId; the convenience\n // method handles the lookup.\n this.cacheManager.destroyComponentByTabId(tabId);\n this.componentRefs.delete(tabId);\n }\n\n this.workspaceManager.CloseTab(tabId);\n\n if (isLastTab && tab) {\n // CloseTab kept the tab around but unpinned it. Replace it with the app's\n // default tab so the user lands on a meaningful surface (typically the\n // home dashboard) instead of staying on the discarded form.\n const app = this.appManager.GetAppById(tab.applicationId);\n if (app) {\n const defaultTabRequest = await app.CreateDefaultTab();\n if (defaultTabRequest) {\n this.workspaceManager.OpenTab(defaultTabRequest, app.GetColor());\n }\n }\n }\n }\n\n /**\n * Generate a signature for tab content to detect when content changes\n * This is needed because in single-resource mode, the same tab ID can have different content\n */\n private getTabContentSignature(tab: WorkspaceTab): string {\n // Include key identifying fields that determine what component/content is shown\n // IMPORTANT: Check both resourceRecordId AND configuration.recordId\n // because for nav items, the recordId is stored in configuration, not resourceRecordId\n const effectiveRecordId = tab.resourceRecordId || (tab.configuration?.recordId as string) || '';\n const parts = [\n tab.applicationId,\n tab.configuration?.resourceType || '',\n tab.configuration?.driverClass || '',\n tab.configuration?.Entity || '', // Include Entity name for Records resource type\n effectiveRecordId,\n tab.configuration?.route || ''\n ];\n return parts.join('|');\n }\n\n /**\n * Create a tab in Golden Layout from workspace tab data\n */\n private createTab(tab: WorkspaceTab): void {\n const app = this.appManager.GetAppById(tab.applicationId);\n const appColor = app?.GetColor() || '#757575';\n\n const state: TabComponentState = {\n tabId: tab.id,\n appId: tab.applicationId,\n appColor,\n title: tab.title,\n route: tab.configuration['route'] as string || '',\n isPinned: tab.isPinned,\n isLoaded: false\n };\n\n this.layoutManager.AddTab(state);\n\n // Load display name in background without loading full component\n this.updateTabDisplayName(tab);\n }\n\n /**\n * Handle tab shown event for lazy loading\n */\n private async onTabShown(event: TabShownEvent): Promise<void> {\n if (event.isFirstShow) {\n // Load content for this tab\n await this.loadTabContent(event.tabId, event.container);\n this.layoutManager.MarkTabLoaded(event.tabId);\n }\n }\n\n /**\n * Load content into a tab container\n * Uses component cache to reuse components for same resources\n */\n private async loadTabContent(tabId: string, container: unknown): Promise<void> {\n // Per-tab guard: prevent concurrent loads of the same tab content.\n // This can happen when a tab's content changes while active — both the workspace\n // config subscription reload path and onTabShown can race to call this method.\n if (this.tabsCurrentlyLoading.has(tabId)) {\n return;\n }\n this.tabsCurrentlyLoading.add(tabId);\n\n try {\n const tab = this.workspaceManager.GetTab(tabId);\n if (!tab) {\n LogError(`Tab not found: ${tabId}`);\n this.emitFirstLoadCompleteOnce();\n return;\n }\n\n // Get the container element from Golden Layout\n const glContainer = container as { element: HTMLElement };\n if (!glContainer?.element) {\n LogError('Golden Layout container element not found');\n this.emitFirstLoadCompleteOnce();\n return;\n }\n\n // Extract resource data from tab configuration\n const resourceData = await this.getResourceDataFromTab(tab);\n if (!resourceData) {\n LogError(`Unable to create ResourceData for tab: ${tab.title}`);\n this.emitFirstLoadCompleteOnce();\n return;\n }\n\n // Clear any existing content from the container (important for tab reuse)\n glContainer.element.innerHTML = '';\n\n // Get driver class for cache lookup (resolves to actual component class name)\n const driverClass = resourceData.Configuration?.resourceTypeDriverClass || resourceData.ResourceType;\n // Discriminate distinct \"new record\" tabs of different entities (all have empty\n // ResourceRecordID otherwise — would silently collide in the cache).\n const cacheDiscriminator = resourceData.Configuration?.Entity as string | undefined;\n\n // Check if we have a cached component for this resource\n const cached = this.cacheManager.getCachedComponent(\n driverClass,\n resourceData.ResourceRecordID || '',\n tab.applicationId,\n cacheDiscriminator\n );\n\n if (cached) {\n // Reattach the cached wrapper element\n glContainer.element.appendChild(cached.wrapperElement);\n\n // Mark as attached to this tab\n this.cacheManager.markAsAttached(\n driverClass,\n resourceData.ResourceRecordID || '',\n tab.applicationId,\n tabId,\n cacheDiscriminator\n );\n\n // Keep legacy componentRefs map updated\n this.componentRefs.set(tabId, cached.componentRef);\n\n // If resource is already loaded, update tab title immediately and signal\n // load-complete so the shell clears any loading overlay.\n const instance = cached.componentRef.instance as BaseResourceComponent;\n if (instance.LoadComplete) {\n this.updateTabTitleFromResource(tabId, instance, resourceData);\n this.emitFirstLoadCompleteOnce();\n }\n\n return;\n }\n\n // Get the component registration using the driver class (with lazy loading fallback via ClassFactory)\n const resourceReg = await MJGlobal.Instance.ClassFactory.GetRegistrationAsync(\n BaseResourceComponent,\n driverClass\n );\n\n if (!resourceReg) {\n LogError(`Unable to find resource registration for driver class: ${driverClass}`);\n // Render an in-tab error instead of leaving the pane blank. The container was\n // already cleared above on line 754, so we just append the error UI here.\n this.renderMissingResourceError(glContainer.element, driverClass, {\n mode: 'multi-tab',\n appId: tab.applicationId,\n tabId,\n resourceType: resourceData.ResourceType,\n recordId: resourceData.ResourceRecordID || null,\n });\n return;\n }\n\n // Create the component dynamically\n const componentRef = createComponent(resourceReg.SubClass, {\n environmentInjector: this.environmentInjector\n });\n\n // Attach to Angular's change detection\n this.appRef.attachView(componentRef.hostView);\n\n // Set the resource data on the component\n const instance = componentRef.instance as BaseResourceComponent;\n instance.Data = resourceData;\n\n // Wire up events\n instance.LoadCompleteEvent = () => {\n // Tab content loaded - update tab title with resource display name\n this.updateTabTitleFromResource(tabId, instance, resourceData);\n this.emitFirstLoadCompleteOnce();\n };\n\n instance.ResourceRecordSavedEvent = (entity: BaseEntity) => {\n this.handleResourceRecordSaved(driverClass, tab.applicationId, tabId, instance, entity);\n };\n\n // Resource asked to be closed (e.g., user discarded a brand-new record).\n instance.ResourceCloseRequestedEvent = () => {\n this.handleResourceCloseRequested(tabId, instance);\n };\n\n // Wire up display name change notifications\n instance.DisplayNameChangedEvent = (newName: string) => {\n this.layoutManager.UpdateTabStyle(tabId, { title: newName });\n this.workspaceManager.UpdateTabTitle(tabId, newName);\n };\n\n // Create a container div for the component\n const componentElement = document.createElement('div');\n componentElement.className = 'tab-content-wrapper';\n componentElement.style.cssText = 'width: 100%; height: 100%;';\n\n // Append the component's native element\n const nativeElement = (componentRef.hostView as unknown as { rootNodes: HTMLElement[] }).rootNodes[0];\n componentElement.appendChild(nativeElement);\n\n // Add to Golden Layout container\n glContainer.element.appendChild(componentElement);\n\n // Cache the component for future reuse\n this.cacheManager.cacheComponent(\n componentRef as ComponentRef<BaseResourceComponent>,\n componentElement,\n resourceData,\n tabId\n );\n\n // Store reference for cleanup (legacy)\n this.componentRefs.set(tabId, componentRef as ComponentRef<BaseResourceComponent>);\n\n } catch (e) {\n // A tab whose resource can't resolve (e.g. a persisted tab referencing an\n // unknown ResourceType) must NEVER brick the shell: log, signal load-complete\n // so the boot loading screen clears, and close the poisoned tab so it doesn't\n // re-fail on every boot from restored workspace state.\n LogError(e);\n this.emitFirstLoadCompleteOnce();\n try {\n this.workspaceManager.CloseTab(tabId);\n } catch {\n // best-effort — leaving the tab is still recoverable via manual close\n }\n } finally {\n this.tabsCurrentlyLoading.delete(tabId);\n }\n }\n\n /**\n * Update tab display name in background without loading full component\n * This ensures all tabs show proper names immediately, not just when clicked\n */\n private async updateTabDisplayName(tab: WorkspaceTab): Promise<void> {\n try {\n // Only update display names for resource-based tabs\n const resourceType = tab.configuration['resourceType'] as string;\n if (!resourceType) {\n return;\n }\n\n // Get ResourceData from tab\n const resourceData = await this.getResourceDataFromTab(tab);\n if (!resourceData) {\n return;\n }\n\n // Get the resource registration to access GetResourceDisplayName without loading full component\n const driverClass = resourceData.Configuration?.resourceTypeDriverClass || resourceData.ResourceType;\n const resourceReg = await MJGlobal.Instance.ClassFactory.GetRegistrationAsync(\n BaseResourceComponent,\n driverClass\n );\n\n if (!resourceReg) {\n return;\n }\n\n // Create a lightweight instance just to call GetResourceDisplayName.\n // Must run inside an injection context because BaseResourceComponent\n // uses inject() field initializers (e.g. NavigationService).\n const tempInstance = runInInjectionContext(\n this.environmentInjector,\n () => new resourceReg.SubClass() as BaseResourceComponent\n );\n const displayName = await tempInstance.GetResourceDisplayName(resourceData);\n\n if (displayName && displayName !== tab.title) {\n // Update the tab title in Golden Layout\n this.layoutManager.UpdateTabStyle(tab.id, { title: displayName });\n\n // Update the tab title in workspace configuration for persistence\n this.workspaceManager.UpdateTabTitle(tab.id, displayName);\n }\n } catch (error) {\n console.error('[TabContainer.updateTabDisplayName] Error updating tab display name:', error);\n }\n }\n\n /**\n * Update tab title with resource display name after resource loads\n */\n private async updateTabTitleFromResource(\n tabId: string,\n resourceComponent: BaseResourceComponent,\n resourceData: ResourceData\n ): Promise<void> {\n try {\n // Get the display name from the resource component\n const displayName = await resourceComponent.GetResourceDisplayName(resourceData);\n\n if (!displayName) {\n return;\n }\n\n // Update the tab title in Golden Layout\n this.layoutManager.UpdateTabStyle(tabId, { title: displayName });\n\n // Update the tab title in workspace configuration for persistence\n this.workspaceManager.UpdateTabTitle(tabId, displayName);\n\n } catch (error) {\n console.error('[TabContainer.updateTabTitleFromResource] Error updating tab title:', error);\n }\n }\n\n /**\n * Convert tab configuration to ResourceData\n */\n private async getResourceDataFromTab(tab: WorkspaceTab): Promise<ResourceData | null> {\n const config = tab.configuration;\n\n // Extract resource type from configuration or route\n let resourceType = config['resourceType'] as string;\n\n if (!resourceType && config['route']) {\n // Parse route to determine resource type\n resourceType = this.getResourceTypeFromRoute(config['route'] as string);\n }\n\n if (!resourceType) {\n console.error('[TabContainer.getResourceDataFromTab] No resourceType found in config or route');\n return null;\n }\n\n // Determine the driver class to use for component instantiation\n let driverClass = resourceType; // Default: use resourceType as driver class\n\n // For Custom resource type, get DriverClass from configuration or ResourceType metadata\n if (resourceType.toLowerCase() === 'custom') {\n // Custom resource type uses NavItem's DriverClass\n driverClass = config['driverClass'] as string;\n\n if (!driverClass) {\n LogError('Custom resource type requires driverClass in configuration');\n console.error('[TabContainer.getResourceDataFromTab] Missing driverClass for Custom resource type');\n return null;\n }\n } else {\n // For standard resource types, look up DriverClass from metadata\n const resourceTypeEntity = await this.getResourceTypeEntity(resourceType);\n\n if (resourceTypeEntity?.DriverClass) {\n driverClass = resourceTypeEntity.DriverClass;\n } \n // If no DriverClass in metadata, fall back to resourceType (backward compatibility)\n }\n\n // Include applicationId, driverClass, and tabId in configuration\n const resourceConfig = {\n ...config,\n applicationId: tab.applicationId,\n resourceTypeDriverClass: driverClass, // Store resolved driver class for component lookup\n tabId: tab.id // Needed for query param notification scoping in BaseResourceComponent\n };\n\n // Get ResourceRecordID from config or fall back to tab.resourceRecordId\n // Important: Some tabs store the record ID in config['recordId'], others in tab.resourceRecordId\n const resourceRecordId = (config['recordId'] as string) || tab.resourceRecordId || '';\n\n const resourceData = new ResourceData({\n ResourceTypeID: await this.getResourceTypeId(resourceType),\n ResourceRecordID: resourceRecordId,\n Configuration: resourceConfig\n });\n\n return resourceData;\n }\n\n private static _resourceTypesDataset: DatasetResultType | null = null;\n\n /**\n * Get ResourceType entity by name (includes DriverClass field)\n */\n private async getResourceTypeEntity(resourceType: string): Promise<MJResourceTypeEntity | null> {\n // Use ResourcePermissionEngine's cached data instead of fetching the dataset again.\n // The engine loads ResourceTypes during startup and keeps them in memory.\n const resourceTypes = ResourcePermissionEngine.Instance.ResourceTypes;\n if (resourceTypes && resourceTypes.length > 0) {\n return TabContainerComponent.findResourceTypeTolerant(resourceTypes, resourceType);\n }\n\n // Fallback: if engine hasn't loaded yet (shouldn't happen in normal flow),\n // fetch the dataset directly\n const md = this.ProviderToUse;\n const ds = TabContainerComponent._resourceTypesDataset || await md.GetDatasetByName(\"ResourceTypes\");\n if (!ds || !ds.Success || ds.Results.length === 0) {\n return null;\n }\n\n if (!TabContainerComponent._resourceTypesDataset) {\n TabContainerComponent._resourceTypesDataset = ds; // cache for next time\n }\n\n const result = ds.Results.find(r => r.Code.trim().toLowerCase() === 'resourcetypes');\n if (result && result.Results?.length > 0) {\n return TabContainerComponent.findResourceTypeTolerant(result.Results as MJResourceTypeEntity[], resourceType);\n }\n\n return null;\n }\n\n /**\n * Resolve a resource type BY NAME, tolerant of the 'MJ: ' prefix in EITHER\n * direction — core ResourceType rows predate the prefix convention ('User Views'),\n * while newer callers may pass 'MJ: User Views' (and vice versa). Exact match wins;\n * prefix-normalized is the fallback, so historical and prefixed names both resolve.\n */\n private static findResourceTypeTolerant(rows: MJResourceTypeEntity[], resourceType: string): MJResourceTypeEntity | null {\n const wanted = resourceType.trim().toLowerCase();\n const normalize = (name: string) => name.trim().toLowerCase().replace(/^mj:\\s*/, '');\n return rows.find(r => r.Name.trim().toLowerCase() === wanted)\n ?? rows.find(r => normalize(r.Name) === normalize(wanted))\n ?? null;\n }\n\n private async getResourceTypeId(resourceType: string): Promise<string> {\n const rt = await this.getResourceTypeEntity(resourceType);\n if (rt) {\n return rt.ID;\n }\n throw new Error(`ResourceType ID not found for type: ${resourceType}`);\n }\n\n /**\n * Determine resource type from route\n */\n private getResourceTypeFromRoute(route: string): string {\n // Parse route segments to determine resource type\n const segments = route.split('/').filter(s => s);\n\n if (segments.length === 0) {\n return 'home';\n }\n\n // Common route patterns\n if (route.includes('/record/')) {\n return 'record';\n }\n if (route.includes('/view/')) {\n return 'view';\n }\n if (route.includes('/dashboard/')) {\n return 'dashboard';\n }\n if (route.includes('/report/')) {\n return 'report';\n }\n if (route.includes('/search')) {\n return 'search';\n }\n if (route.includes('/query/')) {\n return 'query';\n }\n\n // Default based on first segment\n return segments[0] || 'home';\n }\n\n /**\n * Count the number of component nodes in a layout tree.\n * Used to validate that saved layout matches the tabs array before restoring.\n */\n private countLayoutComponents(node: LayoutNode): number {\n if (!node) {\n return 0;\n }\n\n // If this is a component node, count it\n if (node.type === 'component') {\n return 1;\n }\n\n // If this node has children (row, column, stack), recursively count them\n if (node.content && Array.isArray(node.content)) {\n return node.content.reduce((count, child) => count + this.countLayoutComponents(child), 0);\n }\n\n return 0;\n }\n\n /**\n * Cleanup a tab's component\n * Detaches from DOM but keeps in cache for potential reuse\n */\n private cleanupTabComponent(tabId: string): void {\n // First, try to detach from cache (preserves component for reuse)\n const cachedInfo = this.cacheManager.findAndDetachByTabId(tabId);\n\n if (cachedInfo) {\n // Remove from legacy componentRefs but keep in cache\n this.componentRefs.delete(tabId);\n } else {\n // Fallback: destroy if not in cache (shouldn't happen in normal flow)\n const componentRef = this.componentRefs.get(tabId);\n if (componentRef) {\n this.appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n this.componentRefs.delete(tabId);\n }\n }\n }\n\n /**\n * Sync tabs with configuration changes\n */\n private syncTabsWithConfiguration(tabs: WorkspaceTab[]): void {\n // Defense in depth: skip syncing if Golden Layout isn't actually live. This can\n // happen when the visibility-mode transition has flipped `useSingleResourceMode`\n // to false and scheduled `initializeGoldenLayout(true)` via setTimeout(0), but the\n // Configuration subscription fires in the same tick before that init runs. The\n // deferred init will rebuild tabs from config via forceCreateTabs anyway.\n if (!this.layoutInitialized || !this.layoutManager.IsInitialized) {\n return;\n }\n\n // Get existing tab IDs from Golden Layout\n const existingTabIds = this.layoutManager.GetAllTabIds();\n\n // Get tab IDs from configuration\n const configTabIds = tabs.map(tab => tab.id);\n\n // Remove tabs that are no longer in configuration\n existingTabIds.forEach(tabId => {\n if (!configTabIds.includes(tabId)) {\n this.layoutManager.RemoveTab(tabId);\n }\n });\n\n // Create tabs that don't exist yet\n tabs.forEach(tab => {\n if (!existingTabIds.includes(tab.id)) {\n this.createTab(tab);\n } else {\n // Check if tab content needs to be reloaded (app or resource type changed)\n const existingComponentRef = this.componentRefs.get(tab.id);\n if (existingComponentRef) {\n const existingResourceData = existingComponentRef.instance.Data;\n\n // For Custom resource types, also check driverClass to distinguish between different custom resources\n const existingDriverClass = existingResourceData?.Configuration?.driverClass || existingResourceData?.Configuration?.resourceTypeDriverClass;\n const newDriverClass = tab.configuration['driverClass'] || tab.configuration['resourceTypeDriverClass'];\n\n // Normalize record IDs for comparison (treat null/undefined as empty string)\n // IMPORTANT: Check both tab.resourceRecordId AND tab.configuration['recordId']\n // because for nav items, the recordId is stored in configuration, not resourceRecordId\n const existingRecordId = existingResourceData?.ResourceRecordID || '';\n const newRecordId = tab.resourceRecordId || tab.configuration['recordId'] as string || '';\n\n const needsReload = existingResourceData?.ResourceType !== tab.configuration['resourceType'] ||\n existingResourceData?.Configuration?.applicationId !== tab.applicationId ||\n existingRecordId !== newRecordId ||\n (tab.configuration['resourceType'] === 'Custom' && existingDriverClass !== newDriverClass);\n\n if (needsReload) {\n // Clean up old component\n this.cleanupTabComponent(tab.id);\n\n // Mark tab as not loaded so it will reload when shown\n this.layoutManager.MarkTabNotLoaded(tab.id);\n\n // Update display name in background\n this.updateTabDisplayName(tab);\n\n // If this tab is currently active, reload it immediately\n const config = this.workspaceManager.GetConfiguration();\n if (config?.activeTabId === tab.id) {\n const glContainer = this.layoutManager.GetContainer(tab.id);\n if (glContainer) {\n this.loadTabContent(tab.id, glContainer);\n }\n }\n }\n }\n\n // Update styling for existing tabs\n const app = this.appManager.GetAppById(tab.applicationId);\n this.layoutManager.UpdateTabStyle(tab.id, {\n isPinned: tab.isPinned,\n title: tab.title,\n appColor: app?.GetColor() || '#757575'\n });\n }\n });\n\n // Focus the active tab\n const config = this.workspaceManager.GetConfiguration();\n if (config?.activeTabId) {\n this.layoutManager.FocusTab(config.activeTabId);\n }\n }\n\n\n /**\n * Show context menu\n */\n showContextMenu(x: number, y: number, tabId: string): void {\n this.contextMenuX = x;\n this.contextMenuY = y;\n this.contextMenuTabId = tabId;\n this.contextMenuVisible = true;\n\n // Close menu when clicking outside - use setTimeout to avoid immediate trigger\n setTimeout(() => {\n const clickHandler = (event: MouseEvent) => {\n const target = event.target as HTMLElement;\n if (!target.closest('.context-menu')) {\n this.hideContextMenu();\n document.removeEventListener('click', clickHandler);\n document.removeEventListener('keydown', keyHandler);\n }\n };\n\n const keyHandler = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n this.hideContextMenu();\n document.removeEventListener('click', clickHandler);\n document.removeEventListener('keydown', keyHandler);\n }\n };\n\n document.addEventListener('click', clickHandler);\n document.addEventListener('keydown', keyHandler);\n }, 0);\n }\n\n /**\n * Hide context menu\n */\n hideContextMenu(): void {\n this.contextMenuVisible = false;\n this.contextMenuTabId = null;\n }\n\n /**\n * Check if context menu tab is pinned\n */\n get isContextTabPinned(): boolean {\n if (!this.contextMenuTabId) return false;\n const tab = this.workspaceManager.GetTab(this.contextMenuTabId);\n return tab?.isPinned || false;\n }\n\n /**\n * Toggle pin from context menu\n */\n onContextPin(): void {\n if (this.contextMenuTabId) {\n this.workspaceManager.TogglePin(this.contextMenuTabId);\n }\n this.hideContextMenu();\n }\n\n /**\n * Close tab from context menu\n */\n onContextClose(): void {\n if (this.contextMenuTabId) {\n this.layoutManager.RemoveTab(this.contextMenuTabId);\n }\n this.hideContextMenu();\n }\n\n /**\n * Close all other tabs from context menu\n */\n onContextCloseOthers(): void {\n if (this.contextMenuTabId) {\n this.workspaceManager.CloseOtherTabs(this.contextMenuTabId);\n }\n this.hideContextMenu();\n }\n\n /**\n * Close tabs to the right from context menu\n */\n onContextCloseToRight(): void {\n if (this.contextMenuTabId) {\n this.workspaceManager.CloseTabsToRight(this.contextMenuTabId);\n }\n this.hideContextMenu();\n }\n\n /**\n * Check if context menu tab is pinned to Home dashboard\n */\n get isContextTabPinnedToHome(): boolean {\n if (!this.contextMenuTabId) return false;\n const tab = this.workspaceManager.GetTab(this.contextMenuTabId);\n if (!tab) return false;\n const resourceType = this.resolveResourceType(tab);\n return this.pinService.IsPinned(resourceType, tab.configuration as Record<string, unknown>);\n }\n\n /**\n * Pin current context menu tab to Home dashboard\n */\n async onContextPinToHome(): Promise<void> {\n if (this.isContextTabPinnedToHome) {\n this.hideContextMenu();\n return;\n }\n if (!this.contextMenuTabId) {\n this.hideContextMenu();\n return;\n }\n\n const tab = this.workspaceManager.GetTab(this.contextMenuTabId);\n if (!tab) {\n this.hideContextMenu();\n return;\n }\n\n const resourceType = this.resolveResourceType(tab);\n const activeApp = this.appManager.GetActiveApp();\n\n // Resolve nav item icon for Custom pins\n let pinIcon: string | undefined;\n if (resourceType === 'Custom' && activeApp) {\n const navItemName = tab.configuration?.['navItemName'] as string;\n if (navItemName) {\n const navItems = await activeApp.GetNavItems();\n const navItem = navItems.find(ni => ni.Label === navItemName);\n pinIcon = navItem?.Icon || undefined;\n }\n }\n\n const added = this.pinService.AddPin({\n DisplayName: tab.title || 'Untitled',\n ResourceType: resourceType,\n ApplicationID: tab.applicationId || activeApp?.ID,\n ApplicationName: activeApp?.Name,\n Icon: pinIcon,\n Color: activeApp?.GetColor() || undefined,\n Configuration: tab.configuration as Record<string, unknown>,\n });\n\n if (added) {\n MJNotificationService.Instance.CreateSimpleNotification(\n `Pinned \"${tab.title}\" to Home`, 'success', 2000\n );\n this.captureContextTabThumbnail(tab);\n } else {\n MJNotificationService.Instance.CreateSimpleNotification(\n `\"${tab.title}\" is already pinned to Home`, 'info', 3000\n );\n }\n\n this.hideContextMenu();\n }\n\n /**\n * Resolve a WorkspaceTab's resource type string for pin matching\n */\n private resolveResourceType(tab: WorkspaceTab): string {\n const config = tab.configuration;\n const rt = (config.resourceType as string) || '';\n if (rt === 'Dashboards' || config['dashboardId']) return 'Dashboards';\n if (rt === 'User Views' || rt === 'MJ: User Views' || config['viewId']) return 'User Views';\n if (rt === 'Queries' || config['queryId']) return 'Queries';\n if (rt === 'Reports' || config['reportId']) return 'Reports';\n if (rt === 'Records' || (config['entity'] && config['recordId'])) return 'Records';\n if (rt === 'Custom' || config['navItemName']) return 'Custom';\n return rt || 'Custom';\n }\n\n /**\n * Capture thumbnail for a just-pinned tab (async, non-blocking)\n */\n private async captureContextTabThumbnail(tab: WorkspaceTab): Promise<void> {\n try {\n // Find the active content element — differs by mode\n let contentEl: HTMLElement | null = null;\n if (this.useSingleResourceMode) {\n contentEl = this.directContentContainer?.nativeElement ?? null;\n } else {\n // In Golden Layout mode, find the active tab's content pane\n contentEl = this.glContainer?.nativeElement?.querySelector(\n '.lm_item_container .lm_content'\n ) as HTMLElement | null;\n }\n if (!contentEl) return;\n\n const thumbnail = await this.pinService.CaptureThumbnail(contentEl);\n if (thumbnail) {\n const resourceType = this.resolveResourceType(tab);\n const pin = this.pinService.FindPin(resourceType, tab.configuration as Record<string, unknown>);\n if (pin) {\n this.pinService.UpdatePin(pin.Id, { Thumbnail: thumbnail });\n }\n }\n } catch {\n // Thumbnail capture is best-effort\n }\n }\n\n /**\n * Public method for external callers (e.g. shell) to capture a thumbnail\n * of the currently visible content, regardless of mode.\n */\n public async CaptureActiveThumbnail(): Promise<string | undefined> {\n try {\n let contentEl: HTMLElement | null = null;\n if (this.useSingleResourceMode) {\n contentEl = this.directContentContainer?.nativeElement ?? null;\n } else {\n contentEl = this.glContainer?.nativeElement?.querySelector(\n '.lm_item_container .lm_content'\n ) as HTMLElement | null;\n }\n if (!contentEl) return undefined;\n return await this.pinService.CaptureThumbnail(contentEl);\n } catch {\n return undefined;\n }\n }\n\n /**\n * While the naming implies this is only invoked once, components we DO NOT CONTROL might have race\n * conditions that result in unpredictable behavior. To avoid those causing loading screen overaly to show\n * forever we emit all events upstream\n */\n private emitFirstLoadCompleteOnce(): void {\n this.firstResourceLoadComplete.emit(); // do this each time to be sure we don't suppress messages\n }\n\n /**\n * Render an inline \"missing resource component\" error into a host element when\n * ClassFactory has no registration for the requested driver class. Used when a\n * dashboard / nav item references a component class that isn't built into this\n * Angular bundle (e.g. an app-specific dashboard defined outside the running app).\n *\n * Logs a structured console.error with context for developers, and ensures the\n * shell's first-resource-load gate is satisfied so the loading overlay clears.\n */\n private renderMissingResourceError(host: HTMLElement, driverClass: string, context: Record<string, unknown>): void {\n console.error(\n `[TabContainer] No resource component registered for driver class \"${driverClass}\".\\n` +\n `MemberJunction's ClassFactory has no @RegisterClass(BaseResourceComponent, '${driverClass}') in this build. ` +\n `Either the package providing this resource is not included in the running Explorer bundle, ` +\n `the registration manifest is stale (run \\`npm run mj:manifest\\`), or the driver class name in metadata is wrong.\\n` +\n `Context: ${JSON.stringify(context, null, 2)}`\n );\n\n // Clear the host before injecting the error UI.\n host.innerHTML = '';\n const wrapper = document.createElement('div');\n wrapper.className = 'tab-content-wrapper missing-resource-error';\n wrapper.style.cssText = 'width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 32px; box-sizing: border-box;';\n wrapper.setAttribute('role', 'alert');\n\n const card = document.createElement('div');\n card.style.cssText = [\n 'max-width: 720px',\n 'width: 100%',\n 'padding: 32px',\n 'background: var(--mj-bg-surface)',\n 'border: 1px solid var(--mj-status-warning-border)',\n 'border-radius: 8px',\n 'text-align: center',\n 'color: var(--mj-text-primary)',\n 'font-family: inherit',\n ].join(';');\n\n const icon = document.createElement('div');\n icon.innerHTML = '<i class=\"fa-solid fa-puzzle-piece\"></i>';\n icon.style.cssText = 'font-size: 32px; color: var(--mj-status-warning); margin-bottom: 12px;';\n\n const title = document.createElement('h2');\n title.textContent = 'This view isn’t available in the running build.';\n title.style.cssText = 'font-size: 18px; font-weight: 600; margin: 0 0 12px 0; color: var(--mj-status-warning-text);';\n\n const detail = document.createElement('p');\n detail.textContent = `No component is registered for driver class \"${driverClass}\". The Angular package that provides this view likely isn't bundled into this Explorer build.`;\n detail.style.cssText = 'font-size: 14px; line-height: 1.5; color: var(--mj-text-secondary); margin: 0 0 12px 0;';\n\n const hint = document.createElement('p');\n hint.textContent = 'See browser console for technical details (driver class, application, nav item).';\n hint.style.cssText = 'font-size: 12px; color: var(--mj-text-muted); margin: 0; font-style: italic;';\n\n card.appendChild(icon);\n card.appendChild(title);\n card.appendChild(detail);\n card.appendChild(hint);\n wrapper.appendChild(card);\n host.appendChild(wrapper);\n\n // Unblock the shell's first-load gate so the loading overlay clears.\n this.emitFirstLoadCompleteOnce();\n }\n}\n","<div class=\"tab-container\">\n\n <!-- Single-Resource Mode: Direct component rendering without Golden Layout -->\n <!-- This avoids the 20px height issue when GL header is hidden -->\n @if (useSingleResourceMode) {\n <div #directContentContainer class=\"direct-content-container\"></div>\n } @else {\n <!-- Multi-Tab Mode: Golden Layout Container -->\n <div #glContainer class=\"gl-container\"></div>\n }\n\n <!-- Context Menu (only relevant in multi-tab mode) -->\n @if (contextMenuVisible) {\n <div\n class=\"context-menu\"\n [style.left.px]=\"contextMenuX\"\n [style.top.px]=\"contextMenuY\">\n <div class=\"context-menu-item\" (click)=\"onContextPin()\">\n <i class=\"fa-solid fa-thumbtack\"></i>\n <span>{{ isContextTabPinned ? 'Unpin Tab' : 'Pin Tab' }}</span>\n </div>\n <div class=\"context-menu-divider\"></div>\n <div class=\"context-menu-item\" [class.new-item]=\"!isContextTabPinnedToHome\" [class.disabled]=\"isContextTabPinnedToHome\" (click)=\"onContextPinToHome()\">\n <i class=\"fa-solid fa-house-chimney\"></i>\n @if (isContextTabPinnedToHome) {\n <span>Pinned to Home</span>\n <span class=\"check\"><i class=\"fa-solid fa-check\"></i></span>\n } @else {\n <span>Pin to Home</span>\n }\n </div>\n <div class=\"context-menu-divider\"></div>\n <div class=\"context-menu-item\" (click)=\"onContextClose()\">\n <i class=\"fa-solid fa-xmark\"></i>\n <span>Close Tab</span>\n </div>\n <div class=\"context-menu-item\" (click)=\"onContextCloseOthers()\">\n <i class=\"fa-solid fa-layer-group\"></i>\n <span>Close Others</span>\n </div>\n <div class=\"context-menu-item\" (click)=\"onContextCloseToRight()\">\n <i class=\"fa-solid fa-angles-right\"></i>\n <span>Close to Right</span>\n </div>\n </div>\n }\n</div>\n"]}
1
+ {"version":3,"file":"tab-container.component.js","sourceRoot":"","sources":["../../../../../src/lib/shell/components/tabs/tab-container.component.ts","../../../../../src/lib/shell/components/tabs/tab-container.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAIT,SAAS,EAIT,qBAAqB,EACrB,eAAe,EAEf,iBAAiB,EAEjB,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,MAAM,EACP,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EAOnB,0BAA0B,EAC3B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClU,OAAO,EAAE,YAAY,EAAwB,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC7G,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAiC,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAuB,MAAM,2BAA2B,CAAC;AAEvF,OAAO,EAAE,oBAAoB,EAA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,6EAA0B;YAmC1B,yFAA0B;YAoD5B,iBAAM;;YAtGqB,cAAyC;YAAzC,sDAAyC;YAGhE,cAKC;YALD,mDAKC;YAOH,eA8BC;YA9BD,iDA8BC;YAKD,cAmDC;YAnDD,iDAmDC;;;iFD7CU,qBAAqB;cAPjC,SAAS;6BACI,KAAK,YACP,kBAAkB,iBAGb,iBAAiB,CAAC,IAAI;;kBAGpC,SAAS;mBAAC,aAAa,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;kBAC1C,SAAS;mBAAC,wBAAwB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;kBACrD,SAAS;mBAAC,oBAAoB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;kBAOjD,MAAM;;kBAMN,MAAM;;kBAm6BN,YAAY;mBAAC,eAAe;;kFAn7BlB,qBAAqB","sourcesContent":["import {\n Component,\n OnInit,\n OnDestroy,\n AfterViewInit,\n ViewChild,\n ElementRef,\n ApplicationRef,\n EnvironmentInjector,\n runInInjectionContext,\n createComponent,\n ComponentRef,\n ViewEncapsulation,\n ChangeDetectorRef,\n HostListener,\n Output,\n EventEmitter,\n inject\n} from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport {\n GoldenLayoutManager,\n WorkspaceStateManager,\n ApplicationManager,\n TabComponentState,\n TabShownEvent,\n WorkspaceTab,\n LayoutNode,\n FlattenLayoutToSingleStack\n} from '@memberjunction/ng-base-application';\nimport { MJGlobal } from '@memberjunction/global';\nimport { BaseResourceComponent, HomeAppPinService, NavigationService, IsRecordTabsStyle, IsRecordsTabConfiguration, IsRecordsRegionTab, IsRecordDockedToWorkspace, RECORD_DOCKED_TO_WORKSPACE_KEY, GetRecordSourceContext, SafeDetectChanges, ExplorerBreakpointService, ResolveRecordTypeIcon } from '@memberjunction/ng-shared';\nimport { ResourceData, MJResourceTypeEntity, ResourcePermissionEngine } from '@memberjunction/core-entities';\nimport { RecordOriginCrumbComponent } from '../record-open/record-origin-crumb.component';\nimport { RecordSwitcherService } from '../record-open/record-switcher.service';\nimport { RecordSwitcherEntry } from '../record-open/record-switcher-sheet.component';\nimport { MJNotificationService } from '@memberjunction/ng-notifications';\nimport { BaseEntity, DatasetResultType, LogError, Metadata } from '@memberjunction/core';\nimport { ComponentCacheManager, CachedComponentInfo } from './component-cache-manager';\n\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\n\n/** Fallback tab accent when an app has no color (matches pre-existing usage) */\nconst DEFAULT_APP_COLOR = '#757575';\n/**\n * Container for Golden Layout tabs with app-colored styling.\n *\n * Handles:\n * - Golden Layout initialization\n * - Tab creation and styling\n * - Lazy loading of tab content\n * - Context menu for pin/close\n * - Layout persistence\n */\n@Component({\n standalone: false,\n selector: 'mj-tab-container',\n templateUrl: './tab-container.component.html',\n styleUrls: ['./tab-container.component.css'],\n encapsulation: ViewEncapsulation.None\n})\nexport class TabContainerComponent extends BaseAngularComponent implements OnInit, OnDestroy, AfterViewInit {\n @ViewChild('glContainer', { static: false }) glContainer!: ElementRef<HTMLDivElement>;\n @ViewChild('directContentContainer', { static: false }) directContentContainer!: ElementRef<HTMLDivElement>;\n @ViewChild('recordsGlContainer', { static: false }) recordsGlContainer?: ElementRef<HTMLDivElement>;\n\n /**\n * Emitted when the first resource component finishes loading.\n * This allows the shell to keep showing its loading indicator until the first\n * resource is ready, eliminating the visual gap between shell loading and resource loading.\n */\n @Output() firstResourceLoadComplete = new EventEmitter<void>();\n\n /**\n * Emitted when Golden Layout fails to initialize after multiple retries.\n * The shell can use this to show an error dialog and redirect.\n */\n @Output() layoutInitError = new EventEmitter<void>();\n\n private pinService = inject(HomeAppPinService);\n private navigationService = inject(NavigationService);\n private recordSwitcher = inject(RecordSwitcherService);\n private subscriptions: Subscription[] = [];\n private layoutInitRetryCount = 0;\n private readonly MAX_LAYOUT_INIT_RETRIES = 5;\n private layoutInitialized = false;\n private layoutRestorationComplete = false; // True only AFTER layout is fully restored/created\n\n // Track component references for cleanup (legacy - keep for backward compat during transition)\n private componentRefs = new Map<string, ComponentRef<BaseResourceComponent>>();\n /** Pane-level origin crumbs, one per record pane (see RecordOriginCrumbComponent) */\n private originCrumbRefs = new Map<string, ComponentRef<RecordOriginCrumbComponent>>();\n\n // Guard against concurrent loadTabContent calls for the same tab.\n // When a tab's content changes while active, both the reload path (workspace config subscription)\n // and onTabShown can race to call loadTabContent, resulting in duplicate component rendering.\n private tabsCurrentlyLoading = new Set<string>();\n\n // NEW: Smart component cache for preserving state across tab switches\n private cacheManager: ComponentCacheManager;\n\n // Single-resource mode: render component directly without Golden Layout\n // This avoids the 20px height issue when GL header is hidden\n useSingleResourceMode = false;\n private singleResourceComponentRef: ComponentRef<BaseResourceComponent> | null = null;\n /** Cache identity of the current single-resource component for detachment */\n private singleResourceCacheIdentity: { driverClass: string; recordId: string; appId: string; tabId: string; discriminator?: string } | null = null;\n private previousTabBarVisible: boolean | null = null;\n private currentSingleResourceSignature: string | null = null; // Track loaded content signature to avoid unnecessary reloads\n private isCreatingInitialTabs = false; // Flag to prevent syncTabsWithConfiguration during initial tab creation\n\n // Context menu state\n contextMenuVisible = false;\n contextMenuX = 0;\n contextMenuY = 0;\n contextMenuTabId: string | null = null;\n /** The control that opened the context menu — focus returns here on close */\n private contextMenuAnchor: HTMLElement | null = null;\n\n // ---- RECORDS region (records-style record opens) ----\n /**\n * A SEPARATE Golden Layout instance hosting only record tabs. Instantiated\n * directly (not DI) — GoldenLayoutManager has no constructor dependencies\n * and the root-provided instance belongs to the MAIN region. Records get\n * native GL tabs (close/drag-to-split/pin) without ever appearing in the\n * main workspace's tab bar.\n */\n private recordsLayoutManager = new GoldenLayoutManager();\n private recordsLayoutInitialized = false;\n /** Last active tab id reported by the records GL (guards focus feedback loops) */\n private recordsRegionActiveTabId: string | null = null;\n /**\n * True while records-GL tabs are being created/restored in a batch. GL\n * fires an activation event for EVERY tab it creates; letting those write\n * back into the workspace during init steals focus from the tab the user\n * actually asked for (and persists junk layouts mid-build). Suppress both\n * write-backs while set; the batch ends with one explicit focus.\n */\n private recordsCreatingTabs = false;\n\n /** Shell mobile breakpoint (768px) — drives the records mobile surface */\n private breakpoint = inject(ExplorerBreakpointService);\n /**\n * True while the records surface renders MOBILE chrome: strip hidden\n * (headerless GL), record bar shown, splits flattened at render, layout\n * persistence suppressed (see the LayoutChanged guard), move actions\n * hidden. Mirrors the breakpoint; flips via rebuildRecordsLayoutForBreakpoint.\n */\n private mobileRecordsActive = this.breakpoint.IsMobile;\n /**\n * True only synchronously around Destroy() during a breakpoint-crossing\n * rebuild. Destroy fires TabClosed for EVERY live pane; without this guard\n * the records TabClosed handler would CloseTab each one — a crossing would\n * close every open record. cleanupTabComponent still runs (the cache\n * detach is what lets the re-init reattach content).\n */\n private recordsRebuilding = false;\n\n /** True when the deployment runs the records-style record-open model */\n public get RecordsStyleActive(): boolean {\n return IsRecordTabsStyle();\n }\n\n /** Records surface is in mobile chrome (record bar instead of tab strip) */\n public get IsMobileRecords(): boolean {\n return this.RecordsStyleActive && this.mobileRecordsActive;\n }\n\n // ---- Mobile record bar state (computed by updateRecordSurfaceState) ----\n /** Active record's title, entity icon, and app color for the mobile bar */\n public RecordBarTitle = '';\n public RecordBarIcon = 'fa-regular fa-file-lines';\n public RecordBarColor = DEFAULT_APP_COLOR;\n /**\n * ALL open records — region AND docked — matching the switcher sheet's\n * row count (docked/region composition is a desktop concept; on mobile\n * they're one list).\n */\n public OpenRecordCount = 0;\n /** Record switcher sheet visibility (mobile) */\n public RecordSwitcherVisible = false;\n /** Rows for the record switcher sheet (region + docked records, by sequence) */\n public SwitcherEntries: RecordSwitcherEntry[] = [];\n\n /** Open the record switcher sheet (record bar tap / drawer pill) */\n public OpenRecordSwitcher(): void {\n if (this.OpenRecordCount === 0) {\n return;\n }\n this.RecordSwitcherVisible = true;\n this.flushRegionCd();\n }\n\n /** Sheet row tapped: activate — same contract as the pill (sync drives GL focus) */\n public OnSwitcherActivate(tabId: string): void {\n this.RecordSwitcherVisible = false;\n this.flushRegionCd();\n // Guard against a stale row (SetActiveTab doesn't validate existence —\n // stamping a closed tab's id would leave no resolvable active tab)\n if (this.workspaceManager.GetTab(tabId)) {\n this.workspaceManager.SetActiveTab(tabId);\n }\n }\n\n /**\n * Sheet row ✕: close the record through the SAME path as the tab context\n * menu — GL RemoveTab → TabClosed handler (workspace bookkeeping, close\n * guards, cache eviction all apply). The workspace-level fallback covers\n * the edge where GL never held the tab (zero-height init refusal).\n * The sheet stays open; entries recompute on the config emission.\n */\n public OnSwitcherClose(tabId: string): void {\n const tab = this.workspaceManager.GetTab(tabId);\n const manager = tab && this.isRecordTab(tab) ? this.recordsLayoutManager : this.layoutManager;\n if (manager.GetContainer(tabId)) {\n manager.RemoveTab(tabId);\n } else if (tab) {\n // GL never held this tab (e.g. docked record in single-resource mode) —\n // run the same cleanup the GL close path does (cache detach, origin\n // crumb destroy) or the crumb ComponentRef leaks in originCrumbRefs.\n this.cleanupTabComponent(tabId);\n this.workspaceManager.CloseTab(tabId);\n }\n }\n\n public OnSwitcherVisibleChange(visible: boolean): void {\n this.RecordSwitcherVisible = visible;\n }\n\n /**\n * Recompute the mobile record-surface state (bar inputs + count) from a\n * workspace configuration emission. Cheap and unconditional — the values\n * only render while IsMobileRecords, but keeping them current at all\n * widths makes the breakpoint flip instant.\n */\n private updateRecordSurfaceState(config: { tabs: WorkspaceTab[]; activeTabId: string | null }): void {\n if (!this.RecordsStyleActive) {\n return;\n }\n const previous = `${this.RecordBarTitle}|${this.RecordBarIcon}|${this.RecordBarColor}|${this.OpenRecordCount}`;\n const allRecords = config.tabs\n .filter(t => IsRecordsTabConfiguration(t.configuration))\n .sort((a, b) => a.sequence - b.sequence);\n this.OpenRecordCount = allRecords.length;\n this.SwitcherEntries = allRecords.map(tab => this.buildSwitcherEntry(tab, config.activeTabId));\n const activeTab = config.tabs.find(t => t.id === config.activeTabId);\n if (activeTab && this.isRecordTab(activeTab)) {\n const app = this.appManager.GetAppById(activeTab.applicationId);\n this.RecordBarTitle = activeTab.title;\n this.RecordBarIcon = ResolveRecordTypeIcon(activeTab.configuration, this.ProviderToUse);\n this.RecordBarColor = app?.GetColor() || DEFAULT_APP_COLOR;\n }\n // If the active tab is NOT a region record the bar isn't visible (the\n // records region is hidden) — stale bar values are harmless.\n if (this.RecordSwitcherVisible && this.OpenRecordCount === 0) {\n // Last record closed from the sheet — nothing left to switch to\n this.RecordSwitcherVisible = false;\n }\n const current = `${this.RecordBarTitle}|${this.RecordBarIcon}|${this.RecordBarColor}|${this.OpenRecordCount}`;\n // Always flush while the sheet is OPEN: its rows carry state the bar hash\n // can't see (row titles, origins, IsActive) — an activation or async\n // title change with identical bar values would otherwise render stale.\n if (this.RecordSwitcherVisible || (this.mobileRecordsActive && current !== previous)) {\n this.flushRegionCd();\n }\n }\n\n /** One switcher sheet row: identity + origin subtitle (crumb semantics) */\n private buildSwitcherEntry(tab: WorkspaceTab, activeTabId: string | null): RecordSwitcherEntry {\n const app = this.appManager.GetAppById(tab.applicationId);\n const origin = GetRecordSourceContext(tab.configuration);\n const originLabel = origin\n ? (origin.sourceLabel ?? ([origin.sourceAppName, origin.sourceNavLabel].filter(Boolean).join(' › ') || null))\n : null;\n return {\n TabId: tab.id,\n Title: tab.title,\n Icon: ResolveRecordTypeIcon(tab.configuration, this.ProviderToUse),\n Color: app?.GetColor() || DEFAULT_APP_COLOR,\n OriginLabel: originLabel,\n IsActive: tab.id === activeTabId\n };\n }\n\n /** True while the RECORDS region is the visible surface (active tab is a record) */\n public ShowRecordsRegion = false;\n\n\n /**\n * A tab belongs to the records REGION (not the main workspace layout).\n * Records docked to the workspace (\"Move to Workspace\") fail this check —\n * they are main-layout tabs everywhere this predicate gates.\n */\n private isRecordTab(tab: WorkspaceTab): boolean {\n return this.RecordsStyleActive && IsRecordsRegionTab(tab.configuration);\n }\n\n /**\n * Synchronous, exception-safe change-detection flush. Zoneless + OnPush\n * ancestors make RxJS-driven mutations invisible until SOMETHING runs CD;\n * detectChanges throws when a pass is already in flight, and an unguarded\n * throw inside a promise/subscription silently kills the update (the\n * original \"clicked the pill, nothing happened for seconds\" bug). markForCheck\n * first so even the re-entrant case gets picked up by the in-flight pass.\n */\n private flushRegionCd(): void {\n SafeDetectChanges(this.cdr);\n }\n\n /**\n * Keep the RECORDS region in lockstep with the workspace configuration:\n * resolve region visibility (active tab is a record), lazily initialize the\n * records layout on first show (restoring the persisted records layout when\n * it matches the tab set), add/remove record tabs, and focus the active one.\n */\n private syncRecordsRegion(config: { tabs: WorkspaceTab[]; activeTabId: string | null }): void {\n if (!this.RecordsStyleActive) {\n // Defense in depth: if the style ever resolves to classic AFTER a\n // records-style pass set the flag (e.g. late instance-config load),\n // un-hide the main region — otherwise it stays invisible forever.\n if (this.ShowRecordsRegion) {\n this.ShowRecordsRegion = false;\n this.flushRegionCd();\n }\n return;\n }\n const recordTabs = config.tabs.filter(t => this.isRecordTab(t));\n const activeTab = config.tabs.find(t => t.id === config.activeTabId);\n const showing = !!activeTab && this.isRecordTab(activeTab);\n\n // EAGER init + sync on EVERY emission. The region container always keeps\n // its full layout box (visibility-hidden, never display:none — see the\n // component CSS), so the records GL can initialize and reconcile even\n // while the region isn't the visible surface. This is what keeps the\n // strip, the pill, and the workspace from ever drifting apart: closed\n // records leave the strip immediately, new ones appear immediately,\n // whether or not the user is looking at the region.\n if (!this.recordsLayoutInitialized && recordTabs.length > 0) {\n this.ensureRecordsLayoutInitialized(recordTabs);\n }\n if (this.recordsLayoutInitialized) {\n this.syncRecordsTabs(recordTabs);\n }\n\n if (showing !== this.ShowRecordsRegion) {\n this.ShowRecordsRegion = showing;\n // Flush NOW — the visibility class must land in this pass, not\n // whenever the next unrelated emission happens to run CD.\n this.flushRegionCd();\n }\n\n if (showing && activeTab && this.recordsLayoutInitialized) {\n this.focusRecordsTab(activeTab.id);\n }\n }\n\n /** Add/remove/style record tabs in the records GL to match the configuration */\n private syncRecordsTabs(recordTabs: WorkspaceTab[]): void {\n if (!this.recordsLayoutInitialized) {\n return;\n }\n const existingIds = this.recordsLayoutManager.GetAllTabIds();\n const configIds = recordTabs.map(t => t.id);\n existingIds.forEach(id => {\n if (!configIds.includes(id)) {\n this.recordsLayoutManager.RemoveTab(id);\n }\n });\n const toCreate = recordTabs.filter(t => !existingIds.includes(t.id));\n if (toCreate.length > 0) {\n this.recordsCreatingTabs = true;\n try {\n toCreate.forEach(tab => this.createRecordsRegionTab(tab));\n } finally {\n this.recordsCreatingTabs = false;\n }\n }\n recordTabs.forEach(tab => {\n if (existingIds.includes(tab.id)) {\n const app = this.appManager.GetAppById(tab.applicationId);\n this.recordsLayoutManager.UpdateTabStyle(tab.id, {\n isPinned: tab.isPinned,\n title: tab.title,\n appColor: app?.GetColor() || DEFAULT_APP_COLOR,\n typeIcon: this.resolveTabTypeIcon(tab)\n });\n // Origin can change on re-open re-capture — keep the pane crumb live\n this.updateOriginCrumb(tab);\n }\n });\n }\n\n /** Focus a records-region tab without feeding back into SetActiveTab loops */\n private focusRecordsTab(tabId: string): void {\n if (this.recordsRegionActiveTabId !== tabId) {\n this.recordsLayoutManager.FocusTab(tabId);\n }\n }\n\n /**\n * Initialize the records Golden Layout as soon as record tabs exist —\n * EAGERLY, whether or not the region is visible (its container always has\n * a full layout box). Restores the persisted records layout when its\n * component count matches the current record-tab set; otherwise builds\n * tabs fresh. Creation/restore runs with activation write-backs\n * suppressed (see recordsCreatingTabs).\n */\n private ensureRecordsLayoutInitialized(recordTabs: WorkspaceTab[]): void {\n if (this.recordsLayoutInitialized) {\n return;\n }\n const container = this.recordsGlContainer?.nativeElement;\n if (!container) {\n return; // Template not settled yet — the next sync pass retries\n }\n // NEVER initialize GL inside a zero-size (hidden) container — it bakes a\n // 0x0 internal size into every stack it later creates and the region\n // renders collapsed forever. Happens when the region flip is reverted\n // (activation stolen) before this deferred init runs; staying\n // uninitialized is safe — the next real show retries.\n if (container.getBoundingClientRect().height === 0) {\n return;\n }\n // Mobile: headerless GL — the record bar replaces the strip\n this.recordsLayoutManager.Initialize(container, { HideHeaders: this.mobileRecordsActive });\n this.recordsLayoutInitialized = true;\n\n this.recordsCreatingTabs = true;\n try {\n const config = this.workspaceManager.GetConfiguration();\n const savedLayout = config?.recordsLayout;\n // Mobile renders the persisted layout FLATTENED to one stack — a clone;\n // the persisted recordsLayout is never touched (and never written back\n // while mobile — see the LayoutChanged guard). Flattening preserves\n // components, so the restore gate below is unaffected.\n const layoutToLoad = this.mobileRecordsActive ? FlattenLayoutToSingleStack(savedLayout) : savedLayout;\n // Restore gate: the persisted layout must cover EXACTLY the current tab\n // set — identity, not count. Counts can match while identities diverge\n // (open one + close one during a persistence-suppressed mobile session);\n // loading such a layout would render a ghost pane for a closed record.\n if (layoutToLoad?.root && recordTabs.length > 0 && this.layoutCoversExactTabSet(layoutToLoad.root, recordTabs)) {\n if (this.recordsLayoutManager.LoadLayout(layoutToLoad)) {\n return;\n }\n }\n // No (or mismatched) saved layout — create record tabs fresh\n [...recordTabs]\n .sort((a, b) => a.sequence - b.sequence)\n .forEach(tab => this.createRecordsRegionTab(tab));\n } finally {\n this.recordsCreatingTabs = false;\n }\n }\n\n /**\n * Breakpoint crossing: tear the records GL down and let the next sync pass\n * rebuild it in the other chrome mode (mobile: headerless + flattened;\n * desktop: full strip + restored splits). The teardown runs under\n * recordsRebuilding — Destroy() fires TabClosed per pane, and without the\n * guard those events would CloseTab every open record (see the guard's\n * field comment). Content survives via the component cache: cleanup\n * detaches each pane's component, and the re-init's first-show reattaches.\n */\n private rebuildRecordsLayoutForBreakpoint(): void {\n // The switcher sheet is MOBILE chrome — never let it survive a crossing\n // (it would overlay the desktop UI and its entries stop re-rendering)\n this.RecordSwitcherVisible = false;\n // Template state first (bar/strip @if flips, region height settles)\n this.flushRegionCd();\n if (!this.recordsLayoutInitialized) {\n return; // GL not built yet — the next sync initializes in the new mode\n }\n this.recordsRebuilding = true;\n try {\n this.recordsLayoutManager.Destroy();\n } finally {\n // ALL teardown state resets live in the finally: if Destroy() throws\n // mid-walk, leaving recordsLayoutInitialized=true over a half-destroyed\n // GL would corrupt every subsequent sync pass.\n this.recordsRebuilding = false;\n this.recordsLayoutInitialized = false;\n this.recordsRegionActiveTabId = null;\n }\n // Defer re-init one macrotask so the flipped template has painted and\n // the GL container has its final (bar-adjusted) height before Initialize\n // measures it — same reason handleTabBarVisibilityChange defers.\n setTimeout(() => {\n const config = this.workspaceManager.GetConfiguration();\n if (config) {\n this.syncRecordsRegion(config);\n }\n }, 0);\n }\n\n /** Create a record tab in the RECORDS layout (mirror of createTab for main) */\n private createRecordsRegionTab(tab: WorkspaceTab): void {\n const app = this.appManager.GetAppById(tab.applicationId);\n const state: TabComponentState = {\n tabId: tab.id,\n appId: tab.applicationId,\n appColor: app?.GetColor() || DEFAULT_APP_COLOR,\n title: tab.title,\n route: tab.configuration['route'] as string || '',\n isPinned: tab.isPinned,\n isLoaded: false,\n typeIcon: this.resolveTabTypeIcon(tab)\n };\n this.recordsLayoutManager.AddTab(state);\n this.updateTabDisplayName(tab);\n }\n\n\n constructor(\n private layoutManager: GoldenLayoutManager,\n private workspaceManager: WorkspaceStateManager,\n private appManager: ApplicationManager,\n private appRef: ApplicationRef,\n private environmentInjector: EnvironmentInjector,\n private cdr: ChangeDetectorRef\n ) {\n super();\n // Initialize component cache manager\n this.cacheManager = new ComponentCacheManager(this.appRef, this.navigationService);\n }\n\n ngOnInit(): void {\n // Subscribe to tab events\n this.subscriptions.push(\n this.layoutManager.TabShown.subscribe(event => {\n this.onTabShown(event);\n }),\n this.layoutManager.TabClosed.subscribe(tabId => {\n this.cleanupTabComponent(tabId);\n // DEMOTE guard (\"Move to Records\"): the tab was removed from the\n // main GL because its region membership changed — it's still in the\n // workspace config and the records region is about to pick it up.\n // Closing it here would destroy the tab the user asked to keep.\n // cleanupTabComponent above still runs: the cache detach is what\n // lets the records GL reattach the component with state intact.\n const movedTab = this.workspaceManager.GetTab(tabId);\n if (movedTab && this.isRecordTab(movedTab)) {\n return;\n }\n this.workspaceManager.CloseTab(tabId);\n }),\n this.layoutManager.LayoutChanged.subscribe(event => {\n const layout = this.layoutManager.SaveLayout();\n this.workspaceManager.UpdateLayout(layout);\n }),\n this.layoutManager.ActiveTab.subscribe(tabId => {\n if (tabId) {\n this.workspaceManager.SetActiveTab(tabId);\n }\n }),\n this.layoutManager.TabDoubleClicked.subscribe(tabId => {\n this.workspaceManager.TogglePin(tabId);\n }),\n this.layoutManager.TabRightClicked.subscribe(event => {\n this.showContextMenu(event.x, event.y, event.tabId, event.anchorEl);\n })\n );\n\n this.wireRecordsLayoutEvents();\n\n // Breakpoint crossings rebuild the records GL in the other chrome mode\n // (headerless+flattened vs full strip+splits). Skip-if-equal: the\n // BehaviorSubject replays the current value on subscribe.\n this.subscriptions.push(\n this.breakpoint.IsMobile$.subscribe(isMobile => {\n // Exception-guarded like the Configuration subscription: a throw from\n // one crossing (e.g. a cached component's ngOnDestroy during the GL\n // teardown) would otherwise unsubscribe the stream permanently and\n // brick breakpoint handling until reload.\n try {\n if (isMobile === this.mobileRecordsActive) {\n return;\n }\n this.mobileRecordsActive = isMobile;\n this.rebuildRecordsLayoutForBreakpoint();\n } catch (err) {\n LogError(err);\n }\n }),\n // Open requests from surfaces outside this component (drawer pill)\n this.recordSwitcher.OpenRequested.subscribe(() => {\n this.OpenRecordSwitcher();\n })\n );\n\n // Subscribe to configuration changes to sync tabs.\n // The callback is exception-guarded: an error thrown from ONE emission\n // would otherwise unsubscribe the stream permanently — after which the\n // regions silently stop tracking the workspace (tabs drift, content\n // stops loading) with no visible failure.\n this.subscriptions.push(\n this.workspaceManager.Configuration.subscribe(config => {\n try {\n if (config) {\n // Keep the RECORDS region in sync first — it also resolves whether\n // the region is the visible surface for this configuration.\n this.syncRecordsRegion(config);\n this.updateRecordSurfaceState(config);\n\n if (this.useSingleResourceMode) {\n // In single-resource mode, reload content if the tab content changed\n // The same tab ID can have different content (tab gets reused)\n const activeTab = config.tabs.find(t => t.id === config.activeTabId) || config.tabs[0];\n if (activeTab && this.isRecordTab(activeTab)) {\n // Active tab is a RECORD — the records region owns it. Leave the\n // main region's content (the last nav page) untouched behind it.\n } else if (activeTab) {\n const signature = this.getTabContentSignature(activeTab);\n if (signature !== this.currentSingleResourceSignature) {\n // DO NOT call saveCurrentComponentQueryParams() here — by the time this\n // subscription fires, OpenTab has already replaced the tab config with the\n // new nav item's config, so queryParams are gone. The cache entry already\n // has the correct queryParams from the most recent unchanged-signature save.\n this.loadSingleResourceContent();\n } else {\n // Signature unchanged — sync queryParams to cache entry so it stays current.\n // This catches incremental queryParam updates (e.g., user selects a conversation).\n this.saveCurrentComponentQueryParams();\n }\n }\n } else if (this.layoutRestorationComplete && !this.isCreatingInitialTabs) {\n // In multi-tab mode, sync with Golden Layout.\n // Record tabs live in the records region — never in the main layout.\n // IMPORTANT: Only sync AFTER layout restoration is complete to avoid creating duplicate tabs\n // layoutRestorationComplete is set to true only after initializeGoldenLayout finishes\n this.syncTabsWithConfiguration(config.tabs.filter(t => !this.isRecordTab(t)));\n }\n }\n } catch (err) {\n // Never let one bad emission kill the stream — see comment above.\n LogError(err);\n }\n })\n );\n\n // Subscribe to tab bar visibility changes for single-resource mode\n this.subscriptions.push(\n this.workspaceManager.TabBarVisible.subscribe(tabBarVisible => {\n this.handleTabBarVisibilityChange(tabBarVisible);\n })\n );\n }\n\n\n /**\n * RECORDS region event wiring: the separate layout's events route through\n * the SAME handlers as the main layout — content loading, close, pin, and\n * context menu are layout-agnostic; only layout persistence targets its\n * own slot. Activation + persistence write-backs are suppressed during\n * batch creation/restore (recordsCreatingTabs) so GL's per-tab-created\n * events can't steal focus or persist half-built layouts.\n */\n private wireRecordsLayoutEvents(): void {\n this.subscriptions.push(\n this.recordsLayoutManager.TabShown.subscribe(async event => {\n if (event.isFirstShow) {\n await this.loadTabContent(event.tabId, event.container);\n // Mark loaded ONLY when content actually attached to the LIVE\n // container. During layout restore, GL can re-render item elements\n // while an async load is in flight — the load appends into a\n // detached element and the visible pane stays blank. Leaving the\n // tab unmarked lets the next show retry, which hits the component\n // cache and reattaches instantly into the live element.\n const live = this.recordsLayoutManager.GetContainer(event.tabId);\n if (live?.element && live.element.childElementCount > 0) {\n this.recordsLayoutManager.MarkTabLoaded(event.tabId);\n }\n }\n }),\n this.recordsLayoutManager.TabClosed.subscribe(async tabId => {\n this.cleanupTabComponent(tabId);\n // REBUILD guard (breakpoint crossing): Destroy() fires TabClosed for\n // every pane. The tabs are NOT closing — the layout is being rebuilt\n // in the other chrome mode. Cache detach above is exactly what the\n // re-init needs; everything below (CloseTab, backfill) must not run.\n if (this.recordsRebuilding) {\n return;\n }\n const closedTab = this.workspaceManager.GetTab(tabId);\n // PROMOTE guard (\"Move to Workspace\"): the tab left the records GL\n // because its region membership changed — it's still in the\n // workspace config and the MAIN layout is about to pick it up.\n // Closing it here would destroy the tab the user just promoted.\n // cleanupTabComponent above still runs: the cache detach is what\n // lets the main GL reattach the component with state intact.\n if (closedTab && !this.isRecordTab(closedTab)) {\n return;\n }\n // Guard: a configuration sync that removed this tab already updated\n // the workspace — closing again would re-emit an unchanged config\n // from inside a subscription pass.\n if (closedTab) {\n this.workspaceManager.CloseTab(tabId);\n }\n // Records close OUTRIGHT (no keep-last-tab-alive rule) — if that\n // emptied the workspace, land the user on the active app's default\n // tab instead of a blank shell.\n await this.backfillEmptyWorkspace();\n }),\n this.recordsLayoutManager.ActiveTab.subscribe(tabId => {\n this.recordsRegionActiveTabId = tabId;\n if (tabId && this.ShowRecordsRegion && !this.recordsCreatingTabs && !this.recordsRebuilding) {\n this.workspaceManager.SetActiveTab(tabId);\n }\n }),\n this.recordsLayoutManager.LayoutChanged.subscribe(() => {\n // MOBILE suppression: the mobile surface renders a FLATTENED clone of\n // the persisted layout — persisting it would destroy the user's\n // desktop splits (GL fires stateChanged on load/resize/tab ops, so\n // the clobber would land within the 500ms persist debounce of the\n // first mobile render). While suppressed, tab opens/closes still\n // persist via the tab LIST; on the next desktop init a changed tab\n // count hits the existing count-mismatch restore path (fresh\n // sequential creation — splits lost gracefully, records kept).\n if (this.recordsLayoutInitialized && !this.recordsCreatingTabs && !this.recordsRebuilding && !this.mobileRecordsActive) {\n this.workspaceManager.UpdateRecordsLayout(this.recordsLayoutManager.SaveLayout());\n }\n }),\n this.recordsLayoutManager.TabDoubleClicked.subscribe(tabId => {\n this.workspaceManager.TogglePin(tabId);\n }),\n this.recordsLayoutManager.TabRightClicked.subscribe(event => {\n this.showContextMenu(event.x, event.y, event.tabId, event.anchorEl);\n })\n );\n }\n\n ngAfterViewInit(): void {\n // Initialize Golden Layout only if we're not in single-resource mode\n if (!this.useSingleResourceMode) {\n this.initializeGoldenLayout();\n } else {\n // In single-resource mode, load content directly\n this.loadSingleResourceContent();\n }\n }\n\n /**\n * Initialize Golden Layout and load tabs\n * @param forceCreateTabs - If true, always creates tabs fresh from config.tabs instead of restoring saved layout\n */\n private initializeGoldenLayout(forceCreateTabs = false): void {\n // If we are in single resource mode we do NOT need to do this work as golden layout should not exist in that state\n if (this.useSingleResourceMode)\n return;\n\n if (!this.glContainer?.nativeElement) {\n this.layoutInitRetryCount++;\n\n if (this.layoutInitRetryCount > this.MAX_LAYOUT_INIT_RETRIES) {\n console.error(`Golden Layout container not available after ${this.MAX_LAYOUT_INIT_RETRIES} retries, emitting error`);\n this.layoutInitError.emit();\n return;\n }\n\n console.warn(`Golden Layout container not available, retry ${this.layoutInitRetryCount}/${this.MAX_LAYOUT_INIT_RETRIES}...`);\n setTimeout(() => this.initializeGoldenLayout(forceCreateTabs), 50);\n return;\n }\n\n // Reset retry counter on success\n this.layoutInitRetryCount = 0;\n\n if (this.layoutInitialized) {\n return; // Already initialized\n }\n\n // Check if configuration is available\n // If not, wait for it to be loaded before proceeding\n const config = this.workspaceManager.GetConfiguration();\n if (!config) {\n // Configuration not loaded yet — wait for it. TRACKED in\n // this.subscriptions: the sub normally retires itself on the first\n // non-null config, but if the component is destroyed while config is\n // still null (failed load, fast navigation away), an untracked sub\n // would outlive us and re-init a destroyed component when config\n // finally lands. Unsubscribe is idempotent — self-retire + ngOnDestroy\n // both firing is safe.\n const configSub = this.workspaceManager.Configuration.subscribe(loadedConfig => {\n if (loadedConfig) {\n configSub.unsubscribe();\n // Re-call initializeGoldenLayout now that config is available\n this.initializeGoldenLayout(forceCreateTabs);\n }\n });\n this.subscriptions.push(configSub);\n return;\n }\n\n // Initialize Golden Layout (we have config now)\n this.layoutManager.Initialize(this.glContainer.nativeElement);\n\n // Mark layout as initialized\n this.layoutInitialized = true;\n\n // The MAIN layout hosts only non-record tabs — record tabs live in the\n // separate records region (no-op filter under classic style).\n const mainTabs = config.tabs.filter(t => !this.isRecordTab(t));\n\n // Check if config has no tabs\n if (mainTabs.length === 0) {\n // No tabs to load, but mark restoration as complete\n this.layoutRestorationComplete = true;\n return;\n }\n\n // Check if we have a saved layout structure with actual content\n const hasSavedLayout = config.layout?.root?.content && config.layout.root.content.length > 0;\n\n if (hasSavedLayout && !forceCreateTabs && config.layout) {\n // VALIDATE: Check that layout component count matches tabs array count\n const layoutComponentCount = this.countLayoutComponents(config.layout.root);\n if (layoutComponentCount !== mainTabs.length) {\n console.warn(`[TabContainer.initializeGoldenLayout] Layout/tabs mismatch: layout has ${layoutComponentCount} components but tabs array has ${mainTabs.length} tabs. Clearing layout.`);\n this.workspaceManager.ClearLayout();\n // Fall through to create fresh tabs\n } else {\n // RESTORE SAVED LAYOUT - preserves drag/drop arrangements (stacks, columns, rows)\n // This is the single source of truth for visual arrangement\n const layoutLoaded = this.layoutManager.LoadLayout(config.layout);\n\n if (layoutLoaded) {\n // Mark layout restoration as complete AFTER layout is loaded\n this.layoutRestorationComplete = true;\n\n // Focus active tab and ensure proper sizing\n // Also trigger updateSize() to force Golden Layout to fire 'show' events\n // for the active tab in ALL stacks (not just the globally active tab)\n setTimeout(() => {\n if (config.activeTabId) {\n this.layoutManager.FocusTab(config.activeTabId);\n }\n // Trigger resize to ensure all visible tabs in all stacks render their content\n this.layoutManager.updateSize();\n }, 50);\n return; // Layout restored successfully\n }\n\n // Layout load FAILED - clear the corrupted layout and fall through to create tabs fresh\n console.warn('[TabContainer] Saved layout was corrupted, clearing and recreating tabs');\n this.workspaceManager.ClearLayout();\n }\n }\n\n // CREATE FRESH - no saved layout, forceCreateTabs=true, or layout load failed\n // Use the main (non-record) tabs sorted by sequence for a single-stack layout\n const sortedTabs = [...mainTabs].sort((a, b) => a.sequence - b.sequence);\n\n this.isCreatingInitialTabs = true;\n try {\n sortedTabs.forEach(tab => {\n this.createTab(tab);\n });\n } finally {\n this.isCreatingInitialTabs = false;\n }\n\n // Mark layout restoration as complete AFTER tabs are created\n this.layoutRestorationComplete = true;\n\n setTimeout(() => {\n if (config.activeTabId) {\n this.layoutManager.FocusTab(config.activeTabId);\n }\n }, 50);\n }\n\n /**\n * Clear cached components matching a predicate. Components that match are\n * destroyed; others are kept. Use for tenant switching — clear org-scoped\n * components while keeping system/global components alive.\n *\n * @param predicate Return true for components that should be destroyed.\n * If omitted, clears ALL cached components.\n * @returns Number of components destroyed.\n */\n public ClearComponentCache(predicate?: (info: CachedComponentInfo) => boolean): number {\n if (predicate) {\n return this.cacheManager.ClearCacheByPredicate(predicate);\n }\n const stats = this.cacheManager.getCacheStats();\n this.cacheManager.clearCache();\n return stats.total;\n }\n\n /**\n * Destroy all cached components and reload open tabs.\n *\n * In single-resource mode: clears the signature to force a reload, then\n * re-invokes loadSingleResourceContent().\n *\n * In multi-tab mode: destroys all cached components, marks all tabs as\n * not-loaded, then reloads the currently active tab immediately. Other\n * tabs reload lazily when the user switches to them (onTabShown fires\n * with isFirstShow=true after MarkTabNotLoaded).\n *\n * Use this for tenant switching — tabs stay open but their components\n * are recreated fresh with the new org context.\n */\n public async ReloadAllTabs(): Promise<void> {\n // Destroy all cached component instances\n this.cacheManager.clearCache();\n\n if (this.useSingleResourceMode) {\n // Force reload by clearing the signature check\n this.currentSingleResourceSignature = null;\n this.singleResourceComponentRef = null;\n this.singleResourceCacheIdentity = null;\n await this.loadSingleResourceContent();\n } else {\n // Mark all tabs as not-loaded so onTabShown will trigger loadTabContent\n const tabIds = this.layoutManager.GetAllTabIds();\n for (const tabId of tabIds) {\n this.layoutManager.MarkTabNotLoaded(tabId);\n }\n\n // Reload the currently active tab immediately\n const activeTabId = this.workspaceManager.GetActiveTabId();\n if (activeTabId && this.layoutManager.IsInitialized) {\n const container = this.layoutManager.GetContainer(activeTabId);\n if (container) {\n await this.loadTabContent(activeTabId, container);\n this.layoutManager.MarkTabLoaded(activeTabId);\n }\n }\n }\n\n // The RECORDS region is a separate layout with the same destroyed-cache\n // problem — sweep it in BOTH main modes or every record pane stays\n // permanently blank after a tenant switch (marked loaded, component gone).\n await this.reloadRecordsRegionTabs();\n }\n\n /** Mark all records-region tabs not-loaded and reload the active one (tenant switch) */\n private async reloadRecordsRegionTabs(): Promise<void> {\n if (!this.recordsLayoutInitialized) {\n return;\n }\n for (const tabId of this.recordsLayoutManager.GetAllTabIds()) {\n this.recordsLayoutManager.MarkTabNotLoaded(tabId);\n }\n const activeTabId = this.workspaceManager.GetActiveTabId();\n const activeTab = activeTabId ? this.workspaceManager.GetTab(activeTabId) : undefined;\n if (activeTab && this.isRecordTab(activeTab)) {\n const container = this.recordsLayoutManager.GetContainer(activeTab.id);\n if (container) {\n await this.loadTabContent(activeTab.id, container);\n this.recordsLayoutManager.MarkTabLoaded(activeTab.id);\n }\n }\n }\n\n /**\n * If the workspace has no tabs left (closing the last record empties it —\n * records skip the manager's keep-last-tab-alive rule), open the active\n * app's default tab so the user lands on a meaningful surface.\n */\n private async backfillEmptyWorkspace(): Promise<void> {\n const config = this.workspaceManager.GetConfiguration();\n if (!config || config.tabs.length > 0) {\n return;\n }\n const app = this.appManager.GetActiveApp();\n if (!app) {\n return;\n }\n const request = await app.CreateDefaultTab();\n if (request) {\n this.workspaceManager.OpenTab(request, app.GetColor());\n }\n }\n\n ngOnDestroy(): void {\n // Pane crumbs are appRef-attached views — destroy them or they stay in\n // every CD pass after the container is gone (logout/tenant teardown).\n this.originCrumbRefs.forEach(ref => ref.destroy());\n this.originCrumbRefs.clear();\n this.subscriptions.forEach(sub => sub.unsubscribe());\n\n // Tear down the records region's layout\n if (this.recordsLayoutInitialized) {\n this.recordsLayoutManager.Destroy();\n this.recordsLayoutInitialized = false;\n }\n\n // Cleanup single-resource mode component if exists\n this.cleanupSingleResourceComponent();\n\n // Clear the component cache (destroys all components)\n this.cacheManager.clearCache();\n\n // Cleanup any legacy componentRefs\n this.componentRefs.forEach((ref, _tabId) => {\n this.appRef.detachView(ref.hostView);\n ref.destroy();\n });\n this.componentRefs.clear();\n }\n\n /**\n * Handle window resize events as a fallback safety mechanism.\n * Golden Layout's ResizeObserver should handle most cases, but this\n * ensures the layout is properly sized after browser window changes.\n */\n @HostListener('window:resize')\n onWindowResize(): void {\n if (this.layoutInitialized && !this.useSingleResourceMode) {\n this.layoutManager.updateSize();\n }\n }\n\n /**\n * Handle changes to tab bar visibility - switches between single-resource and multi-tab modes\n */\n private handleTabBarVisibilityChange(tabBarVisible: boolean): void {\n // Skip if no change\n if (this.previousTabBarVisible === tabBarVisible) {\n return;\n }\n this.previousTabBarVisible = tabBarVisible;\n\n // Determine if we should use single-resource mode\n const shouldUseSingleResourceMode = !tabBarVisible;\n\n if (shouldUseSingleResourceMode !== this.useSingleResourceMode) {\n this.useSingleResourceMode = shouldUseSingleResourceMode;\n // Defer detectChanges to next microtask to avoid ExpressionChangedAfterItHasBeenCheckedError\n // when this handler fires during an already-running change detection cycle.\n Promise.resolve().then(() => this.cdr.detectChanges());\n\n if (this.useSingleResourceMode) {\n // Transitioning to single-resource mode\n // **CRITICAL FIX**: Wait for the template to render directContentContainer\n // before trying to load content. detectChanges() only marks dirty, doesn't render immediately.\n setTimeout(() => {\n // First, destroy Golden Layout if it was initialized (prevents stale state)\n if (this.layoutInitialized) {\n this.layoutManager.Destroy();\n this.layoutInitialized = false;\n // Reset restoration flag too — otherwise a subsequent flip back to multi-tab\n // mode will let the Configuration subscription take the \"restoration-complete\"\n // branch and try to mutate a non-existent layout, producing\n // \"GoldenLayoutManager: Layout not initialized\" on the next AddTab.\n this.layoutRestorationComplete = false;\n }\n // Load the active tab's content directly (now container will exist)\n this.loadSingleResourceContent();\n }, 0);\n } else {\n // Transitioning to multi-tab mode\n // Pin the previously displayed tab (it was the \"current\" content in single-resource mode)\n // This ensures we only have ONE temporary tab at a time\n const config = this.workspaceManager.GetConfiguration();\n if (config && config.tabs.length > 0) {\n // The new tab (just added via OpenTabForced) is now the activeTabId\n // All OTHER unpinned tabs should be pinned since they represent content\n // the user explicitly kept open\n const updatedTabs = config.tabs.map(tab => {\n // Pin all MAIN-layout tabs except the newly active one (which is\n // the temporary tab). Record tabs are exempt — their pin state is\n // user-owned (PreservePinState), and force-pinning them makes the\n // temp-tab semantics path-dependent.\n if (tab.id !== config.activeTabId && !tab.isPinned && !this.isRecordTab(tab)) {\n return { ...tab, isPinned: true };\n }\n return tab;\n });\n\n // Only update if we actually changed something\n const hasChanges = updatedTabs.some((tab, i) => tab.isPinned !== config.tabs[i].isPinned);\n if (hasChanges) {\n this.workspaceManager.UpdateConfiguration({\n ...config,\n tabs: updatedTabs\n });\n }\n }\n\n // Clean up direct component, Golden Layout will handle tabs\n this.cleanupSingleResourceComponent();\n this.currentSingleResourceSignature = null; // Reset tracking\n\n // Reset layout initialized flag since we're switching from single-resource mode\n // The gl-container is a new DOM element (due to @if), so we need fresh initialization\n this.layoutInitialized = false;\n // Restoration is also undone — see comment above on the single-resource branch.\n this.layoutRestorationComplete = false;\n\n // Initialize Golden Layout - use setTimeout to allow the template to update first\n // and ensure the gl-container div exists in the DOM\n // IMPORTANT: Use forceCreateTabs=true to create tabs fresh from config.tabs\n // instead of restoring potentially stale saved layout structure\n setTimeout(() => {\n this.initializeGoldenLayout(true /* forceCreateTabs */);\n }, 0);\n }\n }\n }\n\n /**\n * Load content directly for single-resource mode (bypasses Golden Layout)\n */\n private async loadSingleResourceContent(): Promise<void> {\n // Wait for next tick to ensure the container is rendered\n await Promise.resolve();\n\n const config = this.workspaceManager.GetConfiguration();\n if (!config || config.tabs.length === 0) {\n return;\n }\n\n // Get the active tab (or first tab)\n let activeTab = config.tabs.find(t => t.id === config.activeTabId) || config.tabs[0];\n\n // Records style: record tabs render in the RECORDS region, never here.\n // When the active tab is a record (e.g. reloading the app while viewing\n // one), the main region shows the most recently used NAV tab behind it.\n if (activeTab && this.isRecordTab(activeTab)) {\n const navTabs = config.tabs.filter(t => !this.isRecordTab(t));\n activeTab = [...navTabs].sort((a, b) => (b.lastAccessedAt || '').localeCompare(a.lastAccessedAt || ''))[0];\n if (!activeTab) {\n // Only record tabs exist — the records region owns first-load\n return;\n }\n }\n\n if (!activeTab) {\n // Config has tabs but none match activeTabId and the array fallback failed.\n // This shouldn't happen, but if it does, unblock the loading screen.\n this.emitFirstLoadCompleteOnce();\n return;\n }\n\n // Track which content we're loading (signature includes resource type and record ID)\n const newSignature = this.getTabContentSignature(activeTab);\n if (this.currentSingleResourceSignature === newSignature) {\n // Content already loaded, no action needed\n return;\n }\n this.currentSingleResourceSignature = newSignature;\n\n // Get the container element\n const container = this.directContentContainer?.nativeElement;\n if (!container) {\n // Retry after view is updated\n setTimeout(() => this.loadSingleResourceContent(), 50);\n return;\n }\n\n // Create ResourceData from tab\n const resourceData = await this.getResourceDataFromTab(activeTab);\n if (!resourceData) {\n LogError(`Unable to create ResourceData for tab: ${activeTab.title}`);\n // Unblock the shell's loading overlay — stale or malformed tab config shouldn't\n // leave the user stuck on the loading screen forever\n this.emitFirstLoadCompleteOnce();\n return;\n }\n\n // Get driver class for component lookup\n const driverClass = resourceData.Configuration?.resourceTypeDriverClass || resourceData.ResourceType;\n // Entity name discriminates between \"new record\" tabs of different entities (all\n // have empty ResourceRecordID otherwise). For non-Records resources this is undefined.\n const cacheDiscriminator = resourceData.Configuration?.Entity as string | undefined;\n\n // **OPTIMIZATION: Check cache first to reuse existing loaded component**\n const cached = this.cacheManager.getCachedComponent(\n driverClass,\n resourceData.ResourceRecordID || '',\n activeTab.applicationId,\n cacheDiscriminator\n );\n\n if (cached) {\n // Clean up previous single-resource component (if different)\n this.cleanupSingleResourceComponent();\n\n // Mark cached component as attached to this tab (it was detached / available for reuse).\n // IMPORTANT: We use markAsAttached here, NOT markAsDetached — the component is being\n // reattached to the DOM and should NOT be eligible for LRU eviction.\n this.cacheManager.markAsAttached(\n driverClass,\n resourceData.ResourceRecordID || '',\n activeTab.applicationId,\n activeTab.id,\n cacheDiscriminator\n );\n\n // Record panes lead with their origin crumb\n this.ensureRecordOriginCrumb(activeTab, container);\n\n // Re-home the component's tab binding (see loadTabContent's cached\n // branch — same cross-tab reattach hazard).\n (cached.componentRef.instance as BaseResourceComponent).RebindTabId(activeTab.id);\n\n // Reattach the cached wrapper element to single-resource container\n // (sizing via the pane-layout CSS: crumb fixed, content flex-fills)\n container.appendChild(cached.wrapperElement);\n\n // Store reference and identity for cleanup/detachment\n this.singleResourceComponentRef = cached.componentRef;\n this.singleResourceCacheIdentity = { driverClass, recordId: resourceData.ResourceRecordID || '', appId: activeTab.applicationId, tabId: activeTab.id, discriminator: cacheDiscriminator };\n\n // Reconcile the cached component's preserved queryParams with any INCOMING navigation\n // intent already on the tab config (e.g. a Home pin / deep link that targeted a specific\n // conversation via SwitchToApp before we got here).\n //\n // - If the tab has incoming queryParams, those are the source of truth: keep them and\n // sync the cache's snapshot to match. The component's reactive query-param subscription\n // (alive while detached) delivers them, so it switches to the requested state. Restoring\n // savedQueryParams here instead would clobber the navigation intent — the bug where two\n // conversation pins both reopened whatever chat was already cached.\n // - Only when there's NO incoming intent (a plain tab re-focus) do we restore the\n // component's own preserved params so the URL reflects its retained state.\n const incomingQP = activeTab.configuration?.['queryParams'] as Record<string, string> | undefined;\n const hasIncomingQP = incomingQP != null && Object.keys(incomingQP).length > 0;\n if (hasIncomingQP) {\n cached.savedQueryParams = { ...incomingQP };\n } else if (cached.savedQueryParams) {\n this.workspaceManager.UpdateTabConfiguration(activeTab.id, {\n queryParams: cached.savedQueryParams\n });\n // Do NOT clear savedQueryParams here — the else branch (unchanged-signature saves)\n // will keep it current while the component is active. Clearing it would cause the\n // queryParams to be lost on the next detach/reattach cycle.\n }\n\n // Cached component is already loaded — emit load-complete so the shell clears its\n // loading overlay. Without this, single-tab mode navigation to a cached resource\n // leaves the overlay blocking all user interaction.\n this.emitFirstLoadCompleteOnce();\n\n return;\n }\n\n // Get the component registration (with lazy loading fallback via ClassFactory)\n const resourceReg = await MJGlobal.Instance.ClassFactory.GetRegistrationAsync(\n BaseResourceComponent,\n driverClass\n );\n\n if (!resourceReg) {\n LogError(`Unable to find resource registration for driver class: ${driverClass}`);\n // Show the user something actionable instead of an empty pane, and unblock the\n // shell's first-load gate so the loading overlay clears.\n this.cleanupSingleResourceComponent();\n this.renderMissingResourceError(container, driverClass, {\n mode: 'single-resource',\n appId: activeTab.applicationId,\n tabId: activeTab.id,\n resourceType: resourceData.ResourceType,\n recordId: resourceData.ResourceRecordID || null,\n });\n return;\n }\n\n // Clean up previous component if any\n this.cleanupSingleResourceComponent();\n\n // Create the component dynamically\n const componentRef = createComponent(resourceReg.SubClass, {\n environmentInjector: this.environmentInjector\n });\n\n // Attach to Angular's change detection\n this.appRef.attachView(componentRef.hostView);\n\n // Set the resource data on the component\n const instance = componentRef.instance as BaseResourceComponent;\n instance.Data = resourceData;\n\n // Wire up events\n instance.LoadCompleteEvent = () => {\n this.emitFirstLoadCompleteOnce();\n };\n\n // Wire up display name change for single-resource mode.\n // Guard: only update the title if THIS component is the currently displayed one.\n // Without this guard, cached components (detached but alive) can fire this callback\n // and overwrite the active tab's title with a stale name.\n // CRITICAL: rename the tab this component was RENDERED FOR — never\n // GetActiveTabId(). Under the records style the active tab can be a\n // record (region showing) while the main region keeps a SUBSTITUTE nav\n // component alive underneath; its emission was renaming the user's\n // record tab (an Action Params record ended up titled \"Data\").\n const renderedTabId = activeTab.id;\n instance.DisplayNameChangedEvent = (newName: string) => {\n if (this.singleResourceComponentRef?.instance === instance) {\n this.workspaceManager.UpdateTabTitle(renderedTabId, newName);\n }\n };\n\n // When a record is saved, re-key the tab and cache (new-record → saved transition)\n // and refresh the tab title to reflect the entity's current display name.\n instance.ResourceRecordSavedEvent = (entity: BaseEntity) => {\n this.handleResourceRecordSaved(driverClass, activeTab.applicationId, activeTab.id, instance, entity);\n };\n\n // Resource asked to be closed (e.g., user discarded a brand-new record — there's\n // no actual record to view, so leaving the tab open serves no purpose and would\n // also poison the cache for the next \"Create New\" click of the same entity).\n instance.ResourceCloseRequestedEvent = () => {\n this.handleResourceCloseRequested(activeTab.id, instance);\n };\n\n // Record panes lead with their origin crumb\n this.ensureRecordOriginCrumb(activeTab, container);\n\n // Get the native element and append to container\n // (sizing via the pane-layout CSS: crumb fixed, content flex-fills)\n const nativeElement = (componentRef.hostView as unknown as { rootNodes: HTMLElement[] }).rootNodes[0];\n container.appendChild(nativeElement);\n\n // Cache the component for reuse when switching between nav items within the same app.\n // Without this, every nav switch creates a brand new component from scratch.\n const wrapperElement = nativeElement;\n this.cacheManager.cacheComponent(\n componentRef as ComponentRef<BaseResourceComponent>,\n wrapperElement,\n resourceData,\n activeTab.id\n );\n\n // Store reference and identity for cleanup/detachment\n this.singleResourceComponentRef = componentRef as ComponentRef<BaseResourceComponent>;\n this.singleResourceCacheIdentity = { driverClass, recordId: resourceData.ResourceRecordID || '', appId: activeTab.applicationId, tabId: activeTab.id, discriminator: cacheDiscriminator };\n }\n\n /**\n * Clean up single-resource mode component\n */\n /**\n * Detaches the current single-resource component from the DOM and marks it as\n * available for reuse in the component cache.\n *\n * ╔══════════════════════════════════════════════════════════════════════════╗\n * ║ ⚠️ DO NOT DESTROY THE COMPONENT HERE — INTENTIONAL DESIGN CHOICE ⚠️ ║\n * ║ ║\n * ║ The component is DETACHED from the DOM, NOT destroyed. It stays alive ║\n * ║ in the ComponentCacheManager with its full Angular state preserved ║\n * ║ (properties, subscriptions, loaded data, scroll position, etc). ║\n * ║ ║\n * ║ When the user returns to this tab, the cached component is reattached ║\n * ║ instantly — no data reload, no API calls, no flash of empty content. ║\n * ║ ║\n * ║ Destroying components here \"for memory optimization\" is a net ║\n * ║ NEGATIVE: the reload on return is far more expensive (DB queries, ║\n * ║ API calls, re-rendering) than keeping the component in memory. ║\n * ║ The LRU eviction in ComponentCacheManager handles memory limits — ║\n * ║ when MaxDetachedComponents is exceeded, the LEAST recently used ║\n * ║ components are evicted automatically. ║\n * ║ ║\n * ║ If you think memory is a problem, adjust MaxDetachedComponents ║\n * ║ instead of destroying components here. ║\n * ╚══════════════════════════════════════════════════════════════════════════╝\n */\n /**\n * Save the currently displayed component's queryParams to its cache entry.\n * Called on every config change so the cache entry always has the latest queryParams,\n * even after the tab config is overwritten by a new nav item.\n */\n private saveCurrentComponentQueryParams(): void {\n if (!this.singleResourceCacheIdentity) return;\n\n const { tabId } = this.singleResourceCacheIdentity;\n const tab = this.workspaceManager.GetTab(tabId);\n const qp = tab?.configuration?.['queryParams'] as Record<string, string> | undefined;\n const cached = this.cacheManager.getComponentByTabId(tabId);\n if (cached) {\n cached.savedQueryParams = (qp && Object.keys(qp).length > 0) ? { ...qp } : undefined;\n }\n }\n\n private cleanupSingleResourceComponent(): void {\n if (this.singleResourceComponentRef) {\n if (this.singleResourceCacheIdentity) {\n const { driverClass, recordId, appId, discriminator } = this.singleResourceCacheIdentity;\n // Mark as DETACHED by resource identity — the ONE consistent key used everywhere.\n this.cacheManager.markAsDetached(driverClass, recordId, appId, discriminator);\n }\n this.singleResourceComponentRef = null;\n this.singleResourceCacheIdentity = null;\n }\n\n // Remove children from the container. This detaches the wrapper DOM element\n // without destroying the Angular component — it lives on in the cache.\n // Using removeChild (not innerHTML='') to avoid aggressive DOM cleanup.\n const container = this.directContentContainer?.nativeElement;\n if (container) {\n while (container.firstChild) {\n container.removeChild(container.firstChild);\n }\n }\n }\n\n /**\n * Handle a record-saved event from a hosted resource component.\n *\n * Does two things on every save:\n *\n * 1. **Re-key new-record tabs.** When a tab opened as \"Create New Record\" (empty\n * `resourceRecordId`) transitions to a saved record, we update both the workspace\n * tab's id and the component-cache key to the new PK. Without this, the next\n * `OpenNewEntityRecord(<sameEntity>)` would match this tab (both have empty\n * `resourceRecordId`) and focus the stale form instead of opening a fresh one.\n * For existing records being re-saved, this step is a no-op.\n *\n * 2. **Refresh the tab title.** Whether new or existing, the entity's display name\n * (typically its `Name` field) may have changed. We call the resource component's\n * `GetResourceDisplayName` and push the result to the tab — so a tab that read\n * \"New Foo Record\" before save now reads the actual entered name.\n */\n private handleResourceRecordSaved(\n driverClass: string,\n appId: string,\n tabId: string,\n instance: BaseResourceComponent,\n entity: BaseEntity\n ): void {\n const tab = this.workspaceManager.GetTab(tabId);\n if (!tab) {\n return;\n }\n\n const oldRecordId = tab.resourceRecordId || '';\n // ToURLSegment, NOT ToString — must match the format NavigationService.OpenEntityRecord\n // uses and that EntityRecordResource.GetPrimaryKey expects via LoadFromURLSegment.\n const newRecordId = entity?.PrimaryKey?.ToURLSegment?.() ?? '';\n const isNewRecordTransition = oldRecordId === '' && !!newRecordId;\n // The cache entry for an empty-recordId tab was keyed with the entity name as\n // discriminator (to avoid new-record collisions across entities). Re-key has to\n // pass that same old discriminator to find the entry. After save the record has\n // a real PK, so the new key needs no discriminator.\n const oldDiscriminator = tab.configuration?.['Entity'] as string | undefined;\n\n if (isNewRecordTransition) {\n // Re-key the cache entry first, so when the workspace config emission triggers\n // signature/needsReload checks below, the cache lookup at the new id succeeds.\n this.cacheManager.rekeyComponent(driverClass, oldRecordId, newRecordId, appId, oldDiscriminator, undefined);\n\n // Keep the in-memory single-resource identity in sync so detach uses the correct key.\n if (this.singleResourceCacheIdentity?.tabId === tabId) {\n this.singleResourceCacheIdentity = {\n ...this.singleResourceCacheIdentity,\n recordId: newRecordId,\n discriminator: undefined\n };\n }\n\n // Pre-compute and stamp the new signature so the configuration-subscription path\n // in single-resource mode doesn't see a \"content changed\" delta and trigger a\n // needless reload cycle (which would destroy the currently attached component).\n if (this.useSingleResourceMode && this.currentSingleResourceSignature !== null) {\n const updatedTab: WorkspaceTab = {\n ...tab,\n resourceRecordId: newRecordId,\n configuration: { ...tab.configuration, recordId: newRecordId, isNew: undefined }\n };\n this.currentSingleResourceSignature = this.getTabContentSignature(updatedTab);\n }\n\n // Propagate the new id to the workspace tab.\n this.workspaceManager.UpdateTabResourceRecordId(tabId, newRecordId);\n }\n\n // Always refresh the tab title — the entity's display-name field (typically Name)\n // may have just been set or changed. Done after the rekey so the resource component's\n // Data.ResourceRecordID reflects the saved PK before GetResourceDisplayName reads it.\n //\n // ProviderBase caches GetEntityRecordName results, so a plain call here would return\n // the pre-edit name. Pre-warm the cache with a forceRefresh so the downstream read\n // inside GetResourceDisplayName picks up the saved name. Only meaningful for entity\n // records with a PK; other resource types' GetResourceDisplayName doesn't hit the\n // record-name cache and will work either way.\n void this.refreshTabTitleAfterSave(tabId, instance, entity);\n }\n\n /**\n * After a save, invalidate the entity-record-name cache for the saved record and then\n * push the resource component's current display name into the tab title.\n *\n * Errors are swallowed (logged via the inner call paths) — failing to refresh a tab\n * title should never break the save flow.\n */\n private async refreshTabTitleAfterSave(\n tabId: string,\n instance: BaseResourceComponent,\n entity: BaseEntity\n ): Promise<void> {\n try {\n const entityName = entity?.EntityInfo?.Name;\n const pk = entity?.PrimaryKey;\n if (entityName && pk?.HasValue) {\n // forceRefresh: true overwrites the cached (pre-edit) name with the fresh one.\n // GetResourceDisplayName (called next) reads the same cache and now sees fresh data.\n const md = instance.ProviderToUse;\n await md.GetEntityRecordName(entityName, pk, md.CurrentUser, true);\n }\n } catch {\n // Cache pre-warm failures are non-fatal — the title update below will fall back\n // to whatever the cache has and the user can still interact with the form.\n }\n await this.updateTabTitleFromResource(tabId, instance, instance.Data);\n }\n\n /**\n * A resource component asked to be dismissed — typically the user clicked Discard\n * on a brand-new record. Behavior depends on workspace state:\n *\n * - **Multi-tab mode (or > 1 tab)**: just close the tab. `WorkspaceStateManager.CloseTab`\n * activates the next tab, `syncTabsWithConfiguration` removes the tab from Golden\n * Layout, and the user lands on whatever tab was previously active.\n *\n * - **Last tab in the workspace**: `CloseTab` intentionally keeps the last tab around\n * (just unpins it) so the workspace is never empty — correct for the\n * user-clicked-X-button case, wrong here. We want the user OFF this discarded form.\n * Workaround: `CloseTab` makes the tab unpinned (= a temp tab), then we open the\n * app's default tab via `CreateDefaultTab()` which goes through `OpenTab` and\n * replaces the now-temp tab. End result: user lands on the app's home/default view.\n */\n private async handleResourceCloseRequested(tabId: string, _instance: BaseResourceComponent): Promise<void> {\n const config = this.workspaceManager.GetConfiguration();\n const tab = config?.tabs.find(t => t.id === tabId);\n const isLastTab = config?.tabs.length === 1 && config.tabs[0].id === tabId;\n\n // DESTROY (not just detach) the cached component before closing. The default\n // tab-close path detaches and keeps components alive for reuse — but the\n // discarded form is exactly what we DON'T want to keep: it holds a stale\n // BaseEntity in view mode. The next \"Create New Record\" click for the same\n // entity would otherwise hit the cache discriminator lookup, find this stale\n // component, and reattach it — surfacing a blank form in view mode instead\n // of a fresh edit-mode form. Destroy here forces a cache miss on the next click.\n if (this.singleResourceCacheIdentity?.tabId === tabId) {\n // Single-resource mode: the component is tracked via singleResource* fields,\n // and its cache entry is currently marked attached. Use the identity directly\n // to destroy it (markAsDetached would clear attachedToTabId and break a\n // subsequent destroyComponentByTabId lookup).\n const { driverClass, recordId, appId, discriminator } = this.singleResourceCacheIdentity;\n this.cacheManager.destroyComponent(driverClass, recordId, appId, discriminator);\n this.singleResourceComponentRef = null;\n this.singleResourceCacheIdentity = null;\n // Clear the host container's DOM so the user isn't briefly looking at the\n // destroyed component's wrapper between CloseTab and the default-tab load.\n const directContainer = this.directContentContainer?.nativeElement;\n if (directContainer) {\n while (directContainer.firstChild) directContainer.removeChild(directContainer.firstChild);\n }\n } else {\n // Multi-tab mode: cache entry is keyed by attachedToTabId; the convenience\n // method handles the lookup.\n this.cacheManager.destroyComponentByTabId(tabId);\n this.componentRefs.delete(tabId);\n }\n\n this.workspaceManager.CloseTab(tabId);\n\n if (isLastTab && tab) {\n // CloseTab kept the tab around but unpinned it. Replace it with the app's\n // default tab so the user lands on a meaningful surface (typically the\n // home dashboard) instead of staying on the discarded form.\n const app = this.appManager.GetAppById(tab.applicationId);\n if (app) {\n const defaultTabRequest = await app.CreateDefaultTab();\n if (defaultTabRequest) {\n this.workspaceManager.OpenTab(defaultTabRequest, app.GetColor());\n }\n }\n }\n }\n\n /**\n * Generate a signature for tab content to detect when content changes\n * This is needed because in single-resource mode, the same tab ID can have different content\n */\n private getTabContentSignature(tab: WorkspaceTab): string {\n // Include key identifying fields that determine what component/content is shown\n // IMPORTANT: Check both resourceRecordId AND configuration.recordId\n // because for nav items, the recordId is stored in configuration, not resourceRecordId\n const effectiveRecordId = tab.resourceRecordId || (tab.configuration?.recordId as string) || '';\n const parts = [\n tab.applicationId,\n tab.configuration?.resourceType || '',\n tab.configuration?.driverClass || '',\n tab.configuration?.Entity || '', // Include Entity name for Records resource type\n effectiveRecordId,\n tab.configuration?.route || ''\n ];\n return parts.join('|');\n }\n\n /**\n * Create a tab in Golden Layout from workspace tab data\n */\n private createTab(tab: WorkspaceTab): void {\n const app = this.appManager.GetAppById(tab.applicationId);\n const appColor = app?.GetColor() || '#757575';\n\n const state: TabComponentState = {\n tabId: tab.id,\n appId: tab.applicationId,\n appColor,\n title: tab.title,\n route: tab.configuration['route'] as string || '',\n isPinned: tab.isPinned,\n isLoaded: false,\n typeIcon: this.resolveTabTypeIcon(tab)\n };\n\n this.layoutManager.AddTab(state);\n\n // Nav-item icons live behind an async lookup — upgrade in the background\n void this.upgradeNavTabIcon(tab, this.layoutManager);\n\n // Load display name in background without loading full component\n this.updateTabDisplayName(tab);\n }\n\n /**\n * Synchronous best-effort TYPE icon for a tab (the app-colored icon in\n * the tab's type slot — see TabComponentState.typeIcon). Record tabs\n * resolve fully here (entity metadata is loaded); nav tabs start with the\n * app's icon and get upgraded to the nav item's own icon asynchronously\n * (upgradeNavTabIcon).\n */\n private resolveTabTypeIcon(tab: WorkspaceTab): string {\n if (IsRecordsTabConfiguration(tab.configuration)) {\n // Shared helper — the record bar and switcher sheet resolve through the\n // same function so a record shows one icon everywhere\n return ResolveRecordTypeIcon(tab.configuration, this.ProviderToUse);\n }\n const app = this.appManager.GetAppById(tab.applicationId);\n return app?.Icon || 'fa-regular fa-file';\n }\n\n /**\n * Resolve and apply a NAV tab's type icon — the async owner of nav-tab\n * icons (GetNavItems is a cached JSON parse: near-instant, but async by\n * contract). Ladder: nav item's own icon → app icon → generic. No-op for\n * record tabs (their icons resolve synchronously). Idempotent: the slot\n * only touches the DOM when the class actually changes.\n */\n private async upgradeNavTabIcon(tab: WorkspaceTab, manager: GoldenLayoutManager): Promise<void> {\n if (IsRecordsTabConfiguration(tab.configuration)) {\n return;\n }\n const app = this.appManager.GetAppById(tab.applicationId);\n let navItemIcon: string | undefined;\n const navItemName = tab.configuration?.['navItemName'];\n if (app && typeof navItemName === 'string' && navItemName) {\n try {\n const navItems = await app.GetNavItems();\n navItemIcon = navItems.find(i => i.Label === navItemName)?.Icon;\n } catch {\n // Icon resolution is cosmetic — fall through to the app fallback.\n }\n }\n manager.UpdateTabStyle(tab.id, { typeIcon: navItemIcon || app?.Icon || 'fa-regular fa-file' });\n }\n\n /**\n * Handle tab shown event for lazy loading\n */\n private async onTabShown(event: TabShownEvent): Promise<void> {\n if (event.isFirstShow) {\n // Load content for this tab\n await this.loadTabContent(event.tabId, event.container);\n this.layoutManager.MarkTabLoaded(event.tabId);\n }\n }\n\n /**\n * Load content into a tab container\n * Uses component cache to reuse components for same resources\n */\n private async loadTabContent(tabId: string, container: unknown): Promise<void> {\n // Per-tab guard: prevent concurrent loads of the same tab content.\n // This can happen when a tab's content changes while active — both the workspace\n // config subscription reload path and onTabShown can race to call this method.\n if (this.tabsCurrentlyLoading.has(tabId)) {\n return;\n }\n this.tabsCurrentlyLoading.add(tabId);\n\n try {\n const tab = this.workspaceManager.GetTab(tabId);\n if (!tab) {\n LogError(`Tab not found: ${tabId}`);\n this.emitFirstLoadCompleteOnce();\n return;\n }\n\n // Get the container element from Golden Layout\n const glContainer = container as { element: HTMLElement };\n if (!glContainer?.element) {\n LogError('Golden Layout container element not found');\n this.emitFirstLoadCompleteOnce();\n return;\n }\n\n // Extract resource data from tab configuration\n const resourceData = await this.getResourceDataFromTab(tab);\n if (!resourceData) {\n LogError(`Unable to create ResourceData for tab: ${tab.title}`);\n this.emitFirstLoadCompleteOnce();\n return;\n }\n\n // Clear any existing content from the container (important for tab reuse)\n glContainer.element.innerHTML = '';\n\n // Record panes lead with their origin crumb — BEFORE content attaches\n // (fresh or cached), so it is always the pane's first element.\n this.ensureRecordOriginCrumb(tab, glContainer.element);\n\n // Get driver class for cache lookup (resolves to actual component class name)\n const driverClass = resourceData.Configuration?.resourceTypeDriverClass || resourceData.ResourceType;\n // Discriminate distinct \"new record\" tabs of different entities (all have empty\n // ResourceRecordID otherwise — would silently collide in the cache).\n const cacheDiscriminator = resourceData.Configuration?.Entity as string | undefined;\n\n // Check if we have a cached component for this resource\n const cached = this.cacheManager.getCachedComponent(\n driverClass,\n resourceData.ResourceRecordID || '',\n tab.applicationId,\n cacheDiscriminator\n );\n\n if (cached) {\n // Reattach the cached wrapper element\n glContainer.element.appendChild(cached.wrapperElement);\n\n // Mark as attached to this tab\n this.cacheManager.markAsAttached(\n driverClass,\n resourceData.ResourceRecordID || '',\n tab.applicationId,\n tabId,\n cacheDiscriminator\n );\n\n // RE-HOME the component's tab binding: the cache keys on\n // driver+record+app, so this component may have been born under a\n // DIFFERENT tab id — without the rebind its query-param\n // subscription listens to the dead tab forever and deliveries to\n // this tab are lost.\n (cached.componentRef.instance as BaseResourceComponent).RebindTabId(tabId);\n\n // Keep legacy componentRefs map updated\n this.componentRefs.set(tabId, cached.componentRef);\n\n // If resource is already loaded, update tab title immediately and signal\n // load-complete so the shell clears any loading overlay.\n const instance = cached.componentRef.instance as BaseResourceComponent;\n if (instance.LoadComplete) {\n this.updateTabTitleFromResource(tabId, instance, resourceData);\n this.emitFirstLoadCompleteOnce();\n }\n\n return;\n }\n\n // Get the component registration using the driver class (with lazy loading fallback via ClassFactory)\n const resourceReg = await MJGlobal.Instance.ClassFactory.GetRegistrationAsync(\n BaseResourceComponent,\n driverClass\n );\n\n if (!resourceReg) {\n LogError(`Unable to find resource registration for driver class: ${driverClass}`);\n // Render an in-tab error instead of leaving the pane blank. The container was\n // already cleared above on line 754, so we just append the error UI here.\n this.renderMissingResourceError(glContainer.element, driverClass, {\n mode: 'multi-tab',\n appId: tab.applicationId,\n tabId,\n resourceType: resourceData.ResourceType,\n recordId: resourceData.ResourceRecordID || null,\n });\n return;\n }\n\n // Create the component dynamically\n const componentRef = createComponent(resourceReg.SubClass, {\n environmentInjector: this.environmentInjector\n });\n\n // Attach to Angular's change detection\n this.appRef.attachView(componentRef.hostView);\n\n // Set the resource data on the component\n const instance = componentRef.instance as BaseResourceComponent;\n instance.Data = resourceData;\n\n // Wire up events\n instance.LoadCompleteEvent = () => {\n // Tab content loaded - update tab title with resource display name\n this.updateTabTitleFromResource(tabId, instance, resourceData);\n this.emitFirstLoadCompleteOnce();\n };\n\n instance.ResourceRecordSavedEvent = (entity: BaseEntity) => {\n this.handleResourceRecordSaved(driverClass, tab.applicationId, tabId, instance, entity);\n };\n\n // Resource asked to be closed (e.g., user discarded a brand-new record).\n instance.ResourceCloseRequestedEvent = () => {\n this.handleResourceCloseRequested(tabId, instance);\n };\n\n // Wire up display name change notifications (routed to whichever\n // Golden Layout hosts this tab)\n instance.DisplayNameChangedEvent = (newName: string) => {\n const t = this.workspaceManager.GetTab(tabId);\n const manager = t && this.isRecordTab(t) ? this.recordsLayoutManager : this.layoutManager;\n manager.UpdateTabStyle(tabId, { title: newName });\n this.workspaceManager.UpdateTabTitle(tabId, newName);\n };\n\n // Create a container div for the component\n const componentElement = document.createElement('div');\n componentElement.className = 'tab-content-wrapper';\n componentElement.style.cssText = 'width: 100%; height: 100%;';\n\n // Append the component's native element\n const nativeElement = (componentRef.hostView as unknown as { rootNodes: HTMLElement[] }).rootNodes[0];\n componentElement.appendChild(nativeElement);\n\n // Add to Golden Layout container\n glContainer.element.appendChild(componentElement);\n\n // Cache the component for future reuse\n this.cacheManager.cacheComponent(\n componentRef as ComponentRef<BaseResourceComponent>,\n componentElement,\n resourceData,\n tabId\n );\n\n // Store reference for cleanup (legacy)\n this.componentRefs.set(tabId, componentRef as ComponentRef<BaseResourceComponent>);\n\n } catch (e) {\n // A tab whose resource can't resolve (e.g. a persisted tab referencing an\n // unknown ResourceType) must NEVER brick the shell: log, signal load-complete\n // so the boot loading screen clears, and close the poisoned tab so it doesn't\n // re-fail on every boot from restored workspace state.\n LogError(e);\n this.emitFirstLoadCompleteOnce();\n try {\n this.workspaceManager.CloseTab(tabId);\n } catch {\n // best-effort — leaving the tab is still recoverable via manual close\n }\n } finally {\n this.tabsCurrentlyLoading.delete(tabId);\n }\n }\n\n /**\n * Update tab display name in background without loading full component\n * This ensures all tabs show proper names immediately, not just when clicked\n */\n private async updateTabDisplayName(tab: WorkspaceTab): Promise<void> {\n try {\n // Only update display names for resource-based tabs\n const resourceType = tab.configuration['resourceType'] as string;\n if (!resourceType) {\n return;\n }\n\n // Get ResourceData from tab\n const resourceData = await this.getResourceDataFromTab(tab);\n if (!resourceData) {\n return;\n }\n\n // Get the resource registration to access GetResourceDisplayName without loading full component\n const driverClass = resourceData.Configuration?.resourceTypeDriverClass || resourceData.ResourceType;\n const resourceReg = await MJGlobal.Instance.ClassFactory.GetRegistrationAsync(\n BaseResourceComponent,\n driverClass\n );\n\n if (!resourceReg) {\n return;\n }\n\n // Create a lightweight instance just to call GetResourceDisplayName.\n // Must run inside an injection context because BaseResourceComponent\n // uses inject() field initializers (e.g. NavigationService).\n const tempInstance = runInInjectionContext(\n this.environmentInjector,\n () => new resourceReg.SubClass() as BaseResourceComponent\n );\n const displayName = await tempInstance.GetResourceDisplayName(resourceData);\n\n if (displayName && displayName !== tab.title) {\n // Update the tab title in whichever Golden Layout hosts this tab\n const targetManager = this.isRecordTab(tab) ? this.recordsLayoutManager : this.layoutManager;\n targetManager.UpdateTabStyle(tab.id, { title: displayName });\n\n // Update the tab title in workspace configuration for persistence\n this.workspaceManager.UpdateTabTitle(tab.id, displayName);\n }\n } catch (error) {\n console.error('[TabContainer.updateTabDisplayName] Error updating tab display name:', error);\n }\n }\n\n /**\n * Update tab title with resource display name after resource loads\n */\n private async updateTabTitleFromResource(\n tabId: string,\n resourceComponent: BaseResourceComponent,\n resourceData: ResourceData\n ): Promise<void> {\n try {\n // Get the display name from the resource component\n const displayName = await resourceComponent.GetResourceDisplayName(resourceData);\n\n if (!displayName) {\n return;\n }\n\n // Update the tab title in Golden Layout\n this.layoutManager.UpdateTabStyle(tabId, { title: displayName });\n\n // Update the tab title in workspace configuration for persistence\n this.workspaceManager.UpdateTabTitle(tabId, displayName);\n\n } catch (error) {\n console.error('[TabContainer.updateTabTitleFromResource] Error updating tab title:', error);\n }\n }\n\n /**\n * Convert tab configuration to ResourceData\n */\n private async getResourceDataFromTab(tab: WorkspaceTab): Promise<ResourceData | null> {\n const config = tab.configuration;\n\n // Extract resource type from configuration or route\n let resourceType = config['resourceType'] as string;\n\n if (!resourceType && config['route']) {\n // Parse route to determine resource type\n resourceType = this.getResourceTypeFromRoute(config['route'] as string);\n }\n\n if (!resourceType) {\n console.error('[TabContainer.getResourceDataFromTab] No resourceType found in config or route');\n return null;\n }\n\n // Determine the driver class to use for component instantiation\n let driverClass = resourceType; // Default: use resourceType as driver class\n\n // For Custom resource type, get DriverClass from configuration or ResourceType metadata\n if (resourceType.toLowerCase() === 'custom') {\n // Custom resource type uses NavItem's DriverClass\n driverClass = config['driverClass'] as string;\n\n if (!driverClass) {\n LogError('Custom resource type requires driverClass in configuration');\n console.error('[TabContainer.getResourceDataFromTab] Missing driverClass for Custom resource type');\n return null;\n }\n } else {\n // For standard resource types, look up DriverClass from metadata\n const resourceTypeEntity = await this.getResourceTypeEntity(resourceType);\n\n if (resourceTypeEntity?.DriverClass) {\n driverClass = resourceTypeEntity.DriverClass;\n } \n // If no DriverClass in metadata, fall back to resourceType (backward compatibility)\n }\n\n // Include applicationId, driverClass, and tabId in configuration\n const resourceConfig = {\n ...config,\n applicationId: tab.applicationId,\n resourceTypeDriverClass: driverClass, // Store resolved driver class for component lookup\n tabId: tab.id // Needed for query param notification scoping in BaseResourceComponent\n };\n\n // Get ResourceRecordID from config or fall back to tab.resourceRecordId\n // Important: Some tabs store the record ID in config['recordId'], others in tab.resourceRecordId\n const resourceRecordId = (config['recordId'] as string) || tab.resourceRecordId || '';\n\n const resourceData = new ResourceData({\n ResourceTypeID: await this.getResourceTypeId(resourceType),\n ResourceRecordID: resourceRecordId,\n Configuration: resourceConfig\n });\n\n return resourceData;\n }\n\n private static _resourceTypesDataset: DatasetResultType | null = null;\n\n /**\n * Get ResourceType entity by name (includes DriverClass field)\n */\n private async getResourceTypeEntity(resourceType: string): Promise<MJResourceTypeEntity | null> {\n // Use ResourcePermissionEngine's cached data instead of fetching the dataset again.\n // The engine loads ResourceTypes during startup and keeps them in memory.\n const resourceTypes = ResourcePermissionEngine.Instance.ResourceTypes;\n if (resourceTypes && resourceTypes.length > 0) {\n return TabContainerComponent.findResourceTypeTolerant(resourceTypes, resourceType);\n }\n\n // Fallback: if engine hasn't loaded yet (shouldn't happen in normal flow),\n // fetch the dataset directly\n const md = this.ProviderToUse;\n const ds = TabContainerComponent._resourceTypesDataset || await md.GetDatasetByName(\"ResourceTypes\");\n if (!ds || !ds.Success || ds.Results.length === 0) {\n return null;\n }\n\n if (!TabContainerComponent._resourceTypesDataset) {\n TabContainerComponent._resourceTypesDataset = ds; // cache for next time\n }\n\n const result = ds.Results.find(r => r.Code.trim().toLowerCase() === 'resourcetypes');\n if (result && result.Results?.length > 0) {\n return TabContainerComponent.findResourceTypeTolerant(result.Results as MJResourceTypeEntity[], resourceType);\n }\n\n return null;\n }\n\n /**\n * Resolve a resource type BY NAME, tolerant of the 'MJ: ' prefix in EITHER\n * direction — core ResourceType rows predate the prefix convention ('User Views'),\n * while newer callers may pass 'MJ: User Views' (and vice versa). Exact match wins;\n * prefix-normalized is the fallback, so historical and prefixed names both resolve.\n */\n private static findResourceTypeTolerant(rows: MJResourceTypeEntity[], resourceType: string): MJResourceTypeEntity | null {\n const wanted = resourceType.trim().toLowerCase();\n const normalize = (name: string) => name.trim().toLowerCase().replace(/^mj:\\s*/, '');\n return rows.find(r => r.Name.trim().toLowerCase() === wanted)\n ?? rows.find(r => normalize(r.Name) === normalize(wanted))\n ?? null;\n }\n\n private async getResourceTypeId(resourceType: string): Promise<string> {\n const rt = await this.getResourceTypeEntity(resourceType);\n if (rt) {\n return rt.ID;\n }\n throw new Error(`ResourceType ID not found for type: ${resourceType}`);\n }\n\n /**\n * Determine resource type from route\n */\n private getResourceTypeFromRoute(route: string): string {\n // Parse route segments to determine resource type\n const segments = route.split('/').filter(s => s);\n\n if (segments.length === 0) {\n return 'home';\n }\n\n // Common route patterns\n if (route.includes('/record/')) {\n return 'record';\n }\n if (route.includes('/view/')) {\n return 'view';\n }\n if (route.includes('/dashboard/')) {\n return 'dashboard';\n }\n if (route.includes('/report/')) {\n return 'report';\n }\n if (route.includes('/search')) {\n return 'search';\n }\n if (route.includes('/query/')) {\n return 'query';\n }\n\n // Default based on first segment\n return segments[0] || 'home';\n }\n\n /**\n * Count the number of component nodes in a layout tree.\n * Used to validate that saved layout matches the tabs array before restoring.\n */\n private countLayoutComponents(node: LayoutNode): number {\n if (!node) {\n return 0;\n }\n\n // If this is a component node, count it\n if (node.type === 'component') {\n return 1;\n }\n\n // If this node has children (row, column, stack), recursively count them\n if (node.content && Array.isArray(node.content)) {\n return node.content.reduce((count, child) => count + this.countLayoutComponents(child), 0);\n }\n\n return 0;\n }\n\n /**\n * A saved records layout is restorable only when its component tabIds are\n * EXACTLY the current record-tab set. Count equality is not enough: a\n * persistence-suppressed mobile session can open one record and close\n * another, leaving a same-sized layout that references a closed tab —\n * restoring it renders a ghost pane (content load fails) until the next\n * sync sweeps it.\n */\n private layoutCoversExactTabSet(root: LayoutNode, recordTabs: WorkspaceTab[]): boolean {\n const layoutIds = new Set<string>();\n const collect = (node: LayoutNode | undefined): void => {\n if (!node) {\n return;\n }\n if (node.type === 'component') {\n const id = node.componentState?.['tabId'];\n if (typeof id === 'string') {\n layoutIds.add(id);\n }\n return;\n }\n node.content?.forEach(collect);\n };\n collect(root);\n return layoutIds.size === recordTabs.length && recordTabs.every(t => layoutIds.has(t.id));\n }\n\n /**\n * Cleanup a tab's component\n * Detaches from DOM but keeps in cache for potential reuse\n */\n /**\n * Ensure a record pane's FIRST element is its origin crumb (Matt's\n * pane-level placement — correct in splits, docked panes, and\n * single-resource, unlike the old region-level bar). Recreated on every\n * content attach: the pane container is cleared/re-homed on loads,\n * cache reattaches, and promote/demote moves.\n */\n private ensureRecordOriginCrumb(tab: WorkspaceTab, containerEl: HTMLElement): void {\n this.destroyOriginCrumb(tab.id);\n // The single-resource container is REUSED across tabs — sweep any crumb\n // element a previous tab left behind before (maybe) adding ours.\n containerEl.querySelectorAll('mj-record-origin-crumb').forEach(e => e.remove());\n if (!this.RecordsStyleActive || !IsRecordsTabConfiguration(tab.configuration)) {\n return;\n }\n const origin = GetRecordSourceContext(tab.configuration);\n if (!origin) {\n return; // No captured origin (deep link, history re-open) — no crumb.\n }\n const ref = createComponent(RecordOriginCrumbComponent, {\n environmentInjector: this.environmentInjector\n });\n ref.setInput('Origin', origin);\n this.appRef.attachView(ref.hostView);\n const el = (ref.hostView as unknown as { rootNodes: HTMLElement[] }).rootNodes[0];\n containerEl.insertBefore(el, containerEl.firstChild);\n this.originCrumbRefs.set(tab.id, ref);\n }\n\n /**\n * Refresh a pane crumb's origin after a config change (re-open\n * re-capture). Also handles the CREATE case: a record first opened\n * WITHOUT an origin (deep link, history recreate) whose re-open just\n * captured one — the pane is already attached, so ensureRecordOriginCrumb\n * never runs again; build the crumb into the live pane here.\n */\n private updateOriginCrumb(tab: WorkspaceTab): void {\n const ref = this.originCrumbRefs.get(tab.id);\n const origin = GetRecordSourceContext(tab.configuration);\n if (ref) {\n ref.setInput('Origin', origin);\n return;\n }\n if (origin && this.RecordsStyleActive && IsRecordsTabConfiguration(tab.configuration)) {\n const paneEl = this.recordsLayoutManager.GetContainer(tab.id)?.element\n ?? this.layoutManager.GetContainer(tab.id)?.element;\n if (paneEl && paneEl.childElementCount > 0) {\n this.ensureRecordOriginCrumb(tab, paneEl);\n }\n }\n }\n\n private destroyOriginCrumb(tabId: string): void {\n const ref = this.originCrumbRefs.get(tabId);\n if (ref) {\n ref.destroy();\n this.originCrumbRefs.delete(tabId);\n }\n }\n\n private cleanupTabComponent(tabId: string): void {\n // The pane crumb belongs to the pane, not the cached component — always\n // destroyed here; the next attach recreates it in the new pane.\n this.destroyOriginCrumb(tabId);\n // First, try to detach from cache (preserves component for reuse)\n const cachedInfo = this.cacheManager.findAndDetachByTabId(tabId);\n\n if (cachedInfo) {\n // Remove from legacy componentRefs but keep in cache\n this.componentRefs.delete(tabId);\n } else {\n // Fallback: destroy if not in cache (shouldn't happen in normal flow)\n const componentRef = this.componentRefs.get(tabId);\n if (componentRef) {\n this.appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n this.componentRefs.delete(tabId);\n }\n }\n }\n\n /**\n * Sync tabs with configuration changes\n */\n private syncTabsWithConfiguration(tabs: WorkspaceTab[]): void {\n // Defense in depth: skip syncing if Golden Layout isn't actually live. This can\n // happen when the visibility-mode transition has flipped `useSingleResourceMode`\n // to false and scheduled `initializeGoldenLayout(true)` via setTimeout(0), but the\n // Configuration subscription fires in the same tick before that init runs. The\n // deferred init will rebuild tabs from config via forceCreateTabs anyway.\n if (!this.layoutInitialized || !this.layoutManager.IsInitialized) {\n return;\n }\n\n // Get existing tab IDs from Golden Layout\n const existingTabIds = this.layoutManager.GetAllTabIds();\n\n // Get tab IDs from configuration\n const configTabIds = tabs.map(tab => tab.id);\n\n // Remove tabs that are no longer in configuration\n existingTabIds.forEach(tabId => {\n if (!configTabIds.includes(tabId)) {\n this.layoutManager.RemoveTab(tabId);\n }\n });\n\n // Create tabs that don't exist yet\n tabs.forEach(tab => {\n if (!existingTabIds.includes(tab.id)) {\n this.createTab(tab);\n } else {\n // Check if tab content needs to be reloaded (app or resource type changed)\n const existingComponentRef = this.componentRefs.get(tab.id);\n if (existingComponentRef) {\n const existingResourceData = existingComponentRef.instance.Data;\n\n // For Custom resource types, also check driverClass to distinguish between different custom resources\n const existingDriverClass = existingResourceData?.Configuration?.driverClass || existingResourceData?.Configuration?.resourceTypeDriverClass;\n const newDriverClass = tab.configuration['driverClass'] || tab.configuration['resourceTypeDriverClass'];\n\n // Normalize record IDs for comparison (treat null/undefined as empty string)\n // IMPORTANT: Check both tab.resourceRecordId AND tab.configuration['recordId']\n // because for nav items, the recordId is stored in configuration, not resourceRecordId\n const existingRecordId = existingResourceData?.ResourceRecordID || '';\n const newRecordId = tab.resourceRecordId || tab.configuration['recordId'] as string || '';\n\n const needsReload = existingResourceData?.ResourceType !== tab.configuration['resourceType'] ||\n existingResourceData?.Configuration?.applicationId !== tab.applicationId ||\n existingRecordId !== newRecordId ||\n (tab.configuration['resourceType'] === 'Custom' && existingDriverClass !== newDriverClass);\n\n if (needsReload) {\n // Clean up old component\n this.cleanupTabComponent(tab.id);\n\n // Mark tab as not loaded so it will reload when shown\n this.layoutManager.MarkTabNotLoaded(tab.id);\n\n // Update display name in background\n this.updateTabDisplayName(tab);\n\n // If this tab is currently active, reload it immediately\n const config = this.workspaceManager.GetConfiguration();\n if (config?.activeTabId === tab.id) {\n const glContainer = this.layoutManager.GetContainer(tab.id);\n if (glContainer) {\n this.loadTabContent(tab.id, glContainer);\n }\n }\n }\n }\n\n // Update styling for existing tabs. typeIcon ownership is split:\n // record tabs resolve synchronously here; NAV tab icons are owned\n // by upgradeNavTabIcon (async ladder) — setting the sync fallback\n // here too would downgrade an upgraded icon every emission and\n // flicker. Restored nav tabs never pass through createTab, so the\n // upgrade call here is also their FIRST icon application.\n const app = this.appManager.GetAppById(tab.applicationId);\n const styleUpdate: Partial<TabComponentState> = {\n isPinned: tab.isPinned,\n title: tab.title,\n appColor: app?.GetColor() || DEFAULT_APP_COLOR\n };\n if (IsRecordsTabConfiguration(tab.configuration)) {\n styleUpdate.typeIcon = this.resolveTabTypeIcon(tab);\n }\n this.layoutManager.UpdateTabStyle(tab.id, styleUpdate);\n void this.upgradeNavTabIcon(tab, this.layoutManager);\n this.updateOriginCrumb(tab);\n }\n });\n\n // Focus the active tab\n const config = this.workspaceManager.GetConfiguration();\n if (config?.activeTabId) {\n this.layoutManager.FocusTab(config.activeTabId);\n }\n }\n\n\n /**\n * Show context menu\n */\n showContextMenu(x: number, y: number, tabId: string, anchorEl?: HTMLElement): void {\n this.contextMenuX = x;\n this.contextMenuY = y;\n this.contextMenuTabId = tabId;\n this.contextMenuVisible = true;\n // Remember the invoking control so closing can hand focus back (the\n // slot button passes itself; right-click falls back to whatever was\n // focused). aria-expanded reflects the open menu on the anchor.\n this.contextMenuAnchor = anchorEl ?? (document.activeElement instanceof HTMLElement ? document.activeElement : null);\n if (this.contextMenuAnchor?.classList.contains('mj-tab-type-slot')) {\n this.contextMenuAnchor.setAttribute('aria-expanded', 'true');\n }\n // GL tab events (right-click, type-slot click) originate OUTSIDE any\n // Angular CD trigger — zoneless: without an explicit flush the flag\n // flips but the menu never renders.\n SafeDetectChanges(this.cdr);\n // Menu-pattern focus: land on the first enabled item so arrow keys work\n // immediately (rAF — the flush above just created the DOM).\n requestAnimationFrame(() => {\n const first = document.querySelector<HTMLButtonElement>('.context-menu [role=\"menuitem\"]:not([disabled])');\n first?.focus();\n });\n\n // Close menu when clicking outside - use setTimeout to avoid immediate trigger.\n // CAPTURE phase: bubble-phase closers are blind to clicks whose\n // propagation something stopped (the origin crumb stops its clicks so\n // GL pane-focus can't stomp navigation) — the menu stayed open when the\n // outside click landed on such an element.\n setTimeout(() => {\n const clickHandler = (event: MouseEvent) => {\n const target = event.target as HTMLElement;\n if (!target.closest('.context-menu')) {\n this.hideContextMenu();\n document.removeEventListener('click', clickHandler, true);\n document.removeEventListener('keydown', keyHandler, true);\n }\n };\n\n const keyHandler = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n this.hideContextMenu();\n document.removeEventListener('click', clickHandler, true);\n document.removeEventListener('keydown', keyHandler, true);\n }\n };\n\n document.addEventListener('click', clickHandler, true);\n document.addEventListener('keydown', keyHandler, true);\n }, 0);\n }\n\n /**\n * Hide context menu\n */\n hideContextMenu(restoreFocus = true): void {\n this.contextMenuVisible = false;\n this.contextMenuTabId = null;\n const anchor = this.contextMenuAnchor;\n this.contextMenuAnchor = null;\n if (anchor?.classList.contains('mj-tab-type-slot')) {\n anchor.setAttribute('aria-expanded', 'false');\n }\n // Outside-click/Escape teardown also runs outside CD — flush so the\n // menu actually disappears (see showContextMenu).\n SafeDetectChanges(this.cdr);\n // Menu-pattern focus return (app-switcher precedent). Actions that\n // deliberately move the user to another surface pass restoreFocus=false\n // and let the destination own focus.\n if (restoreFocus && anchor?.isConnected) {\n requestAnimationFrame(() => anchor.focus());\n }\n }\n\n /**\n * role=\"menu\" keyboard model: ArrowUp/Down rove (wrapping) over enabled\n * items, Home/End jump, Escape closes with focus return, Tab dismisses\n * (native menus don't trap Tab).\n */\n onMenuKeydown(event: KeyboardEvent): void {\n const items = Array.from(document.querySelectorAll<HTMLButtonElement>('.context-menu [role=\"menuitem\"]:not([disabled])'));\n if (items.length === 0) {\n return;\n }\n const idx = items.indexOf(document.activeElement as HTMLButtonElement);\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n items[(idx + 1) % items.length].focus();\n break;\n case 'ArrowUp':\n event.preventDefault();\n items[(idx - 1 + items.length) % items.length].focus();\n break;\n case 'Home':\n event.preventDefault();\n items[0].focus();\n break;\n case 'End':\n event.preventDefault();\n items[items.length - 1].focus();\n break;\n case 'Escape':\n // Handle here (with stopPropagation) so Escape works even before the\n // deferred document-level teardown listener attaches.\n event.preventDefault();\n event.stopPropagation();\n this.hideContextMenu();\n break;\n case 'Tab':\n this.hideContextMenu(false);\n break;\n }\n }\n\n /**\n * Check if context menu tab is pinned\n */\n get isContextTabPinned(): boolean {\n if (!this.contextMenuTabId) return false;\n const tab = this.workspaceManager.GetTab(this.contextMenuTabId);\n return tab?.isPinned || false;\n }\n\n /** Context tab is a records-REGION record — eligible for \"Move to Workspace\" */\n get canContextMoveToWorkspace(): boolean {\n // Docked/region composition is a DESKTOP concept — no move actions on mobile\n if (!this.contextMenuTabId || !this.RecordsStyleActive || this.mobileRecordsActive) return false;\n const tab = this.workspaceManager.GetTab(this.contextMenuTabId);\n return !!tab && IsRecordsRegionTab(tab.configuration);\n }\n\n /** Context tab is a DOCKED record — eligible for \"Move to Records\" */\n get canContextMoveToRecords(): boolean {\n if (!this.contextMenuTabId || !this.RecordsStyleActive || this.mobileRecordsActive) return false;\n const tab = this.workspaceManager.GetTab(this.contextMenuTabId);\n return !!tab && IsRecordsTabConfiguration(tab.configuration) && IsRecordDockedToWorkspace(tab.configuration);\n }\n\n /**\n * Promote: records region → main workspace layout (\"Move to Workspace\").\n * ORDER MATTERS: activate FIRST, then flip the flag. With the tab already\n * active, (a) the moved tab stays the user's focus through the membership\n * flip (syncTabsWithConfiguration's tail focuses config.activeTabId), and\n * (b) a single-resource→multi-tab transition triggered by the flip exempts\n * it from the force-pin sweep (it IS the activeTabId).\n */\n onContextMoveToWorkspace(): void {\n const tabId = this.contextMenuTabId;\n this.hideContextMenu(false);\n if (!tabId) return;\n this.workspaceManager.SetActiveTab(tabId);\n this.workspaceManager.UpdateTabConfiguration(tabId, { [RECORD_DOCKED_TO_WORKSPACE_KEY]: true });\n this.assertMovedTabActivation(tabId);\n }\n\n /**\n * Demote: main workspace layout → records region (\"Move to Records\").\n * Same activate-first ordering: the flip's emission then computes\n * showing=true in syncRecordsRegion, so the region surfaces focused on\n * the returned tab. `false` (not undefined) so the choice is explicit in\n * the persisted configuration.\n */\n onContextMoveToRecords(): void {\n const tabId = this.contextMenuTabId;\n this.hideContextMenu(false);\n if (!tabId) return;\n this.workspaceManager.SetActiveTab(tabId);\n this.workspaceManager.UpdateTabConfiguration(tabId, { [RECORD_DOCKED_TO_WORKSPACE_KEY]: false });\n this.assertMovedTabActivation(tabId);\n }\n\n /**\n * A move's SOURCE layout auto-activates its next tab when the moved tab is\n * removed, and that GL activation WRITES BACK into the workspace — stomping\n * the moved tab's activation (demote left the user staring at the main\n * layout while the record surfaced in the records region). Re-assert after\n * the removal cascade settles — the assertRecordActivation pattern.\n */\n private assertMovedTabActivation(tabId: string): void {\n setTimeout(() => {\n const config = this.workspaceManager.GetConfiguration();\n if (config?.tabs.some(t => t.id === tabId) && config.activeTabId !== tabId) {\n this.workspaceManager.SetActiveTab(tabId);\n }\n }, 0);\n }\n\n /**\n * Toggle pin from context menu\n */\n onContextPin(): void {\n if (this.contextMenuTabId) {\n this.workspaceManager.TogglePin(this.contextMenuTabId);\n }\n this.hideContextMenu();\n }\n\n /**\n * Close tab from context menu\n */\n onContextClose(): void {\n if (this.contextMenuTabId) {\n const tab = this.workspaceManager.GetTab(this.contextMenuTabId);\n const manager = tab && this.isRecordTab(tab) ? this.recordsLayoutManager : this.layoutManager;\n manager.RemoveTab(this.contextMenuTabId);\n }\n // The anchor lives on the closed tab — nothing to return focus to.\n this.hideContextMenu(false);\n }\n\n /**\n * Close all other tabs from context menu\n */\n onContextCloseOthers(): void {\n if (this.contextMenuTabId) {\n this.workspaceManager.CloseOtherTabs(this.contextMenuTabId);\n }\n this.hideContextMenu();\n }\n\n /**\n * Close tabs to the right from context menu\n */\n onContextCloseToRight(): void {\n if (this.contextMenuTabId) {\n this.workspaceManager.CloseTabsToRight(this.contextMenuTabId);\n }\n this.hideContextMenu();\n }\n\n /**\n * Check if context menu tab is pinned to Home dashboard\n */\n get isContextTabPinnedToHome(): boolean {\n if (!this.contextMenuTabId) return false;\n const tab = this.workspaceManager.GetTab(this.contextMenuTabId);\n if (!tab) return false;\n const resourceType = this.resolveResourceType(tab);\n return this.pinService.IsPinned(resourceType, tab.configuration as Record<string, unknown>);\n }\n\n /**\n * Pin current context menu tab to Home dashboard\n */\n async onContextPinToHome(): Promise<void> {\n if (this.isContextTabPinnedToHome) {\n this.hideContextMenu();\n return;\n }\n if (!this.contextMenuTabId) {\n this.hideContextMenu();\n return;\n }\n\n const tab = this.workspaceManager.GetTab(this.contextMenuTabId);\n if (!tab) {\n this.hideContextMenu();\n return;\n }\n\n const resourceType = this.resolveResourceType(tab);\n const activeApp = this.appManager.GetActiveApp();\n\n // Resolve nav item icon for Custom pins\n let pinIcon: string | undefined;\n if (resourceType === 'Custom' && activeApp) {\n const navItemName = tab.configuration?.['navItemName'] as string;\n if (navItemName) {\n const navItems = await activeApp.GetNavItems();\n const navItem = navItems.find(ni => ni.Label === navItemName);\n pinIcon = navItem?.Icon || undefined;\n }\n }\n\n const added = this.pinService.AddPin({\n DisplayName: tab.title || 'Untitled',\n ResourceType: resourceType,\n ApplicationID: tab.applicationId || activeApp?.ID,\n ApplicationName: activeApp?.Name,\n Icon: pinIcon,\n Color: activeApp?.GetColor() || undefined,\n Configuration: tab.configuration as Record<string, unknown>,\n });\n\n if (added) {\n MJNotificationService.Instance.CreateSimpleNotification(\n `Pinned \"${tab.title}\" to Home`, 'success', 2000\n );\n this.captureContextTabThumbnail(tab);\n } else {\n MJNotificationService.Instance.CreateSimpleNotification(\n `\"${tab.title}\" is already pinned to Home`, 'info', 3000\n );\n }\n\n this.hideContextMenu();\n }\n\n /**\n * Resolve a WorkspaceTab's resource type string for pin matching\n */\n private resolveResourceType(tab: WorkspaceTab): string {\n const config = tab.configuration;\n const rt = (config.resourceType as string) || '';\n if (rt === 'Dashboards' || config['dashboardId']) return 'Dashboards';\n if (rt === 'User Views' || rt === 'MJ: User Views' || config['viewId']) return 'User Views';\n if (rt === 'Queries' || config['queryId']) return 'Queries';\n if (rt === 'Reports' || config['reportId']) return 'Reports';\n if (rt === 'Records' || (config['entity'] && config['recordId'])) return 'Records';\n if (rt === 'Custom' || config['navItemName']) return 'Custom';\n return rt || 'Custom';\n }\n\n /**\n * Capture thumbnail for a just-pinned tab (async, non-blocking)\n */\n private async captureContextTabThumbnail(tab: WorkspaceTab): Promise<void> {\n try {\n // Find the active content element — differs by mode\n let contentEl: HTMLElement | null = null;\n if (this.useSingleResourceMode) {\n contentEl = this.directContentContainer?.nativeElement ?? null;\n } else {\n // In Golden Layout mode, find the active tab's content pane\n contentEl = this.glContainer?.nativeElement?.querySelector(\n '.lm_item_container .lm_content'\n ) as HTMLElement | null;\n }\n if (!contentEl) return;\n\n const thumbnail = await this.pinService.CaptureThumbnail(contentEl);\n if (thumbnail) {\n const resourceType = this.resolveResourceType(tab);\n const pin = this.pinService.FindPin(resourceType, tab.configuration as Record<string, unknown>);\n if (pin) {\n this.pinService.UpdatePin(pin.Id, { Thumbnail: thumbnail });\n }\n }\n } catch {\n // Thumbnail capture is best-effort\n }\n }\n\n /**\n * Public method for external callers (e.g. shell) to capture a thumbnail\n * of the currently visible content, regardless of mode.\n */\n public async CaptureActiveThumbnail(): Promise<string | undefined> {\n try {\n let contentEl: HTMLElement | null = null;\n if (this.useSingleResourceMode) {\n contentEl = this.directContentContainer?.nativeElement ?? null;\n } else {\n contentEl = this.glContainer?.nativeElement?.querySelector(\n '.lm_item_container .lm_content'\n ) as HTMLElement | null;\n }\n if (!contentEl) return undefined;\n return await this.pinService.CaptureThumbnail(contentEl);\n } catch {\n return undefined;\n }\n }\n\n /**\n * While the naming implies this is only invoked once, components we DO NOT CONTROL might have race\n * conditions that result in unpredictable behavior. To avoid those causing loading screen overaly to show\n * forever we emit all events upstream\n */\n private emitFirstLoadCompleteOnce(): void {\n this.firstResourceLoadComplete.emit(); // do this each time to be sure we don't suppress messages\n }\n\n /**\n * Render an inline \"missing resource component\" error into a host element when\n * ClassFactory has no registration for the requested driver class. Used when a\n * dashboard / nav item references a component class that isn't built into this\n * Angular bundle (e.g. an app-specific dashboard defined outside the running app).\n *\n * Logs a structured console.error with context for developers, and ensures the\n * shell's first-resource-load gate is satisfied so the loading overlay clears.\n */\n private renderMissingResourceError(host: HTMLElement, driverClass: string, context: Record<string, unknown>): void {\n console.error(\n `[TabContainer] No resource component registered for driver class \"${driverClass}\".\\n` +\n `MemberJunction's ClassFactory has no @RegisterClass(BaseResourceComponent, '${driverClass}') in this build. ` +\n `Either the package providing this resource is not included in the running Explorer bundle, ` +\n `the registration manifest is stale (run \\`npm run mj:manifest\\`), or the driver class name in metadata is wrong.\\n` +\n `Context: ${JSON.stringify(context, null, 2)}`\n );\n\n // Clear the host before injecting the error UI.\n host.innerHTML = '';\n const wrapper = document.createElement('div');\n wrapper.className = 'tab-content-wrapper missing-resource-error';\n wrapper.style.cssText = 'width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 32px; box-sizing: border-box;';\n wrapper.setAttribute('role', 'alert');\n\n const card = document.createElement('div');\n card.style.cssText = [\n 'max-width: 720px',\n 'width: 100%',\n 'padding: 32px',\n 'background: var(--mj-bg-surface)',\n 'border: 1px solid var(--mj-status-warning-border)',\n 'border-radius: 8px',\n 'text-align: center',\n 'color: var(--mj-text-primary)',\n 'font-family: inherit',\n ].join(';');\n\n const icon = document.createElement('div');\n icon.innerHTML = '<i class=\"fa-solid fa-puzzle-piece\"></i>';\n icon.style.cssText = 'font-size: 32px; color: var(--mj-status-warning); margin-bottom: 12px;';\n\n const title = document.createElement('h2');\n title.textContent = 'This view isn’t available in the running build.';\n title.style.cssText = 'font-size: 18px; font-weight: 600; margin: 0 0 12px 0; color: var(--mj-status-warning-text);';\n\n const detail = document.createElement('p');\n detail.textContent = `No component is registered for driver class \"${driverClass}\". The Angular package that provides this view likely isn't bundled into this Explorer build.`;\n detail.style.cssText = 'font-size: 14px; line-height: 1.5; color: var(--mj-text-secondary); margin: 0 0 12px 0;';\n\n const hint = document.createElement('p');\n hint.textContent = 'See browser console for technical details (driver class, application, nav item).';\n hint.style.cssText = 'font-size: 12px; color: var(--mj-text-muted); margin: 0; font-style: italic;';\n\n card.appendChild(icon);\n card.appendChild(title);\n card.appendChild(detail);\n card.appendChild(hint);\n wrapper.appendChild(card);\n host.appendChild(wrapper);\n\n // Unblock the shell's first-load gate so the loading overlay clears.\n this.emitFirstLoadCompleteOnce();\n }\n}\n","<div class=\"tab-container\">\n\n <!-- Main region: nav pages (single-resource or main Golden Layout).\n Hidden (not destroyed) while the RECORDS region is showing, so nav\n content keeps its state and reappears instantly. -->\n <div class=\"main-region\" [class.region-hidden]=\"ShowRecordsRegion\">\n <!-- Single-Resource Mode: Direct component rendering without Golden Layout -->\n <!-- This avoids the 20px height issue when GL header is hidden -->\n @if (useSingleResourceMode) {\n <div #directContentContainer class=\"direct-content-container\"></div>\n } @else {\n <!-- Multi-Tab Mode: Golden Layout Container -->\n <div #glContainer class=\"gl-container\"></div>\n }\n </div>\n\n <!-- RECORDS region: a SEPARATE Golden Layout hosting only record tabs\n (records-style record opens). Always in the DOM once created so the\n layout survives visibility flips; shown only while the active tab is\n a record. Native GL tab bar = record tabs, drag-to-split included. -->\n @if (RecordsStyleActive) {\n <!-- Origin crumbs are PANE-LEVEL now (first element inside each record\n pane — see RecordOriginCrumbComponent); the region needs no bar. -->\n <div class=\"records-region\" [class.region-hidden]=\"!ShowRecordsRegion\">\n <!-- MOBILE: the GL tab strip is unusable at phone widths (one tab\n fits, no overflow UI) — the record bar replaces it and opens the\n record switcher sheet. The GL itself runs headerless (HideHeaders). -->\n @if (IsMobileRecords) {\n <mj-record-bar\n [Title]=\"RecordBarTitle\"\n [Icon]=\"RecordBarIcon\"\n [Color]=\"RecordBarColor\"\n [Count]=\"OpenRecordCount\"\n (SwitcherRequested)=\"OpenRecordSwitcher()\">\n </mj-record-bar>\n }\n <div #recordsGlContainer class=\"records-gl-container\"></div>\n </div>\n\n <!-- MOBILE record switcher: bottom sheet listing ALL open records\n (region + docked). Fixed-position — DOM location here is\n visual-neutral; living in tab-container keeps close routing on the\n same path as the tab context menu. -->\n <mj-record-switcher-sheet\n [Entries]=\"SwitcherEntries\"\n [Visible]=\"RecordSwitcherVisible\"\n (VisibleChange)=\"OnSwitcherVisibleChange($event)\"\n (ActivateRequested)=\"OnSwitcherActivate($event)\"\n (CloseRequested)=\"OnSwitcherClose($event)\">\n </mj-record-switcher-sheet>\n }\n\n <!-- Context Menu (only relevant in multi-tab mode). Real buttons with\n menu semantics: arrow keys rove, Escape closes with focus return to\n the invoking control (see onMenuKeydown / hideContextMenu). -->\n @if (contextMenuVisible) {\n <div\n class=\"context-menu\"\n role=\"menu\"\n aria-label=\"Tab actions\"\n (keydown)=\"onMenuKeydown($event)\"\n [style.left.px]=\"contextMenuX\"\n [style.top.px]=\"contextMenuY\">\n <button type=\"button\" role=\"menuitem\" class=\"context-menu-item\" (click)=\"onContextPin()\">\n <i class=\"fa-solid fa-thumbtack\" aria-hidden=\"true\"></i>\n <span>{{ isContextTabPinned ? 'Unpin Tab' : 'Pin Tab' }}</span>\n </button>\n <div class=\"context-menu-divider\"></div>\n <button type=\"button\" role=\"menuitem\" class=\"context-menu-item\" [class.new-item]=\"!isContextTabPinnedToHome\" [class.disabled]=\"isContextTabPinnedToHome\" [disabled]=\"isContextTabPinnedToHome\" (click)=\"onContextPinToHome()\">\n <i class=\"fa-solid fa-house-chimney\" aria-hidden=\"true\"></i>\n @if (isContextTabPinnedToHome) {\n <span>Pinned to Home</span>\n <span class=\"check\"><i class=\"fa-solid fa-check\" aria-hidden=\"true\"></i></span>\n } @else {\n <span>Pin to Home</span>\n }\n </button>\n @if (canContextMoveToWorkspace || canContextMoveToRecords) {\n <div class=\"context-menu-divider\"></div>\n @if (canContextMoveToWorkspace) {\n <button type=\"button\" role=\"menuitem\" class=\"context-menu-item\" (click)=\"onContextMoveToWorkspace()\">\n <i class=\"fa-solid fa-arrow-up-right-from-square\" aria-hidden=\"true\"></i>\n <span>Move to Workspace</span>\n </button>\n }\n @if (canContextMoveToRecords) {\n <button type=\"button\" role=\"menuitem\" class=\"context-menu-item\" (click)=\"onContextMoveToRecords()\">\n <i class=\"fa-solid fa-file-lines\" aria-hidden=\"true\"></i>\n <span>Move to Records</span>\n </button>\n }\n }\n <div class=\"context-menu-divider\"></div>\n <button type=\"button\" role=\"menuitem\" class=\"context-menu-item\" (click)=\"onContextClose()\">\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i>\n <span>Close Tab</span>\n </button>\n <button type=\"button\" role=\"menuitem\" class=\"context-menu-item\" (click)=\"onContextCloseOthers()\">\n <i class=\"fa-solid fa-layer-group\" aria-hidden=\"true\"></i>\n <span>Close Others</span>\n </button>\n <button type=\"button\" role=\"menuitem\" class=\"context-menu-item\" (click)=\"onContextCloseToRight()\">\n <i class=\"fa-solid fa-angles-right\" aria-hidden=\"true\"></i>\n <span>Close to Right</span>\n </button>\n </div>\n }\n</div>\n"]}