@esfaenza/dashboard-feature 15.2.14 → 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 -38
  24. package/lib/models/widgets/IJaceWidgetModel.d.ts +33 -39
  25. package/lib/models/widgets/JaceChartWidgetModel.d.ts +8 -14
  26. package/lib/models/widgets/JaceCounterWidgetModel.d.ts +10 -18
  27. package/lib/models/widgets/JaceListWidgetModel.d.ts +16 -27
  28. package/lib/models/widgets/JaceMultiprogWidgetModel.d.ts +9 -15
  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 -38
  56. package/esm2020/lib/models/widgets/IJaceWidgetModel.mjs +0 -2
  57. package/esm2020/lib/models/widgets/JaceChartWidgetModel.mjs +0 -29
  58. package/esm2020/lib/models/widgets/JaceCounterWidgetModel.mjs +0 -29
  59. package/esm2020/lib/models/widgets/JaceListWidgetModel.mjs +0 -48
  60. package/esm2020/lib/models/widgets/JaceMultiprogWidgetModel.mjs +0 -32
  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 -1076
  67. package/fesm2015/esfaenza-dashboard-feature.mjs.map +0 -1
  68. package/fesm2020/esfaenza-dashboard-feature.mjs +0 -1059
  69. package/fesm2020/esfaenza-dashboard-feature.mjs.map +0 -1
@@ -1,1059 +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
- const BaseJaceWidgetConstants = {
348
- ITEMS: "items",
349
- QUERYERROR: "queryerror",
350
- OPTIONS: "options"
351
- };
352
- class BaseJaceWidgetModel {
353
- constructor() {
354
- this.backendid = "default_backend";
355
- this.resizeEnabled = false;
356
- this.dataError = false;
357
- this.options = {};
358
- }
359
- configureFromInstanceDetails(details) {
360
- this.name = details.name;
361
- this.widgetType = details.type;
362
- this.title = details.title;
363
- this.x = details.x;
364
- this.y = details.y;
365
- this.cols = details.cols;
366
- this.rows = details.rows;
367
- this.compactEnabled = details.compactenabled;
368
- this.dragEnabled = details.dragenabled;
369
- this.options = details.options;
370
- this.dataError = details.queryerror;
371
- this.resizeEnabled = details.resizeenabled;
372
- this.backendid = details.backendid ?? "default_backend";
373
- }
374
- setData(data) {
375
- if (!data)
376
- return;
377
- if (data[BaseJaceWidgetConstants.QUERYERROR])
378
- this.dataError = data[BaseJaceWidgetConstants.QUERYERROR];
379
- //TODO se sono specificate opzioni, inizializzare la configurazione
380
- //chiamata per le impostazioni specifiche
381
- this.setWidgetData(data);
382
- }
383
- }
384
-
385
- const JaceChartWidgetConstants = {
386
- TYPE: "CHART",
387
- DATAFIELD_LEGEND: 'legend',
388
- DATAFIELD_CHART_TYPE: 'charttype',
389
- DATAFIELD_CHART_DATA: 'chartdata',
390
- };
391
- class JaceChartWidgetModel extends BaseJaceWidgetModel {
392
- constructor() {
393
- super();
394
- this.chartType = 'line';
395
- this.legend = false;
396
- this.widgetType = JaceChartWidgetConstants.TYPE;
397
- }
398
- setWidgetData(data) {
399
- if (data[JaceChartWidgetConstants.DATAFIELD_LEGEND])
400
- this.legend = data[JaceChartWidgetConstants.DATAFIELD_LEGEND];
401
- else
402
- this.legend = true;
403
- if (data[JaceChartWidgetConstants.DATAFIELD_CHART_TYPE])
404
- this.chartType = data[JaceChartWidgetConstants.DATAFIELD_CHART_TYPE];
405
- if (data[JaceChartWidgetConstants.DATAFIELD_CHART_DATA]) {
406
- this.chartData = data[JaceChartWidgetConstants.DATAFIELD_CHART_DATA];
407
- }
408
- if (this.options && this.options[JaceChartWidgetConstants.DATAFIELD_LEGEND] == undefined)
409
- this.options[JaceChartWidgetConstants.DATAFIELD_LEGEND] = true;
410
- }
411
- }
412
-
413
- const JaceCounterWidgetConstants = {
414
- TYPE: "COUNTER",
415
- DATAFIELD_SUPERTEXT: "supertext",
416
- DATAFIELD_SUBTEXT: "subtext",
417
- DATAFIELD_VALUE: "value",
418
- DATAFIELD_ICON: "icon",
419
- DATAFIELD_UNIT: "unit",
420
- };
421
- class JaceCounterWidgetModel extends BaseJaceWidgetModel {
422
- constructor() {
423
- super();
424
- this.superText = undefined;
425
- this.subText = undefined;
426
- this.value = 0;
427
- this.icon = undefined;
428
- this.unit = undefined;
429
- this.widgetType = JaceCounterWidgetConstants.TYPE;
430
- }
431
- setWidgetData(data) {
432
- this.superText = data[JaceCounterWidgetConstants.DATAFIELD_SUPERTEXT];
433
- this.subText = data[JaceCounterWidgetConstants.DATAFIELD_SUBTEXT];
434
- this.value = data[JaceCounterWidgetConstants.DATAFIELD_VALUE];
435
- this.icon = data[JaceCounterWidgetConstants.DATAFIELD_ICON];
436
- this.options = data[BaseJaceWidgetConstants.OPTIONS];
437
- this.unit = data[JaceCounterWidgetConstants.DATAFIELD_UNIT];
438
- }
439
- }
440
-
441
- class JaceListItemWidget {
442
- }
443
- const JaceListWidgetConstants = {
444
- TYPE: "LIST",
445
- DATAFIELD_SUPERTEXT: "supertext",
446
- DATAFIELD_ID: "id",
447
- DATAFIELD_DESCRIPTION: "description",
448
- DATAFIELD_SUBLINE: "subline",
449
- DATAFIELD_CLASSES: "classes",
450
- DATAFIELD_ID_PARAM_NAME: "idparamname",
451
- DATAFIELD_LINK: "link",
452
- DATAFIELD_SHOWID: "showId"
453
- };
454
- class JaceListWidgetModel extends BaseJaceWidgetModel {
455
- constructor() {
456
- super();
457
- this.superText = undefined;
458
- this.items = [];
459
- this.widgetType = JaceListWidgetConstants.TYPE;
460
- }
461
- setWidgetData(data) {
462
- this.superText = data[JaceListWidgetConstants.DATAFIELD_SUPERTEXT];
463
- if (data[BaseJaceWidgetConstants.ITEMS]) {
464
- const d = data[BaseJaceWidgetConstants.ITEMS];
465
- this.items = [];
466
- for (let index = 0; index < d.length; index++) {
467
- const item = new JaceListItemWidget();
468
- const element = d[index];
469
- if (element[JaceListWidgetConstants.DATAFIELD_ID])
470
- item.id = element[JaceListWidgetConstants.DATAFIELD_ID];
471
- if (element[JaceListWidgetConstants.DATAFIELD_SHOWID])
472
- item.showId = element[JaceListWidgetConstants.DATAFIELD_SHOWID];
473
- if (element[JaceListWidgetConstants.DATAFIELD_ID_PARAM_NAME])
474
- item.idParamName = element[JaceListWidgetConstants.DATAFIELD_ID_PARAM_NAME];
475
- if (element[JaceListWidgetConstants.DATAFIELD_LINK])
476
- item.link = element[JaceListWidgetConstants.DATAFIELD_LINK];
477
- if (element[JaceListWidgetConstants.DATAFIELD_SUBLINE])
478
- item.subline = element[JaceListWidgetConstants.DATAFIELD_SUBLINE];
479
- if (element[JaceListWidgetConstants.DATAFIELD_CLASSES])
480
- item.classes = element[JaceListWidgetConstants.DATAFIELD_CLASSES];
481
- item.description = element.description;
482
- this.items.push(item);
483
- }
484
- }
485
- }
486
- }
487
-
488
- const JaceMultiprogWidgetConstants = {
489
- TYPE: "MULTIPROGRESS",
490
- DATAFIELD_TITLES: "progresstitles",
491
- DATAFIELD_VALUES: "progressvalues",
492
- DATAFIELD_AS_CIRCLES: "circleprogress",
493
- };
494
- class JaceMultiprogWidgetModel extends BaseJaceWidgetModel {
495
- constructor() {
496
- super();
497
- this.resizeEnabled = true;
498
- this.progressTitles = [];
499
- this.progressValues = [];
500
- this.circleProgress = false;
501
- this.widgetType = JaceMultiprogWidgetConstants.TYPE;
502
- }
503
- setWidgetData(data) {
504
- this.progressTitles = data[JaceMultiprogWidgetConstants.DATAFIELD_TITLES] ?? [];
505
- this.progressValues = data[JaceMultiprogWidgetConstants.DATAFIELD_VALUES] ?? [];
506
- this.circleProgress = data[JaceMultiprogWidgetConstants.DATAFIELD_AS_CIRCLES];
507
- this.options = data[BaseJaceWidgetConstants.OPTIONS] ?? {};
508
- if (this.circleProgress === undefined)
509
- this.circleProgress = true;
510
- if (this.cols === undefined && this.progressValues) {
511
- if (this.progressValues.length == 1)
512
- this.cols = 1;
513
- else
514
- this.cols = 2;
515
- }
516
- }
517
- }
518
-
519
- class DefaultDashboardModuleOptions {
520
- constructor() {
521
- this.widgetTypes = [
522
- {
523
- name: "COUNTER",
524
- component: JaceCounterWidgetComponent,
525
- model: JaceCounterWidgetModel
526
- },
527
- {
528
- name: "LIST",
529
- component: JaceListWidgetComponent,
530
- model: JaceListWidgetModel
531
- },
532
- {
533
- name: "CHART",
534
- component: JaceChartWidgetComponent,
535
- model: JaceChartWidgetModel
536
- },
537
- {
538
- name: "MULTIPROGRESS",
539
- component: JaceMultiprogWidgetComponent,
540
- model: JaceMultiprogWidgetModel
541
- }
542
- ];
543
- }
544
- }
545
-
546
- class DashboardWidgetFactory {
547
- constructor() {
548
- this.types = {};
549
- }
550
- addOption(option) {
551
- if (option.widgetTypes) {
552
- option.widgetTypes.forEach((o) => {
553
- this.types[o.name] = o;
554
- });
555
- }
556
- }
557
- /**
558
- * Versione ng13+ della creazione dei componenti dinamici delle widget
559
- * @param type
560
- * @param vcr
561
- * @returns
562
- */
563
- resolveComponent(type, vcr) {
564
- if (!this.types)
565
- return null;
566
- let t = this.types[type];
567
- if (!t)
568
- return null;
569
- let componentRef = vcr.createComponent(t.component);
570
- return componentRef;
571
- }
572
- resolveDefinition(type, details) {
573
- if (!this.types)
574
- return null;
575
- let t = this.types[type];
576
- if (!t)
577
- return null;
578
- let definitionInstance = this.createInstance(t.model);
579
- definitionInstance.configureFromInstanceDetails(details);
580
- return definitionInstance;
581
- }
582
- createInstance(type) {
583
- return new type();
584
- }
585
- }
586
- DashboardWidgetFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardWidgetFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
587
- DashboardWidgetFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardWidgetFactory, providedIn: "root" });
588
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardWidgetFactory, decorators: [{
589
- type: Injectable,
590
- args: [{ providedIn: "root" }]
591
- }], ctorParameters: function () { return []; } });
592
-
593
- class SaveJaceDashboardLayoutDTO {
594
- constructor() {
595
- this.backendid = "default_backend";
596
- }
597
- }
598
-
599
- //Definizione della widget restituita dal backend
600
- class JaceWidgetInstanceDetail {
601
- constructor() {
602
- this.queryerror = false;
603
- }
604
- }
605
-
606
- /**
607
- * Componente di base che rappresenta una dashboard.
608
- * Utilizza Gridster2 per il layout delle widget [Gridster2](https://tiberiuzuld.github.io/angular-gridster2/)
609
- */
610
- class DashboardComponent {
611
- constructor(dshService, intercom, route, cmpFactory, cdr) {
612
- this.dshService = dshService;
613
- this.intercom = intercom;
614
- this.route = route;
615
- this.cmpFactory = cmpFactory;
616
- this.cdr = cdr;
617
- this.dashboardDate = new Date();
618
- this.widgetDefinitions = [];
619
- this.trackedSubscriptions = [];
620
- this.destroySignal$ = new Subject();
621
- this.intercom.send(InboundMessageTypes.Navigation, { sub: false, routeTitle: this.route.snapshot.data["title"] });
622
- }
623
- ngOnInit() { }
624
- ngAfterViewInit() {
625
- //qui this.gridItemRefs è 'riempito'
626
- // sottoscrivo changes che sparerà tutte le volte che ngFor si aggiorna (ovvero quando cambia dashboard)
627
- this.changesSub = this.gridItemRefs.changes.pipe(takeUntil(this.destroySignal$)).subscribe((comps) => {
628
- this.renderLayout(comps);
629
- });
630
- //prima volta
631
- //setTimeout(()=>this.reloadData(),500);
632
- this.trackedSubscriptions.push(timer(500).pipe(takeUntil(this.destroySignal$), map(() => this.reloadData())).subscribe());
633
- }
634
- ngOnDestroy() {
635
- //unsubscribe dalle changes dei viewref
636
- if (this.changesSub)
637
- this.changesSub.unsubscribe();
638
- this.clearTrackedSubscriptions();
639
- this.destroySignal$.next();
640
- this.destroySignal$.complete();
641
- }
642
- clearTrackedSubscriptions() {
643
- if (this.trackedSubscriptions) {
644
- for (let index = 0; index < this.trackedSubscriptions.length; index++) {
645
- const element = this.trackedSubscriptions[index];
646
- element.unsubscribe();
647
- }
648
- this.trackedSubscriptions = [];
649
- }
650
- }
651
- ngOnChanges(changes) {
652
- //occhio: arriva prima di ngAfterViewInit
653
- if (changes.Configuration) {
654
- //appena ho configuration
655
- console.log(changes.Configuration);
656
- // la prima volta l'ho già fatta alla creazione del componente
657
- if (!changes.Configuration.firstChange) {
658
- this.reloadData();
659
- }
660
- }
661
- }
662
- reloadData() {
663
- if (!this.Configuration)
664
- return;
665
- this.dshService.GetUserDashboard(this.Configuration.backendId, this.Configuration.accountId, this.Configuration.dashboardName).pipe(takeUntil(this.destroySignal$)).subscribe(c => {
666
- this.dashboardLayout = c;
667
- this.widgetDefinitions = c.widgets.map(i => {
668
- return this.cmpFactory.resolveDefinition(i.type, i);
669
- });
670
- });
671
- }
672
- removeItem(widgetName) {
673
- if (!this.dashboardLayout)
674
- return;
675
- let idx = this.dashboardLayout.widgets.findIndex(s => s.name == widgetName);
676
- this.widgetDefinitions.splice(idx, 1);
677
- }
678
- saveDashboard() {
679
- if (!this.dashboardLayout)
680
- return;
681
- const dto = new SaveJaceDashboardLayoutDTO();
682
- dto.backendid = this.Configuration.backendId;
683
- dto.widgets = [];
684
- for (let index = 0; index < this.widgetDefinitions.length; index++) {
685
- const w = this.widgetDefinitions[index];
686
- if (w == null)
687
- continue;
688
- let v = new JaceWidgetInstanceDetail();
689
- v.id = w.id;
690
- v.name = w.name;
691
- v.x = w.x;
692
- v.y = w.y;
693
- v.cols = w.cols;
694
- v.rows = w.rows;
695
- v.compactenabled = w.compactEnabled;
696
- v.dragenabled = w.dragEnabled;
697
- v.resizeenabled = w.resizeEnabled;
698
- v.type = w.widgetType;
699
- v.title = w.title;
700
- v.options = w.options;
701
- dto.widgets.push(v);
702
- }
703
- this.dshService.SaveUserDashboard(dto).subscribe(res => {
704
- if (res.success)
705
- console.log('Dashboard saved');
706
- });
707
- }
708
- renderLayout(comps) {
709
- this.clearTrackedSubscriptions();
710
- comps.map((host, index) => {
711
- const vcr = host;
712
- vcr.clear();
713
- const widgetData = this.widgetDefinitions[index];
714
- if (!widgetData || !widgetData.widgetType)
715
- return;
716
- let componentRef;
717
- componentRef = this.cmpFactory.resolveComponent(widgetData?.widgetType, vcr);
718
- if (!componentRef) {
719
- console.log(`Tipo widget sconosciuto ${widgetData.widgetType}`);
720
- return;
721
- }
722
- //setta l'input della data
723
- if (this.Configuration.showDateInput)
724
- componentRef.instance.DashboardDate = this.dashboardDate;
725
- //setta il modello
726
- componentRef.instance.setWidgetModel(this.Configuration.backendId, widgetData);
727
- //setta la callback per OnRemove
728
- let s = componentRef.instance.OnRemove.pipe(takeUntil(this.destroySignal$)).subscribe(name => this.removeItem(name));
729
- this.trackedSubscriptions.push(s);
730
- //componentRef.changeDetectorRef.markForCheck();
731
- //componentRef.changeDetectorRef.detectChanges();
732
- });
733
- this.cdr.detectChanges();
734
- }
735
- addItem() {
736
- //this.dashboard.push({});
737
- }
738
- }
739
- 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 });
740
- 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 });
741
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardComponent, decorators: [{
742
- type: Component,
743
- 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"] }]
744
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
745
- type: Inject,
746
- args: [DSH_DATA_SERVICE]
747
- }] }, { type: i1$1.InterComService }, { type: i1.ActivatedRoute }, { type: DashboardWidgetFactory }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { Configuration: [{
748
- type: Input
749
- }], gridItemRefs: [{
750
- type: ViewChildren,
751
- args: ['grid_item', { read: ViewContainerRef }]
752
- }] } });
753
-
754
- const Repository = {
755
- GET_Dashboard_GetLayout: "/api/Dashboard/GetLayout",
756
- POST_Dashboard_SaveLayout: "/api/Dashboard/SaveLayout",
757
- GET_Dashboard_GetWidgetData: "/api/Dashboard/GetWidgetData"
758
- };
759
-
760
- class DashboardFeatureAPIDataService {
761
- constructor(http) {
762
- this.http = http;
763
- }
764
- /**
765
- * Recupera la dashboard specificata dal backend specificato per l'account specificato.
766
- * Usata dal component DashboardComponent
767
- * @param backendid id del backend che pubblica questa dashboard
768
- * @param idaccount idaccount dell'utente che sta visitando questa dashboard
769
- * @param dashboardName identificativo della dashboard da recuperare
770
- * @returns JaceDashboardLayoutDetail layout della dashboard
771
- */
772
- GetUserDashboard(backendid, idaccount, dashboardName) {
773
- let params = new HttpParams();
774
- params = params.append("backendid", backendid.toString());
775
- params = params.append("idaccount", idaccount.toString());
776
- params = params.append("name", dashboardName);
777
- return this.http.get(Repository["GET_Dashboard_GetLayout"], params);
778
- }
779
- /**
780
- *Salva le impostazioni della dashboard (es. preferenze specifiche dell'utente)
781
- * @param dto dati di salvataggio
782
- * @returns CallResult
783
- */
784
- SaveUserDashboard(dto) {
785
- return this.http.post(Repository["POST_Dashboard_SaveLayout"], dto);
786
- }
787
- /**
788
- * Recupera i dati di una specifica Widget. Chiamato dal metodo refreshData() di BaseWidgetComponent.
789
- * @param backendid id del backend che pubblica i dati di questa Widget
790
- * @param name nome univoco di questa Widget
791
- * @param options dizionario di configurazioni impostate sulla specifica Widget (aka configurazioni particolari)
792
- * @returns Un oggetto any con i dati della Widget (Nota: ogni Widget è responsabile di interpretare i propri dati)
793
- */
794
- GetWidgetData(backendid, name, options) {
795
- let params = new HttpParams();
796
- params = params.append("backendid", backendid.toString());
797
- params = params.append("name", name.toString());
798
- if (options && Object.keys(options).length != 0) {
799
- for (let index = 0; index < Object.keys(options).length; index++) {
800
- const k = Object.keys(options)[index];
801
- params = params.append(k, options[k]);
802
- }
803
- }
804
- return this.http.get(Repository["GET_Dashboard_GetWidgetData"], params);
805
- }
806
- }
807
- 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 });
808
- DashboardFeatureAPIDataService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardFeatureAPIDataService });
809
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardFeatureAPIDataService, decorators: [{
810
- type: Injectable
811
- }], ctorParameters: function () { return [{ type: i1$2.HTTPService }]; } });
812
-
813
- const MODULES = [
814
- // Base
815
- CommonModule,
816
- FormsModule,
817
- GridsterModule,
818
- MatProgressBarModule,
819
- FormsAndValidationsModule,
820
- EsChartsModule,
821
- HttpserviceModule,
822
- NgCircleProgressModule.forRoot({
823
- radius: 50,
824
- outerStrokeWidth: 8,
825
- innerStrokeWidth: 4,
826
- outerStrokeColor: "#78C000",
827
- innerStrokeColor: "#C7E596",
828
- animationDuration: 300
829
- })
830
- ];
831
- const COMPONENTS = [
832
- DashboardComponent,
833
- JaceListWidgetComponent,
834
- JaceCounterWidgetComponent,
835
- JaceChartWidgetComponent,
836
- JaceMultiprogWidgetComponent
837
- ];
838
- class DashboardFeatureModule {
839
- static forRoot(options) {
840
- return {
841
- ngModule: DashboardFeatureModule,
842
- providers: [
843
- { provide: DSH_OPTIONS, multi: true, useValue: new DefaultDashboardModuleOptions() },
844
- { provide: DSH_OPTIONS, multi: true, useValue: options },
845
- { provide: DSH_DATA_SERVICE, useClass: DashboardFeatureAPIDataService },
846
- DashboardWidgetFactory
847
- ]
848
- };
849
- }
850
- constructor(componentFactory, options) {
851
- if (!options)
852
- return;
853
- options.map((o) => componentFactory.addOption(o));
854
- }
855
- }
856
- 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 });
857
- DashboardFeatureModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: DashboardFeatureModule, declarations: [DashboardComponent,
858
- JaceListWidgetComponent,
859
- JaceCounterWidgetComponent,
860
- JaceChartWidgetComponent,
861
- JaceMultiprogWidgetComponent], imports: [
862
- // Base
863
- CommonModule,
864
- FormsModule,
865
- GridsterModule,
866
- MatProgressBarModule,
867
- FormsAndValidationsModule,
868
- EsChartsModule,
869
- HttpserviceModule, i4.NgCircleProgressModule], exports: [DashboardComponent,
870
- JaceListWidgetComponent,
871
- JaceCounterWidgetComponent,
872
- JaceChartWidgetComponent,
873
- JaceMultiprogWidgetComponent] });
874
- DashboardFeatureModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardFeatureModule, imports: [MODULES] });
875
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DashboardFeatureModule, decorators: [{
876
- type: NgModule,
877
- args: [{
878
- declarations: [...COMPONENTS],
879
- imports: [...MODULES],
880
- exports: [...COMPONENTS]
881
- }]
882
- }], ctorParameters: function () { return [{ type: DashboardWidgetFactory }, { type: undefined, decorators: [{
883
- type: Optional
884
- }, {
885
- type: Inject,
886
- args: [DSH_OPTIONS]
887
- }] }]; } });
888
-
889
- /**
890
- * Configurazione della dashboard
891
- */
892
- class JaceDashboardConfig {
893
- constructor() {
894
- /**
895
- * Id del backend a cui verranno indirizzate le chiamate di questa dashboard.
896
- * Deve essere uno di quelli definiti in appsetting.json del FE nella sezione **Backends**.
897
- */
898
- this.backendId = "default_backend";
899
- /**
900
- * Se questa dashboard contiene widget che mostrano dati che dipendono dalla data corrente
901
- * mostra il controllo (datetimepicker) per variare la data in base a cui mostrare i dati.
902
- *
903
- * NOTA: showToolbar deve essere a true.
904
- *
905
- * Default = false
906
- */
907
- this.showDateInput = false;
908
- /**
909
- * Mostrare la toolbar in cima alla dashboard che contiene il titolo, il pulsante per salvare il proprio layout personalizzato
910
- * e il picker per scegliere la data nel caso che le widget nella dashboard mostrino dati dipendenti dalla data.
911
- *
912
- * Default = true
913
- */
914
- this.showToolbar = true;
915
- /**
916
- * Titolo della dashboard mostrato in cima al layout all'interno della toolbar.
917
- *
918
- * NOTA: showToolbar deve essere a true.
919
- *
920
- * Default = undefined
921
- */
922
- this.dashboardTitle = undefined;
923
- //default per gridster
924
- this.gridsterConfig = {
925
- maxCols: 10,
926
- maxRows: 10,
927
- minCols: 5,
928
- minRows: 6,
929
- defaultItemCols: 1,
930
- defaultItemRows: 1,
931
- disablePushOnDrag: true,
932
- draggable: { enabled: true, ignoreContent: true },
933
- displayGrid: "onDrag&Resize",
934
- gridType: GridType.Fit,
935
- resizable: { enabled: true },
936
- /* fixedRowHeight: 164, */
937
- setGridSize: true,
938
- //compactType: "compactUp&Left"
939
- /* itemChangeCallback: AppComponent.itemChange,
940
- itemResizeCallback: AppComponent.itemResize, */
941
- };
942
- }
943
- }
944
-
945
- class JaceDashboardLayoutAppSearch extends AppSearch {
946
- constructor() {
947
- super(...arguments);
948
- this.backendid = "default_backend";
949
- }
950
- }
951
-
952
- //Definizione del layout della dashboard definito dal Backend
953
- class JaceDashboardLayoutDetail {
954
- }
955
-
956
- /**
957
- * Classe di base astratta per la creazione di Widget custom.
958
- */
959
- class BaseWidgetComponent {
960
- constructor(dshService) {
961
- this.dshService = dshService;
962
- this.OnRemove = new EventEmitter();
963
- this.configuration = false;
964
- this.dataReady = false;
965
- this.lastdate = "";
966
- }
967
- setWidgetModel(dshBackendId, widgetModel) {
968
- this.model = widgetModel;
969
- if (this.model.backendid === undefined || this.model.backendid == "default_backend")
970
- this.model.backendid = dshBackendId;
971
- this.refreshData();
972
- }
973
- ngOnInit() { }
974
- /**
975
- * Ascolta i cambiamenti sull'input DashboardDate e, se è cambiata, lancia refreshData()
976
- */
977
- ngOnChanges(changes) {
978
- //console.log(changes['DashboardDate'].currentValue);
979
- if (changes['DashboardDate'].previousValue)
980
- this.lastdate = changes['DashboardDate'].previousValue.toISOString();
981
- let curdate = "";
982
- if (changes['DashboardDate'].currentValue)
983
- curdate = changes['DashboardDate'].currentValue.toISOString();
984
- //fix per il datetimepicker material che cambia l'oggetto al momento del caricamento
985
- if (this.lastdate != curdate) {
986
- this.lastdate = curdate;
987
- this.refreshData();
988
- }
989
- }
990
- /**
991
- * Prepara i parametri e lancia la chiamata GetWidgetData della service DashboardFeatureService.
992
- * Imposta il model con i dati restituiti (setData) ed imposta il campo dataReady del component a true
993
- */
994
- refreshData() {
995
- if (!this.model)
996
- return;
997
- const pars = {};
998
- if (this.DashboardDate)
999
- pars["DT"] = this.DashboardDate.toISOString();
1000
- if (this.model.options && Object.keys(this.model.options).length != 0) {
1001
- for (let index = 0; index < Object.keys(this.model.options).length; index++) {
1002
- const k = Object.keys(this.model.options)[index];
1003
- pars[k] = this.model.options[k];
1004
- }
1005
- }
1006
- this.prepareGetDataParameters(pars);
1007
- this.dshService.GetWidgetData(this.model.backendid, this.model.name, pars).subscribe(data => {
1008
- if (this.model) {
1009
- this.model.setData(data);
1010
- this.dataReady = true;
1011
- }
1012
- });
1013
- }
1014
- /**
1015
- * Da chiamare quando l'utente preme il pulsante 'rimuovi' nella toolbar della widget.
1016
- */
1017
- removeWidget() {
1018
- if (!this.model)
1019
- return;
1020
- this.OnRemove.emit(this.model.name);
1021
- }
1022
- /**
1023
- * Da chiamare quando viene premuto il pulsante 'configure' nella toolbar della widget
1024
- */
1025
- configureWidget() {
1026
- if (this.configuration) {
1027
- //finito di configurare -> refreshData
1028
- this.refreshData();
1029
- }
1030
- this.configuration = !this.configuration;
1031
- }
1032
- }
1033
- 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 });
1034
- BaseWidgetComponent.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BaseWidgetComponent });
1035
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BaseWidgetComponent, decorators: [{
1036
- type: Injectable
1037
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1038
- type: Inject,
1039
- args: [DSH_DATA_SERVICE]
1040
- }] }]; } });
1041
-
1042
- var JaceWidgetTypes;
1043
- (function (JaceWidgetTypes) {
1044
- JaceWidgetTypes["CHART"] = "CHART";
1045
- JaceWidgetTypes["COUNTER"] = "COUNTER";
1046
- JaceWidgetTypes["LIST"] = "LIST";
1047
- JaceWidgetTypes["MULTIPROGRESS"] = "MULTIPROGRESS";
1048
- })(JaceWidgetTypes || (JaceWidgetTypes = {}));
1049
-
1050
- /*
1051
- * Public API Surface of dashboard-feature
1052
- */
1053
-
1054
- /**
1055
- * Generated bundle index. Do not edit.
1056
- */
1057
-
1058
- export { BaseJaceWidgetConstants, BaseJaceWidgetModel, BaseWidgetComponent, DSH_DATA_SERVICE, DSH_OPTIONS, DashboardComponent, DashboardFeatureAPIDataService, DashboardFeatureModule, DashboardWidgetFactory, DefaultDashboardModuleOptions, JaceChartWidgetComponent, JaceCounterWidgetComponent, JaceDashboardConfig, JaceDashboardLayoutAppSearch, JaceDashboardLayoutDetail, JaceListWidgetComponent, JaceMultiprogWidgetComponent, JaceWidgetInstanceDetail, JaceWidgetTypes, SaveJaceDashboardLayoutDTO };
1059
- //# sourceMappingURL=esfaenza-dashboard-feature.mjs.map