@esfaenza/dashboard-feature 15.2.12 → 15.2.14

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.
@@ -344,6 +344,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
344
344
  type: Output
345
345
  }] } });
346
346
 
347
+ const BaseJaceWidgetConstants = {
348
+ ITEMS: "items",
349
+ QUERYERROR: "queryerror",
350
+ OPTIONS: "options"
351
+ };
347
352
  class BaseJaceWidgetModel {
348
353
  constructor() {
349
354
  this.backendid = "default_backend";
@@ -366,34 +371,53 @@ class BaseJaceWidgetModel {
366
371
  this.resizeEnabled = details.resizeenabled;
367
372
  this.backendid = details.backendid ?? "default_backend";
368
373
  }
374
+ setData(data) {
375
+ if (!data)
376
+ return;
377
+ if (data[BaseJaceWidgetConstants.QUERYERROR])
378
+ this.dataError = data[BaseJaceWidgetConstants.QUERYERROR];
379
+ //TODO se sono specificate opzioni, inizializzare la configurazione
380
+ //chiamata per le impostazioni specifiche
381
+ this.setWidgetData(data);
382
+ }
369
383
  }
370
384
 
385
+ const JaceChartWidgetConstants = {
386
+ TYPE: "CHART",
387
+ DATAFIELD_LEGEND: 'legend',
388
+ DATAFIELD_CHART_TYPE: 'charttype',
389
+ DATAFIELD_CHART_DATA: 'chartdata',
390
+ };
371
391
  class JaceChartWidgetModel extends BaseJaceWidgetModel {
372
392
  constructor() {
373
393
  super();
374
394
  this.chartType = 'line';
375
395
  this.legend = false;
376
- this.widgetType = "CHART";
396
+ this.widgetType = JaceChartWidgetConstants.TYPE;
377
397
  }
378
- setData(data) {
379
- if (!data)
380
- return;
381
- if (data['queryerror'])
382
- this.dataError = data['queryerror'];
383
- if (data['legend'])
384
- this.legend = data['legend'];
398
+ setWidgetData(data) {
399
+ if (data[JaceChartWidgetConstants.DATAFIELD_LEGEND])
400
+ this.legend = data[JaceChartWidgetConstants.DATAFIELD_LEGEND];
385
401
  else
386
402
  this.legend = true;
387
- if (data['charttype'])
388
- this.chartType = data['charttype'];
389
- if (data['chartdata']) {
390
- this.chartData = data['chartdata'];
403
+ if (data[JaceChartWidgetConstants.DATAFIELD_CHART_TYPE])
404
+ this.chartType = data[JaceChartWidgetConstants.DATAFIELD_CHART_TYPE];
405
+ if (data[JaceChartWidgetConstants.DATAFIELD_CHART_DATA]) {
406
+ this.chartData = data[JaceChartWidgetConstants.DATAFIELD_CHART_DATA];
391
407
  }
392
- if (this.options && this.options['legend'] == undefined)
393
- this.options['legend'] = true;
408
+ if (this.options && this.options[JaceChartWidgetConstants.DATAFIELD_LEGEND] == undefined)
409
+ this.options[JaceChartWidgetConstants.DATAFIELD_LEGEND] = true;
394
410
  }
395
411
  }
396
412
 
413
+ const JaceCounterWidgetConstants = {
414
+ TYPE: "COUNTER",
415
+ DATAFIELD_SUPERTEXT: "supertext",
416
+ DATAFIELD_SUBTEXT: "subtext",
417
+ DATAFIELD_VALUE: "value",
418
+ DATAFIELD_ICON: "icon",
419
+ DATAFIELD_UNIT: "unit",
420
+ };
397
421
  class JaceCounterWidgetModel extends BaseJaceWidgetModel {
398
422
  constructor() {
399
423
  super();
@@ -402,51 +426,58 @@ class JaceCounterWidgetModel extends BaseJaceWidgetModel {
402
426
  this.value = 0;
403
427
  this.icon = undefined;
404
428
  this.unit = undefined;
405
- this.widgetType = "COUNTER";
429
+ this.widgetType = JaceCounterWidgetConstants.TYPE;
406
430
  }
407
- setData(data) {
408
- if (data['queryerror'])
409
- this.dataError = data['queryerror'];
410
- this.superText = data['supertext'];
411
- this.subText = data['subtext'];
412
- this.value = data['value'];
413
- this.icon = data['icon'];
414
- this.options = data['options'];
415
- this.unit = data['unit'];
431
+ setWidgetData(data) {
432
+ this.superText = data[JaceCounterWidgetConstants.DATAFIELD_SUPERTEXT];
433
+ this.subText = data[JaceCounterWidgetConstants.DATAFIELD_SUBTEXT];
434
+ this.value = data[JaceCounterWidgetConstants.DATAFIELD_VALUE];
435
+ this.icon = data[JaceCounterWidgetConstants.DATAFIELD_ICON];
436
+ this.options = data[BaseJaceWidgetConstants.OPTIONS];
437
+ this.unit = data[JaceCounterWidgetConstants.DATAFIELD_UNIT];
416
438
  }
417
439
  }
418
440
 
419
441
  class JaceListItemWidget {
420
442
  }
443
+ const JaceListWidgetConstants = {
444
+ TYPE: "LIST",
445
+ DATAFIELD_SUPERTEXT: "supertext",
446
+ DATAFIELD_ID: "id",
447
+ DATAFIELD_DESCRIPTION: "description",
448
+ DATAFIELD_SUBLINE: "subline",
449
+ DATAFIELD_CLASSES: "classes",
450
+ DATAFIELD_ID_PARAM_NAME: "idparamname",
451
+ DATAFIELD_LINK: "link",
452
+ DATAFIELD_SHOWID: "showId"
453
+ };
421
454
  class JaceListWidgetModel extends BaseJaceWidgetModel {
422
455
  constructor() {
423
456
  super();
424
457
  this.superText = undefined;
425
458
  this.items = [];
426
- this.widgetType = "LIST";
459
+ this.widgetType = JaceListWidgetConstants.TYPE;
427
460
  }
428
- setData(data) {
429
- if (!data)
430
- return;
431
- if (data['queryerror'])
432
- this.dataError = data['queryerror'];
433
- this.superText = data['supertext'];
434
- if (data['items']) {
435
- const d = data['items'];
461
+ setWidgetData(data) {
462
+ this.superText = data[JaceListWidgetConstants.DATAFIELD_SUPERTEXT];
463
+ if (data[BaseJaceWidgetConstants.ITEMS]) {
464
+ const d = data[BaseJaceWidgetConstants.ITEMS];
436
465
  this.items = [];
437
466
  for (let index = 0; index < d.length; index++) {
438
467
  const item = new JaceListItemWidget();
439
468
  const element = d[index];
440
- if (element['id'])
441
- item.id = element['id'];
442
- if (element['idparamname'])
443
- item.idParamName = element['idparamname'];
444
- if (element['link'])
445
- item.link = element['link'];
446
- if (element['subline'])
447
- item.subline = element['subline'];
448
- if (element['classes'])
449
- item.classes = element['classes'];
469
+ if (element[JaceListWidgetConstants.DATAFIELD_ID])
470
+ item.id = element[JaceListWidgetConstants.DATAFIELD_ID];
471
+ if (element[JaceListWidgetConstants.DATAFIELD_SHOWID])
472
+ item.showId = element[JaceListWidgetConstants.DATAFIELD_SHOWID];
473
+ if (element[JaceListWidgetConstants.DATAFIELD_ID_PARAM_NAME])
474
+ item.idParamName = element[JaceListWidgetConstants.DATAFIELD_ID_PARAM_NAME];
475
+ if (element[JaceListWidgetConstants.DATAFIELD_LINK])
476
+ item.link = element[JaceListWidgetConstants.DATAFIELD_LINK];
477
+ if (element[JaceListWidgetConstants.DATAFIELD_SUBLINE])
478
+ item.subline = element[JaceListWidgetConstants.DATAFIELD_SUBLINE];
479
+ if (element[JaceListWidgetConstants.DATAFIELD_CLASSES])
480
+ item.classes = element[JaceListWidgetConstants.DATAFIELD_CLASSES];
450
481
  item.description = element.description;
451
482
  this.items.push(item);
452
483
  }
@@ -454,6 +485,12 @@ class JaceListWidgetModel extends BaseJaceWidgetModel {
454
485
  }
455
486
  }
456
487
 
488
+ const JaceMultiprogWidgetConstants = {
489
+ TYPE: "MULTIPROGRESS",
490
+ DATAFIELD_TITLES: "progresstitles",
491
+ DATAFIELD_VALUES: "progressvalues",
492
+ DATAFIELD_AS_CIRCLES: "circleprogress",
493
+ };
457
494
  class JaceMultiprogWidgetModel extends BaseJaceWidgetModel {
458
495
  constructor() {
459
496
  super();
@@ -461,15 +498,13 @@ class JaceMultiprogWidgetModel extends BaseJaceWidgetModel {
461
498
  this.progressTitles = [];
462
499
  this.progressValues = [];
463
500
  this.circleProgress = false;
464
- this.widgetType = "MULTIPROGRESS";
501
+ this.widgetType = JaceMultiprogWidgetConstants.TYPE;
465
502
  }
466
- setData(data) {
467
- if (data['queryerror'])
468
- this.dataError = data['queryerror'];
469
- this.progressTitles = data['progresstitles'] ?? [];
470
- this.progressValues = data['progressvalues'] ?? [];
471
- this.circleProgress = data['circleprogress'];
472
- this.options = data['options'] ?? {};
503
+ setWidgetData(data) {
504
+ this.progressTitles = data[JaceMultiprogWidgetConstants.DATAFIELD_TITLES] ?? [];
505
+ this.progressValues = data[JaceMultiprogWidgetConstants.DATAFIELD_VALUES] ?? [];
506
+ this.circleProgress = data[JaceMultiprogWidgetConstants.DATAFIELD_AS_CIRCLES];
507
+ this.options = data[BaseJaceWidgetConstants.OPTIONS] ?? {};
473
508
  if (this.circleProgress === undefined)
474
509
  this.circleProgress = true;
475
510
  if (this.cols === undefined && this.progressValues) {
@@ -1020,5 +1055,5 @@ var JaceWidgetTypes;
1020
1055
  * Generated bundle index. Do not edit.
1021
1056
  */
1022
1057
 
1023
- export { BaseJaceWidgetModel, BaseWidgetComponent, DSH_DATA_SERVICE, DSH_OPTIONS, DashboardComponent, DashboardFeatureAPIDataService, DashboardFeatureModule, DashboardWidgetFactory, DefaultDashboardModuleOptions, JaceChartWidgetComponent, JaceCounterWidgetComponent, JaceDashboardConfig, JaceDashboardLayoutAppSearch, JaceDashboardLayoutDetail, JaceListWidgetComponent, JaceMultiprogWidgetComponent, JaceWidgetInstanceDetail, JaceWidgetTypes, SaveJaceDashboardLayoutDTO };
1058
+ export { BaseJaceWidgetConstants, BaseJaceWidgetModel, BaseWidgetComponent, DSH_DATA_SERVICE, DSH_OPTIONS, DashboardComponent, DashboardFeatureAPIDataService, DashboardFeatureModule, DashboardWidgetFactory, DefaultDashboardModuleOptions, JaceChartWidgetComponent, JaceCounterWidgetComponent, JaceDashboardConfig, JaceDashboardLayoutAppSearch, JaceDashboardLayoutDetail, JaceListWidgetComponent, JaceMultiprogWidgetComponent, JaceWidgetInstanceDetail, JaceWidgetTypes, SaveJaceDashboardLayoutDTO };
1024
1059
  //# sourceMappingURL=esfaenza-dashboard-feature.mjs.map