@schneideress/dashboardframework 0.0.271 → 0.0.272

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 +415 -118
  2. package/bundles/schneideress-dashboardframework.umd.js.map +1 -1
  3. package/bundles/schneideress-dashboardframework.umd.min.js +1 -15
  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 +159 -62
  8. package/esm2015/lib/ra-widget-container/ra.widget.container.component.js +55 -31
  9. package/esm2015/lib/ra.base.dashboard.template.js +4 -2
  10. package/esm2015/lib/ra.dashboard.responsive.service.js +12 -2
  11. package/esm2015/lib/ra.dashboard.service.js +7 -2
  12. package/esm2015/lib/ra.event.enum.js +7 -1
  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 +160 -62
  17. package/esm5/lib/ra-widget-container/ra.widget.container.component.js +55 -31
  18. package/esm5/lib/ra.base.dashboard.template.js +4 -2
  19. package/esm5/lib/ra.dashboard.responsive.service.js +12 -2
  20. package/esm5/lib/ra.dashboard.service.js +7 -2
  21. package/esm5/lib/ra.event.enum.js +7 -1
  22. package/esm5/lib/ra.gridster.config.js +3 -3
  23. package/fesm2015/schneideress-dashboardframework.js +240 -96
  24. package/fesm2015/schneideress-dashboardframework.js.map +1 -1
  25. package/fesm5/schneideress-dashboardframework.js +242 -97
  26. package/fesm5/schneideress-dashboardframework.js.map +1 -1
  27. package/lib/ra-dashboard-area/ra.dashboard.area.d.ts +23 -2
  28. package/lib/ra-widget-container/ra.widget.container.component.d.ts +5 -2
  29. package/lib/ra.base.dashboard.template.d.ts +4 -2
  30. package/lib/ra.dashboard.responsive.service.d.ts +1 -1
  31. package/lib/ra.dashboard.service.d.ts +0 -1
  32. package/lib/ra.event.enum.d.ts +7 -1
  33. package/package.json +1 -1
  34. package/schneideress-dashboardframework.metadata.json +1 -1
@@ -16,7 +16,6 @@ let RaDashboardService = class RaDashboardService extends BaseService {
16
16
  constructor(injector) {
17
17
  super(injector, '');
18
18
  this.loadedScripts = [];
19
- this.clientId = undefined;
20
19
  }
21
20
  /*
22
21
  * To load external scripts in the dom
@@ -68,6 +67,12 @@ let RaDashboardService = class RaDashboardService extends BaseService {
68
67
  /**To Update widgetInfo in database */
69
68
  updateWidget(widgetInfo, appConfig) {
70
69
  this.baseUrl = appConfig.apiBaseUrl;
70
+ let info = {};
71
+ info.widgetConfigInfo = widgetInfo.widgetConfigInfo;
72
+ info.widgetInstanceId = widgetInfo.widgetInstanceId;
73
+ info.widgetTitle = widgetInfo.widgetTitle;
74
+ info.widgetType = widgetInfo.widgetType;
75
+ info.widgetId = widgetInfo.widgetId;
71
76
  return this.post('widget/UpdateUserWidget', widgetInfo);
72
77
  }
73
78
  /** To Move or change position if current widget container*/
@@ -181,6 +186,12 @@ var RAEvent;
181
186
  RAEvent["UpdateAppledFiterForInapplicableFilter"] = "UpdateAppledFiterForInapplicableFilter";
182
187
  /**show inapplicable filter message in global filter flyout */
183
188
  RAEvent["ShowInapplicableFilterMessage"] = "ShowInapplicableFilterMessage";
189
+ /** Bulk Action Clicked */
190
+ RAEvent["BulkActionClick"] = "BulkActionClick";
191
+ /** Global Filter Clicked */
192
+ /** When user change the curated filter(eg:data streams), system will create/delete widgets */
193
+ RAEvent["CuratedFilterChange"] = "CuratedFilterChange";
194
+ RAEvent["GlobalFilterClick"] = "GlobalFilterClick";
184
195
  })(RAEvent || (RAEvent = {}));
185
196
  var RAEventKey;
186
197
  (function (RAEventKey) {
@@ -194,9 +205,9 @@ const GridsterConfigDefaultSettings = {
194
205
  margin: 10,
195
206
  outerMargin: true,
196
207
  outerMarginTop: 10,
197
- outerMarginRight: 10,
208
+ outerMarginRight: 0,
198
209
  outerMarginBottom: 30,
199
- outerMarginLeft: 10,
210
+ outerMarginLeft: 0,
200
211
  useTransformPositioning: true,
201
212
  mobileBreakpoint: 640,
202
213
  minCols: 10,
@@ -301,7 +312,7 @@ let RADashboardResponsiveService = class RADashboardResponsiveService {
301
312
  check = true;
302
313
  return check;
303
314
  }
304
- getGridsterConfig(isWidgetMgmnt) {
315
+ getGridsterConfig(isWidgetMgmnt, resize, canMove) {
305
316
  let config = GridsterConfigDefaultSettings;
306
317
  config.minCols = this.currentResInfo.maxCols;
307
318
  config.maxCols = this.currentResInfo.maxCols;
@@ -323,6 +334,13 @@ let RADashboardResponsiveService = class RADashboardResponsiveService {
323
334
  config.swap = true;
324
335
  config.draggable.enabled = true;
325
336
  }
337
+ if (!resize) {
338
+ config.resizable.enabled = false;
339
+ config.swap = false;
340
+ }
341
+ if (!canMove) {
342
+ config.draggable.enabled = false;
343
+ }
326
344
  return config;
327
345
  }
328
346
  /**To map IwidgetInfo object to gridsterItem */
@@ -330,6 +348,9 @@ let RADashboardResponsiveService = class RADashboardResponsiveService {
330
348
  if (widget.widgetSettings) {
331
349
  widget.settings = JSON.parse(widget.widgetSettings);
332
350
  }
351
+ if (widget.templateSettings) {
352
+ widget.templateWidgetSettings = JSON.parse(widget.templateSettings);
353
+ }
333
354
  let gridsterItem = {
334
355
  cols: this.getWidth(widget.width),
335
356
  rows: this.getHeight(widget.height),
@@ -396,13 +417,20 @@ let RADashboardArea = class RADashboardArea {
396
417
  this.domResized = false;
397
418
  this.showEmptyDashboard = false;
398
419
  this.isWidgetMgmnt = false;
420
+ this.initialWidgetCount = 10;
421
+ this.currentLoadedIndex = 0;
422
+ this.loading = false;
399
423
  this.widgetHeight = 2;
400
424
  this.widgetWidth = 4;
401
425
  this.hideDashboardBanner = new EventEmitter();
402
426
  }
403
427
  ngOnInit() {
428
+ window.addEventListener('scroll', () => {
429
+ this.loadNext();
430
+ });
404
431
  this.isWidgetMgmnt = this.permissionService.hasPermission('ra.widgetmanagement');
405
432
  this.initiateGridsterConfig();
433
+ this.setEmptyDashboardConfig();
406
434
  this.lastViewType = this.responsiveService.IsDesktopView ? 'desktop' : 'mobile';
407
435
  this.responsiveService.resized.subscribe((isDesktop) => {
408
436
  if (this.lastViewType != (isDesktop ? 'desktop' : 'mobile') || !isDesktop) {
@@ -431,6 +459,11 @@ let RADashboardArea = class RADashboardArea {
431
459
  }, 100);
432
460
  }
433
461
  });
462
+ setTimeout(() => {
463
+ this.bulkActionClick = this.raDashboardEventBus.subscribe(RAEvent.BulkActionClick).subscribe((data) => {
464
+ this.bulkActionData = JSON.parse(JSON.stringify(data)); // To create a new reference;
465
+ });
466
+ });
434
467
  }
435
468
  ngOnChanges(changes) {
436
469
  this.isWidgetMgmnt = this.permissionService.hasPermission('ra.widgetmanagement');
@@ -438,27 +471,40 @@ let RADashboardArea = class RADashboardArea {
438
471
  this.isWidgetLoaded = true;
439
472
  this.loadWidgets(this.userDashboardId, this.areaKey);
440
473
  }
474
+ this.initiateGridsterConfig();
441
475
  if (changes.raDashboardEventBus && changes.raDashboardEventBus.currentValue != changes.raDashboardEventBus.previousValue) {
442
476
  this.inititateEventBusSubscritions();
443
477
  }
444
478
  }
479
+ setEmptyDashboardConfig() {
480
+ if (this.dashboardInfo && this.dashboardInfo.templateConfig.emptyDashboardHeader) {
481
+ this.emptyDashboardTitle = this.translateService.translate("dashboard." + this.dashboardInfo.templateConfig.emptyDashboardHeader.titleKey);
482
+ this.emptyDashboardMsg1 = this.translateService.translate("dashboard." + this.dashboardInfo.templateConfig.emptyDashboardHeader.descriptionKey1);
483
+ this.emptyDashboardMsg2 = (this.dashboardInfo.templateConfig.emptyDashboardHeader.descriptionKey2) ? this.translateService.translate("dashboard." + this.dashboardInfo.templateConfig.emptyDashboardHeader.descriptionKey2) : '';
484
+ this.emptyDashboardButtonText = this.translateService.translate("dashboard." + this.dashboardInfo.templateConfig.emptyDashboardHeader.buttonTextKey);
485
+ this.emptyDashboardButtonIcon = this.dashboardInfo.templateConfig.emptyDashboardHeader.buttonIcon ? this.dashboardInfo.templateConfig.emptyDashboardHeader.buttonIcon : '';
486
+ this.emptyDashboardButtonAction = this.dashboardInfo.templateConfig.emptyDashboardHeader.buttonAction ? this.dashboardInfo.templateConfig.emptyDashboardHeader.buttonAction : '';
487
+ }
488
+ }
445
489
  /**To set GridsterConfig */
446
490
  initiateGridsterConfig() {
447
- /**To override default configuration values to the gridster control */
448
- this.options = this.responsiveService.getGridsterConfig(this.isWidgetMgmnt);
449
- this.options.initCallback = (gridster) => {
450
- if (this.options.api) {
451
- this.gridcellHeight = this.options.api.getCurrentRowHeight();
452
- }
453
- };
454
- this.options.itemChangeCallback = (item) => {
455
- if (this.responsiveService.IsDesktopView) {
456
- if (item.widgetInfo && item.widgetInfo.widgetInstanceId) {
457
- this.updateWidgetPosition(item.widgetInfo.widgetInstanceId);
491
+ if (this.dashboardInfo) {
492
+ /**To override default configuration values to the gridster control */
493
+ this.options = this.responsiveService.getGridsterConfig(this.isWidgetMgmnt, this.dashboardInfo.templateConfig.widget.canResize, this.dashboardInfo.templateConfig.widget.canMove);
494
+ this.options.initCallback = (gridster) => {
495
+ if (this.options.api) {
496
+ this.gridcellHeight = this.options.api.getCurrentRowHeight();
458
497
  }
459
- }
460
- this.setAreaHeight();
461
- };
498
+ };
499
+ this.options.itemChangeCallback = (item) => {
500
+ if (this.responsiveService.IsDesktopView) {
501
+ if (item.widgetInfo && item.widgetInfo.widgetInstanceId) {
502
+ this.updateWidgetPosition(item.widgetInfo.widgetInstanceId);
503
+ }
504
+ }
505
+ this.setAreaHeight();
506
+ };
507
+ }
462
508
  }
463
509
  /** To initiate eventbus subsctiptions */
464
510
  inititateEventBusSubscritions() {
@@ -477,6 +523,11 @@ let RADashboardArea = class RADashboardArea {
477
523
  this.addWidget(e);
478
524
  });
479
525
  });
526
+ this.curatedFilterChange = this.raDashboardEventBus.subscribe(RAEvent.CuratedFilterChange).subscribe((e) => {
527
+ this.ngZone.run(() => {
528
+ this.loadWidgets(this.userDashboardId, this.areaKey);
529
+ });
530
+ });
480
531
  this.rearrangeWidgetClick = this.raDashboardEventBus.subscribe(RAEvent.RearrangeClicked).subscribe((e) => {
481
532
  this.ngZone.run(() => {
482
533
  this.rearrangeWidgets();
@@ -525,6 +576,10 @@ let RADashboardArea = class RADashboardArea {
525
576
  this.widgetLibraryDoneClick.unsubscribe();
526
577
  if (this.rearrangeWidgetClick)
527
578
  this.rearrangeWidgetClick.unsubscribe();
579
+ if (this.curatedFilterChange)
580
+ this.curatedFilterChange.unsubscribe();
581
+ if (this.bulkActionClick)
582
+ this.bulkActionClick.unsubscribe();
528
583
  }
529
584
  /**To update position/dimention of all widgets in the area */
530
585
  updateWidgets() {
@@ -560,6 +615,12 @@ let RADashboardArea = class RADashboardArea {
560
615
  }
561
616
  /** To retrieve widgets based on userDashboardid and area name */
562
617
  loadWidgets(userDashboarId, areaKey) {
618
+ if (this.templateConfig && this.templateConfig.initialWidgetCount)
619
+ this.initialWidgetCount = this.templateConfig.initialWidgetCount;
620
+ if (location.href.indexOf('loadAllWidgets') > -1)
621
+ this.initialWidgetCount = 1000;
622
+ this.currentLoadedIndex = 0;
623
+ this.loading = false;
563
624
  let widgetInfo = {
564
625
  dashboardId: userDashboarId.toString(),
565
626
  dashboardAreaKey: areaKey
@@ -567,7 +628,6 @@ let RADashboardArea = class RADashboardArea {
567
628
  this.widgetList = [];
568
629
  this.dashboardService.getWidgetsByDashboardArea(widgetInfo, this.appConfig).subscribe(widgets => {
569
630
  this.userWidgets = widgets;
570
- this.dashboardService.clientId = widgets[0].clientId;
571
631
  this.PAMWidgets = [];
572
632
  widgets.forEach(element => {
573
633
  var settings = undefined;
@@ -579,8 +639,8 @@ let RADashboardArea = class RADashboardArea {
579
639
  });
580
640
  this.checkPAMWidgets();
581
641
  if (widgets && widgets.length > 0) {
582
- this.widgetList = this.mapObjectListToGridsterItemList(widgets);
583
- this.setAreaHeight();
642
+ this.widgetList = [];
643
+ this.loadWidgetsDelta();
584
644
  this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, false);
585
645
  }
586
646
  else {
@@ -589,6 +649,41 @@ let RADashboardArea = class RADashboardArea {
589
649
  }
590
650
  });
591
651
  }
652
+ loadWidgetsDelta() {
653
+ if (!this.loading) {
654
+ this.loading = true;
655
+ let widgets = this.mapObjectListToGridsterItemList(this.userWidgets.slice(this.currentLoadedIndex, (this.currentLoadedIndex + this.initialWidgetCount)));
656
+ this.currentLoadedIndex += this.initialWidgetCount;
657
+ this.widgetList.push(...widgets);
658
+ this.setAreaHeight();
659
+ this.loading = false;
660
+ }
661
+ }
662
+ dataLoaded(widgetElement) {
663
+ this.loadNext();
664
+ }
665
+ loadNext() {
666
+ if (this.divBottom) {
667
+ if (this.elementInViewport(this.divBottom.nativeElement)) {
668
+ this.loadWidgetsDelta();
669
+ }
670
+ }
671
+ }
672
+ elementInViewport(el) {
673
+ var top = el.offsetTop;
674
+ var left = el.offsetLeft;
675
+ var width = el.offsetWidth;
676
+ var height = el.offsetHeight;
677
+ while (el.offsetParent) {
678
+ el = el.offsetParent;
679
+ top += el.offsetTop;
680
+ left += el.offsetLeft;
681
+ }
682
+ return (top >= window.scrollY &&
683
+ left >= window.scrollX &&
684
+ (top + height) <= (window.scrollY + window.innerHeight) &&
685
+ (left + width) <= (window.scrollX + window.innerWidth));
686
+ }
592
687
  /** To set Area(Gridster) height dynamically as widgets are added/removed */
593
688
  setAreaHeight() {
594
689
  setTimeout(() => {
@@ -630,22 +725,22 @@ let RADashboardArea = class RADashboardArea {
630
725
  }
631
726
  /** To remove a widget instance from dashboard and to save info in database */
632
727
  deleteWidget(widgetInstanceId, isalertDisabled = false) {
728
+ let widget = this.userWidgets.filter((item) => {
729
+ return item.widgetInstanceId === widgetInstanceId;
730
+ });
731
+ if (widget.length > 0) {
732
+ this.userWidgets.splice(this.userWidgets.indexOf(widget[0]), 1);
733
+ }
734
+ if (this.PAMWidgets.length > 0) {
735
+ var indx = this.PAMWidgets.indexOf(widgetInstanceId);
736
+ if (indx > -1)
737
+ this.PAMWidgets.splice(indx, 1);
738
+ this.checkPAMWidgets();
739
+ }
633
740
  let gridsterItem = this.widgetList.filter((item) => {
634
741
  return item.widgetInfo.widgetInstanceId === widgetInstanceId;
635
742
  });
636
743
  if (gridsterItem.length > 0) {
637
- let widget = this.userWidgets.filter((item) => {
638
- return item.widgetInstanceId === widgetInstanceId;
639
- });
640
- if (widget.length > 0) {
641
- this.userWidgets.splice(this.userWidgets.indexOf(widget[0]), 1);
642
- }
643
- if (this.PAMWidgets.length > 0) {
644
- var indx = this.PAMWidgets.indexOf(widgetInstanceId);
645
- if (indx > -1)
646
- this.PAMWidgets.splice(indx, 1);
647
- this.checkPAMWidgets();
648
- }
649
744
  this.widgetList.splice(this.widgetList.indexOf(gridsterItem[0]), 1);
650
745
  this.setAreaHeight();
651
746
  if (!isalertDisabled) {
@@ -659,11 +754,15 @@ let RADashboardArea = class RADashboardArea {
659
754
  }
660
755
  /**To rearrange widgets position in the dashboard, compactLeft&Up,compactLeft,compactUp,etc*/
661
756
  rearrangeWidgets() {
757
+ this.currentLoadedIndex = 0;
758
+ this.loading = false;
662
759
  for (let i = 0; i < this.userWidgets.length; i++) {
663
760
  this.userWidgets[i].position_x = 0;
664
761
  this.userWidgets[i].position_y = 0;
665
762
  }
666
- this.widgetList = this.mapObjectListToGridsterItemList(this.userWidgets);
763
+ this.widgetList = [];
764
+ this.loadWidgetsDelta();
765
+ this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, false);
667
766
  if (this.widgetList.length > 0)
668
767
  this.updateWidgetPosition(this.widgetList[0].widgetInfo.widgetInstanceId);
669
768
  setTimeout(() => {
@@ -695,29 +794,31 @@ let RADashboardArea = class RADashboardArea {
695
794
  this.ngxService.start();
696
795
  this.dashboardService.addWidget(data, this.appConfig).subscribe(widget => {
697
796
  this.userWidgets.push(widget);
698
- let gridsterItem = this.responsiveService.getGridsterItem(widget);
699
- this.widgetList.push(gridsterItem);
700
- this.setAreaHeight();
701
- if (this.options.api) {
702
- let curRowHeight = Number(this.options.api.getCurrentRowHeight());
703
- if (curRowHeight > 0) {
704
- widget.rowHeight = curRowHeight;
705
- this.gridcellHeight = curRowHeight;
797
+ if (this.currentLoadedIndex >= this.userWidgets.length) {
798
+ let gridsterItem = this.responsiveService.getGridsterItem(widget);
799
+ this.widgetList.push(gridsterItem);
800
+ this.setAreaHeight();
801
+ if (this.options.api) {
802
+ let curRowHeight = Number(this.options.api.getCurrentRowHeight());
803
+ if (curRowHeight > 0) {
804
+ widget.rowHeight = curRowHeight;
805
+ this.gridcellHeight = curRowHeight;
806
+ }
706
807
  }
707
- }
708
- var widgetInstanceId = 0;
709
- if (widget && widget.widgetInstanceId) {
710
- widgetInstanceId = widget.widgetInstanceId;
711
- /**To save added widget position in db */
712
- if (this.responsiveService.IsDesktopView) {
713
- setTimeout(() => {
714
- this.updateWidgetPosition(widgetInstanceId);
715
- });
808
+ var widgetInstanceId = 0;
809
+ if (widget && widget.widgetInstanceId) {
810
+ widgetInstanceId = widget.widgetInstanceId;
811
+ /**To save added widget position in db */
812
+ if (this.responsiveService.IsDesktopView) {
813
+ setTimeout(() => {
814
+ this.updateWidgetPosition(widgetInstanceId);
815
+ });
816
+ }
817
+ }
818
+ if (widget.settings && widget.settings.isPAMWidget) {
819
+ this.PAMWidgets.push(widget.widgetInstanceId);
820
+ this.checkPAMWidgets();
716
821
  }
717
- }
718
- if (widget.settings && widget.settings.isPAMWidget) {
719
- this.PAMWidgets.push(widget.widgetInstanceId);
720
- this.checkPAMWidgets();
721
822
  }
722
823
  this.raDashboardEventBus.publish(RAEvent.WidgetAdded, widget);
723
824
  });
@@ -747,12 +848,14 @@ let RADashboardArea = class RADashboardArea {
747
848
  });
748
849
  }
749
850
  this.userWidgets.push(data);
750
- let gridsterItem = this.responsiveService.getGridsterItem(data);
751
- this.widgetList.push(gridsterItem);
752
- this.setAreaHeight();
753
- if (data.settings && data.settings.isPAMWidget) {
754
- this.PAMWidgets.push(data.widgetInstanceId);
755
- this.checkPAMWidgets();
851
+ if (this.currentLoadedIndex >= this.userWidgets.length) {
852
+ let gridsterItem = this.responsiveService.getGridsterItem(data);
853
+ this.widgetList.push(gridsterItem);
854
+ this.setAreaHeight();
855
+ if (data.settings && data.settings.isPAMWidget) {
856
+ this.PAMWidgets.push(data.widgetInstanceId);
857
+ this.checkPAMWidgets();
858
+ }
756
859
  }
757
860
  }
758
861
  mapObjectListToGridsterItemList(widgetList) {
@@ -779,8 +882,11 @@ let RADashboardArea = class RADashboardArea {
779
882
  });
780
883
  return widgetListArray;
781
884
  }
782
- addNewWidget() {
783
- this.raDashboardEventBus.publish(RAEvent.AddNewWidgetToDashboard, null);
885
+ buttonClick() {
886
+ if (this.emptyDashboardButtonAction == "widgets")
887
+ this.raDashboardEventBus.publish(RAEvent.AddNewWidgetToDashboard, null);
888
+ else if (this.emptyDashboardButtonAction == "filter")
889
+ this.raDashboardEventBus.publish(RAEvent.GlobalFilterClick, null);
784
890
  }
785
891
  updateAppliedFilters(data) {
786
892
  this.raDashboardEventBus.publish(RAEvent.UpdateAppledFiterForInapplicableFilter, data);
@@ -831,6 +937,14 @@ __decorate([
831
937
  Input('app-config'),
832
938
  __metadata("design:type", Object)
833
939
  ], RADashboardArea.prototype, "appConfig", void 0);
940
+ __decorate([
941
+ Input('dashboard-info'),
942
+ __metadata("design:type", Object)
943
+ ], RADashboardArea.prototype, "dashboardInfo", void 0);
944
+ __decorate([
945
+ Input(),
946
+ __metadata("design:type", Object)
947
+ ], RADashboardArea.prototype, "templateConfig", void 0);
834
948
  __decorate([
835
949
  Output(),
836
950
  __metadata("design:type", Object)
@@ -839,11 +953,15 @@ __decorate([
839
953
  ViewChild('gridWrapper', { static: false }),
840
954
  __metadata("design:type", ElementRef)
841
955
  ], RADashboardArea.prototype, "gridWrapper", void 0);
956
+ __decorate([
957
+ ViewChild('divBottom', { static: false }),
958
+ __metadata("design:type", ElementRef)
959
+ ], RADashboardArea.prototype, "divBottom", void 0);
842
960
  RADashboardArea = __decorate([
843
961
  Component({
844
962
  selector: 'ra-dashboard-area',
845
- 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>",
846
- 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}}"]
963
+ 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 (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>",
964
+ 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}}"]
847
965
  }),
848
966
  __metadata("design:paramtypes", [RaDashboardService,
849
967
  NgZone,
@@ -943,6 +1061,8 @@ let RAWidgetContainer = class RAWidgetContainer {
943
1061
  this.inapplicableFilters = [];
944
1062
  this.widgetDeleted = new EventEmitter();
945
1063
  this.updateAppliedFilters = new EventEmitter();
1064
+ this.dataLoaded = new EventEmitter();
1065
+ this.widgetLoaded = new EventEmitter();
946
1066
  this.isWidgetStateApplicable = false;
947
1067
  this.widgetEmptyState = '';
948
1068
  this.lockVisible = false;
@@ -963,7 +1083,7 @@ let RAWidgetContainer = class RAWidgetContainer {
963
1083
  this.invokeWidgetResizedEvent();
964
1084
  }
965
1085
  ngOnInit() {
966
- this.WidgetDisplayName = this.getwidgetTitleTranslation(this.data.widgetInfo.widgetTitle);
1086
+ this.WidgetDisplayName = this.translateService.translate('Common.' + this.data.widgetInfo.widgetTitle, true);
967
1087
  this.lockIconTitle = this.translateService.translate('Common.lockedfields');
968
1088
  this.lockIconFooter = this.translateService.translate('Common.lockedfieldseditinfo');
969
1089
  this.inapplicableIconTitle = this.translateService.translate('Common.InapplicableFilters');
@@ -979,19 +1099,28 @@ let RAWidgetContainer = class RAWidgetContainer {
979
1099
  });
980
1100
  });
981
1101
  }
982
- if (this.widgetElement && changes.globalFilter && changes.globalFilter.currentValue != changes.globalFilter.previousValue) {
983
- let filterObj = this.getParsedConfig(this.globalFilter);
984
- if (filterObj.WidgetInstanceId) {
985
- if (this.data.widgetInfo.widgetInstanceId != filterObj.WidgetInstanceId)
986
- this.refreshWidget(this.data.widgetInfo);
1102
+ if (this.widgetElement) {
1103
+ if (changes.bulkActionData && changes.bulkActionData.currentValue != changes.bulkActionData.previousValue) {
1104
+ if (typeof this.widgetElement.bulkActionClicked === "function") {
1105
+ this.widgetElement.bulkActionClicked(this.bulkActionData);
1106
+ }
987
1107
  }
988
- else {
989
- this.refreshWidget(this.data.widgetInfo);
1108
+ if (changes.globalFilter && changes.globalFilter.currentValue != changes.globalFilter.previousValue) {
1109
+ if (!this.dashboardInfo.curatedFilters) {
1110
+ let filterObj = this.getParsedConfig(this.globalFilter);
1111
+ if (filterObj.WidgetInstanceId) {
1112
+ if (this.data.widgetInfo.widgetInstanceId != filterObj.WidgetInstanceId)
1113
+ this.refreshWidget(this.data.widgetInfo);
1114
+ }
1115
+ else {
1116
+ //this.refreshWidget(this.data.widgetInfo);
1117
+ }
1118
+ }
1119
+ }
1120
+ if (changes.width && changes.width.currentValue != changes.width.previousValue ||
1121
+ (changes.height && changes.height.currentValue != changes.height.previousValue)) {
1122
+ this.invokeWidgetResizedEvent();
990
1123
  }
991
- }
992
- if (changes.width && changes.width.currentValue != changes.width.previousValue ||
993
- (changes.height && changes.height.currentValue != changes.height.previousValue)) {
994
- this.invokeWidgetResizedEvent();
995
1124
  }
996
1125
  }
997
1126
  invokeWidgetResizedEvent() {
@@ -1170,6 +1299,10 @@ let RAWidgetContainer = class RAWidgetContainer {
1170
1299
  this.showPanel = true;
1171
1300
  else
1172
1301
  this.showPanel = false;
1302
+ if (!this.data.dataLoaded) {
1303
+ this.data.dataLoaded = true;
1304
+ this.dataLoaded.emit(this.widgetElement);
1305
+ }
1173
1306
  break;
1174
1307
  case 'onConfigEditClicked':
1175
1308
  this.editWidget();
@@ -1242,7 +1375,9 @@ let RAWidgetContainer = class RAWidgetContainer {
1242
1375
  widgetConfigFilter.configChanges = this.getConfigChanges(false);
1243
1376
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1244
1377
  widgetConfigFilter.globalFilter = this.globalFilter;
1378
+ widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1245
1379
  this.widgetElement.loadContent(widgetConfigFilter);
1380
+ this.widgetLoaded.emit();
1246
1381
  yield this.setLock(widgetConfigFilter.config);
1247
1382
  yield this.setDownloadIcon();
1248
1383
  }));
@@ -1476,9 +1611,12 @@ let RAWidgetContainer = class RAWidgetContainer {
1476
1611
  let html = '<div id="ra-db-widget-menu"' + 'style="' + style + '" class="download-content dropdown-content widget-config-item dropdown-click" style="z-index: 1002;">';
1477
1612
  let settings = '';
1478
1613
  if (this.isWidgetMgmnt) {
1479
- settings += this.getHtmlForButton('wcEditWidget', 'fal fa-edit', this.editText);
1480
- settings += this.getHtmlForButton('wcCopyWidget', 'fal fa-copy', this.copyText);
1481
- settings += this.getHtmlForButton('wcMoveWidget', 'fal fa-arrows-alt', this.moveText);
1614
+ if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideEdit)
1615
+ settings += this.getHtmlForButton('wcEditWidget', 'fal fa-edit', this.editText);
1616
+ if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideCopy)
1617
+ settings += this.getHtmlForButton('wcCopyWidget', 'fal fa-copy', this.copyText);
1618
+ if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideMove)
1619
+ settings += this.getHtmlForButton('wcMoveWidget', 'fal fa-arrows-alt', this.moveText);
1482
1620
  }
1483
1621
  let customPageParams = false;
1484
1622
  if (this.data.widgetInfo && this.data.widgetInfo.widgetSettings) {
@@ -1487,14 +1625,14 @@ let RAWidgetContainer = class RAWidgetContainer {
1487
1625
  customPageParams = true;
1488
1626
  }
1489
1627
  }
1490
- if ((this.detailPageUrl || customPageParams) && this.checkVisitLinkVisiblity()) {
1628
+ if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideVisitPage && (this.detailPageUrl || customPageParams) && this.checkVisitLinkVisiblity()) {
1491
1629
  settings += '<a style="max-height: 30px;align-items: center;align-content: center; display: flex;" id="wcVisitWidget">';
1492
1630
  settings += '<i style="padding-left: 4px;font-size: 27px !important;" class="fal fa-angle-right"></i> ';
1493
1631
  settings += '<span style="padding-left: 11px;margin-top: 2px;" style="padding-left: 6px;">';
1494
1632
  settings += this.translateService.translate('Common.visitpage');
1495
1633
  settings += '</span></a>';
1496
1634
  }
1497
- if ((this.detailPageUrl && this.checkVisitLinkVisiblity()) || this.isWidgetMgmnt) {
1635
+ if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideVisitPage && (this.detailPageUrl && this.checkVisitLinkVisiblity()) || this.isWidgetMgmnt) {
1498
1636
  html += '<div style="color: #9FA0A4;font-size: 12px;padding-top: 8px;padding-left: 12px;">';
1499
1637
  html += this.translateService.translate('Common.settings') + '</div>';
1500
1638
  html += settings;
@@ -1526,7 +1664,7 @@ let RAWidgetContainer = class RAWidgetContainer {
1526
1664
  if (this.isDownloadIconVisible && this.isWidgetMgmnt && this.showExcell) {
1527
1665
  html += this.getHr();
1528
1666
  }
1529
- if (this.isWidgetMgmnt) {
1667
+ if (this.isWidgetMgmnt && !this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideDelete) {
1530
1668
  html += '<a id="wcWidgetDelete"><i class="fal fa-times" style="padding-left: 3px;color: red;"></i><span>';
1531
1669
  html += this.deleteText;
1532
1670
  html += '</span></a>';
@@ -1605,18 +1743,6 @@ let RAWidgetContainer = class RAWidgetContainer {
1605
1743
  if (this.currentComponent)
1606
1744
  this.popupInstance.removeMe(this.currentComponent);
1607
1745
  }
1608
- getwidgetTitleTranslation(item) {
1609
- let rKey = 'DBW_' + this.translateService.makeCode(item);
1610
- let translatedString = '';
1611
- const translationModule = this.dashboardService.clientId + '_DBW';
1612
- translatedString = this.translateService.translate(translationModule + '.' + rKey);
1613
- if (translatedString.toLowerCase() === rKey.toLowerCase()) {
1614
- return item;
1615
- }
1616
- else {
1617
- return translatedString;
1618
- }
1619
- }
1620
1746
  };
1621
1747
  RAWidgetContainer.ctorParameters = () => [
1622
1748
  { type: RaDashboardService },
@@ -1660,6 +1786,10 @@ __decorate([
1660
1786
  Input('global-filter'),
1661
1787
  __metadata("design:type", Object)
1662
1788
  ], RAWidgetContainer.prototype, "globalFilter", void 0);
1789
+ __decorate([
1790
+ Input('dashboard-info'),
1791
+ __metadata("design:type", Object)
1792
+ ], RAWidgetContainer.prototype, "dashboardInfo", void 0);
1663
1793
  __decorate([
1664
1794
  Input('data'),
1665
1795
  __metadata("design:type", Object)
@@ -1684,6 +1814,10 @@ __decorate([
1684
1814
  Input('grid-cell-height'),
1685
1815
  __metadata("design:type", Number)
1686
1816
  ], RAWidgetContainer.prototype, "gridCellHeight", void 0);
1817
+ __decorate([
1818
+ Input('bulk-action-data'),
1819
+ __metadata("design:type", Object)
1820
+ ], RAWidgetContainer.prototype, "bulkActionData", void 0);
1687
1821
  __decorate([
1688
1822
  Output(),
1689
1823
  __metadata("design:type", Object)
@@ -1692,6 +1826,14 @@ __decorate([
1692
1826
  Output(),
1693
1827
  __metadata("design:type", Object)
1694
1828
  ], RAWidgetContainer.prototype, "updateAppliedFilters", void 0);
1829
+ __decorate([
1830
+ Output(),
1831
+ __metadata("design:type", Object)
1832
+ ], RAWidgetContainer.prototype, "dataLoaded", void 0);
1833
+ __decorate([
1834
+ Output(),
1835
+ __metadata("design:type", Object)
1836
+ ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
1695
1837
  __decorate([
1696
1838
  Input('dom-resized'),
1697
1839
  __metadata("design:type", Boolean),
@@ -4647,11 +4789,13 @@ DashboardFrameworkModule = __decorate([
4647
4789
  class RaBaseDashboardTemplate {
4648
4790
  constructor(ngZone) {
4649
4791
  this.ngZone = ngZone;
4650
- this.initialize = (eventBus, userDashboardId, appConfig) => {
4792
+ this.initialize = (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) => {
4651
4793
  this.ngZone.run(() => {
4652
4794
  this.userDashboardId = userDashboardId;
4653
4795
  this.appConfig = appConfig;
4654
4796
  this.raDashboardEventBus = eventBus;
4797
+ this.dashboardInfo = dashboardInfo;
4798
+ this.templateConfig = templateConfig;
4655
4799
  });
4656
4800
  this.init();
4657
4801
  };