@acorex/platform 21.0.0-next.67 → 21.0.0-next.70

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.
@@ -14,7 +14,7 @@ import { AXDropdownModule } from '@acorex/components/dropdown';
14
14
  import { AXDropdownButtonModule } from '@acorex/components/dropdown-button';
15
15
  import { AXPStickyDirective, AXPHomePageService, AXPCommonSettings, AXPEntityCommandScope, AXPSettingsService } from '@acorex/platform/common';
16
16
  import * as i8 from '@acorex/platform/core';
17
- import { AXPDeviceService, AXPComponentSlotModule, getSmart, getChangedPaths, AXPExpressionEvaluatorService, AXPBroadcastEventService } from '@acorex/platform/core';
17
+ import { AXPDeviceService, AXPComponentSlotModule, getSmart, getChangedPaths, AXPExpressionEvaluatorService, AXPContextStore, AXPBroadcastEventService } from '@acorex/platform/core';
18
18
  import * as i1 from '@acorex/cdk/drawer';
19
19
  import { AXDrawerDirectiveModule, AXDrawerContainerDirective } from '@acorex/cdk/drawer';
20
20
  import { AXDrawerModule } from '@acorex/components/drawer';
@@ -348,6 +348,13 @@ class AXPPageLayoutBaseComponent {
348
348
  //#endregion
349
349
  //#region ---------------- Handle Commands ----------------
350
350
  execute(command) { }
351
+ /**
352
+ * Optional partial context to merge into the create/update wizard when leaving a page step.
353
+ * Override when the page keeps edits in local state instead of the shared form context.
354
+ */
355
+ getWizardStepContext() {
356
+ return null;
357
+ }
351
358
  startSideToggle() {
352
359
  this.layout();
353
360
  }
@@ -1171,6 +1178,7 @@ class AXPPageComponentRendererDirective {
1171
1178
  this.viewContainerRef = inject(ViewContainerRef);
1172
1179
  this.pageComponentRegistry = inject(AXPPageComponentRegistryService);
1173
1180
  this.instanceRegistry = inject(AXPPageComponentInstanceRegistryService);
1181
+ this.contextStore = inject(AXPContextStore);
1174
1182
  this.componentRef = null;
1175
1183
  this.#contextEffect = effect(() => {
1176
1184
  const context = this.rootContext();
@@ -1191,6 +1199,10 @@ class AXPPageComponentRendererDirective {
1191
1199
  }
1192
1200
  }, ...(ngDevMode ? [{ debugName: "#optionsEffect" }] : /* istanbul ignore next */ []));
1193
1201
  }
1202
+ /** Returns the dynamically mounted page component instance, if loaded. */
1203
+ getMountedPageInstance() {
1204
+ return this.componentRef?.instance ?? null;
1205
+ }
1194
1206
  #contextEffect;
1195
1207
  #pageConfigEffect;
1196
1208
  #optionsEffect;
@@ -1199,11 +1211,23 @@ class AXPPageComponentRendererDirective {
1199
1211
  }
1200
1212
  ngOnDestroy() {
1201
1213
  if (this.componentRef) {
1214
+ this.syncWizardStepContextBeforeTeardown();
1202
1215
  this.instanceRegistry.unregister(this.componentKey());
1203
1216
  this.componentRef.destroy();
1204
1217
  this.componentRef = null;
1205
1218
  }
1206
1219
  }
1220
+ /** Persists page edits into the shared form context before the step component is destroyed. */
1221
+ syncWizardStepContextBeforeTeardown() {
1222
+ const instance = this.componentRef?.instance;
1223
+ const partial = instance?.getWizardStepContext?.();
1224
+ if (!partial || typeof partial !== 'object') {
1225
+ return;
1226
+ }
1227
+ for (const [path, value] of Object.entries(partial)) {
1228
+ this.contextStore.update(path, value);
1229
+ }
1230
+ }
1207
1231
  async loadComponent() {
1208
1232
  try {
1209
1233
  // Clear any existing component
@@ -1551,5 +1575,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
1551
1575
  * Generated bundle index. Do not edit.
1552
1576
  */
1553
1577
 
1554
- export { AXPLayoutDetailsViewComponent, AXPLayoutDetailsViewViewModel, AXPPageComponentInstanceRegistryService, AXPPageLayoutBase, AXPPageLayoutBaseComponent, AXPPageLayoutComponent, AXPPopupLayoutBase, AXPPopupLayoutBaseComponent, AXPPopupLayoutComponent };
1578
+ export { AXPLayoutDetailsViewComponent, AXPLayoutDetailsViewViewModel, AXPPageComponentInstanceRegistryService, AXPPageComponentRendererDirective, AXPPageLayoutBase, AXPPageLayoutBaseComponent, AXPPageLayoutComponent, AXPPopupLayoutBase, AXPPopupLayoutBaseComponent, AXPPopupLayoutComponent };
1555
1579
  //# sourceMappingURL=acorex-platform-layout-views.mjs.map