@acorex/platform 21.0.0-next.46 → 21.0.0-next.47

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.
@@ -30,7 +30,7 @@ import { AXPAuthModule, AXPSessionService, AXPSessionStatus, AXPAuthGuard } from
30
30
  import { AXPRefreshEvent, AXPSettingsService, AXPCommonSettings, AXP_PLATFORM_CONFIG_TOKEN, AXPMenuService, AXPMenuVisibilityService, AXPCommonModule } from '@acorex/platform/common';
31
31
  import * as i1$3 from '@acorex/platform/core';
32
32
  import { AXPDeviceService, AXHighlightService, AXPComponentSlotModule, AXPPlatformScope, AXPBroadcastEventService, AXPContextStore } from '@acorex/platform/core';
33
- import { AXP_CATEGORY_TREE_ROOT_TITLE_I18N_KEY, AXPEntityDefinitionRegistryService, AXPCategoryTreeService, AXPEntityListViewColumnViewModel, restoreEntityListExpandedRows, AXP_ENTITY_CONFIG_TOKEN } from '@acorex/platform/layout/entity';
33
+ import { AXP_CATEGORY_TREE_ROOT_TITLE_I18N_KEY, AXPEntityDefinitionRegistryService, AXPCategoryTreeService, AXPEntityListViewColumnViewModel, getDataSourcePageIndex, restoreEntityListExpandedRows, AXP_ENTITY_CONFIG_TOKEN } from '@acorex/platform/layout/entity';
34
34
  import * as i7$1 from '@acorex/platform/layout/widget-core';
35
35
  import { AXPWidgetCoreModule } from '@acorex/platform/layout/widget-core';
36
36
  import { AXPWidgetsModule } from '@acorex/platform/layout/widgets';
@@ -1273,7 +1273,10 @@ class AXPEntityMasterToolbarViewComponent {
1273
1273
  this.sortQueries = computed(() => this.vm
1274
1274
  .sortedFields()
1275
1275
  .filter((s) => !!s.dir)
1276
- .map((s) => ({ name: s.name, dir: s.dir })), ...(ngDevMode ? [{ debugName: "sortQueries" }] : /* istanbul ignore next */ []));
1276
+ .map((s) => ({
1277
+ name: s.name,
1278
+ dir: s.dir,
1279
+ })), ...(ngDevMode ? [{ debugName: "sortQueries" }] : /* istanbul ignore next */ []));
1277
1280
  this.sortDefinitions = computed(() => this.vm.sortableFields().map((s) => ({
1278
1281
  name: s.name,
1279
1282
  title: s.title,
@@ -1284,6 +1287,7 @@ class AXPEntityMasterToolbarViewComponent {
1284
1287
  // Prefer saved settings (view/columns/sorts/filters) if available, then apply
1285
1288
  await this.loadSettings();
1286
1289
  await this.vm.setView();
1290
+ await this.vm.ensureListPagingResolved();
1287
1291
  this.filtersDefinitions.set(this.vm.filtersDef);
1288
1292
  this.isInitializing = true;
1289
1293
  // this.pendingInitialFilters = true;
@@ -1375,6 +1379,9 @@ class AXPEntityMasterToolbarViewComponent {
1375
1379
  const byKey = new Map(prev.map((c) => [keyOf(c), c]));
1376
1380
  return columns.map((newColumn) => {
1377
1381
  const existing = byKey.get(keyOf(newColumn));
1382
+ if (!existing) {
1383
+ return null;
1384
+ }
1378
1385
  return new AXPEntityListViewColumnViewModel(existing.property, {
1379
1386
  ...existing.column,
1380
1387
  options: {
@@ -1382,7 +1389,7 @@ class AXPEntityMasterToolbarViewComponent {
1382
1389
  visible: newColumn.visible,
1383
1390
  },
1384
1391
  });
1385
- });
1392
+ }).filter((c) => c != null);
1386
1393
  });
1387
1394
  // Persist column order/visibility
1388
1395
  this.vm.onColumnsChanged(this.vm.columns());
@@ -1465,9 +1472,16 @@ class AXPEntityMasterListViewComponent extends AXPPageLayoutBaseComponent {
1465
1472
  this.updateParentHasChildAfterRefresh(refreshTargetId);
1466
1473
  }
1467
1474
  else {
1475
+ if (!resetPagination) {
1476
+ await this.vm.ensureListPagingResolved();
1477
+ this.vm.applyPagingToDataSourceWithoutLoad();
1478
+ }
1468
1479
  this.grid()?.refresh({
1469
1480
  reset: resetPagination,
1470
1481
  });
1482
+ if (!resetPagination) {
1483
+ this.scheduleSyncGridPagerUi();
1484
+ }
1471
1485
  this.scheduleRestoreExpandedRows();
1472
1486
  }
1473
1487
  }
@@ -1533,11 +1547,8 @@ class AXPEntityMasterListViewComponent extends AXPPageLayoutBaseComponent {
1533
1547
  }
1534
1548
  }
1535
1549
  onPageChanged(e) {
1536
- if (e.isUserInteraction) {
1537
- const pageSizeChanged = e.take != this.vm.dataSource.pageSize;
1538
- if (pageSizeChanged) {
1539
- this.vm.saveSettings('pageSize', e.take);
1540
- }
1550
+ if (e.isUserInteraction && !this.vm.skipListPagingPersistence) {
1551
+ this.vm.saveListPaging(e.take, e.skip);
1541
1552
  }
1542
1553
  this.scheduleRestoreExpandedRows();
1543
1554
  }
@@ -1700,6 +1711,35 @@ class AXPEntityMasterListViewComponent extends AXPPageLayoutBaseComponent {
1700
1711
  }
1701
1712
  });
1702
1713
  }
1714
+ scheduleSyncGridPagerUi() {
1715
+ queueMicrotask(() => {
1716
+ this.syncGridPagerUi();
1717
+ });
1718
+ }
1719
+ syncGridPagerUi() {
1720
+ const gridRef = this.grid();
1721
+ if (!gridRef) {
1722
+ return;
1723
+ }
1724
+ const pageIndex = getDataSourcePageIndex(this.vm.dataSource);
1725
+ const take = this.vm.dataSource.config.pageSize;
1726
+ const pagerPage = pageIndex + 1;
1727
+ const grid = gridRef;
1728
+ this.vm.skipListPagingPersistence = true;
1729
+ try {
1730
+ if (grid.page() !== pageIndex) {
1731
+ grid.page.set(pageIndex);
1732
+ }
1733
+ grid.pageSize.set(take);
1734
+ const pager = grid.dataPager;
1735
+ if (pager && pager.value !== pagerPage) {
1736
+ pager.goToPage(pagerPage);
1737
+ }
1738
+ }
1739
+ finally {
1740
+ this.vm.skipListPagingPersistence = false;
1741
+ }
1742
+ }
1703
1743
  scheduleRestoreExpandedRows() {
1704
1744
  if (!this.vm.parentKey() || this.restoreExpandedRowsScheduled) {
1705
1745
  return;