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