ngx-wapp-components 3.4.1-alpha.3 → 3.4.1-alpha.4

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/README.md CHANGED
@@ -26,8 +26,14 @@ The default is `1`; only positive integers are accepted. With
26
26
  `[rowsPerPage]="10"`, page 3 emits the initial `queryElements` request with
27
27
  `first: 20` and `rows: 10`.
28
28
 
29
- Pagination saved in session for the tenant and table `id` takes priority,
30
- including its saved page size. Use a stable, unique `id` for each table.
29
+ Pagination saved in session for the tenant and table configuration's
30
+ `identificator` takes priority, including its saved page size.
31
+ `SessionStorageService` saves the key and pagination `id` as
32
+ `table-paginator_[identificator]` to separate pagination from filter-panel keys.
33
+ Pass the unprefixed identifier to `setTablePaginationQuery`,
34
+ `getStoredPagination` and the table's `setStoredTablePagination` method.
35
+ Old unprefixed pagination is not restored because those keys may belong to
36
+ another component. Tables with the same `identificator` still share pagination.
31
37
  `initialPage` is applied only on initialization, not on subsequent page,
32
38
  sort or filter changes. Choose a page that exists in the result set.
33
39
 
@@ -1536,6 +1536,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
1536
1536
  class SessionStorageService {
1537
1537
  constructor() {
1538
1538
  this.businessData = "businessData";
1539
+ this.tablePaginationPrefix = "table-paginator_";
1539
1540
  }
1540
1541
  setComponentsTenantStorage(tenantId, tenantStorage) {
1541
1542
  sessionStorage.setItem(tenantId, JSON.stringify(tenantStorage));
@@ -1579,21 +1580,25 @@ class SessionStorageService {
1579
1580
  }
1580
1581
  setTablePaginationQuery(tenantId, storeablePagination) {
1581
1582
  if (storeablePagination != undefined) {
1583
+ const pagination = {
1584
+ ...storeablePagination,
1585
+ id: `${this.tablePaginationPrefix}${storeablePagination.id}`
1586
+ };
1582
1587
  let allFilters = this.getAllLastFilterPanelQueries(tenantId);
1583
1588
  if (allFilters) {
1584
- allFilters[storeablePagination.id] = storeablePagination;
1589
+ allFilters[pagination.id] = pagination;
1585
1590
  sessionStorage.setItem(tenantId, JSON.stringify(allFilters));
1586
1591
  }
1587
1592
  else {
1588
1593
  let tenantStorage = {
1589
- [storeablePagination.id]: storeablePagination
1594
+ [pagination.id]: pagination
1590
1595
  };
1591
1596
  sessionStorage.setItem(tenantId, JSON.stringify(tenantStorage));
1592
1597
  }
1593
1598
  }
1594
1599
  }
1595
1600
  getStoredPagination(tenantId, filterId) {
1596
- return this.getTenantStoragePaginators(tenantId)?.[filterId];
1601
+ return this.getTenantStoragePaginators(tenantId)?.[`${this.tablePaginationPrefix}${filterId}`];
1597
1602
  }
1598
1603
  getTenantStoragePaginators(tenantId) {
1599
1604
  return JSON.parse(sessionStorage.getItem(tenantId));