@esfaenza/dashboard-feature 11.2.2

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 (71) hide show
  1. package/README.md +24 -0
  2. package/bundles/esfaenza-dashboard-feature.umd.js +1328 -0
  3. package/bundles/esfaenza-dashboard-feature.umd.js.map +1 -0
  4. package/bundles/esfaenza-dashboard-feature.umd.min.js +2 -0
  5. package/bundles/esfaenza-dashboard-feature.umd.min.js.map +1 -0
  6. package/esfaenza-dashboard-feature.d.ts +8 -0
  7. package/esfaenza-dashboard-feature.metadata.json +1 -0
  8. package/esm2015/esfaenza-dashboard-feature.js +9 -0
  9. package/esm2015/lib/components/dashboard/dashboard.component.js +157 -0
  10. package/esm2015/lib/components/dashboard/dashboard.component.loc.js +16 -0
  11. package/esm2015/lib/components/widgets/BaseWidgetComponent.js +81 -0
  12. package/esm2015/lib/components/widgets/IWidgetComponent.js +2 -0
  13. package/esm2015/lib/components/widgets/JaceWidgetTypes.js +8 -0
  14. package/esm2015/lib/components/widgets/chart/jace-dsh-chart.component.js +77 -0
  15. package/esm2015/lib/components/widgets/counter/jace-dsh-counter.component.js +76 -0
  16. package/esm2015/lib/components/widgets/list/jace-dsh-list.component.js +89 -0
  17. package/esm2015/lib/components/widgets/multiprog/jace-dsh-multiprog.component.js +78 -0
  18. package/esm2015/lib/dashboard-feature.module.js +98 -0
  19. package/esm2015/lib/models/config/JaceDashboardConfig.js +49 -0
  20. package/esm2015/lib/models/externals/JaceDashboardLayoutDetail.js +4 -0
  21. package/esm2015/lib/models/externals/JaceWidgetInstanceDetail.js +7 -0
  22. package/esm2015/lib/models/externals/Repository.js +6 -0
  23. package/esm2015/lib/models/externals/SaveJaceDashboardLayoutDTO.js +3 -0
  24. package/esm2015/lib/models/options/DefaultDashboardModuleOptions.js +36 -0
  25. package/esm2015/lib/models/options/IDashboardModuleOptions.js +2 -0
  26. package/esm2015/lib/models/options/IWidgetTypeConfig.js +2 -0
  27. package/esm2015/lib/models/widgets/BaseJaceWidgetModel.js +22 -0
  28. package/esm2015/lib/models/widgets/IJaceWidgetModel.js +2 -0
  29. package/esm2015/lib/models/widgets/JaceChartWidgetModel.js +27 -0
  30. package/esm2015/lib/models/widgets/JaceCounterWidgetModel.js +23 -0
  31. package/esm2015/lib/models/widgets/JaceListWidgetModel.js +39 -0
  32. package/esm2015/lib/models/widgets/JaceMultiprogWidgetModel.js +29 -0
  33. package/esm2015/lib/private-injection-tokens.js +3 -0
  34. package/esm2015/lib/public-injection-tokens.js +15 -0
  35. package/esm2015/lib/services/DashboardWidgetFactory.js +66 -0
  36. package/esm2015/lib/services/IDashboardFeatureDataService.js +2 -0
  37. package/esm2015/lib/services/dashboard-feature.service.js +39 -0
  38. package/esm2015/public-api.js +20 -0
  39. package/fesm2015/esfaenza-dashboard-feature.js +955 -0
  40. package/fesm2015/esfaenza-dashboard-feature.js.map +1 -0
  41. package/lib/components/dashboard/dashboard.component.d.ts +44 -0
  42. package/lib/components/dashboard/dashboard.component.loc.d.ts +5 -0
  43. package/lib/components/widgets/BaseWidgetComponent.d.ts +41 -0
  44. package/lib/components/widgets/IWidgetComponent.d.ts +23 -0
  45. package/lib/components/widgets/JaceWidgetTypes.d.ts +6 -0
  46. package/lib/components/widgets/chart/jace-dsh-chart.component.d.ts +22 -0
  47. package/lib/components/widgets/counter/jace-dsh-counter.component.d.ts +21 -0
  48. package/lib/components/widgets/list/jace-dsh-list.component.d.ts +24 -0
  49. package/lib/components/widgets/multiprog/jace-dsh-multiprog.component.d.ts +23 -0
  50. package/lib/dashboard-feature.module.d.ts +8 -0
  51. package/lib/models/config/JaceDashboardConfig.d.ts +46 -0
  52. package/lib/models/externals/JaceDashboardLayoutDetail.d.ts +6 -0
  53. package/lib/models/externals/JaceWidgetInstanceDetail.d.ts +17 -0
  54. package/lib/models/externals/Repository.d.ts +5 -0
  55. package/lib/models/externals/SaveJaceDashboardLayoutDTO.d.ts +4 -0
  56. package/lib/models/options/DefaultDashboardModuleOptions.d.ts +7 -0
  57. package/lib/models/options/IDashboardModuleOptions.d.ts +5 -0
  58. package/lib/models/options/IWidgetTypeConfig.d.ts +8 -0
  59. package/lib/models/widgets/BaseJaceWidgetModel.d.ts +31 -0
  60. package/lib/models/widgets/IJaceWidgetModel.d.ts +13 -0
  61. package/lib/models/widgets/JaceChartWidgetModel.d.ts +8 -0
  62. package/lib/models/widgets/JaceCounterWidgetModel.d.ts +10 -0
  63. package/lib/models/widgets/JaceListWidgetModel.d.ts +15 -0
  64. package/lib/models/widgets/JaceMultiprogWidgetModel.d.ts +9 -0
  65. package/lib/private-injection-tokens.d.ts +3 -0
  66. package/lib/public-injection-tokens.d.ts +15 -0
  67. package/lib/services/DashboardWidgetFactory.d.ts +20 -0
  68. package/lib/services/IDashboardFeatureDataService.d.ts +11 -0
  69. package/lib/services/dashboard-feature.service.d.ts +16 -0
  70. package/package.json +27 -0
  71. package/public-api.d.ts +16 -0
@@ -0,0 +1,1328 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('angular-gridster2'), require('@angular/material/progress-bar'), require('@angular/router'), require('@esfaenza/extensions'), require('@esfaenza/localizations'), require('@esfaenza/forms-and-validations'), require('@esfaenza/es-charts'), require('ng-circle-progress'), require('@esfaenza/httpservice'), require('@angular/common/http')) :
3
+ typeof define === 'function' && define.amd ? define('@esfaenza/dashboard-feature', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'angular-gridster2', '@angular/material/progress-bar', '@angular/router', '@esfaenza/extensions', '@esfaenza/localizations', '@esfaenza/forms-and-validations', '@esfaenza/es-charts', 'ng-circle-progress', '@esfaenza/httpservice', '@angular/common/http'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esfaenza = global.esfaenza || {}, global.esfaenza['dashboard-feature'] = {}), global.ng.core, global.ng.common, global.ng.forms, global.angularGridster2, global.ng.material.progressBar, global.ng.router, global.extensions, global.localizations, global.formsAndValidations, global.esCharts, global.ngCircleProgress, global.httpservice, global.ng.common.http));
5
+ }(this, (function (exports, i0, common, forms, angularGridster2, progressBar, router, extensions, localizations, formsAndValidations, esCharts, ngCircleProgress, httpservice, http) { 'use strict';
6
+
7
+ /**
8
+ * Injection Token della stringa che rappresenta il 'locale' nel sistema @es-faenza/localization
9
+ */
10
+ var DSH_LOCALE = new i0.InjectionToken('DSH_LOCALE');
11
+ /**
12
+ * Injection Token dell'url del FE
13
+ */
14
+ var DSH_BACKEND_URL = new i0.InjectionToken('DSH_BACKEND_URL');
15
+ /**
16
+ * Token di registrazione della DashboardFeatureService.
17
+ * Permette di fare l'override dell'implementazione di default a scopo di test delle widget
18
+ */
19
+ var DSH_DATA_SERVICE = new i0.InjectionToken('DSH_DATA_SERVICE');
20
+
21
+ /******************************************************************************
22
+ Copyright (c) Microsoft Corporation.
23
+
24
+ Permission to use, copy, modify, and/or distribute this software for any
25
+ purpose with or without fee is hereby granted.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
28
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
29
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
30
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
31
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
32
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
33
+ PERFORMANCE OF THIS SOFTWARE.
34
+ ***************************************************************************** */
35
+ /* global Reflect, Promise */
36
+ var extendStatics = function (d, b) {
37
+ extendStatics = Object.setPrototypeOf ||
38
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
39
+ function (d, b) { for (var p in b)
40
+ if (Object.prototype.hasOwnProperty.call(b, p))
41
+ d[p] = b[p]; };
42
+ return extendStatics(d, b);
43
+ };
44
+ function __extends(d, b) {
45
+ if (typeof b !== "function" && b !== null)
46
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
47
+ extendStatics(d, b);
48
+ function __() { this.constructor = d; }
49
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
50
+ }
51
+ var __assign = function () {
52
+ __assign = Object.assign || function __assign(t) {
53
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
54
+ s = arguments[i];
55
+ for (var p in s)
56
+ if (Object.prototype.hasOwnProperty.call(s, p))
57
+ t[p] = s[p];
58
+ }
59
+ return t;
60
+ };
61
+ return __assign.apply(this, arguments);
62
+ };
63
+ function __rest(s, e) {
64
+ var t = {};
65
+ for (var p in s)
66
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
67
+ t[p] = s[p];
68
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
69
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
70
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
71
+ t[p[i]] = s[p[i]];
72
+ }
73
+ return t;
74
+ }
75
+ function __decorate(decorators, target, key, desc) {
76
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
77
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
78
+ r = Reflect.decorate(decorators, target, key, desc);
79
+ else
80
+ for (var i = decorators.length - 1; i >= 0; i--)
81
+ if (d = decorators[i])
82
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
83
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
84
+ }
85
+ function __param(paramIndex, decorator) {
86
+ return function (target, key) { decorator(target, key, paramIndex); };
87
+ }
88
+ function __metadata(metadataKey, metadataValue) {
89
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
90
+ return Reflect.metadata(metadataKey, metadataValue);
91
+ }
92
+ function __awaiter(thisArg, _arguments, P, generator) {
93
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
94
+ return new (P || (P = Promise))(function (resolve, reject) {
95
+ function fulfilled(value) { try {
96
+ step(generator.next(value));
97
+ }
98
+ catch (e) {
99
+ reject(e);
100
+ } }
101
+ function rejected(value) { try {
102
+ step(generator["throw"](value));
103
+ }
104
+ catch (e) {
105
+ reject(e);
106
+ } }
107
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
108
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
109
+ });
110
+ }
111
+ function __generator(thisArg, body) {
112
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
113
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
114
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
115
+ function verb(n) { return function (v) { return step([n, v]); }; }
116
+ function step(op) {
117
+ if (f)
118
+ throw new TypeError("Generator is already executing.");
119
+ while (_)
120
+ try {
121
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
122
+ return t;
123
+ if (y = 0, t)
124
+ op = [op[0] & 2, t.value];
125
+ switch (op[0]) {
126
+ case 0:
127
+ case 1:
128
+ t = op;
129
+ break;
130
+ case 4:
131
+ _.label++;
132
+ return { value: op[1], done: false };
133
+ case 5:
134
+ _.label++;
135
+ y = op[1];
136
+ op = [0];
137
+ continue;
138
+ case 7:
139
+ op = _.ops.pop();
140
+ _.trys.pop();
141
+ continue;
142
+ default:
143
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
144
+ _ = 0;
145
+ continue;
146
+ }
147
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
148
+ _.label = op[1];
149
+ break;
150
+ }
151
+ if (op[0] === 6 && _.label < t[1]) {
152
+ _.label = t[1];
153
+ t = op;
154
+ break;
155
+ }
156
+ if (t && _.label < t[2]) {
157
+ _.label = t[2];
158
+ _.ops.push(op);
159
+ break;
160
+ }
161
+ if (t[2])
162
+ _.ops.pop();
163
+ _.trys.pop();
164
+ continue;
165
+ }
166
+ op = body.call(thisArg, _);
167
+ }
168
+ catch (e) {
169
+ op = [6, e];
170
+ y = 0;
171
+ }
172
+ finally {
173
+ f = t = 0;
174
+ }
175
+ if (op[0] & 5)
176
+ throw op[1];
177
+ return { value: op[0] ? op[1] : void 0, done: true };
178
+ }
179
+ }
180
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
181
+ if (k2 === undefined)
182
+ k2 = k;
183
+ var desc = Object.getOwnPropertyDescriptor(m, k);
184
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
185
+ desc = { enumerable: true, get: function () { return m[k]; } };
186
+ }
187
+ Object.defineProperty(o, k2, desc);
188
+ }) : (function (o, m, k, k2) {
189
+ if (k2 === undefined)
190
+ k2 = k;
191
+ o[k2] = m[k];
192
+ });
193
+ function __exportStar(m, o) {
194
+ for (var p in m)
195
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
196
+ __createBinding(o, m, p);
197
+ }
198
+ function __values(o) {
199
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
200
+ if (m)
201
+ return m.call(o);
202
+ if (o && typeof o.length === "number")
203
+ return {
204
+ next: function () {
205
+ if (o && i >= o.length)
206
+ o = void 0;
207
+ return { value: o && o[i++], done: !o };
208
+ }
209
+ };
210
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
211
+ }
212
+ function __read(o, n) {
213
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
214
+ if (!m)
215
+ return o;
216
+ var i = m.call(o), r, ar = [], e;
217
+ try {
218
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
219
+ ar.push(r.value);
220
+ }
221
+ catch (error) {
222
+ e = { error: error };
223
+ }
224
+ finally {
225
+ try {
226
+ if (r && !r.done && (m = i["return"]))
227
+ m.call(i);
228
+ }
229
+ finally {
230
+ if (e)
231
+ throw e.error;
232
+ }
233
+ }
234
+ return ar;
235
+ }
236
+ /** @deprecated */
237
+ function __spread() {
238
+ for (var ar = [], i = 0; i < arguments.length; i++)
239
+ ar = ar.concat(__read(arguments[i]));
240
+ return ar;
241
+ }
242
+ /** @deprecated */
243
+ function __spreadArrays() {
244
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
245
+ s += arguments[i].length;
246
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
247
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
248
+ r[k] = a[j];
249
+ return r;
250
+ }
251
+ function __spreadArray(to, from, pack) {
252
+ if (pack || arguments.length === 2)
253
+ for (var i = 0, l = from.length, ar; i < l; i++) {
254
+ if (ar || !(i in from)) {
255
+ if (!ar)
256
+ ar = Array.prototype.slice.call(from, 0, i);
257
+ ar[i] = from[i];
258
+ }
259
+ }
260
+ return to.concat(ar || Array.prototype.slice.call(from));
261
+ }
262
+ function __await(v) {
263
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
264
+ }
265
+ function __asyncGenerator(thisArg, _arguments, generator) {
266
+ if (!Symbol.asyncIterator)
267
+ throw new TypeError("Symbol.asyncIterator is not defined.");
268
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
269
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
270
+ function verb(n) { if (g[n])
271
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
272
+ function resume(n, v) { try {
273
+ step(g[n](v));
274
+ }
275
+ catch (e) {
276
+ settle(q[0][3], e);
277
+ } }
278
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
279
+ function fulfill(value) { resume("next", value); }
280
+ function reject(value) { resume("throw", value); }
281
+ function settle(f, v) { if (f(v), q.shift(), q.length)
282
+ resume(q[0][0], q[0][1]); }
283
+ }
284
+ function __asyncDelegator(o) {
285
+ var i, p;
286
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
287
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
288
+ }
289
+ function __asyncValues(o) {
290
+ if (!Symbol.asyncIterator)
291
+ throw new TypeError("Symbol.asyncIterator is not defined.");
292
+ var m = o[Symbol.asyncIterator], i;
293
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
294
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
295
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
296
+ }
297
+ function __makeTemplateObject(cooked, raw) {
298
+ if (Object.defineProperty) {
299
+ Object.defineProperty(cooked, "raw", { value: raw });
300
+ }
301
+ else {
302
+ cooked.raw = raw;
303
+ }
304
+ return cooked;
305
+ }
306
+ ;
307
+ var __setModuleDefault = Object.create ? (function (o, v) {
308
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
309
+ }) : function (o, v) {
310
+ o["default"] = v;
311
+ };
312
+ function __importStar(mod) {
313
+ if (mod && mod.__esModule)
314
+ return mod;
315
+ var result = {};
316
+ if (mod != null)
317
+ for (var k in mod)
318
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
319
+ __createBinding(result, mod, k);
320
+ __setModuleDefault(result, mod);
321
+ return result;
322
+ }
323
+ function __importDefault(mod) {
324
+ return (mod && mod.__esModule) ? mod : { default: mod };
325
+ }
326
+ function __classPrivateFieldGet(receiver, state, kind, f) {
327
+ if (kind === "a" && !f)
328
+ throw new TypeError("Private accessor was defined without a getter");
329
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
330
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
331
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
332
+ }
333
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
334
+ if (kind === "m")
335
+ throw new TypeError("Private method is not writable");
336
+ if (kind === "a" && !f)
337
+ throw new TypeError("Private accessor was defined without a setter");
338
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
339
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
340
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
341
+ }
342
+ function __classPrivateFieldIn(state, receiver) {
343
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
344
+ throw new TypeError("Cannot use 'in' operator on non-object");
345
+ return typeof state === "function" ? receiver === state : state.has(receiver);
346
+ }
347
+
348
+ var DSH_OPTIONS = new i0.InjectionToken('DSH_MODULE_OPTIONS');
349
+
350
+ var JaceChartWidgetComponent = /** @class */ (function () {
351
+ function JaceChartWidgetComponent(dshService) {
352
+ this.dshService = dshService;
353
+ this.OnRemove = new i0.EventEmitter();
354
+ this.configuration = false;
355
+ this.dataReady = false;
356
+ this.lastdate = "";
357
+ this.chartName = "";
358
+ }
359
+ JaceChartWidgetComponent.prototype.setWidgetModel = function (widgetModel) {
360
+ this.model = widgetModel;
361
+ this.refreshData();
362
+ };
363
+ JaceChartWidgetComponent.prototype.ngOnInit = function () { };
364
+ JaceChartWidgetComponent.prototype.ngOnChanges = function (changes) {
365
+ //console.log(changes['DashboardDate'].currentValue);
366
+ if (changes['DashboardDate'].previousValue)
367
+ this.lastdate = changes['DashboardDate'].previousValue.toISOString();
368
+ var curdate = "";
369
+ if (changes['DashboardDate'].currentValue)
370
+ curdate = changes['DashboardDate'].currentValue.toISOString();
371
+ //fix per il datetimepicker material che cambia l'oggetto al momento del caricamento
372
+ if (this.lastdate != curdate) {
373
+ this.lastdate = curdate;
374
+ this.refreshData();
375
+ }
376
+ };
377
+ JaceChartWidgetComponent.prototype.refreshData = function () {
378
+ var _this = this;
379
+ if (!this.model)
380
+ return;
381
+ var pars = {};
382
+ if (this.DashboardDate)
383
+ pars["DT"] = this.DashboardDate.toISOString();
384
+ if (this.model.options && Object.keys(this.model.options).length != 0) {
385
+ for (var index = 0; index < Object.keys(this.model.options).length; index++) {
386
+ var k = Object.keys(this.model.options)[index];
387
+ pars[k] = this.model.options[k];
388
+ }
389
+ }
390
+ this.dshService.GetWidgetData(this.model.name, pars).subscribe(function (data) {
391
+ if (_this.model) {
392
+ _this.model.setData(data);
393
+ _this.chartName = _this.model.name;
394
+ _this.dataReady = true;
395
+ }
396
+ });
397
+ };
398
+ JaceChartWidgetComponent.prototype.removeWidget = function () {
399
+ if (!this.model)
400
+ return;
401
+ this.OnRemove.emit(this.model.name);
402
+ };
403
+ JaceChartWidgetComponent.prototype.configure = function () {
404
+ if (this.configuration) {
405
+ //finito di configurare -> refreshData
406
+ this.refreshData();
407
+ }
408
+ this.configuration = !this.configuration;
409
+ };
410
+ return JaceChartWidgetComponent;
411
+ }());
412
+ JaceChartWidgetComponent.decorators = [
413
+ { type: i0.Component, args: [{
414
+ selector: 'jace-dsh-chart',
415
+ 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>",
416
+ styles: [""]
417
+ },] }
418
+ ];
419
+ JaceChartWidgetComponent.ctorParameters = function () { return [
420
+ { type: undefined, decorators: [{ type: i0.Inject, args: [DSH_DATA_SERVICE,] }] }
421
+ ]; };
422
+ JaceChartWidgetComponent.propDecorators = {
423
+ DashboardDate: [{ type: i0.Input }],
424
+ OnRemove: [{ type: i0.Output }]
425
+ };
426
+
427
+ var JaceCounterWidgetComponent = /** @class */ (function () {
428
+ function JaceCounterWidgetComponent(dshService) {
429
+ this.dshService = dshService;
430
+ this.OnRemove = new i0.EventEmitter();
431
+ this.configuration = false;
432
+ this.dataReady = false;
433
+ this.lastdate = "";
434
+ }
435
+ JaceCounterWidgetComponent.prototype.setWidgetModel = function (widgetModel) {
436
+ this.model = widgetModel;
437
+ this.refreshData();
438
+ };
439
+ JaceCounterWidgetComponent.prototype.ngOnInit = function () { };
440
+ JaceCounterWidgetComponent.prototype.ngOnChanges = function (changes) {
441
+ //console.log(changes['DashboardDate'].currentValue);
442
+ if (changes['DashboardDate'].previousValue)
443
+ this.lastdate = changes['DashboardDate'].previousValue.toISOString();
444
+ var curdate = "";
445
+ if (changes['DashboardDate'].currentValue)
446
+ curdate = changes['DashboardDate'].currentValue.toISOString();
447
+ //fix per il datetimepicker material che cambia l'oggetto al momento del caricamento
448
+ if (this.lastdate != curdate) {
449
+ this.lastdate = curdate;
450
+ this.refreshData();
451
+ }
452
+ };
453
+ JaceCounterWidgetComponent.prototype.refreshData = function () {
454
+ var _this = this;
455
+ if (!this.model)
456
+ return;
457
+ var pars = {};
458
+ if (this.DashboardDate)
459
+ pars["DT"] = this.DashboardDate.toISOString();
460
+ if (this.model.options && Object.keys(this.model.options).length != 0) {
461
+ for (var index = 0; index < Object.keys(this.model.options).length; index++) {
462
+ var k = Object.keys(this.model.options)[index];
463
+ pars[k] = this.model.options[k];
464
+ }
465
+ }
466
+ this.dshService.GetWidgetData(this.model.name, pars).subscribe(function (data) {
467
+ if (_this.model) {
468
+ _this.model.setData(data);
469
+ _this.dataReady = true;
470
+ }
471
+ });
472
+ };
473
+ JaceCounterWidgetComponent.prototype.removeWidget = function () {
474
+ if (!this.model)
475
+ return;
476
+ this.OnRemove.emit(this.model.name);
477
+ };
478
+ JaceCounterWidgetComponent.prototype.configure = function () {
479
+ if (this.configuration) {
480
+ //finito di configurare -> refreshData
481
+ this.refreshData();
482
+ }
483
+ this.configuration = !this.configuration;
484
+ };
485
+ return JaceCounterWidgetComponent;
486
+ }());
487
+ JaceCounterWidgetComponent.decorators = [
488
+ { type: i0.Component, args: [{
489
+ selector: 'jace-dsh-counter',
490
+ 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>",
491
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
492
+ 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}"]
493
+ },] }
494
+ ];
495
+ JaceCounterWidgetComponent.ctorParameters = function () { return [
496
+ { type: undefined, decorators: [{ type: i0.Inject, args: [DSH_DATA_SERVICE,] }] }
497
+ ]; };
498
+ JaceCounterWidgetComponent.propDecorators = {
499
+ DashboardDate: [{ type: i0.Input }],
500
+ OnRemove: [{ type: i0.Output }]
501
+ };
502
+
503
+ var JaceListWidgetComponent = /** @class */ (function () {
504
+ function JaceListWidgetComponent(dshService, router) {
505
+ this.dshService = dshService;
506
+ this.router = router;
507
+ this.OnRemove = new i0.EventEmitter();
508
+ this.configuration = false;
509
+ this.dataReady = false;
510
+ this.lastdate = "";
511
+ }
512
+ JaceListWidgetComponent.prototype.setWidgetModel = function (widgetModel) {
513
+ this.model = widgetModel;
514
+ this.refreshData();
515
+ };
516
+ JaceListWidgetComponent.prototype.ngOnInit = function () { };
517
+ JaceListWidgetComponent.prototype.ngOnChanges = function (changes) {
518
+ //console.log(changes['DashboardDate'].currentValue);
519
+ if (changes['DashboardDate'].previousValue)
520
+ this.lastdate = changes['DashboardDate'].previousValue.toISOString();
521
+ var curdate = "";
522
+ if (changes['DashboardDate'].currentValue)
523
+ curdate = changes['DashboardDate'].currentValue.toISOString();
524
+ //fix per il datetimepicker material che cambia l'oggetto al momento del caricamento
525
+ if (this.lastdate != curdate) {
526
+ this.lastdate = curdate;
527
+ this.refreshData();
528
+ }
529
+ };
530
+ JaceListWidgetComponent.prototype.refreshData = function () {
531
+ var _this = this;
532
+ if (!this.model)
533
+ return;
534
+ var pars = {};
535
+ if (this.DashboardDate)
536
+ pars["DT"] = this.DashboardDate.toISOString();
537
+ if (this.model.options && Object.keys(this.model.options).length != 0) {
538
+ for (var index = 0; index < Object.keys(this.model.options).length; index++) {
539
+ var k = Object.keys(this.model.options)[index];
540
+ pars[k] = this.model.options[k];
541
+ }
542
+ }
543
+ this.dshService.GetWidgetData(this.model.name, pars).subscribe(function (data) {
544
+ if (_this.model) {
545
+ _this.model.setData(data);
546
+ _this.dataReady = true;
547
+ }
548
+ });
549
+ };
550
+ JaceListWidgetComponent.prototype.removeWidget = function () {
551
+ if (!this.model)
552
+ return;
553
+ this.OnRemove.emit(this.model.name);
554
+ };
555
+ JaceListWidgetComponent.prototype.itemClicked = function (item) {
556
+ if (item.link) {
557
+ //naviga al link
558
+ var to = item.link;
559
+ var par = {};
560
+ if (item.id && item.idParamName) {
561
+ par[item.idParamName] = item.id;
562
+ }
563
+ this.router.navigate([to, par]);
564
+ }
565
+ };
566
+ JaceListWidgetComponent.prototype.configure = function () {
567
+ if (this.configuration) {
568
+ //finito di configurare -> refreshData
569
+ this.refreshData();
570
+ }
571
+ this.configuration = !this.configuration;
572
+ };
573
+ return JaceListWidgetComponent;
574
+ }());
575
+ JaceListWidgetComponent.decorators = [
576
+ { type: i0.Component, args: [{
577
+ selector: 'jace-dsh-list',
578
+ 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.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>",
579
+ 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}"]
580
+ },] }
581
+ ];
582
+ JaceListWidgetComponent.ctorParameters = function () { return [
583
+ { type: undefined, decorators: [{ type: i0.Inject, args: [DSH_DATA_SERVICE,] }] },
584
+ { type: router.Router }
585
+ ]; };
586
+ JaceListWidgetComponent.propDecorators = {
587
+ DashboardDate: [{ type: i0.Input }],
588
+ OnRemove: [{ type: i0.Output }]
589
+ };
590
+
591
+ var JaceMultiprogWidgetComponent = /** @class */ (function () {
592
+ function JaceMultiprogWidgetComponent(dshService, router) {
593
+ this.dshService = dshService;
594
+ this.router = router;
595
+ this.OnRemove = new i0.EventEmitter();
596
+ this.configuration = false;
597
+ this.dataReady = false;
598
+ this.lastdate = "";
599
+ }
600
+ JaceMultiprogWidgetComponent.prototype.setWidgetModel = function (widgetModel) {
601
+ this.model = widgetModel;
602
+ this.refreshData();
603
+ };
604
+ JaceMultiprogWidgetComponent.prototype.ngOnInit = function () { };
605
+ JaceMultiprogWidgetComponent.prototype.ngOnChanges = function (changes) {
606
+ //console.log(changes['DashboardDate'].currentValue);
607
+ if (changes['DashboardDate'].previousValue)
608
+ this.lastdate = changes['DashboardDate'].previousValue.toISOString();
609
+ var curdate = "";
610
+ if (changes['DashboardDate'].currentValue)
611
+ curdate = changes['DashboardDate'].currentValue.toISOString();
612
+ //fix per il datetimepicker material che cambia l'oggetto al momento del caricamento
613
+ if (this.lastdate != curdate) {
614
+ this.lastdate = curdate;
615
+ this.refreshData();
616
+ }
617
+ };
618
+ JaceMultiprogWidgetComponent.prototype.refreshData = function () {
619
+ var _this = this;
620
+ if (!this.model)
621
+ return;
622
+ var pars = {};
623
+ if (this.DashboardDate)
624
+ pars["DT"] = this.DashboardDate.toISOString();
625
+ if (this.model.options && Object.keys(this.model.options).length != 0) {
626
+ for (var index = 0; index < Object.keys(this.model.options).length; index++) {
627
+ var k = Object.keys(this.model.options)[index];
628
+ pars[k] = this.model.options[k];
629
+ }
630
+ }
631
+ this.dshService.GetWidgetData(this.model.name, pars).subscribe(function (data) {
632
+ if (_this.model) {
633
+ _this.model.setData(data);
634
+ _this.dataReady = true;
635
+ }
636
+ });
637
+ };
638
+ JaceMultiprogWidgetComponent.prototype.removeWidget = function () {
639
+ if (!this.model)
640
+ return;
641
+ this.OnRemove.emit(this.model.name);
642
+ };
643
+ JaceMultiprogWidgetComponent.prototype.configure = function () {
644
+ if (this.configuration) {
645
+ //finito di configurare -> refreshData
646
+ this.refreshData();
647
+ }
648
+ this.configuration = !this.configuration;
649
+ };
650
+ return JaceMultiprogWidgetComponent;
651
+ }());
652
+ JaceMultiprogWidgetComponent.decorators = [
653
+ { type: i0.Component, args: [{
654
+ selector: 'jace-dsh-multiprog',
655
+ 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>",
656
+ 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}"]
657
+ },] }
658
+ ];
659
+ JaceMultiprogWidgetComponent.ctorParameters = function () { return [
660
+ { type: undefined, decorators: [{ type: i0.Inject, args: [DSH_DATA_SERVICE,] }] },
661
+ { type: router.Router }
662
+ ]; };
663
+ JaceMultiprogWidgetComponent.propDecorators = {
664
+ DashboardDate: [{ type: i0.Input }],
665
+ OnRemove: [{ type: i0.Output }]
666
+ };
667
+
668
+ var BaseJaceWidgetModel = /** @class */ (function () {
669
+ function BaseJaceWidgetModel() {
670
+ this.resizeEnabled = false;
671
+ this.dataError = false;
672
+ this.options = {};
673
+ }
674
+ BaseJaceWidgetModel.prototype.configureFromInstanceDetails = function (details) {
675
+ this.name = details.name;
676
+ this.widgetType = details.type;
677
+ this.title = details.title;
678
+ this.x = details.x;
679
+ this.y = details.y;
680
+ this.cols = details.cols;
681
+ this.rows = details.rows;
682
+ this.compactEnabled = details.compactenabled;
683
+ this.dragEnabled = details.dragenabled;
684
+ this.options = details.options;
685
+ this.dataError = details.queryerror;
686
+ this.resizeEnabled = details.resizeenabled;
687
+ };
688
+ return BaseJaceWidgetModel;
689
+ }());
690
+
691
+ var JaceChartWidgetModel = /** @class */ (function (_super) {
692
+ __extends(JaceChartWidgetModel, _super);
693
+ function JaceChartWidgetModel() {
694
+ var _this = _super.call(this) || this;
695
+ _this.chartType = 'line';
696
+ _this.legend = false;
697
+ _this.widgetType = "CHART";
698
+ return _this;
699
+ }
700
+ JaceChartWidgetModel.prototype.setData = function (data) {
701
+ if (!data)
702
+ return;
703
+ if (data['queryerror'])
704
+ this.dataError = data['queryerror'];
705
+ if (data['legend'])
706
+ this.legend = data['legend'];
707
+ else
708
+ this.legend = true;
709
+ if (data['charttype'])
710
+ this.chartType = data['charttype'];
711
+ if (data['chartdata']) {
712
+ this.chartData = data['chartdata'];
713
+ }
714
+ if (this.options && this.options['legend'] == undefined)
715
+ this.options['legend'] = true;
716
+ };
717
+ return JaceChartWidgetModel;
718
+ }(BaseJaceWidgetModel));
719
+
720
+ var JaceCounterWidgetModel = /** @class */ (function (_super) {
721
+ __extends(JaceCounterWidgetModel, _super);
722
+ function JaceCounterWidgetModel() {
723
+ var _this = _super.call(this) || this;
724
+ _this.superText = undefined;
725
+ _this.subText = undefined;
726
+ _this.value = 0;
727
+ _this.icon = undefined;
728
+ _this.unit = undefined;
729
+ _this.widgetType = "COUNTER";
730
+ return _this;
731
+ }
732
+ JaceCounterWidgetModel.prototype.setData = function (data) {
733
+ if (data['queryerror'])
734
+ this.dataError = data['queryerror'];
735
+ this.superText = data['supertext'];
736
+ this.subText = data['subtext'];
737
+ this.value = data['value'];
738
+ this.icon = data['icon'];
739
+ this.options = data['options'];
740
+ this.unit = data['unit'];
741
+ };
742
+ return JaceCounterWidgetModel;
743
+ }(BaseJaceWidgetModel));
744
+
745
+ var JaceListItemWidget = /** @class */ (function () {
746
+ function JaceListItemWidget() {
747
+ }
748
+ return JaceListItemWidget;
749
+ }());
750
+ var JaceListWidgetModel = /** @class */ (function (_super) {
751
+ __extends(JaceListWidgetModel, _super);
752
+ function JaceListWidgetModel() {
753
+ var _this = _super.call(this) || this;
754
+ _this.superText = undefined;
755
+ _this.items = [];
756
+ _this.widgetType = "LIST";
757
+ return _this;
758
+ }
759
+ JaceListWidgetModel.prototype.setData = function (data) {
760
+ if (!data)
761
+ return;
762
+ if (data['queryerror'])
763
+ this.dataError = data['queryerror'];
764
+ this.superText = data['supertext'];
765
+ if (data['items']) {
766
+ var d = data['items'];
767
+ this.items = [];
768
+ for (var index = 0; index < d.length; index++) {
769
+ var item = new JaceListItemWidget();
770
+ var element = d[index];
771
+ if (element['id'])
772
+ item.id = element['id'];
773
+ if (element['idparamname'])
774
+ item.idParamName = element['idparamname'];
775
+ if (element['link'])
776
+ item.link = element['link'];
777
+ if (element['subline'])
778
+ item.subline = element['subline'];
779
+ if (element['classes'])
780
+ item.classes = element['classes'];
781
+ item.description = element.description;
782
+ this.items.push(item);
783
+ }
784
+ }
785
+ };
786
+ return JaceListWidgetModel;
787
+ }(BaseJaceWidgetModel));
788
+
789
+ var JaceMultiprogWidgetModel = /** @class */ (function (_super) {
790
+ __extends(JaceMultiprogWidgetModel, _super);
791
+ function JaceMultiprogWidgetModel() {
792
+ var _this = _super.call(this) || this;
793
+ _this.resizeEnabled = true;
794
+ _this.progressTitles = [];
795
+ _this.progressValues = [];
796
+ _this.circleProgress = false;
797
+ _this.widgetType = "MULTIPROGRESS";
798
+ return _this;
799
+ }
800
+ JaceMultiprogWidgetModel.prototype.setData = function (data) {
801
+ var _a, _b, _c;
802
+ if (data['queryerror'])
803
+ this.dataError = data['queryerror'];
804
+ this.progressTitles = (_a = data['progresstitles']) !== null && _a !== void 0 ? _a : [];
805
+ this.progressValues = (_b = data['progressvalues']) !== null && _b !== void 0 ? _b : [];
806
+ this.circleProgress = data['circleprogress'];
807
+ this.options = (_c = data['options']) !== null && _c !== void 0 ? _c : {};
808
+ if (this.circleProgress === undefined)
809
+ this.circleProgress = true;
810
+ if (this.cols === undefined && this.progressValues) {
811
+ if (this.progressValues.length == 1)
812
+ this.cols = 1;
813
+ else
814
+ this.cols = 2;
815
+ }
816
+ };
817
+ return JaceMultiprogWidgetModel;
818
+ }(BaseJaceWidgetModel));
819
+
820
+ var DefaultDashboardModuleOptions = /** @class */ (function () {
821
+ function DefaultDashboardModuleOptions() {
822
+ this.locale = "it-IT";
823
+ this.widgetTypes = [
824
+ {
825
+ name: "COUNTER",
826
+ component: JaceCounterWidgetComponent,
827
+ model: JaceCounterWidgetModel
828
+ },
829
+ {
830
+ name: "LIST",
831
+ component: JaceListWidgetComponent,
832
+ model: JaceListWidgetModel
833
+ },
834
+ {
835
+ name: "CHART",
836
+ component: JaceChartWidgetComponent,
837
+ model: JaceChartWidgetModel
838
+ },
839
+ {
840
+ name: "MULTIPROGRESS",
841
+ component: JaceMultiprogWidgetComponent,
842
+ model: JaceMultiprogWidgetModel
843
+ }
844
+ ];
845
+ }
846
+ return DefaultDashboardModuleOptions;
847
+ }());
848
+
849
+ //singleton
850
+ var DashboardWidgetFactory = /** @class */ (function () {
851
+ //verione ng 13
852
+ //constructor() { }
853
+ function DashboardWidgetFactory(componentFactoryResolver) {
854
+ this.componentFactoryResolver = componentFactoryResolver;
855
+ this.types = {};
856
+ }
857
+ DashboardWidgetFactory.prototype.addOption = function (option) {
858
+ var _this = this;
859
+ if (option.widgetTypes) {
860
+ option.widgetTypes.forEach(function (o) {
861
+ _this.types[o.name] = o;
862
+ });
863
+ }
864
+ };
865
+ //versione ng 13+
866
+ /* resolveComponent(type: string, vcr: ViewContainerRef): ComponentRef<IWidgetComponent> | null {
867
+
868
+ if (!this.types)
869
+ return null;
870
+
871
+ let t = this.types[type];
872
+
873
+ if (!t)
874
+ return null;
875
+
876
+ let componentRef: ComponentRef<IWidgetComponent> = vcr.createComponent(t.component);
877
+
878
+ return componentRef;
879
+ } */
880
+ //versione ng11
881
+ DashboardWidgetFactory.prototype.resolveComponent = function (type, vcr) {
882
+ if (!this.types)
883
+ return null;
884
+ var t = this.types[type];
885
+ if (!t)
886
+ return null;
887
+ //DEPRECATO dopo ng11: è stato tolto il meccanismo dei ComponentFactory per i componenti dinamici
888
+ var cf = this.componentFactoryResolver.resolveComponentFactory(t.component);
889
+ var componentRef = vcr.createComponent(cf);
890
+ return componentRef;
891
+ };
892
+ DashboardWidgetFactory.prototype.resolveDefinition = function (type, details) {
893
+ if (!this.types)
894
+ return null;
895
+ var t = this.types[type];
896
+ if (!t)
897
+ return null;
898
+ var definitionInstance = this.createInstance(t.model);
899
+ definitionInstance.configureFromInstanceDetails(details);
900
+ return definitionInstance;
901
+ };
902
+ DashboardWidgetFactory.prototype.createInstance = function (type) {
903
+ return new type();
904
+ };
905
+ return DashboardWidgetFactory;
906
+ }());
907
+ DashboardWidgetFactory.ɵprov = i0.ɵɵdefineInjectable({ factory: function DashboardWidgetFactory_Factory() { return new DashboardWidgetFactory(i0.ɵɵinject(i0.ComponentFactoryResolver)); }, token: DashboardWidgetFactory, providedIn: "root" });
908
+ DashboardWidgetFactory.decorators = [
909
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
910
+ ];
911
+ DashboardWidgetFactory.ctorParameters = function () { return [
912
+ { type: i0.ComponentFactoryResolver }
913
+ ]; };
914
+
915
+ var DashboardLoc = /** @class */ (function (_super) {
916
+ __extends(DashboardLoc, _super);
917
+ function DashboardLoc(options) {
918
+ var _this = _super.call(this, options.locale) || this;
919
+ _super.prototype.set.call(_this, "en->it", "Dashboard", ["Dashboard"]);
920
+ return _this;
921
+ }
922
+ return DashboardLoc;
923
+ }(localizations.LocalizationService));
924
+ DashboardLoc.decorators = [
925
+ { type: i0.Injectable }
926
+ ];
927
+ DashboardLoc.ctorParameters = function () { return [
928
+ { type: undefined, decorators: [{ type: i0.Inject, args: [DSH_OPTIONS,] }] }
929
+ ]; };
930
+
931
+ var SaveJaceDashboardLayoutDTO = /** @class */ (function () {
932
+ function SaveJaceDashboardLayoutDTO() {
933
+ }
934
+ return SaveJaceDashboardLayoutDTO;
935
+ }());
936
+
937
+ //Definizione della widget restituita dal backend
938
+ var JaceWidgetInstanceDetail = /** @class */ (function () {
939
+ function JaceWidgetInstanceDetail() {
940
+ this.queryerror = false;
941
+ }
942
+ return JaceWidgetInstanceDetail;
943
+ }());
944
+
945
+ /**
946
+ * Componente di base che rappresenta una dashboard.
947
+ * Utilizza Gridster2 per il layout delle widget [Gridster2](https://tiberiuzuld.github.io/angular-gridster2/)
948
+ */
949
+ var DashboardComponent = /** @class */ (function () {
950
+ function DashboardComponent(dshService, intercom, lc, route, cmpFactory, cdr) {
951
+ this.dshService = dshService;
952
+ this.intercom = intercom;
953
+ this.lc = lc;
954
+ this.route = route;
955
+ this.cmpFactory = cmpFactory;
956
+ this.cdr = cdr;
957
+ this.dashboardDate = new Date();
958
+ this.widgetDefinitions = [];
959
+ this.trackedSubscriptions = [];
960
+ this.intercom.send(extensions.InboundMessageTypes.Navigation, { sub: false, routeTitle: this.lc.loc(this.route.snapshot.data["title"]) });
961
+ }
962
+ DashboardComponent.prototype.ngOnInit = function () {
963
+ };
964
+ DashboardComponent.prototype.ngAfterViewInit = function () {
965
+ var _this = this;
966
+ //qui this.gridItemRefs è 'riempito'
967
+ // sottoscrivo changes che sparerà tutte le volte che ngFor si aggiorna (ovvero quando cambia dashboard)
968
+ this.changesSub = this.gridItemRefs.changes.subscribe(function (comps) {
969
+ _this.renderLayout(comps);
970
+ });
971
+ //prima volta
972
+ /* if(this.Configuration)
973
+ this.reloadData(); */
974
+ setTimeout(function () { return _this.reloadData(); }, 500);
975
+ };
976
+ DashboardComponent.prototype.ngOnDestroy = function () {
977
+ //unsubscribe dalle changes dei viewref
978
+ if (this.changesSub)
979
+ this.changesSub.unsubscribe();
980
+ this.clearTrackedSubscriptions();
981
+ };
982
+ DashboardComponent.prototype.clearTrackedSubscriptions = function () {
983
+ if (this.trackedSubscriptions) {
984
+ for (var index = 0; index < this.trackedSubscriptions.length; index++) {
985
+ var element = this.trackedSubscriptions[index];
986
+ element.unsubscribe();
987
+ }
988
+ this.trackedSubscriptions = [];
989
+ }
990
+ };
991
+ DashboardComponent.prototype.ngOnChanges = function (changes) {
992
+ if (changes.Configuration) {
993
+ //appena ho configuration
994
+ }
995
+ };
996
+ DashboardComponent.prototype.reloadData = function () {
997
+ var _this = this;
998
+ this.dshService.GetUserDashboard(this.Configuration.accountId, this.Configuration.dashboardName).subscribe(function (c) {
999
+ _this.dashboardLayout = c;
1000
+ _this.widgetDefinitions = c.widgets.map(function (i) {
1001
+ return _this.cmpFactory.resolveDefinition(i.type, i);
1002
+ });
1003
+ });
1004
+ };
1005
+ DashboardComponent.prototype.removeItem = function (widgetName) {
1006
+ if (!this.dashboardLayout)
1007
+ return;
1008
+ var idx = this.dashboardLayout.widgets.findIndex(function (s) { return s.name == widgetName; });
1009
+ this.widgetDefinitions.splice(idx, 1);
1010
+ };
1011
+ DashboardComponent.prototype.saveDashboard = function () {
1012
+ if (!this.dashboardLayout)
1013
+ return;
1014
+ var dto = new SaveJaceDashboardLayoutDTO();
1015
+ dto.widgets = [];
1016
+ for (var index = 0; index < this.widgetDefinitions.length; index++) {
1017
+ var w = this.widgetDefinitions[index];
1018
+ if (w == null)
1019
+ continue;
1020
+ var v = new JaceWidgetInstanceDetail();
1021
+ v.id = w.id;
1022
+ v.name = w.name;
1023
+ v.x = w.x;
1024
+ v.y = w.y;
1025
+ v.cols = w.cols;
1026
+ v.rows = w.rows;
1027
+ v.compactenabled = w.compactEnabled;
1028
+ v.dragenabled = w.dragEnabled;
1029
+ v.resizeenabled = w.resizeEnabled;
1030
+ v.type = w.widgetType;
1031
+ v.title = w.title;
1032
+ v.options = w.options;
1033
+ dto.widgets.push(v);
1034
+ }
1035
+ this.dshService.SaveUserDashboard(dto).subscribe(function (res) {
1036
+ if (res.success)
1037
+ console.log('Dashboard saved');
1038
+ });
1039
+ };
1040
+ DashboardComponent.prototype.renderLayout = function (comps) {
1041
+ var _this = this;
1042
+ this.clearTrackedSubscriptions();
1043
+ comps.map(function (host, index) {
1044
+ var vcr = host;
1045
+ vcr.clear();
1046
+ var widgetData = _this.widgetDefinitions[index];
1047
+ if (!widgetData || !widgetData.widgetType)
1048
+ return;
1049
+ var componentRef;
1050
+ componentRef = _this.cmpFactory.resolveComponent(widgetData === null || widgetData === void 0 ? void 0 : widgetData.widgetType, vcr);
1051
+ if (!componentRef) {
1052
+ console.log("Tipo widget sconosciuto " + widgetData.widgetType);
1053
+ return;
1054
+ }
1055
+ //setta l'input della data
1056
+ if (_this.Configuration.showDateInput)
1057
+ componentRef.instance.DashboardDate = _this.dashboardDate;
1058
+ //setta il modello
1059
+ componentRef.instance.setWidgetModel(widgetData);
1060
+ //setta la callback per OnRemove
1061
+ var s = componentRef.instance.OnRemove.subscribe(function (name) { return _this.removeItem(name); });
1062
+ _this.trackedSubscriptions.push(s);
1063
+ //componentRef.changeDetectorRef.markForCheck();
1064
+ //componentRef.changeDetectorRef.detectChanges();
1065
+ });
1066
+ this.cdr.detectChanges();
1067
+ };
1068
+ DashboardComponent.prototype.addItem = function () {
1069
+ //this.dashboard.push({});
1070
+ };
1071
+ return DashboardComponent;
1072
+ }());
1073
+ DashboardComponent.decorators = [
1074
+ { type: i0.Component, args: [{
1075
+ selector: 'dashboard',
1076
+ encapsulation: i0.ViewEncapsulation.None,
1077
+ providers: [
1078
+ { provide: localizations.LocalizationService, useClass: DashboardLoc }
1079
+ ],
1080
+ 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>",
1081
+ 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:1px solid #ddd;border-radius:5px;min-width:204px}.jace-dsh-widget-header{margin:0 .5rem;display:flex;flex-flow:row;justify-content:left;align-items:center}.jace-dsh-widget-title{padding:.5rem .2rem .3rem;border-bottom:1px solid #ddd;text-transform:uppercase;font-size:.8rem}.jace-dsh-widget-body{margin:0 .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:0;right:0;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}"]
1082
+ },] }
1083
+ ];
1084
+ DashboardComponent.ctorParameters = function () { return [
1085
+ { type: undefined, decorators: [{ type: i0.Inject, args: [DSH_DATA_SERVICE,] }] },
1086
+ { type: extensions.InterComService },
1087
+ { type: localizations.LocalizationService },
1088
+ { type: router.ActivatedRoute },
1089
+ { type: DashboardWidgetFactory },
1090
+ { type: i0.ChangeDetectorRef }
1091
+ ]; };
1092
+ DashboardComponent.propDecorators = {
1093
+ Configuration: [{ type: i0.Input }],
1094
+ gridItemRefs: [{ type: i0.ViewChildren, args: ['grid_item', { read: i0.ViewContainerRef },] }]
1095
+ };
1096
+
1097
+ var Repository = {
1098
+ GET_Dashboard_GetLayout: "/api/Dashboard/GetLayout",
1099
+ POST_Dashboard_SaveLayout: "/api/Dashboard/SaveLayout",
1100
+ GET_Dashboard_GetWidgetData: "/api/Dashboard/GetWidgetData"
1101
+ };
1102
+
1103
+ var DashboardFeatureAPIDataService = /** @class */ (function () {
1104
+ function DashboardFeatureAPIDataService(http, backend) {
1105
+ this.http = http;
1106
+ this.backend = backend;
1107
+ }
1108
+ DashboardFeatureAPIDataService.prototype.GetUserDashboard = function (idaccount, dashboardName) {
1109
+ var params = new http.HttpParams();
1110
+ params = params.append("idaccount", idaccount.toString());
1111
+ params = params.append("name", dashboardName);
1112
+ return this.http.get(this.backend + Repository["GET_Dashboard_GetLayout"], params);
1113
+ };
1114
+ DashboardFeatureAPIDataService.prototype.SaveUserDashboard = function (dto) {
1115
+ return this.http.post(this.backend + Repository["POST_Dashboard_SaveLayout"], dto);
1116
+ };
1117
+ DashboardFeatureAPIDataService.prototype.GetWidgetData = function (name, options) {
1118
+ var params = new http.HttpParams();
1119
+ params = params.append("name", name.toString());
1120
+ if (options && Object.keys(options).length != 0) {
1121
+ for (var index = 0; index < Object.keys(options).length; index++) {
1122
+ var k = Object.keys(options)[index];
1123
+ params = params.append(k, options[k]);
1124
+ }
1125
+ }
1126
+ return this.http.get(this.backend + Repository["GET_Dashboard_GetWidgetData"], params);
1127
+ };
1128
+ return DashboardFeatureAPIDataService;
1129
+ }());
1130
+ DashboardFeatureAPIDataService.decorators = [
1131
+ { type: i0.Injectable }
1132
+ ];
1133
+ DashboardFeatureAPIDataService.ctorParameters = function () { return [
1134
+ { type: httpservice.HTTPService },
1135
+ { type: String, decorators: [{ type: i0.Inject, args: [DSH_BACKEND_URL,] }] }
1136
+ ]; };
1137
+
1138
+ var MODULES = [
1139
+ // Base
1140
+ common.CommonModule,
1141
+ forms.FormsModule,
1142
+ angularGridster2.GridsterModule,
1143
+ progressBar.MatProgressBarModule,
1144
+ formsAndValidations.FormsAndValidationsModule,
1145
+ esCharts.EsChartsModule,
1146
+ httpservice.HttpserviceModule,
1147
+ /* EsChartsModule.forRoot({
1148
+ locale: myconfig.LOCALE,
1149
+ animations: true,
1150
+ theme: 'spiritedaway',
1151
+ adapter: null,
1152
+ debugMode: false
1153
+ }), */
1154
+ ngCircleProgress.NgCircleProgressModule.forRoot({
1155
+ // set defaults here
1156
+ radius: 50,
1157
+ outerStrokeWidth: 8,
1158
+ innerStrokeWidth: 4,
1159
+ outerStrokeColor: "#78C000",
1160
+ innerStrokeColor: "#C7E596",
1161
+ animationDuration: 300
1162
+ })
1163
+ ];
1164
+ var COMPONENTS = [
1165
+ DashboardComponent,
1166
+ JaceListWidgetComponent,
1167
+ JaceCounterWidgetComponent,
1168
+ JaceChartWidgetComponent,
1169
+ JaceMultiprogWidgetComponent
1170
+ ];
1171
+ var DashboardFeatureModule = /** @class */ (function () {
1172
+ function DashboardFeatureModule(componentFactory, options) {
1173
+ if (!options) {
1174
+ //componentFactory.addOption(new DefaultDashboardModuleOptions());
1175
+ return;
1176
+ }
1177
+ options.map(function (o) { return componentFactory.addOption(o); });
1178
+ }
1179
+ DashboardFeatureModule.forRoot = function (options) {
1180
+ return {
1181
+ ngModule: DashboardFeatureModule,
1182
+ providers: [
1183
+ { provide: DSH_OPTIONS, multi: true, useValue: new DefaultDashboardModuleOptions() },
1184
+ { provide: DSH_OPTIONS, multi: true, useValue: options },
1185
+ { provide: DSH_DATA_SERVICE, useClass: DashboardFeatureAPIDataService }
1186
+ ]
1187
+ };
1188
+ };
1189
+ DashboardFeatureModule.forChild = function (options) {
1190
+ return {
1191
+ ngModule: DashboardFeatureModule,
1192
+ providers: [
1193
+ { provide: DSH_OPTIONS, multi: true, useValue: new DefaultDashboardModuleOptions() },
1194
+ { provide: DSH_OPTIONS, multi: true, useValue: options }
1195
+ ]
1196
+ };
1197
+ };
1198
+ return DashboardFeatureModule;
1199
+ }());
1200
+ DashboardFeatureModule.decorators = [
1201
+ { type: i0.NgModule, args: [{
1202
+ declarations: __spread(COMPONENTS),
1203
+ imports: __spread(MODULES),
1204
+ exports: __spread(COMPONENTS)
1205
+ },] }
1206
+ ];
1207
+ DashboardFeatureModule.ctorParameters = function () { return [
1208
+ { type: DashboardWidgetFactory },
1209
+ { type: Array, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [DSH_OPTIONS,] }] }
1210
+ ]; };
1211
+
1212
+ /**
1213
+ * Classe di base astratta per la creazione di Widget custom.
1214
+ */
1215
+ var BaseWidgetComponent = /** @class */ (function () {
1216
+ function BaseWidgetComponent(dshService) {
1217
+ this.dshService = dshService;
1218
+ this.OnRemove = new i0.EventEmitter();
1219
+ this.configuration = false;
1220
+ this.dataReady = false;
1221
+ this.lastdate = "";
1222
+ }
1223
+ BaseWidgetComponent.prototype.setWidgetModel = function (widgetModel) {
1224
+ this.model = widgetModel;
1225
+ this.refreshData();
1226
+ };
1227
+ BaseWidgetComponent.prototype.ngOnInit = function () { };
1228
+ BaseWidgetComponent.prototype.ngOnChanges = function (changes) {
1229
+ //console.log(changes['DashboardDate'].currentValue);
1230
+ if (changes['DashboardDate'].previousValue)
1231
+ this.lastdate = changes['DashboardDate'].previousValue.toISOString();
1232
+ var curdate = "";
1233
+ if (changes['DashboardDate'].currentValue)
1234
+ curdate = changes['DashboardDate'].currentValue.toISOString();
1235
+ //fix per il datetimepicker material che cambia l'oggetto al momento del caricamento
1236
+ if (this.lastdate != curdate) {
1237
+ this.lastdate = curdate;
1238
+ this.refreshData();
1239
+ }
1240
+ };
1241
+ /**
1242
+ * Prepara i parametri e lancia la chiamata GetWidgetData della DashboardFeatureService.
1243
+ * Imposta il model con i dati restituiti (setData) e imposta la variabile dataReady del campo a true
1244
+ */
1245
+ BaseWidgetComponent.prototype.refreshData = function () {
1246
+ var _this = this;
1247
+ if (!this.model)
1248
+ return;
1249
+ var pars = {};
1250
+ if (this.DashboardDate)
1251
+ pars["DT"] = this.DashboardDate.toISOString();
1252
+ if (this.model.options && Object.keys(this.model.options).length != 0) {
1253
+ for (var index = 0; index < Object.keys(this.model.options).length; index++) {
1254
+ var k = Object.keys(this.model.options)[index];
1255
+ pars[k] = this.model.options[k];
1256
+ }
1257
+ }
1258
+ this.prepareGetDataParameters(pars);
1259
+ this.dshService.GetWidgetData(this.model.name, pars).subscribe(function (data) {
1260
+ if (_this.model) {
1261
+ _this.model.setData(data);
1262
+ _this.dataReady = true;
1263
+ }
1264
+ });
1265
+ };
1266
+ /**
1267
+ * Da chiamare quando l'utente preme il pulsante 'rimuovi' nella toolbar della widget.
1268
+ */
1269
+ BaseWidgetComponent.prototype.removeWidget = function () {
1270
+ if (!this.model)
1271
+ return;
1272
+ this.OnRemove.emit(this.model.name);
1273
+ };
1274
+ /**
1275
+ * Da chiamare quando viene premuto il pulsante 'configure' nella toolbar della widget
1276
+ */
1277
+ BaseWidgetComponent.prototype.configureWidget = function () {
1278
+ if (this.configuration) {
1279
+ //finito di configurare -> refreshData
1280
+ this.refreshData();
1281
+ }
1282
+ this.configuration = !this.configuration;
1283
+ };
1284
+ return BaseWidgetComponent;
1285
+ }());
1286
+ BaseWidgetComponent.decorators = [
1287
+ { type: i0.Injectable }
1288
+ ];
1289
+ BaseWidgetComponent.ctorParameters = function () { return [
1290
+ { type: undefined, decorators: [{ type: i0.Inject, args: [DSH_DATA_SERVICE,] }] }
1291
+ ]; };
1292
+
1293
+ (function (JaceWidgetTypes) {
1294
+ JaceWidgetTypes["CHART"] = "CHART";
1295
+ JaceWidgetTypes["COUNTER"] = "COUNTER";
1296
+ JaceWidgetTypes["LIST"] = "LIST";
1297
+ JaceWidgetTypes["MULTIPROGRESS"] = "MULTIPROGRESS";
1298
+ })(exports.JaceWidgetTypes || (exports.JaceWidgetTypes = {}));
1299
+
1300
+ /*
1301
+ * Public API Surface of dashboard-feature
1302
+ */
1303
+
1304
+ /**
1305
+ * Generated bundle index. Do not edit.
1306
+ */
1307
+
1308
+ exports.BaseJaceWidgetModel = BaseJaceWidgetModel;
1309
+ exports.BaseWidgetComponent = BaseWidgetComponent;
1310
+ exports.DSH_BACKEND_URL = DSH_BACKEND_URL;
1311
+ exports.DSH_DATA_SERVICE = DSH_DATA_SERVICE;
1312
+ exports.DSH_LOCALE = DSH_LOCALE;
1313
+ exports.DashboardComponent = DashboardComponent;
1314
+ exports.DashboardFeatureModule = DashboardFeatureModule;
1315
+ exports.DefaultDashboardModuleOptions = DefaultDashboardModuleOptions;
1316
+ exports.JaceChartWidgetComponent = JaceChartWidgetComponent;
1317
+ exports.JaceCounterWidgetComponent = JaceCounterWidgetComponent;
1318
+ exports.JaceListWidgetComponent = JaceListWidgetComponent;
1319
+ exports.JaceMultiprogWidgetComponent = JaceMultiprogWidgetComponent;
1320
+ exports.ɵa = DashboardLoc;
1321
+ exports.ɵb = DSH_OPTIONS;
1322
+ exports.ɵc = DashboardWidgetFactory;
1323
+ exports.ɵd = DashboardFeatureAPIDataService;
1324
+
1325
+ Object.defineProperty(exports, '__esModule', { value: true });
1326
+
1327
+ })));
1328
+ //# sourceMappingURL=esfaenza-dashboard-feature.umd.js.map