@visactor/vtable 1.5.4 → 1.5.5-beta.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.
Files changed (97) hide show
  1. package/cjs/PivotChart.d.ts +1 -0
  2. package/cjs/PivotChart.js +4 -0
  3. package/cjs/PivotChart.js.map +1 -1
  4. package/cjs/components/axis/axis.js +3 -2
  5. package/cjs/components/axis/axis.js.map +1 -1
  6. package/cjs/components/legend/discrete-legend/discrete-legend.js +2 -1
  7. package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  8. package/cjs/core/BaseTable.d.ts +3 -0
  9. package/cjs/core/BaseTable.js +44 -24
  10. package/cjs/core/BaseTable.js.map +1 -1
  11. package/cjs/core/FouseInput.d.ts +1 -0
  12. package/cjs/core/FouseInput.js +5 -2
  13. package/cjs/core/FouseInput.js.map +1 -1
  14. package/cjs/core/tableHelper.d.ts +2 -2
  15. package/cjs/core/tableHelper.js.map +1 -1
  16. package/cjs/core/utils/get-cell-position.d.ts +5 -25
  17. package/cjs/core/utils/get-cell-position.js.map +1 -1
  18. package/cjs/event/event.js +2 -1
  19. package/cjs/event/event.js.map +1 -1
  20. package/cjs/event/listener/container-dom.js +1 -1
  21. package/cjs/event/listener/container-dom.js.map +1 -1
  22. package/cjs/event/util.js +2 -2
  23. package/cjs/event/util.js.map +1 -1
  24. package/cjs/index.d.ts +1 -1
  25. package/cjs/index.js +1 -1
  26. package/cjs/index.js.map +1 -1
  27. package/cjs/scenegraph/debug-tool/debug-tool.js +4 -1
  28. package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
  29. package/cjs/scenegraph/graphic/chart.d.ts +1 -0
  30. package/cjs/scenegraph/graphic/chart.js +34 -20
  31. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  32. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +56 -16
  33. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  34. package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  35. package/cjs/scenegraph/graphic/contributions/chart-render.js +40 -24
  36. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  37. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  38. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  39. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -0
  40. package/cjs/scenegraph/refresh-node/update-chart.js +9 -3
  41. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  42. package/cjs/scenegraph/scenegraph.js +10 -4
  43. package/cjs/scenegraph/scenegraph.js.map +1 -1
  44. package/cjs/tools/helper.js.map +1 -1
  45. package/cjs/ts-types/base-table.d.ts +12 -1
  46. package/cjs/ts-types/base-table.js.map +1 -1
  47. package/cjs/vrender.js.map +1 -1
  48. package/dist/vtable.js +289 -114
  49. package/dist/vtable.min.js +2 -2
  50. package/es/PivotChart.d.ts +1 -0
  51. package/es/PivotChart.js +5 -2
  52. package/es/PivotChart.js.map +1 -1
  53. package/es/components/axis/axis.js +3 -1
  54. package/es/components/axis/axis.js.map +1 -1
  55. package/es/components/legend/discrete-legend/discrete-legend.js +2 -1
  56. package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  57. package/es/core/BaseTable.d.ts +3 -0
  58. package/es/core/BaseTable.js +43 -23
  59. package/es/core/BaseTable.js.map +1 -1
  60. package/es/core/FouseInput.d.ts +1 -0
  61. package/es/core/FouseInput.js +5 -2
  62. package/es/core/FouseInput.js.map +1 -1
  63. package/es/core/tableHelper.d.ts +2 -2
  64. package/es/core/tableHelper.js.map +1 -1
  65. package/es/core/utils/get-cell-position.d.ts +5 -25
  66. package/es/core/utils/get-cell-position.js.map +1 -1
  67. package/es/event/event.js +2 -1
  68. package/es/event/event.js.map +1 -1
  69. package/es/event/listener/container-dom.js +1 -1
  70. package/es/event/listener/container-dom.js.map +1 -1
  71. package/es/event/util.js +2 -2
  72. package/es/event/util.js.map +1 -1
  73. package/es/index.d.ts +1 -1
  74. package/es/index.js +1 -1
  75. package/es/index.js.map +1 -1
  76. package/es/scenegraph/debug-tool/debug-tool.js +4 -1
  77. package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
  78. package/es/scenegraph/graphic/chart.d.ts +1 -0
  79. package/es/scenegraph/graphic/chart.js +33 -21
  80. package/es/scenegraph/graphic/chart.js.map +1 -1
  81. package/es/scenegraph/graphic/contributions/chart-render-helper.js +57 -15
  82. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  83. package/es/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  84. package/es/scenegraph/graphic/contributions/chart-render.js +41 -25
  85. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  86. package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  87. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  88. package/es/scenegraph/refresh-node/update-chart.d.ts +1 -0
  89. package/es/scenegraph/refresh-node/update-chart.js +6 -0
  90. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  91. package/es/scenegraph/scenegraph.js +10 -4
  92. package/es/scenegraph/scenegraph.js.map +1 -1
  93. package/es/tools/helper.js.map +1 -1
  94. package/es/ts-types/base-table.d.ts +12 -1
  95. package/es/ts-types/base-table.js.map +1 -1
  96. package/es/vrender.js.map +1 -1
  97. package/package.json +5 -5
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 (!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);
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
+ }
54966
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([
@@ -60044,6 +60136,15 @@
60044
60136
  });
60045
60137
  }
60046
60138
  }
60139
+ function clearCellChartCacheImage(col, row, scenegraph) {
60140
+ const cellGroup = scenegraph.getCell(col, row);
60141
+ cellGroup.children.forEach((node) => {
60142
+ if (node.type === 'chart') {
60143
+ node.cacheCanvas = null;
60144
+ node.addUpdateBoundTag();
60145
+ }
60146
+ });
60147
+ }
60047
60148
  function updateChartData(scenegraph) {
60048
60149
  const table = scenegraph.table;
60049
60150
  for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
@@ -60905,7 +61006,12 @@
60905
61006
  setPoptipTheme(this.table.theme.textPopTipStyle);
60906
61007
  let width;
60907
61008
  let height;
60908
- if (Env.mode === 'node') {
61009
+ if (table.options.canvas && table.options.viewBox) {
61010
+ vglobal.setEnv('browser');
61011
+ width = table.options.viewBox.x2 - table.options.viewBox.x1;
61012
+ height = table.options.viewBox.y2 - table.options.viewBox.y1;
61013
+ }
61014
+ else if (Env.mode === 'node') {
60909
61015
  vglobal.setEnv('node', table.options.modeParams);
60910
61016
  width = table.canvasWidth;
60911
61017
  height = table.canvasHeight;
@@ -60923,9 +61029,15 @@
60923
61029
  background: table.theme.underlayBackgroundColor,
60924
61030
  dpr: table.internalProps.pixelRatio,
60925
61031
  enableLayout: true,
60926
- afterRender: () => {
61032
+ beforeRender: (stage) => {
61033
+ this.table.options.beforeRender && this.table.options.beforeRender(stage);
61034
+ },
61035
+ afterRender: (stage) => {
61036
+ this.table.options.afterRender && this.table.options.afterRender(stage);
60927
61037
  this.table.fireListeners('after_render', null);
60928
61038
  },
61039
+ canvasControled: !table.options.canvas,
61040
+ viewBox: table.options.viewBox,
60929
61041
  ...table.options.renderOption
60930
61042
  });
60931
61043
  this.stage.defaultLayer.setTheme({
@@ -66243,20 +66355,22 @@
66243
66355
  e.preventDefault();
66244
66356
  }
66245
66357
  });
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
- });
66358
+ if (!table.options.canvas) {
66359
+ handler.on(table.getContainer(), 'resize', e => {
66360
+ if (e.width === 0 && e.height === 0) {
66361
+ return;
66362
+ }
66363
+ if (table.autoFillWidth || table.autoFillHeight) {
66364
+ table.editorManager?.completeEdit();
66365
+ }
66366
+ if (!isValid$1(table.options.pixelRatio)) {
66367
+ table.setPixelRatio(getPixelRatio());
66368
+ }
66369
+ if (!e.windowSizeNotChange) {
66370
+ table.resize();
66371
+ }
66372
+ });
66373
+ }
66260
66374
  const regex = /<tr[^>]*>([\s\S]*?)<\/tr>/g;
66261
66375
  const cellRegex = /<td[^>]*>([\s\S]*?)<\/td>/g;
66262
66376
  function pasteHtmlToTable(item) {
@@ -66818,7 +66932,7 @@
66818
66932
  this.table = table;
66819
66933
  this.handleTextStickBindId = [];
66820
66934
  this.inertiaScroll = new InertiaScroll(table.stateManager);
66821
- if (Env.mode === 'node') {
66935
+ if (Env.mode === 'node' || table.options.disableInteraction) {
66822
66936
  return;
66823
66937
  }
66824
66938
  this.bindOuterEvent();
@@ -68419,6 +68533,7 @@
68419
68533
  }
68420
68534
 
68421
68535
  class FocusInput extends EventTarget {
68536
+ _container;
68422
68537
  _table;
68423
68538
  _input;
68424
68539
  constructor(table, parentElement) {
@@ -68438,6 +68553,7 @@
68438
68553
  input.dataset.vtable = 'vtable';
68439
68554
  input.readOnly = true;
68440
68555
  parentElement.appendChild(div);
68556
+ this._container = div;
68441
68557
  }
68442
68558
  focus() {
68443
68559
  this._input.focus({ preventScroll: true });
@@ -68457,6 +68573,7 @@
68457
68573
  return this._input;
68458
68574
  }
68459
68575
  release() {
68576
+ this._container.parentElement?.removeChild(this._container);
68460
68577
  }
68461
68578
  }
68462
68579
 
@@ -70606,7 +70723,7 @@
70606
70723
  return TABLE_EVENT_TYPE;
70607
70724
  }
70608
70725
  options;
70609
- version = "1.5.4";
70726
+ version = "1.5.5-beta.0";
70610
70727
  pagination;
70611
70728
  id = `VTable${Date.now()}`;
70612
70729
  headerStyleCache;
@@ -70621,7 +70738,7 @@
70621
70738
  _hasAutoImageColumn;
70622
70739
  constructor(container, options = {}) {
70623
70740
  super();
70624
- if (!container && options.mode !== 'node') {
70741
+ if (!container && options.mode !== 'node' && !options.canvas) {
70625
70742
  throw new Error("vtable's container is undefined");
70626
70743
  }
70627
70744
  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 +70776,14 @@
70659
70776
  if (typeof allowFrozenColCount === 'number' && allowFrozenColCount <= 0) {
70660
70777
  this.showFrozenIcon = false;
70661
70778
  }
70662
- if (Env.mode !== 'node') {
70779
+ if (this.options.canvas) {
70780
+ internalProps.element = this.options.canvas.parentElement;
70781
+ internalProps.element.style.position = 'relative';
70782
+ internalProps.focusControl = new FocusInput(this, internalProps.element);
70783
+ internalProps.canvas = this.options.canvas;
70784
+ internalProps.context = internalProps.canvas.getContext('2d');
70785
+ }
70786
+ else if (Env.mode !== 'node') {
70663
70787
  internalProps.element = createRootElement(this.padding);
70664
70788
  internalProps.focusControl = new FocusInput(this, internalProps.element);
70665
70789
  internalProps.canvas = document.createElement('canvas');
@@ -71067,7 +71191,21 @@
71067
71191
  const { padding } = this;
71068
71192
  let widthP = 0;
71069
71193
  let heightP = 0;
71070
- if (Env.mode === 'browser') {
71194
+ this.tableX = 0;
71195
+ this.tableY = 0;
71196
+ if (this.options.canvas && this.options.viewBox) {
71197
+ widthP = this.options.viewBox.x2 - this.options.viewBox.x1;
71198
+ heightP = this.options.viewBox.y2 - this.options.viewBox.y1;
71199
+ if (this?.scenegraph?.stage) {
71200
+ if (this.options.viewBox) {
71201
+ this.scenegraph.stage.setViewBox(this.options.viewBox, false);
71202
+ }
71203
+ else {
71204
+ this.scenegraph.stage.resize(widthP, heightP);
71205
+ }
71206
+ }
71207
+ }
71208
+ else if (Env.mode === 'browser') {
71071
71209
  const element = this.getElement();
71072
71210
  let widthWithoutPadding = 0;
71073
71211
  let heightWithoutPadding = 0;
@@ -71134,6 +71272,23 @@
71134
71272
  }
71135
71273
  }
71136
71274
  }
71275
+ updateViewBox(newViewBox) {
71276
+ const oldWidth = this.options?.viewBox.x2 ?? 0 - this.options?.viewBox.x1 ?? 0;
71277
+ const oldHeight = this.options?.viewBox.y2 ?? 0 - this.options?.viewBox.y1 ?? 0;
71278
+ const newWidth = newViewBox.x2 - newViewBox.x1;
71279
+ const newHeight = newViewBox.y2 - newViewBox.y1;
71280
+ this.options.viewBox = newViewBox;
71281
+ if (oldWidth !== newWidth || oldHeight !== newHeight) {
71282
+ this.resize();
71283
+ }
71284
+ else {
71285
+ this.scenegraph.stage.setViewBox(this.options.viewBox, true);
71286
+ }
71287
+ }
71288
+ setViewBoxTransform(a, b, c, d, e, f) {
71289
+ this.internalProps.modifiedViewBoxTransform = true;
71290
+ this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
71291
+ }
71137
71292
  get rowHierarchyType() {
71138
71293
  return 'grid';
71139
71294
  }
@@ -71660,6 +71815,8 @@
71660
71815
  const visibleRect = this.getVisibleRect();
71661
71816
  rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0));
71662
71817
  rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0));
71818
+ rect.offsetLeft(this.options.viewBox?.x1 ?? 0);
71819
+ rect.offsetTop(this.options.viewBox?.y1 ?? 0);
71663
71820
  return rect;
71664
71821
  }
71665
71822
  getVisibleRect() {
@@ -71819,8 +71976,9 @@
71819
71976
  }
71820
71977
  this.scenegraph.stage.release();
71821
71978
  this.scenegraph.proxy.release();
71979
+ internalProps.focusControl.release();
71822
71980
  const { parentElement } = internalProps.element;
71823
- if (parentElement) {
71981
+ if (parentElement && !this.options.canvas) {
71824
71982
  parentElement.removeChild(internalProps.element);
71825
71983
  }
71826
71984
  this.editorManager?.editingEditor?.onEnd?.();
@@ -71864,7 +72022,7 @@
71864
72022
  this.autoFillHeight = autoFillHeight ?? false;
71865
72023
  this.customRender = customRender;
71866
72024
  const internalProps = this.internalProps;
71867
- if (Env.mode !== 'node') {
72025
+ if (Env.mode !== 'node' && !options.canvas) {
71868
72026
  updateRootElementPadding(internalProps.element, this.padding);
71869
72027
  }
71870
72028
  this.columnWidthComputeMode = options.columnWidthComputeMode ?? 'normal';
@@ -72045,9 +72203,14 @@
72045
72203
  const currentHeight = rect.height;
72046
72204
  const originHeight = this.canvas.offsetHeight || currentHeight;
72047
72205
  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 };
72206
+ const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0) - (this.options.viewBox?.x1 ?? 0);
72207
+ const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0) - (this.options.viewBox?.y1 ?? 0);
72208
+ const point = { x, y, inTable };
72209
+ if (this.internalProps.modifiedViewBoxTransform && this.scenegraph.stage.window.getViewBoxTransform()) {
72210
+ const transform = this.scenegraph.stage.window.getViewBoxTransform();
72211
+ transform.transformPoint(point, point);
72212
+ }
72213
+ return point;
72051
72214
  }
72052
72215
  getTheme() {
72053
72216
  return this.internalProps.theme;
@@ -77686,7 +77849,9 @@
77686
77849
  const axisStylrAttrs = getAxisAttributes(this.option);
77687
77850
  const attrs = this.getUpdateAttribute();
77688
77851
  attrs.verticalFactor = this.orient === 'top' || this.orient === 'right' ? -1 : 1;
77689
- this.component = new LineAxis(merge({}, axisStylrAttrs, attrs));
77852
+ this.component = new LineAxis(merge({
77853
+ disableTriggerEvent: this.table.options.disableInteraction
77854
+ }, axisStylrAttrs, attrs));
77690
77855
  this.component.setAttributes(this.setLayoutStartPosition({ x: 0, y: 0 }));
77691
77856
  this.component.originAxis = this;
77692
77857
  }
@@ -78267,7 +78432,8 @@
78267
78432
  height: this.table.tableNoFrameHeight
78268
78433
  });
78269
78434
  const legend = new DiscreteLegend(merge({}, attrs, {
78270
- defaultSelected: this.selectedData
78435
+ defaultSelected: this.selectedData,
78436
+ disableTriggerEvent: this.table.options.disableInteraction
78271
78437
  }));
78272
78438
  legend.name = 'legend';
78273
78439
  this.legendComponent = legend;
@@ -79967,7 +80133,8 @@
79967
80133
  data: table.getCellValue(col, row),
79968
80134
  cellPadding: padding,
79969
80135
  dpr: table.internalProps.pixelRatio,
79970
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
80136
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : [],
80137
+ tableChartOption: table.options.chartOption
79971
80138
  });
79972
80139
  cellGroup.appendChild(chartGroup);
79973
80140
  table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
@@ -88316,6 +88483,14 @@
88316
88483
  updateChartData(this.scenegraph);
88317
88484
  this.render();
88318
88485
  }
88486
+ clearChartCacheImage(col, row) {
88487
+ if (isNumber$2(col) && isNumber$2(row)) {
88488
+ clearCellChartCacheImage(col, row, this.scenegraph);
88489
+ }
88490
+ else {
88491
+ clearChartCacheImage(this.scenegraph);
88492
+ }
88493
+ }
88319
88494
  getLegendSelected() {
88320
88495
  const selected = [];
88321
88496
  this.internalProps.legends?.forEach(legend => {
@@ -89109,7 +89284,7 @@
89109
89284
  }
89110
89285
 
89111
89286
  registerForVrender();
89112
- const version = "1.5.4";
89287
+ const version = "1.5.5-beta.0";
89113
89288
  function getIcons() {
89114
89289
  return get$2();
89115
89290
  }