@schneideress/dashboardframework 0.0.234 → 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.
@@ -1787,16 +1787,18 @@ var RAWidgetContainer = /** @class */ (function () {
1787
1787
  */
1788
1788
  function () {
1789
1789
  if (this.widgetElement) {
1790
- /** @type {?} */
1791
- var size = {};
1792
- size.height = this.height;
1793
- size.width = this.width;
1794
- size.cellHeight = this.gridCellHeight;
1795
- this.widgetElement.widgetResized(size);
1796
- if (this.height == 1 || this.width == 1)
1797
- this.isKpiView = true;
1798
- else
1799
- 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
+ }
1800
1802
  }
1801
1803
  };
1802
1804
  /**
@@ -1876,6 +1878,9 @@ var RAWidgetContainer = /** @class */ (function () {
1876
1878
  function () {
1877
1879
  if (this.configChanged)
1878
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
+ }
1879
1884
  };
1880
1885
  /** To Edit current widget configuration*/
1881
1886
  /**
@@ -2084,120 +2089,122 @@ var RAWidgetContainer = /** @class */ (function () {
2084
2089
  function () {
2085
2090
  me.widgetElement = document.createElement(widgetInfo.customTag);
2086
2091
  me.widgetElement.setAttribute("widget-instance-id", widgetInfo.widgetInstanceId);
2087
- document.body.addEventListener('widgetinitiated' + widgetInfo.widgetInstanceId, (/**
2092
+ /** @type {?} */
2093
+ var handler = (/**
2094
+ * @param {?} event
2088
2095
  * @return {?}
2089
2096
  */
2090
- function () { return __awaiter(_this, void 0, void 0, function () {
2097
+ function (event) {
2091
2098
  var _this = this;
2092
- return __generator(this, function (_a) {
2093
- setTimeout((/**
2094
- * @return {?}
2095
- */
2096
- function () { return __awaiter(_this, void 0, void 0, function () {
2097
- var titleLineEnabled;
2098
- var _this = this;
2099
- return __generator(this, function (_a) {
2100
- switch (_a.label) {
2101
- case 0:
2102
- me.widgetElement.addEventListener('on-widget-respond', (/**
2103
- * @param {?} e
2104
- * @return {?}
2105
- */
2106
- function (e) {
2107
- /** @type {?} */
2108
- var type = e.detail.type;
2109
- switch (type) {
2110
- case 'onDataLoad':
2111
- if (e.detail.data)
2112
- me.showPanel = true;
2113
- else
2114
- me.showPanel = false;
2115
- break;
2116
- case 'onConfigEditClicked':
2117
- me.editWidget();
2118
- break;
2119
- case 'onEnableDefaultState':
2120
- me.setEmptyState(e.detail.data);
2121
- break;
2122
- case 'onSetTitleUnderline':
2123
- if (e.detail.data == true)
2124
- _this.enableTitleLine = true;
2125
- else
2126
- _this.enableTitleLine = _this.enableTitleLineActual;
2127
- break;
2128
- case 'onWidgetTitleHidden':
2129
- if (e.detail.data == true)
2130
- _this.hideTitle = true;
2131
- else
2132
- _this.hideTitle = false;
2133
- break;
2134
- case 'onUpdateLockData':
2135
- _this.setLock(e.detail.data);
2136
- break;
2137
- case 'onGlobalFilterApplicableCheck':
2138
- _this.setInapplicableFilters(e.detail.data, widgetInfo.widgetInstanceId);
2139
- break;
2140
- default:
2141
- break;
2142
- }
2143
- }));
2144
- if (typeof (me.widgetElement.titleLineEnabled) != 'undefined') {
2145
- titleLineEnabled = me.widgetElement.titleLineEnabled();
2146
- if (titleLineEnabled) {
2147
- this.enableTitleLine = titleLineEnabled;
2148
- this.enableTitleLineActual = titleLineEnabled;
2149
- }
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;
2150
2149
  }
2151
- this.editText = this.translateService.translate('Common.edit');
2152
- if (this.translateService.translate('Common.edit').length > 6) {
2153
- this.editText = (this.translateService.translate('Common.edit').substring(0, 6) + '...');
2154
- this.editToolTipValue = this.translateService.translate('Common.edit');
2155
- this.editToolTipWidth = "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;
2156
2156
  }
2157
- this.copyText = this.translateService.translate('Common.copy');
2158
- if (this.translateService.translate('Common.copy').length > 6) {
2159
- this.copyText = (this.translateService.translate('Common.copy').substring(0, 6) + '...');
2160
- this.copyToolTipValue = this.translateService.translate('Common.copy');
2161
- this.copyToolTipWidth = "300px";
2162
- }
2163
- this.moveText = this.translateService.translate('Common.move');
2164
- if (this.translateService.translate('Common.move').length > 6) {
2165
- this.moveText = (this.translateService.translate('Common.move').substring(0, 6) + '...');
2166
- this.moveToolTipValue = this.translateService.translate('Common.move');
2167
- this.moveToolTipWidth = "300px";
2168
- }
2169
- this.excelText = this.translateService.translate('Common.excel');
2170
- if (this.translateService.translate('Common.excel').length > 6) {
2171
- this.excelText = (this.translateService.translate('Common.excel').substring(0, 6) + '...');
2172
- this.excelToolTipValue = this.translateService.translate('Common.excel');
2173
- this.excelToolTipWidth = "300px";
2174
- }
2175
- this.deleteText = this.translateService.translate('Common.delete');
2176
- if (this.translateService.translate('Common.delete').length > 6) {
2177
- this.deleteText = (this.translateService.translate('Common.delete').substring(0, 6) + '...');
2178
- this.deleteToolTipValue = this.translateService.translate('Common.delete');
2179
- this.deleteToolTipWidth = "300px";
2180
- }
2181
- me.isWidgetLoaded = true;
2182
- widgetConfigFilter.appConfig = this.appConfig;
2183
- widgetConfigFilter.widgetInfo = widgetInfo;
2184
- widgetConfigFilter.configChanges = this.getConfigChanges(false);
2185
- widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
2186
- widgetConfigFilter.globalFilter = this.globalFilter;
2187
- me.widgetElement.loadContent(widgetConfigFilter);
2188
- return [4 /*yield*/, me.setLock(widgetConfigFilter.config)];
2189
- case 1:
2190
- _a.sent();
2191
- return [4 /*yield*/, me.setDownloadIcon()];
2192
- case 2:
2193
- _a.sent();
2194
- return [2 /*return*/];
2195
- }
2196
- });
2197
- }); }));
2198
- return [2 /*return*/];
2199
- });
2200
- }); }));
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);
2201
2208
  _this.ctlWidget.nativeElement.appendChild(_this.widgetElement);
2202
2209
  }));
2203
2210
  }));
@@ -2920,6 +2927,8 @@ if (false) {
2920
2927
  RAWidgetContainer.prototype.WidgetDisplayName;
2921
2928
  /** @type {?} */
2922
2929
  RAWidgetContainer.prototype.enableTitleLineActual;
2930
+ /** @type {?} */
2931
+ RAWidgetContainer.prototype.widgetElementHandler;
2923
2932
  /**
2924
2933
  * @type {?}
2925
2934
  * @private