@arsedizioni/ars-utils 18.2.403 → 18.2.406

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.
@@ -1500,11 +1500,17 @@ class ClipperReferencesComponent extends ClipperSearchResultManager {
1500
1500
  this.title += " - " + this.dialogData.anchorTitle;
1501
1501
  }
1502
1502
  // Use service snapshot
1503
- this.prepareParams();
1504
1503
  this.snapshot = this.clipperService.referencesSnapshot() ?? { searchParams: new ClipperSearchParams(), interval: "-1" };
1505
1504
  if (this.filterParams.mode !== this.dialogData.mode ||
1506
1505
  this.filterParams.id !== this.dialogData.documentId ||
1507
1506
  this.filterParams.anchor !== this.dialogData.anchor) {
1507
+ this.filterParams = new ClipperSearchParams();
1508
+ this.filterParams.mode = this.dialogData.mode;
1509
+ this.filterParams.model = this.dialogData.model;
1510
+ this.filterParams.anchor = this.dialogData.anchor;
1511
+ this.filterParams.id = this.dialogData.documentId;
1512
+ this.filterParams.useModifierInfo = this.dialogData.mode === ClipperQueryReferencesMode.ChangesOut;
1513
+ this.filterParams.returnModifierInfo = this.dialogData.mode !== ClipperQueryReferencesMode.ChangesOut;
1508
1514
  this.clipperService.referencesSnapshot.set(this.snapshot);
1509
1515
  }
1510
1516
  }
@@ -1625,24 +1631,12 @@ class ClipperReferencesComponent extends ClipperSearchResultManager {
1625
1631
  this.sendItemsTo(item ? [item] : this.selection?.all);
1626
1632
  }
1627
1633
  /**
1628
- * Prepare params
1629
- */
1630
- prepareParams() {
1631
- this.filterParams = new ClipperSearchParams();
1632
- this.filterParams.mode = this.dialogData.mode;
1633
- this.filterParams.model = this.dialogData.model;
1634
- this.filterParams.anchor = this.dialogData.anchor;
1635
- this.filterParams.id = this.dialogData.documentId;
1636
- this.filterParams.useModifierInfo = this.dialogData.mode === ClipperQueryReferencesMode.ChangesOut;
1637
- this.filterParams.returnModifierInfo = this.dialogData.mode !== ClipperQueryReferencesMode.ChangesOut;
1638
- }
1639
- /**
1640
- * Prepare teh search params
1634
+ * Prepare the search params
1641
1635
  * @param newSearch : true if it is a new search
1642
1636
  * @return the new search params
1643
1637
  */
1644
1638
  prepareFetch(newSearch = false) {
1645
- const newParams = this.filterParams;
1639
+ const newParams = SystemUtils.clone(this.filterParams);
1646
1640
  newParams.count = 15;
1647
1641
  newParams.useModifierInfo =
1648
1642
  newParams.mode === ClipperQueryReferencesMode.ChangesOut;
@@ -1673,6 +1667,28 @@ class ClipperReferencesComponent extends ClipperSearchResultManager {
1673
1667
  }
1674
1668
  return newParams;
1675
1669
  }
1670
+ /**
1671
+ * Get e refrences search params form clipper search params
1672
+ * @param params : the clipper search params
1673
+ * @returns : the references search params
1674
+ */
1675
+ toReferencesSearchParams(params) {
1676
+ return {
1677
+ documentId: params.id,
1678
+ year: params.year,
1679
+ sector: params.sector,
1680
+ author: params.author,
1681
+ anchor: params.anchor,
1682
+ model: params.model?.toString() ?? null,
1683
+ mode: params.mode,
1684
+ excludeTextReferences: params.excludeTextReferences,
1685
+ excludeNotesReferences: params.excludeNotesReferences,
1686
+ returnModifierInfo: params.returnModifierInfo,
1687
+ useModifierInfo: params.useModifierInfo,
1688
+ count: 15,
1689
+ first: 0
1690
+ };
1691
+ }
1676
1692
  /**
1677
1693
  * Perform a search
1678
1694
  * @param newSearch: true if is a new search
@@ -1683,7 +1699,7 @@ class ClipperReferencesComponent extends ClipperSearchResultManager {
1683
1699
  this.dialogService.busy('Ricerca in corso...');
1684
1700
  const searchParams = this.prepareFetch(newSearch);
1685
1701
  if (searchParams) {
1686
- this.clipperService.references(searchParams.toReferencesSearchParams())
1702
+ this.clipperService.references(this.toReferencesSearchParams(searchParams))
1687
1703
  .subscribe({
1688
1704
  next: (r) => {
1689
1705
  if (!r.success)
@@ -1730,7 +1746,7 @@ class ClipperReferencesComponent extends ClipperSearchResultManager {
1730
1746
  return;
1731
1747
  if (!this.snapshot.facets || this.snapshot.facets?.hasMoreFacets) {
1732
1748
  this.filterBusy.set(true);
1733
- this.clipperService.referencesFacets(params.toReferencesSearchParams())
1749
+ this.clipperService.referencesFacets(this.toReferencesSearchParams(params))
1734
1750
  .subscribe({
1735
1751
  next: (r) => {
1736
1752
  if (r.success) {