evui 3.4.92 → 3.4.93

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evui",
3
- "version": "3.4.92",
3
+ "version": "3.4.93",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -172,9 +172,9 @@
172
172
  watch(() => props.options, (chartOpt) => {
173
173
  const newOpt = getNormalizedOptions(chartOpt);
174
174
  const isUpdateLegendType = !isEqual(newOpt.legend.table, evChart.options.legend.table);
175
- const isUpdateTooltipFormatter = newOpt.tooltip.use === true && !isEqual(
176
- newOpt.tooltip.formatter,
177
- evChart.options.tooltip.formatter,
175
+ const isUpdateTooltip = newOpt.tooltip.use && !isEqual(
176
+ newOpt.tooltip,
177
+ evChart.options.tooltip,
178
178
  );
179
179
 
180
180
  evChart.options = cloneDeep(newOpt);
@@ -183,7 +183,7 @@
183
183
  updateSeries: false,
184
184
  updateSelTip: { update: false, keepDomain: false },
185
185
  updateLegend: isUpdateLegendType,
186
- updateTooltipFormatter: isUpdateTooltipFormatter,
186
+ updateTooltip: isUpdateTooltip,
187
187
  });
188
188
 
189
189
  if (!injectIsChartGroup) {
@@ -132,7 +132,7 @@ class EvChart {
132
132
 
133
133
  this.drawChart();
134
134
 
135
- if (tooltip.use) {
135
+ if (tooltip.use && !this.isInitTooltip) {
136
136
  this.createTooltipDOM();
137
137
  }
138
138
 
@@ -722,13 +722,7 @@ class EvChart {
722
722
  const groups = this.data.groups;
723
723
  const series = this.data.series;
724
724
 
725
- const {
726
- updateSeries,
727
- updateSelTip,
728
- updateLegend,
729
- updateData,
730
- updateTooltipFormatter,
731
- } = updateInfo;
725
+ const { updateSeries, updateSelTip, updateLegend, updateData, updateTooltip } = updateInfo;
732
726
 
733
727
  if (!this.isInit) {
734
728
  return;
@@ -823,7 +817,11 @@ class EvChart {
823
817
  }
824
818
 
825
819
  // Tooltip Update
826
- if (updateTooltipFormatter) {
820
+ if (updateTooltip) {
821
+ if (!this.isInitTooltip) {
822
+ this.createTooltipDOM();
823
+ }
824
+
827
825
  this.tooltipDOM.innerHTML = '';
828
826
 
829
827
  if (!options.tooltip?.formatter?.html) {
@@ -981,11 +979,8 @@ class EvChart {
981
979
  window.removeEventListener('click', this.dragTouchSelectionEvent);
982
980
  }
983
981
 
984
- if (this.options.tooltip.use) {
985
- this.tooltipCanvas.remove();
986
- this.tooltipCanvas = null;
987
- this.tooltipDOM.remove();
988
- this.tooltipDOM = null;
982
+ if (this.isInitTooltip) {
983
+ this.tooltipDestroy();
989
984
  }
990
985
 
991
986
  if (this.renderVisibleLegendsFrameId != null) {
@@ -34,7 +34,7 @@ const modules = {
34
34
  this.overlayClear();
35
35
 
36
36
  if (Object.keys(hitInfo.items).length) {
37
- if (tooltip.use) {
37
+ if (tooltip.use && this.isInitTooltip) {
38
38
  this.drawItemsHighlight(hitInfo, ctx);
39
39
 
40
40
  if (tooltip?.formatter?.html) {
@@ -51,7 +51,7 @@ const modules = {
51
51
  }
52
52
  }
53
53
  }
54
- } else if (tooltip.use) {
54
+ } else if (tooltip.use && this.isInitTooltip) {
55
55
  this.hideTooltipDOM();
56
56
  }
57
57
 
@@ -99,7 +99,7 @@ const modules = {
99
99
  this.overlayClear();
100
100
  }
101
101
 
102
- if (tooltip.use) {
102
+ if (tooltip.use && this.isInitTooltip) {
103
103
  this.tooltipClear();
104
104
  }
105
105
  this.listeners['mouse-leave']();
@@ -353,7 +353,7 @@ const modules = {
353
353
  };
354
354
 
355
355
  this.onWheel = (e) => {
356
- const isTooltipVisible = this.tooltipDOM.style.display === 'block';
356
+ const isTooltipVisible = this.tooltipDOM?.style?.display === 'block';
357
357
 
358
358
  if (isTooltipVisible) {
359
359
  e.preventDefault();
@@ -46,6 +46,7 @@ const modules = {
46
46
  this.tooltipDOM.style.display = 'none';
47
47
  };
48
48
  }
49
+ this.isInitTooltip = true;
49
50
  },
50
51
 
51
52
  setDefaultTooltipLayout() {
@@ -942,6 +943,14 @@ const modules = {
942
943
 
943
944
  return result;
944
945
  },
946
+
947
+ tooltipDestroy() {
948
+ if (this.tooltipDOM) {
949
+ this.tooltipDOM.remove();
950
+ this.tooltipDOM = null;
951
+ }
952
+ this.isInitTooltip = false;
953
+ },
945
954
  };
946
955
 
947
956
  export default modules;