oip-common 0.0.37 → 0.0.38
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.
- package/fesm2022/oip-common.mjs +26 -2
- package/fesm2022/oip-common.mjs.map +1 -1
- package/index.d.ts +8 -0
- package/package.json +1 -1
package/fesm2022/oip-common.mjs
CHANGED
|
@@ -565,6 +565,9 @@ class BaseModuleComponent {
|
|
|
565
565
|
if (localStorageSettingsString != null) {
|
|
566
566
|
this.localSettings.set(JSON.parse(localStorageSettingsString));
|
|
567
567
|
}
|
|
568
|
+
else {
|
|
569
|
+
this.localSettings.set({});
|
|
570
|
+
}
|
|
568
571
|
}
|
|
569
572
|
catch (error) {
|
|
570
573
|
this.msgService.error(error, 'Error parsing layoutConfig:');
|
|
@@ -596,6 +599,8 @@ class BaseModuleComponent {
|
|
|
596
599
|
* Initializes the component and subscribes to local settings updates.
|
|
597
600
|
*/
|
|
598
601
|
constructor() {
|
|
602
|
+
this.isInitialized = false;
|
|
603
|
+
this.moduleInstanceReloadPromise = Promise.resolve();
|
|
599
604
|
/**
|
|
600
605
|
* Provide access to app settings
|
|
601
606
|
*/
|
|
@@ -681,8 +686,14 @@ class BaseModuleComponent {
|
|
|
681
686
|
this.controller = url[0].path;
|
|
682
687
|
}));
|
|
683
688
|
this.subscriptions.push(this.route.paramMap.subscribe((params) => {
|
|
684
|
-
|
|
689
|
+
const routeId = params.get('id');
|
|
690
|
+
const nextId = routeId != null ? +routeId : undefined;
|
|
691
|
+
const idChanged = this.id !== nextId;
|
|
692
|
+
this.id = nextId;
|
|
685
693
|
this.getLocalStorageSettings();
|
|
694
|
+
if (this.isInitialized && idChanged) {
|
|
695
|
+
void this.reloadModuleInstance();
|
|
696
|
+
}
|
|
686
697
|
}));
|
|
687
698
|
}
|
|
688
699
|
/**
|
|
@@ -710,7 +721,8 @@ class BaseModuleComponent {
|
|
|
710
721
|
}));
|
|
711
722
|
this.topBarService.setTopBarItems(this.topBarItems);
|
|
712
723
|
this.topBarService.activeId = this.topBarItems[0].id;
|
|
713
|
-
|
|
724
|
+
this.isInitialized = true;
|
|
725
|
+
await this.reloadModuleInstance();
|
|
714
726
|
this.subscriptions.push(this.appTitleService.title$.subscribe((title) => {
|
|
715
727
|
this.title = title;
|
|
716
728
|
this.changeDetectorRef.detectChanges();
|
|
@@ -746,6 +758,18 @@ class BaseModuleComponent {
|
|
|
746
758
|
this.msgService.error(error);
|
|
747
759
|
});
|
|
748
760
|
}
|
|
761
|
+
/**
|
|
762
|
+
* Called whenever the module instance changes, including the first load.
|
|
763
|
+
* Derived components can override this to refresh module-specific data.
|
|
764
|
+
*/
|
|
765
|
+
async onModuleInstanceChange() { }
|
|
766
|
+
async reloadModuleInstance() {
|
|
767
|
+
this.moduleInstanceReloadPromise = this.moduleInstanceReloadPromise.then(async () => {
|
|
768
|
+
await this.getSettings();
|
|
769
|
+
await this.onModuleInstanceChange();
|
|
770
|
+
});
|
|
771
|
+
await this.moduleInstanceReloadPromise;
|
|
772
|
+
}
|
|
749
773
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BaseModuleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
750
774
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: BaseModuleComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: '', isInline: true }); }
|
|
751
775
|
}
|