@arsedizioni/ars-utils 19.0.8 → 19.0.10

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.
@@ -12,7 +12,6 @@ export declare class ClipperSearchResultManager extends ClipperDocumentManager i
12
12
  readonly paginator: import("@angular/core").Signal<MatPaginator>;
13
13
  readonly facets: import("@angular/core").Signal<ClipperSearchFacetsComponent>;
14
14
  readonly calendar: import("@angular/core").Signal<ClipperSearchCalendarComponent>;
15
- readonly saving: import("@angular/core").OutputEmitterRef<any>;
16
15
  protected unsubscribe: Subject<void>;
17
16
  protected changeDetector: ChangeDetectorRef;
18
17
  protected breakpointObserver: BreakpointObserver;
@@ -150,6 +149,13 @@ export declare class ClipperSearchResultManager extends ClipperDocumentManager i
150
149
  * @param query: the current query or null
151
150
  */
152
151
  openDocument(documentId: string, query?: string | null | undefined): void;
152
+ /**
153
+ * Save restorable data
154
+ * @param id : the restorable id
155
+ * @param scroll : the current scroll position
156
+ * @param storage : the storage to use. Default si session storage.
157
+ */
158
+ save(id: string, scroll?: number, storage?: Storage): void;
153
159
  /**
154
160
  * Restore data
155
161
  * @param id : the restorable id
@@ -157,5 +163,5 @@ export declare class ClipperSearchResultManager extends ClipperDocumentManager i
157
163
  */
158
164
  restore(id: string, storage?: Storage): void;
159
165
  static ɵfac: i0.ɵɵFactoryDeclaration<ClipperSearchResultManager, never>;
160
- static ɵcmp: i0.ɵɵComponentDeclaration<ClipperSearchResultManager, "ng-component", never, {}, { "saving": "saving"; }, never, never, true, never>;
166
+ static ɵcmp: i0.ɵɵComponentDeclaration<ClipperSearchResultManager, "ng-component", never, {}, {}, never, never, true, never>;
161
167
  }
@@ -1028,10 +1028,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
1028
1028
  class ClipperSearchResultManager extends ClipperDocumentManager {
1029
1029
  constructor() {
1030
1030
  super(...arguments);
1031
- this.paginator = viewChild.required('paginator');
1032
- this.facets = viewChild.required('facets');
1033
- this.calendar = viewChild.required('calendar');
1034
- this.saving = output();
1031
+ this.paginator = viewChild('paginator');
1032
+ this.facets = viewChild('facets');
1033
+ this.calendar = viewChild('calendar');
1035
1034
  this.unsubscribe = new Subject();
1036
1035
  this.changeDetector = inject(ChangeDetectorRef);
1037
1036
  this.breakpointObserver = inject(BreakpointObserver);
@@ -1055,23 +1054,6 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1055
1054
  };
1056
1055
  }
1057
1056
  ngOnDestroy() {
1058
- if (this.saving) {
1059
- var data = JSON.stringify({
1060
- paginator: {
1061
- page: this.paginator()?.pageIndex,
1062
- total: this.snapshot?.total ?? 0,
1063
- size: this.paginator()?.pageSize
1064
- },
1065
- facets: this.facets()?.save(),
1066
- filterParams: this.filterParams,
1067
- scroll: 0,
1068
- sort: { mode: this.sortMode, options: this.sortOptions },
1069
- data: this.snapshot
1070
- ? { items: this.snapshot.items, total: this.snapshot.total }
1071
- : null
1072
- });
1073
- this.saving.emit(data);
1074
- }
1075
1057
  this.unsubscribe.next();
1076
1058
  this.unsubscribe.complete();
1077
1059
  }
@@ -1477,6 +1459,28 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1477
1459
  ///
1478
1460
  // Restorable
1479
1461
  ///
1462
+ /**
1463
+ * Save restorable data
1464
+ * @param id : the restorable id
1465
+ * @param scroll : the current scroll position
1466
+ * @param storage : the storage to use. Default si session storage.
1467
+ */
1468
+ save(id, scroll = 0, storage = sessionStorage) {
1469
+ storage.setItem(id, JSON.stringify({
1470
+ paginator: {
1471
+ page: this.paginator()?.pageIndex ?? 0,
1472
+ total: this.snapshot?.total ?? 0,
1473
+ size: this.paginator()?.pageSize ?? 15
1474
+ },
1475
+ facets: this.facets()?.save(),
1476
+ filterParams: this.filterParams,
1477
+ scroll: scroll,
1478
+ sort: { mode: this.sortMode, options: this.sortOptions },
1479
+ data: this.snapshot
1480
+ ? { items: this.snapshot.items, total: this.snapshot.total }
1481
+ : null
1482
+ }));
1483
+ }
1480
1484
  /**
1481
1485
  * Restore data
1482
1486
  * @param id : the restorable id
@@ -1525,7 +1529,7 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1525
1529
  }
1526
1530
  }
1527
1531
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ClipperSearchResultManager, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1528
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.0", type: ClipperSearchResultManager, isStandalone: true, selector: "ng-component", outputs: { saving: "saving" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: ["paginator"], descendants: true, isSignal: true }, { propertyName: "facets", first: true, predicate: ["facets"], descendants: true, isSignal: true }, { propertyName: "calendar", first: true, predicate: ["calendar"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: '<div></div>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1532
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.0", type: ClipperSearchResultManager, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "paginator", first: true, predicate: ["paginator"], descendants: true, isSignal: true }, { propertyName: "facets", first: true, predicate: ["facets"], descendants: true, isSignal: true }, { propertyName: "calendar", first: true, predicate: ["calendar"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: '<div></div>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1529
1533
  }
1530
1534
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ClipperSearchResultManager, decorators: [{
1531
1535
  type: Component,