@esfaenza/dashboard-feature 15.2.9 → 15.2.11

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.
@@ -509,43 +509,8 @@ class DefaultDashboardModuleOptions {
509
509
  }
510
510
  }
511
511
 
512
- class SaveJaceDashboardLayoutDTO {
513
- constructor() {
514
- this.backendid = "default_backend";
515
- }
516
- }
517
-
518
- //Definizione della widget restituita dal backend
519
- class JaceWidgetInstanceDetail {
520
- constructor() {
521
- this.queryerror = false;
522
- }
523
- }
524
-
525
- /**NOTA
526
- * per essere sicuro che la Factory venga creata dall'injector dei moduli lazy nel template di FE e quindi sappia come creare i componenti dinamici,
527
- * al momento è dichiarata con provideIn: null in modo da 'costringere' ad esplicitarla nei provider del proprio modulo
528
- * dove si vuole usare la dashboard
529
- *
530
- * @NgModule({
531
- * imports: [...MODULES],
532
- * declarations: [...COMPONENTS],
533
- * providers: [
534
- * // url backend per la dashboard
535
- * { provide: DSH_BACKEND_URL, useValue: myconfig.BACKEND_URL},
536
- * ==> DashboardWidgetFactory
537
- * ]
538
- * })
539
- * export class MyLazyModule {}
540
- *
541
- * sperabilmente in futuro (ng12+ con Ivy) la si potrà dichiarare provideIn: root se si supera il problema dei componenti dinamici
542
- */
543
- //singleton
544
512
  class DashboardWidgetFactory {
545
- //verione ng 13
546
- //constructor() { }
547
- constructor(componentFactoryResolver) {
548
- this.componentFactoryResolver = componentFactoryResolver;
513
+ constructor() {
549
514
  this.types = {};
550
515
  }
551
516
  addOption(option) {
@@ -555,22 +520,6 @@ class DashboardWidgetFactory {
555
520
  });
556
521
  }
557
522
  }
558
- //TODO
559
- //versione ng 13+
560
- /* resolveComponent(type: string, vcr: ViewContainerRef): ComponentRef<IWidgetComponent> | null {
561
-
562
- if (!this.types)
563
- return null;
564
-
565
- let t = this.types[type];
566
-
567
- if (!t)
568
- return null;
569
-
570
- let componentRef: ComponentRef<IWidgetComponent> = vcr.createComponent(t.component);
571
-
572
- return componentRef;
573
- } */
574
523
  /**
575
524
  * Versione ng11 della creazione dei componenti dinamici delle widget
576
525
  * @param type
@@ -583,9 +532,7 @@ class DashboardWidgetFactory {
583
532
  let t = this.types[type];
584
533
  if (!t)
585
534
  return null;
586
- //DEPRECATO dopo ng11: è stato tolto il meccanismo dei ComponentFactory per i componenti dinamici
587
- let cf = this.componentFactoryResolver.resolveComponentFactory(t.component);
588
- let componentRef = vcr.createComponent(cf);
535
+ let componentRef = vcr.createComponent(t.component);
589
536
  return componentRef;
590
537
  }
591
538
  resolveDefinition(type, details) {
@@ -602,12 +549,25 @@ class DashboardWidgetFactory {
602
549
  return new type();
603
550
  }
604
551
  }
605
- DashboardWidgetFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardWidgetFactory, deps: [{ token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Injectable });
606
- DashboardWidgetFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardWidgetFactory, providedIn: null });
552
+ DashboardWidgetFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardWidgetFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
553
+ DashboardWidgetFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardWidgetFactory, providedIn: "root" });
607
554
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardWidgetFactory, decorators: [{
608
555
  type: Injectable,
609
- args: [{ providedIn: null }]
610
- }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }]; } });
556
+ args: [{ providedIn: "root" }]
557
+ }], ctorParameters: function () { return []; } });
558
+
559
+ class SaveJaceDashboardLayoutDTO {
560
+ constructor() {
561
+ this.backendid = "default_backend";
562
+ }
563
+ }
564
+
565
+ //Definizione della widget restituita dal backend
566
+ class JaceWidgetInstanceDetail {
567
+ constructor() {
568
+ this.queryerror = false;
569
+ }
570
+ }
611
571
 
612
572
  /**
613
573
  * Componente di base che rappresenta una dashboard.
@@ -828,24 +788,14 @@ class DashboardFeatureModule {
828
788
  providers: [
829
789
  { provide: DSH_OPTIONS, multi: true, useValue: new DefaultDashboardModuleOptions() },
830
790
  { provide: DSH_OPTIONS, multi: true, useValue: options },
831
- { provide: DSH_DATA_SERVICE, useClass: DashboardFeatureAPIDataService }
832
- ]
833
- };
834
- }
835
- static forChild(options) {
836
- return {
837
- ngModule: DashboardFeatureModule,
838
- providers: [
839
- { provide: DSH_OPTIONS, multi: true, useValue: new DefaultDashboardModuleOptions() },
840
- { provide: DSH_OPTIONS, multi: true, useValue: options }
791
+ { provide: DSH_DATA_SERVICE, useClass: DashboardFeatureAPIDataService },
792
+ DashboardWidgetFactory
841
793
  ]
842
794
  };
843
795
  }
844
796
  constructor(componentFactory, options) {
845
- if (!options) {
846
- //componentFactory.addOption(new DefaultDashboardModuleOptions());
797
+ if (!options)
847
798
  return;
848
- }
849
799
  options.map((o) => componentFactory.addOption(o));
850
800
  }
851
801
  }