@schneideress/dashboardframework 0.0.233 → 0.0.235

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.
@@ -772,22 +772,14 @@ var RADashboardArea = /** @class */ (function () {
772
772
  var _this = this;
773
773
  this.isWidgetMgmnt = this.permissionService.hasPermission('ra.widgetmanagement');
774
774
  this.initiateGridsterConfig();
775
+ this.lastViewType = this.responsiveService.IsDesktopView ? 'desktop' : 'mobile';
775
776
  this.responsiveService.resized.subscribe((/**
776
777
  * @param {?} isDesktop
777
778
  * @return {?}
778
779
  */
779
780
  function (isDesktop) {
780
- if (isDesktop) {
781
- setTimeout((/**
782
- * @return {?}
783
- */
784
- function () {
785
- _this.gridcellHeight = _this.options.api.getCurrentRowHeight();
786
- _this.domResized = !_this.domResized;
787
- _this.setAreaHeight();
788
- }), 100);
789
- }
790
- else {
781
+ if (_this.lastViewType != (isDesktop ? 'desktop' : 'mobile') || !isDesktop) {
782
+ _this.lastViewType = (isDesktop ? 'desktop' : 'mobile');
791
783
  _this.widgetList = [];
792
784
  setTimeout((/**
793
785
  * @return {?}
@@ -810,6 +802,16 @@ var RADashboardArea = /** @class */ (function () {
810
802
  _this.domResized = !_this.domResized;
811
803
  }));
812
804
  }
805
+ else {
806
+ setTimeout((/**
807
+ * @return {?}
808
+ */
809
+ function () {
810
+ _this.gridcellHeight = _this.options.api.getCurrentRowHeight();
811
+ _this.domResized = !_this.domResized;
812
+ _this.setAreaHeight();
813
+ }), 100);
814
+ }
813
815
  }));
814
816
  };
815
817
  /**
@@ -1582,6 +1584,8 @@ if (false) {
1582
1584
  /** @type {?} */
1583
1585
  RADashboardArea.prototype.isWidgetMgmnt;
1584
1586
  /** @type {?} */
1587
+ RADashboardArea.prototype.lastViewType;
1588
+ /** @type {?} */
1585
1589
  RADashboardArea.prototype.userDashboardId;
1586
1590
  /** @type {?} */
1587
1591
  RADashboardArea.prototype.areaKey;
@@ -1783,16 +1787,18 @@ var RAWidgetContainer = /** @class */ (function () {
1783
1787
  */
1784
1788
  function () {
1785
1789
  if (this.widgetElement) {
1786
- /** @type {?} */
1787
- var size = {};
1788
- size.height = this.height;
1789
- size.width = this.width;
1790
- size.cellHeight = this.gridCellHeight;
1791
- this.widgetElement.widgetResized(size);
1792
- if (this.height == 1 || this.width == 1)
1793
- this.isKpiView = true;
1794
- else
1795
- this.isKpiView = false;
1790
+ if (typeof this.widgetElement.widgetResized === "function") {
1791
+ /** @type {?} */
1792
+ var size = {};
1793
+ size.height = this.height;
1794
+ size.width = this.width;
1795
+ size.cellHeight = this.gridCellHeight;
1796
+ this.widgetElement.widgetResized(size);
1797
+ if (this.height == 1 || this.width == 1)
1798
+ this.isKpiView = true;
1799
+ else
1800
+ this.isKpiView = false;
1801
+ }
1796
1802
  }
1797
1803
  };
1798
1804
  /**
@@ -1872,6 +1878,9 @@ var RAWidgetContainer = /** @class */ (function () {
1872
1878
  function () {
1873
1879
  if (this.configChanged)
1874
1880
  this.configChanged.unsubscribe();
1881
+ if (this.widgetElementHandler && this.data && this.data.widgetInfo && this.data.widgetInfo.widgetInstanceId) {
1882
+ document.body.removeEventListener('widgetinitiated' + this.data.widgetInfo.widgetInstanceId, this.widgetElementHandler);
1883
+ }
1875
1884
  };
1876
1885
  /** To Edit current widget configuration*/
1877
1886
  /**
@@ -2080,120 +2089,122 @@ var RAWidgetContainer = /** @class */ (function () {
2080
2089
  function () {
2081
2090
  me.widgetElement = document.createElement(widgetInfo.customTag);
2082
2091
  me.widgetElement.setAttribute("widget-instance-id", widgetInfo.widgetInstanceId);
2083
- document.body.addEventListener('widgetinitiated' + widgetInfo.widgetInstanceId, (/**
2092
+ /** @type {?} */
2093
+ var handler = (/**
2094
+ * @param {?} event
2084
2095
  * @return {?}
2085
2096
  */
2086
- function () { return __awaiter(_this, void 0, void 0, function () {
2097
+ function (event) {
2087
2098
  var _this = this;
2088
- return __generator(this, function (_a) {
2089
- setTimeout((/**
2090
- * @return {?}
2091
- */
2092
- function () { return __awaiter(_this, void 0, void 0, function () {
2093
- var titleLineEnabled;
2094
- var _this = this;
2095
- return __generator(this, function (_a) {
2096
- switch (_a.label) {
2097
- case 0:
2098
- me.widgetElement.addEventListener('on-widget-respond', (/**
2099
- * @param {?} e
2100
- * @return {?}
2101
- */
2102
- function (e) {
2103
- /** @type {?} */
2104
- var type = e.detail.type;
2105
- switch (type) {
2106
- case 'onDataLoad':
2107
- if (e.detail.data)
2108
- me.showPanel = true;
2109
- else
2110
- me.showPanel = false;
2111
- break;
2112
- case 'onConfigEditClicked':
2113
- me.editWidget();
2114
- break;
2115
- case 'onEnableDefaultState':
2116
- me.setEmptyState(e.detail.data);
2117
- break;
2118
- case 'onSetTitleUnderline':
2119
- if (e.detail.data == true)
2120
- _this.enableTitleLine = true;
2121
- else
2122
- _this.enableTitleLine = _this.enableTitleLineActual;
2123
- break;
2124
- case 'onWidgetTitleHidden':
2125
- if (e.detail.data == true)
2126
- _this.hideTitle = true;
2127
- else
2128
- _this.hideTitle = false;
2129
- break;
2130
- case 'onUpdateLockData':
2131
- _this.setLock(e.detail.data);
2132
- break;
2133
- case 'onGlobalFilterApplicableCheck':
2134
- _this.setInapplicableFilters(e.detail.data, widgetInfo.widgetInstanceId);
2135
- break;
2136
- default:
2137
- break;
2138
- }
2139
- }));
2140
- if (typeof (me.widgetElement.titleLineEnabled) != 'undefined') {
2141
- titleLineEnabled = me.widgetElement.titleLineEnabled();
2142
- if (titleLineEnabled) {
2143
- this.enableTitleLine = titleLineEnabled;
2144
- this.enableTitleLineActual = titleLineEnabled;
2145
- }
2146
- }
2147
- this.editText = this.translateService.translate('Common.edit');
2148
- if (this.translateService.translate('Common.edit').length > 6) {
2149
- this.editText = (this.translateService.translate('Common.edit').substring(0, 6) + '...');
2150
- this.editToolTipValue = this.translateService.translate('Common.edit');
2151
- this.editToolTipWidth = "300px";
2152
- }
2153
- this.copyText = this.translateService.translate('Common.copy');
2154
- if (this.translateService.translate('Common.copy').length > 6) {
2155
- this.copyText = (this.translateService.translate('Common.copy').substring(0, 6) + '...');
2156
- this.copyToolTipValue = this.translateService.translate('Common.copy');
2157
- this.copyToolTipWidth = "300px";
2099
+ setTimeout((/**
2100
+ * @return {?}
2101
+ */
2102
+ function () { return __awaiter(_this, void 0, void 0, function () {
2103
+ var titleLineEnabled;
2104
+ var _this = this;
2105
+ return __generator(this, function (_a) {
2106
+ switch (_a.label) {
2107
+ case 0:
2108
+ console.log('widget inititated listener triggered');
2109
+ this.widgetElement.addEventListener('on-widget-respond', (/**
2110
+ * @param {?} e
2111
+ * @return {?}
2112
+ */
2113
+ function (e) {
2114
+ /** @type {?} */
2115
+ var type = e.detail.type;
2116
+ switch (type) {
2117
+ case 'onDataLoad':
2118
+ if (e.detail.data)
2119
+ _this.showPanel = true;
2120
+ else
2121
+ _this.showPanel = false;
2122
+ break;
2123
+ case 'onConfigEditClicked':
2124
+ _this.editWidget();
2125
+ break;
2126
+ case 'onEnableDefaultState':
2127
+ _this.setEmptyState(e.detail.data);
2128
+ break;
2129
+ case 'onSetTitleUnderline':
2130
+ if (e.detail.data == true)
2131
+ _this.enableTitleLine = true;
2132
+ else
2133
+ _this.enableTitleLine = _this.enableTitleLineActual;
2134
+ break;
2135
+ case 'onWidgetTitleHidden':
2136
+ if (e.detail.data == true)
2137
+ _this.hideTitle = true;
2138
+ else
2139
+ _this.hideTitle = false;
2140
+ break;
2141
+ case 'onUpdateLockData':
2142
+ _this.setLock(e.detail.data);
2143
+ break;
2144
+ case 'onGlobalFilterApplicableCheck':
2145
+ _this.setInapplicableFilters(e.detail.data, widgetInfo.widgetInstanceId);
2146
+ break;
2147
+ default:
2148
+ break;
2158
2149
  }
2159
- this.moveText = this.translateService.translate('Common.move');
2160
- if (this.translateService.translate('Common.move').length > 6) {
2161
- this.moveText = (this.translateService.translate('Common.move').substring(0, 6) + '...');
2162
- this.moveToolTipValue = this.translateService.translate('Common.move');
2163
- this.moveToolTipWidth = "300px";
2150
+ }));
2151
+ if (typeof (this.widgetElement.titleLineEnabled) != 'undefined') {
2152
+ titleLineEnabled = this.widgetElement.titleLineEnabled();
2153
+ if (titleLineEnabled) {
2154
+ this.enableTitleLine = titleLineEnabled;
2155
+ this.enableTitleLineActual = titleLineEnabled;
2164
2156
  }
2165
- this.excelText = this.translateService.translate('Common.excel');
2166
- if (this.translateService.translate('Common.excel').length > 6) {
2167
- this.excelText = (this.translateService.translate('Common.excel').substring(0, 6) + '...');
2168
- this.excelToolTipValue = this.translateService.translate('Common.excel');
2169
- this.excelToolTipWidth = "300px";
2170
- }
2171
- this.deleteText = this.translateService.translate('Common.delete');
2172
- if (this.translateService.translate('Common.delete').length > 6) {
2173
- this.deleteText = (this.translateService.translate('Common.delete').substring(0, 6) + '...');
2174
- this.deleteToolTipValue = this.translateService.translate('Common.delete');
2175
- this.deleteToolTipWidth = "300px";
2176
- }
2177
- me.isWidgetLoaded = true;
2178
- widgetConfigFilter.appConfig = this.appConfig;
2179
- widgetConfigFilter.widgetInfo = widgetInfo;
2180
- widgetConfigFilter.configChanges = this.getConfigChanges(false);
2181
- widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
2182
- widgetConfigFilter.globalFilter = this.globalFilter;
2183
- me.widgetElement.loadContent(widgetConfigFilter);
2184
- return [4 /*yield*/, me.setLock(widgetConfigFilter.config)];
2185
- case 1:
2186
- _a.sent();
2187
- return [4 /*yield*/, me.setDownloadIcon()];
2188
- case 2:
2189
- _a.sent();
2190
- return [2 /*return*/];
2191
- }
2192
- });
2193
- }); }));
2194
- return [2 /*return*/];
2195
- });
2196
- }); }));
2157
+ }
2158
+ this.editText = this.translateService.translate('Common.edit');
2159
+ if (this.translateService.translate('Common.edit').length > 6) {
2160
+ this.editText = (this.translateService.translate('Common.edit').substring(0, 6) + '...');
2161
+ this.editToolTipValue = this.translateService.translate('Common.edit');
2162
+ this.editToolTipWidth = "300px";
2163
+ }
2164
+ this.copyText = this.translateService.translate('Common.copy');
2165
+ if (this.translateService.translate('Common.copy').length > 6) {
2166
+ this.copyText = (this.translateService.translate('Common.copy').substring(0, 6) + '...');
2167
+ this.copyToolTipValue = this.translateService.translate('Common.copy');
2168
+ this.copyToolTipWidth = "300px";
2169
+ }
2170
+ this.moveText = this.translateService.translate('Common.move');
2171
+ if (this.translateService.translate('Common.move').length > 6) {
2172
+ this.moveText = (this.translateService.translate('Common.move').substring(0, 6) + '...');
2173
+ this.moveToolTipValue = this.translateService.translate('Common.move');
2174
+ this.moveToolTipWidth = "300px";
2175
+ }
2176
+ this.excelText = this.translateService.translate('Common.excel');
2177
+ if (this.translateService.translate('Common.excel').length > 6) {
2178
+ this.excelText = (this.translateService.translate('Common.excel').substring(0, 6) + '...');
2179
+ this.excelToolTipValue = this.translateService.translate('Common.excel');
2180
+ this.excelToolTipWidth = "300px";
2181
+ }
2182
+ this.deleteText = this.translateService.translate('Common.delete');
2183
+ if (this.translateService.translate('Common.delete').length > 6) {
2184
+ this.deleteText = (this.translateService.translate('Common.delete').substring(0, 6) + '...');
2185
+ this.deleteToolTipValue = this.translateService.translate('Common.delete');
2186
+ this.deleteToolTipWidth = "300px";
2187
+ }
2188
+ this.isWidgetLoaded = true;
2189
+ widgetConfigFilter.appConfig = this.appConfig;
2190
+ widgetConfigFilter.widgetInfo = widgetInfo;
2191
+ widgetConfigFilter.configChanges = this.getConfigChanges(false);
2192
+ widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
2193
+ widgetConfigFilter.globalFilter = this.globalFilter;
2194
+ this.widgetElement.loadContent(widgetConfigFilter);
2195
+ return [4 /*yield*/, this.setLock(widgetConfigFilter.config)];
2196
+ case 1:
2197
+ _a.sent();
2198
+ return [4 /*yield*/, this.setDownloadIcon()];
2199
+ case 2:
2200
+ _a.sent();
2201
+ return [2 /*return*/];
2202
+ }
2203
+ });
2204
+ }); }));
2205
+ }).bind(_this);
2206
+ _this.widgetElementHandler = handler;
2207
+ document.body.addEventListener('widgetinitiated' + widgetInfo.widgetInstanceId, handler);
2197
2208
  _this.ctlWidget.nativeElement.appendChild(_this.widgetElement);
2198
2209
  }));
2199
2210
  }));
@@ -2916,6 +2927,8 @@ if (false) {
2916
2927
  RAWidgetContainer.prototype.WidgetDisplayName;
2917
2928
  /** @type {?} */
2918
2929
  RAWidgetContainer.prototype.enableTitleLineActual;
2930
+ /** @type {?} */
2931
+ RAWidgetContainer.prototype.widgetElementHandler;
2919
2932
  /**
2920
2933
  * @type {?}
2921
2934
  * @private