@schneideress/dashboardframework 0.0.271 → 0.0.273

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 +430 -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 +164 -62
  8. package/esm2015/lib/ra-widget-container/ra.widget.container.component.js +64 -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 +166 -62
  17. package/esm5/lib/ra-widget-container/ra.widget.container.component.js +64 -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 +254 -96
  24. package/fesm2015/schneideress-dashboardframework.js.map +1 -1
  25. package/fesm5/schneideress-dashboardframework.js +257 -97
  26. package/fesm5/schneideress-dashboardframework.js.map +1 -1
  27. package/lib/ra-dashboard-area/ra.dashboard.area.d.ts +24 -2
  28. package/lib/ra-widget-container/ra.widget.container.component.d.ts +6 -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,43 @@ 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
+ }
508
+ }
509
+ widgetLoaded(widget) {
510
+ widget.canLoadData = true;
462
511
  }
463
512
  /** To initiate eventbus subsctiptions */
464
513
  inititateEventBusSubscritions() {
@@ -477,6 +526,11 @@ let RADashboardArea = class RADashboardArea {
477
526
  this.addWidget(e);
478
527
  });
479
528
  });
529
+ this.curatedFilterChange = this.raDashboardEventBus.subscribe(RAEvent.CuratedFilterChange).subscribe((e) => {
530
+ this.ngZone.run(() => {
531
+ this.loadWidgets(this.userDashboardId, this.areaKey);
532
+ });
533
+ });
480
534
  this.rearrangeWidgetClick = this.raDashboardEventBus.subscribe(RAEvent.RearrangeClicked).subscribe((e) => {
481
535
  this.ngZone.run(() => {
482
536
  this.rearrangeWidgets();
@@ -525,6 +579,10 @@ let RADashboardArea = class RADashboardArea {
525
579
  this.widgetLibraryDoneClick.unsubscribe();
526
580
  if (this.rearrangeWidgetClick)
527
581
  this.rearrangeWidgetClick.unsubscribe();
582
+ if (this.curatedFilterChange)
583
+ this.curatedFilterChange.unsubscribe();
584
+ if (this.bulkActionClick)
585
+ this.bulkActionClick.unsubscribe();
528
586
  }
529
587
  /**To update position/dimention of all widgets in the area */
530
588
  updateWidgets() {
@@ -560,6 +618,12 @@ let RADashboardArea = class RADashboardArea {
560
618
  }
561
619
  /** To retrieve widgets based on userDashboardid and area name */
562
620
  loadWidgets(userDashboarId, areaKey) {
621
+ if (this.templateConfig && this.templateConfig.initialWidgetCount)
622
+ this.initialWidgetCount = this.templateConfig.initialWidgetCount;
623
+ if (location.href.indexOf('/kiosk/') > -1)
624
+ this.initialWidgetCount = 1000;
625
+ this.currentLoadedIndex = 0;
626
+ this.loading = false;
563
627
  let widgetInfo = {
564
628
  dashboardId: userDashboarId.toString(),
565
629
  dashboardAreaKey: areaKey
@@ -567,7 +631,6 @@ let RADashboardArea = class RADashboardArea {
567
631
  this.widgetList = [];
568
632
  this.dashboardService.getWidgetsByDashboardArea(widgetInfo, this.appConfig).subscribe(widgets => {
569
633
  this.userWidgets = widgets;
570
- this.dashboardService.clientId = widgets[0].clientId;
571
634
  this.PAMWidgets = [];
572
635
  widgets.forEach(element => {
573
636
  var settings = undefined;
@@ -579,8 +642,8 @@ let RADashboardArea = class RADashboardArea {
579
642
  });
580
643
  this.checkPAMWidgets();
581
644
  if (widgets && widgets.length > 0) {
582
- this.widgetList = this.mapObjectListToGridsterItemList(widgets);
583
- this.setAreaHeight();
645
+ this.widgetList = [];
646
+ this.loadWidgetsDelta();
584
647
  this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, false);
585
648
  }
586
649
  else {
@@ -589,6 +652,43 @@ let RADashboardArea = class RADashboardArea {
589
652
  }
590
653
  });
591
654
  }
655
+ loadWidgetsDelta() {
656
+ if (!this.loading) {
657
+ this.loading = true;
658
+ let widgets = this.mapObjectListToGridsterItemList(this.userWidgets.slice(this.currentLoadedIndex, (this.currentLoadedIndex + this.initialWidgetCount)));
659
+ this.currentLoadedIndex += this.initialWidgetCount;
660
+ this.widgetList.push(...widgets);
661
+ this.setAreaHeight();
662
+ setTimeout(() => {
663
+ this.loading = false;
664
+ });
665
+ }
666
+ }
667
+ dataLoaded(widgetElement) {
668
+ this.loadNext();
669
+ }
670
+ loadNext() {
671
+ if (this.divBottom) {
672
+ if (this.elementInViewport(this.divBottom.nativeElement)) {
673
+ this.loadWidgetsDelta();
674
+ }
675
+ }
676
+ }
677
+ elementInViewport(el) {
678
+ var top = el.offsetTop;
679
+ var left = el.offsetLeft;
680
+ var width = el.offsetWidth;
681
+ var height = el.offsetHeight;
682
+ while (el.offsetParent) {
683
+ el = el.offsetParent;
684
+ top += el.offsetTop;
685
+ left += el.offsetLeft;
686
+ }
687
+ return (top >= window.scrollY &&
688
+ left >= window.scrollX &&
689
+ (top + height) <= (window.scrollY + window.innerHeight) &&
690
+ (left + width) <= (window.scrollX + window.innerWidth));
691
+ }
592
692
  /** To set Area(Gridster) height dynamically as widgets are added/removed */
593
693
  setAreaHeight() {
594
694
  setTimeout(() => {
@@ -630,22 +730,22 @@ let RADashboardArea = class RADashboardArea {
630
730
  }
631
731
  /** To remove a widget instance from dashboard and to save info in database */
632
732
  deleteWidget(widgetInstanceId, isalertDisabled = false) {
733
+ let widget = this.userWidgets.filter((item) => {
734
+ return item.widgetInstanceId === widgetInstanceId;
735
+ });
736
+ if (widget.length > 0) {
737
+ this.userWidgets.splice(this.userWidgets.indexOf(widget[0]), 1);
738
+ }
739
+ if (this.PAMWidgets.length > 0) {
740
+ var indx = this.PAMWidgets.indexOf(widgetInstanceId);
741
+ if (indx > -1)
742
+ this.PAMWidgets.splice(indx, 1);
743
+ this.checkPAMWidgets();
744
+ }
633
745
  let gridsterItem = this.widgetList.filter((item) => {
634
746
  return item.widgetInfo.widgetInstanceId === widgetInstanceId;
635
747
  });
636
748
  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
749
  this.widgetList.splice(this.widgetList.indexOf(gridsterItem[0]), 1);
650
750
  this.setAreaHeight();
651
751
  if (!isalertDisabled) {
@@ -659,11 +759,15 @@ let RADashboardArea = class RADashboardArea {
659
759
  }
660
760
  /**To rearrange widgets position in the dashboard, compactLeft&Up,compactLeft,compactUp,etc*/
661
761
  rearrangeWidgets() {
762
+ this.currentLoadedIndex = 0;
763
+ this.loading = false;
662
764
  for (let i = 0; i < this.userWidgets.length; i++) {
663
765
  this.userWidgets[i].position_x = 0;
664
766
  this.userWidgets[i].position_y = 0;
665
767
  }
666
- this.widgetList = this.mapObjectListToGridsterItemList(this.userWidgets);
768
+ this.widgetList = [];
769
+ this.loadWidgetsDelta();
770
+ this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, false);
667
771
  if (this.widgetList.length > 0)
668
772
  this.updateWidgetPosition(this.widgetList[0].widgetInfo.widgetInstanceId);
669
773
  setTimeout(() => {
@@ -695,29 +799,31 @@ let RADashboardArea = class RADashboardArea {
695
799
  this.ngxService.start();
696
800
  this.dashboardService.addWidget(data, this.appConfig).subscribe(widget => {
697
801
  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;
802
+ if (this.currentLoadedIndex >= this.userWidgets.length) {
803
+ let gridsterItem = this.responsiveService.getGridsterItem(widget);
804
+ this.widgetList.push(gridsterItem);
805
+ this.setAreaHeight();
806
+ if (this.options.api) {
807
+ let curRowHeight = Number(this.options.api.getCurrentRowHeight());
808
+ if (curRowHeight > 0) {
809
+ widget.rowHeight = curRowHeight;
810
+ this.gridcellHeight = curRowHeight;
811
+ }
706
812
  }
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
- });
813
+ var widgetInstanceId = 0;
814
+ if (widget && widget.widgetInstanceId) {
815
+ widgetInstanceId = widget.widgetInstanceId;
816
+ /**To save added widget position in db */
817
+ if (this.responsiveService.IsDesktopView) {
818
+ setTimeout(() => {
819
+ this.updateWidgetPosition(widgetInstanceId);
820
+ });
821
+ }
822
+ }
823
+ if (widget.settings && widget.settings.isPAMWidget) {
824
+ this.PAMWidgets.push(widget.widgetInstanceId);
825
+ this.checkPAMWidgets();
716
826
  }
717
- }
718
- if (widget.settings && widget.settings.isPAMWidget) {
719
- this.PAMWidgets.push(widget.widgetInstanceId);
720
- this.checkPAMWidgets();
721
827
  }
722
828
  this.raDashboardEventBus.publish(RAEvent.WidgetAdded, widget);
723
829
  });
@@ -747,12 +853,14 @@ let RADashboardArea = class RADashboardArea {
747
853
  });
748
854
  }
749
855
  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();
856
+ if (this.currentLoadedIndex >= this.userWidgets.length) {
857
+ let gridsterItem = this.responsiveService.getGridsterItem(data);
858
+ this.widgetList.push(gridsterItem);
859
+ this.setAreaHeight();
860
+ if (data.settings && data.settings.isPAMWidget) {
861
+ this.PAMWidgets.push(data.widgetInstanceId);
862
+ this.checkPAMWidgets();
863
+ }
756
864
  }
757
865
  }
758
866
  mapObjectListToGridsterItemList(widgetList) {
@@ -779,8 +887,11 @@ let RADashboardArea = class RADashboardArea {
779
887
  });
780
888
  return widgetListArray;
781
889
  }
782
- addNewWidget() {
783
- this.raDashboardEventBus.publish(RAEvent.AddNewWidgetToDashboard, null);
890
+ buttonClick() {
891
+ if (this.emptyDashboardButtonAction == "widgets")
892
+ this.raDashboardEventBus.publish(RAEvent.AddNewWidgetToDashboard, null);
893
+ else if (this.emptyDashboardButtonAction == "filter")
894
+ this.raDashboardEventBus.publish(RAEvent.GlobalFilterClick, null);
784
895
  }
785
896
  updateAppliedFilters(data) {
786
897
  this.raDashboardEventBus.publish(RAEvent.UpdateAppledFiterForInapplicableFilter, data);
@@ -831,6 +942,14 @@ __decorate([
831
942
  Input('app-config'),
832
943
  __metadata("design:type", Object)
833
944
  ], RADashboardArea.prototype, "appConfig", void 0);
945
+ __decorate([
946
+ Input('dashboard-info'),
947
+ __metadata("design:type", Object)
948
+ ], RADashboardArea.prototype, "dashboardInfo", void 0);
949
+ __decorate([
950
+ Input(),
951
+ __metadata("design:type", Object)
952
+ ], RADashboardArea.prototype, "templateConfig", void 0);
834
953
  __decorate([
835
954
  Output(),
836
955
  __metadata("design:type", Object)
@@ -839,11 +958,15 @@ __decorate([
839
958
  ViewChild('gridWrapper', { static: false }),
840
959
  __metadata("design:type", ElementRef)
841
960
  ], RADashboardArea.prototype, "gridWrapper", void 0);
961
+ __decorate([
962
+ ViewChild('divBottom', { static: false }),
963
+ __metadata("design:type", ElementRef)
964
+ ], RADashboardArea.prototype, "divBottom", void 0);
842
965
  RADashboardArea = __decorate([
843
966
  Component({
844
967
  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}}"]
968
+ 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>",
969
+ 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
970
  }),
848
971
  __metadata("design:paramtypes", [RaDashboardService,
849
972
  NgZone,
@@ -941,8 +1064,11 @@ let RAWidgetContainer = class RAWidgetContainer {
941
1064
  this.showExcell = true;
942
1065
  this.hideTitle = false;
943
1066
  this.inapplicableFilters = [];
1067
+ this.canLoadData = false;
944
1068
  this.widgetDeleted = new EventEmitter();
945
1069
  this.updateAppliedFilters = new EventEmitter();
1070
+ this.dataLoaded = new EventEmitter();
1071
+ this.widgetLoaded = new EventEmitter();
946
1072
  this.isWidgetStateApplicable = false;
947
1073
  this.widgetEmptyState = '';
948
1074
  this.lockVisible = false;
@@ -963,7 +1089,7 @@ let RAWidgetContainer = class RAWidgetContainer {
963
1089
  this.invokeWidgetResizedEvent();
964
1090
  }
965
1091
  ngOnInit() {
966
- this.WidgetDisplayName = this.getwidgetTitleTranslation(this.data.widgetInfo.widgetTitle);
1092
+ this.WidgetDisplayName = this.translateService.translate('Common.' + this.data.widgetInfo.widgetTitle, true);
967
1093
  this.lockIconTitle = this.translateService.translate('Common.lockedfields');
968
1094
  this.lockIconFooter = this.translateService.translate('Common.lockedfieldseditinfo');
969
1095
  this.inapplicableIconTitle = this.translateService.translate('Common.InapplicableFilters');
@@ -979,19 +1105,32 @@ let RAWidgetContainer = class RAWidgetContainer {
979
1105
  });
980
1106
  });
981
1107
  }
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);
1108
+ if (this.widgetElement) {
1109
+ if (changes.bulkActionData && changes.bulkActionData.currentValue != changes.bulkActionData.previousValue) {
1110
+ if (typeof this.widgetElement.bulkActionClicked === "function") {
1111
+ this.widgetElement.bulkActionClicked(this.bulkActionData);
1112
+ }
987
1113
  }
988
- else {
989
- this.refreshWidget(this.data.widgetInfo);
1114
+ if (changes.globalFilter && changes.globalFilter.currentValue != changes.globalFilter.previousValue) {
1115
+ if (!this.dashboardInfo.curatedFilters) {
1116
+ let filterObj = this.getParsedConfig(this.globalFilter);
1117
+ if (filterObj.WidgetInstanceId) {
1118
+ if (this.data.widgetInfo.widgetInstanceId != filterObj.WidgetInstanceId)
1119
+ this.refreshWidget(this.data.widgetInfo);
1120
+ }
1121
+ else {
1122
+ //this.refreshWidget(this.data.widgetInfo);
1123
+ }
1124
+ }
1125
+ }
1126
+ if (changes.width && changes.width.currentValue != changes.width.previousValue ||
1127
+ (changes.height && changes.height.currentValue != changes.height.previousValue)) {
1128
+ this.invokeWidgetResizedEvent();
990
1129
  }
991
1130
  }
992
- if (changes.width && changes.width.currentValue != changes.width.previousValue ||
993
- (changes.height && changes.height.currentValue != changes.height.previousValue)) {
994
- this.invokeWidgetResizedEvent();
1131
+ if (changes.canLoadData && changes.canLoadData.currentValue != changes.canLoadData.previousValue) {
1132
+ if (this.canLoadData)
1133
+ this.refreshWidget(this.data.widgetInfo);
995
1134
  }
996
1135
  }
997
1136
  invokeWidgetResizedEvent() {
@@ -1170,6 +1309,10 @@ let RAWidgetContainer = class RAWidgetContainer {
1170
1309
  this.showPanel = true;
1171
1310
  else
1172
1311
  this.showPanel = false;
1312
+ if (!this.data.dataLoaded) {
1313
+ this.data.dataLoaded = true;
1314
+ this.dataLoaded.emit(this.widgetElement);
1315
+ }
1173
1316
  break;
1174
1317
  case 'onConfigEditClicked':
1175
1318
  this.editWidget();
@@ -1242,7 +1385,9 @@ let RAWidgetContainer = class RAWidgetContainer {
1242
1385
  widgetConfigFilter.configChanges = this.getConfigChanges(false);
1243
1386
  widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
1244
1387
  widgetConfigFilter.globalFilter = this.globalFilter;
1245
- this.widgetElement.loadContent(widgetConfigFilter);
1388
+ widgetConfigFilter.dashboardInfo = me.dashboardInfo;
1389
+ //this.widgetElement.loadContent(widgetConfigFilter);
1390
+ this.widgetLoaded.emit();
1246
1391
  yield this.setLock(widgetConfigFilter.config);
1247
1392
  yield this.setDownloadIcon();
1248
1393
  }));
@@ -1476,9 +1621,12 @@ let RAWidgetContainer = class RAWidgetContainer {
1476
1621
  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
1622
  let settings = '';
1478
1623
  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);
1624
+ if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideEdit)
1625
+ settings += this.getHtmlForButton('wcEditWidget', 'fal fa-edit', this.editText);
1626
+ if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideCopy)
1627
+ settings += this.getHtmlForButton('wcCopyWidget', 'fal fa-copy', this.copyText);
1628
+ if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideMove)
1629
+ settings += this.getHtmlForButton('wcMoveWidget', 'fal fa-arrows-alt', this.moveText);
1482
1630
  }
1483
1631
  let customPageParams = false;
1484
1632
  if (this.data.widgetInfo && this.data.widgetInfo.widgetSettings) {
@@ -1487,14 +1635,14 @@ let RAWidgetContainer = class RAWidgetContainer {
1487
1635
  customPageParams = true;
1488
1636
  }
1489
1637
  }
1490
- if ((this.detailPageUrl || customPageParams) && this.checkVisitLinkVisiblity()) {
1638
+ if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideVisitPage && (this.detailPageUrl || customPageParams) && this.checkVisitLinkVisiblity()) {
1491
1639
  settings += '<a style="max-height: 30px;align-items: center;align-content: center; display: flex;" id="wcVisitWidget">';
1492
1640
  settings += '<i style="padding-left: 4px;font-size: 27px !important;" class="fal fa-angle-right"></i> ';
1493
1641
  settings += '<span style="padding-left: 11px;margin-top: 2px;" style="padding-left: 6px;">';
1494
1642
  settings += this.translateService.translate('Common.visitpage');
1495
1643
  settings += '</span></a>';
1496
1644
  }
1497
- if ((this.detailPageUrl && this.checkVisitLinkVisiblity()) || this.isWidgetMgmnt) {
1645
+ if (!this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideVisitPage && (this.detailPageUrl && this.checkVisitLinkVisiblity()) || this.isWidgetMgmnt) {
1498
1646
  html += '<div style="color: #9FA0A4;font-size: 12px;padding-top: 8px;padding-left: 12px;">';
1499
1647
  html += this.translateService.translate('Common.settings') + '</div>';
1500
1648
  html += settings;
@@ -1526,7 +1674,7 @@ let RAWidgetContainer = class RAWidgetContainer {
1526
1674
  if (this.isDownloadIconVisible && this.isWidgetMgmnt && this.showExcell) {
1527
1675
  html += this.getHr();
1528
1676
  }
1529
- if (this.isWidgetMgmnt) {
1677
+ if (this.isWidgetMgmnt && !this.data.widgetInfo.templateWidgetSettings || !this.data.widgetInfo.templateWidgetSettings.hideDelete) {
1530
1678
  html += '<a id="wcWidgetDelete"><i class="fal fa-times" style="padding-left: 3px;color: red;"></i><span>';
1531
1679
  html += this.deleteText;
1532
1680
  html += '</span></a>';
@@ -1605,18 +1753,6 @@ let RAWidgetContainer = class RAWidgetContainer {
1605
1753
  if (this.currentComponent)
1606
1754
  this.popupInstance.removeMe(this.currentComponent);
1607
1755
  }
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
1756
  };
1621
1757
  RAWidgetContainer.ctorParameters = () => [
1622
1758
  { type: RaDashboardService },
@@ -1660,6 +1796,10 @@ __decorate([
1660
1796
  Input('global-filter'),
1661
1797
  __metadata("design:type", Object)
1662
1798
  ], RAWidgetContainer.prototype, "globalFilter", void 0);
1799
+ __decorate([
1800
+ Input('dashboard-info'),
1801
+ __metadata("design:type", Object)
1802
+ ], RAWidgetContainer.prototype, "dashboardInfo", void 0);
1663
1803
  __decorate([
1664
1804
  Input('data'),
1665
1805
  __metadata("design:type", Object)
@@ -1684,6 +1824,14 @@ __decorate([
1684
1824
  Input('grid-cell-height'),
1685
1825
  __metadata("design:type", Number)
1686
1826
  ], RAWidgetContainer.prototype, "gridCellHeight", void 0);
1827
+ __decorate([
1828
+ Input('bulk-action-data'),
1829
+ __metadata("design:type", Object)
1830
+ ], RAWidgetContainer.prototype, "bulkActionData", void 0);
1831
+ __decorate([
1832
+ Input(),
1833
+ __metadata("design:type", Boolean)
1834
+ ], RAWidgetContainer.prototype, "canLoadData", void 0);
1687
1835
  __decorate([
1688
1836
  Output(),
1689
1837
  __metadata("design:type", Object)
@@ -1692,6 +1840,14 @@ __decorate([
1692
1840
  Output(),
1693
1841
  __metadata("design:type", Object)
1694
1842
  ], RAWidgetContainer.prototype, "updateAppliedFilters", void 0);
1843
+ __decorate([
1844
+ Output(),
1845
+ __metadata("design:type", Object)
1846
+ ], RAWidgetContainer.prototype, "dataLoaded", void 0);
1847
+ __decorate([
1848
+ Output(),
1849
+ __metadata("design:type", Object)
1850
+ ], RAWidgetContainer.prototype, "widgetLoaded", void 0);
1695
1851
  __decorate([
1696
1852
  Input('dom-resized'),
1697
1853
  __metadata("design:type", Boolean),
@@ -4647,11 +4803,13 @@ DashboardFrameworkModule = __decorate([
4647
4803
  class RaBaseDashboardTemplate {
4648
4804
  constructor(ngZone) {
4649
4805
  this.ngZone = ngZone;
4650
- this.initialize = (eventBus, userDashboardId, appConfig) => {
4806
+ this.initialize = (eventBus, userDashboardId, appConfig, dashboardInfo, templateConfig) => {
4651
4807
  this.ngZone.run(() => {
4652
4808
  this.userDashboardId = userDashboardId;
4653
4809
  this.appConfig = appConfig;
4654
4810
  this.raDashboardEventBus = eventBus;
4811
+ this.dashboardInfo = dashboardInfo;
4812
+ this.templateConfig = templateConfig;
4655
4813
  });
4656
4814
  this.init();
4657
4815
  };