@esfaenza/extensions 15.2.12 → 15.2.13

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.
@@ -3,7 +3,6 @@ import { InjectionToken, Injectable, Optional, Inject, Pipe, NgModule, Injector
3
3
  import * as i1 from '@esfaenza/localizations';
4
4
  import { LocalizationModule } from '@esfaenza/localizations';
5
5
  import { first, map } from 'rxjs/operators';
6
- import { Deserialize } from 'cerialize';
7
6
  import swal from 'sweetalert2';
8
7
  import { ToastrService } from 'ngx-toastr';
9
8
  import { of, Subject } from 'rxjs';
@@ -1104,18 +1103,6 @@ class ExportService {
1104
1103
  });
1105
1104
  }
1106
1105
  }
1107
- /**
1108
- * Metodo che si occupa della deserializzazione degli oggetti da esportare. Messo a livello di libreria in modo che qualora ci fosse da cambiare libreria
1109
- * tutte le manutenzioni siano concentrate qui
1110
- *
1111
- * @param {any[]} items Oggetti da deserializzare
1112
- * @param {any} type Tipo da usare come prototipo per la deserializzazione
1113
- *
1114
- * @returns {any} Oggetti deserializzati
1115
- */
1116
- deserializeForExport(items, type) {
1117
- return Deserialize(items, type);
1118
- }
1119
1106
  /**
1120
1107
  * Effettua l'esportazione in file CSV
1121
1108
  */
@@ -1201,9 +1188,15 @@ class ExportService {
1201
1188
  *
1202
1189
  * @param {any[]} items Oggetti da esportare
1203
1190
  */
1204
- export(items, format, fileName, columnsFilter, genericHeaders) {
1205
- let headers = genericHeaders ? this.setupForGenericExport(items, genericHeaders) : this.setupForExport(items, columnsFilter);
1206
- (format == "CSV" ? this.exportCSV : this.exportExcel).bind(this)(fileName, headers, items);
1191
+ export(items, format, fileName, type, columnsFilter, genericHeaders) {
1192
+ var createdItems = items.map(t => {
1193
+ let tmp = new type();
1194
+ for (let property in t)
1195
+ [property] = t[property];
1196
+ return tmp;
1197
+ });
1198
+ let headers = genericHeaders ? this.setupForGenericExport(createdItems, genericHeaders) : this.setupForExport(createdItems, columnsFilter);
1199
+ (format == "CSV" ? this.exportCSV : this.exportExcel).bind(this)(fileName, headers, createdItems);
1207
1200
  }
1208
1201
  }
1209
1202
  ExportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExportService, deps: [{ token: DateService }, { token: UtilityService }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Injectable });