@acorex/platform 21.0.0-next.89 → 21.0.0-next.90

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 (29) hide show
  1. package/fesm2022/acorex-platform-contracts.mjs +1 -0
  2. package/fesm2022/acorex-platform-contracts.mjs.map +1 -1
  3. package/fesm2022/acorex-platform-core.mjs +22 -4
  4. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-layout-components.mjs +1 -1
  6. package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-layout-entity-contracts.mjs.map +1 -1
  8. package/fesm2022/acorex-platform-layout-entity.mjs +93 -8
  9. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  10. package/fesm2022/acorex-platform-layout-views.mjs +73 -14
  11. package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
  12. package/fesm2022/acorex-platform-layout-widget-core.mjs +2 -0
  13. package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
  14. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-edit-popup.component-CZc2zFlg.mjs → acorex-platform-layout-widgets-tabular-data-edit-popup.component-BvFykMTH.mjs} +2 -2
  15. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-edit-popup.component-CZc2zFlg.mjs.map → acorex-platform-layout-widgets-tabular-data-edit-popup.component-BvFykMTH.mjs.map} +1 -1
  16. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-view-popup.component-XWRUVoL4.mjs → acorex-platform-layout-widgets-tabular-data-view-popup.component-CntopmDS.mjs} +2 -2
  17. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-view-popup.component-XWRUVoL4.mjs.map → acorex-platform-layout-widgets-tabular-data-view-popup.component-CntopmDS.mjs.map} +1 -1
  18. package/fesm2022/acorex-platform-layout-widgets.mjs +3 -3
  19. package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
  20. package/fesm2022/acorex-platform-themes-default.mjs +15 -5
  21. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  22. package/package.json +1 -1
  23. package/types/acorex-platform-contracts.d.ts +1 -0
  24. package/types/acorex-platform-core.d.ts +1 -1
  25. package/types/acorex-platform-layout-entity-contracts.d.ts +4 -0
  26. package/types/acorex-platform-layout-entity.d.ts +30 -4
  27. package/types/acorex-platform-layout-views.d.ts +6 -1
  28. package/types/acorex-platform-layout-widget-core.d.ts +6 -0
  29. package/types/acorex-platform-themes-default.d.ts +4 -1
@@ -1051,6 +1051,7 @@ const AXPLayoutDetailsViewViewModel = signalStore(withState(() => {
1051
1051
  evaluatedPageContent,
1052
1052
  evaluatedTabContentsById,
1053
1053
  formDirty: false,
1054
+ pageSelectedRows: [],
1054
1055
  });
1055
1056
  AXPDebugService.instance?.trace(OVERLAY_DETAILS_VIEW_TRACE_NS, 'viewmodel', 'activatePage VM ready (Rendered)', () => ({
1056
1057
  pageId: currentPage?.id,
@@ -1864,6 +1865,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
1864
1865
  }]
1865
1866
  }], propDecorators: { componentKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "componentKey", required: true }] }], rootContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "rootContext", required: false }] }], pageConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageConfig", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], componentReady: [{ type: i0.Output, args: ["componentReady"] }] } });
1866
1867
 
1868
+ /** Registered id of the data-list inside related-entity `page-list` sidebar pages. */
1869
+ const PAGE_LIST_TABLE_WIDGET_ID = 'page-list_table';
1867
1870
  class AXPLayoutDetailsViewComponent extends AXPPageLayoutBaseComponent {
1868
1871
  constructor() {
1869
1872
  super(...arguments);
@@ -1879,6 +1882,8 @@ class AXPLayoutDetailsViewComponent extends AXPPageLayoutBaseComponent {
1879
1882
  this.destroyRef = inject(DestroyRef);
1880
1883
  this.elementRef = inject((ElementRef));
1881
1884
  this.debug = inject(AXPDebugService);
1885
+ /** Cancels in-flight list selection bind when the sidebar page or widget tree changes. */
1886
+ this.pageListSelectionBindGeneration = 0;
1882
1887
  /** Prevents sidebar tab init events from pushing history before the first page activation completes. */
1883
1888
  this.detailsLayoutReady = signal(false, ...(ngDevMode ? [{ debugName: "detailsLayoutReady" }] : /* istanbul ignore next */ []));
1884
1889
  this.destroyed$ = new Subject();
@@ -1922,6 +1927,42 @@ class AXPLayoutDetailsViewComponent extends AXPPageLayoutBaseComponent {
1922
1927
  }
1923
1928
  }));
1924
1929
  }, ...(ngDevMode ? [{ debugName: "#sidebarTabsIndicatorEffect" }] : /* istanbul ignore next */ []));
1930
+ /**
1931
+ * Binds list selection whenever `page-list_table` registers (including after remount).
1932
+ * `find()` / `waitForWidget()` can return a destroyed instance; registration always carries the live widget.
1933
+ */
1934
+ this.#pageListSelectionBindEffect = effect((onCleanup) => {
1935
+ const pageId = this.vm.currentPage()?.id;
1936
+ const isPageReady = this.vm.isPageReady();
1937
+ if (!pageId || this.vm.showPages() || !isPageReady || this.getActivePageComponentKey()) {
1938
+ return;
1939
+ }
1940
+ this.vm.currentPageContent();
1941
+ if (!this.pageHasEntityListWidget()) {
1942
+ return;
1943
+ }
1944
+ const generation = ++this.pageListSelectionBindGeneration;
1945
+ const container = this.widgetContainer();
1946
+ if (!container) {
1947
+ return;
1948
+ }
1949
+ const builder = container.builderService;
1950
+ onCleanup(() => {
1951
+ this.onSelectionChangeSubscription?.unsubscribe();
1952
+ this.onSelectionChangeSubscription = undefined;
1953
+ });
1954
+ const registrationSub = builder.widgetRegistered$.subscribe(({ id, widget }) => {
1955
+ if (id !== PAGE_LIST_TABLE_WIDGET_ID) {
1956
+ return;
1957
+ }
1958
+ this.attachSelectionToListWidget(pageId, generation, widget);
1959
+ });
1960
+ onCleanup(() => registrationSub.unsubscribe());
1961
+ const existing = builder.getWidget(PAGE_LIST_TABLE_WIDGET_ID);
1962
+ if (existing) {
1963
+ untracked(() => this.attachSelectionToListWidget(pageId, generation, existing));
1964
+ }
1965
+ }, ...(ngDevMode ? [{ debugName: "#pageListSelectionBindEffect" }] : /* istanbul ignore next */ []));
1925
1966
  /** Clears the page overlay reactively once VM + widget hydration are both idle. */
1926
1967
  this.#overlayReleaseEffect = effect(() => {
1927
1968
  const showPages = this.vm.showPages();
@@ -2152,6 +2193,11 @@ class AXPLayoutDetailsViewComponent extends AXPPageLayoutBaseComponent {
2152
2193
  }
2153
2194
  /** Syncs the line indicator when the active page changes programmatically. */
2154
2195
  #sidebarTabsIndicatorEffect;
2196
+ /**
2197
+ * Binds list selection whenever `page-list_table` registers (including after remount).
2198
+ * `find()` / `waitForWidget()` can return a destroyed instance; registration always carries the live widget.
2199
+ */
2200
+ #pageListSelectionBindEffect;
2155
2201
  /** Clears the page overlay reactively once VM + widget hydration are both idle. */
2156
2202
  #overlayReleaseEffect;
2157
2203
  isSaveDiscardFooterAction(action) {
@@ -2251,18 +2297,6 @@ class AXPLayoutDetailsViewComponent extends AXPPageLayoutBaseComponent {
2251
2297
  }
2252
2298
  await this.vm.goToListPage();
2253
2299
  }
2254
- async ngAfterViewInit() {
2255
- const listWidget = (await this.widgetContainer()?.find('page-list_table'));
2256
- if (listWidget?.api && typeof listWidget.api === 'function') {
2257
- const onSelectionChange = listWidget.api()['onSelectionChange'];
2258
- if (onSelectionChange) {
2259
- this.onSelectionChangeSubscription = onSelectionChange.subscribe((e) => {
2260
- this.vm.updatePageSelectedRows(e);
2261
- this.recompute();
2262
- });
2263
- }
2264
- }
2265
- }
2266
2300
  ngOnDestroy() {
2267
2301
  this.onSelectionChangeSubscription?.unsubscribe();
2268
2302
  ++this.keyboardShortcutRegistrationGeneration;
@@ -2289,6 +2323,30 @@ class AXPLayoutDetailsViewComponent extends AXPPageLayoutBaseComponent {
2289
2323
  this.footerPrimaryActions.set(footerPrimaryActions);
2290
2324
  this.footerSecondaryActions.set(footerSecondaryActions);
2291
2325
  }
2326
+ /** Whether the active page hosts a related-entity list (`page-list` widget). */
2327
+ pageHasEntityListWidget() {
2328
+ return this.vm.currentPageContent().some((item) => {
2329
+ if ('type' in item && item.type === 'component') {
2330
+ return false;
2331
+ }
2332
+ return item.name === 'page-list';
2333
+ });
2334
+ }
2335
+ /** Subscribes to the live data-list selection stream for Selected-scope header actions. */
2336
+ attachSelectionToListWidget(pageId, generation, widget) {
2337
+ if (generation !== this.pageListSelectionBindGeneration || this.vm.currentPage()?.id !== pageId) {
2338
+ return;
2339
+ }
2340
+ const selectionStream = widget.api()['onSelectionChange'];
2341
+ if (!selectionStream || typeof selectionStream.subscribe !== 'function') {
2342
+ return;
2343
+ }
2344
+ this.onSelectionChangeSubscription?.unsubscribe();
2345
+ this.onSelectionChangeSubscription = selectionStream.subscribe((rows) => {
2346
+ this.vm.updatePageSelectedRows(rows);
2347
+ this.recompute();
2348
+ });
2349
+ }
2292
2350
  handleOnContextChanged(e) {
2293
2351
  if (!this.vm.currentPage()?.isReadonly &&
2294
2352
  !this.getActivePageComponentKey() &&
@@ -2645,10 +2703,11 @@ class AXPLayoutDetailsViewComponent extends AXPPageLayoutBaseComponent {
2645
2703
  return 'type' in item && item.type === 'component';
2646
2704
  }
2647
2705
  pageContentTrackKey(item, index) {
2706
+ const pageId = this.vm.currentPage()?.id ?? 'unknown';
2648
2707
  if (AXPLayoutDetailsViewComponent.isComponentPageContent(item)) {
2649
- return `component:${item.componentKey}`;
2708
+ return `${pageId}:component:${item.componentKey}`;
2650
2709
  }
2651
- return item.name ?? `widget:${index}`;
2710
+ return `${pageId}:${item.name ?? `widget:${index}`}`;
2652
2711
  }
2653
2712
  /** Whether the active component-based entity page has unsaved edits. */
2654
2713
  isActivePageComponentDirty() {