@visactor/vtable 1.5.4-alpha.5 → 1.5.4-beta.1

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 (111) hide show
  1. package/cjs/ListTable.js +2 -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/components/axis/axis.js +3 -2
  7. package/cjs/components/axis/axis.js.map +1 -1
  8. package/cjs/components/legend/discrete-legend/discrete-legend.js +2 -1
  9. package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  10. package/cjs/components/react/react-custom-layout.d.ts +1 -3
  11. package/cjs/components/react/react-custom-layout.js +3 -7
  12. package/cjs/components/react/react-custom-layout.js.map +1 -1
  13. package/cjs/core/BaseTable.d.ts +4 -1
  14. package/cjs/core/BaseTable.js +46 -26
  15. package/cjs/core/BaseTable.js.map +1 -1
  16. package/cjs/core/FouseInput.d.ts +1 -0
  17. package/cjs/core/FouseInput.js +5 -2
  18. package/cjs/core/FouseInput.js.map +1 -1
  19. package/cjs/core/tableHelper.d.ts +2 -2
  20. package/cjs/core/tableHelper.js.map +1 -1
  21. package/cjs/core/utils/get-cell-position.d.ts +5 -25
  22. package/cjs/core/utils/get-cell-position.js.map +1 -1
  23. package/cjs/event/event.js +4 -3
  24. package/cjs/event/event.js.map +1 -1
  25. package/cjs/event/listener/container-dom.js +8 -8
  26. package/cjs/event/listener/container-dom.js.map +1 -1
  27. package/cjs/event/listener/table-group.js.map +1 -1
  28. package/cjs/event/util.js +2 -2
  29. package/cjs/event/util.js.map +1 -1
  30. package/cjs/index.d.ts +1 -1
  31. package/cjs/index.js +1 -1
  32. package/cjs/index.js.map +1 -1
  33. package/cjs/scenegraph/debug-tool/debug-tool.js +4 -1
  34. package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
  35. package/cjs/scenegraph/graphic/chart.d.ts +1 -0
  36. package/cjs/scenegraph/graphic/chart.js +34 -20
  37. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  38. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
  39. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  40. package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  41. package/cjs/scenegraph/graphic/contributions/chart-render.js +40 -24
  42. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  43. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  44. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  45. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -0
  46. package/cjs/scenegraph/refresh-node/update-chart.js +9 -2
  47. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  48. package/cjs/scenegraph/scenegraph.js +14 -10
  49. package/cjs/scenegraph/scenegraph.js.map +1 -1
  50. package/cjs/state/state.js +1 -1
  51. package/cjs/tools/helper.js.map +1 -1
  52. package/cjs/ts-types/base-table.d.ts +13 -2
  53. package/cjs/ts-types/base-table.js.map +1 -1
  54. package/cjs/vrender.js.map +1 -1
  55. package/dist/vtable.js +247 -126
  56. package/dist/vtable.min.js +2 -2
  57. package/es/ListTable.js +2 -1
  58. package/es/ListTable.js.map +1 -1
  59. package/es/PivotChart.d.ts +1 -0
  60. package/es/PivotChart.js +5 -2
  61. package/es/PivotChart.js.map +1 -1
  62. package/es/components/axis/axis.js +3 -1
  63. package/es/components/axis/axis.js.map +1 -1
  64. package/es/components/legend/discrete-legend/discrete-legend.js +2 -1
  65. package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  66. package/es/components/react/react-custom-layout.d.ts +1 -3
  67. package/es/components/react/react-custom-layout.js +3 -7
  68. package/es/components/react/react-custom-layout.js.map +1 -1
  69. package/es/core/BaseTable.d.ts +4 -1
  70. package/es/core/BaseTable.js +45 -25
  71. package/es/core/BaseTable.js.map +1 -1
  72. package/es/core/FouseInput.d.ts +1 -0
  73. package/es/core/FouseInput.js +5 -2
  74. package/es/core/FouseInput.js.map +1 -1
  75. package/es/core/tableHelper.d.ts +2 -2
  76. package/es/core/tableHelper.js.map +1 -1
  77. package/es/core/utils/get-cell-position.d.ts +5 -25
  78. package/es/core/utils/get-cell-position.js.map +1 -1
  79. package/es/event/event.js +4 -3
  80. package/es/event/event.js.map +1 -1
  81. package/es/event/listener/container-dom.js +8 -8
  82. package/es/event/listener/container-dom.js.map +1 -1
  83. package/es/event/listener/table-group.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 +20 -8
  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 +6 -0
  103. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  104. package/es/scenegraph/scenegraph.js +14 -10
  105. package/es/scenegraph/scenegraph.js.map +1 -1
  106. package/es/state/state.js +1 -1
  107. package/es/tools/helper.js.map +1 -1
  108. package/es/ts-types/base-table.d.ts +13 -2
  109. package/es/ts-types/base-table.js.map +1 -1
  110. package/es/vrender.js.map +1 -1
  111. 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 {
@@ -48907,14 +48909,12 @@
48907
48909
  };
48908
48910
  }
48909
48911
  class ReactCustomLayout {
48910
- removeAllContainer;
48911
48912
  table;
48912
48913
  customLayoutFuncCache;
48913
48914
  reactRemoveGraphicCache;
48914
48915
  headerCustomLayoutFuncCache;
48915
48916
  headerReactRemoveGraphicCache;
48916
- constructor(removeAllContainer, table) {
48917
- this.removeAllContainer = removeAllContainer;
48917
+ constructor(table) {
48918
48918
  this.table = table;
48919
48919
  this.customLayoutFuncCache = new Map();
48920
48920
  this.reactRemoveGraphicCache = new Map();
@@ -48992,9 +48992,6 @@
48992
48992
  removeFun(col, row);
48993
48993
  }
48994
48994
  }
48995
- clearCache() {
48996
- this.removeAllContainer();
48997
- }
48998
48995
  }
48999
48996
  function getUpdateCustomCellRangeInListTable(componentId, table, isHeaderCustomLayout) {
49000
48997
  const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;
@@ -49110,8 +49107,8 @@
49110
49107
  function getCellEventArgsSet(e) {
49111
49108
  const tableEvent = {
49112
49109
  abstractPos: {
49113
- x: e.x,
49114
- y: e.y
49110
+ x: e.viewport.x,
49111
+ y: e.viewport.y
49115
49112
  }
49116
49113
  };
49117
49114
  const targetCell = getTargetCell(e.target);
@@ -54749,7 +54746,7 @@
54749
54746
  this.numberType = CHART_NUMBER_TYPE;
54750
54747
  this.isShareChartSpec = isShareChartSpec;
54751
54748
  if (!params.chartInstance) {
54752
- const chartInstance = new params.ClassType(params.spec, {
54749
+ const chartInstance = (this.chartInstance = new params.ClassType(params.spec, merge({}, this.attribute.tableChartOption, {
54753
54750
  renderCanvas: params.canvas,
54754
54751
  mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
54755
54752
  modeParams: this.attribute.modeParams,
@@ -54759,8 +54756,9 @@
54759
54756
  interactive: false,
54760
54757
  animation: false,
54761
54758
  autoFit: false
54762
- });
54759
+ })));
54763
54760
  chartInstance.renderSync();
54761
+ chartInstance.getStage().enableDirtyBounds();
54764
54762
  params.chartInstance = this.chartInstance = chartInstance;
54765
54763
  }
54766
54764
  else {
@@ -54778,34 +54776,53 @@
54778
54776
  y1: y1 - table.scrollTop,
54779
54777
  y2: y2 - table.scrollTop
54780
54778
  });
54781
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
54779
+ this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, merge({}, this.attribute.tableChartOption, {
54782
54780
  renderCanvas: this.attribute.canvas,
54783
54781
  mode: 'desktop-browser',
54784
54782
  canvasControled: false,
54785
54783
  viewBox: {
54786
- x1: x1 - table.scrollLeft,
54787
- x2: x2 - table.scrollLeft,
54788
- y1: y1 - table.scrollTop,
54789
- y2: y2 - table.scrollTop
54784
+ x1: 0,
54785
+ x2: x2 - x1,
54786
+ y1: 0,
54787
+ y2: y2 - y1
54790
54788
  },
54791
54789
  dpr: table.internalProps.pixelRatio,
54792
54790
  animation: false,
54793
54791
  interactive: true,
54794
54792
  autoFit: false,
54795
- beforeRender: (stage) => {
54796
- const ctx = stage.window.getContext();
54793
+ beforeRender: (chartStage) => {
54794
+ const stage = this.stage;
54795
+ const ctx = chartStage.window.getContext();
54796
+ const stageMatrix = stage.window.getViewBoxTransform();
54797
+ const viewBox = stage.window.getViewBox();
54797
54798
  ctx.inuse = true;
54798
54799
  ctx.clearMatrix();
54800
+ ctx.setTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f, true);
54801
+ ctx.translate(viewBox.x1, viewBox.y1);
54799
54802
  ctx.setTransformForCurrent(true);
54800
54803
  ctx.beginPath();
54801
54804
  ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
54802
54805
  ctx.clip();
54806
+ ctx.clearMatrix();
54807
+ if (!chartStage.needRender) {
54808
+ chartStage.pauseRender();
54809
+ table.scenegraph.stage.dirtyBounds.union(this.globalAABBBounds);
54810
+ table.scenegraph.updateNextFrame();
54811
+ }
54803
54812
  },
54804
54813
  afterRender(stage) {
54805
54814
  const ctx = stage.window.getContext();
54806
54815
  ctx.inuse = false;
54816
+ stage.needRender = false;
54817
+ chartStage.resumeRender();
54807
54818
  }
54808
- });
54819
+ }));
54820
+ const chartStage = this.activeChartInstance.getStage();
54821
+ const matrix = this.globalTransMatrix.clone();
54822
+ const stageMatrix = this.stage.window.getViewBoxTransform();
54823
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
54824
+ chartStage.window.setViewBoxTransform &&
54825
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
54809
54826
  this.activeChartInstance.renderSync();
54810
54827
  table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
54811
54828
  this.activeChartInstance.on('click', (params) => {
@@ -54841,11 +54858,12 @@
54841
54858
  const cellGroup = this.parent;
54842
54859
  const padding = this.attribute.cellPadding;
54843
54860
  const table = this.stage.table;
54861
+ const { x1, y1, x2, y2 } = cellGroup.globalAABBBounds;
54844
54862
  return {
54845
- x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
54846
- x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
54847
- y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
54848
- y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
54863
+ x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
54864
+ x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
54865
+ y1: Math.ceil(y1 + padding[0] + table.scrollTop + (table.options.viewBox?.y1 ?? 0)),
54866
+ y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (table.options.viewBox?.y1 ?? 0))
54849
54867
  };
54850
54868
  }
54851
54869
  }
@@ -54876,6 +54894,10 @@
54876
54894
  bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
54877
54895
  bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
54878
54896
  }
54897
+ bodyBound.x1 = bodyBound.x1 + (table.options.viewBox?.x1 ?? 0);
54898
+ bodyBound.x2 = bodyBound.x2 + (table.options.viewBox?.x1 ?? 0);
54899
+ bodyBound.y1 = bodyBound.y1 + (table.options.viewBox?.y1 ?? 0);
54900
+ bodyBound.y2 = bodyBound.y2 + (table.options.viewBox?.y1 ?? 0);
54879
54901
  return bodyBound;
54880
54902
  }
54881
54903
 
@@ -54901,48 +54923,65 @@
54901
54923
  if (viewBox.y2 <= viewBox.y1) {
54902
54924
  viewBox.y2 = viewBox.y1 + 1;
54903
54925
  }
54904
- axes?.forEach((axis, index) => {
54905
- if (axis.type === 'band') {
54906
- chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
54907
- }
54908
- else {
54909
- chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
54910
- }
54911
- });
54912
54926
  chartInstance.updateViewBox({
54913
- x1: viewBox.x1 - chart.getRootNode().table.scrollLeft,
54914
- x2: viewBox.x2 - chart.getRootNode().table.scrollLeft,
54915
- y1: viewBox.y1 - chart.getRootNode().table.scrollTop,
54916
- y2: viewBox.y2 - chart.getRootNode().table.scrollTop
54927
+ x1: 0,
54928
+ x2: viewBox.x2 - viewBox.x1,
54929
+ y1: 0,
54930
+ y2: viewBox.y2 - viewBox.y1
54917
54931
  }, false, false);
54918
- const table = chart.getRootNode().table;
54919
- table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
54920
- if (typeof dataId === 'string') {
54921
- chartInstance.updateDataSync(dataId, data ?? []);
54922
- }
54923
- else {
54924
- const dataBatch = [];
54925
- for (const dataIdStr in dataId) {
54926
- const dataIdAndField = dataId[dataIdStr];
54927
- const series = spec.series.find((item) => item?.data?.id === dataIdStr);
54928
- dataBatch.push({
54929
- id: dataIdStr,
54930
- values: dataIdAndField
54931
- ? data?.filter((item) => {
54932
- return item.hasOwnProperty(dataIdAndField);
54933
- }) ?? []
54934
- : data ?? [],
54935
- fields: series?.data?.fields
54936
- });
54937
- if (!chartInstance.updateFullDataSync) {
54938
- chartInstance.updateDataSync(dataIdStr, dataIdAndField
54939
- ? data?.filter((item) => {
54940
- return item.hasOwnProperty(dataIdAndField);
54941
- }) ?? []
54942
- : data ?? []);
54932
+ const chartStage = chartInstance.getStage();
54933
+ const matrix = chart.globalTransMatrix.clone();
54934
+ const stageMatrix = chart.stage.window.getViewBoxTransform();
54935
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
54936
+ chartStage.window.setViewBoxTransform &&
54937
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
54938
+ const { table } = chart.getRootNode();
54939
+ let updateSpec = false;
54940
+ if (table.options.specFormat) {
54941
+ const formatResult = table.options.specFormat(chart.attribute.spec);
54942
+ if (formatResult.needFormatSpec && formatResult.spec) {
54943
+ const spec = formatResult.spec;
54944
+ chartInstance.updateSpecSync(spec);
54945
+ updateSpec = true;
54946
+ }
54947
+ }
54948
+ if (!updateSpec) {
54949
+ axes?.forEach((axis, index) => {
54950
+ if (axis.type === 'band') {
54951
+ chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
54943
54952
  }
54953
+ else {
54954
+ chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
54955
+ }
54956
+ });
54957
+ table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
54958
+ if (typeof dataId === 'string') {
54959
+ chartInstance.updateDataSync(dataId, data ?? []);
54960
+ }
54961
+ else {
54962
+ const dataBatch = [];
54963
+ for (const dataIdStr in dataId) {
54964
+ const dataIdAndField = dataId[dataIdStr];
54965
+ const series = spec.series.find((item) => item?.data?.id === dataIdStr);
54966
+ dataBatch.push({
54967
+ id: dataIdStr,
54968
+ values: dataIdAndField
54969
+ ? data?.filter((item) => {
54970
+ return item.hasOwnProperty(dataIdAndField);
54971
+ }) ?? []
54972
+ : data ?? [],
54973
+ fields: series?.data?.fields
54974
+ });
54975
+ if (!chartInstance.updateFullDataSync) {
54976
+ chartInstance.updateDataSync(dataIdStr, dataIdAndField
54977
+ ? data?.filter((item) => {
54978
+ return item.hasOwnProperty(dataIdAndField);
54979
+ }) ?? []
54980
+ : data ?? []);
54981
+ }
54982
+ }
54983
+ chartInstance.updateFullDataSync?.(dataBatch);
54944
54984
  }
54945
- chartInstance.updateFullDataSync?.(dataBatch);
54946
54985
  }
54947
54986
  const sg = chartInstance.getStage();
54948
54987
  cacheStageCanvas(sg, chart);
@@ -55004,7 +55043,7 @@
55004
55043
  }
55005
55044
 
55006
55045
  const ChartRender = Symbol.for('ChartRender');
55007
- let DefaultCanvasChartRender = class DefaultCanvasChartRender {
55046
+ let DefaultCanvasChartRender = class DefaultCanvasChartRender extends BaseRender {
55008
55047
  type;
55009
55048
  numberType = CHART_NUMBER_TYPE;
55010
55049
  drawShape(chart, context, x, y, drawContext, params, fillCb, strokeCb) {
@@ -55012,6 +55051,7 @@
55012
55051
  const { dataId, data, spec } = chart.attribute;
55013
55052
  chart.getViewBox();
55014
55053
  const { width = groupAttribute.width, height = groupAttribute.height } = chart.attribute;
55054
+ const { table } = chart.getRootNode();
55015
55055
  const { active, cacheCanvas, activeChartInstance } = chart;
55016
55056
  if (!active && cacheCanvas) {
55017
55057
  if (isArray$1(cacheCanvas)) {
@@ -55025,6 +55065,27 @@
55025
55065
  }
55026
55066
  }
55027
55067
  else if (activeChartInstance) {
55068
+ if (table.options.specFormat) {
55069
+ const formatResult = table.options.specFormat(chart.attribute.spec);
55070
+ if (formatResult.needFormatSpec && formatResult.spec) {
55071
+ const spec = formatResult.spec;
55072
+ activeChartInstance.updateSpecSync(spec);
55073
+ return;
55074
+ }
55075
+ }
55076
+ const viewBox = chart.getViewBox();
55077
+ activeChartInstance.updateViewBox({
55078
+ x1: 0,
55079
+ x2: viewBox.x2 - viewBox.x1,
55080
+ y1: 0,
55081
+ y2: viewBox.y2 - viewBox.y1
55082
+ }, false, false);
55083
+ const chartStage = activeChartInstance.getStage();
55084
+ chartStage.needRender = true;
55085
+ const matrix = chart.globalTransMatrix.clone();
55086
+ const stageMatrix = chart.stage.window.getViewBoxTransform().clone();
55087
+ stageMatrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
55088
+ chartStage.window.setViewBoxTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
55028
55089
  if (typeof dataId === 'string') {
55029
55090
  activeChartInstance.updateDataSync(dataId, data ?? []);
55030
55091
  }
@@ -55054,13 +55115,13 @@
55054
55115
  }
55055
55116
  }
55056
55117
  else {
55057
- if (chart.getRootNode().table.internalProps.renderChartAsync) {
55118
+ if (table.internalProps.renderChartAsync) {
55058
55119
  if (chartRenderKeys.indexOf(`${chart.parent.col}+${chart.parent.row}`) === -1) {
55059
55120
  chartRenderKeys.push(`${chart.parent.col}+${chart.parent.row}`);
55060
55121
  chartRenderQueueList.push(chart);
55061
55122
  }
55062
55123
  if (!IsHandlingChartQueue()) {
55063
- startRenderChartQueue(chart.getRootNode().table);
55124
+ startRenderChartQueue(table);
55064
55125
  }
55065
55126
  }
55066
55127
  else {
@@ -55069,31 +55130,7 @@
55069
55130
  }
55070
55131
  }
55071
55132
  draw(chart, renderService, drawContext, params) {
55072
- const { context } = drawContext;
55073
- if (!context) {
55074
- return;
55075
- }
55076
- const { clip } = chart.attribute;
55077
- if (clip) {
55078
- context.save();
55079
- }
55080
- else {
55081
- context.highPerformanceSave();
55082
- }
55083
- context.transformFromMatrix(chart.transMatrix, true);
55084
- context.beginPath();
55085
- if (params.skipDraw) {
55086
- this.drawShape(chart, context, 0, 0, drawContext, params, () => false, () => false);
55087
- }
55088
- else {
55089
- this.drawShape(chart, context, 0, 0, drawContext);
55090
- }
55091
- if (clip) {
55092
- context.restore();
55093
- }
55094
- else {
55095
- context.highPerformanceRestore();
55096
- }
55133
+ this._draw(chart, {}, false, drawContext, params);
55097
55134
  }
55098
55135
  };
55099
55136
  DefaultCanvasChartRender = __decorate([
@@ -59977,6 +60014,15 @@
59977
60014
  });
59978
60015
  }
59979
60016
  }
60017
+ function clearCellChartCacheImage(col, row, scenegraph) {
60018
+ const cellGroup = scenegraph.getCell(col, row);
60019
+ cellGroup.children.forEach((node) => {
60020
+ if (node.type === 'chart') {
60021
+ node.cacheCanvas = null;
60022
+ node.addUpdateBoundTag();
60023
+ }
60024
+ });
60025
+ }
59980
60026
  function updateChartData(scenegraph) {
59981
60027
  const table = scenegraph.table;
59982
60028
  for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
@@ -60838,7 +60884,12 @@
60838
60884
  setPoptipTheme(this.table.theme.textPopTipStyle);
60839
60885
  let width;
60840
60886
  let height;
60841
- if (Env.mode === 'node') {
60887
+ if (table.options.canvas && table.options.viewBox) {
60888
+ vglobal.setEnv('browser');
60889
+ width = table.options.viewBox.x2 - table.options.viewBox.x1;
60890
+ height = table.options.viewBox.y2 - table.options.viewBox.y1;
60891
+ }
60892
+ else if (Env.mode === 'node') {
60842
60893
  vglobal.setEnv('node', table.options.modeParams);
60843
60894
  width = table.canvasWidth;
60844
60895
  height = table.canvasHeight;
@@ -60856,9 +60907,15 @@
60856
60907
  background: table.theme.underlayBackgroundColor,
60857
60908
  dpr: table.internalProps.pixelRatio,
60858
60909
  enableLayout: true,
60859
- afterRender: () => {
60910
+ beforeRender: (stage) => {
60911
+ this.table.options.beforeRender && this.table.options.beforeRender(stage);
60912
+ },
60913
+ afterRender: (stage) => {
60914
+ this.table.options.afterRender && this.table.options.afterRender(stage);
60860
60915
  this.table.fireListeners('after_render', null);
60861
60916
  },
60917
+ canvasControled: !table.options.canvas,
60918
+ viewBox: table.options.viewBox,
60862
60919
  ...table.options.renderOption
60863
60920
  });
60864
60921
  this.stage.defaultLayer.setTheme({
@@ -60990,7 +61047,6 @@
60990
61047
  delete this.tableGroup.border;
60991
61048
  }
60992
61049
  this.proxy?.release();
60993
- this.table.reactCustomLayout?.clearCache();
60994
61050
  }
60995
61051
  updateStageBackground() {
60996
61052
  this.stage.background = this.table.theme.underlayBackgroundColor;
@@ -61008,7 +61064,6 @@
61008
61064
  createSceneGraph(skipRowHeightClear = false) {
61009
61065
  if (!skipRowHeightClear) {
61010
61066
  this.table.rowHeightsMap.clear();
61011
- this.table.internalProps.layoutMap.clearCellRangeMap();
61012
61067
  }
61013
61068
  if (this.table.isPivotChart() || this.table._hasCustomRenderOrLayout()) {
61014
61069
  this.stage.pluginService.autoEnablePlugins.getContributions().forEach((p) => {
@@ -65052,7 +65107,7 @@
65052
65107
  }
65053
65108
  }
65054
65109
  const isCompleteEdit = table.editorManager?.completeEdit(e.nativeEvent);
65055
- getPromiseValue(isCompleteEdit, (isCompleteEdit) => {
65110
+ getPromiseValue(isCompleteEdit, isCompleteEdit => {
65056
65111
  if (isCompleteEdit === false) {
65057
65112
  return;
65058
65113
  }
@@ -65089,7 +65144,7 @@
65089
65144
  stateManager.hideMenu();
65090
65145
  }
65091
65146
  const isCompleteEdit = table.editorManager?.completeEdit(e.nativeEvent);
65092
- getPromiseValue(isCompleteEdit, (isCompleteEdit) => {
65147
+ getPromiseValue(isCompleteEdit, isCompleteEdit => {
65093
65148
  if (isCompleteEdit === false) {
65094
65149
  return;
65095
65150
  }
@@ -65319,7 +65374,7 @@
65319
65374
  stateManager.hideMenu();
65320
65375
  }
65321
65376
  const isCompleteEdit = table.editorManager?.completeEdit(e.nativeEvent);
65322
- getPromiseValue(isCompleteEdit, (isCompleteEdit) => {
65377
+ getPromiseValue(isCompleteEdit, isCompleteEdit => {
65323
65378
  if (isCompleteEdit === false) {
65324
65379
  return;
65325
65380
  }
@@ -65964,7 +66019,7 @@
65964
66019
  table.editorManager.cancelEdit();
65965
66020
  }
65966
66021
  else if (e.key === 'Enter') {
65967
- if (table.editorManager.editingEditor) {
66022
+ if (table.editorManager?.editingEditor) {
65968
66023
  handleKeydownListener(e);
65969
66024
  table.editorManager.completeEdit();
65970
66025
  table.getElement().focus();
@@ -66143,17 +66198,19 @@
66143
66198
  e.preventDefault();
66144
66199
  }
66145
66200
  });
66146
- handler.on(table.getContainer(), 'resize', e => {
66147
- if (e.width === 0 && e.height === 0) {
66148
- return;
66149
- }
66150
- if (!isValid$1(table.options.pixelRatio)) {
66151
- table.setPixelRatio(getPixelRatio());
66152
- }
66153
- if (!e.windowSizeNotChange) {
66154
- table.resize();
66155
- }
66156
- });
66201
+ if (!table.options.canvas) {
66202
+ handler.on(table.getContainer(), 'resize', e => {
66203
+ if ((e.width === 0 && e.height === 0) || table.isReleased) {
66204
+ return;
66205
+ }
66206
+ if (!isValid$1(table.options.pixelRatio)) {
66207
+ table.setPixelRatio(getPixelRatio());
66208
+ }
66209
+ if (!e.windowSizeNotChange) {
66210
+ table.resize();
66211
+ }
66212
+ });
66213
+ }
66157
66214
  const regex = /<tr[^>]*>([\s\S]*?)<\/tr>/g;
66158
66215
  const cellRegex = /<td[^>]*>([\s\S]*?)<\/td>/g;
66159
66216
  function pasteHtmlToTable(item) {
@@ -66715,7 +66772,7 @@
66715
66772
  this.table = table;
66716
66773
  this.handleTextStickBindId = [];
66717
66774
  this.inertiaScroll = new InertiaScroll(table.stateManager);
66718
- if (Env.mode === 'node') {
66775
+ if (Env.mode === 'node' || table.options.disableInteraction) {
66719
66776
  return;
66720
66777
  }
66721
66778
  this.bindOuterEvent();
@@ -66732,6 +66789,9 @@
66732
66789
  }
66733
66790
  updateEventBinder() {
66734
66791
  setTimeout(() => {
66792
+ if (this.table.isReleased) {
66793
+ return;
66794
+ }
66735
66795
  if (checkHaveTextStick(this.table) && this.handleTextStickBindId?.length === 0) {
66736
66796
  this.handleTextStickBindId.push(this.table.on(TABLE_EVENT_TYPE.SCROLL, e => {
66737
66797
  handleTextStick(this.table);
@@ -68313,6 +68373,7 @@
68313
68373
  }
68314
68374
 
68315
68375
  class FocusInput extends EventTarget {
68376
+ _container;
68316
68377
  _table;
68317
68378
  _input;
68318
68379
  constructor(table, parentElement) {
@@ -68332,6 +68393,7 @@
68332
68393
  input.dataset.vtable = 'vtable';
68333
68394
  input.readOnly = true;
68334
68395
  parentElement.appendChild(div);
68396
+ this._container = div;
68335
68397
  }
68336
68398
  focus() {
68337
68399
  this._input.focus({ preventScroll: true });
@@ -68351,6 +68413,7 @@
68351
68413
  return this._input;
68352
68414
  }
68353
68415
  release() {
68416
+ this._container.parentElement?.removeChild(this._container);
68354
68417
  }
68355
68418
  }
68356
68419
 
@@ -70499,7 +70562,7 @@
70499
70562
  return TABLE_EVENT_TYPE;
70500
70563
  }
70501
70564
  options;
70502
- version = "1.5.4-alpha.5";
70565
+ version = "1.5.4-beta.1";
70503
70566
  pagination;
70504
70567
  id = `VTable${Date.now()}`;
70505
70568
  headerStyleCache;
@@ -70514,7 +70577,7 @@
70514
70577
  _hasAutoImageColumn;
70515
70578
  constructor(container, options = {}) {
70516
70579
  super();
70517
- if (!container && options.mode !== 'node') {
70580
+ if (!container && options.mode !== 'node' && !options.canvas) {
70518
70581
  throw new Error("vtable's container is undefined");
70519
70582
  }
70520
70583
  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;
@@ -70552,7 +70615,14 @@
70552
70615
  if (typeof allowFrozenColCount === 'number' && allowFrozenColCount <= 0) {
70553
70616
  this.showFrozenIcon = false;
70554
70617
  }
70555
- if (Env.mode !== 'node') {
70618
+ if (this.options.canvas) {
70619
+ internalProps.element = this.options.canvas.parentElement;
70620
+ internalProps.element.style.position = 'relative';
70621
+ internalProps.focusControl = new FocusInput(this, internalProps.element);
70622
+ internalProps.canvas = this.options.canvas;
70623
+ internalProps.context = internalProps.canvas.getContext('2d');
70624
+ }
70625
+ else if (Env.mode !== 'node') {
70556
70626
  internalProps.element = createRootElement(this.padding);
70557
70627
  internalProps.focusControl = new FocusInput(this, internalProps.element);
70558
70628
  internalProps.canvas = document.createElement('canvas');
@@ -70960,7 +71030,21 @@
70960
71030
  const { padding } = this;
70961
71031
  let widthP = 0;
70962
71032
  let heightP = 0;
70963
- if (Env.mode === 'browser') {
71033
+ this.tableX = 0;
71034
+ this.tableY = 0;
71035
+ if (this.options.canvas && this.options.viewBox) {
71036
+ widthP = this.options.viewBox.x2 - this.options.viewBox.x1;
71037
+ heightP = this.options.viewBox.y2 - this.options.viewBox.y1;
71038
+ if (this?.scenegraph?.stage) {
71039
+ if (this.options.viewBox) {
71040
+ this.scenegraph.stage.setViewBox(this.options.viewBox, false);
71041
+ }
71042
+ else {
71043
+ this.scenegraph.stage.resize(widthP, heightP);
71044
+ }
71045
+ }
71046
+ }
71047
+ else if (Env.mode === 'browser') {
70964
71048
  const element = this.getElement();
70965
71049
  let widthWithoutPadding = 0;
70966
71050
  let heightWithoutPadding = 0;
@@ -71027,6 +71111,23 @@
71027
71111
  }
71028
71112
  }
71029
71113
  }
71114
+ updateViewBox(newViewBox) {
71115
+ const oldWidth = this.options?.viewBox.x2 ?? 0 - this.options?.viewBox.x1 ?? 0;
71116
+ const oldHeight = this.options?.viewBox.y2 ?? 0 - this.options?.viewBox.y1 ?? 0;
71117
+ const newWidth = newViewBox.x2 - newViewBox.x1;
71118
+ const newHeight = newViewBox.y2 - newViewBox.y1;
71119
+ this.options.viewBox = newViewBox;
71120
+ if (oldWidth !== newWidth || oldHeight !== newHeight) {
71121
+ this.resize();
71122
+ }
71123
+ else {
71124
+ this.scenegraph.stage.setViewBox(this.options.viewBox, true);
71125
+ }
71126
+ }
71127
+ setViewBoxTransform(a, b, c, d, e, f) {
71128
+ this.internalProps.modifiedViewBoxTransform = true;
71129
+ this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
71130
+ }
71030
71131
  get rowHierarchyType() {
71031
71132
  return 'grid';
71032
71133
  }
@@ -71551,6 +71652,8 @@
71551
71652
  const visibleRect = this.getVisibleRect();
71552
71653
  rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0));
71553
71654
  rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0));
71655
+ rect.offsetLeft(this.options.viewBox?.x1 ?? 0);
71656
+ rect.offsetTop(this.options.viewBox?.y1 ?? 0);
71554
71657
  return rect;
71555
71658
  }
71556
71659
  getVisibleRect() {
@@ -71710,8 +71813,9 @@
71710
71813
  }
71711
71814
  this.scenegraph.stage.release();
71712
71815
  this.scenegraph.proxy.release();
71816
+ internalProps.focusControl.release();
71713
71817
  const { parentElement } = internalProps.element;
71714
- if (parentElement) {
71818
+ if (parentElement && !this.options.canvas) {
71715
71819
  parentElement.removeChild(internalProps.element);
71716
71820
  }
71717
71821
  this.editorManager?.editingEditor?.onEnd?.();
@@ -71755,7 +71859,7 @@
71755
71859
  this.autoFillHeight = autoFillHeight ?? false;
71756
71860
  this.customRender = customRender;
71757
71861
  const internalProps = this.internalProps;
71758
- if (Env.mode !== 'node') {
71862
+ if (Env.mode !== 'node' && !options.canvas) {
71759
71863
  updateRootElementPadding(internalProps.element, this.padding);
71760
71864
  }
71761
71865
  this.columnWidthComputeMode = options.columnWidthComputeMode ?? 'normal';
@@ -71936,9 +72040,14 @@
71936
72040
  const currentHeight = rect.height;
71937
72041
  const originHeight = this.canvas.offsetHeight || currentHeight;
71938
72042
  const heightRatio = currentHeight / originHeight;
71939
- const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0);
71940
- const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0);
71941
- return { x, y, inTable };
72043
+ const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0) - (this.options.viewBox?.x1 ?? 0);
72044
+ const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0) - (this.options.viewBox?.y1 ?? 0);
72045
+ const point = { x, y, inTable };
72046
+ if (this.internalProps.modifiedViewBoxTransform && this.scenegraph.stage.window.getViewBoxTransform()) {
72047
+ const transform = this.scenegraph.stage.window.getViewBoxTransform();
72048
+ transform.transformPoint(point, point);
72049
+ }
72050
+ return point;
71942
72051
  }
71943
72052
  getTheme() {
71944
72053
  return this.internalProps.theme;
@@ -73183,9 +73292,9 @@
73183
73292
  setSortedIndexMap(field, filedMap) {
73184
73293
  this.dataSource?.setSortedIndexMap(field, filedMap);
73185
73294
  }
73186
- checkReactCustomLayout(removeAllContainer) {
73295
+ checkReactCustomLayout() {
73187
73296
  if (!this.reactCustomLayout) {
73188
- this.reactCustomLayout = new ReactCustomLayout(removeAllContainer, this);
73297
+ this.reactCustomLayout = new ReactCustomLayout(this);
73189
73298
  }
73190
73299
  }
73191
73300
  get bodyDomContainer() {
@@ -76459,7 +76568,7 @@
76459
76568
  this.render();
76460
76569
  if (isValid$1(oldHoverState.col) && isValid$1(oldHoverState.row) && oldHoverState.col >= 0 && oldHoverState.row >= 0) {
76461
76570
  setTimeout(() => {
76462
- this.internalProps.tooltipHandler.showTooltip(oldHoverState.col, oldHoverState.row);
76571
+ this.internalProps?.tooltipHandler.showTooltip(oldHoverState.col, oldHoverState.row);
76463
76572
  }, 0);
76464
76573
  }
76465
76574
  }
@@ -77581,7 +77690,9 @@
77581
77690
  const axisStylrAttrs = getAxisAttributes(this.option);
77582
77691
  const attrs = this.getUpdateAttribute();
77583
77692
  attrs.verticalFactor = this.orient === 'top' || this.orient === 'right' ? -1 : 1;
77584
- this.component = new LineAxis(merge({}, axisStylrAttrs, attrs));
77693
+ this.component = new LineAxis(merge({
77694
+ disableTriggerEvent: this.table.options.disableInteraction
77695
+ }, axisStylrAttrs, attrs));
77585
77696
  this.component.setAttributes(this.setLayoutStartPosition({ x: 0, y: 0 }));
77586
77697
  this.component.originAxis = this;
77587
77698
  }
@@ -78162,7 +78273,8 @@
78162
78273
  height: this.table.tableNoFrameHeight
78163
78274
  });
78164
78275
  const legend = new DiscreteLegend(merge({}, attrs, {
78165
- defaultSelected: this.selectedData
78276
+ defaultSelected: this.selectedData,
78277
+ disableTriggerEvent: this.table.options.disableInteraction
78166
78278
  }));
78167
78279
  legend.name = 'legend';
78168
78280
  this.legendComponent = legend;
@@ -79852,7 +79964,8 @@
79852
79964
  data: table.getCellValue(col, row),
79853
79965
  cellPadding: padding,
79854
79966
  dpr: table.internalProps.pixelRatio,
79855
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
79967
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : [],
79968
+ tableChartOption: table.options.chartOption
79856
79969
  });
79857
79970
  cellGroup.appendChild(chartGroup);
79858
79971
  table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
@@ -88199,6 +88312,14 @@
88199
88312
  updateChartData(this.scenegraph);
88200
88313
  this.render();
88201
88314
  }
88315
+ clearChartCacheImage(col, row) {
88316
+ if (isNumber$2(col) && isNumber$2(row)) {
88317
+ clearCellChartCacheImage(col, row, this.scenegraph);
88318
+ }
88319
+ else {
88320
+ clearChartCacheImage(this.scenegraph);
88321
+ }
88322
+ }
88202
88323
  getLegendSelected() {
88203
88324
  const selected = [];
88204
88325
  this.internalProps.legends?.forEach(legend => {
@@ -88992,7 +89113,7 @@
88992
89113
  }
88993
89114
 
88994
89115
  registerForVrender();
88995
- const version = "1.5.4-alpha.5";
89116
+ const version = "1.5.4-beta.1";
88996
89117
  function getIcons() {
88997
89118
  return get$2();
88998
89119
  }