cloud-ide-layout 1.0.123 → 1.0.125

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 (16) hide show
  1. package/fesm2022/{cloud-ide-layout-cloud-ide-layout-BpATV-Pe.mjs → cloud-ide-layout-cloud-ide-layout-DdMf1j7_.mjs} +126 -7
  2. package/fesm2022/cloud-ide-layout-cloud-ide-layout-DdMf1j7_.mjs.map +1 -0
  3. package/fesm2022/{cloud-ide-layout-dashboard-manager.component-BrAn37oD.mjs → cloud-ide-layout-dashboard-manager.component-C8rnVZpP.mjs} +2 -2
  4. package/fesm2022/{cloud-ide-layout-dashboard-manager.component-BrAn37oD.mjs.map → cloud-ide-layout-dashboard-manager.component-C8rnVZpP.mjs.map} +1 -1
  5. package/fesm2022/{cloud-ide-layout-drawer-theme.component-D9-hx3zD.mjs → cloud-ide-layout-drawer-theme.component-DV0QsDsO.mjs} +2 -2
  6. package/fesm2022/{cloud-ide-layout-drawer-theme.component-D9-hx3zD.mjs.map → cloud-ide-layout-drawer-theme.component-DV0QsDsO.mjs.map} +1 -1
  7. package/fesm2022/{cloud-ide-layout-floating-entity-selection.component-DIQDQ_7Q.mjs → cloud-ide-layout-floating-entity-selection.component-DteJtUqk.mjs} +2 -2
  8. package/fesm2022/{cloud-ide-layout-floating-entity-selection.component-DIQDQ_7Q.mjs.map → cloud-ide-layout-floating-entity-selection.component-DteJtUqk.mjs.map} +1 -1
  9. package/fesm2022/{cloud-ide-layout-home-wrapper.component-Ce2ZrkY6.mjs → cloud-ide-layout-home-wrapper.component-DjRHVU59.mjs} +2 -2
  10. package/fesm2022/{cloud-ide-layout-home-wrapper.component-Ce2ZrkY6.mjs.map → cloud-ide-layout-home-wrapper.component-DjRHVU59.mjs.map} +1 -1
  11. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-cOnPPckf.mjs → cloud-ide-layout-sidedrawer-notes.component-C2tOsEC4.mjs} +2 -2
  12. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-cOnPPckf.mjs.map → cloud-ide-layout-sidedrawer-notes.component-C2tOsEC4.mjs.map} +1 -1
  13. package/fesm2022/cloud-ide-layout.mjs +1 -1
  14. package/index.d.ts +13 -0
  15. package/package.json +1 -1
  16. package/fesm2022/cloud-ide-layout-cloud-ide-layout-BpATV-Pe.mjs.map +0 -1
@@ -248,7 +248,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
248
248
  }] });
249
249
 
250
250
  class AppStateService {
251
- // Inject file manager service
251
+ // Inject services
252
252
  fileManagerService = inject(CideEleFileManagerService);
253
253
  // Private signal for current user
254
254
  currentUserSignal = signal(null, ...(ngDevMode ? [{ debugName: "currentUserSignal" }] : []));
@@ -256,6 +256,10 @@ class AppStateService {
256
256
  activeModuleSignal = signal(null, ...(ngDevMode ? [{ debugName: "activeModuleSignal" }] : []));
257
257
  // Private signal for active entity
258
258
  activeEntitySignal = signal(null, ...(ngDevMode ? [{ debugName: "activeEntitySignal" }] : []));
259
+ // Track if entity change handler is initialized (to prevent triggering on initial load)
260
+ entityChangeHandlerInitialized = false;
261
+ // Callback registration for entity change handlers (to avoid circular dependencies)
262
+ entityChangeCallbacks = [];
259
263
  // Public computed signal for current user, for other services to get the user value
260
264
  currentUser = computed(() => this.currentUserSignal(), ...(ngDevMode ? [{ debugName: "currentUser" }] : []));
261
265
  // Public computed signal for active module
@@ -316,6 +320,52 @@ class AppStateService {
316
320
  this.fileManagerService.setUserId('');
317
321
  }
318
322
  });
323
+ // GLOBAL ENTITY CHANGE HANDLER: When entity changes, close all tabs and navigate to home
324
+ // This ensures all components are destroyed and data is refreshed for the new entity
325
+ // No need to inject this service in any component - it works globally
326
+ let previousEntityId = null;
327
+ effect(() => {
328
+ const currentEntity = this.activeEntitySignal();
329
+ const currentEntityId = currentEntity?._id || null;
330
+ // Mark handler as initialized after first run (to skip initial load from localStorage)
331
+ if (!this.entityChangeHandlerInitialized) {
332
+ previousEntityId = currentEntityId;
333
+ this.entityChangeHandlerInitialized = true;
334
+ console.log('🏢 [AppStateService] Entity change handler initialized with initial entity:', currentEntityId);
335
+ return; // Skip on initial load
336
+ }
337
+ // Only trigger if entity actually changed (not on initial load)
338
+ if (previousEntityId !== null && currentEntityId !== previousEntityId && currentEntityId !== null) {
339
+ console.log('🏢 [AppStateService] Entity changed - notifying registered handlers', {
340
+ previousEntityId,
341
+ newEntityId: currentEntityId,
342
+ newEntityName: currentEntity?.syen_name
343
+ });
344
+ // Notify all registered entity change callbacks (e.g., close tabs, refresh components)
345
+ this.entityChangeCallbacks.forEach(callback => {
346
+ try {
347
+ callback(currentEntity);
348
+ }
349
+ catch (error) {
350
+ console.error('Error in entity change callback:', error);
351
+ }
352
+ });
353
+ }
354
+ else if (previousEntityId !== null && currentEntityId === null) {
355
+ // Entity was cleared - also notify callbacks
356
+ console.log('🏢 [AppStateService] Entity cleared - notifying registered handlers');
357
+ this.entityChangeCallbacks.forEach(callback => {
358
+ try {
359
+ callback(null);
360
+ }
361
+ catch (error) {
362
+ console.error('Error in entity change callback:', error);
363
+ }
364
+ });
365
+ }
366
+ // Update previous entity ID for next comparison
367
+ previousEntityId = currentEntityId;
368
+ });
319
369
  // Listen for localStorage changes from other tabs/windows
320
370
  this.setupStorageListener();
321
371
  }
@@ -371,6 +421,26 @@ class AppStateService {
371
421
  getActiveEntityValue() {
372
422
  return this.activeEntitySignal();
373
423
  }
424
+ /**
425
+ * Register a callback to be called when entity changes
426
+ * This allows other services to react to entity changes without creating circular dependencies
427
+ * @param callback Function to call when entity changes, receives the new entity (or null if cleared)
428
+ */
429
+ registerEntityChangeHandler(callback) {
430
+ this.entityChangeCallbacks.push(callback);
431
+ console.log('📝 [AppStateService] Registered entity change handler, total handlers:', this.entityChangeCallbacks.length);
432
+ }
433
+ /**
434
+ * Unregister an entity change callback
435
+ * @param callback The callback function to remove
436
+ */
437
+ unregisterEntityChangeHandler(callback) {
438
+ const index = this.entityChangeCallbacks.indexOf(callback);
439
+ if (index > -1) {
440
+ this.entityChangeCallbacks.splice(index, 1);
441
+ console.log('📝 [AppStateService] Unregistered entity change handler, remaining handlers:', this.entityChangeCallbacks.length);
442
+ }
443
+ }
374
444
  /**
375
445
  * Manually refresh state from localStorage
376
446
  * Call this method when you need to sync with external localStorage changes
@@ -1283,7 +1353,7 @@ class CideLytFloatingEntitySelectionService {
1283
1353
  }
1284
1354
  try {
1285
1355
  // Use relative import to avoid circular dependency
1286
- const module = await import('./cloud-ide-layout-floating-entity-selection.component-DIQDQ_7Q.mjs');
1356
+ const module = await import('./cloud-ide-layout-floating-entity-selection.component-DteJtUqk.mjs');
1287
1357
  if (module.CideLytFloatingEntitySelectionComponent) {
1288
1358
  this.containerService.registerComponent('entity-selection-header', module.CideLytFloatingEntitySelectionComponent);
1289
1359
  console.log('✅ Entity selection component registered successfully');
@@ -4479,6 +4549,8 @@ class CideLytRequestService {
4479
4549
  tabStateService = inject(TabStateService);
4480
4550
  sidedrawerService = inject(CideLytSidedrawerService);
4481
4551
  sharedService = inject(CideLytSharedService);
4552
+ floatingContainerService = inject(CideEleFloatingContainerService);
4553
+ appStateService = inject(AppStateService);
4482
4554
  constructor() {
4483
4555
  // Initialize router
4484
4556
  this.router = inject(Router);
@@ -4487,6 +4559,12 @@ class CideLytRequestService {
4487
4559
  this.sharedService.registerTabManagement(this.handleRouteBasedTabManagement.bind(this));
4488
4560
  // Register request visibility callback
4489
4561
  this.sharedService.registerRequestVisibility(this.handleRequestVisibility.bind(this));
4562
+ // Register entity change handler with AppStateService to close tabs when entity changes
4563
+ // This is safe because AppStateService no longer imports CideLytRequestService
4564
+ this.appStateService.registerEntityChangeHandler((entity) => {
4565
+ console.log('🏢 [RequestService] Entity changed, closing all tabs:', entity?._id);
4566
+ this.closeAllTabs();
4567
+ });
4490
4568
  }
4491
4569
  /**
4492
4570
  * Handle request visibility changes from shared service
@@ -4683,6 +4761,47 @@ class CideLytRequestService {
4683
4761
  // Request wrapper visibility is now controlled by layout configuration
4684
4762
  // The wrapper will be hidden/shown based on sytm_layout_request.status in setPageData
4685
4763
  }
4764
+ /**
4765
+ * Close all tabs and navigate to home
4766
+ * This is used when entity changes to ensure all components are destroyed and refreshed
4767
+ */
4768
+ closeAllTabs() {
4769
+ console.log('🧹 REQUEST SERVICE: Closing all tabs due to entity change');
4770
+ const currentTabs = this.tabsSignal();
4771
+ // Close all floating containers first
4772
+ this.floatingContainerService.hideAll();
4773
+ console.log('🧹 REQUEST SERVICE: Closed all floating containers');
4774
+ // Clear all tabs from TabStateService
4775
+ currentTabs.forEach(tab => {
4776
+ this.tabStateService.removeTab(tab.id);
4777
+ // Clear stored routes from route reuse strategy
4778
+ if (this.routeReuseStrategy instanceof CustomRouteReuseStrategy) {
4779
+ let pathKey = tab.route.startsWith('/') ? tab.route.substring(1) : tab.route;
4780
+ if (tab.params && Object.keys(tab.params).length > 0) {
4781
+ const queryParamsString = Object.keys(tab.params)
4782
+ .sort()
4783
+ .map(key => `${key}=${tab.params[key]}`)
4784
+ .join('&');
4785
+ pathKey += '?' + queryParamsString;
4786
+ }
4787
+ this.routeReuseStrategy.clearStoredRoute(pathKey);
4788
+ // Also clear without query params
4789
+ const pathKeyWithoutParams = tab.route.startsWith('/') ? tab.route.substring(1) : tab.route;
4790
+ if (pathKeyWithoutParams !== pathKey) {
4791
+ this.routeReuseStrategy.clearStoredRoute(pathKeyWithoutParams);
4792
+ }
4793
+ }
4794
+ });
4795
+ // Clear all tabs
4796
+ this.tabsSignal.set([]);
4797
+ this.activeTabIdSignal.set(null);
4798
+ this.tabStateService.setActiveTab(null);
4799
+ // Clear sidedrawer
4800
+ this.sidedrawerService.updateDrawerItems(undefined);
4801
+ // Navigate to home
4802
+ this.router.navigate(['/control-panel']);
4803
+ console.log('✅ REQUEST SERVICE: All tabs and floating containers closed, navigated to home');
4804
+ }
4686
4805
  // Hide Request
4687
4806
  hideRequest() {
4688
4807
  console.log('🚫 REQUEST SERVICE - Hiding request wrapper');
@@ -4835,8 +4954,8 @@ class CideLytSidedrawerWrapperComponent {
4835
4954
  }
4836
4955
  ngOnInit() {
4837
4956
  // Initialize the component map (You'd likely populate this from a config or service)
4838
- this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-cOnPPckf.mjs').then(m => m.CideLytSidedrawerNotesComponent);
4839
- this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-D9-hx3zD.mjs').then(m => m.CideLytDrawerThemeComponent);
4957
+ this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-C2tOsEC4.mjs').then(m => m.CideLytSidedrawerNotesComponent);
4958
+ this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-DV0QsDsO.mjs').then(m => m.CideLytDrawerThemeComponent);
4840
4959
  }
4841
4960
  async loadComponent(configFor) {
4842
4961
  console.log('🔍 SIDEDRAWER - Loading component:', configFor, 'Current tab:', this.currentTabId);
@@ -6503,7 +6622,7 @@ const layoutControlPannelChildRoutes = [{
6503
6622
  },
6504
6623
  {
6505
6624
  path: "home",
6506
- loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-Ce2ZrkY6.mjs').then(c => c.CideLytHomeWrapperComponent),
6625
+ loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-DjRHVU59.mjs').then(c => c.CideLytHomeWrapperComponent),
6507
6626
  canActivate: [authGuard],
6508
6627
  data: {
6509
6628
  sypg_page_code: "cide_lyt_home" // Used by RequestService to fetch tab properties
@@ -6511,7 +6630,7 @@ const layoutControlPannelChildRoutes = [{
6511
6630
  },
6512
6631
  {
6513
6632
  path: "dashboard-manager",
6514
- loadComponent: () => import('./cloud-ide-layout-dashboard-manager.component-BrAn37oD.mjs').then(c => c.DashboardManagerComponent),
6633
+ loadComponent: () => import('./cloud-ide-layout-dashboard-manager.component-C8rnVZpP.mjs').then(c => c.DashboardManagerComponent),
6515
6634
  canActivate: [authGuard],
6516
6635
  data: {
6517
6636
  sypg_page_code: "cide_lyt_dashboard_manager"
@@ -8078,4 +8197,4 @@ var floatingEntityRightsSharing_component = /*#__PURE__*/Object.freeze({
8078
8197
  */
8079
8198
 
8080
8199
  export { AppStateHelperService as A, CideLytSharedWrapperComponent as C, ENVIRONMENT_CONFIG as E, NotificationSettingsService as N, RightsService as R, CideLytSidebarService as a, CideLytRequestService as b, CideLytSidedrawerService as c, CideLytThemeService as d, AppStateService as e, CloudIdeLayoutService as f, CloudIdeLayoutComponent as g, CideLytSharedService as h, ComponentContextService as i, layoutControlPannelChildRoutes as j, CustomRouteReuseStrategy as k, layoutRoutes as l, CideLytUserStatusService as m, CacheManagerService as n, CideLytFileManagerService as o, processThemeVariable as p, CideLytFloatingEntityRightsSharingComponent as q, CideLytFloatingEntityRightsSharingService as r, setCSSVariable as s, themeFactory as t };
8081
- //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-BpATV-Pe.mjs.map
8200
+ //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-DdMf1j7_.mjs.map