@arsedizioni/ars-utils 19.0.7 → 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,15 +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 pageIndex : the page index. Default is 0.
158
- * @param pageSize : the page size. Default is 15.
159
- */
160
- save(id: string, scroll?: number, storage?: Storage, pageIndex?: number, pageSize?: number): void;
161
153
  /**
162
154
  * Restore data
163
155
  * @param id : the restorable id
@@ -165,5 +157,5 @@ export declare class ClipperSearchResultManager extends ClipperDocumentManager i
165
157
  */
166
158
  restore(id: string, storage?: Storage): void;
167
159
  static ɵfac: i0.ɵɵFactoryDeclaration<ClipperSearchResultManager, never>;
168
- 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>;
169
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,30 +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 pageIndex : the page index. Default is 0.
1468
- * @param pageSize : the page size. Default is 15.
1469
- */
1470
- save(id, scroll = 0, storage = sessionStorage, pageIndex = 0, pageSize = 15) {
1471
- storage.setItem(id, JSON.stringify({
1472
- paginator: {
1473
- page: pageIndex,
1474
- total: this.snapshot?.total ?? 0,
1475
- size: pageSize
1476
- },
1477
- facets: this.facets()?.save(),
1478
- filterParams: this.filterParams,
1479
- scroll: scroll,
1480
- sort: { mode: this.sortMode, options: this.sortOptions },
1481
- data: this.snapshot
1482
- ? { items: this.snapshot.items, total: this.snapshot.total }
1483
- : null
1484
- }));
1485
- }
1486
1480
  /**
1487
1481
  * Restore data
1488
1482
  * @param id : the restorable id
@@ -1531,7 +1525,7 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
1531
1525
  }
1532
1526
  }
1533
1527
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ClipperSearchResultManager, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1534
- 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 }); }
1535
1529
  }
1536
1530
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ClipperSearchResultManager, decorators: [{
1537
1531
  type: Component,