cloud-ide-layout 1.0.176 → 1.0.179

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 (14) hide show
  1. package/fesm2022/{cloud-ide-layout-cloud-ide-layout-CC-eJdik.mjs → cloud-ide-layout-cloud-ide-layout-BlLjLM3N.mjs} +140 -49
  2. package/fesm2022/cloud-ide-layout-cloud-ide-layout-BlLjLM3N.mjs.map +1 -0
  3. package/fesm2022/{cloud-ide-layout-dashboard-manager.component-asEb-RqK.mjs → cloud-ide-layout-dashboard-manager.component-DWxN9ReS.mjs} +2 -2
  4. package/fesm2022/{cloud-ide-layout-dashboard-manager.component-asEb-RqK.mjs.map → cloud-ide-layout-dashboard-manager.component-DWxN9ReS.mjs.map} +1 -1
  5. package/fesm2022/{cloud-ide-layout-drawer-theme.component-hlIFgjX_.mjs → cloud-ide-layout-drawer-theme.component-D4qmt25K.mjs} +2 -2
  6. package/fesm2022/{cloud-ide-layout-drawer-theme.component-hlIFgjX_.mjs.map → cloud-ide-layout-drawer-theme.component-D4qmt25K.mjs.map} +1 -1
  7. package/fesm2022/{cloud-ide-layout-home-wrapper.component-TsEnFYa4.mjs → cloud-ide-layout-home-wrapper.component-DeR1T21C.mjs} +2 -2
  8. package/fesm2022/{cloud-ide-layout-home-wrapper.component-TsEnFYa4.mjs.map → cloud-ide-layout-home-wrapper.component-DeR1T21C.mjs.map} +1 -1
  9. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-ByfmdVwA.mjs → cloud-ide-layout-sidedrawer-notes.component-BuDfM6ms.mjs} +2 -2
  10. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-ByfmdVwA.mjs.map → cloud-ide-layout-sidedrawer-notes.component-BuDfM6ms.mjs.map} +1 -1
  11. package/fesm2022/cloud-ide-layout.mjs +1 -1
  12. package/index.d.ts +25 -1
  13. package/package.json +1 -1
  14. package/fesm2022/cloud-ide-layout-cloud-ide-layout-CC-eJdik.mjs.map +0 -1
@@ -286,6 +286,8 @@ class AppStateService {
286
286
  activeModuleSignal = signal(null, ...(ngDevMode ? [{ debugName: "activeModuleSignal" }] : []));
287
287
  // Private signal for active entity
288
288
  activeEntitySignal = signal(null, ...(ngDevMode ? [{ debugName: "activeEntitySignal" }] : []));
289
+ // Private signal for active academic year
290
+ activeAcademicYearSignal = signal(null, ...(ngDevMode ? [{ debugName: "activeAcademicYearSignal" }] : []));
289
291
  // Track if entity change handler is initialized (to prevent triggering on initial load)
290
292
  entityChangeHandlerInitialized = false;
291
293
  // Callback registration for entity change handlers (to avoid circular dependencies)
@@ -296,6 +298,8 @@ class AppStateService {
296
298
  activeModule = computed(() => this.activeModuleSignal(), ...(ngDevMode ? [{ debugName: "activeModule" }] : []));
297
299
  // Public computed signal for active entity
298
300
  activeEntity = computed(() => this.activeEntitySignal(), ...(ngDevMode ? [{ debugName: "activeEntity" }] : []));
301
+ // Public computed signal for active academic year
302
+ activeAcademicYear = computed(() => this.activeAcademicYearSignal(), ...(ngDevMode ? [{ debugName: "activeAcademicYear" }] : []));
299
303
  // Computed signals for derived state
300
304
  isAuthenticated = computed(() => !!this.currentUserSignal(), ...(ngDevMode ? [{ debugName: "isAuthenticated" }] : []));
301
305
  userInfo = computed(() => {
@@ -333,10 +337,12 @@ class AppStateService {
333
337
  const currentUser = this.currentUserSignal();
334
338
  const activeModule = this.activeModuleSignal();
335
339
  const activeEntity = this.activeEntitySignal();
340
+ const activeAcademicYear = this.activeAcademicYearSignal();
336
341
  this.saveToLocalStorage({
337
342
  user: currentUser,
338
343
  activeModule: activeModule,
339
- activeEntity: activeEntity
344
+ activeEntity: activeEntity,
345
+ activeAcademicYear: activeAcademicYear
340
346
  });
341
347
  });
342
348
  // Automatically update file manager user ID whenever user changes
@@ -451,6 +457,18 @@ class AppStateService {
451
457
  getActiveEntityValue() {
452
458
  return this.activeEntitySignal();
453
459
  }
460
+ /**
461
+ * Set the active academic year
462
+ */
463
+ setActiveAcademicYear(academicYear) {
464
+ this.activeAcademicYearSignal.set(academicYear);
465
+ }
466
+ /**
467
+ * Get active academic year value (non-reactive)
468
+ */
469
+ getActiveAcademicYearValue() {
470
+ return this.activeAcademicYearSignal();
471
+ }
454
472
  /**
455
473
  * Register a callback to be called when entity changes
456
474
  * This allows other services to react to entity changes without creating circular dependencies
@@ -522,6 +540,14 @@ class AppStateService {
522
540
  localStorage.removeItem('cide_active_entity');
523
541
  }
524
542
  }
543
+ if (data.activeAcademicYear !== undefined) {
544
+ if (data.activeAcademicYear) {
545
+ localStorage.setItem('cide_active_academic_year', JSON.stringify(data.activeAcademicYear));
546
+ }
547
+ else {
548
+ localStorage.removeItem('cide_active_academic_year');
549
+ }
550
+ }
525
551
  }
526
552
  catch (error) {
527
553
  console.error('Error saving to localStorage:', error);
@@ -550,6 +576,11 @@ class AppStateService {
550
576
  const entity = JSON.parse(entityData);
551
577
  this.activeEntitySignal.set(entity);
552
578
  }
579
+ const academicYearData = localStorage.getItem('cide_active_academic_year');
580
+ if (academicYearData) {
581
+ const academicYear = JSON.parse(academicYearData);
582
+ this.activeAcademicYearSignal.set(academicYear);
583
+ }
553
584
  }
554
585
  catch (error) {
555
586
  console.error('Error loading from localStorage:', error);
@@ -558,6 +589,7 @@ class AppStateService {
558
589
  localStorage.removeItem('cide_auth_user');
559
590
  localStorage.removeItem('cide_active_module');
560
591
  localStorage.removeItem('cide_active_entity');
592
+ localStorage.removeItem('cide_active_academic_year');
561
593
  }
562
594
  }
563
595
  }
@@ -603,6 +635,16 @@ class AppStateService {
603
635
  this.activeEntitySignal.set(null);
604
636
  }
605
637
  }
638
+ // Handle active academic year changes
639
+ if (event.key === 'cide_active_academic_year') {
640
+ if (event.newValue) {
641
+ const academicYear = JSON.parse(event.newValue);
642
+ this.activeAcademicYearSignal.set(academicYear);
643
+ }
644
+ else {
645
+ this.activeAcademicYearSignal.set(null);
646
+ }
647
+ }
606
648
  }
607
649
  catch (error) {
608
650
  console.error('Error parsing localStorage update:', error);
@@ -629,6 +671,7 @@ class AppStateHelperService {
629
671
  activeModule = this.appStateService.activeModule;
630
672
  activeModuleInfo = this.appStateService.activeModuleInfo;
631
673
  activeEntity = this.appStateService.activeEntity;
674
+ activeAcademicYear = this.appStateService.activeAcademicYear;
632
675
  /**
633
676
  * Get current user value (non-reactive)
634
677
  */
@@ -824,6 +867,25 @@ class AppStateHelperService {
824
867
  const entity = this.getActiveEntity();
825
868
  return entity?.syen_entity_code || null;
826
869
  }
870
+ /**
871
+ * Set the active academic year
872
+ */
873
+ setActiveAcademicYear(academicYear) {
874
+ this.appStateService.setActiveAcademicYear(academicYear);
875
+ }
876
+ /**
877
+ * Get active academic year value (non-reactive)
878
+ */
879
+ getActiveAcademicYear() {
880
+ return this.appStateService.getActiveAcademicYearValue();
881
+ }
882
+ /**
883
+ * Get active academic year ID
884
+ */
885
+ getActiveAcademicYearId() {
886
+ const academicYear = this.getActiveAcademicYear();
887
+ return academicYear?._id || null;
888
+ }
827
889
  /**
828
890
  * Manually refresh state from localStorage
829
891
  */
@@ -2538,6 +2600,8 @@ class CideLytHeaderWrapperComponent {
2538
2600
  this.currentAcademicYear.set(null);
2539
2601
  this.currentFinancialYearName.set('FY');
2540
2602
  this.currentAcademicYearName.set('AY');
2603
+ // Clear active academic year in AppStateService when entity is cleared
2604
+ this.appStateService.setActiveAcademicYear(null);
2541
2605
  }
2542
2606
  });
2543
2607
  });
@@ -3418,8 +3482,41 @@ class CideLytHeaderWrapperComponent {
3418
3482
  iconColor: 'tw-text-green-500'
3419
3483
  };
3420
3484
  }));
3421
- // Set current academic year (first active one or first in list)
3422
- const currentAY = years.find(year => year.acayr_isactive) || years[0];
3485
+ // Get active academic year from AppStateService
3486
+ let currentAY = this.appStateService.getActiveAcademicYearValue();
3487
+ // If not found in AppStateService, find and set it
3488
+ if (!currentAY) {
3489
+ // Find the first active academic year (acayr_isactive: true)
3490
+ currentAY = years.find(year => year.acayr_isactive);
3491
+ // If no active year, find one with acayr_iscurrent: true
3492
+ if (!currentAY) {
3493
+ currentAY = years.find(year => year.acayr_iscurrent === true);
3494
+ }
3495
+ // If still not found, use the first one in the list
3496
+ if (!currentAY && years.length > 0) {
3497
+ currentAY = years[0];
3498
+ }
3499
+ // Set in AppStateService if found
3500
+ if (currentAY) {
3501
+ this.appStateService.setActiveAcademicYear(currentAY);
3502
+ console.log('✅ [HEADER] Set active academic year in AppStateService:', currentAY.acayr_name, currentAY._id);
3503
+ }
3504
+ }
3505
+ else {
3506
+ // Verify the academic year from AppStateService exists in the current list
3507
+ const yearExists = years.find(year => year._id === currentAY._id);
3508
+ if (!yearExists) {
3509
+ // If the stored academic year doesn't exist in the list, find a new one
3510
+ currentAY = years.find(year => year.acayr_isactive) || years.find(year => year.acayr_iscurrent === true) || years[0];
3511
+ if (currentAY) {
3512
+ this.appStateService.setActiveAcademicYear(currentAY);
3513
+ console.log('✅ [HEADER] Updated active academic year in AppStateService (previous one not found):', currentAY.acayr_name, currentAY._id);
3514
+ }
3515
+ }
3516
+ else {
3517
+ console.log('✅ [HEADER] Using active academic year from AppStateService:', currentAY.acayr_name, currentAY._id);
3518
+ }
3519
+ }
3423
3520
  if (currentAY) {
3424
3521
  this.currentAcademicYear.set(currentAY);
3425
3522
  // Set display name with proper fallback
@@ -3436,23 +3533,6 @@ class CideLytHeaderWrapperComponent {
3436
3533
  this.currentAcademicYearName.set('AY');
3437
3534
  }
3438
3535
  }
3439
- else if (years.length > 0) {
3440
- // If no active year, set the first one
3441
- const firstYear = years[0];
3442
- this.currentAcademicYear.set(firstYear);
3443
- const name = firstYear.acayr_name;
3444
- const fromDate = firstYear.acayr_from_date;
3445
- const toDate = firstYear.acayr_to_date;
3446
- if (name) {
3447
- this.currentAcademicYearName.set(name);
3448
- }
3449
- else if (fromDate && toDate) {
3450
- this.currentAcademicYearName.set(`${fromDate} - ${toDate}`);
3451
- }
3452
- else {
3453
- this.currentAcademicYearName.set('AY');
3454
- }
3455
- }
3456
3536
  }
3457
3537
  /**
3458
3538
  * Handle financial year dropdown item clicks
@@ -3485,6 +3565,9 @@ class CideLytHeaderWrapperComponent {
3485
3565
  onAcademicYearClick(item) {
3486
3566
  const selectedYear = this.academicYears().find(year => year._id === item.id);
3487
3567
  if (selectedYear) {
3568
+ // Update AppStateService with the selected academic year
3569
+ this.appStateService.setActiveAcademicYear(selectedYear);
3570
+ console.log('✅ [HEADER] User selected academic year, updated AppStateService:', selectedYear.acayr_name, selectedYear._id);
3488
3571
  this.currentAcademicYear.set(selectedYear);
3489
3572
  // Set display name with proper fallback
3490
3573
  const name = selectedYear.acayr_name;
@@ -3499,7 +3582,6 @@ class CideLytHeaderWrapperComponent {
3499
3582
  else {
3500
3583
  this.currentAcademicYearName.set('AY');
3501
3584
  }
3502
- // TODO: Update app state or notify other components about the change
3503
3585
  }
3504
3586
  }
3505
3587
  /**
@@ -4728,10 +4810,23 @@ class CustomRouteReuseStrategy {
4728
4810
  }
4729
4811
  }
4730
4812
  // Clears all stored routes (useful for cleanup)
4813
+ // This method ensures all component instances are destroyed and removed from DOM
4731
4814
  clearAllStoredRoutes() {
4732
- Object.keys(this.storedRoutes).forEach(pathKey => {
4815
+ const routeKeys = Object.keys(this.storedRoutes);
4816
+ console.log(`🧹 [RouteReuseStrategy] Clearing ${routeKeys.length} stored route(s) to remove components from DOM`);
4817
+ routeKeys.forEach(pathKey => {
4733
4818
  this.clearStoredRoute(pathKey);
4734
4819
  });
4820
+ // Double-check that all routes are cleared
4821
+ const remainingRoutes = Object.keys(this.storedRoutes).length;
4822
+ if (remainingRoutes > 0) {
4823
+ console.warn(`⚠️ [RouteReuseStrategy] ${remainingRoutes} route(s) still remain after clearing. Force clearing...`);
4824
+ // Force clear any remaining routes
4825
+ Object.keys(this.storedRoutes).forEach(pathKey => {
4826
+ delete this.storedRoutes[pathKey];
4827
+ });
4828
+ }
4829
+ console.log(`✅ [RouteReuseStrategy] All stored routes cleared. Components should be removed from DOM.`);
4735
4830
  }
4736
4831
  // Gets the count of stored routes (useful for debugging)
4737
4832
  getStoredRoutesCount() {
@@ -5083,7 +5178,8 @@ class CideLytRequestService {
5083
5178
  // Clear sidedrawer as no tabs are open
5084
5179
  this.sidedrawerService.updateDrawerItems(undefined);
5085
5180
  // Redirect to home screen when all tabs are closed
5086
- this.router.navigate(['/control-panel']);
5181
+ // Use replaceUrl to prevent back navigation to closed tabs and ensure clean state
5182
+ this.router.navigate(['/control-panel'], { replaceUrl: true });
5087
5183
  }
5088
5184
  this.tabsSignal.set(newTabs);
5089
5185
  // Request wrapper visibility is now controlled by layout configuration
@@ -5092,6 +5188,10 @@ class CideLytRequestService {
5092
5188
  /**
5093
5189
  * Close all tabs and navigate to home
5094
5190
  * This is used when entity changes to ensure all components are destroyed and refreshed
5191
+ * IMPORTANT: This method ensures all tab components are removed from DOM by:
5192
+ * 1. Clearing all stored routes from route reuse strategy (destroys component instances)
5193
+ * 2. Clearing all tabs from TabStateService
5194
+ * 3. Navigating to home to clear router outlet
5095
5195
  */
5096
5196
  closeAllTabs() {
5097
5197
  console.log('🧹 REQUEST SERVICE: Closing all tabs due to entity change');
@@ -5099,35 +5199,26 @@ class CideLytRequestService {
5099
5199
  // Close all floating containers first
5100
5200
  this.floatingContainerService.hideAll();
5101
5201
  console.log('🧹 REQUEST SERVICE: Closed all floating containers');
5102
- // Clear all tabs from TabStateService
5202
+ // Clear all tabs from TabStateService first
5103
5203
  currentTabs.forEach(tab => {
5104
5204
  this.tabStateService.removeTab(tab.id);
5105
- // Clear stored routes from route reuse strategy
5106
- if (this.routeReuseStrategy instanceof CustomRouteReuseStrategy) {
5107
- let pathKey = tab.route.startsWith('/') ? tab.route.substring(1) : tab.route;
5108
- if (tab.params && Object.keys(tab.params).length > 0) {
5109
- const queryParamsString = Object.keys(tab.params)
5110
- .sort()
5111
- .map(key => `${key}=${tab.params[key]}`)
5112
- .join('&');
5113
- pathKey += '?' + queryParamsString;
5114
- }
5115
- this.routeReuseStrategy.clearStoredRoute(pathKey);
5116
- // Also clear without query params
5117
- const pathKeyWithoutParams = tab.route.startsWith('/') ? tab.route.substring(1) : tab.route;
5118
- if (pathKeyWithoutParams !== pathKey) {
5119
- this.routeReuseStrategy.clearStoredRoute(pathKeyWithoutParams);
5120
- }
5121
- }
5122
5205
  });
5123
- // Clear all tabs
5206
+ // Clear ALL stored routes from route reuse strategy
5207
+ // This ensures all component instances are destroyed and removed from DOM
5208
+ if (this.routeReuseStrategy instanceof CustomRouteReuseStrategy) {
5209
+ console.log('🧹 REQUEST SERVICE: Clearing all stored routes to remove components from DOM');
5210
+ this.routeReuseStrategy.clearAllStoredRoutes();
5211
+ console.log('✅ REQUEST SERVICE: All stored routes cleared, components destroyed');
5212
+ }
5213
+ // Clear all tabs from signals
5124
5214
  this.tabsSignal.set([]);
5125
5215
  this.activeTabIdSignal.set(null);
5126
5216
  this.tabStateService.setActiveTab(null);
5127
5217
  // Clear sidedrawer
5128
5218
  this.sidedrawerService.updateDrawerItems(undefined);
5129
- // Navigate to home
5130
- this.router.navigate(['/control-panel']);
5219
+ // Navigate to home - this ensures router outlet is cleared and any remaining components are removed
5220
+ // Use replaceUrl to prevent back navigation to closed tabs
5221
+ this.router.navigate(['/control-panel'], { replaceUrl: true });
5131
5222
  console.log('✅ REQUEST SERVICE: All tabs and floating containers closed, navigated to home');
5132
5223
  }
5133
5224
  // Hide Request
@@ -5282,8 +5373,8 @@ class CideLytSidedrawerWrapperComponent {
5282
5373
  }
5283
5374
  ngOnInit() {
5284
5375
  // Initialize the component map (You'd likely populate this from a config or service)
5285
- this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-ByfmdVwA.mjs').then(m => m.CideLytSidedrawerNotesComponent);
5286
- this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-hlIFgjX_.mjs').then(m => m.CideLytDrawerThemeComponent);
5376
+ this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-BuDfM6ms.mjs').then(m => m.CideLytSidedrawerNotesComponent);
5377
+ this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-D4qmt25K.mjs').then(m => m.CideLytDrawerThemeComponent);
5287
5378
  }
5288
5379
  async loadComponent(configFor) {
5289
5380
  console.log('🔍 SIDEDRAWER - Loading component:', configFor, 'Current tab:', this.currentTabId);
@@ -6975,7 +7066,7 @@ const layoutControlPannelChildRoutes = [{
6975
7066
  },
6976
7067
  {
6977
7068
  path: "home",
6978
- loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-TsEnFYa4.mjs').then(c => c.CideLytHomeWrapperComponent),
7069
+ loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-DeR1T21C.mjs').then(c => c.CideLytHomeWrapperComponent),
6979
7070
  canActivate: [authGuard],
6980
7071
  data: {
6981
7072
  sypg_page_code: "cide_lyt_home" // Used by RequestService to fetch tab properties
@@ -6983,7 +7074,7 @@ const layoutControlPannelChildRoutes = [{
6983
7074
  },
6984
7075
  {
6985
7076
  path: "dashboard-manager",
6986
- loadComponent: () => import('./cloud-ide-layout-dashboard-manager.component-asEb-RqK.mjs').then(c => c.DashboardManagerComponent),
7077
+ loadComponent: () => import('./cloud-ide-layout-dashboard-manager.component-DWxN9ReS.mjs').then(c => c.DashboardManagerComponent),
6987
7078
  canActivate: [authGuard],
6988
7079
  data: {
6989
7080
  sypg_page_code: "cide_lyt_dashboard_manager"
@@ -8807,4 +8898,4 @@ var floatingEntitySelection_component = /*#__PURE__*/Object.freeze({
8807
8898
  */
8808
8899
 
8809
8900
  export { AppStateHelperService as A, CideLytSharedWrapperComponent as C, ENVIRONMENT_CONFIG as E, NotificationSettingsService as N, RightsService as R, CideLytSidebarService as a, CideLytSidedrawerService as b, CideLytThemeService as c, CloudIdeLayoutService as d, CloudIdeLayoutComponent as e, CideLytSharedService as f, ComponentContextService as g, layoutControlPannelChildRoutes as h, CustomRouteReuseStrategy as i, AppStateService as j, CideLytUserStatusService as k, layoutRoutes as l, CacheManagerService as m, CideLytFileManagerService as n, CideLytFloatingEntityRightsSharingComponent as o, processThemeVariable as p, CideLytFloatingEntityRightsSharingService as q, CideLytFloatingEntitySelectionComponent as r, setCSSVariable as s, themeFactory as t, CideLytFloatingEntitySelectionService as u };
8810
- //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-CC-eJdik.mjs.map
8901
+ //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-BlLjLM3N.mjs.map