@eclipse-scout/chart 22.0.0-beta.1 → 22.0.0

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.
@@ -13,7 +13,7 @@ __webpack_require__.r(__webpack_exports__);
13
13
  /* harmony export */ "default": () => (/* binding */ AbstractChartRenderer)
14
14
  /* harmony export */ });
15
15
  /*
16
- * Copyright (c) 2010-2020 BSI Business Systems Integration AG.
16
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
17
17
  * All rights reserved. This program and the accompanying materials
18
18
  * are made available under the terms of the Eclipse Public License v1.0
19
19
  * which accompanies this distribution, and is available at
@@ -119,14 +119,6 @@ class AbstractChartRenderer {
119
119
  _render() {// Override in subclasses
120
120
  }
121
121
 
122
- checkCompletlyRendered() {
123
- if (this.rendered || !this.chart.data) {
124
- return;
125
- }
126
-
127
- this.render();
128
- }
129
-
130
122
  renderCheckedItems() {
131
123
  if (this.rendered) {
132
124
  this._renderCheckedItems();
@@ -669,7 +661,7 @@ __webpack_require__.r(__webpack_exports__);
669
661
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
670
662
 
671
663
  /*
672
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
664
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
673
665
  * All rights reserved. This program and the accompanying materials
674
666
  * are made available under the terms of the Eclipse Public License v1.0
675
667
  * which accompanies this distribution, and is available at
@@ -712,6 +704,7 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
712
704
  this.checkedItems = [];
713
705
  this._updateChartTimeoutId = null;
714
706
  this._updateChartOpts = null;
707
+ this._updateChartOptsWhileNotAttached = [];
715
708
  this.updatedOnce = false;
716
709
  }
717
710
 
@@ -747,6 +740,14 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
747
740
  });
748
741
  }
749
742
 
743
+ _renderOnAttach() {
744
+ super._renderOnAttach();
745
+
746
+ this._updateChartOptsWhileNotAttached.splice(0).forEach(opts => this.updateChart($.extend(true, {}, opts, {
747
+ debounce: true
748
+ })));
749
+ }
750
+
750
751
  _remove() {
751
752
  if (this.chartRenderer) {
752
753
  this.chartRenderer.remove(false);
@@ -945,7 +946,8 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
945
946
 
946
947
 
947
948
  updateChart(opts) {
948
- opts = opts || {}; // Cancel previously scheduled update and merge opts
949
+ opts = opts || {};
950
+ opts.enforceRerender = !opts.onlyUpdateData && !opts.onlyRefresh; // Cancel previously scheduled update and merge opts
949
951
 
950
952
  if (this._updateChartTimeoutId) {
951
953
  clearTimeout(this._updateChartTimeoutId);
@@ -953,6 +955,9 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
953
955
  if (this._updateChartOpts) {
954
956
  // Inherit 'true' values from previously scheduled updates
955
957
  opts.requestAnimation = opts.requestAnimation || this._updateChartOpts.requestAnimation;
958
+ opts.onlyUpdateData = opts.onlyUpdateData || this._updateChartOpts.onlyUpdateData;
959
+ opts.onlyRefresh = opts.onlyRefresh || this._updateChartOpts.onlyRefresh;
960
+ opts.enforceRerender = opts.enforceRerender || this._updateChartOpts.enforceRerender;
956
961
  }
957
962
 
958
963
  this._updateChartTimeoutId = null;
@@ -979,11 +984,19 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
979
984
  this._updateChartTimeoutId = null;
980
985
  this._updateChartOpts = null;
981
986
 
982
- if (opts.onlyUpdateData && this.chartRenderer && this.chartRenderer.isDataUpdatable()) {
983
- this.chartRenderer.updateData(opts.requestAnimation);
984
- } else if (opts.onlyRefresh && this.chartRenderer) {
985
- this.chartRenderer.refresh();
986
- } else if (this.chartRenderer) {
987
+ if (!this.$container || !this.$container.isAttached()) {
988
+ this._updateChartOptsWhileNotAttached.push(opts);
989
+
990
+ return;
991
+ }
992
+
993
+ this.updatedOnce = true;
994
+
995
+ if (!this.chartRenderer) {
996
+ return; // nothing to render when there is no renderer.
997
+ }
998
+
999
+ if (opts.enforceRerender) {
987
1000
  this.chartRenderer.remove(this.chartRenderer.shouldAnimateRemoveOnUpdate(opts), chartAnimationStopping => {
988
1001
  if (this.removing || chartAnimationStopping) {
989
1002
  // prevent exceptions trying to render after navigated away, and do not update/render while a running animation is being stopped
@@ -993,9 +1006,11 @@ class Chart extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_1__.Widget {
993
1006
  this.chartRenderer.render(opts.requestAnimation);
994
1007
  this.trigger('chartRender');
995
1008
  });
1009
+ } else if (opts.onlyUpdateData && this.chartRenderer.isDataUpdatable()) {
1010
+ this.chartRenderer.updateData(opts.requestAnimation);
1011
+ } else if (opts.onlyRefresh) {
1012
+ this.chartRenderer.refresh();
996
1013
  }
997
-
998
- this.updatedOnce = true;
999
1014
  }
1000
1015
  }
1001
1016
 
@@ -2108,6 +2123,10 @@ class ChartJsRenderer extends _index__WEBPACK_IMPORTED_MODULE_0__.AbstractChartR
2108
2123
  }
2109
2124
 
2110
2125
  _renderTooltipLater(context) {
2126
+ if (!this.rendered || this.removing) {
2127
+ return;
2128
+ }
2129
+
2111
2130
  let tooltip = context.tooltip,
2112
2131
  tooltipItems = tooltip._tooltipItems;
2113
2132
 
@@ -3136,7 +3155,7 @@ class ChartJsRenderer extends _index__WEBPACK_IMPORTED_MODULE_0__.AbstractChartR
3136
3155
  let defaultGenerateLabels = defaultTypeGenerateLabels || chart_js_auto__WEBPACK_IMPORTED_MODULE_1__["default"].defaults.plugins.legend.labels.generateLabels;
3137
3156
  let labels = defaultGenerateLabels.call(chart, chart);
3138
3157
 
3139
- if (!this.rendered || this.removing) {
3158
+ if (this.removing) {
3140
3159
  return labels;
3141
3160
  }
3142
3161
 
@@ -4017,10 +4036,10 @@ class ChartJsRenderer extends _index__WEBPACK_IMPORTED_MODULE_0__.AbstractChartR
4017
4036
  _remove(afterRemoveFunc) {
4018
4037
  if (this.rendered && !this.removing) {
4019
4038
  this.removing = true;
4020
- this.$canvas.remove();
4021
- this.$canvas = null;
4022
4039
  this.chartJs.destroy();
4023
4040
  this.chartJs = null;
4041
+ this.$canvas.remove();
4042
+ this.$canvas = null;
4024
4043
  }
4025
4044
 
4026
4045
  super._remove(afterRemoveFunc);
@@ -5430,7 +5449,7 @@ __webpack_require__.r(__webpack_exports__);
5430
5449
  /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ "jquery");
5431
5450
  /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);
5432
5451
  /*
5433
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
5452
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
5434
5453
  * All rights reserved. This program and the accompanying materials
5435
5454
  * are made available under the terms of the Eclipse Public License v1.0
5436
5455
  * which accompanies this distribution, and is available at
@@ -5542,14 +5561,6 @@ class VennChartRenderer extends _index__WEBPACK_IMPORTED_MODULE_0__.AbstractSvgC
5542
5561
  }
5543
5562
  }
5544
5563
 
5545
- checkCompletlyRendered() {
5546
- if (this.readyToDraw) {
5547
- this._draw(false, true);
5548
- } else {
5549
- super.checkCompletlyRendered();
5550
- }
5551
- }
5552
-
5553
5564
  remove(requestAnimation, afterRemoveFunc) {
5554
5565
  this._cancelAsync3Calculator();
5555
5566
 
@@ -6000,7 +6011,7 @@ __webpack_require__.r(__webpack_exports__);
6000
6011
  /* harmony import */ var _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @eclipse-scout/core */ "@eclipse-scout/core");
6001
6012
  /* harmony import */ var _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0__);
6002
6013
  /*
6003
- * Copyright (c) 2010-2020 BSI Business Systems Integration AG.
6014
+ * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
6004
6015
  * All rights reserved. This program and the accompanying materials
6005
6016
  * are made available under the terms of the Eclipse Public License v1.0
6006
6017
  * which accompanies this distribution, and is available at
@@ -6039,14 +6050,6 @@ class ChartField extends _eclipse_scout_core__WEBPACK_IMPORTED_MODULE_0__.FormFi
6039
6050
  this._removeField();
6040
6051
  }
6041
6052
 
6042
- _renderOnAttach() {
6043
- super._renderOnAttach();
6044
-
6045
- if (this.chart && this.chart.chartRenderer) {
6046
- this.chart.chartRenderer.checkCompletlyRendered();
6047
- }
6048
- }
6049
-
6050
6053
  }
6051
6054
 
6052
6055
  /***/ }),