@esfaenza/dashboard-feature 15.2.14 → 19.2.1

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