@visactor/vtable 1.5.5 → 1.5.6

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.
Files changed (115) hide show
  1. package/cjs/ListTable.js +1 -1
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotChart.d.ts +1 -0
  4. package/cjs/PivotChart.js +4 -0
  5. package/cjs/PivotChart.js.map +1 -1
  6. package/cjs/PivotTable.js +1 -1
  7. package/cjs/PivotTable.js.map +1 -1
  8. package/cjs/components/axis/axis.js +3 -2
  9. package/cjs/components/axis/axis.js.map +1 -1
  10. package/cjs/components/legend/discrete-legend/discrete-legend.js +2 -1
  11. package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  12. package/cjs/core/BaseTable.d.ts +3 -0
  13. package/cjs/core/BaseTable.js +44 -24
  14. package/cjs/core/BaseTable.js.map +1 -1
  15. package/cjs/core/FouseInput.d.ts +1 -0
  16. package/cjs/core/FouseInput.js +5 -2
  17. package/cjs/core/FouseInput.js.map +1 -1
  18. package/cjs/core/tableHelper.d.ts +2 -2
  19. package/cjs/core/tableHelper.js.map +1 -1
  20. package/cjs/core/utils/get-cell-position.d.ts +5 -25
  21. package/cjs/core/utils/get-cell-position.js.map +1 -1
  22. package/cjs/event/event.js +2 -1
  23. package/cjs/event/event.js.map +1 -1
  24. package/cjs/event/listener/container-dom.js +1 -1
  25. package/cjs/event/listener/container-dom.js.map +1 -1
  26. package/cjs/event/util.js +2 -2
  27. package/cjs/event/util.js.map +1 -1
  28. package/cjs/index.d.ts +1 -1
  29. package/cjs/index.js +1 -1
  30. package/cjs/index.js.map +1 -1
  31. package/cjs/scenegraph/debug-tool/debug-tool.js +4 -1
  32. package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
  33. package/cjs/scenegraph/graphic/chart.d.ts +1 -0
  34. package/cjs/scenegraph/graphic/chart.js +34 -20
  35. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  36. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +56 -16
  37. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  38. package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  39. package/cjs/scenegraph/graphic/contributions/chart-render.js +40 -24
  40. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  41. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  42. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  43. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -0
  44. package/cjs/scenegraph/refresh-node/update-chart.js +84 -32
  45. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  46. package/cjs/scenegraph/scenegraph.d.ts +1 -1
  47. package/cjs/scenegraph/scenegraph.js +14 -8
  48. package/cjs/scenegraph/scenegraph.js.map +1 -1
  49. package/cjs/state/resize/update-resize-row.js +1 -1
  50. package/cjs/state/resize/update-resize-row.js.map +1 -1
  51. package/cjs/state/state.js +2 -2
  52. package/cjs/state/state.js.map +1 -1
  53. package/cjs/tools/helper.js.map +1 -1
  54. package/cjs/ts-types/base-table.d.ts +12 -1
  55. package/cjs/ts-types/base-table.js.map +1 -1
  56. package/cjs/vrender.js.map +1 -1
  57. package/dist/vtable.js +433 -169
  58. package/dist/vtable.min.js +2 -2
  59. package/es/ListTable.js +1 -1
  60. package/es/ListTable.js.map +1 -1
  61. package/es/PivotChart.d.ts +1 -0
  62. package/es/PivotChart.js +5 -2
  63. package/es/PivotChart.js.map +1 -1
  64. package/es/PivotTable.js +1 -1
  65. package/es/PivotTable.js.map +1 -1
  66. package/es/components/axis/axis.js +3 -1
  67. package/es/components/axis/axis.js.map +1 -1
  68. package/es/components/legend/discrete-legend/discrete-legend.js +2 -1
  69. package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  70. package/es/core/BaseTable.d.ts +3 -0
  71. package/es/core/BaseTable.js +43 -23
  72. package/es/core/BaseTable.js.map +1 -1
  73. package/es/core/FouseInput.d.ts +1 -0
  74. package/es/core/FouseInput.js +5 -2
  75. package/es/core/FouseInput.js.map +1 -1
  76. package/es/core/tableHelper.d.ts +2 -2
  77. package/es/core/tableHelper.js.map +1 -1
  78. package/es/core/utils/get-cell-position.d.ts +5 -25
  79. package/es/core/utils/get-cell-position.js.map +1 -1
  80. package/es/event/event.js +2 -1
  81. package/es/event/event.js.map +1 -1
  82. package/es/event/listener/container-dom.js +1 -1
  83. package/es/event/listener/container-dom.js.map +1 -1
  84. package/es/event/util.js +2 -2
  85. package/es/event/util.js.map +1 -1
  86. package/es/index.d.ts +1 -1
  87. package/es/index.js +1 -1
  88. package/es/index.js.map +1 -1
  89. package/es/scenegraph/debug-tool/debug-tool.js +4 -1
  90. package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
  91. package/es/scenegraph/graphic/chart.d.ts +1 -0
  92. package/es/scenegraph/graphic/chart.js +33 -21
  93. package/es/scenegraph/graphic/chart.js.map +1 -1
  94. package/es/scenegraph/graphic/contributions/chart-render-helper.js +57 -15
  95. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  96. package/es/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  97. package/es/scenegraph/graphic/contributions/chart-render.js +41 -25
  98. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  99. package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  100. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  101. package/es/scenegraph/refresh-node/update-chart.d.ts +1 -0
  102. package/es/scenegraph/refresh-node/update-chart.js +81 -29
  103. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  104. package/es/scenegraph/scenegraph.d.ts +1 -1
  105. package/es/scenegraph/scenegraph.js +14 -8
  106. package/es/scenegraph/scenegraph.js.map +1 -1
  107. package/es/state/resize/update-resize-row.js +1 -1
  108. package/es/state/resize/update-resize-row.js.map +1 -1
  109. package/es/state/state.js +2 -2
  110. package/es/state/state.js.map +1 -1
  111. package/es/tools/helper.js.map +1 -1
  112. package/es/ts-types/base-table.d.ts +12 -1
  113. package/es/ts-types/base-table.js.map +1 -1
  114. package/es/vrender.js.map +1 -1
  115. package/package.json +4 -4
package/dist/vtable.js CHANGED
@@ -44372,9 +44372,11 @@
44372
44372
  }
44373
44373
  function getPromiseValue(value, callback) {
44374
44374
  if (isPromise(value)) {
44375
- value.then(result => {
44375
+ value
44376
+ .then(result => {
44376
44377
  callback(result);
44377
- }).catch((err) => {
44378
+ })
44379
+ .catch((err) => {
44378
44380
  });
44379
44381
  }
44380
44382
  else {
@@ -49119,8 +49121,8 @@
49119
49121
  function getCellEventArgsSet(e) {
49120
49122
  const tableEvent = {
49121
49123
  abstractPos: {
49122
- x: e.x,
49123
- y: e.y
49124
+ x: e.viewport.x,
49125
+ y: e.viewport.y
49124
49126
  }
49125
49127
  };
49126
49128
  const targetCell = getTargetCell(e.target);
@@ -54759,7 +54761,7 @@
54759
54761
  this.numberType = CHART_NUMBER_TYPE;
54760
54762
  this.isShareChartSpec = isShareChartSpec;
54761
54763
  if (!params.chartInstance) {
54762
- const chartInstance = new params.ClassType(params.spec, {
54764
+ const chartInstance = (this.chartInstance = new params.ClassType(params.spec, merge({}, this.attribute.tableChartOption, {
54763
54765
  renderCanvas: params.canvas,
54764
54766
  mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
54765
54767
  modeParams: this.attribute.modeParams,
@@ -54769,8 +54771,9 @@
54769
54771
  interactive: false,
54770
54772
  animation: false,
54771
54773
  autoFit: false
54772
- });
54774
+ })));
54773
54775
  chartInstance.renderSync();
54776
+ chartInstance.getStage().enableDirtyBounds();
54774
54777
  params.chartInstance = this.chartInstance = chartInstance;
54775
54778
  }
54776
54779
  else {
@@ -54788,34 +54791,53 @@
54788
54791
  y1: y1 - table.scrollTop,
54789
54792
  y2: y2 - table.scrollTop
54790
54793
  });
54791
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
54794
+ this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, merge({}, this.attribute.tableChartOption, {
54792
54795
  renderCanvas: this.attribute.canvas,
54793
54796
  mode: 'desktop-browser',
54794
54797
  canvasControled: false,
54795
54798
  viewBox: {
54796
- x1: x1 - table.scrollLeft,
54797
- x2: x2 - table.scrollLeft,
54798
- y1: y1 - table.scrollTop,
54799
- y2: y2 - table.scrollTop
54799
+ x1: 0,
54800
+ x2: x2 - x1,
54801
+ y1: 0,
54802
+ y2: y2 - y1
54800
54803
  },
54801
54804
  dpr: table.internalProps.pixelRatio,
54802
54805
  animation: false,
54803
54806
  interactive: true,
54804
54807
  autoFit: false,
54805
- beforeRender: (stage) => {
54806
- const ctx = stage.window.getContext();
54808
+ beforeRender: (chartStage) => {
54809
+ const stage = this.stage;
54810
+ const ctx = chartStage.window.getContext();
54811
+ const stageMatrix = stage.window.getViewBoxTransform();
54812
+ const viewBox = stage.window.getViewBox();
54807
54813
  ctx.inuse = true;
54808
54814
  ctx.clearMatrix();
54815
+ ctx.setTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f, true);
54816
+ ctx.translate(viewBox.x1, viewBox.y1);
54809
54817
  ctx.setTransformForCurrent(true);
54810
54818
  ctx.beginPath();
54811
54819
  ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
54812
54820
  ctx.clip();
54821
+ ctx.clearMatrix();
54822
+ if (table.options.canvas && !chartStage.needRender) {
54823
+ chartStage.pauseRender();
54824
+ table.scenegraph.stage.dirtyBounds.union(this.globalAABBBounds);
54825
+ table.scenegraph.updateNextFrame();
54826
+ }
54813
54827
  },
54814
54828
  afterRender(stage) {
54815
54829
  const ctx = stage.window.getContext();
54816
54830
  ctx.inuse = false;
54831
+ stage.needRender = false;
54832
+ chartStage.resumeRender();
54817
54833
  }
54818
- });
54834
+ }));
54835
+ const chartStage = this.activeChartInstance.getStage();
54836
+ const matrix = this.globalTransMatrix.clone();
54837
+ const stageMatrix = this.stage.window.getViewBoxTransform();
54838
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
54839
+ chartStage.window.setViewBoxTransform &&
54840
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
54819
54841
  this.activeChartInstance.renderSync();
54820
54842
  table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
54821
54843
  this.activeChartInstance.on('click', (params) => {
@@ -54851,11 +54873,12 @@
54851
54873
  const cellGroup = this.parent;
54852
54874
  const padding = this.attribute.cellPadding;
54853
54875
  const table = this.stage.table;
54876
+ const { x1, y1, x2, y2 } = cellGroup.globalAABBBounds;
54854
54877
  return {
54855
- x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
54856
- x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
54857
- y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
54858
- y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
54878
+ x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
54879
+ x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
54880
+ y1: Math.ceil(y1 + padding[0] + table.scrollTop + (table.options.viewBox?.y1 ?? 0)),
54881
+ y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (table.options.viewBox?.y1 ?? 0))
54859
54882
  };
54860
54883
  }
54861
54884
  }
@@ -54886,6 +54909,10 @@
54886
54909
  bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
54887
54910
  bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
54888
54911
  }
54912
+ bodyBound.x1 = bodyBound.x1 + (table.options.viewBox?.x1 ?? 0);
54913
+ bodyBound.x2 = bodyBound.x2 + (table.options.viewBox?.x1 ?? 0);
54914
+ bodyBound.y1 = bodyBound.y1 + (table.options.viewBox?.y1 ?? 0);
54915
+ bodyBound.y2 = bodyBound.y2 + (table.options.viewBox?.y1 ?? 0);
54889
54916
  return bodyBound;
54890
54917
  }
54891
54918
 
@@ -54926,46 +54953,65 @@
54926
54953
  if (viewBox.y2 <= viewBox.y1) {
54927
54954
  viewBox.y2 = viewBox.y1 + 1;
54928
54955
  }
54929
- axes?.forEach((axis, index) => {
54930
- if (axis.type === 'band') {
54931
- chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
54932
- }
54933
- else {
54934
- chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
54935
- }
54936
- });
54937
54956
  chartInstance.updateViewBox({
54938
- x1: viewBox.x1 - chart.getRootNode().table.scrollLeft,
54939
- x2: viewBox.x2 - chart.getRootNode().table.scrollLeft,
54940
- y1: viewBox.y1 - chart.getRootNode().table.scrollTop,
54941
- y2: viewBox.y2 - chart.getRootNode().table.scrollTop
54957
+ x1: 0,
54958
+ x2: viewBox.x2 - viewBox.x1,
54959
+ y1: 0,
54960
+ y2: viewBox.y2 - viewBox.y1
54942
54961
  }, false, false);
54943
- if (typeof dataId === 'string') {
54944
- chartInstance.updateDataSync(dataId, data ?? []);
54945
- }
54946
- else {
54947
- const dataBatch = [];
54948
- for (const dataIdStr in dataId) {
54949
- const dataIdAndField = dataId[dataIdStr];
54950
- const series = spec.series.find((item) => item?.data?.id === dataIdStr);
54951
- dataBatch.push({
54952
- id: dataIdStr,
54953
- values: dataIdAndField
54954
- ? data?.filter((item) => {
54955
- return item.hasOwnProperty(dataIdAndField);
54956
- }) ?? []
54957
- : data ?? [],
54958
- fields: series?.data?.fields
54959
- });
54960
- if (!chartInstance.updateFullDataSync) {
54961
- chartInstance.updateDataSync(dataIdStr, dataIdAndField
54962
- ? data?.filter((item) => {
54963
- return item.hasOwnProperty(dataIdAndField);
54964
- }) ?? []
54965
- : data ?? []);
54962
+ const chartStage = chartInstance.getStage();
54963
+ const matrix = chart.globalTransMatrix.clone();
54964
+ const stageMatrix = chart.stage.window.getViewBoxTransform();
54965
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
54966
+ chartStage.window.setViewBoxTransform &&
54967
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
54968
+ const { table } = chart.getRootNode();
54969
+ let updateSpec = false;
54970
+ if (table.options.specFormat) {
54971
+ const formatResult = table.options.specFormat(chart.attribute.spec);
54972
+ if (formatResult.needFormatSpec && formatResult.spec) {
54973
+ const spec = formatResult.spec;
54974
+ chartInstance.updateSpecSync(spec);
54975
+ updateSpec = true;
54976
+ }
54977
+ }
54978
+ if (!updateSpec) {
54979
+ axes?.forEach((axis, index) => {
54980
+ if (axis.type === 'band') {
54981
+ chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
54982
+ }
54983
+ else {
54984
+ chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
54966
54985
  }
54986
+ });
54987
+ table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
54988
+ if (typeof dataId === 'string') {
54989
+ chartInstance.updateDataSync(dataId, data ?? []);
54990
+ }
54991
+ else {
54992
+ const dataBatch = [];
54993
+ for (const dataIdStr in dataId) {
54994
+ const dataIdAndField = dataId[dataIdStr];
54995
+ const series = spec.series.find((item) => item?.data?.id === dataIdStr);
54996
+ dataBatch.push({
54997
+ id: dataIdStr,
54998
+ values: dataIdAndField
54999
+ ? data?.filter((item) => {
55000
+ return item.hasOwnProperty(dataIdAndField);
55001
+ }) ?? []
55002
+ : data ?? [],
55003
+ fields: series?.data?.fields
55004
+ });
55005
+ if (!chartInstance.updateFullDataSync) {
55006
+ chartInstance.updateDataSync(dataIdStr, dataIdAndField
55007
+ ? data?.filter((item) => {
55008
+ return item.hasOwnProperty(dataIdAndField);
55009
+ }) ?? []
55010
+ : data ?? []);
55011
+ }
55012
+ }
55013
+ chartInstance.updateFullDataSync?.(dataBatch);
54967
55014
  }
54968
- chartInstance.updateFullDataSync?.(dataBatch);
54969
55015
  }
54970
55016
  const sg = chartInstance.getStage();
54971
55017
  cacheStageCanvas(sg, chart);
@@ -54992,7 +55038,7 @@
54992
55038
  function cacheStageCanvas(stage, chart) {
54993
55039
  const { viewWidth, viewHeight } = stage;
54994
55040
  if (viewWidth < cacheCanvasSizeLimit && viewHeight < cacheCanvasSizeLimit) {
54995
- chart.cacheCanvas = stage.toCanvas();
55041
+ chart.cacheCanvas = toCanvas(stage);
54996
55042
  if (!chart.isShareChartSpec) {
54997
55043
  chart.chartInstance?.release();
54998
55044
  chart.chartInstance = null;
@@ -55013,7 +55059,7 @@
55013
55059
  const height = endY - startY;
55014
55060
  const bounds = new Bounds();
55015
55061
  bounds.setValue(startX, startY, endX, endY);
55016
- const canvas = stage.toCanvas(false, bounds);
55062
+ const canvas = toCanvas(stage, false, bounds);
55017
55063
  cacheCanvas.push({
55018
55064
  canvas,
55019
55065
  x: startX,
@@ -55025,9 +55071,57 @@
55025
55071
  }
55026
55072
  chart.cacheCanvas = cacheCanvas;
55027
55073
  }
55074
+ function toCanvas(stage, fullImage = true, viewBox) {
55075
+ if (stage.releaseStatus === 'released') {
55076
+ return null;
55077
+ }
55078
+ const matrix = stage.window.getViewBoxTransform();
55079
+ const window = renderToNewWindow(stage, fullImage, viewBox);
55080
+ window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, 0, 0);
55081
+ stage.renderTo(window);
55082
+ const c = window.getNativeHandler();
55083
+ if (c.nativeCanvas) {
55084
+ return c.nativeCanvas;
55085
+ }
55086
+ return null;
55087
+ }
55088
+ function renderToNewWindow(stage, fullImage = true, viewBox) {
55089
+ const matrix = stage.window.getViewBoxTransform();
55090
+ const window = container.get(VWindow);
55091
+ const x1 = viewBox ? -viewBox.x1 : 0;
55092
+ const y1 = viewBox ? -viewBox.y1 : 0;
55093
+ const x2 = viewBox ? viewBox.x2 : stage.viewWidth;
55094
+ const y2 = viewBox ? viewBox.y2 : stage.viewHeight;
55095
+ const width = viewBox ? viewBox.width() : stage.viewWidth;
55096
+ const height = viewBox ? viewBox.height() : stage.viewHeight;
55097
+ if (fullImage) {
55098
+ window.create({
55099
+ viewBox: { x1, y1, x2, y2 },
55100
+ width: width * matrix.a,
55101
+ height: height * matrix.d,
55102
+ dpr: stage.window.dpr,
55103
+ canvasControled: true,
55104
+ offscreen: true,
55105
+ title: ''
55106
+ });
55107
+ }
55108
+ else {
55109
+ window.create({
55110
+ viewBox: { x1, y1, x2, y2 },
55111
+ width: width * matrix.a,
55112
+ height: height * matrix.d,
55113
+ dpr: stage.window.dpr,
55114
+ canvasControled: true,
55115
+ offscreen: true,
55116
+ title: ''
55117
+ });
55118
+ }
55119
+ stage.renderTo(window);
55120
+ return window;
55121
+ }
55028
55122
 
55029
55123
  const ChartRender = Symbol.for('ChartRender');
55030
- let DefaultCanvasChartRender = class DefaultCanvasChartRender {
55124
+ let DefaultCanvasChartRender = class DefaultCanvasChartRender extends BaseRender {
55031
55125
  type;
55032
55126
  numberType = CHART_NUMBER_TYPE;
55033
55127
  drawShape(chart, context, x, y, drawContext, params, fillCb, strokeCb) {
@@ -55035,6 +55129,7 @@
55035
55129
  const { dataId, data, spec } = chart.attribute;
55036
55130
  chart.getViewBox();
55037
55131
  const { width = groupAttribute.width, height = groupAttribute.height } = chart.attribute;
55132
+ const { table } = chart.getRootNode();
55038
55133
  const { active, cacheCanvas, activeChartInstance } = chart;
55039
55134
  if (!active && cacheCanvas) {
55040
55135
  if (isArray$1(cacheCanvas)) {
@@ -55048,6 +55143,27 @@
55048
55143
  }
55049
55144
  }
55050
55145
  else if (activeChartInstance) {
55146
+ if (table.options.specFormat) {
55147
+ const formatResult = table.options.specFormat(chart.attribute.spec);
55148
+ if (formatResult.needFormatSpec && formatResult.spec) {
55149
+ const spec = formatResult.spec;
55150
+ activeChartInstance.updateSpecSync(spec);
55151
+ return;
55152
+ }
55153
+ }
55154
+ const viewBox = chart.getViewBox();
55155
+ activeChartInstance.updateViewBox({
55156
+ x1: 0,
55157
+ x2: viewBox.x2 - viewBox.x1,
55158
+ y1: 0,
55159
+ y2: viewBox.y2 - viewBox.y1
55160
+ }, false, false);
55161
+ const chartStage = activeChartInstance.getStage();
55162
+ chartStage.needRender = true;
55163
+ const matrix = chart.globalTransMatrix.clone();
55164
+ const stageMatrix = chart.stage.window.getViewBoxTransform().clone();
55165
+ stageMatrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
55166
+ chartStage.window.setViewBoxTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
55051
55167
  if (typeof dataId === 'string') {
55052
55168
  activeChartInstance.updateDataSync(dataId, data ?? []);
55053
55169
  }
@@ -55077,13 +55193,13 @@
55077
55193
  }
55078
55194
  }
55079
55195
  else {
55080
- if (chart.getRootNode().table.internalProps.renderChartAsync) {
55196
+ if (table.internalProps.renderChartAsync) {
55081
55197
  if (chartRenderKeys.indexOf(`${chart.parent.col}+${chart.parent.row}`) === -1) {
55082
55198
  chartRenderKeys.push(`${chart.parent.col}+${chart.parent.row}`);
55083
55199
  chartRenderQueueList.push(chart);
55084
55200
  }
55085
55201
  if (!IsHandlingChartQueue()) {
55086
- startRenderChartQueue(chart.getRootNode().table);
55202
+ startRenderChartQueue(table);
55087
55203
  }
55088
55204
  }
55089
55205
  else {
@@ -55092,31 +55208,7 @@
55092
55208
  }
55093
55209
  }
55094
55210
  draw(chart, renderService, drawContext, params) {
55095
- const { context } = drawContext;
55096
- if (!context) {
55097
- return;
55098
- }
55099
- const { clip } = chart.attribute;
55100
- if (clip) {
55101
- context.save();
55102
- }
55103
- else {
55104
- context.highPerformanceSave();
55105
- }
55106
- context.transformFromMatrix(chart.transMatrix, true);
55107
- context.beginPath();
55108
- if (params.skipDraw) {
55109
- this.drawShape(chart, context, 0, 0, drawContext, params, () => false, () => false);
55110
- }
55111
- else {
55112
- this.drawShape(chart, context, 0, 0, drawContext);
55113
- }
55114
- if (clip) {
55115
- context.restore();
55116
- }
55117
- else {
55118
- context.highPerformanceRestore();
55119
- }
55211
+ this._draw(chart, {}, false, drawContext, params);
55120
55212
  }
55121
55213
  };
55122
55214
  DefaultCanvasChartRender = __decorate([
@@ -59967,66 +60059,144 @@
59967
60059
  }
59968
60060
 
59969
60061
  function updateChartSizeForResizeColWidth(scenegraph, col) {
59970
- for (let c = col; c <= scenegraph.proxy.colEnd; c++) {
59971
- const columnGroup = scenegraph.getColGroup(c);
59972
- columnGroup?.getChildren()?.forEach((cellNode) => {
59973
- const width = scenegraph.table.getColWidth(cellNode.col);
59974
- const height = scenegraph.table.getRowHeight(cellNode.row);
59975
- cellNode.children.forEach((node) => {
59976
- if (node.type === 'chart') {
59977
- node.cacheCanvas = null;
59978
- node.setAttribute('width', Math.ceil(width - node.attribute.cellPadding[3] - node.attribute.cellPadding[1]));
59979
- node.setAttribute('height', Math.ceil(height - node.attribute.cellPadding[0] - node.attribute.cellPadding[2]));
59980
- }
59981
- });
60062
+ const { table } = scenegraph;
60063
+ const layout = table.internalProps.layoutMap;
60064
+ const columnResizeType = col === -1 ? 'all' : table.internalProps.columnResizeType;
60065
+ if (columnResizeType === 'column') {
60066
+ const columnGroup = scenegraph.getColGroup(col);
60067
+ columnGroup?.forEachChildren((cellNode) => {
60068
+ const width = table.getColWidth(cellNode.col);
60069
+ const height = table.getRowHeight(cellNode.row);
60070
+ updateChartGraphicSize(cellNode, width, height);
59982
60071
  });
60072
+ if (table.widthMode === 'adaptive' && col < table.colCount - 1) {
60073
+ const columnGroup = scenegraph.getColGroup(col + 1);
60074
+ columnGroup?.forEachChildren((cellNode) => {
60075
+ const width = table.getColWidth(cellNode.col);
60076
+ const height = table.getRowHeight(cellNode.row);
60077
+ updateChartGraphicSize(cellNode, width, height);
60078
+ });
60079
+ }
59983
60080
  }
59984
- if (!scenegraph.table.isPivotChart() && scenegraph.table.rightFrozenColCount >= 1) {
59985
- for (let c = scenegraph.table.colCount - scenegraph.table.rightFrozenColCount; c <= scenegraph.table.colCount - 1; c++) {
60081
+ else {
60082
+ let startCol = table.rowHeaderLevelCount;
60083
+ let endCol = table.colCount - 1;
60084
+ let resizeIndicatorKey;
60085
+ let resizeDimensionKey;
60086
+ let resizeDimensionValue;
60087
+ if (columnResizeType === 'indicator') {
60088
+ if (layout.indicatorsAsCol) {
60089
+ resizeIndicatorKey = layout.getIndicatorKey(col, table.columnHeaderLevelCount);
60090
+ }
60091
+ else {
60092
+ const headerPaths = layout.getCellHeaderPaths(col, table.columnHeaderLevelCount - 1);
60093
+ const headerPath = headerPaths.colHeaderPaths[headerPaths.colHeaderPaths.length - 1];
60094
+ resizeDimensionKey = headerPath.dimensionKey;
60095
+ resizeDimensionValue = headerPath.value;
60096
+ }
60097
+ }
60098
+ else if (columnResizeType === 'indicatorGroup') {
60099
+ const layout = table.internalProps.layoutMap;
60100
+ const headerPaths = layout.getCellHeaderPaths(table.stateManager.columnResize.col, table.columnHeaderLevelCount);
60101
+ const node = layout.getHeadNodeByRowOrColDimensions(headerPaths.colHeaderPaths.slice(0, headerPaths.colHeaderPaths.length - 1));
60102
+ startCol = node.startInTotal + table.frozenColCount;
60103
+ endCol = node.startInTotal + table.frozenColCount + node.size - 1;
60104
+ }
60105
+ for (let c = startCol; c <= endCol; c++) {
59986
60106
  const columnGroup = scenegraph.getColGroup(c);
59987
- columnGroup?.getChildren()?.forEach((cellNode) => {
59988
- const width = scenegraph.table.getColWidth(cellNode.col);
59989
- const height = scenegraph.table.getRowHeight(cellNode.row);
59990
- cellNode.children.forEach((node) => {
59991
- if (node.type === 'chart') {
59992
- node.cacheCanvas = null;
59993
- node.setAttribute('width', Math.ceil(width - node.attribute.cellPadding[3] - node.attribute.cellPadding[1]));
59994
- node.setAttribute('height', Math.ceil(height - node.attribute.cellPadding[0] - node.attribute.cellPadding[2]));
60107
+ if (columnGroup) {
60108
+ if (columnResizeType === 'indicator') {
60109
+ const indicatorKey = layout.getIndicatorKey(c, table.columnHeaderLevelCount);
60110
+ if (layout.indicatorsAsCol && indicatorKey !== resizeIndicatorKey) {
60111
+ continue;
60112
+ }
60113
+ else if (!layout.indicatorsAsCol) {
60114
+ const headerPaths = layout.getCellHeaderPaths(c, table.columnHeaderLevelCount - 1);
60115
+ const headerPath = headerPaths?.colHeaderPaths[headerPaths.colHeaderPaths.length - 1];
60116
+ if (!headerPath ||
60117
+ resizeDimensionKey !== headerPath.dimensionKey ||
60118
+ resizeDimensionValue !== headerPath.value) {
60119
+ continue;
60120
+ }
59995
60121
  }
60122
+ }
60123
+ columnGroup.forEachChildren((cellNode) => {
60124
+ const width = table.getColWidth(cellNode.col);
60125
+ const height = table.getRowHeight(cellNode.row);
60126
+ updateChartGraphicSize(cellNode, width, height);
59996
60127
  });
59997
- });
60128
+ }
59998
60129
  }
59999
60130
  }
60000
60131
  }
60001
60132
  function updateChartSizeForResizeRowHeight(scenegraph, row) {
60002
- const updateCellNode = (c, r) => {
60003
- const cellNode = scenegraph.getCell(c, r);
60004
- const width = scenegraph.table.getColWidth(cellNode.col);
60005
- const height = scenegraph.table.getRowHeight(cellNode.row);
60006
- cellNode.children.forEach((node) => {
60007
- if (node.type === 'chart') {
60008
- node.cacheCanvas = null;
60009
- node.setAttribute('width', Math.ceil(width - node.attribute.cellPadding[3] - node.attribute.cellPadding[1]));
60010
- node.setAttribute('height', Math.ceil(height - node.attribute.cellPadding[0] - node.attribute.cellPadding[2]));
60011
- }
60012
- });
60013
- };
60014
- for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
60015
- for (let r = row; r <= scenegraph.proxy.rowEnd; r++) {
60016
- updateCellNode(c, r);
60133
+ const { table } = scenegraph;
60134
+ const layout = table.internalProps.layoutMap;
60135
+ const state = table.stateManager;
60136
+ const rowResizeType = row === -1 ? 'all' : table.internalProps.rowResizeType;
60137
+ let startRow = table.columnHeaderLevelCount;
60138
+ let endRow = table.rowCount - 1;
60139
+ let resizeIndicatorKey;
60140
+ let resizeDimensionKey;
60141
+ let resizeDimensionValue;
60142
+ if (rowResizeType === 'indicator') {
60143
+ if (!layout.indicatorsAsCol) {
60144
+ resizeIndicatorKey = layout.getIndicatorKey(table.rowHeaderLevelCount, row);
60017
60145
  }
60018
- }
60019
- if (scenegraph.table.rightFrozenColCount >= 1) {
60020
- for (let c = scenegraph.table.colCount - scenegraph.table.rightFrozenColCount; c <= scenegraph.table.colCount - 1; c++) {
60021
- for (let r = row; r <= scenegraph.proxy.rowEnd; r++) {
60022
- updateCellNode(c, r);
60146
+ else {
60147
+ const headerPaths = layout.getCellHeaderPaths(table.rowHeaderLevelCount - 1, row);
60148
+ const headerPath = headerPaths.rowHeaderPaths?.[headerPaths.rowHeaderPaths.length - 1];
60149
+ resizeDimensionKey = headerPath?.dimensionKey;
60150
+ resizeDimensionValue = headerPath?.value;
60151
+ }
60152
+ }
60153
+ else if (rowResizeType === 'indicatorGroup') {
60154
+ const layout = table.internalProps.layoutMap;
60155
+ const headerPaths = layout.getCellHeaderPaths(table.rowHeaderLevelCount, row);
60156
+ const node = layout.getHeadNodeByRowOrColDimensions(headerPaths.rowHeaderPaths.slice(0, headerPaths.rowHeaderPaths.length - 1));
60157
+ startRow = node.startInTotal + table.frozenRowCount;
60158
+ endRow = node.startInTotal + table.frozenRowCount + node.size - 1;
60159
+ }
60160
+ for (let col = scenegraph.proxy.colStart; col <= scenegraph.proxy.colEnd; col++) {
60161
+ if (rowResizeType === 'row') {
60162
+ const cellNode = scenegraph.highPerformanceGetCell(col, row);
60163
+ if (cellNode.role !== 'cell') {
60164
+ continue;
60165
+ }
60166
+ const width = table.getColWidth(cellNode.col);
60167
+ const height = table.getRowHeight(cellNode.row);
60168
+ updateChartGraphicSize(cellNode, width, height);
60169
+ if (table.heightMode === 'adaptive' && row < table.rowCount - 1) {
60170
+ const cellNode = scenegraph.highPerformanceGetCell(col, row + 1);
60171
+ const width = table.getColWidth(cellNode.col);
60172
+ const height = table.getRowHeight(cellNode.row);
60173
+ updateChartGraphicSize(cellNode, width, height);
60023
60174
  }
60024
60175
  }
60025
- }
60026
- if (scenegraph.table.frozenColCount >= 1) {
60027
- for (let c = 0; c <= scenegraph.table.frozenColCount - 1; c++) {
60028
- for (let r = row; r <= scenegraph.proxy.rowEnd; r++) {
60029
- updateCellNode(c, r);
60176
+ else {
60177
+ for (let r = startRow; r <= endRow; r++) {
60178
+ if (rowResizeType === 'indicator') {
60179
+ const indicatorKey = layout.getIndicatorKey(state.table.rowHeaderLevelCount, r);
60180
+ if (!layout.indicatorsAsCol && indicatorKey !== resizeIndicatorKey) {
60181
+ continue;
60182
+ }
60183
+ else if (layout.indicatorsAsCol) {
60184
+ const headerPaths = layout.getCellHeaderPaths(state.table.rowHeaderLevelCount - 1, r);
60185
+ const headerPath = headerPaths?.rowHeaderPaths[headerPaths.rowHeaderPaths.length - 1];
60186
+ if (!headerPath ||
60187
+ resizeDimensionKey !== headerPath.dimensionKey ||
60188
+ resizeDimensionValue !== headerPath.value) {
60189
+ continue;
60190
+ }
60191
+ }
60192
+ }
60193
+ const cellNode = scenegraph.highPerformanceGetCell(col, r);
60194
+ if (cellNode.role !== 'cell') {
60195
+ continue;
60196
+ }
60197
+ const width = table.getColWidth(cellNode.col);
60198
+ const height = table.getRowHeight(cellNode.row);
60199
+ updateChartGraphicSize(cellNode, width, height);
60030
60200
  }
60031
60201
  }
60032
60202
  }
@@ -60044,6 +60214,15 @@
60044
60214
  });
60045
60215
  }
60046
60216
  }
60217
+ function clearCellChartCacheImage(col, row, scenegraph) {
60218
+ const cellGroup = scenegraph.getCell(col, row);
60219
+ cellGroup.children.forEach((node) => {
60220
+ if (node.type === 'chart') {
60221
+ node.cacheCanvas = null;
60222
+ node.addUpdateBoundTag();
60223
+ }
60224
+ });
60225
+ }
60047
60226
  function updateChartData(scenegraph) {
60048
60227
  const table = scenegraph.table;
60049
60228
  for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
@@ -60134,6 +60313,17 @@
60134
60313
  }
60135
60314
  });
60136
60315
  }
60316
+ function updateChartGraphicSize(cellNode, width, height) {
60317
+ cellNode.forEachChildren((graphic) => {
60318
+ if (graphic.type === 'chart') {
60319
+ graphic.cacheCanvas = null;
60320
+ graphic.setAttributes({
60321
+ width: Math.ceil(width - graphic.attribute.cellPadding[3] - graphic.attribute.cellPadding[1]),
60322
+ height: Math.ceil(height - graphic.attribute.cellPadding[0] - graphic.attribute.cellPadding[2])
60323
+ });
60324
+ }
60325
+ });
60326
+ }
60137
60327
 
60138
60328
  function initSceneGraph(scene) {
60139
60329
  const width = scene.table.tableNoFrameWidth;
@@ -60905,7 +61095,12 @@
60905
61095
  setPoptipTheme(this.table.theme.textPopTipStyle);
60906
61096
  let width;
60907
61097
  let height;
60908
- if (Env.mode === 'node') {
61098
+ if (table.options.canvas && table.options.viewBox) {
61099
+ vglobal.setEnv('browser');
61100
+ width = table.options.viewBox.x2 - table.options.viewBox.x1;
61101
+ height = table.options.viewBox.y2 - table.options.viewBox.y1;
61102
+ }
61103
+ else if (Env.mode === 'node') {
60909
61104
  vglobal.setEnv('node', table.options.modeParams);
60910
61105
  width = table.canvasWidth;
60911
61106
  height = table.canvasHeight;
@@ -60923,9 +61118,15 @@
60923
61118
  background: table.theme.underlayBackgroundColor,
60924
61119
  dpr: table.internalProps.pixelRatio,
60925
61120
  enableLayout: true,
60926
- afterRender: () => {
61121
+ beforeRender: (stage) => {
61122
+ this.table.options.beforeRender && this.table.options.beforeRender(stage);
61123
+ },
61124
+ afterRender: (stage) => {
61125
+ this.table.options.afterRender && this.table.options.afterRender(stage);
60927
61126
  this.table.fireListeners('after_render', null);
60928
61127
  },
61128
+ canvasControled: !table.options.canvas,
61129
+ viewBox: table.options.viewBox,
60929
61130
  ...table.options.renderOption
60930
61131
  });
60931
61132
  this.stage.defaultLayer.setTheme({
@@ -61301,8 +61502,8 @@
61301
61502
  updateChartSizeForResizeColWidth(col) {
61302
61503
  updateChartSizeForResizeColWidth(this, col);
61303
61504
  }
61304
- updateChartSizeForResizeRowHeight(col) {
61305
- updateChartSizeForResizeRowHeight(this, col);
61505
+ updateChartSizeForResizeRowHeight(row) {
61506
+ updateChartSizeForResizeRowHeight(this, row);
61306
61507
  }
61307
61508
  updateChartState(datum) {
61308
61509
  this.table.isPivotChart() && updateChartState(this, datum);
@@ -61438,7 +61639,7 @@
61438
61639
  this.table.heightMode === 'adaptive' ||
61439
61640
  this.table.autoFillWidth ||
61440
61641
  this.table.autoFillHeight) {
61441
- this.updateChartSizeForResizeColWidth(this.table.rowHeaderLevelCount);
61642
+ this.updateChartSizeForResizeColWidth(-1);
61442
61643
  }
61443
61644
  this.proxy.progress();
61444
61645
  this.updateNextFrame();
@@ -63706,7 +63907,7 @@
63706
63907
  state.table.scenegraph.updateNextFrame();
63707
63908
  }
63708
63909
  function updateResizeColForRow(detaY, state) {
63709
- if (state.table.heightMode === 'adaptive' && state.rowResize.row < state.table.colCount - 1) {
63910
+ if (state.table.heightMode === 'adaptive' && state.rowResize.row < state.table.rowCount - 1) {
63710
63911
  state.table.scenegraph.updateRowHeight(state.rowResize.row, detaY);
63711
63912
  state.table.scenegraph.updateRowHeight(state.rowResize.row + 1, -detaY);
63712
63913
  state.table.internalProps._heightResizedRowMap.add(state.rowResize.row);
@@ -64193,7 +64394,7 @@
64193
64394
  setTimeout(() => {
64194
64395
  this.rowResize.resizing = false;
64195
64396
  }, 0);
64196
- this.table.scenegraph.updateChartSizeForResizeColWidth(this.rowResize.row);
64397
+ this.table.scenegraph.updateChartSizeForResizeRowHeight(this.rowResize.row);
64197
64398
  this.table.scenegraph.component.hideResizeRow();
64198
64399
  this.table.scenegraph.updateNextFrame();
64199
64400
  }
@@ -66243,20 +66444,22 @@
66243
66444
  e.preventDefault();
66244
66445
  }
66245
66446
  });
66246
- handler.on(table.getContainer(), 'resize', e => {
66247
- if (e.width === 0 && e.height === 0) {
66248
- return;
66249
- }
66250
- if (table.autoFillWidth || table.autoFillHeight) {
66251
- table.editorManager?.completeEdit();
66252
- }
66253
- if (!isValid$1(table.options.pixelRatio)) {
66254
- table.setPixelRatio(getPixelRatio());
66255
- }
66256
- if (!e.windowSizeNotChange) {
66257
- table.resize();
66258
- }
66259
- });
66447
+ if (!table.options.canvas) {
66448
+ handler.on(table.getContainer(), 'resize', e => {
66449
+ if (e.width === 0 && e.height === 0) {
66450
+ return;
66451
+ }
66452
+ if (table.autoFillWidth || table.autoFillHeight) {
66453
+ table.editorManager?.completeEdit();
66454
+ }
66455
+ if (!isValid$1(table.options.pixelRatio)) {
66456
+ table.setPixelRatio(getPixelRatio());
66457
+ }
66458
+ if (!e.windowSizeNotChange) {
66459
+ table.resize();
66460
+ }
66461
+ });
66462
+ }
66260
66463
  const regex = /<tr[^>]*>([\s\S]*?)<\/tr>/g;
66261
66464
  const cellRegex = /<td[^>]*>([\s\S]*?)<\/td>/g;
66262
66465
  function pasteHtmlToTable(item) {
@@ -66818,7 +67021,7 @@
66818
67021
  this.table = table;
66819
67022
  this.handleTextStickBindId = [];
66820
67023
  this.inertiaScroll = new InertiaScroll(table.stateManager);
66821
- if (Env.mode === 'node') {
67024
+ if (Env.mode === 'node' || table.options.disableInteraction) {
66822
67025
  return;
66823
67026
  }
66824
67027
  this.bindOuterEvent();
@@ -68419,6 +68622,7 @@
68419
68622
  }
68420
68623
 
68421
68624
  class FocusInput extends EventTarget {
68625
+ _container;
68422
68626
  _table;
68423
68627
  _input;
68424
68628
  constructor(table, parentElement) {
@@ -68438,6 +68642,7 @@
68438
68642
  input.dataset.vtable = 'vtable';
68439
68643
  input.readOnly = true;
68440
68644
  parentElement.appendChild(div);
68645
+ this._container = div;
68441
68646
  }
68442
68647
  focus() {
68443
68648
  this._input.focus({ preventScroll: true });
@@ -68457,6 +68662,7 @@
68457
68662
  return this._input;
68458
68663
  }
68459
68664
  release() {
68665
+ this._container.parentElement?.removeChild(this._container);
68460
68666
  }
68461
68667
  }
68462
68668
 
@@ -70606,7 +70812,7 @@
70606
70812
  return TABLE_EVENT_TYPE;
70607
70813
  }
70608
70814
  options;
70609
- version = "1.5.5";
70815
+ version = "1.5.6";
70610
70816
  pagination;
70611
70817
  id = `VTable${Date.now()}`;
70612
70818
  headerStyleCache;
@@ -70621,7 +70827,7 @@
70621
70827
  _hasAutoImageColumn;
70622
70828
  constructor(container, options = {}) {
70623
70829
  super();
70624
- if (!container && options.mode !== 'node') {
70830
+ if (!container && options.mode !== 'node' && !options.canvas) {
70625
70831
  throw new Error("vtable's container is undefined");
70626
70832
  }
70627
70833
  const { frozenColCount = 0, frozenRowCount, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth, widthMode = 'standard', heightMode = 'standard', autoFillWidth = false, autoFillHeight = false, widthAdaptiveMode = 'only-body', heightAdaptiveMode = 'only-body', keyboardOptions, eventOptions, rowSeriesNumber, columnResizeMode, rowResizeMode = 'none', dragHeaderMode, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, customRender, pixelRatio = defaultPixelRatio, renderChartAsync, renderChartAsyncBatchCount, mode, modeParams, canvasWidth, canvasHeight, overscrollBehavior, limitMinWidth, limitMinHeight, clearDOM = true } = options;
@@ -70659,7 +70865,14 @@
70659
70865
  if (typeof allowFrozenColCount === 'number' && allowFrozenColCount <= 0) {
70660
70866
  this.showFrozenIcon = false;
70661
70867
  }
70662
- if (Env.mode !== 'node') {
70868
+ if (this.options.canvas) {
70869
+ internalProps.element = this.options.canvas.parentElement;
70870
+ internalProps.element.style.position = 'relative';
70871
+ internalProps.focusControl = new FocusInput(this, internalProps.element);
70872
+ internalProps.canvas = this.options.canvas;
70873
+ internalProps.context = internalProps.canvas.getContext('2d');
70874
+ }
70875
+ else if (Env.mode !== 'node') {
70663
70876
  internalProps.element = createRootElement(this.padding);
70664
70877
  internalProps.focusControl = new FocusInput(this, internalProps.element);
70665
70878
  internalProps.canvas = document.createElement('canvas');
@@ -71067,7 +71280,21 @@
71067
71280
  const { padding } = this;
71068
71281
  let widthP = 0;
71069
71282
  let heightP = 0;
71070
- if (Env.mode === 'browser') {
71283
+ this.tableX = 0;
71284
+ this.tableY = 0;
71285
+ if (this.options.canvas && this.options.viewBox) {
71286
+ widthP = this.options.viewBox.x2 - this.options.viewBox.x1;
71287
+ heightP = this.options.viewBox.y2 - this.options.viewBox.y1;
71288
+ if (this?.scenegraph?.stage) {
71289
+ if (this.options.viewBox) {
71290
+ this.scenegraph.stage.setViewBox(this.options.viewBox, false);
71291
+ }
71292
+ else {
71293
+ this.scenegraph.stage.resize(widthP, heightP);
71294
+ }
71295
+ }
71296
+ }
71297
+ else if (Env.mode === 'browser') {
71071
71298
  const element = this.getElement();
71072
71299
  let widthWithoutPadding = 0;
71073
71300
  let heightWithoutPadding = 0;
@@ -71134,6 +71361,23 @@
71134
71361
  }
71135
71362
  }
71136
71363
  }
71364
+ updateViewBox(newViewBox) {
71365
+ const oldWidth = this.options?.viewBox.x2 ?? 0 - this.options?.viewBox.x1 ?? 0;
71366
+ const oldHeight = this.options?.viewBox.y2 ?? 0 - this.options?.viewBox.y1 ?? 0;
71367
+ const newWidth = newViewBox.x2 - newViewBox.x1;
71368
+ const newHeight = newViewBox.y2 - newViewBox.y1;
71369
+ this.options.viewBox = newViewBox;
71370
+ if (oldWidth !== newWidth || oldHeight !== newHeight) {
71371
+ this.resize();
71372
+ }
71373
+ else {
71374
+ this.scenegraph.stage.setViewBox(this.options.viewBox, true);
71375
+ }
71376
+ }
71377
+ setViewBoxTransform(a, b, c, d, e, f) {
71378
+ this.internalProps.modifiedViewBoxTransform = true;
71379
+ this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
71380
+ }
71137
71381
  get rowHierarchyType() {
71138
71382
  return 'grid';
71139
71383
  }
@@ -71660,6 +71904,8 @@
71660
71904
  const visibleRect = this.getVisibleRect();
71661
71905
  rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0));
71662
71906
  rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0));
71907
+ rect.offsetLeft(this.options.viewBox?.x1 ?? 0);
71908
+ rect.offsetTop(this.options.viewBox?.y1 ?? 0);
71663
71909
  return rect;
71664
71910
  }
71665
71911
  getVisibleRect() {
@@ -71819,8 +72065,9 @@
71819
72065
  }
71820
72066
  this.scenegraph.stage.release();
71821
72067
  this.scenegraph.proxy.release();
72068
+ internalProps.focusControl.release();
71822
72069
  const { parentElement } = internalProps.element;
71823
- if (parentElement) {
72070
+ if (parentElement && !this.options.canvas) {
71824
72071
  parentElement.removeChild(internalProps.element);
71825
72072
  }
71826
72073
  this.editorManager?.editingEditor?.onEnd?.();
@@ -71864,7 +72111,7 @@
71864
72111
  this.autoFillHeight = autoFillHeight ?? false;
71865
72112
  this.customRender = customRender;
71866
72113
  const internalProps = this.internalProps;
71867
- if (Env.mode !== 'node') {
72114
+ if (Env.mode !== 'node' && !options.canvas) {
71868
72115
  updateRootElementPadding(internalProps.element, this.padding);
71869
72116
  }
71870
72117
  this.columnWidthComputeMode = options.columnWidthComputeMode ?? 'normal';
@@ -72045,9 +72292,14 @@
72045
72292
  const currentHeight = rect.height;
72046
72293
  const originHeight = this.canvas.offsetHeight || currentHeight;
72047
72294
  const heightRatio = currentHeight / originHeight;
72048
- const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0);
72049
- const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0);
72050
- return { x, y, inTable };
72295
+ const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0) - (this.options.viewBox?.x1 ?? 0);
72296
+ const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0) - (this.options.viewBox?.y1 ?? 0);
72297
+ const point = { x, y, inTable };
72298
+ if (this.internalProps.modifiedViewBoxTransform && this.scenegraph.stage.window.getViewBoxTransform()) {
72299
+ const transform = this.scenegraph.stage.window.getViewBoxTransform();
72300
+ transform.transformPoint(point, point);
72301
+ }
72302
+ return point;
72051
72303
  }
72052
72304
  getTheme() {
72053
72305
  return this.internalProps.theme;
@@ -76369,7 +76621,7 @@
76369
76621
  notFillHeight = this.getAllRowsHeight() <= this.tableNoFrameHeight;
76370
76622
  }
76371
76623
  if (this.widthMode === 'adaptive' || notFillWidth || this.heightMode === 'adaptive' || notFillHeight) {
76372
- this.scenegraph.updateChartSizeForResizeColWidth(0);
76624
+ this.scenegraph.updateChartSizeForResizeColWidth(-1);
76373
76625
  }
76374
76626
  }
76375
76627
  }
@@ -77686,7 +77938,9 @@
77686
77938
  const axisStylrAttrs = getAxisAttributes(this.option);
77687
77939
  const attrs = this.getUpdateAttribute();
77688
77940
  attrs.verticalFactor = this.orient === 'top' || this.orient === 'right' ? -1 : 1;
77689
- this.component = new LineAxis(merge({}, axisStylrAttrs, attrs));
77941
+ this.component = new LineAxis(merge({
77942
+ disableTriggerEvent: this.table.options.disableInteraction
77943
+ }, axisStylrAttrs, attrs));
77690
77944
  this.component.setAttributes(this.setLayoutStartPosition({ x: 0, y: 0 }));
77691
77945
  this.component.originAxis = this;
77692
77946
  }
@@ -78267,7 +78521,8 @@
78267
78521
  height: this.table.tableNoFrameHeight
78268
78522
  });
78269
78523
  const legend = new DiscreteLegend(merge({}, attrs, {
78270
- defaultSelected: this.selectedData
78524
+ defaultSelected: this.selectedData,
78525
+ disableTriggerEvent: this.table.options.disableInteraction
78271
78526
  }));
78272
78527
  legend.name = 'legend';
78273
78528
  this.legendComponent = legend;
@@ -79967,7 +80222,8 @@
79967
80222
  data: table.getCellValue(col, row),
79968
80223
  cellPadding: padding,
79969
80224
  dpr: table.internalProps.pixelRatio,
79970
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
80225
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : [],
80226
+ tableChartOption: table.options.chartOption
79971
80227
  });
79972
80228
  cellGroup.appendChild(chartGroup);
79973
80229
  table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
@@ -87017,7 +87273,7 @@
87017
87273
  notFillHeight = this.getAllRowsHeight() <= this.tableNoFrameHeight;
87018
87274
  }
87019
87275
  if (this.widthMode === 'adaptive' || notFillWidth || this.heightMode === 'adaptive' || notFillHeight) {
87020
- this.scenegraph.updateChartSizeForResizeColWidth(0);
87276
+ this.scenegraph.updateChartSizeForResizeColWidth(-1);
87021
87277
  }
87022
87278
  }
87023
87279
  }
@@ -88316,6 +88572,14 @@
88316
88572
  updateChartData(this.scenegraph);
88317
88573
  this.render();
88318
88574
  }
88575
+ clearChartCacheImage(col, row) {
88576
+ if (isNumber$2(col) && isNumber$2(row)) {
88577
+ clearCellChartCacheImage(col, row, this.scenegraph);
88578
+ }
88579
+ else {
88580
+ clearChartCacheImage(this.scenegraph);
88581
+ }
88582
+ }
88319
88583
  getLegendSelected() {
88320
88584
  const selected = [];
88321
88585
  this.internalProps.legends?.forEach(legend => {
@@ -89109,7 +89373,7 @@
89109
89373
  }
89110
89374
 
89111
89375
  registerForVrender();
89112
- const version = "1.5.5";
89376
+ const version = "1.5.6";
89113
89377
  function getIcons() {
89114
89378
  return get$2();
89115
89379
  }