@arsedizioni/ars-utils 22.5.15 → 22.5.17

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 (25) hide show
  1. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +82 -23
  2. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
  3. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +47 -0
  4. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
  5. package/fesm2022/arsedizioni-ars-utils-core.validators.mjs +115 -1
  6. package/fesm2022/arsedizioni-ars-utils-core.validators.mjs.map +1 -1
  7. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +77 -22
  8. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -1
  9. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs +116 -49
  10. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs.map +1 -1
  11. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs +34 -13
  12. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs.map +1 -1
  13. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs +149 -48
  14. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs.map +1 -1
  15. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs +58 -44
  16. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs.map +1 -1
  17. package/package.json +1 -1
  18. package/types/arsedizioni-ars-utils-clipper.common.d.ts +42 -10
  19. package/types/arsedizioni-ars-utils-clipper.ui.d.ts +32 -0
  20. package/types/arsedizioni-ars-utils-core.validators.d.ts +52 -1
  21. package/types/arsedizioni-ars-utils-evolution.common.d.ts +39 -11
  22. package/types/arsedizioni-ars-utils-ui.dialogs.auth.d.ts +37 -9
  23. package/types/arsedizioni-ars-utils-ui.dialogs.d.ts +29 -21
  24. package/types/arsedizioni-ars-utils-ui.dialogs.prompt.d.ts +56 -7
  25. package/types/arsedizioni-ars-utils-ui.dialogs.select.d.ts +13 -4
@@ -1546,6 +1546,51 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1546
1546
  }
1547
1547
  this.documentUtils.openDocument(documentId, query, queryChunks, this.selectionMode(), undefined, this.themeService.getTheme(), this.canHandleTooManyResults());
1548
1548
  }
1549
+ /**
1550
+ * Freezes the parameters that produced the result set currently on screen. Paging and
1551
+ * re-sorting must run against this copy, never against `filterParams`, which is bound to the
1552
+ * filter pane and may hold edits the user has not applied yet.
1553
+ * @param params - The parameters actually sent to the server for the current result set.
1554
+ */
1555
+ setActiveParams(params) {
1556
+ this.activeParams = SystemUtils.clone(params);
1557
+ }
1558
+ /**
1559
+ * Returns a working copy of the parameters that produced the result set currently on screen.
1560
+ * @returns A clone of the active parameters, or `undefined` when no search has run yet.
1561
+ */
1562
+ getActiveParams() {
1563
+ return this.activeParams ? SystemUtils.clone(this.activeParams) : undefined;
1564
+ }
1565
+ /**
1566
+ * Builds the parameters needed to load a different page of the result set currently on screen.
1567
+ * @param pageIndex - The zero-based index of the requested page.
1568
+ * @returns A clone of the active parameters with the paging offset moved to `pageIndex`, or
1569
+ * `undefined` when no search has run yet.
1570
+ */
1571
+ getPageParams(pageIndex) {
1572
+ const params = this.getActiveParams();
1573
+ if (!params)
1574
+ return undefined;
1575
+ params.count = params.count ?? 15;
1576
+ params.first = pageIndex * params.count;
1577
+ return params;
1578
+ }
1579
+ /**
1580
+ * Revives the date properties of a set of search parameters read back from storage, where JSON
1581
+ * serialisation has turned them into strings.
1582
+ * @param params - The deserialised parameters, or `undefined` when the stored state predates them.
1583
+ * @returns The same instance with its date properties converted back to `Date`, or `undefined`.
1584
+ */
1585
+ reviveParamsDates(params) {
1586
+ if (!params)
1587
+ return undefined;
1588
+ params.fromDate = SystemUtils.toLocalDate(params.fromDate);
1589
+ params.toDate = SystemUtils.toLocalDate(params.toDate);
1590
+ params.sourceFromDate = SystemUtils.toLocalDate(params.sourceFromDate);
1591
+ params.sourceToDate = SystemUtils.toLocalDate(params.sourceToDate);
1592
+ return params;
1593
+ }
1549
1594
  ///
1550
1595
  // Restorable
1551
1596
  ///
@@ -1564,6 +1609,7 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1564
1609
  },
1565
1610
  facets: this.facets()?.save(),
1566
1611
  filterParams: this.filterParams,
1612
+ activeParams: this.activeParams,
1567
1613
  scroll: this.scrollPos,
1568
1614
  sort: { mode: this.sortMode(), options: this.sortOptions() },
1569
1615
  data: this.snapshot
@@ -1583,6 +1629,7 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1583
1629
  const data = JSON.parse(value);
1584
1630
  if (data) {
1585
1631
  this.filterParams = data.filterParams;
1632
+ this.activeParams = this.reviveParamsDates(data.activeParams);
1586
1633
  const modules = SystemUtils.clone(this.filterParams.modules);
1587
1634
  const sectors = SystemUtils.clone(this.filterParams.sectors);
1588
1635
  const authors = SystemUtils.clone(this.filterParams.authors);