@schneideress/dashboardframework 20.0.1 → 20.0.3

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.
@@ -164,6 +164,8 @@ var RAEvent;
164
164
  RAEvent["SnapShotClick"] = "SnapShotClick";
165
165
  /** Event on emission report snapshot selected from list*/
166
166
  RAEvent["SnapShotSelected"] = "SnapShotSelected";
167
+ /** Event to update widget count */
168
+ RAEvent["UpdateWidgetCount"] = "UpdateWidgetCount";
167
169
  })(RAEvent || (RAEvent = {}));
168
170
  var RAEventKey;
169
171
  (function (RAEventKey) {
@@ -4015,7 +4017,7 @@ class RAWidgetContainer {
4015
4017
  this.setInapplicableFilters(undefined, this.data.widgetInfo.widgetInstanceId);
4016
4018
  }
4017
4019
  else {
4018
- widgetContainerContext.notifier.notify('error', " " + this.translateService.translate('FailedToRemoveWidget') + " (" + this.translateService.translate('Common.' + this.data.widgetInfo.widgetTitle, true) + ")!");
4020
+ widgetContainerContext.notifier.notify('error', " " + this.translateService.translate('Dashboard.FailedToRemoveWidget') + " (" + this.translateService.translate('Common.' + this.data.widgetInfo.widgetTitle, true) + ")!");
4019
4021
  }
4020
4022
  });
4021
4023
  }
@@ -4679,16 +4681,13 @@ class RAWidgetContainer {
4679
4681
  let translatedString = '';
4680
4682
  if (this.data?.widgetInfo?.widgetComponent.startsWith('PAM'))
4681
4683
  translatedString = this.translateService.translate('common.' + rKey);
4682
- else if (this.dashboardService.clientId)
4683
- translatedString = this.translateService.translate(this.dashboardService.clientId + '_DBW' + '.DBW_' + rKey);
4684
+ else if (this.dashboardService.clientId) {
4685
+ rKey = 'DBW_' + rKey;
4686
+ translatedString = this.translateService.translate(this.dashboardService.clientId + '_DBW.' + rKey);
4687
+ }
4684
4688
  else
4685
- translatedString = this.translateService.translate(rKey);
4686
- if (translatedString.toLowerCase() === rKey.toLowerCase()) {
4687
4689
  return item;
4688
- }
4689
- else {
4690
- return translatedString;
4691
- }
4690
+ return translatedString.toLowerCase() === rKey.toLowerCase() ? item : translatedString;
4692
4691
  }
4693
4692
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: RAWidgetContainer, deps: [{ token: RaDashboardService }, { token: i2$1.NgxUiLoaderService }, { token: i3.RATranslateService }, { token: i0.NgZone }, { token: i4.NotifierService }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i3.RAPermissionService }, { token: i3.DomService }], target: i0.ɵɵFactoryTarget.Component }); }
4694
4693
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.1", type: RAWidgetContainer, isStandalone: false, selector: "ra-widget-container", inputs: { widgetInstanceId: ["widget-instance-id", "widgetInstanceId"], globalFilter: ["global-filter", "globalFilter"], dashboardInfo: ["dashboard-info", "dashboardInfo"], data: "data", raDashboardEventBus: ["event-bus", "raDashboardEventBus"], appConfig: ["app-config", "appConfig"], width: ["widget-width", "width"], height: ["widget-height", "height"], gridCellHeight: ["grid-cell-height", "gridCellHeight"], bulkActionData: ["bulk-action-data", "bulkActionData"], canLoadData: "canLoadData", setResized: ["dom-resized", "setResized"] }, outputs: { widgetDeleted: "widgetDeleted", updateAppliedFilters: "updateAppliedFilters", dataLoaded: "dataLoaded", widgetLoaded: "widgetLoaded" }, viewQueries: [{ propertyName: "ctlWidget", first: true, predicate: ["ctlWidget"], descendants: true }, { propertyName: "ctlWidgetModule", first: true, predicate: ["ctlWidgetModule"], descendants: true, read: ViewContainerRef }, { propertyName: "widgetDropdown", first: true, predicate: ["widgetDropdown"], descendants: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }, { propertyName: "wcWrapper", first: true, predicate: ["wcWrapper"], descendants: true }, { propertyName: "banPopupDiv", first: true, predicate: ["banPopupDiv"], descendants: true }, { propertyName: "lockPopupDiv", first: true, predicate: ["lockPopupDiv"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #wcWrapper class=\"wc-wrapper\" (mouseenter)=\"mouseHover(true)\" (mouseleave)=\"mouseHover(false)\"\r\n [ngStyle]=\"{'margin-left': noPadding?'0px':'15px','margin-right': noPadding?'0px':'15px'}\">\r\n <div class=\"wcheader widget-move\" *ngIf=\"!hideTitle && !showOnlyDropdown\"\r\n [ngClass]=\"{'underLine': enableTitleLine || isWidgetStateApplicable}\">\r\n <div class=\"col-md-12\" [ngClass]=\"{'wc-mover' : isWidgetCanMove }\" style=\"padding-left: 0px;height:inherit;padding-right: 0px;\">\r\n <div style=\"display:flex;margin-top:10px;\"\r\n [ngStyle]=\"{'margin-left': noPadding?'15px':'0px','margin-right': noPadding?'15px':'0px'}\">\r\n <div class=\"col-9 float-left title-label\">\r\n <ra-tooltip [value]=\"toolTipValue\" [width]=\"toolTipWidth\">\r\n <div [hidden]=\"hideTitle\" style=\"text-overflow: ellipsis;white-space: nowrap;overflow: hidden;\"\r\n (mouseover)=\"mouseOver($event)\" #searchInput>{{WidgetDisplayName}}</div>\r\n </ra-tooltip>\r\n </div>\r\n <div class=\"col-3\" style=\"cursor:default;padding-right: 0px;\"> \r\n <div class=\"float-right\" style=\"display: flex;\">\r\n <div #banPopupDiv (mouseover)=\"openPopup(inapplicableIconTitle,inapplicableFilters,inapplicableIconFooter,'innaplicable')\" (mouseout)=\"closePopup()\" class=\"title-bar-lock-icon lock-dropdown\" [hidden]=\"!inapplicableFilters || inapplicableFilters.length == 0 || !globalFilter || globalFilter == '{}'\">\r\n <i class=\"fal fa-ban lock\"></i> \r\n </div>\r\n <div #lockPopupDiv (mouseover)=\"openPopup(lockIconTitle,lockDetails,lockIconFooter,'lock',lockTemplateInfo)\" (mouseout)=\"closePopup()\" class=\"title-bar-lock-icon lock-dropdown\" [hidden]=\"(!lockDetails && !lockTemplateInfo) || hideLock\">\r\n <i class=\"fal fa-lock lock\"></i> \r\n </div>\r\n <div class=\"widget-menu\" style=\"width:10px;\"\r\n [ngClass]=\"{'widget-menu-show': isMouseHover && showSettingsLink}\">\r\n <div class=\"dropbtn title-bar-icon\">\r\n <i (click)=\"showDropDown($event)\" #widgetDropdown class=\"fal fa-ellipsis-v widget-menu-ellipse\"></i>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div *ngIf=\"hideTitle && !showOnlyDropdown\" class=\"wcheader widget-move\"\r\n style=\"height: 45px;width: 95%;cursor: move;z-index: 99;opacity: 0;\">\r\n </div>\r\n <div *ngIf=\"hideTitle && !showOnlyDropdown\" class=\"widget-menu widget-menu-title-hidden\" [ngClass]=\"{'widget-menu-show': isMouseHover && showSettingsLink}\">\r\n <div class=\"dropbtn title-bar-icon\">\r\n <i (click)=\"showDropDown($event)\" class=\"fal fa-ellipsis-v\" style=\"text-align: center;\"></i>\r\n </div>\r\n </div>\r\n <div class=\"wcBody\" [ngStyle]=\"{'bottom': noPadding?'0px':'10px','top':hideTitle || showOnlyDropdown?'10px':'46px'}\">\r\n <div [hidden]=\"isWidgetStateApplicable\" class=\"m-fadeOut widget-overlay\" [ngClass]=\"{'m-fadeIn': showPanel}\">\r\n <div class=\"lds-roller\">\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n </div>\r\n </div>\r\n <div class=\"wc\" [hidden]=\"isWidgetStateApplicable\">\r\n <div [hidden]=\"!isCustomElement\" #ctlWidget></div>\r\n <div [hidden]=\"isCustomElement\">\r\n <ng-container #ctlWidgetModule></ng-container>\r\n </div>\r\n </div>\r\n <div *ngIf=\"isWidgetStateApplicable\" class=\"defaultConfig\">\r\n <ra-widget-state style=\"width: 100%;height: 100%;\" [isWidgetStateApplicable]=\"isWidgetStateApplicable\"\r\n [isGlobalFilterApplied]=\"isGlobalFilterApplied\" [widgetEmptyState]=\"widgetEmptyState\"\r\n (editWidgetClicked)=editWidget() [widthCol]=\"width\" [heightCol]=\"height\">\r\n </ra-widget-state>\r\n </div>\r\n <div>\r\n </div>\r\n </div>\r\n</div>", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i6.TooltipControl, selector: "ra-tooltip", inputs: ["data", "url", "value", "key", "dataField", "position", "width", "count", "moreItemText", "reset", "disable-tooltip", "set-top-padding"], outputs: ["dataLoaded"] }, { kind: "component", type: i6.WidgetStateControl, selector: "ra-widget-state", inputs: ["isWidgetStateApplicable", "isGlobalFilterApplied", "widgetEmptyState", "widgetEmptyDataText", "widthCol", "heightCol"], outputs: ["editWidgetClicked"] }] }); }
@@ -4786,6 +4785,7 @@ class RADashboardArea {
4786
4785
  this.hasGird = false;
4787
4786
  this.initialWidgetCount = 10;
4788
4787
  this.currentLoadingCount = 0;
4788
+ this.isSiteDetailDashboard = false;
4789
4789
  this.downloadDatastreamLimit = 200;
4790
4790
  this.reportDatastreamLimit = 50;
4791
4791
  this.widgetHeight = 2;
@@ -5080,6 +5080,7 @@ class RADashboardArea {
5080
5080
  isIndicatorDashboard: this.isIndicatorDashboard
5081
5081
  };
5082
5082
  let _the = this;
5083
+ this.isSiteDetailDashboard = this.dashboardInfo?.templateName === 'Site Detail';
5083
5084
  this.dashboardService.getWidgetsByDashboardArea(widgetInfo, this.appConfig).subscribe(widgets => {
5084
5085
  _the.widgetList = [];
5085
5086
  this.userWidgets = widgets;
@@ -5091,6 +5092,8 @@ class RADashboardArea {
5091
5092
  if (settings && settings.isPAMWidget)
5092
5093
  this.PAMWidgets.push(element.widgetInstanceId);
5093
5094
  }
5095
+ if (this.isSiteDetailDashboard)
5096
+ element.templateSettings = JSON.stringify(this.dashboardInfo?.templateConfig?.widget);
5094
5097
  });
5095
5098
  this.checkPAMWidgets();
5096
5099
  if (this.dashboardInfo?.isReport && widgets && widgets.length > this.reportDatastreamLimit) {
@@ -5106,8 +5109,15 @@ class RADashboardArea {
5106
5109
  else {
5107
5110
  this.showDownloadOnlyState = false;
5108
5111
  this.showEmptyDashboard = true;
5109
- this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, this.showEmptyDashboard);
5112
+ if (this.isSiteDetailDashboard) {
5113
+ this.showDownloadOnlyState = false;
5114
+ this.showEmptyDashboard = false;
5115
+ }
5116
+ else {
5117
+ this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, this.showEmptyDashboard);
5118
+ }
5110
5119
  }
5120
+ this.raDashboardEventBus.publish(RAEvent.UpdateWidgetCount, this.userWidgets.length);
5111
5121
  });
5112
5122
  }
5113
5123
  /** To set Area(Gridster) height dynamically as widgets are added/removed */
@@ -5123,7 +5133,12 @@ class RADashboardArea {
5123
5133
  if (this.options.api) {
5124
5134
  curRowHeight = this.options.api.getCurrentRowHeight();
5125
5135
  }
5126
- this.showEmptyDashboard = this.userWidgets.length > 0 ? false : true;
5136
+ if (this.isSiteDetailDashboard) {
5137
+ this.showEmptyDashboard = false;
5138
+ }
5139
+ else {
5140
+ this.showEmptyDashboard = this.userWidgets.length === 0;
5141
+ }
5127
5142
  this.widgetList.forEach((t) => {
5128
5143
  let currentHeight = t.y + t.rows;
5129
5144
  if (currentHeight > areaScrollHeight) {
@@ -5179,9 +5194,13 @@ class RADashboardArea {
5179
5194
  }
5180
5195
  }
5181
5196
  this.showEmptyDashboard = this.userWidgets.length > 0 ? false : true;
5182
- if (this.showEmptyDashboard == true) {
5197
+ if (this.showEmptyDashboard == true && !this.isSiteDetailDashboard) {
5183
5198
  this.raDashboardEventBus.publish(RAEvent.HideDashboardBanner, this.showEmptyDashboard);
5184
5199
  }
5200
+ if (this.isSiteDetailDashboard) {
5201
+ this.raDashboardEventBus.publish(RAEvent.UpdateWidgetCount, -1);
5202
+ this.raDashboardEventBus.publish(RAEvent.RearrangeClicked, true);
5203
+ }
5185
5204
  }
5186
5205
  /**To rearrange widgets position in the dashboard, compactLeft&Up,compactLeft,compactUp,etc*/
5187
5206
  rearrangeWidgets() {
@@ -5222,6 +5241,8 @@ class RADashboardArea {
5222
5241
  data.dashboardId = this.userDashboardId;
5223
5242
  this.ngxService.start();
5224
5243
  this.dashboardService.addWidget(data, this.appConfig).subscribe(widget => {
5244
+ if (this.isSiteDetailDashboard)
5245
+ widget.templateSettings = JSON.stringify(this.dashboardInfo?.templateConfig?.widget);
5225
5246
  this.userWidgets.push(widget);
5226
5247
  let gridsterItem = this.responsiveService.getGridsterItem(widget);
5227
5248
  this.widgetList.push(gridsterItem);