@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.
@@ -1998,16 +1998,18 @@
1998
1998
  */
1999
1999
  function () {
2000
2000
  if (this.widgetElement) {
2001
- /** @type {?} */
2002
- var size = {};
2003
- size.height = this.height;
2004
- size.width = this.width;
2005
- size.cellHeight = this.gridCellHeight;
2006
- this.widgetElement.widgetResized(size);
2007
- if (this.height == 1 || this.width == 1)
2008
- this.isKpiView = true;
2009
- else
2010
- this.isKpiView = false;
2001
+ if (typeof this.widgetElement.widgetResized === "function") {
2002
+ /** @type {?} */
2003
+ var size = {};
2004
+ size.height = this.height;
2005
+ size.width = this.width;
2006
+ size.cellHeight = this.gridCellHeight;
2007
+ this.widgetElement.widgetResized(size);
2008
+ if (this.height == 1 || this.width == 1)
2009
+ this.isKpiView = true;
2010
+ else
2011
+ this.isKpiView = false;
2012
+ }
2011
2013
  }
2012
2014
  };
2013
2015
  /**
@@ -2087,6 +2089,9 @@
2087
2089
  function () {
2088
2090
  if (this.configChanged)
2089
2091
  this.configChanged.unsubscribe();
2092
+ if (this.widgetElementHandler && this.data && this.data.widgetInfo && this.data.widgetInfo.widgetInstanceId) {
2093
+ document.body.removeEventListener('widgetinitiated' + this.data.widgetInfo.widgetInstanceId, this.widgetElementHandler);
2094
+ }
2090
2095
  };
2091
2096
  /** To Edit current widget configuration*/
2092
2097
  /**
@@ -2295,120 +2300,122 @@
2295
2300
  function () {
2296
2301
  me.widgetElement = document.createElement(widgetInfo.customTag);
2297
2302
  me.widgetElement.setAttribute("widget-instance-id", widgetInfo.widgetInstanceId);
2298
- document.body.addEventListener('widgetinitiated' + widgetInfo.widgetInstanceId, (/**
2303
+ /** @type {?} */
2304
+ var handler = (/**
2305
+ * @param {?} event
2299
2306
  * @return {?}
2300
2307
  */
2301
- function () { return __awaiter(_this, void 0, void 0, function () {
2308
+ function (event) {
2302
2309
  var _this = this;
2303
- return __generator(this, function (_a) {
2304
- setTimeout((/**
2305
- * @return {?}
2306
- */
2307
- function () { return __awaiter(_this, void 0, void 0, function () {
2308
- var titleLineEnabled;
2309
- var _this = this;
2310
- return __generator(this, function (_a) {
2311
- switch (_a.label) {
2312
- case 0:
2313
- me.widgetElement.addEventListener('on-widget-respond', (/**
2314
- * @param {?} e
2315
- * @return {?}
2316
- */
2317
- function (e) {
2318
- /** @type {?} */
2319
- var type = e.detail.type;
2320
- switch (type) {
2321
- case 'onDataLoad':
2322
- if (e.detail.data)
2323
- me.showPanel = true;
2324
- else
2325
- me.showPanel = false;
2326
- break;
2327
- case 'onConfigEditClicked':
2328
- me.editWidget();
2329
- break;
2330
- case 'onEnableDefaultState':
2331
- me.setEmptyState(e.detail.data);
2332
- break;
2333
- case 'onSetTitleUnderline':
2334
- if (e.detail.data == true)
2335
- _this.enableTitleLine = true;
2336
- else
2337
- _this.enableTitleLine = _this.enableTitleLineActual;
2338
- break;
2339
- case 'onWidgetTitleHidden':
2340
- if (e.detail.data == true)
2341
- _this.hideTitle = true;
2342
- else
2343
- _this.hideTitle = false;
2344
- break;
2345
- case 'onUpdateLockData':
2346
- _this.setLock(e.detail.data);
2347
- break;
2348
- case 'onGlobalFilterApplicableCheck':
2349
- _this.setInapplicableFilters(e.detail.data, widgetInfo.widgetInstanceId);
2350
- break;
2351
- default:
2352
- break;
2353
- }
2354
- }));
2355
- if (typeof (me.widgetElement.titleLineEnabled) != 'undefined') {
2356
- titleLineEnabled = me.widgetElement.titleLineEnabled();
2357
- if (titleLineEnabled) {
2358
- this.enableTitleLine = titleLineEnabled;
2359
- this.enableTitleLineActual = titleLineEnabled;
2360
- }
2310
+ setTimeout((/**
2311
+ * @return {?}
2312
+ */
2313
+ function () { return __awaiter(_this, void 0, void 0, function () {
2314
+ var titleLineEnabled;
2315
+ var _this = this;
2316
+ return __generator(this, function (_a) {
2317
+ switch (_a.label) {
2318
+ case 0:
2319
+ console.log('widget inititated listener triggered');
2320
+ this.widgetElement.addEventListener('on-widget-respond', (/**
2321
+ * @param {?} e
2322
+ * @return {?}
2323
+ */
2324
+ function (e) {
2325
+ /** @type {?} */
2326
+ var type = e.detail.type;
2327
+ switch (type) {
2328
+ case 'onDataLoad':
2329
+ if (e.detail.data)
2330
+ _this.showPanel = true;
2331
+ else
2332
+ _this.showPanel = false;
2333
+ break;
2334
+ case 'onConfigEditClicked':
2335
+ _this.editWidget();
2336
+ break;
2337
+ case 'onEnableDefaultState':
2338
+ _this.setEmptyState(e.detail.data);
2339
+ break;
2340
+ case 'onSetTitleUnderline':
2341
+ if (e.detail.data == true)
2342
+ _this.enableTitleLine = true;
2343
+ else
2344
+ _this.enableTitleLine = _this.enableTitleLineActual;
2345
+ break;
2346
+ case 'onWidgetTitleHidden':
2347
+ if (e.detail.data == true)
2348
+ _this.hideTitle = true;
2349
+ else
2350
+ _this.hideTitle = false;
2351
+ break;
2352
+ case 'onUpdateLockData':
2353
+ _this.setLock(e.detail.data);
2354
+ break;
2355
+ case 'onGlobalFilterApplicableCheck':
2356
+ _this.setInapplicableFilters(e.detail.data, widgetInfo.widgetInstanceId);
2357
+ break;
2358
+ default:
2359
+ break;
2361
2360
  }
2362
- this.editText = this.translateService.translate('Common.edit');
2363
- if (this.translateService.translate('Common.edit').length > 6) {
2364
- this.editText = (this.translateService.translate('Common.edit').substring(0, 6) + '...');
2365
- this.editToolTipValue = this.translateService.translate('Common.edit');
2366
- this.editToolTipWidth = "300px";
2361
+ }));
2362
+ if (typeof (this.widgetElement.titleLineEnabled) != 'undefined') {
2363
+ titleLineEnabled = this.widgetElement.titleLineEnabled();
2364
+ if (titleLineEnabled) {
2365
+ this.enableTitleLine = titleLineEnabled;
2366
+ this.enableTitleLineActual = titleLineEnabled;
2367
2367
  }
2368
- this.copyText = this.translateService.translate('Common.copy');
2369
- if (this.translateService.translate('Common.copy').length > 6) {
2370
- this.copyText = (this.translateService.translate('Common.copy').substring(0, 6) + '...');
2371
- this.copyToolTipValue = this.translateService.translate('Common.copy');
2372
- this.copyToolTipWidth = "300px";
2373
- }
2374
- this.moveText = this.translateService.translate('Common.move');
2375
- if (this.translateService.translate('Common.move').length > 6) {
2376
- this.moveText = (this.translateService.translate('Common.move').substring(0, 6) + '...');
2377
- this.moveToolTipValue = this.translateService.translate('Common.move');
2378
- this.moveToolTipWidth = "300px";
2379
- }
2380
- this.excelText = this.translateService.translate('Common.excel');
2381
- if (this.translateService.translate('Common.excel').length > 6) {
2382
- this.excelText = (this.translateService.translate('Common.excel').substring(0, 6) + '...');
2383
- this.excelToolTipValue = this.translateService.translate('Common.excel');
2384
- this.excelToolTipWidth = "300px";
2385
- }
2386
- this.deleteText = this.translateService.translate('Common.delete');
2387
- if (this.translateService.translate('Common.delete').length > 6) {
2388
- this.deleteText = (this.translateService.translate('Common.delete').substring(0, 6) + '...');
2389
- this.deleteToolTipValue = this.translateService.translate('Common.delete');
2390
- this.deleteToolTipWidth = "300px";
2391
- }
2392
- me.isWidgetLoaded = true;
2393
- widgetConfigFilter.appConfig = this.appConfig;
2394
- widgetConfigFilter.widgetInfo = widgetInfo;
2395
- widgetConfigFilter.configChanges = this.getConfigChanges(false);
2396
- widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
2397
- widgetConfigFilter.globalFilter = this.globalFilter;
2398
- me.widgetElement.loadContent(widgetConfigFilter);
2399
- return [4 /*yield*/, me.setLock(widgetConfigFilter.config)];
2400
- case 1:
2401
- _a.sent();
2402
- return [4 /*yield*/, me.setDownloadIcon()];
2403
- case 2:
2404
- _a.sent();
2405
- return [2 /*return*/];
2406
- }
2407
- });
2408
- }); }));
2409
- return [2 /*return*/];
2410
- });
2411
- }); }));
2368
+ }
2369
+ this.editText = this.translateService.translate('Common.edit');
2370
+ if (this.translateService.translate('Common.edit').length > 6) {
2371
+ this.editText = (this.translateService.translate('Common.edit').substring(0, 6) + '...');
2372
+ this.editToolTipValue = this.translateService.translate('Common.edit');
2373
+ this.editToolTipWidth = "300px";
2374
+ }
2375
+ this.copyText = this.translateService.translate('Common.copy');
2376
+ if (this.translateService.translate('Common.copy').length > 6) {
2377
+ this.copyText = (this.translateService.translate('Common.copy').substring(0, 6) + '...');
2378
+ this.copyToolTipValue = this.translateService.translate('Common.copy');
2379
+ this.copyToolTipWidth = "300px";
2380
+ }
2381
+ this.moveText = this.translateService.translate('Common.move');
2382
+ if (this.translateService.translate('Common.move').length > 6) {
2383
+ this.moveText = (this.translateService.translate('Common.move').substring(0, 6) + '...');
2384
+ this.moveToolTipValue = this.translateService.translate('Common.move');
2385
+ this.moveToolTipWidth = "300px";
2386
+ }
2387
+ this.excelText = this.translateService.translate('Common.excel');
2388
+ if (this.translateService.translate('Common.excel').length > 6) {
2389
+ this.excelText = (this.translateService.translate('Common.excel').substring(0, 6) + '...');
2390
+ this.excelToolTipValue = this.translateService.translate('Common.excel');
2391
+ this.excelToolTipWidth = "300px";
2392
+ }
2393
+ this.deleteText = this.translateService.translate('Common.delete');
2394
+ if (this.translateService.translate('Common.delete').length > 6) {
2395
+ this.deleteText = (this.translateService.translate('Common.delete').substring(0, 6) + '...');
2396
+ this.deleteToolTipValue = this.translateService.translate('Common.delete');
2397
+ this.deleteToolTipWidth = "300px";
2398
+ }
2399
+ this.isWidgetLoaded = true;
2400
+ widgetConfigFilter.appConfig = this.appConfig;
2401
+ widgetConfigFilter.widgetInfo = widgetInfo;
2402
+ widgetConfigFilter.configChanges = this.getConfigChanges(false);
2403
+ widgetConfigFilter.widgetInfo.widgetName = widgetInfo.widgetName;
2404
+ widgetConfigFilter.globalFilter = this.globalFilter;
2405
+ this.widgetElement.loadContent(widgetConfigFilter);
2406
+ return [4 /*yield*/, this.setLock(widgetConfigFilter.config)];
2407
+ case 1:
2408
+ _a.sent();
2409
+ return [4 /*yield*/, this.setDownloadIcon()];
2410
+ case 2:
2411
+ _a.sent();
2412
+ return [2 /*return*/];
2413
+ }
2414
+ });
2415
+ }); }));
2416
+ }).bind(_this);
2417
+ _this.widgetElementHandler = handler;
2418
+ document.body.addEventListener('widgetinitiated' + widgetInfo.widgetInstanceId, handler);
2412
2419
  _this.ctlWidget.nativeElement.appendChild(_this.widgetElement);
2413
2420
  }));
2414
2421
  }));
@@ -3131,6 +3138,8 @@
3131
3138
  RAWidgetContainer.prototype.WidgetDisplayName;
3132
3139
  /** @type {?} */
3133
3140
  RAWidgetContainer.prototype.enableTitleLineActual;
3141
+ /** @type {?} */
3142
+ RAWidgetContainer.prototype.widgetElementHandler;
3134
3143
  /**
3135
3144
  * @type {?}
3136
3145
  * @private