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