@esfaenza/dashboard-feature 15.2.13 → 19.2.0

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.
Files changed (69) hide show
  1. package/README.md +24 -24
  2. package/fesm2022/esfaenza-dashboard-feature.mjs +988 -0
  3. package/fesm2022/esfaenza-dashboard-feature.mjs.map +1 -0
  4. package/index.d.ts +5 -5
  5. package/lib/components/dashboard/dashboard.component.d.ts +46 -46
  6. package/lib/components/widgets/BaseWidgetComponent.d.ts +44 -47
  7. package/lib/components/widgets/IWidgetComponent.d.ts +23 -23
  8. package/lib/components/widgets/JaceWidgetTypes.d.ts +6 -6
  9. package/lib/components/widgets/chart/jace-dsh-chart.component.d.ts +25 -25
  10. package/lib/components/widgets/counter/jace-dsh-counter.component.d.ts +24 -24
  11. package/lib/components/widgets/list/jace-dsh-list.component.d.ts +27 -27
  12. package/lib/components/widgets/multiprog/jace-dsh-multiprog.component.d.ts +26 -26
  13. package/lib/dashboard-feature.module.d.ts +22 -24
  14. package/lib/models/config/JaceDashboardConfig.d.ts +51 -51
  15. package/lib/models/externals/JaceDashboardLayoutAppSearch.d.ts +6 -6
  16. package/lib/models/externals/JaceDashboardLayoutDetail.d.ts +6 -6
  17. package/lib/models/externals/JaceWidgetInstanceDetail.d.ts +18 -18
  18. package/lib/models/externals/Repository.d.ts +5 -5
  19. package/lib/models/externals/SaveJaceDashboardLayoutDTO.d.ts +6 -6
  20. package/lib/models/options/DefaultDashboardModuleOptions.d.ts +6 -6
  21. package/lib/models/options/IDashboardModuleOptions.d.ts +4 -4
  22. package/lib/models/options/IWidgetTypeConfig.d.ts +8 -8
  23. package/lib/models/widgets/BaseJaceWidgetModel.d.ts +32 -32
  24. package/lib/models/widgets/IJaceWidgetModel.d.ts +33 -33
  25. package/lib/models/widgets/JaceChartWidgetModel.d.ts +8 -8
  26. package/lib/models/widgets/JaceCounterWidgetModel.d.ts +10 -10
  27. package/lib/models/widgets/JaceListWidgetModel.d.ts +16 -16
  28. package/lib/models/widgets/JaceMultiprogWidgetModel.d.ts +9 -9
  29. package/lib/private-injection-tokens.d.ts +3 -0
  30. package/lib/{tokens.d.ts → public-injection-tokens.d.ts} +7 -9
  31. package/lib/services/DashboardWidgetFactory.d.ts +28 -28
  32. package/lib/services/IDashboardFeatureDataService.d.ts +11 -31
  33. package/lib/services/dashboard-feature.service.d.ts +18 -38
  34. package/package.json +15 -16
  35. package/public-api.d.ts +23 -23
  36. package/esm2020/esfaenza-dashboard-feature.mjs +0 -5
  37. package/esm2020/lib/components/dashboard/dashboard.component.mjs +0 -163
  38. package/esm2020/lib/components/widgets/BaseWidgetComponent.mjs +0 -89
  39. package/esm2020/lib/components/widgets/IWidgetComponent.mjs +0 -2
  40. package/esm2020/lib/components/widgets/JaceWidgetTypes.mjs +0 -8
  41. package/esm2020/lib/components/widgets/chart/jace-dsh-chart.component.mjs +0 -81
  42. package/esm2020/lib/components/widgets/counter/jace-dsh-counter.component.mjs +0 -80
  43. package/esm2020/lib/components/widgets/list/jace-dsh-list.component.mjs +0 -91
  44. package/esm2020/lib/components/widgets/multiprog/jace-dsh-multiprog.component.mjs +0 -82
  45. package/esm2020/lib/dashboard-feature.module.mjs +0 -98
  46. package/esm2020/lib/models/config/JaceDashboardConfig.mjs +0 -57
  47. package/esm2020/lib/models/externals/JaceDashboardLayoutAppSearch.mjs +0 -8
  48. package/esm2020/lib/models/externals/JaceDashboardLayoutDetail.mjs +0 -4
  49. package/esm2020/lib/models/externals/JaceWidgetInstanceDetail.mjs +0 -7
  50. package/esm2020/lib/models/externals/Repository.mjs +0 -6
  51. package/esm2020/lib/models/externals/SaveJaceDashboardLayoutDTO.mjs +0 -6
  52. package/esm2020/lib/models/options/DefaultDashboardModuleOptions.mjs +0 -35
  53. package/esm2020/lib/models/options/IDashboardModuleOptions.mjs +0 -2
  54. package/esm2020/lib/models/options/IWidgetTypeConfig.mjs +0 -2
  55. package/esm2020/lib/models/widgets/BaseJaceWidgetModel.mjs +0 -24
  56. package/esm2020/lib/models/widgets/IJaceWidgetModel.mjs +0 -2
  57. package/esm2020/lib/models/widgets/JaceChartWidgetModel.mjs +0 -27
  58. package/esm2020/lib/models/widgets/JaceCounterWidgetModel.mjs +0 -23
  59. package/esm2020/lib/models/widgets/JaceListWidgetModel.mjs +0 -39
  60. package/esm2020/lib/models/widgets/JaceMultiprogWidgetModel.mjs +0 -28
  61. package/esm2020/lib/services/DashboardWidgetFactory.mjs +0 -49
  62. package/esm2020/lib/services/IDashboardFeatureDataService.mjs +0 -2
  63. package/esm2020/lib/services/dashboard-feature.service.mjs +0 -58
  64. package/esm2020/lib/tokens.mjs +0 -8
  65. package/esm2020/public-api.mjs +0 -34
  66. package/fesm2015/esfaenza-dashboard-feature.mjs +0 -1041
  67. package/fesm2015/esfaenza-dashboard-feature.mjs.map +0 -1
  68. package/fesm2020/esfaenza-dashboard-feature.mjs +0 -1024
  69. package/fesm2020/esfaenza-dashboard-feature.mjs.map +0 -1
@@ -0,0 +1,988 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, EventEmitter, Output, Input, Inject, Component, Injectable, ViewContainerRef, ViewChildren, ViewEncapsulation, Optional, NgModule } from '@angular/core';
3
+ import * as i2 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i5 from '@angular/forms';
6
+ import { FormsModule } from '@angular/forms';
7
+ import * as i6 from 'angular-gridster2';
8
+ import { GridsterModule, GridType } from 'angular-gridster2';
9
+ import * as i2$1 from '@esfaenza/es-charts';
10
+ import { EsChartsModule } from '@esfaenza/es-charts';
11
+ import * as i1 from '@angular/router';
12
+ import * as i1$1 from '@esfaenza/extensions';
13
+ import { InboundMessageTypes } from '@esfaenza/extensions';
14
+ import { Subject, timer } from 'rxjs';
15
+ import { takeUntil, map } from 'rxjs/operators';
16
+ import * as i7 from '@esfaenza/forms-and-validations';
17
+ import { FormsAndValidationsModule } from '@esfaenza/forms-and-validations';
18
+ import * as i1$2 from '@esfaenza/httpservice';
19
+ import { HttpserviceModule } from '@esfaenza/httpservice';
20
+ import { HttpParams } from '@angular/common/http';
21
+ import { AppSearch } from '@esfaenza/es-table';
22
+
23
+ /**
24
+ * Token di registrazione della DashboardFeatureService.
25
+ * Permette di fare l'override dell'implementazione di default a scopo di test delle widget
26
+ */
27
+ const DSH_DATA_SERVICE = new InjectionToken('DSH_DATA_SERVICE');
28
+
29
+ const DSH_OPTIONS = new InjectionToken('DSH_MODULE_OPTIONS');
30
+
31
+ class JaceChartWidgetComponent {
32
+ constructor(dshService) {
33
+ this.dshService = dshService;
34
+ this.OnRemove = new EventEmitter();
35
+ this.configuration = false;
36
+ this.dataReady = false;
37
+ this.lastdate = "";
38
+ this.chartName = "";
39
+ }
40
+ setWidgetModel(dshBackendId, widgetModel) {
41
+ this.model = widgetModel;
42
+ if (this.model.backendid === undefined || this.model.backendid == "default_backend")
43
+ this.model.backendid = dshBackendId;
44
+ this.refreshData();
45
+ }
46
+ ngOnInit() { }
47
+ ngOnChanges(changes) {
48
+ //console.log(changes['DashboardDate'].currentValue);
49
+ if (changes['DashboardDate'].previousValue)
50
+ this.lastdate = changes['DashboardDate'].previousValue.toISOString();
51
+ let curdate = "";
52
+ if (changes['DashboardDate'].currentValue)
53
+ curdate = changes['DashboardDate'].currentValue.toISOString();
54
+ //fix per il datetimepicker material che cambia l'oggetto al momento del caricamento
55
+ if (this.lastdate != curdate) {
56
+ this.lastdate = curdate;
57
+ this.refreshData();
58
+ }
59
+ }
60
+ refreshData() {
61
+ if (!this.model)
62
+ return;
63
+ const pars = {};
64
+ if (this.DashboardDate)
65
+ pars["DT"] = this.DashboardDate.toISOString();
66
+ if (this.model.options && Object.keys(this.model.options).length != 0) {
67
+ for (let index = 0; index < Object.keys(this.model.options).length; index++) {
68
+ const k = Object.keys(this.model.options)[index];
69
+ pars[k] = this.model.options[k];
70
+ }
71
+ }
72
+ this.dshService.GetWidgetData(this.model.backendid, this.model.name, pars).subscribe(data => {
73
+ if (this.model) {
74
+ this.model.setData(data);
75
+ this.chartName = this.model.name;
76
+ this.dataReady = true;
77
+ }
78
+ });
79
+ }
80
+ removeWidget() {
81
+ if (!this.model)
82
+ return;
83
+ this.OnRemove.emit(this.model.name);
84
+ }
85
+ configure() {
86
+ if (this.configuration) {
87
+ //finito di configurare -> refreshData
88
+ this.refreshData();
89
+ }
90
+ this.configuration = !this.configuration;
91
+ }
92
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: JaceChartWidgetComponent, deps: [{ token: DSH_DATA_SERVICE }], target: i0.ɵɵFactoryTarget.Component }); }
93
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: JaceChartWidgetComponent, isStandalone: false, selector: "jace-dsh-chart", inputs: { DashboardDate: "DashboardDate" }, outputs: { OnRemove: "OnRemove" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"jace-dsh-widget-header {{model?.name}}-header\">\r\n <div class=\"jace-dsh-widget-title\" *ngIf=\"model.title\">\r\n {{model.title}}\r\n </div>\r\n <div class=\"jace-dsh-widget-controls\" *ngIf=\"dataReady\">\r\n <span class=\"transition drag-handler jace-dsh-widget-drag\" *ngIf=\"model.dragEnabled\">\r\n <i class=\"fa fa-arrows-alt\"></i>\r\n </span>\r\n <span class=\"transition jace-dsh-widget-opts\" (click)=\"configure()\">\r\n <i class=\"fa fa-cog\"></i>\r\n </span>\r\n <span (click)=\"removeWidget()\" class=\"transition remove-button jace-dsh-widget-close\">\r\n <i class=\"fa fa-times\"></i>\r\n </span>\r\n </div>\r\n</div>\r\n<div class=\"jace-dsh-widget-body gridster-item-content {{model?.name}}-body\">\r\n <div class=\"jace-dsh-widget-loading\" *ngIf=\"!dataReady\">\r\n <i class=\"fa fa-spinner fa-spin\"></i>\r\n </div>\r\n\r\n <div class=\"jace-dsh-chart-container jace-dsh-widget-slide\"\r\n [ngClass]=\"{'jace-dsh-widget-content-hide':configuration,'jace-dsh-widget-content-show':!configuration}\"\r\n *ngIf=\"dataReady\">\r\n <!-- [Type]=\"Widget.chartType\" -->\r\n <h6 *ngIf=\"model?.queryerror\" class=\"fg-disabled\" style=\"margin-top: 0.5rem;\"><span\r\n class=\"fa fa-times-circle-o\"></span>&nbsp;&nbsp;Error retrieving data</h6>\r\n <es-chart [Legend]=\"model.legend\" [Theme]=\"'dataviz'\" [Type]=\"model.chartType\" [Data]=\"model.chartData\"\r\n [name]=\"chartName\"></es-chart>\r\n </div>\r\n\r\n <div class=\"jace-dsh-widget-settings jace-dsh-widget-slide \"\r\n [ngClass]=\"{'jace-dsh-widget-settings-hide':!configuration,'jace-dsh-widget-settings-show':configuration}\">\r\n <p>Configuration</p>\r\n </div>\r\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.EsChartComponent, selector: "es-chart", inputs: ["Type", "Data", "DataArray"] }] }); }
94
+ }
95
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: JaceChartWidgetComponent, decorators: [{
96
+ type: Component,
97
+ args: [{ selector: 'jace-dsh-chart', standalone: false, template: "<div class=\"jace-dsh-widget-header {{model?.name}}-header\">\r\n <div class=\"jace-dsh-widget-title\" *ngIf=\"model.title\">\r\n {{model.title}}\r\n </div>\r\n <div class=\"jace-dsh-widget-controls\" *ngIf=\"dataReady\">\r\n <span class=\"transition drag-handler jace-dsh-widget-drag\" *ngIf=\"model.dragEnabled\">\r\n <i class=\"fa fa-arrows-alt\"></i>\r\n </span>\r\n <span class=\"transition jace-dsh-widget-opts\" (click)=\"configure()\">\r\n <i class=\"fa fa-cog\"></i>\r\n </span>\r\n <span (click)=\"removeWidget()\" class=\"transition remove-button jace-dsh-widget-close\">\r\n <i class=\"fa fa-times\"></i>\r\n </span>\r\n </div>\r\n</div>\r\n<div class=\"jace-dsh-widget-body gridster-item-content {{model?.name}}-body\">\r\n <div class=\"jace-dsh-widget-loading\" *ngIf=\"!dataReady\">\r\n <i class=\"fa fa-spinner fa-spin\"></i>\r\n </div>\r\n\r\n <div class=\"jace-dsh-chart-container jace-dsh-widget-slide\"\r\n [ngClass]=\"{'jace-dsh-widget-content-hide':configuration,'jace-dsh-widget-content-show':!configuration}\"\r\n *ngIf=\"dataReady\">\r\n <!-- [Type]=\"Widget.chartType\" -->\r\n <h6 *ngIf=\"model?.queryerror\" class=\"fg-disabled\" style=\"margin-top: 0.5rem;\"><span\r\n class=\"fa fa-times-circle-o\"></span>&nbsp;&nbsp;Error retrieving data</h6>\r\n <es-chart [Legend]=\"model.legend\" [Theme]=\"'dataviz'\" [Type]=\"model.chartType\" [Data]=\"model.chartData\"\r\n [name]=\"chartName\"></es-chart>\r\n </div>\r\n\r\n <div class=\"jace-dsh-widget-settings jace-dsh-widget-slide \"\r\n [ngClass]=\"{'jace-dsh-widget-settings-hide':!configuration,'jace-dsh-widget-settings-show':configuration}\">\r\n <p>Configuration</p>\r\n </div>\r\n</div>" }]
98
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
99
+ type: Inject,
100
+ args: [DSH_DATA_SERVICE]
101
+ }] }], propDecorators: { DashboardDate: [{
102
+ type: Input
103
+ }], OnRemove: [{
104
+ type: Output
105
+ }] } });
106
+
107
+ class JaceCounterWidgetComponent {
108
+ constructor(dshService) {
109
+ this.dshService = dshService;
110
+ this.OnRemove = new EventEmitter();
111
+ this.configuration = false;
112
+ this.dataReady = false;
113
+ this.lastdate = "";
114
+ }
115
+ //TODO per online update: importare cdr: ChangeDectectorRef
116
+ setWidgetModel(dshBackendId, widgetModel) {
117
+ this.model = widgetModel;
118
+ if (this.model.backendid === undefined || this.model.backendid == "default_backend")
119
+ this.model.backendid = dshBackendId;
120
+ this.refreshData();
121
+ }
122
+ ngOnInit() { }
123
+ ngOnChanges(changes) {
124
+ //console.log(changes['DashboardDate'].currentValue);
125
+ if (changes['DashboardDate'].previousValue)
126
+ this.lastdate = changes['DashboardDate'].previousValue.toISOString();
127
+ let curdate = "";
128
+ if (changes['DashboardDate'].currentValue)
129
+ curdate = changes['DashboardDate'].currentValue.toISOString();
130
+ //fix per il datetimepicker material che cambia l'oggetto al momento del caricamento
131
+ if (this.lastdate != curdate) {
132
+ this.lastdate = curdate;
133
+ this.refreshData();
134
+ }
135
+ }
136
+ refreshData() {
137
+ if (!this.model)
138
+ return;
139
+ const pars = {};
140
+ if (this.DashboardDate)
141
+ pars["DT"] = this.DashboardDate.toISOString();
142
+ if (this.model.options && Object.keys(this.model.options).length != 0) {
143
+ for (let index = 0; index < Object.keys(this.model.options).length; index++) {
144
+ const k = Object.keys(this.model.options)[index];
145
+ pars[k] = this.model.options[k];
146
+ }
147
+ }
148
+ this.dshService.GetWidgetData(this.model.backendid, this.model.name, pars).subscribe(data => {
149
+ if (this.model) {
150
+ this.model.setData(data);
151
+ this.dataReady = true;
152
+ //TODO per online update: this.cdr.markForCheck();
153
+ }
154
+ });
155
+ }
156
+ removeWidget() {
157
+ if (!this.model)
158
+ return;
159
+ this.OnRemove.emit(this.model.name);
160
+ }
161
+ configure() {
162
+ if (this.configuration) {
163
+ //finito di configurare -> refreshData
164
+ this.refreshData();
165
+ }
166
+ this.configuration = !this.configuration;
167
+ }
168
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: JaceCounterWidgetComponent, deps: [{ token: DSH_DATA_SERVICE }], target: i0.ɵɵFactoryTarget.Component }); }
169
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: JaceCounterWidgetComponent, isStandalone: false, selector: "jace-dsh-counter", inputs: { DashboardDate: "DashboardDate" }, outputs: { OnRemove: "OnRemove" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"jace-dsh-widget-header {{model?.name}}-header\">\r\n <div class=\"jace-dsh-widget-title\" *ngIf=\"model.title\">\r\n {{model.title}}\r\n </div>\r\n <div class=\"jace-dsh-widget-controls\" *ngIf=\"dataReady\">\r\n <span class=\"transition drag-handler jace-dsh-widget-drag\" *ngIf=\"model.dragEnabled\">\r\n <i class=\"fa fa-arrows-alt\"></i>\r\n </span>\r\n <span class=\"transition jace-dsh-widget-opts\" (click)=\"configure()\">\r\n <i class=\"fa fa-cog\"></i>\r\n </span>\r\n <span (click)=\"removeWidget()\" class=\"transition remove-button jace-dsh-widget-close\">\r\n <i class=\"fa fa-times\"></i>\r\n </span>\r\n </div>\r\n</div>\r\n<div class=\"jace-dsh-widget-body gridster-item-content {{model?.name}}-body\">\r\n <div class=\"jace-dsh-widget-loading\" *ngIf=\"!dataReady\">\r\n <i class=\"fa fa-spinner fa-spin\"></i>\r\n </div>\r\n <div class=\"jace-dsh-counter-body jace-dsh-widget-slide\"\r\n [ngClass]=\"{'jace-dsh-widget-content-hide':configuration,'jace-dsh-widget-content-show':!configuration}\"\r\n *ngIf=\"dataReady\">\r\n <i class=\"jace-dsh-counter-icon fa fa-2x\" [ngClass]=\"[ model.icon ? model.icon : '']\" *ngIf=\"model.icon\"></i>\r\n <div class=\"jace-dsh-counter-super\">{{model.superText}}</div>\r\n <div class=\"jace-dsh-counter-value\"><span>{{model.value}}</span> <span\r\n class=\"jace-dsh-counter-unit\">{{model.unit}}</span> </div>\r\n\r\n <div class=\"jace-dsh-counter-sub\">{{model.subText}}</div>\r\n </div>\r\n\r\n <div class=\"jace-dsh-widget-settings jace-dsh-widget-slide \"\r\n [ngClass]=\"{'jace-dsh-widget-settings-hide':!configuration,'jace-dsh-widget-settings-show':configuration}\">\r\n <p>Configuration</p>\r\n </div>\r\n</div>", styles: [".jace-dsh-counter-body{padding:1em .5em}.jace-dsh-counter-value{font-size:2em;font-weight:700;text-align:center}.jace-dsh-counter-unit{margin-left:.08em;font-size:.5em;text-align:center}.jace-dsh-counter-super{font-size:1em;text-align:center}.jace-dsh-counter-sub{font-size:.8em;text-align:center}.jace-dsh-counter-icon{position:absolute;font-size:2.6em;color:#b0c4de}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
170
+ }
171
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: JaceCounterWidgetComponent, decorators: [{
172
+ type: Component,
173
+ args: [{ selector: 'jace-dsh-counter', standalone: false, template: "<div class=\"jace-dsh-widget-header {{model?.name}}-header\">\r\n <div class=\"jace-dsh-widget-title\" *ngIf=\"model.title\">\r\n {{model.title}}\r\n </div>\r\n <div class=\"jace-dsh-widget-controls\" *ngIf=\"dataReady\">\r\n <span class=\"transition drag-handler jace-dsh-widget-drag\" *ngIf=\"model.dragEnabled\">\r\n <i class=\"fa fa-arrows-alt\"></i>\r\n </span>\r\n <span class=\"transition jace-dsh-widget-opts\" (click)=\"configure()\">\r\n <i class=\"fa fa-cog\"></i>\r\n </span>\r\n <span (click)=\"removeWidget()\" class=\"transition remove-button jace-dsh-widget-close\">\r\n <i class=\"fa fa-times\"></i>\r\n </span>\r\n </div>\r\n</div>\r\n<div class=\"jace-dsh-widget-body gridster-item-content {{model?.name}}-body\">\r\n <div class=\"jace-dsh-widget-loading\" *ngIf=\"!dataReady\">\r\n <i class=\"fa fa-spinner fa-spin\"></i>\r\n </div>\r\n <div class=\"jace-dsh-counter-body jace-dsh-widget-slide\"\r\n [ngClass]=\"{'jace-dsh-widget-content-hide':configuration,'jace-dsh-widget-content-show':!configuration}\"\r\n *ngIf=\"dataReady\">\r\n <i class=\"jace-dsh-counter-icon fa fa-2x\" [ngClass]=\"[ model.icon ? model.icon : '']\" *ngIf=\"model.icon\"></i>\r\n <div class=\"jace-dsh-counter-super\">{{model.superText}}</div>\r\n <div class=\"jace-dsh-counter-value\"><span>{{model.value}}</span> <span\r\n class=\"jace-dsh-counter-unit\">{{model.unit}}</span> </div>\r\n\r\n <div class=\"jace-dsh-counter-sub\">{{model.subText}}</div>\r\n </div>\r\n\r\n <div class=\"jace-dsh-widget-settings jace-dsh-widget-slide \"\r\n [ngClass]=\"{'jace-dsh-widget-settings-hide':!configuration,'jace-dsh-widget-settings-show':configuration}\">\r\n <p>Configuration</p>\r\n </div>\r\n</div>", styles: [".jace-dsh-counter-body{padding:1em .5em}.jace-dsh-counter-value{font-size:2em;font-weight:700;text-align:center}.jace-dsh-counter-unit{margin-left:.08em;font-size:.5em;text-align:center}.jace-dsh-counter-super{font-size:1em;text-align:center}.jace-dsh-counter-sub{font-size:.8em;text-align:center}.jace-dsh-counter-icon{position:absolute;font-size:2.6em;color:#b0c4de}\n"] }]
174
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
175
+ type: Inject,
176
+ args: [DSH_DATA_SERVICE]
177
+ }] }], propDecorators: { DashboardDate: [{
178
+ type: Input
179
+ }], OnRemove: [{
180
+ type: Output
181
+ }] } });
182
+
183
+ class JaceListWidgetComponent {
184
+ constructor(dshService, router) {
185
+ this.dshService = dshService;
186
+ this.router = router;
187
+ this.OnRemove = new EventEmitter();
188
+ this.configuration = false;
189
+ this.dataReady = false;
190
+ this.lastdate = "";
191
+ }
192
+ setWidgetModel(dshBackendId, widgetModel) {
193
+ this.model = widgetModel;
194
+ if (this.model.backendid === undefined || this.model.backendid == "default_backend")
195
+ this.model.backendid = dshBackendId;
196
+ this.refreshData();
197
+ }
198
+ ngOnInit() { }
199
+ ngOnChanges(changes) {
200
+ //console.log(changes['DashboardDate'].currentValue);
201
+ if (changes['DashboardDate'].previousValue)
202
+ this.lastdate = changes['DashboardDate'].previousValue.toISOString();
203
+ let curdate = "";
204
+ if (changes['DashboardDate'].currentValue)
205
+ curdate = changes['DashboardDate'].currentValue.toISOString();
206
+ //fix per il datetimepicker material che cambia l'oggetto al momento del caricamento
207
+ if (this.lastdate != curdate) {
208
+ this.lastdate = curdate;
209
+ this.refreshData();
210
+ }
211
+ }
212
+ refreshData() {
213
+ if (!this.model)
214
+ return;
215
+ const pars = {};
216
+ if (this.DashboardDate)
217
+ pars["DT"] = this.DashboardDate.toISOString();
218
+ if (this.model.options && Object.keys(this.model.options).length != 0) {
219
+ for (let index = 0; index < Object.keys(this.model.options).length; index++) {
220
+ const k = Object.keys(this.model.options)[index];
221
+ pars[k] = this.model.options[k];
222
+ }
223
+ }
224
+ this.dshService.GetWidgetData(this.model.backendid, this.model.name, pars).subscribe(data => {
225
+ if (this.model) {
226
+ this.model.setData(data);
227
+ this.dataReady = true;
228
+ }
229
+ });
230
+ }
231
+ removeWidget() {
232
+ if (!this.model)
233
+ return;
234
+ this.OnRemove.emit(this.model.name);
235
+ }
236
+ itemClicked(item) {
237
+ if (item.link) {
238
+ //naviga al link
239
+ let to = item.link;
240
+ let par = {};
241
+ if (item.id && item.idParamName) {
242
+ par[item.idParamName] = item.id;
243
+ }
244
+ this.router.navigate([to, par]);
245
+ }
246
+ }
247
+ configure() {
248
+ if (this.configuration) {
249
+ //finito di configurare -> refreshData
250
+ this.refreshData();
251
+ }
252
+ this.configuration = !this.configuration;
253
+ }
254
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: JaceListWidgetComponent, deps: [{ token: DSH_DATA_SERVICE }, { token: i1.Router }], target: i0.ɵɵFactoryTarget.Component }); }
255
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: JaceListWidgetComponent, isStandalone: false, selector: "jace-dsh-list", inputs: { DashboardDate: "DashboardDate" }, outputs: { OnRemove: "OnRemove" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"jace-dsh-widget-header {{model?.name}}-header\">\r\n <div class=\"jace-dsh-widget-title\" *ngIf=\"model.title\">\r\n {{model.title}}\r\n </div>\r\n <div class=\"jace-dsh-widget-controls\" *ngIf=\"dataReady\">\r\n <span class=\"transition drag-handler jace-dsh-widget-drag\" *ngIf=\"model.dragEnabled\">\r\n <i class=\"fa fa-arrows-alt\"></i>\r\n </span>\r\n <span class=\"transition jace-dsh-widget-opts\" (click)=\"configure()\">\r\n <i class=\"fa fa-cog\"></i>\r\n </span>\r\n <span (click)=\"removeWidget()\" class=\"transition remove-button jace-dsh-widget-close\">\r\n <i class=\"fa fa-times\"></i>\r\n </span>\r\n </div>\r\n</div>\r\n<div class=\"jace-dsh-widget-body gridster-item-content {{model?.name}}-body\">\r\n <div class=\"jace-dsh-widget-loading\" *ngIf=\"!dataReady\">\r\n <i class=\"fa fa-spinner fa-spin\"></i>\r\n </div>\r\n <div class=\"jace-dsh-list-body jace-dsh-widget-slide\"\r\n [ngClass]=\"{'jace-dsh-widget-content-hide':configuration,'jace-dsh-widget-content-show':!configuration}\"\r\n *ngIf=\"dataReady\">\r\n <div class=\"jace-dsh-list-super-text\" *ngIf=\"model.superText\">{{model.superText}}</div>\r\n <div class=\"jace-dsh-list-item\" (click)=\"itemClicked(item)\" [class.jace-dsh-list-link]=\"item.link\"\r\n *ngFor=\"let item of model.items\">\r\n <div>\r\n <span class=\"jace-dsh-list-item-id\" *ngIf=\"item.id && item.showId\">{{item.id}}</span>\r\n <span>{{item.description}}</span>\r\n </div>\r\n <div *ngIf=\"item.subline\">\r\n <span class=\"jace-dsh-list-item-subline\">{{item.subline}}</span>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n <div class=\"jace-dsh-widget-settings jace-dsh-widget-slide \"\r\n [ngClass]=\"{'jace-dsh-widget-settings-hide':!configuration,'jace-dsh-widget-settings-show':configuration}\">\r\n <p>Configuration</p>\r\n </div>\r\n</div>", styles: [".jace-dsh-list-body{height:100%;overflow-y:auto}.jace-dsh-list-super-text{font-weight:500}.jace-dsh-list-item{display:flow;flex-direction:row;justify-content:flex-start;padding:.4em;border:1px solid #eee;margin-top:2px}.jace-dsh-list-item-id{margin-right:1em;color:#fff;background:#637ca0;font-size:.8em;padding:.2em .5em;border-radius:.2em}.jace-dsh-list-link{color:#0275d8!important;cursor:pointer;text-decoration:none;display:block}.jace-dsh-list-link:hover{cursor:pointer;color:#fff;background-color:#b0c4de;text-decoration:underline}.jace-dsh-list-item-subline{font-size:.5em}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
256
+ }
257
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: JaceListWidgetComponent, decorators: [{
258
+ type: Component,
259
+ args: [{ selector: 'jace-dsh-list', standalone: false, template: "<div class=\"jace-dsh-widget-header {{model?.name}}-header\">\r\n <div class=\"jace-dsh-widget-title\" *ngIf=\"model.title\">\r\n {{model.title}}\r\n </div>\r\n <div class=\"jace-dsh-widget-controls\" *ngIf=\"dataReady\">\r\n <span class=\"transition drag-handler jace-dsh-widget-drag\" *ngIf=\"model.dragEnabled\">\r\n <i class=\"fa fa-arrows-alt\"></i>\r\n </span>\r\n <span class=\"transition jace-dsh-widget-opts\" (click)=\"configure()\">\r\n <i class=\"fa fa-cog\"></i>\r\n </span>\r\n <span (click)=\"removeWidget()\" class=\"transition remove-button jace-dsh-widget-close\">\r\n <i class=\"fa fa-times\"></i>\r\n </span>\r\n </div>\r\n</div>\r\n<div class=\"jace-dsh-widget-body gridster-item-content {{model?.name}}-body\">\r\n <div class=\"jace-dsh-widget-loading\" *ngIf=\"!dataReady\">\r\n <i class=\"fa fa-spinner fa-spin\"></i>\r\n </div>\r\n <div class=\"jace-dsh-list-body jace-dsh-widget-slide\"\r\n [ngClass]=\"{'jace-dsh-widget-content-hide':configuration,'jace-dsh-widget-content-show':!configuration}\"\r\n *ngIf=\"dataReady\">\r\n <div class=\"jace-dsh-list-super-text\" *ngIf=\"model.superText\">{{model.superText}}</div>\r\n <div class=\"jace-dsh-list-item\" (click)=\"itemClicked(item)\" [class.jace-dsh-list-link]=\"item.link\"\r\n *ngFor=\"let item of model.items\">\r\n <div>\r\n <span class=\"jace-dsh-list-item-id\" *ngIf=\"item.id && item.showId\">{{item.id}}</span>\r\n <span>{{item.description}}</span>\r\n </div>\r\n <div *ngIf=\"item.subline\">\r\n <span class=\"jace-dsh-list-item-subline\">{{item.subline}}</span>\r\n </div>\r\n </div>\r\n\r\n </div>\r\n <div class=\"jace-dsh-widget-settings jace-dsh-widget-slide \"\r\n [ngClass]=\"{'jace-dsh-widget-settings-hide':!configuration,'jace-dsh-widget-settings-show':configuration}\">\r\n <p>Configuration</p>\r\n </div>\r\n</div>", styles: [".jace-dsh-list-body{height:100%;overflow-y:auto}.jace-dsh-list-super-text{font-weight:500}.jace-dsh-list-item{display:flow;flex-direction:row;justify-content:flex-start;padding:.4em;border:1px solid #eee;margin-top:2px}.jace-dsh-list-item-id{margin-right:1em;color:#fff;background:#637ca0;font-size:.8em;padding:.2em .5em;border-radius:.2em}.jace-dsh-list-link{color:#0275d8!important;cursor:pointer;text-decoration:none;display:block}.jace-dsh-list-link:hover{cursor:pointer;color:#fff;background-color:#b0c4de;text-decoration:underline}.jace-dsh-list-item-subline{font-size:.5em}\n"] }]
260
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
261
+ type: Inject,
262
+ args: [DSH_DATA_SERVICE]
263
+ }] }, { type: i1.Router }], propDecorators: { DashboardDate: [{
264
+ type: Input
265
+ }], OnRemove: [{
266
+ type: Output
267
+ }] } });
268
+
269
+ class JaceMultiprogWidgetComponent {
270
+ constructor(dshService, router) {
271
+ this.dshService = dshService;
272
+ this.router = router;
273
+ this.OnRemove = new EventEmitter();
274
+ this.configuration = false;
275
+ this.dataReady = false;
276
+ this.lastdate = "";
277
+ }
278
+ setWidgetModel(dshBackendId, widgetModel) {
279
+ this.model = widgetModel;
280
+ if (this.model.backendid === undefined || this.model.backendid == "default_backend")
281
+ this.model.backendid = dshBackendId;
282
+ this.refreshData();
283
+ }
284
+ ngOnInit() { }
285
+ ngOnChanges(changes) {
286
+ //console.log(changes['DashboardDate'].currentValue);
287
+ if (changes['DashboardDate'].previousValue)
288
+ this.lastdate = changes['DashboardDate'].previousValue.toISOString();
289
+ let curdate = "";
290
+ if (changes['DashboardDate'].currentValue)
291
+ curdate = changes['DashboardDate'].currentValue.toISOString();
292
+ //fix per il datetimepicker material che cambia l'oggetto al momento del caricamento
293
+ if (this.lastdate != curdate) {
294
+ this.lastdate = curdate;
295
+ this.refreshData();
296
+ }
297
+ }
298
+ refreshData() {
299
+ if (!this.model)
300
+ return;
301
+ const pars = {};
302
+ if (this.DashboardDate)
303
+ pars["DT"] = this.DashboardDate.toISOString();
304
+ if (this.model.options && Object.keys(this.model.options).length != 0) {
305
+ for (let index = 0; index < Object.keys(this.model.options).length; index++) {
306
+ const k = Object.keys(this.model.options)[index];
307
+ pars[k] = this.model.options[k];
308
+ }
309
+ }
310
+ this.dshService.GetWidgetData(this.model.backendid, this.model.name, pars).subscribe(data => {
311
+ if (this.model) {
312
+ this.model.setData(data);
313
+ this.dataReady = true;
314
+ }
315
+ });
316
+ }
317
+ removeWidget() {
318
+ if (!this.model)
319
+ return;
320
+ this.OnRemove.emit(this.model.name);
321
+ }
322
+ configure() {
323
+ if (this.configuration) {
324
+ //finito di configurare -> refreshData
325
+ this.refreshData();
326
+ }
327
+ this.configuration = !this.configuration;
328
+ }
329
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: JaceMultiprogWidgetComponent, deps: [{ token: DSH_DATA_SERVICE }, { token: i1.Router }], target: i0.ɵɵFactoryTarget.Component }); }
330
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: JaceMultiprogWidgetComponent, isStandalone: false, selector: "jace-dsh-multiprog", inputs: { DashboardDate: "DashboardDate" }, outputs: { OnRemove: "OnRemove" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"jace-dsh-widget-header {{model?.name}}-header\">\r\n <div class=\"jace-dsh-widget-title\" *ngIf=\"model.title\">\r\n {{model.title}}\r\n </div>\r\n <div class=\"jace-dsh-widget-controls\" *ngIf=\"dataReady\">\r\n <span class=\"transition drag-handler jace-dsh-widget-drag\" *ngIf=\"model.dragEnabled\">\r\n <i class=\"fa fa-arrows-alt\"></i>\r\n </span>\r\n <span class=\"transition jace-dsh-widget-opts\" (click)=\"configure()\">\r\n <i class=\"fa fa-cog\"></i>\r\n </span>\r\n <span (click)=\"removeWidget()\" class=\"transition remove-button jace-dsh-widget-close\">\r\n <i class=\"fa fa-times\"></i>\r\n </span>\r\n\r\n </div>\r\n</div>\r\n<div class=\"jace-dsh-widget-body gridster-item-content {{model?.name}}-body\">\r\n <div class=\"jace-dsh-widget-loading\" *ngIf=\"!dataReady\">\r\n <i class=\"fa fa-spinner\"></i>\r\n </div>\r\n <div class=\"jace-dsh-multiprog-container jace-dsh-widget-slide\"\r\n [ngClass]=\"{'jace-dsh-widget-content-hide':configuration,'jace-dsh-widget-content-show':!configuration}\"\r\n *ngIf=\"dataReady\">\r\n <div *ngFor=\"let item of model.progressTitles; let i = index\" class=\"jace-dsh-multiprog-progress\">\r\n <div class=\"jace-dsh-multiprog-title\">{{item}}</div>\r\n <!-- TODO: riportare in vita la parte grafica... con calma -->\r\n <!-- <circle-progress [percent]=\"model.progressValues[i]\" [showSubtitle]=false [radius]=\"36\"\r\n [outerStrokeWidth]=\"4\" [innerStrokeWidth]=\"2\" [outerStrokeColor]=\"'#7489AA'\"\r\n [innerStrokeColor]=\"'#EFECCA'\" [animation]=\"true\" [animationDuration]=\"300\" [showTitle]=\"true\"\r\n *ngIf=\"model.circleProgress\"></circle-progress>\r\n <mat-progress-bar [value]=\"model.progressValues[i]\" [mode]=\"'determinate'\" *ngIf=\"!model.circleProgress\">\r\n </mat-progress-bar> -->\r\n <span>{{model.progressValues[i]}}</span>\r\n </div>\r\n </div>\r\n <div class=\"jace-dsh-widget-settings jace-dsh-widget-slide \"\r\n [ngClass]=\"{'jace-dsh-widget-settings-hide':!configuration,'jace-dsh-widget-settings-show':configuration}\">\r\n <p>Configuration</p>\r\n </div>\r\n</div>", styles: [".jace-dsh-multiprog-title{text-align:center;font-weight:600;font-size:.8em}.jace-dsh-multiprog-container{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-evenly;padding:.5rem}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
331
+ }
332
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: JaceMultiprogWidgetComponent, decorators: [{
333
+ type: Component,
334
+ args: [{ selector: 'jace-dsh-multiprog', standalone: false, template: "<div class=\"jace-dsh-widget-header {{model?.name}}-header\">\r\n <div class=\"jace-dsh-widget-title\" *ngIf=\"model.title\">\r\n {{model.title}}\r\n </div>\r\n <div class=\"jace-dsh-widget-controls\" *ngIf=\"dataReady\">\r\n <span class=\"transition drag-handler jace-dsh-widget-drag\" *ngIf=\"model.dragEnabled\">\r\n <i class=\"fa fa-arrows-alt\"></i>\r\n </span>\r\n <span class=\"transition jace-dsh-widget-opts\" (click)=\"configure()\">\r\n <i class=\"fa fa-cog\"></i>\r\n </span>\r\n <span (click)=\"removeWidget()\" class=\"transition remove-button jace-dsh-widget-close\">\r\n <i class=\"fa fa-times\"></i>\r\n </span>\r\n\r\n </div>\r\n</div>\r\n<div class=\"jace-dsh-widget-body gridster-item-content {{model?.name}}-body\">\r\n <div class=\"jace-dsh-widget-loading\" *ngIf=\"!dataReady\">\r\n <i class=\"fa fa-spinner\"></i>\r\n </div>\r\n <div class=\"jace-dsh-multiprog-container jace-dsh-widget-slide\"\r\n [ngClass]=\"{'jace-dsh-widget-content-hide':configuration,'jace-dsh-widget-content-show':!configuration}\"\r\n *ngIf=\"dataReady\">\r\n <div *ngFor=\"let item of model.progressTitles; let i = index\" class=\"jace-dsh-multiprog-progress\">\r\n <div class=\"jace-dsh-multiprog-title\">{{item}}</div>\r\n <!-- TODO: riportare in vita la parte grafica... con calma -->\r\n <!-- <circle-progress [percent]=\"model.progressValues[i]\" [showSubtitle]=false [radius]=\"36\"\r\n [outerStrokeWidth]=\"4\" [innerStrokeWidth]=\"2\" [outerStrokeColor]=\"'#7489AA'\"\r\n [innerStrokeColor]=\"'#EFECCA'\" [animation]=\"true\" [animationDuration]=\"300\" [showTitle]=\"true\"\r\n *ngIf=\"model.circleProgress\"></circle-progress>\r\n <mat-progress-bar [value]=\"model.progressValues[i]\" [mode]=\"'determinate'\" *ngIf=\"!model.circleProgress\">\r\n </mat-progress-bar> -->\r\n <span>{{model.progressValues[i]}}</span>\r\n </div>\r\n </div>\r\n <div class=\"jace-dsh-widget-settings jace-dsh-widget-slide \"\r\n [ngClass]=\"{'jace-dsh-widget-settings-hide':!configuration,'jace-dsh-widget-settings-show':configuration}\">\r\n <p>Configuration</p>\r\n </div>\r\n</div>", styles: [".jace-dsh-multiprog-title{text-align:center;font-weight:600;font-size:.8em}.jace-dsh-multiprog-container{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-evenly;padding:.5rem}\n"] }]
335
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
336
+ type: Inject,
337
+ args: [DSH_DATA_SERVICE]
338
+ }] }, { type: i1.Router }], propDecorators: { DashboardDate: [{
339
+ type: Input
340
+ }], OnRemove: [{
341
+ type: Output
342
+ }] } });
343
+
344
+ class BaseJaceWidgetModel {
345
+ constructor() {
346
+ this.backendid = "default_backend";
347
+ this.resizeEnabled = false;
348
+ this.dataError = false;
349
+ this.options = {};
350
+ }
351
+ configureFromInstanceDetails(details) {
352
+ this.name = details.name;
353
+ this.widgetType = details.type;
354
+ this.title = details.title;
355
+ this.x = details.x;
356
+ this.y = details.y;
357
+ this.cols = details.cols;
358
+ this.rows = details.rows;
359
+ this.compactEnabled = details.compactenabled;
360
+ this.dragEnabled = details.dragenabled;
361
+ this.options = details.options;
362
+ this.dataError = details.queryerror;
363
+ this.resizeEnabled = details.resizeenabled;
364
+ this.backendid = details.backendid ?? "default_backend";
365
+ }
366
+ }
367
+
368
+ class JaceChartWidgetModel extends BaseJaceWidgetModel {
369
+ constructor() {
370
+ super();
371
+ this.chartType = 'line';
372
+ this.legend = false;
373
+ this.widgetType = "CHART";
374
+ }
375
+ setData(data) {
376
+ if (!data)
377
+ return;
378
+ if (data['queryerror'])
379
+ this.dataError = data['queryerror'];
380
+ if (data['legend'])
381
+ this.legend = data['legend'];
382
+ else
383
+ this.legend = true;
384
+ if (data['charttype'])
385
+ this.chartType = data['charttype'];
386
+ if (data['chartdata']) {
387
+ this.chartData = data['chartdata'];
388
+ }
389
+ if (this.options && this.options['legend'] == undefined)
390
+ this.options['legend'] = true;
391
+ }
392
+ }
393
+
394
+ class JaceCounterWidgetModel extends BaseJaceWidgetModel {
395
+ constructor() {
396
+ super();
397
+ this.superText = undefined;
398
+ this.subText = undefined;
399
+ this.value = 0;
400
+ this.icon = undefined;
401
+ this.unit = undefined;
402
+ this.widgetType = "COUNTER";
403
+ }
404
+ setData(data) {
405
+ if (data['queryerror'])
406
+ this.dataError = data['queryerror'];
407
+ this.superText = data['supertext'];
408
+ this.subText = data['subtext'];
409
+ this.value = data['value'];
410
+ this.icon = data['icon'];
411
+ this.options = data['options'];
412
+ this.unit = data['unit'];
413
+ }
414
+ }
415
+
416
+ class JaceListItemWidget {
417
+ }
418
+ class JaceListWidgetModel extends BaseJaceWidgetModel {
419
+ constructor() {
420
+ super();
421
+ this.superText = undefined;
422
+ this.items = [];
423
+ this.widgetType = "LIST";
424
+ }
425
+ setData(data) {
426
+ if (!data)
427
+ return;
428
+ if (data['queryerror'])
429
+ this.dataError = data['queryerror'];
430
+ this.superText = data['supertext'];
431
+ if (data['items']) {
432
+ const d = data['items'];
433
+ this.items = [];
434
+ for (let index = 0; index < d.length; index++) {
435
+ const item = new JaceListItemWidget();
436
+ const element = d[index];
437
+ if (element['id'])
438
+ item.id = element['id'];
439
+ if (element['idparamname'])
440
+ item.idParamName = element['idparamname'];
441
+ if (element['link'])
442
+ item.link = element['link'];
443
+ if (element['subline'])
444
+ item.subline = element['subline'];
445
+ if (element['classes'])
446
+ item.classes = element['classes'];
447
+ item.description = element.description;
448
+ this.items.push(item);
449
+ }
450
+ }
451
+ }
452
+ }
453
+
454
+ class JaceMultiprogWidgetModel extends BaseJaceWidgetModel {
455
+ constructor() {
456
+ super();
457
+ this.resizeEnabled = true;
458
+ this.progressTitles = [];
459
+ this.progressValues = [];
460
+ this.circleProgress = false;
461
+ this.widgetType = "MULTIPROGRESS";
462
+ }
463
+ setData(data) {
464
+ if (data['queryerror'])
465
+ this.dataError = data['queryerror'];
466
+ this.progressTitles = data['progresstitles'] ?? [];
467
+ this.progressValues = data['progressvalues'] ?? [];
468
+ this.circleProgress = data['circleprogress'];
469
+ this.options = data['options'] ?? {};
470
+ if (this.circleProgress === undefined)
471
+ this.circleProgress = true;
472
+ if (this.cols === undefined && this.progressValues) {
473
+ if (this.progressValues.length == 1)
474
+ this.cols = 1;
475
+ else
476
+ this.cols = 2;
477
+ }
478
+ }
479
+ }
480
+
481
+ class DefaultDashboardModuleOptions {
482
+ constructor() {
483
+ this.widgetTypes = [
484
+ {
485
+ name: "COUNTER",
486
+ component: JaceCounterWidgetComponent,
487
+ model: JaceCounterWidgetModel
488
+ },
489
+ {
490
+ name: "LIST",
491
+ component: JaceListWidgetComponent,
492
+ model: JaceListWidgetModel
493
+ },
494
+ {
495
+ name: "CHART",
496
+ component: JaceChartWidgetComponent,
497
+ model: JaceChartWidgetModel
498
+ },
499
+ {
500
+ name: "MULTIPROGRESS",
501
+ component: JaceMultiprogWidgetComponent,
502
+ model: JaceMultiprogWidgetModel
503
+ }
504
+ ];
505
+ }
506
+ }
507
+
508
+ class DashboardWidgetFactory {
509
+ constructor() {
510
+ this.types = {};
511
+ }
512
+ addOption(option) {
513
+ if (option.widgetTypes) {
514
+ option.widgetTypes.forEach((o) => {
515
+ this.types[o.name] = o;
516
+ });
517
+ }
518
+ }
519
+ /**
520
+ * Versione ng11 della creazione dei componenti dinamici delle widget
521
+ * @param type
522
+ * @param vcr
523
+ * @returns
524
+ */
525
+ resolveComponent(type, vcr) {
526
+ if (!this.types)
527
+ return null;
528
+ let t = this.types[type];
529
+ if (!t)
530
+ return null;
531
+ let componentRef = vcr.createComponent(t.component);
532
+ return componentRef;
533
+ }
534
+ resolveDefinition(type, details) {
535
+ if (!this.types)
536
+ return null;
537
+ let t = this.types[type];
538
+ if (!t)
539
+ return null;
540
+ let definitionInstance = this.createInstance(t.model);
541
+ definitionInstance.configureFromInstanceDetails(details);
542
+ return definitionInstance;
543
+ }
544
+ createInstance(type) {
545
+ return new type();
546
+ }
547
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DashboardWidgetFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
548
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DashboardWidgetFactory, providedIn: "root" }); }
549
+ }
550
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DashboardWidgetFactory, decorators: [{
551
+ type: Injectable,
552
+ args: [{ providedIn: "root" }]
553
+ }], ctorParameters: () => [] });
554
+
555
+ class SaveJaceDashboardLayoutDTO {
556
+ constructor() {
557
+ this.backendid = "default_backend";
558
+ }
559
+ }
560
+
561
+ //Definizione della widget restituita dal backend
562
+ class JaceWidgetInstanceDetail {
563
+ constructor() {
564
+ this.queryerror = false;
565
+ }
566
+ }
567
+
568
+ /**
569
+ * Componente di base che rappresenta una dashboard.
570
+ * Utilizza Gridster2 per il layout delle widget [Gridster2](https://tiberiuzuld.github.io/angular-gridster2/)
571
+ */
572
+ class DashboardComponent {
573
+ constructor(dshService, intercom, route, cmpFactory, cdr) {
574
+ this.dshService = dshService;
575
+ this.intercom = intercom;
576
+ this.route = route;
577
+ this.cmpFactory = cmpFactory;
578
+ this.cdr = cdr;
579
+ this.dashboardDate = new Date();
580
+ this.widgetDefinitions = [];
581
+ this.trackedSubscriptions = [];
582
+ this.destroySignal$ = new Subject();
583
+ this.intercom.send(InboundMessageTypes.Navigation, { sub: false, routeTitle: this.route.snapshot.data["title"] });
584
+ }
585
+ ngOnInit() { }
586
+ ngAfterViewInit() {
587
+ //qui this.gridItemRefs è 'riempito'
588
+ // sottoscrivo changes che sparerà tutte le volte che ngFor si aggiorna (ovvero quando cambia dashboard)
589
+ this.changesSub = this.gridItemRefs.changes.pipe(takeUntil(this.destroySignal$)).subscribe((comps) => {
590
+ this.renderLayout(comps);
591
+ });
592
+ //prima volta
593
+ //setTimeout(()=>this.reloadData(),500);
594
+ this.trackedSubscriptions.push(timer(500).pipe(takeUntil(this.destroySignal$), map(() => this.reloadData())).subscribe());
595
+ }
596
+ ngOnDestroy() {
597
+ //unsubscribe dalle changes dei viewref
598
+ if (this.changesSub)
599
+ this.changesSub.unsubscribe();
600
+ this.clearTrackedSubscriptions();
601
+ this.destroySignal$.next();
602
+ this.destroySignal$.complete();
603
+ }
604
+ clearTrackedSubscriptions() {
605
+ if (this.trackedSubscriptions) {
606
+ for (let index = 0; index < this.trackedSubscriptions.length; index++) {
607
+ const element = this.trackedSubscriptions[index];
608
+ element.unsubscribe();
609
+ }
610
+ this.trackedSubscriptions = [];
611
+ }
612
+ }
613
+ ngOnChanges(changes) {
614
+ //occhio: arriva prima di ngAfterViewInit
615
+ if (changes.Configuration) {
616
+ //appena ho configuration
617
+ console.log(changes.Configuration);
618
+ // la prima volta l'ho già fatta alla creazione del componente
619
+ if (!changes.Configuration.firstChange) {
620
+ this.reloadData();
621
+ }
622
+ }
623
+ }
624
+ reloadData() {
625
+ if (!this.Configuration)
626
+ return;
627
+ this.dshService.GetUserDashboard(this.Configuration.backendId, this.Configuration.accountId, this.Configuration.dashboardName).pipe(takeUntil(this.destroySignal$)).subscribe(c => {
628
+ this.dashboardLayout = c;
629
+ this.widgetDefinitions = c.widgets.map(i => {
630
+ return this.cmpFactory.resolveDefinition(i.type, i);
631
+ });
632
+ });
633
+ }
634
+ removeItem(widgetName) {
635
+ if (!this.dashboardLayout)
636
+ return;
637
+ let idx = this.dashboardLayout.widgets.findIndex(s => s.name == widgetName);
638
+ this.widgetDefinitions.splice(idx, 1);
639
+ }
640
+ saveDashboard() {
641
+ if (!this.dashboardLayout)
642
+ return;
643
+ const dto = new SaveJaceDashboardLayoutDTO();
644
+ dto.backendid = this.Configuration.backendId;
645
+ dto.widgets = [];
646
+ for (let index = 0; index < this.widgetDefinitions.length; index++) {
647
+ const w = this.widgetDefinitions[index];
648
+ if (w == null)
649
+ continue;
650
+ let v = new JaceWidgetInstanceDetail();
651
+ v.id = w.id;
652
+ v.name = w.name;
653
+ v.x = w.x;
654
+ v.y = w.y;
655
+ v.cols = w.cols;
656
+ v.rows = w.rows;
657
+ v.compactenabled = w.compactEnabled;
658
+ v.dragenabled = w.dragEnabled;
659
+ v.resizeenabled = w.resizeEnabled;
660
+ v.type = w.widgetType;
661
+ v.title = w.title;
662
+ v.options = w.options;
663
+ dto.widgets.push(v);
664
+ }
665
+ this.dshService.SaveUserDashboard(dto).subscribe(res => {
666
+ if (res.success)
667
+ console.log('Dashboard saved');
668
+ });
669
+ }
670
+ renderLayout(comps) {
671
+ this.clearTrackedSubscriptions();
672
+ comps.map((host, index) => {
673
+ const vcr = host;
674
+ vcr.clear();
675
+ const widgetData = this.widgetDefinitions[index];
676
+ if (!widgetData || !widgetData.widgetType)
677
+ return;
678
+ let componentRef;
679
+ componentRef = this.cmpFactory.resolveComponent(widgetData?.widgetType, vcr);
680
+ if (!componentRef) {
681
+ console.log(`Tipo widget sconosciuto ${widgetData.widgetType}`);
682
+ return;
683
+ }
684
+ //setta l'input della data
685
+ if (this.Configuration.showDateInput)
686
+ componentRef.instance.DashboardDate = this.dashboardDate;
687
+ //setta il modello
688
+ componentRef.instance.setWidgetModel(this.Configuration.backendId, widgetData);
689
+ //setta la callback per OnRemove
690
+ let s = componentRef.instance.OnRemove.pipe(takeUntil(this.destroySignal$)).subscribe(name => this.removeItem(name));
691
+ this.trackedSubscriptions.push(s);
692
+ //componentRef.changeDetectorRef.markForCheck();
693
+ //componentRef.changeDetectorRef.detectChanges();
694
+ });
695
+ this.cdr.detectChanges();
696
+ }
697
+ addItem() {
698
+ //this.dashboard.push({});
699
+ }
700
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DashboardComponent, deps: [{ token: DSH_DATA_SERVICE }, { token: i1$1.InterComService }, { token: i1.ActivatedRoute }, { token: DashboardWidgetFactory }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
701
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: DashboardComponent, isStandalone: false, selector: "es-dashboard", inputs: { Configuration: "Configuration" }, viewQueries: [{ propertyName: "gridItemRefs", predicate: ["grid_item"], descendants: true, read: ViewContainerRef }], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"Configuration\">\r\n\r\n <form role=\"form\" class=\"jace-dsh-toolbar\" *ngIf=\"Configuration.showToolbar\">\r\n <div *ngIf=\"Configuration.dashboardTitle\" class=\"jace-dsh-toolbar-title\">\r\n {{Configuration.dashboardTitle}}\r\n </div>\r\n <div class=\"jace-dsh-toolbar-dtp\" *ngIf=\"Configuration?.showDateInput\">\r\n <form-date InOutFormat=\"date\" [FormLayout]=\"false\" id=\"txt_dashboarddate\" [Validation]=\"false\"\r\n autocomplete=\"off\" [(ngModel)]=\"dashboardDate\" name=\"dashboarddate\" [Placeholder]=\"'Dashboard Date'\">\r\n </form-date>\r\n </div>\r\n <div class=\"jace-dsh-save-button\" (click)=\"saveDashboard()\">\r\n <span class=\"transition\">\r\n <i class=\"fa fa-save\"></i>\r\n </span>\r\n </div>\r\n </form>\r\n\r\n <gridster [options]=\"Configuration.gridsterConfig\" class=\"jace-dsh-widget-area\">\r\n <gridster-item [item]=\"item\" *ngFor=\"let item of widgetDefinitions\" class=\"jace-dsh-widget {{item.name}}\">\r\n <!-- <ng-container *ngFor=\"let item of widgetDefinitions\"> -->\r\n <ng-template #grid_item></ng-template>\r\n <!-- </ng-container> -->\r\n </gridster-item>\r\n </gridster>\r\n\r\n</ng-container>", styles: [".jace-dsh-toolbar{font-size:smaller;display:flex;flex-flow:row;justify-content:flex-end;align-items:center;padding:0 1em .5em}.jace-dsh-toolbar-title{flex:2 1 auto;font-size:2em;color:#777;font-variant:small-caps}.jace-dsh-toolbar-dtp{flex:1 1 auto}.jace-dsh-save-button{font-size:larger;padding:.5em 1em;border-radius:4px;border:1px solid #ddd;color:#777;margin-left:.5em;cursor:pointer;flex:0 0 auto}.jace-dsh-save-button:hover{color:#000;border-color:#000}.jace-dsh-widget-area{background:#e9ebee;scroll-behavior:auto}.jace-dsh-widget{border:solid 1px #ddd;border-radius:5px;min-width:204px}.jace-dsh-widget-header{margin:0rem .5rem;display:flex;flex-flow:row;justify-content:left;align-items:center}.jace-dsh-widget-title{padding:.5rem .2rem .3rem;border-bottom:solid 1px #ddd;text-transform:uppercase;font-size:.8rem}.jace-dsh-widget-body{margin:0rem .5rem;display:flex;flex-wrap:nowrap;overflow-x:clip}.jace-dsh-widget-loading{padding:.5rem;width:100%;flex:0 0 auto;font-size:4rem;font-weight:700;text-align:center}.jace-dsh-widget-slide{transition-property:transform;transition-duration:.75s;transition-timing-function:ease;width:100%;flex:0 0 auto}.jace-dsh-widget-content-show{transform:translate(0) translateZ(0)}.jace-dsh-widget-content-hide,.jace-dsh-widget-settings-show{transform:translate(-100%) translateZ(0)}.jace-dsh-widget-settings-hide{transform:translate(0) translateZ(0)}.jace-dsh-widget-settings{padding:.5rem;width:100%;flex:0 0 auto}.jace-dsh-widget-controls{margin-left:auto;order:2;z-index:1;top:0rem;right:0rem;padding:.2rem .1rem;font-size:1rem;color:#bbb;align-items:center;cursor:pointer}.jace-dsh-widget-drag{font-size:.78em}.jace-dsh-widget-opts{font-size:.92em}.jace-dsh-widget-close{font-size:1.1em}.jace-dsh-widget-controls span{margin-right:.1rem;margin-left:.1rem}.jace-dsh-widget-controls span:hover{color:#637ca0}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i6.GridsterComponent, selector: "gridster", inputs: ["options"] }, { kind: "component", type: i6.GridsterItemComponent, selector: "gridster-item", inputs: ["item"], outputs: ["itemInit", "itemChange", "itemResize"] }, { kind: "component", type: i7.EsFormDateComponent, selector: "form-date", inputs: ["InOutFormat", "FloatingLabel"] }], encapsulation: i0.ViewEncapsulation.None }); }
702
+ }
703
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DashboardComponent, decorators: [{
704
+ type: Component,
705
+ args: [{ selector: 'es-dashboard', encapsulation: ViewEncapsulation.None, standalone: false, template: "<ng-container *ngIf=\"Configuration\">\r\n\r\n <form role=\"form\" class=\"jace-dsh-toolbar\" *ngIf=\"Configuration.showToolbar\">\r\n <div *ngIf=\"Configuration.dashboardTitle\" class=\"jace-dsh-toolbar-title\">\r\n {{Configuration.dashboardTitle}}\r\n </div>\r\n <div class=\"jace-dsh-toolbar-dtp\" *ngIf=\"Configuration?.showDateInput\">\r\n <form-date InOutFormat=\"date\" [FormLayout]=\"false\" id=\"txt_dashboarddate\" [Validation]=\"false\"\r\n autocomplete=\"off\" [(ngModel)]=\"dashboardDate\" name=\"dashboarddate\" [Placeholder]=\"'Dashboard Date'\">\r\n </form-date>\r\n </div>\r\n <div class=\"jace-dsh-save-button\" (click)=\"saveDashboard()\">\r\n <span class=\"transition\">\r\n <i class=\"fa fa-save\"></i>\r\n </span>\r\n </div>\r\n </form>\r\n\r\n <gridster [options]=\"Configuration.gridsterConfig\" class=\"jace-dsh-widget-area\">\r\n <gridster-item [item]=\"item\" *ngFor=\"let item of widgetDefinitions\" class=\"jace-dsh-widget {{item.name}}\">\r\n <!-- <ng-container *ngFor=\"let item of widgetDefinitions\"> -->\r\n <ng-template #grid_item></ng-template>\r\n <!-- </ng-container> -->\r\n </gridster-item>\r\n </gridster>\r\n\r\n</ng-container>", styles: [".jace-dsh-toolbar{font-size:smaller;display:flex;flex-flow:row;justify-content:flex-end;align-items:center;padding:0 1em .5em}.jace-dsh-toolbar-title{flex:2 1 auto;font-size:2em;color:#777;font-variant:small-caps}.jace-dsh-toolbar-dtp{flex:1 1 auto}.jace-dsh-save-button{font-size:larger;padding:.5em 1em;border-radius:4px;border:1px solid #ddd;color:#777;margin-left:.5em;cursor:pointer;flex:0 0 auto}.jace-dsh-save-button:hover{color:#000;border-color:#000}.jace-dsh-widget-area{background:#e9ebee;scroll-behavior:auto}.jace-dsh-widget{border:solid 1px #ddd;border-radius:5px;min-width:204px}.jace-dsh-widget-header{margin:0rem .5rem;display:flex;flex-flow:row;justify-content:left;align-items:center}.jace-dsh-widget-title{padding:.5rem .2rem .3rem;border-bottom:solid 1px #ddd;text-transform:uppercase;font-size:.8rem}.jace-dsh-widget-body{margin:0rem .5rem;display:flex;flex-wrap:nowrap;overflow-x:clip}.jace-dsh-widget-loading{padding:.5rem;width:100%;flex:0 0 auto;font-size:4rem;font-weight:700;text-align:center}.jace-dsh-widget-slide{transition-property:transform;transition-duration:.75s;transition-timing-function:ease;width:100%;flex:0 0 auto}.jace-dsh-widget-content-show{transform:translate(0) translateZ(0)}.jace-dsh-widget-content-hide,.jace-dsh-widget-settings-show{transform:translate(-100%) translateZ(0)}.jace-dsh-widget-settings-hide{transform:translate(0) translateZ(0)}.jace-dsh-widget-settings{padding:.5rem;width:100%;flex:0 0 auto}.jace-dsh-widget-controls{margin-left:auto;order:2;z-index:1;top:0rem;right:0rem;padding:.2rem .1rem;font-size:1rem;color:#bbb;align-items:center;cursor:pointer}.jace-dsh-widget-drag{font-size:.78em}.jace-dsh-widget-opts{font-size:.92em}.jace-dsh-widget-close{font-size:1.1em}.jace-dsh-widget-controls span{margin-right:.1rem;margin-left:.1rem}.jace-dsh-widget-controls span:hover{color:#637ca0}\n"] }]
706
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
707
+ type: Inject,
708
+ args: [DSH_DATA_SERVICE]
709
+ }] }, { type: i1$1.InterComService }, { type: i1.ActivatedRoute }, { type: DashboardWidgetFactory }, { type: i0.ChangeDetectorRef }], propDecorators: { Configuration: [{
710
+ type: Input
711
+ }], gridItemRefs: [{
712
+ type: ViewChildren,
713
+ args: ['grid_item', { read: ViewContainerRef }]
714
+ }] } });
715
+
716
+ const Repository = {
717
+ GET_Dashboard_GetLayout: "/api/Dashboard/GetLayout",
718
+ POST_Dashboard_SaveLayout: "/api/Dashboard/SaveLayout",
719
+ GET_Dashboard_GetWidgetData: "/api/Dashboard/GetWidgetData"
720
+ };
721
+
722
+ class DashboardFeatureAPIDataService {
723
+ constructor(http) {
724
+ this.http = http;
725
+ }
726
+ GetUserDashboard(backendid, idaccount, dashboardName) {
727
+ let params = new HttpParams();
728
+ params = params.append("backendid", backendid.toString());
729
+ params = params.append("idaccount", idaccount.toString());
730
+ params = params.append("name", dashboardName);
731
+ return this.http.get(Repository["GET_Dashboard_GetLayout"], params);
732
+ }
733
+ SaveUserDashboard(dto) {
734
+ return this.http.post(Repository["POST_Dashboard_SaveLayout"], dto);
735
+ }
736
+ GetWidgetData(backendid, name, options) {
737
+ let params = new HttpParams();
738
+ params = params.append("backendid", backendid.toString());
739
+ params = params.append("name", name.toString());
740
+ if (options && Object.keys(options).length != 0) {
741
+ for (let index = 0; index < Object.keys(options).length; index++) {
742
+ const k = Object.keys(options)[index];
743
+ params = params.append(k, options[k]);
744
+ }
745
+ }
746
+ return this.http.get(Repository["GET_Dashboard_GetWidgetData"], params);
747
+ }
748
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DashboardFeatureAPIDataService, deps: [{ token: i1$2.HTTPService }], target: i0.ɵɵFactoryTarget.Injectable }); }
749
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DashboardFeatureAPIDataService }); }
750
+ }
751
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DashboardFeatureAPIDataService, decorators: [{
752
+ type: Injectable
753
+ }], ctorParameters: () => [{ type: i1$2.HTTPService }] });
754
+
755
+ const MODULES = [
756
+ // Base
757
+ CommonModule,
758
+ FormsModule,
759
+ GridsterModule,
760
+ FormsAndValidationsModule,
761
+ EsChartsModule,
762
+ HttpserviceModule
763
+ ];
764
+ const COMPONENTS = [
765
+ DashboardComponent,
766
+ JaceListWidgetComponent,
767
+ JaceCounterWidgetComponent,
768
+ JaceChartWidgetComponent,
769
+ JaceMultiprogWidgetComponent
770
+ ];
771
+ class DashboardFeatureModule {
772
+ static forRoot(options) {
773
+ return {
774
+ ngModule: DashboardFeatureModule,
775
+ providers: [
776
+ { provide: DSH_OPTIONS, multi: true, useValue: new DefaultDashboardModuleOptions() },
777
+ { provide: DSH_OPTIONS, multi: true, useValue: options },
778
+ { provide: DSH_DATA_SERVICE, useClass: DashboardFeatureAPIDataService },
779
+ DashboardWidgetFactory
780
+ ]
781
+ };
782
+ }
783
+ constructor(componentFactory, options) {
784
+ if (!options)
785
+ return;
786
+ options.map((o) => componentFactory.addOption(o));
787
+ }
788
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DashboardFeatureModule, deps: [{ token: DashboardWidgetFactory }, { token: DSH_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
789
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: DashboardFeatureModule, declarations: [DashboardComponent,
790
+ JaceListWidgetComponent,
791
+ JaceCounterWidgetComponent,
792
+ JaceChartWidgetComponent,
793
+ JaceMultiprogWidgetComponent], imports: [
794
+ // Base
795
+ CommonModule,
796
+ FormsModule,
797
+ GridsterModule,
798
+ FormsAndValidationsModule,
799
+ EsChartsModule,
800
+ HttpserviceModule], exports: [DashboardComponent,
801
+ JaceListWidgetComponent,
802
+ JaceCounterWidgetComponent,
803
+ JaceChartWidgetComponent,
804
+ JaceMultiprogWidgetComponent] }); }
805
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DashboardFeatureModule, imports: [MODULES] }); }
806
+ }
807
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DashboardFeatureModule, decorators: [{
808
+ type: NgModule,
809
+ args: [{
810
+ declarations: [...COMPONENTS],
811
+ imports: [...MODULES],
812
+ exports: [...COMPONENTS]
813
+ }]
814
+ }], ctorParameters: () => [{ type: DashboardWidgetFactory }, { type: undefined, decorators: [{
815
+ type: Optional
816
+ }, {
817
+ type: Inject,
818
+ args: [DSH_OPTIONS]
819
+ }] }] });
820
+
821
+ /**
822
+ * Configurazione della dashboard
823
+ */
824
+ class JaceDashboardConfig {
825
+ constructor() {
826
+ /**
827
+ * Id del backend a cui verranno indirizzate le chiamate di questa dashboard.
828
+ * Deve essere uno di quelli definiti in appsetting.json del FE nella sezione **Backends**.
829
+ */
830
+ this.backendId = "default_backend";
831
+ /**
832
+ * Se questa dashboard contiene widget che mostrano dati che dipendono dalla data corrente
833
+ * mostra il controllo (datetimepicker) per variare la data in base a cui mostrare i dati.
834
+ *
835
+ * NOTA: showToolbar deve essere a true.
836
+ *
837
+ * Default = false
838
+ */
839
+ this.showDateInput = false;
840
+ /**
841
+ * Mostrare la toolbar in cima alla dashboard che contiene il titolo, il pulsante per salvare il proprio layout personalizzato
842
+ * e il picker per scegliere la data nel caso che le widget nella dashboard mostrino dati dipendenti dalla data.
843
+ *
844
+ * Default = true
845
+ */
846
+ this.showToolbar = true;
847
+ /**
848
+ * Titolo della dashboard mostrato in cima al layout all'interno della toolbar.
849
+ *
850
+ * NOTA: showToolbar deve essere a true.
851
+ *
852
+ * Default = undefined
853
+ */
854
+ this.dashboardTitle = undefined;
855
+ //default per gridster
856
+ this.gridsterConfig = {
857
+ maxCols: 10,
858
+ maxRows: 10,
859
+ minCols: 5,
860
+ minRows: 6,
861
+ defaultItemCols: 1,
862
+ defaultItemRows: 1,
863
+ disablePushOnDrag: true,
864
+ draggable: { enabled: true, ignoreContent: true },
865
+ displayGrid: "onDrag&Resize",
866
+ gridType: GridType.Fit,
867
+ resizable: { enabled: true },
868
+ /* fixedRowHeight: 164, */
869
+ setGridSize: true,
870
+ //compactType: "compactUp&Left"
871
+ /* itemChangeCallback: AppComponent.itemChange,
872
+ itemResizeCallback: AppComponent.itemResize, */
873
+ };
874
+ }
875
+ }
876
+
877
+ class JaceDashboardLayoutAppSearch extends AppSearch {
878
+ constructor() {
879
+ super(...arguments);
880
+ this.backendid = "default_backend";
881
+ }
882
+ }
883
+
884
+ //Definizione del layout della dashboard definito dal Backend
885
+ class JaceDashboardLayoutDetail {
886
+ }
887
+
888
+ /**
889
+ * Classe di base astratta per la creazione di Widget custom.
890
+ */
891
+ class BaseWidgetComponent {
892
+ constructor(dshService) {
893
+ this.dshService = dshService;
894
+ this.OnRemove = new EventEmitter();
895
+ this.configuration = false;
896
+ this.dataReady = false;
897
+ this.lastdate = "";
898
+ }
899
+ setWidgetModel(dshBackendId, widgetModel) {
900
+ this.model = widgetModel;
901
+ if (this.model.backendid === undefined || this.model.backendid == "default_backend")
902
+ this.model.backendid = dshBackendId;
903
+ this.refreshData();
904
+ }
905
+ ngOnInit() { }
906
+ ngOnChanges(changes) {
907
+ //console.log(changes['DashboardDate'].currentValue);
908
+ if (changes['DashboardDate'].previousValue)
909
+ this.lastdate = changes['DashboardDate'].previousValue.toISOString();
910
+ let curdate = "";
911
+ if (changes['DashboardDate'].currentValue)
912
+ curdate = changes['DashboardDate'].currentValue.toISOString();
913
+ //fix per il datetimepicker material che cambia l'oggetto al momento del caricamento
914
+ if (this.lastdate != curdate) {
915
+ this.lastdate = curdate;
916
+ this.refreshData();
917
+ }
918
+ }
919
+ /**
920
+ * Prepara i parametri e lancia la chiamata GetWidgetData della DashboardFeatureService.
921
+ * Imposta il model con i dati restituiti (setData) e imposta la variabile dataReady del campo a true
922
+ */
923
+ refreshData() {
924
+ if (!this.model)
925
+ return;
926
+ const pars = {};
927
+ if (this.DashboardDate)
928
+ pars["DT"] = this.DashboardDate.toISOString();
929
+ if (this.model.options && Object.keys(this.model.options).length != 0) {
930
+ for (let index = 0; index < Object.keys(this.model.options).length; index++) {
931
+ const k = Object.keys(this.model.options)[index];
932
+ pars[k] = this.model.options[k];
933
+ }
934
+ }
935
+ this.prepareGetDataParameters(pars);
936
+ this.dshService.GetWidgetData(this.model.backendid, this.model.name, pars).subscribe(data => {
937
+ if (this.model) {
938
+ this.model.setData(data);
939
+ this.dataReady = true;
940
+ }
941
+ });
942
+ }
943
+ /**
944
+ * Da chiamare quando l'utente preme il pulsante 'rimuovi' nella toolbar della widget.
945
+ */
946
+ removeWidget() {
947
+ if (!this.model)
948
+ return;
949
+ this.OnRemove.emit(this.model.name);
950
+ }
951
+ /**
952
+ * Da chiamare quando viene premuto il pulsante 'configure' nella toolbar della widget
953
+ */
954
+ configureWidget() {
955
+ if (this.configuration) {
956
+ //finito di configurare -> refreshData
957
+ this.refreshData();
958
+ }
959
+ this.configuration = !this.configuration;
960
+ }
961
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: BaseWidgetComponent, deps: [{ token: DSH_DATA_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable }); }
962
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: BaseWidgetComponent }); }
963
+ }
964
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: BaseWidgetComponent, decorators: [{
965
+ type: Injectable
966
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
967
+ type: Inject,
968
+ args: [DSH_DATA_SERVICE]
969
+ }] }] });
970
+
971
+ var JaceWidgetTypes;
972
+ (function (JaceWidgetTypes) {
973
+ JaceWidgetTypes["CHART"] = "CHART";
974
+ JaceWidgetTypes["COUNTER"] = "COUNTER";
975
+ JaceWidgetTypes["LIST"] = "LIST";
976
+ JaceWidgetTypes["MULTIPROGRESS"] = "MULTIPROGRESS";
977
+ })(JaceWidgetTypes || (JaceWidgetTypes = {}));
978
+
979
+ /*
980
+ * Public API Surface of dashboard-feature
981
+ */
982
+
983
+ /**
984
+ * Generated bundle index. Do not edit.
985
+ */
986
+
987
+ export { BaseJaceWidgetModel, BaseWidgetComponent, DSH_DATA_SERVICE, DashboardComponent, DashboardFeatureAPIDataService, DashboardFeatureModule, DashboardWidgetFactory, DefaultDashboardModuleOptions, JaceChartWidgetComponent, JaceCounterWidgetComponent, JaceDashboardConfig, JaceDashboardLayoutAppSearch, JaceDashboardLayoutDetail, JaceListWidgetComponent, JaceMultiprogWidgetComponent, JaceWidgetInstanceDetail, JaceWidgetTypes, SaveJaceDashboardLayoutDTO };
988
+ //# sourceMappingURL=esfaenza-dashboard-feature.mjs.map