@schneideress/dashboardframework 0.0.273 → 0.0.275

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 (34) hide show
  1. package/bundles/schneideress-dashboardframework.umd.js +122 -430
  2. package/bundles/schneideress-dashboardframework.umd.js.map +1 -1
  3. package/bundles/schneideress-dashboardframework.umd.min.js +15 -1
  4. package/bundles/schneideress-dashboardframework.umd.min.js.map +1 -1
  5. package/esm2015/gridster/lib/gridsterItem.component.js +1 -1
  6. package/esm2015/gridster/lib/gridsterRenderer.service.js +1 -1
  7. package/esm2015/lib/ra-dashboard-area/ra.dashboard.area.js +62 -164
  8. package/esm2015/lib/ra-widget-container/ra.widget.container.component.js +35 -64
  9. package/esm2015/lib/ra.base.dashboard.template.js +2 -4
  10. package/esm2015/lib/ra.dashboard.responsive.service.js +2 -12
  11. package/esm2015/lib/ra.dashboard.service.js +2 -7
  12. package/esm2015/lib/ra.event.enum.js +1 -7
  13. package/esm2015/lib/ra.gridster.config.js +3 -3
  14. package/esm5/gridster/lib/gridsterItem.component.js +1 -1
  15. package/esm5/gridster/lib/gridsterRenderer.service.js +1 -1
  16. package/esm5/lib/ra-dashboard-area/ra.dashboard.area.js +62 -166
  17. package/esm5/lib/ra-widget-container/ra.widget.container.component.js +35 -64
  18. package/esm5/lib/ra.base.dashboard.template.js +2 -4
  19. package/esm5/lib/ra.dashboard.responsive.service.js +2 -12
  20. package/esm5/lib/ra.dashboard.service.js +2 -7
  21. package/esm5/lib/ra.event.enum.js +1 -7
  22. package/esm5/lib/ra.gridster.config.js +3 -3
  23. package/fesm2015/schneideress-dashboardframework.js +100 -254
  24. package/fesm2015/schneideress-dashboardframework.js.map +1 -1
  25. package/fesm5/schneideress-dashboardframework.js +101 -257
  26. package/fesm5/schneideress-dashboardframework.js.map +1 -1
  27. package/lib/ra-dashboard-area/ra.dashboard.area.d.ts +2 -24
  28. package/lib/ra-widget-container/ra.widget.container.component.d.ts +2 -6
  29. package/lib/ra.base.dashboard.template.d.ts +2 -4
  30. package/lib/ra.dashboard.responsive.service.d.ts +1 -1
  31. package/lib/ra.dashboard.service.d.ts +1 -0
  32. package/lib/ra.event.enum.d.ts +1 -7
  33. package/package.json +1 -1
  34. package/schneideress-dashboardframework.metadata.json +1 -1
@@ -1,4 +1,4 @@
1
- import { __extends, __decorate, __metadata, __spread, __awaiter, __generator, __assign, __param } from 'tslib';
1
+ import { __extends, __decorate, __metadata, __awaiter, __generator, __assign, __param } from 'tslib';
2
2
  import { Injector, ɵɵdefineInjectable, ɵɵinject, INJECTOR, Injectable, EventEmitter, NgZone, Input, Output, ViewChild, ElementRef, Component, Renderer2, ChangeDetectorRef, ViewEncapsulation, Host, NgModule } from '@angular/core';
3
3
  import { of, Subject } from 'rxjs';
4
4
  import { BaseService, RATranslateService, RAPermissionService, DomService, RACommonModule } from '@schneideress/ra-common';
@@ -17,6 +17,7 @@ var RaDashboardService = /** @class */ (function (_super) {
17
17
  function RaDashboardService(injector) {
18
18
  var _this = _super.call(this, injector, '') || this;
19
19
  _this.loadedScripts = [];
20
+ _this.clientId = undefined;
20
21
  return _this;
21
22
  }
22
23
  /*
@@ -69,12 +70,6 @@ var RaDashboardService = /** @class */ (function (_super) {
69
70
  /**To Update widgetInfo in database */
70
71
  RaDashboardService.prototype.updateWidget = function (widgetInfo, appConfig) {
71
72
  this.baseUrl = appConfig.apiBaseUrl;
72
- var info = {};
73
- info.widgetConfigInfo = widgetInfo.widgetConfigInfo;
74
- info.widgetInstanceId = widgetInfo.widgetInstanceId;
75
- info.widgetTitle = widgetInfo.widgetTitle;
76
- info.widgetType = widgetInfo.widgetType;
77
- info.widgetId = widgetInfo.widgetId;
78
73
  return this.post('widget/UpdateUserWidget', widgetInfo);
79
74
  };
80
75
  /** To Move or change position if current widget container*/
@@ -190,12 +185,6 @@ var RAEvent;
190
185
  RAEvent["UpdateAppledFiterForInapplicableFilter"] = "UpdateAppledFiterForInapplicableFilter";
191
186
  /**show inapplicable filter message in global filter flyout */
192
187
  RAEvent["ShowInapplicableFilterMessage"] = "ShowInapplicableFilterMessage";
193
- /** Bulk Action Clicked */
194
- RAEvent["BulkActionClick"] = "BulkActionClick";
195
- /** Global Filter Clicked */
196
- /** When user change the curated filter(eg:data streams), system will create/delete widgets */
197
- RAEvent["CuratedFilterChange"] = "CuratedFilterChange";
198
- RAEvent["GlobalFilterClick"] = "GlobalFilterClick";
199
188
  })(RAEvent || (RAEvent = {}));
200
189
  var RAEventKey;
201
190
  (function (RAEventKey) {
@@ -209,9 +198,9 @@ var GridsterConfigDefaultSettings = {
209
198
  margin: 10,
210
199
  outerMargin: true,
211
200
  outerMarginTop: 10,
212
- outerMarginRight: 0,
201
+ outerMarginRight: 10,
213
202
  outerMarginBottom: 30,
214
- outerMarginLeft: 0,
203
+ outerMarginLeft: 10,
215
204
  useTransformPositioning: true,
216
205
  mobileBreakpoint: 640,
217
206
  minCols: 10,
@@ -326,7 +315,7 @@ var RADashboardResponsiveService = /** @class */ (function () {
326
315
  enumerable: true,
327
316
  configurable: true
328
317
  });
329
- RADashboardResponsiveService.prototype.getGridsterConfig = function (isWidgetMgmnt, resize, canMove) {
318
+ RADashboardResponsiveService.prototype.getGridsterConfig = function (isWidgetMgmnt) {
330
319
  var config = GridsterConfigDefaultSettings;
331
320
  config.minCols = this.currentResInfo.maxCols;
332
321
  config.maxCols = this.currentResInfo.maxCols;
@@ -348,13 +337,6 @@ var RADashboardResponsiveService = /** @class */ (function () {
348
337
  config.swap = true;
349
338
  config.draggable.enabled = true;
350
339
  }
351
- if (!resize) {
352
- config.resizable.enabled = false;
353
- config.swap = false;
354
- }
355
- if (!canMove) {
356
- config.draggable.enabled = false;
357
- }
358
340
  return config;
359
341
  };
360
342
  /**To map IwidgetInfo object to gridsterItem */
@@ -362,9 +344,6 @@ var RADashboardResponsiveService = /** @class */ (function () {
362
344
  if (widget.widgetSettings) {
363
345
  widget.settings = JSON.parse(widget.widgetSettings);
364
346
  }
365
- if (widget.templateSettings) {
366
- widget.templateWidgetSettings = JSON.parse(widget.templateSettings);
367
- }
368
347
  var gridsterItem = {
369
348
  cols: this.getWidth(widget.width),
370
349
  rows: this.getHeight(widget.height),
@@ -432,21 +411,14 @@ var RADashboardArea = /** @class */ (function () {
432
411
  this.domResized = false;
433
412
  this.showEmptyDashboard = false;
434
413
  this.isWidgetMgmnt = false;
435
- this.initialWidgetCount = 10;
436
- this.currentLoadedIndex = 0;
437
- this.loading = false;
438
414
  this.widgetHeight = 2;
439
415
  this.widgetWidth = 4;
440
416
  this.hideDashboardBanner = new EventEmitter();
441
417
  }
442
418
  RADashboardArea.prototype.ngOnInit = function () {
443
419
  var _this = this;
444
- window.addEventListener('scroll', function () {
445
- _this.loadNext();
446
- });
447
420
  this.isWidgetMgmnt = this.permissionService.hasPermission('ra.widgetmanagement');
448
421
  this.initiateGridsterConfig();
449
- this.setEmptyDashboardConfig();
450
422
  this.lastViewType = this.responsiveService.IsDesktopView ? 'desktop' : 'mobile';
451
423
  this.responsiveService.resized.subscribe(function (isDesktop) {
452
424
  if (_this.lastViewType != (isDesktop ? 'desktop' : 'mobile') || !isDesktop) {
@@ -475,11 +447,6 @@ var RADashboardArea = /** @class */ (function () {
475
447
  }, 100);
476
448
  }
477
449
  });
478
- setTimeout(function () {
479
- _this.bulkActionClick = _this.raDashboardEventBus.subscribe(RAEvent.BulkActionClick).subscribe(function (data) {
480
- _this.bulkActionData = JSON.parse(JSON.stringify(data)); // To create a new reference;
481
- });
482
- });
483
450
  };
484
451
  RADashboardArea.prototype.ngOnChanges = function (changes) {
485
452
  this.isWidgetMgmnt = this.permissionService.hasPermission('ra.widgetmanagement');
@@ -487,44 +454,28 @@ var RADashboardArea = /** @class */ (function () {
487
454
  this.isWidgetLoaded = true;
488
455
  this.loadWidgets(this.userDashboardId, this.areaKey);
489
456
  }
490
- this.initiateGridsterConfig();
491
457
  if (changes.raDashboardEventBus && changes.raDashboardEventBus.currentValue != changes.raDashboardEventBus.previousValue) {
492
458
  this.inititateEventBusSubscritions();
493
459
  }
494
460
  };
495
- RADashboardArea.prototype.setEmptyDashboardConfig = function () {
496
- if (this.dashboardInfo && this.dashboardInfo.templateConfig.emptyDashboardHeader) {
497
- this.emptyDashboardTitle = this.translateService.translate("dashboard." + this.dashboardInfo.templateConfig.emptyDashboardHeader.titleKey);
498
- this.emptyDashboardMsg1 = this.translateService.translate("dashboard." + this.dashboardInfo.templateConfig.emptyDashboardHeader.descriptionKey1);
499
- this.emptyDashboardMsg2 = (this.dashboardInfo.templateConfig.emptyDashboardHeader.descriptionKey2) ? this.translateService.translate("dashboard." + this.dashboardInfo.templateConfig.emptyDashboardHeader.descriptionKey2) : '';
500
- this.emptyDashboardButtonText = this.translateService.translate("dashboard." + this.dashboardInfo.templateConfig.emptyDashboardHeader.buttonTextKey);
501
- this.emptyDashboardButtonIcon = this.dashboardInfo.templateConfig.emptyDashboardHeader.buttonIcon ? this.dashboardInfo.templateConfig.emptyDashboardHeader.buttonIcon : '';
502
- this.emptyDashboardButtonAction = this.dashboardInfo.templateConfig.emptyDashboardHeader.buttonAction ? this.dashboardInfo.templateConfig.emptyDashboardHeader.buttonAction : '';
503
- }
504
- };
505
461
  /**To set GridsterConfig */
506
462
  RADashboardArea.prototype.initiateGridsterConfig = function () {
507
463
  var _this = this;
508
- if (this.dashboardInfo) {
509
- /**To override default configuration values to the gridster control */
510
- this.options = this.responsiveService.getGridsterConfig(this.isWidgetMgmnt, this.dashboardInfo.templateConfig.widget.canResize, this.dashboardInfo.templateConfig.widget.canMove);
511
- this.options.initCallback = function (gridster) {
512
- if (_this.options.api) {
513
- _this.gridcellHeight = _this.options.api.getCurrentRowHeight();
514
- }
515
- };
516
- this.options.itemChangeCallback = function (item) {
517
- if (_this.responsiveService.IsDesktopView) {
518
- if (item.widgetInfo && item.widgetInfo.widgetInstanceId) {
519
- _this.updateWidgetPosition(item.widgetInfo.widgetInstanceId);
520
- }
464
+ /**To override default configuration values to the gridster control */
465
+ this.options = this.responsiveService.getGridsterConfig(this.isWidgetMgmnt);
466
+ this.options.initCallback = function (gridster) {
467
+ if (_this.options.api) {
468
+ _this.gridcellHeight = _this.options.api.getCurrentRowHeight();
469
+ }
470
+ };
471
+ this.options.itemChangeCallback = function (item) {
472
+ if (_this.responsiveService.IsDesktopView) {
473
+ if (item.widgetInfo && item.widgetInfo.widgetInstanceId) {
474
+ _this.updateWidgetPosition(item.widgetInfo.widgetInstanceId);
521
475
  }
522
- _this.setAreaHeight();
523
- };
524
- }
525
- };
526
- RADashboardArea.prototype.widgetLoaded = function (widget) {
527
- widget.canLoadData = true;
476
+ }
477
+ _this.setAreaHeight();
478
+ };
528
479
  };
529
480
  /** To initiate eventbus subsctiptions */
530
481
  RADashboardArea.prototype.inititateEventBusSubscritions = function () {
@@ -544,11 +495,6 @@ var RADashboardArea = /** @class */ (function () {
544
495
  _this.addWidget(e);
545
496
  });
546
497
  });
547
- this.curatedFilterChange = this.raDashboardEventBus.subscribe(RAEvent.CuratedFilterChange).subscribe(function (e) {
548
- _this.ngZone.run(function () {
549
- _this.loadWidgets(_this.userDashboardId, _this.areaKey);
550
- });
551
- });
552
498
  this.rearrangeWidgetClick = this.raDashboardEventBus.subscribe(RAEvent.RearrangeClicked).subscribe(function (e) {
553
499
  _this.ngZone.run(function () {
554
500
  _this.rearrangeWidgets();
@@ -597,10 +543,6 @@ var RADashboardArea = /** @class */ (function () {
597
543
  this.widgetLibraryDoneClick.unsubscribe();
598
544
  if (this.rearrangeWidgetClick)
599
545
  this.rearrangeWidgetClick.unsubscribe();
600
- if (this.curatedFilterChange)
601
- this.curatedFilterChange.unsubscribe();
602
- if (this.bulkActionClick)
603
- this.bulkActionClick.unsubscribe();
604
546
  };
605
547
  /**To update position/dimention of all widgets in the area */
606
548
  RADashboardArea.prototype.updateWidgets = function () {
@@ -637,12 +579,6 @@ var RADashboardArea = /** @class */ (function () {
637
579
  /** To retrieve widgets based on userDashboardid and area name */
638
580
  RADashboardArea.prototype.loadWidgets = function (userDashboarId, areaKey) {
639
581
  var _this = this;
640
- if (this.templateConfig && this.templateConfig.initialWidgetCount)
641
- this.initialWidgetCount = this.templateConfig.initialWidgetCount;
642
- if (location.href.indexOf('/kiosk/') > -1)
643
- this.initialWidgetCount = 1000;
644
- this.currentLoadedIndex = 0;
645
- this.loading = false;
646
582
  var widgetInfo = {
647
583
  dashboardId: userDashboarId.toString(),
648
584
  dashboardAreaKey: areaKey
@@ -661,8 +597,9 @@ var RADashboardArea = /** @class */ (function () {
661
597
  });
662
598
  _this.checkPAMWidgets();
663
599
  if (widgets && widgets.length > 0) {
664
- _this.widgetList = [];
665
- _this.loadWidgetsDelta();
600
+ _this.dashboardService.clientId = widgets[0].clientId;
601
+ _this.widgetList = _this.mapObjectListToGridsterItemList(widgets);
602
+ _this.setAreaHeight();
666
603
  _this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, false);
667
604
  }
668
605
  else {
@@ -671,45 +608,6 @@ var RADashboardArea = /** @class */ (function () {
671
608
  }
672
609
  });
673
610
  };
674
- RADashboardArea.prototype.loadWidgetsDelta = function () {
675
- var _this = this;
676
- var _a;
677
- if (!this.loading) {
678
- this.loading = true;
679
- var widgets = this.mapObjectListToGridsterItemList(this.userWidgets.slice(this.currentLoadedIndex, (this.currentLoadedIndex + this.initialWidgetCount)));
680
- this.currentLoadedIndex += this.initialWidgetCount;
681
- (_a = this.widgetList).push.apply(_a, __spread(widgets));
682
- this.setAreaHeight();
683
- setTimeout(function () {
684
- _this.loading = false;
685
- });
686
- }
687
- };
688
- RADashboardArea.prototype.dataLoaded = function (widgetElement) {
689
- this.loadNext();
690
- };
691
- RADashboardArea.prototype.loadNext = function () {
692
- if (this.divBottom) {
693
- if (this.elementInViewport(this.divBottom.nativeElement)) {
694
- this.loadWidgetsDelta();
695
- }
696
- }
697
- };
698
- RADashboardArea.prototype.elementInViewport = function (el) {
699
- var top = el.offsetTop;
700
- var left = el.offsetLeft;
701
- var width = el.offsetWidth;
702
- var height = el.offsetHeight;
703
- while (el.offsetParent) {
704
- el = el.offsetParent;
705
- top += el.offsetTop;
706
- left += el.offsetLeft;
707
- }
708
- return (top >= window.scrollY &&
709
- left >= window.scrollX &&
710
- (top + height) <= (window.scrollY + window.innerHeight) &&
711
- (left + width) <= (window.scrollX + window.innerWidth));
712
- };
713
611
  /** To set Area(Gridster) height dynamically as widgets are added/removed */
714
612
  RADashboardArea.prototype.setAreaHeight = function () {
715
613
  var _this = this;
@@ -753,22 +651,22 @@ var RADashboardArea = /** @class */ (function () {
753
651
  /** To remove a widget instance from dashboard and to save info in database */
754
652
  RADashboardArea.prototype.deleteWidget = function (widgetInstanceId, isalertDisabled) {
755
653
  if (isalertDisabled === void 0) { isalertDisabled = false; }
756
- var widget = this.userWidgets.filter(function (item) {
757
- return item.widgetInstanceId === widgetInstanceId;
758
- });
759
- if (widget.length > 0) {
760
- this.userWidgets.splice(this.userWidgets.indexOf(widget[0]), 1);
761
- }
762
- if (this.PAMWidgets.length > 0) {
763
- var indx = this.PAMWidgets.indexOf(widgetInstanceId);
764
- if (indx > -1)
765
- this.PAMWidgets.splice(indx, 1);
766
- this.checkPAMWidgets();
767
- }
768
654
  var gridsterItem = this.widgetList.filter(function (item) {
769
655
  return item.widgetInfo.widgetInstanceId === widgetInstanceId;
770
656
  });
771
657
  if (gridsterItem.length > 0) {
658
+ var widget = this.userWidgets.filter(function (item) {
659
+ return item.widgetInstanceId === widgetInstanceId;
660
+ });
661
+ if (widget.length > 0) {
662
+ this.userWidgets.splice(this.userWidgets.indexOf(widget[0]), 1);
663
+ }
664
+ if (this.PAMWidgets.length > 0) {
665
+ var indx = this.PAMWidgets.indexOf(widgetInstanceId);
666
+ if (indx > -1)
667
+ this.PAMWidgets.splice(indx, 1);
668
+ this.checkPAMWidgets();
669
+ }
772
670
  this.widgetList.splice(this.widgetList.indexOf(gridsterItem[0]), 1);
773
671
  this.setAreaHeight();
774
672
  if (!isalertDisabled) {
@@ -783,15 +681,11 @@ var RADashboardArea = /** @class */ (function () {
783
681
  /**To rearrange widgets position in the dashboard, compactLeft&Up,compactLeft,compactUp,etc*/
784
682
  RADashboardArea.prototype.rearrangeWidgets = function () {
785
683
  var _this = this;
786
- this.currentLoadedIndex = 0;
787
- this.loading = false;
788
684
  for (var i = 0; i < this.userWidgets.length; i++) {
789
685
  this.userWidgets[i].position_x = 0;
790
686
  this.userWidgets[i].position_y = 0;
791
687
  }
792
- this.widgetList = [];
793
- this.loadWidgetsDelta();
794
- this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, false);
688
+ this.widgetList = this.mapObjectListToGridsterItemList(this.userWidgets);
795
689
  if (this.widgetList.length > 0)
796
690
  this.updateWidgetPosition(this.widgetList[0].widgetInfo.widgetInstanceId);
797
691
  setTimeout(function () {
@@ -824,32 +718,30 @@ var RADashboardArea = /** @class */ (function () {
824
718
  this.ngxService.start();
825
719
  this.dashboardService.addWidget(data, this.appConfig).subscribe(function (widget) {
826
720
  _this.userWidgets.push(widget);
827
- if (_this.currentLoadedIndex >= _this.userWidgets.length) {
828
- var gridsterItem = _this.responsiveService.getGridsterItem(widget);
829
- _this.widgetList.push(gridsterItem);
830
- _this.setAreaHeight();
831
- if (_this.options.api) {
832
- var curRowHeight = Number(_this.options.api.getCurrentRowHeight());
833
- if (curRowHeight > 0) {
834
- widget.rowHeight = curRowHeight;
835
- _this.gridcellHeight = curRowHeight;
836
- }
837
- }
838
- var widgetInstanceId = 0;
839
- if (widget && widget.widgetInstanceId) {
840
- widgetInstanceId = widget.widgetInstanceId;
841
- /**To save added widget position in db */
842
- if (_this.responsiveService.IsDesktopView) {
843
- setTimeout(function () {
844
- _this.updateWidgetPosition(widgetInstanceId);
845
- });
846
- }
721
+ var gridsterItem = _this.responsiveService.getGridsterItem(widget);
722
+ _this.widgetList.push(gridsterItem);
723
+ _this.setAreaHeight();
724
+ if (_this.options.api) {
725
+ var curRowHeight = Number(_this.options.api.getCurrentRowHeight());
726
+ if (curRowHeight > 0) {
727
+ widget.rowHeight = curRowHeight;
728
+ _this.gridcellHeight = curRowHeight;
847
729
  }
848
- if (widget.settings && widget.settings.isPAMWidget) {
849
- _this.PAMWidgets.push(widget.widgetInstanceId);
850
- _this.checkPAMWidgets();
730
+ }
731
+ var widgetInstanceId = 0;
732
+ if (widget && widget.widgetInstanceId) {
733
+ widgetInstanceId = widget.widgetInstanceId;
734
+ /**To save added widget position in db */
735
+ if (_this.responsiveService.IsDesktopView) {
736
+ setTimeout(function () {
737
+ _this.updateWidgetPosition(widgetInstanceId);
738
+ });
851
739
  }
852
740
  }
741
+ if (widget.settings && widget.settings.isPAMWidget) {
742
+ _this.PAMWidgets.push(widget.widgetInstanceId);
743
+ _this.checkPAMWidgets();
744
+ }
853
745
  _this.raDashboardEventBus.publish(RAEvent.WidgetAdded, widget);
854
746
  });
855
747
  };
@@ -878,14 +770,12 @@ var RADashboardArea = /** @class */ (function () {
878
770
  });
879
771
  }
880
772
  this.userWidgets.push(data);
881
- if (this.currentLoadedIndex >= this.userWidgets.length) {
882
- var gridsterItem = this.responsiveService.getGridsterItem(data);
883
- this.widgetList.push(gridsterItem);
884
- this.setAreaHeight();
885
- if (data.settings && data.settings.isPAMWidget) {
886
- this.PAMWidgets.push(data.widgetInstanceId);
887
- this.checkPAMWidgets();
888
- }
773
+ var gridsterItem = this.responsiveService.getGridsterItem(data);
774
+ this.widgetList.push(gridsterItem);
775
+ this.setAreaHeight();
776
+ if (data.settings && data.settings.isPAMWidget) {
777
+ this.PAMWidgets.push(data.widgetInstanceId);
778
+ this.checkPAMWidgets();
889
779
  }
890
780
  };
891
781
  RADashboardArea.prototype.mapObjectListToGridsterItemList = function (widgetList) {
@@ -914,11 +804,8 @@ var RADashboardArea = /** @class */ (function () {
914
804
  });
915
805
  return widgetListArray;
916
806
  };
917
- RADashboardArea.prototype.buttonClick = function () {
918
- if (this.emptyDashboardButtonAction == "widgets")
919
- this.raDashboardEventBus.publish(RAEvent.AddNewWidgetToDashboard, null);
920
- else if (this.emptyDashboardButtonAction == "filter")
921
- this.raDashboardEventBus.publish(RAEvent.GlobalFilterClick, null);
807
+ RADashboardArea.prototype.addNewWidget = function () {
808
+ this.raDashboardEventBus.publish(RAEvent.AddNewWidgetToDashboard, null);
922
809
  };
923
810
  RADashboardArea.prototype.updateAppliedFilters = function (data) {
924
811
  this.raDashboardEventBus.publish(RAEvent.UpdateAppledFiterForInapplicableFilter, data);
@@ -968,14 +855,6 @@ var RADashboardArea = /** @class */ (function () {
968
855
  Input('app-config'),
969
856
  __metadata("design:type", Object)
970
857
  ], RADashboardArea.prototype, "appConfig", void 0);
971
- __decorate([
972
- Input('dashboard-info'),
973
- __metadata("design:type", Object)
974
- ], RADashboardArea.prototype, "dashboardInfo", void 0);
975
- __decorate([
976
- Input(),
977
- __metadata("design:type", Object)
978
- ], RADashboardArea.prototype, "templateConfig", void 0);
979
858
  __decorate([
980
859
  Output(),
981
860
  __metadata("design:type", Object)
@@ -984,15 +863,11 @@ var RADashboardArea = /** @class */ (function () {
984
863
  ViewChild('gridWrapper', { static: false }),
985
864
  __metadata("design:type", ElementRef)
986
865
  ], RADashboardArea.prototype, "gridWrapper", void 0);
987
- __decorate([
988
- ViewChild('divBottom', { static: false }),
989
- __metadata("design:type", ElementRef)
990
- ], RADashboardArea.prototype, "divBottom", void 0);
991
866
  RADashboardArea = __decorate([
992
867
  Component({
993
868
  selector: 'ra-dashboard-area',
994
- template: "<div #gridWrapper class=\"wrap gridster gridster-mobile\"\r\n [ngStyle]=\"{'height': userWidgets.length > 0 ? (gridheight + 'px') : 'unset'}\">\r\n <!-- <div #gridWrapper class=\"wrap gridster\"> -->\r\n <gridster [options]=\"options\" style=\"height:100%;\" *ngIf=\"userWidgets.length > 0\">\r\n <gridster-item [item]=\"item\" *ngFor=\"let item of widgetList\">\r\n <ra-widget-container (widgetLoaded)=\"widgetLoaded(item)\" [canLoadData]=\"item.canLoadData\" (dataLoaded)=\"dataLoaded($event)\"\r\n [bulk-action-data]=\"bulkActionData\" [dashboard-info]=\"dashboardInfo\" [app-config]=\"appConfig\"\r\n [event-bus]=\"raDashboardEventBus\" (widgetDeleted)=\"deleteWidget($event)\" [data]=\"item\"\r\n [global-filter]=\"globalFilter\" [grid-cell-height]=\"gridcellHeight\" *ngIf=\"gridcellHeight && gridcellHeight > 0\"\r\n [widget-width]=\"item.cols\" [widget-height]=\"item.rows\" [widget-instance-id]=\"item.widgetInstanceId\"\r\n [dom-resized]=\"domResized\" (updateAppliedFilters)=\"updateAppliedFilters($event)\">\r\n </ra-widget-container>\r\n </gridster-item>\r\n </gridster>\r\n\r\n <div class=\"empty-padding kiosk-hide\" *ngIf=\"showEmptyDashboard\">\r\n <div class=\"empty-wrapper\">\r\n <div></div>\r\n <div class=\"empty-prefix\">\r\n <!-- <i class=\"fal fa-edit edit-icon\"></i> -->\r\n <span>{{emptyDashboardTitle}}</span>\r\n </div>\r\n <hr class=\"horizontalLine-solid\" />\r\n <div class=\"empty-content light\">\r\n <div>\r\n <div class=\"col-sm-12 empty-msg\">\r\n {{emptyDashboardMsg1}} <br />\r\n {{emptyDashboardMsg2}}\r\n </div>\r\n <button *ngIf=\"isWidgetMgmnt\" class=\"btn btnLib btn-sm dashboard-button light\" (click)=\"buttonClick()\">\r\n <i class=\"{{emptyDashboardButtonIcon}}\"></i>{{emptyDashboardButtonText}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <notifier-container></notifier-container>\r\n</div>\r\n<div #divBottom></div>",
995
- styles: ["gridster{width:inherit;resize:height;display:flex;background-color:#fff;overflow-y:hidden!important}.dvheader{width:100%;height:35px;background:#000;color:#fff;padding:7px 3px 5px 6px;text-transform:uppercase}gridster-item{box-sizing:border-box;z-index:1;position:absolute;overflow:hidden;transition:.3s;display:none;background:#fff;-webkit-user-select:text;-moz-user-select:text;user-select:text;box-shadow:none}gridster-item:hover{box-shadow:0 1px 10px rgba(0,0,0,.15)!important}@media screen and (max-width:685px){.gridster-mobile{height:auto!important;margin-bottom:50px!important}}@media screen and (max-width:350px){.gridster-mobile{min-height:330px!important;margin-bottom:0!important}}.empty-padding{padding:15px 0;background-color:#fff;display:flex}.empty-wrapper{background-color:#fff;border:1px solid #9fa0a4;min-height:125px;width:100%}.empty-prefix{color:#32ad3c;font-size:18px;padding:15px}.empty-content{color:#626469;width:100%;padding:15px}.empty-msg{padding:0 0 15px;font-size:16px}.horizontalLine-solid{border-top:1px solid #cbcbcb;margin:0 15px}.dashboard-button{padding:5px 10px 5px 5px!important}.btnLib{background-color:#ededed;color:#333!important}.btn-group-sm>.btn,.btn-sm{padding:5px 20px 5px 5px}.edit-icon{color:#32ad3c;font-size:24px;margin-right:15px}.empty-title{margin-top:10px}@media screen and (max-width:600px){.empty-padding{padding:15px 0;background-color:#fff;width:100%;display:block}.empty-wrapper{display:flex;background-color:#fff;border:1px solid #9fa0a4;min-height:125px;width:100%}.empty-prefix{color:#32ad3c;font-size:16px;display:flex;height:40px;padding:15px}.empty-content{color:#333;display:flex;padding:15px}.empty-msg{padding:0 0 15px;font-size:14px}.edit-icon{color:#32ad3c;font-size:20px;margin-right:6px}.empty-title{margin-top:6px}}"]
869
+ template: "<div #gridWrapper class=\"wrap gridster gridster-mobile\" [ngStyle]=\"{'height': userWidgets.length > 0 ? (gridheight + 'px') : 'unset'}\">\r\n <!-- <div #gridWrapper class=\"wrap gridster\"> -->\r\n <gridster [options]=\"options\" style=\"height:100%;\" *ngIf=\"userWidgets.length > 0\">\r\n <gridster-item [item]=\"item\" *ngFor=\"let item of widgetList\">\r\n <ra-widget-container [app-config]=\"appConfig\" [event-bus]=\"raDashboardEventBus\"\r\n (widgetDeleted)=\"deleteWidget($event)\" [data]=\"item\" [global-filter]=\"globalFilter\"\r\n [grid-cell-height]=\"gridcellHeight\" *ngIf=\"gridcellHeight && gridcellHeight > 0\" [widget-width]=\"item.cols\"\r\n [widget-height]=\"item.rows\" [widget-instance-id]=\"item.widgetInstanceId\" [dom-resized]=\"domResized\"\r\n (updateAppliedFilters)=\"updateAppliedFilters($event)\">\r\n </ra-widget-container>\r\n </gridster-item>\r\n </gridster>\r\n\r\n <div class=\"empty-padding kiosk-hide\" *ngIf=\"showEmptyDashboard\">\r\n <div class=\"empty-wrapper\">\r\n <div></div>\r\n <div class=\"m-1 empty-prefix\">\r\n <i class=\"fal fa-edit edit-icon\"></i>\r\n <span class=\"empty-title\">{{'dashboard.emptydashboard'|translate}}</span>\r\n </div>\r\n <div class=\"empty-content light\">\r\n <div>\r\n <div class=\"col-sm-12 empty-msg\">\r\n {{'dashboard.emptydashboardmessage'|translate}} <br />\r\n {{'dashboard.emptydashboardmessage2'|translate}}\r\n </div>\r\n <button *ngIf=\"isWidgetMgmnt\" class=\"btn btnLib btn-sm m-1 dashboard-button light\" (click)=\"addNewWidget()\">\r\n <i class=\"fal fa-plus m-1\"></i>{{'dashboard.addawidgets'|translate}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <notifier-container></notifier-container>\r\n</div>",
870
+ styles: ["gridster{width:inherit;resize:height;display:flex;background-color:#ededed;overflow-y:hidden!important}.dvheader{width:100%;height:35px;background:#000;color:#fff;padding:7px 3px 5px 6px;text-transform:uppercase}gridster-item{box-sizing:border-box;z-index:1;position:absolute;overflow:hidden;transition:.3s;display:none;background:#fff;-webkit-user-select:text;-moz-user-select:text;user-select:text;box-shadow:0 1px 10px rgba(0,0,0,.05)}gridster-item:hover{box-shadow:0 1px 10px rgba(0,0,0,.15)}@media screen and (max-width:685px){.gridster-mobile{height:auto!important;margin-bottom:50px!important}}@media screen and (max-width:350px){.gridster-mobile{min-height:330px!important;margin-bottom:0!important}}.empty-padding{padding:40px 20px 20px;background-color:#ededed;display:flex;justify-content:center;align-content:center}.empty-wrapper{display:flex;background-color:#fff;border-radius:8px;min-height:125px;width:72%}.empty-prefix{color:#32ad3c;font-size:18px;display:flex;align-items:center;padding:10px 30px;min-width:-webkit-max-content;min-width:max-content;min-width:-moz-max-content}.empty-content{color:#333;border-left:1px solid #a9afb1;width:100%;display:flex;align-items:center;padding:15px 30px 10px 40px}.empty-msg{padding:0 0 5px;font-size:16px}.dashboard-button{padding:5px 10px 5px 5px!important}.btnLib{background-color:#ededed;color:#333!important}.btn-group-sm>.btn,.btn-sm{padding:5px 20px 5px 5px}.edit-icon{color:#32ad3c;font-size:24px;margin-right:15px}.empty-title{margin-top:10px}@media screen and (max-width:600px){.empty-padding{padding:10px;background-color:#ededed;width:100%;display:block}.empty-wrapper{display:flex;background-color:#fff;border-radius:8px;min-height:125px;width:100%}.empty-prefix{color:#32ad3c;font-size:16px;display:flex;height:40px;padding:6px 10px 8px}.empty-content{color:#333;display:flex;padding:5px 10px 10px;margin-top:44px;margin-left:-185px;border-left:none}.empty-msg{padding:12px 10px 10px 5px;font-size:14px;border-top:1px solid #a9afb1}.edit-icon{color:#32ad3c;font-size:20px;margin-right:6px}.empty-title{margin-top:6px}}"]
996
871
  }),
997
872
  __metadata("design:paramtypes", [RaDashboardService,
998
873
  NgZone,
@@ -1095,11 +970,8 @@ var RAWidgetContainer = /** @class */ (function () {
1095
970
  this.showExcell = true;
1096
971
  this.hideTitle = false;
1097
972
  this.inapplicableFilters = [];
1098
- this.canLoadData = false;
1099
973
  this.widgetDeleted = new EventEmitter();
1100
974
  this.updateAppliedFilters = new EventEmitter();
1101
- this.dataLoaded = new EventEmitter();
1102
- this.widgetLoaded = new EventEmitter();
1103
975
  this.isWidgetStateApplicable = false;
1104
976
  this.widgetEmptyState = '';
1105
977
  this.lockVisible = false;
@@ -1124,7 +996,7 @@ var RAWidgetContainer = /** @class */ (function () {
1124
996
  configurable: true
1125
997
  });
1126
998
  RAWidgetContainer.prototype.ngOnInit = function () {
1127
- this.WidgetDisplayName = this.translateService.translate('Common.' + this.data.widgetInfo.widgetTitle, true);
999
+ this.WidgetDisplayName = this.getwidgetTitleTranslation(this.data.widgetInfo.widgetTitle);
1128
1000
  this.lockIconTitle = this.translateService.translate('Common.lockedfields');
1129
1001
  this.lockIconFooter = this.translateService.translate('Common.lockedfieldseditinfo');
1130
1002
  this.inapplicableIconTitle = this.translateService.translate('Common.InapplicableFilters');
@@ -1145,32 +1017,19 @@ var RAWidgetContainer = /** @class */ (function () {
1145
1017
  });
1146
1018
  });
1147
1019
  }
1148
- if (this.widgetElement) {
1149
- if (changes.bulkActionData && changes.bulkActionData.currentValue != changes.bulkActionData.previousValue) {
1150
- if (typeof this.widgetElement.bulkActionClicked === "function") {
1151
- this.widgetElement.bulkActionClicked(this.bulkActionData);
1152
- }
1153
- }
1154
- if (changes.globalFilter && changes.globalFilter.currentValue != changes.globalFilter.previousValue) {
1155
- if (!this.dashboardInfo.curatedFilters) {
1156
- var filterObj = this.getParsedConfig(this.globalFilter);
1157
- if (filterObj.WidgetInstanceId) {
1158
- if (this.data.widgetInfo.widgetInstanceId != filterObj.WidgetInstanceId)
1159
- this.refreshWidget(this.data.widgetInfo);
1160
- }
1161
- else {
1162
- //this.refreshWidget(this.data.widgetInfo);
1163
- }
1164
- }
1020
+ if (this.widgetElement && changes.globalFilter && changes.globalFilter.currentValue != changes.globalFilter.previousValue) {
1021
+ var filterObj = this.getParsedConfig(this.globalFilter);
1022
+ if (filterObj.WidgetInstanceId) {
1023
+ if (this.data.widgetInfo.widgetInstanceId != filterObj.WidgetInstanceId)
1024
+ this.refreshWidget(this.data.widgetInfo);
1165
1025
  }
1166
- if (changes.width && changes.width.currentValue != changes.width.previousValue ||
1167
- (changes.height && changes.height.currentValue != changes.height.previousValue)) {
1168
- this.invokeWidgetResizedEvent();
1026
+ else {
1027
+ this.refreshWidget(this.data.widgetInfo);
1169
1028
  }
1170
1029
  }
1171
- if (changes.canLoadData && changes.canLoadData.currentValue != changes.canLoadData.previousValue) {
1172
- if (this.canLoadData)
1173
- this.refreshWidget(this.data.widgetInfo);
1030
+ if (changes.width && changes.width.currentValue != changes.width.previousValue ||
1031
+ (changes.height && changes.height.currentValue != changes.height.previousValue)) {
1032
+ this.invokeWidgetResizedEvent();
1174
1033
  }
1175
1034
  };
1176
1035
  RAWidgetContainer.prototype.invokeWidgetResizedEvent = function () {
@@ -1362,10 +1221,6 @@ var RAWidgetContainer = /** @class */ (function () {
1362
1221
  _this.showPanel = true;
1363
1222
  else
1364
1223
  _this.showPanel = false;
1365
- if (!_this.data.dataLoaded) {
1366
- _this.data.dataLoaded = true;
1367
- _this.dataLoaded.emit(_this.widgetElement);
1368
- }
1369
1224
  break;
1370
1225
  case 'onConfigEditClicked':
1371
1226
  _this.editWidget();
@@ -1438,9 +1293,7 @@ var RAWidgetContainer = /** @class */ (function () {
1438
1293
  widgetConfigFilter.configChanges = this.getConfigChanges(false);
1439
1294
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1440
1295
  widgetConfigFilter.globalFilter = this.globalFilter;
1441
- widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1442
- //this.widgetElement.loadContent(widgetConfigFilter);
1443
- this.widgetLoaded.emit();
1296
+ this.widgetElement.loadContent(widgetConfigFilter);
1444
1297
  return [4 /*yield*/, this.setLock(widgetConfigFilter.config)];
1445
1298
  case 1:
1446
1299
  _a.sent();
@@ -1710,12 +1563,9 @@ var RAWidgetContainer = /** @class */ (function () {
1710
1563
  var html = '<div id="ra-db-widget-menu"' + 'style="' + style + '" class="download-content dropdown-content widget-config-item dropdown-click" style="z-index: 1002;">';
1711
1564
  var settings = '';
1712
1565
  if (this.isWidgetMgmnt) {
1713
- if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideEdit)
1714
- settings += this.getHtmlForButton('wcEditWidget', 'fal fa-edit', this.editText);
1715
- if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideCopy)
1716
- settings += this.getHtmlForButton('wcCopyWidget', 'fal fa-copy', this.copyText);
1717
- if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideMove)
1718
- settings += this.getHtmlForButton('wcMoveWidget', 'fal fa-arrows-alt', this.moveText);
1566
+ settings += this.getHtmlForButton('wcEditWidget', 'fal fa-edit', this.editText);
1567
+ settings += this.getHtmlForButton('wcCopyWidget', 'fal fa-copy', this.copyText);
1568
+ settings += this.getHtmlForButton('wcMoveWidget', 'fal fa-arrows-alt', this.moveText);
1719
1569
  }
1720
1570
  var customPageParams = false;
1721
1571
  if (this.data.widgetInfo && this.data.widgetInfo.widgetSettings) {
@@ -1724,14 +1574,14 @@ var RAWidgetContainer = /** @class */ (function () {
1724
1574
  customPageParams = true;
1725
1575
  }
1726
1576
  }
1727
- if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideVisitPage && (this.detailPageUrl || customPageParams) && this.checkVisitLinkVisiblity()) {
1577
+ if ((this.detailPageUrl || customPageParams) && this.checkVisitLinkVisiblity()) {
1728
1578
  settings += '<a style="max-height: 30px;align-items: center;align-content: center; display: flex;" id="wcVisitWidget">';
1729
1579
  settings += '<i style="padding-left: 4px;font-size: 27px !important;" class="fal fa-angle-right"></i> ';
1730
1580
  settings += '<span style="padding-left: 11px;margin-top: 2px;" style="padding-left: 6px;">';
1731
1581
  settings += this.translateService.translate('Common.visitpage');
1732
1582
  settings += '</span></a>';
1733
1583
  }
1734
- if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideVisitPage && (this.detailPageUrl && this.checkVisitLinkVisiblity()) || this.isWidgetMgmnt) {
1584
+ if ((this.detailPageUrl && this.checkVisitLinkVisiblity()) || this.isWidgetMgmnt) {
1735
1585
  html += '<div style="color: #9FA0A4;font-size: 12px;padding-top: 8px;padding-left: 12px;">';
1736
1586
  html += this.translateService.translate('Common.settings') + '</div>';
1737
1587
  html += settings;
@@ -1763,7 +1613,7 @@ var RAWidgetContainer = /** @class */ (function () {
1763
1613
  if (this.isDownloadIconVisible && this.isWidgetMgmnt && this.showExcell) {
1764
1614
  html += this.getHr();
1765
1615
  }
1766
- if (this.isWidgetMgmnt && !this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideDelete) {
1616
+ if (this.isWidgetMgmnt) {
1767
1617
  html += '<a id="wcWidgetDelete"><i class="fal fa-times" style="padding-left: 3px;color: red;"></i><span>';
1768
1618
  html += this.deleteText;
1769
1619
  html += '</span></a>';
@@ -1844,6 +1694,22 @@ var RAWidgetContainer = /** @class */ (function () {
1844
1694
  if (this.currentComponent)
1845
1695
  this.popupInstance.removeMe(this.currentComponent);
1846
1696
  };
1697
+ RAWidgetContainer.prototype.getwidgetTitleTranslation = function (item) {
1698
+ var rKey = 'DBW_' + this.translateService.makeCode(item);
1699
+ var translatedString = '';
1700
+ if (this.dashboardService.clientId) {
1701
+ var translationModule = this.dashboardService.clientId + '_DBW';
1702
+ translatedString = this.translateService.translate(translationModule + '.' + rKey);
1703
+ if (translatedString.toLowerCase() === rKey.toLowerCase()) {
1704
+ return item;
1705
+ }
1706
+ else {
1707
+ return translatedString;
1708
+ }
1709
+ }
1710
+ else
1711
+ return item;
1712
+ };
1847
1713
  RAWidgetContainer.ctorParameters = function () { return [
1848
1714
  { type: RaDashboardService },
1849
1715
  { type: NgxUiLoaderService },
@@ -1886,10 +1752,6 @@ var RAWidgetContainer = /** @class */ (function () {
1886
1752
  Input('global-filter'),
1887
1753
  __metadata("design:type", Object)
1888
1754
  ], RAWidgetContainer.prototype, "globalFilter", void 0);
1889
- __decorate([
1890
- Input('dashboard-info'),
1891
- __metadata("design:type", Object)
1892
- ], RAWidgetContainer.prototype, "dashboardInfo", void 0);
1893
1755
  __decorate([
1894
1756
  Input('data'),
1895
1757
  __metadata("design:type", Object)
@@ -1914,14 +1776,6 @@ var RAWidgetContainer = /** @class */ (function () {
1914
1776
  Input('grid-cell-height'),
1915
1777
  __metadata("design:type", Number)
1916
1778
  ], RAWidgetContainer.prototype, "gridCellHeight", void 0);
1917
- __decorate([
1918
- Input('bulk-action-data'),
1919
- __metadata("design:type", Object)
1920
- ], RAWidgetContainer.prototype, "bulkActionData", void 0);
1921
- __decorate([
1922
- Input(),
1923
- __metadata("design:type", Boolean)
1924
- ], RAWidgetContainer.prototype, "canLoadData", void 0);
1925
1779
  __decorate([
1926
1780
  Output(),
1927
1781
  __metadata("design:type", Object)
@@ -1930,14 +1784,6 @@ var RAWidgetContainer = /** @class */ (function () {
1930
1784
  Output(),
1931
1785
  __metadata("design:type", Object)
1932
1786
  ], RAWidgetContainer.prototype, "updateAppliedFilters", void 0);
1933
- __decorate([
1934
- Output(),
1935
- __metadata("design:type", Object)
1936
- ], RAWidgetContainer.prototype, "dataLoaded", void 0);
1937
- __decorate([
1938
- Output(),
1939
- __metadata("design:type", Object)
1940
- ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
1941
1787
  __decorate([
1942
1788
  Input('dom-resized'),
1943
1789
  __metadata("design:type", Boolean),
@@ -4936,13 +4782,11 @@ var RaBaseDashboardTemplate = /** @class */ (function () {
4936
4782
  function RaBaseDashboardTemplate(ngZone) {
4937
4783
  var _this = this;
4938
4784
  this.ngZone = ngZone;
4939
- this.initialize = function (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) {
4785
+ this.initialize = function (eventBus, userDashboardId, appConfig) {
4940
4786
  _this.ngZone.run(function () {
4941
4787
  _this.userDashboardId = userDashboardId;
4942
4788
  _this.appConfig = appConfig;
4943
4789
  _this.raDashboardEventBus = eventBus;
4944
- _this.dashboardInfo = dashboardInfo;
4945
- _this.templateConfig = templateConfig;
4946
4790
  });
4947
4791
  _this.init();
4948
4792
  };