@arsedizioni/ars-utils 19.0.6 → 19.0.8

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,6 +12,7 @@ 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>;
15
16
  protected unsubscribe: Subject<void>;
16
17
  protected changeDetector: ChangeDetectorRef;
17
18
  protected breakpointObserver: BreakpointObserver;
@@ -149,14 +150,6 @@ export declare class ClipperSearchResultManager extends ClipperDocumentManager i
149
150
  * @param query: the current query or null
150
151
  */
151
152
  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
- * @param paginator : the paginator.
158
- */
159
- save(id: string, scroll: number, storage: Storage, paginator: MatPaginator | null): void;
160
153
  /**
161
154
  * Restore data
162
155
  * @param id : the restorable id
@@ -164,5 +157,5 @@ export declare class ClipperSearchResultManager extends ClipperDocumentManager i
164
157
  */
165
158
  restore(id: string, storage?: Storage): void;
166
159
  static ɵfac: i0.ɵɵFactoryDeclaration<ClipperSearchResultManager, never>;
167
- static ɵcmp: i0.ɵɵComponentDeclaration<ClipperSearchResultManager, "ng-component", never, {}, {}, never, never, true, never>;
160
+ static ɵcmp: i0.ɵɵComponentDeclaration<ClipperSearchResultManager, "ng-component", never, {}, { "saving": "saving"; }, never, never, true, never>;
168
161
  }
@@ -1031,6 +1031,7 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1031
1031
  this.paginator = viewChild.required('paginator');
1032
1032
  this.facets = viewChild.required('facets');
1033
1033
  this.calendar = viewChild.required('calendar');
1034
+ this.saving = output();
1034
1035
  this.unsubscribe = new Subject();
1035
1036
  this.changeDetector = inject(ChangeDetectorRef);
1036
1037
  this.breakpointObserver = inject(BreakpointObserver);
@@ -1054,6 +1055,23 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1054
1055
  };
1055
1056
  }
1056
1057
  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
+ }
1057
1075
  this.unsubscribe.next();
1058
1076
  this.unsubscribe.complete();
1059
1077
  }
@@ -1459,29 +1477,6 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1459
1477
  ///
1460
1478
  // Restorable
1461
1479
  ///
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
- * @param paginator : the paginator.
1468
- */
1469
- save(id, scroll = 0, storage = sessionStorage, paginator) {
1470
- storage.setItem(id, JSON.stringify({
1471
- paginator: {
1472
- page: paginator?.pageIndex ?? 0,
1473
- total: this.snapshot?.total ?? 0,
1474
- size: paginator?.pageSize ?? 15
1475
- },
1476
- facets: this.facets()?.save(),
1477
- filterParams: this.filterParams,
1478
- scroll: scroll,
1479
- sort: { mode: this.sortMode, options: this.sortOptions },
1480
- data: this.snapshot
1481
- ? { items: this.snapshot.items, total: this.snapshot.total }
1482
- : null
1483
- }));
1484
- }
1485
1480
  /**
1486
1481
  * Restore data
1487
1482
  * @param id : the restorable id
@@ -1530,7 +1525,7 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1530
1525
  }
1531
1526
  }
1532
1527
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ClipperSearchResultManager, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1533
- 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 }); }
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 }); }
1534
1529
  }
1535
1530
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ClipperSearchResultManager, decorators: [{
1536
1531
  type: Component,