@xh/hoist 78.0.0-SNAPSHOT.1761848630542 → 78.0.0-SNAPSHOT.1761929921002

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.
@@ -24,14 +24,14 @@ export function installCopyToClipboard(Highcharts) {
24
24
  try {
25
25
  const blobPromise = convertChartToPngAsync(this),
26
26
  clipboardItemInput = new window.ClipboardItem({
27
- // Safari requires an unresolved promise. See https://bugs.webkit.org/show_bug.cgi?id=222262 for discussion
27
+ // Safari requires an unresolved promise. See https://bugs.webkit.org/show_bug.cgi?id=222262 for discussion
28
28
  'image/png': Highcharts.isSafari ? blobPromise : await blobPromise
29
29
  });
30
30
  await window.navigator.clipboard.write([clipboardItemInput]);
31
31
  XH.successToast('Chart copied to clipboard');
32
32
  } catch (e) {
33
33
  XH.handleException(e, {showAlert: false, logOnServer: true});
34
- XH.dangerToast('Error: Chart could not be copied. This error has been logged.');
34
+ XH.dangerToast('Error: Chart could not be copied. This error has been logged.');
35
35
  }
36
36
  }
37
37
  });
@@ -41,14 +41,7 @@ export function installCopyToClipboard(Highcharts) {
41
41
  // Implementation
42
42
  //------------------
43
43
  async function convertChartToPngAsync(chart) {
44
- const svg = await new Promise((resolve, reject) =>
45
- chart.getSVGForLocalExport(
46
- chart.options.exporting,
47
- {},
48
- () => reject('Cannot fallback to export server'),
49
- svg => resolve(svg)
50
- )
51
- ),
44
+ const svg = chart.getSVG(),
52
45
  svgUrl = svgToDataUrl(svg),
53
46
  pngDataUrl = await svgUrlToPngDataUrlAsync(svgUrl),
54
47
  ret = await loadBlob(pngDataUrl);
@@ -65,7 +58,7 @@ function memoryCleanup(svgUrl) {
65
58
  }
66
59
 
67
60
  /**
68
- * Convert dataUri converted to blob
61
+ * Convert dataUri to blob
69
62
  */
70
63
  async function loadBlob(dataUrl) {
71
64
  const fetched = await fetch(dataUrl);
@@ -84,7 +77,7 @@ function svgToDataUrl(svg) {
84
77
  try {
85
78
  // Safari requires data URI since it doesn't allow navigation to blob
86
79
  // URLs.
87
- // foreignObjects dont work well in Blobs in Chrome (#14780).
80
+ // foreignObjects don't work well in Blobs in Chrome (#14780).
88
81
  if (!isWebKitButNotChrome && svg.indexOf('<foreignObject') === -1) {
89
82
  return domurl.createObjectURL(
90
83
  new window.Blob([svg], {
@@ -94,7 +87,7 @@ function svgToDataUrl(svg) {
94
87
  }
95
88
  } catch (e) {}
96
89
 
97
- // safari, firefox, or svgs with foreignObect returns this
90
+ // Safari, Firefox, or SVGs with foreignObect returns this
98
91
  return 'data:image/svg+xml;charset=UTF-8,' + encodeURIComponent(svg);
99
92
  }
100
93
 
@@ -172,7 +172,6 @@ class TreeMapLocalModel extends HoistModel {
172
172
  this.prevConfig = cloneDeep(chartCfg);
173
173
  this.createChart(config);
174
174
  }
175
-
176
175
  this.updateLabelVisibility();
177
176
  }
178
177
 
@@ -199,9 +198,18 @@ class TreeMapLocalModel extends HoistModel {
199
198
  });
200
199
  }
201
200
 
201
+ // Reload series data by fully removing and re-adding the series.
202
+ // When treemap clustering is enabled, `setData()` & `series.update()` does not properly clear old cluster nodes,
203
+ // causing overlap or stale rendering. Removing and re-adding the series forces a full rebuild
204
+ // of the layout and clustering state, ensuring the chart is correctly redrawn.
202
205
  @logWithDebug
203
206
  reloadSeriesData(newData) {
204
- this.chart?.series[0].setData(newData, true, false);
207
+ const {chart} = this;
208
+ if (!chart) return;
209
+ const oldSeries = chart.series[0],
210
+ series = Highcharts.merge(oldSeries.userOptions, {data: newData});
211
+ oldSeries.remove(false);
212
+ chart.addSeries(series, true);
205
213
  }
206
214
 
207
215
  startResize = ({width, height}) => {
@@ -465,7 +465,7 @@ export class TreeMapModel extends HoistModel {
465
465
  //----------------------
466
466
  defaultOnClick = (record, e) => {
467
467
  const {gridModel} = this;
468
- if (!gridModel) return;
468
+ if (!gridModel || !record) return;
469
469
 
470
470
  // Select nodes in grid
471
471
  const {selModel} = gridModel;
@@ -477,7 +477,7 @@ export class TreeMapModel extends HoistModel {
477
477
  };
478
478
 
479
479
  defaultOnDoubleClick = record => {
480
- if (!this.gridModel?.treeMode || isEmpty(record.children)) return;
480
+ if (!this.gridModel?.treeMode || isEmpty(record?.children)) return;
481
481
  this.toggleNodeExpanded(record.treePath);
482
482
  };
483
483
  }
@@ -9,8 +9,8 @@ import {checkVersion, logError} from '@xh/hoist/utils/js';
9
9
 
10
10
  export let Highcharts = null;
11
11
 
12
- const MIN_VERSION = '11.1.0';
13
- const MAX_VERSION = '11.*.*';
12
+ const MIN_VERSION = '12.4.0';
13
+ const MAX_VERSION = '12.*.*';
14
14
 
15
15
  /**
16
16
  * Expose application versions of Highcharts to Hoist.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "78.0.0-SNAPSHOT.1761848630542",
3
+ "version": "78.0.0-SNAPSHOT.1761929921002",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",