@esfaenza/extensions 15.2.7 → 15.2.9

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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, Injectable, Optional, Inject, Pipe, NgModule, Injector } from '@angular/core';
3
3
  import * as i1 from '@esfaenza/localizations';
4
- import { LocalizationModule, LocalizationService } from '@esfaenza/localizations';
4
+ import { LocalizationModule } from '@esfaenza/localizations';
5
5
  import { first, map } from 'rxjs/operators';
6
6
  import { Deserialize } from 'cerialize';
7
7
  import swal from 'sweetalert2';
@@ -352,8 +352,8 @@ const locProperty = "__loc__";
352
352
  * @param {Type<LocalizationService>} loc Tipo ereditato dal LocalizationService che può essere creato a runtime sotto contesto della DI di Angular
353
353
  */
354
354
  function ExportLocalization(loc) {
355
- return (ctor) => {
356
- return class extends ctor {
355
+ return function integrateLoc(constructor) {
356
+ return class extends constructor {
357
357
  constructor() {
358
358
  super(...arguments);
359
359
  this.__loc__ = loc;
@@ -514,8 +514,9 @@ class ExportService {
514
514
  *
515
515
  * @ignore
516
516
  */
517
- constructor(dates) {
517
+ constructor(dates, lc) {
518
518
  this.dates = dates;
519
+ this.lc = lc;
519
520
  }
520
521
  /**
521
522
  * Data una lista di oggetti genera gli header per l'esportazione e integra ogni oggetto con le proprietà esportabili dalla libreria **@ctrl/ngx-csv**
@@ -621,7 +622,7 @@ class ExportService {
621
622
  var headers = [];
622
623
  // Miracle incoming
623
624
  let exportProps = obj[exportList] || [];
624
- let loc = this.getLocalizationService(obj);
625
+ let loc = this.lc.generateFromType(obj[locProperty]);
625
626
  if (exportProps.length == 0)
626
627
  console.warn("[@esfaenza/extensions] Nessuna colonna configurata da esportare!");
627
628
  for (let i = 0; i < exportProps.length; i++) {
@@ -648,13 +649,6 @@ class ExportService {
648
649
  }
649
650
  return headers;
650
651
  }
651
- /** Helper per ottenere il servizio di localizzazione relativo ad un'entità */
652
- getLocalizationService(object) {
653
- if (!object[locProperty])
654
- return null;
655
- const injector = Injector.create({ providers: [{ provide: LocalizationService, useClass: object[locProperty] }] });
656
- return injector.get(LocalizationService);
657
- }
658
652
  /**
659
653
  * Setup per l'esportazione di una singola proprietà.
660
654
  * Viene generato l'header e la proprietà relativa al valore formattato o no
@@ -870,12 +864,12 @@ class ExportService {
870
864
  return Deserialize(items, type);
871
865
  }
872
866
  }
873
- ExportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExportService, deps: [{ token: DateService }], target: i0.ɵɵFactoryTarget.Injectable });
867
+ ExportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExportService, deps: [{ token: DateService }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Injectable });
874
868
  ExportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExportService, providedIn: "root" });
875
869
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExportService, decorators: [{
876
870
  type: Injectable,
877
871
  args: [{ providedIn: "root" }]
878
- }], ctorParameters: function () { return [{ type: DateService }]; } });
872
+ }], ctorParameters: function () { return [{ type: DateService }, { type: i1.LocalizationService }]; } });
879
873
 
880
874
  // Angular
881
875
  /**