@visactor/vtable 1.4.0 → 1.4.1-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 (101) 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 +4 -2
  9. package/cjs/core/BaseTable.js +55 -171
  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 +22 -0
  17. package/cjs/core/utils/get-cell-position.js +206 -0
  18. package/cjs/core/utils/get-cell-position.js.map +1 -0
  19. package/cjs/event/event.js +2 -1
  20. package/cjs/event/event.js.map +1 -1
  21. package/cjs/event/listener/container-dom.js +1 -1
  22. package/cjs/event/listener/container-dom.js.map +1 -1
  23. package/cjs/event/util.js +2 -2
  24. package/cjs/event/util.js.map +1 -1
  25. package/cjs/index.d.ts +1 -1
  26. package/cjs/index.js +1 -1
  27. package/cjs/index.js.map +1 -1
  28. package/cjs/scenegraph/debug-tool/debug-tool.js +4 -1
  29. package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
  30. package/cjs/scenegraph/graphic/chart.d.ts +1 -0
  31. package/cjs/scenegraph/graphic/chart.js +34 -20
  32. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  33. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
  34. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  35. package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  36. package/cjs/scenegraph/graphic/contributions/chart-render.js +40 -24
  37. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  38. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  39. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  40. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -0
  41. package/cjs/scenegraph/refresh-node/update-chart.js +9 -2
  42. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  43. package/cjs/scenegraph/scenegraph.js +10 -4
  44. package/cjs/scenegraph/scenegraph.js.map +1 -1
  45. package/cjs/state/state.js +1 -1
  46. package/cjs/themes/component.js +1 -1
  47. package/cjs/ts-types/base-table.d.ts +14 -1
  48. package/cjs/ts-types/base-table.js.map +1 -1
  49. package/cjs/vrender.js.map +1 -1
  50. package/dist/vtable.js +486 -306
  51. package/dist/vtable.min.js +2 -2
  52. package/es/PivotChart.d.ts +1 -0
  53. package/es/PivotChart.js +5 -2
  54. package/es/PivotChart.js.map +1 -1
  55. package/es/components/axis/axis.js +3 -1
  56. package/es/components/axis/axis.js.map +1 -1
  57. package/es/components/legend/discrete-legend/discrete-legend.js +2 -1
  58. package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  59. package/es/core/BaseTable.d.ts +4 -2
  60. package/es/core/BaseTable.js +56 -170
  61. package/es/core/BaseTable.js.map +1 -1
  62. package/es/core/FouseInput.d.ts +1 -0
  63. package/es/core/FouseInput.js +5 -2
  64. package/es/core/FouseInput.js.map +1 -1
  65. package/es/core/tableHelper.d.ts +2 -2
  66. package/es/core/tableHelper.js.map +1 -1
  67. package/es/core/utils/get-cell-position.d.ts +22 -0
  68. package/es/core/utils/get-cell-position.js +194 -0
  69. package/es/core/utils/get-cell-position.js.map +1 -0
  70. package/es/event/event.js +2 -1
  71. package/es/event/event.js.map +1 -1
  72. package/es/event/listener/container-dom.js +1 -1
  73. package/es/event/listener/container-dom.js.map +1 -1
  74. package/es/event/util.js +2 -2
  75. package/es/event/util.js.map +1 -1
  76. package/es/index.d.ts +1 -1
  77. package/es/index.js +1 -1
  78. package/es/index.js.map +1 -1
  79. package/es/scenegraph/debug-tool/debug-tool.js +4 -1
  80. package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
  81. package/es/scenegraph/graphic/chart.d.ts +1 -0
  82. package/es/scenegraph/graphic/chart.js +33 -21
  83. package/es/scenegraph/graphic/chart.js.map +1 -1
  84. package/es/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
  85. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  86. package/es/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  87. package/es/scenegraph/graphic/contributions/chart-render.js +41 -25
  88. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  89. package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  90. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  91. package/es/scenegraph/refresh-node/update-chart.d.ts +1 -0
  92. package/es/scenegraph/refresh-node/update-chart.js +6 -0
  93. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  94. package/es/scenegraph/scenegraph.js +10 -4
  95. package/es/scenegraph/scenegraph.js.map +1 -1
  96. package/es/state/state.js +1 -1
  97. package/es/themes/component.js +1 -1
  98. package/es/ts-types/base-table.d.ts +14 -1
  99. package/es/ts-types/base-table.js.map +1 -1
  100. package/es/vrender.js.map +1 -1
  101. package/package.json +6 -6
package/dist/vtable.js CHANGED
@@ -41998,7 +41998,7 @@
41998
41998
  }
41999
41999
  };
42000
42000
 
42001
- const version$1 = "0.19.11";
42001
+ const version$1 = "0.19.12";
42002
42002
 
42003
42003
  let registed = false;
42004
42004
  function registerForVrender() {
@@ -47961,7 +47961,9 @@
47961
47961
  const axisStylrAttrs = getAxisAttributes(this.option);
47962
47962
  const attrs = this.getUpdateAttribute();
47963
47963
  attrs.verticalFactor = this.orient === 'top' || this.orient === 'right' ? -1 : 1;
47964
- this.component = new LineAxis(merge({}, axisStylrAttrs, attrs));
47964
+ this.component = new LineAxis(merge({
47965
+ disableTriggerEvent: this.table.options.disableInteraction
47966
+ }, axisStylrAttrs, attrs));
47965
47967
  this.component.setAttributes(this.setLayoutStartPosition({ x: 0, y: 0 }));
47966
47968
  this.component.originAxis = this;
47967
47969
  }
@@ -50699,8 +50701,8 @@
50699
50701
  function getCellEventArgsSet(e) {
50700
50702
  const tableEvent = {
50701
50703
  abstractPos: {
50702
- x: e.x,
50703
- y: e.y
50704
+ x: e.viewport.x,
50705
+ y: e.viewport.y
50704
50706
  }
50705
50707
  };
50706
50708
  const targetCell = getTargetCell(e.target);
@@ -52843,7 +52845,7 @@
52843
52845
  this.numberType = CHART_NUMBER_TYPE;
52844
52846
  this.isShareChartSpec = isShareChartSpec;
52845
52847
  if (!params.chartInstance) {
52846
- const chartInstance = new params.ClassType(params.spec, {
52848
+ const chartInstance = (this.chartInstance = new params.ClassType(params.spec, merge({}, this.attribute.tableChartOption, {
52847
52849
  renderCanvas: params.canvas,
52848
52850
  mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
52849
52851
  modeParams: this.attribute.modeParams,
@@ -52853,8 +52855,9 @@
52853
52855
  interactive: false,
52854
52856
  animation: false,
52855
52857
  autoFit: false
52856
- });
52858
+ })));
52857
52859
  chartInstance.renderSync();
52860
+ chartInstance.getStage().enableDirtyBounds();
52858
52861
  params.chartInstance = this.chartInstance = chartInstance;
52859
52862
  }
52860
52863
  else {
@@ -52872,34 +52875,53 @@
52872
52875
  y1: y1 - table.scrollTop,
52873
52876
  y2: y2 - table.scrollTop
52874
52877
  });
52875
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
52878
+ this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, merge({}, this.attribute.tableChartOption, {
52876
52879
  renderCanvas: this.attribute.canvas,
52877
52880
  mode: 'desktop-browser',
52878
52881
  canvasControled: false,
52879
52882
  viewBox: {
52880
- x1: x1 - table.scrollLeft,
52881
- x2: x2 - table.scrollLeft,
52882
- y1: y1 - table.scrollTop,
52883
- y2: y2 - table.scrollTop
52883
+ x1: 0,
52884
+ x2: x2 - x1,
52885
+ y1: 0,
52886
+ y2: y2 - y1
52884
52887
  },
52885
52888
  dpr: table.internalProps.pixelRatio,
52886
52889
  animation: false,
52887
52890
  interactive: true,
52888
52891
  autoFit: false,
52889
- beforeRender: (stage) => {
52890
- const ctx = stage.window.getContext();
52892
+ beforeRender: (chartStage) => {
52893
+ const stage = this.stage;
52894
+ const ctx = chartStage.window.getContext();
52895
+ const stageMatrix = stage.window.getViewBoxTransform();
52896
+ const viewBox = stage.window.getViewBox();
52891
52897
  ctx.inuse = true;
52892
52898
  ctx.clearMatrix();
52899
+ ctx.setTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f, true);
52900
+ ctx.translate(viewBox.x1, viewBox.y1);
52893
52901
  ctx.setTransformForCurrent(true);
52894
52902
  ctx.beginPath();
52895
52903
  ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
52896
52904
  ctx.clip();
52905
+ ctx.clearMatrix();
52906
+ if (!chartStage.needRender) {
52907
+ chartStage.pauseRender();
52908
+ table.scenegraph.stage.dirtyBounds.union(this.globalAABBBounds);
52909
+ table.scenegraph.updateNextFrame();
52910
+ }
52897
52911
  },
52898
52912
  afterRender(stage) {
52899
52913
  const ctx = stage.window.getContext();
52900
52914
  ctx.inuse = false;
52915
+ stage.needRender = false;
52916
+ chartStage.resumeRender();
52901
52917
  }
52902
- });
52918
+ }));
52919
+ const chartStage = this.activeChartInstance.getStage();
52920
+ const matrix = this.globalTransMatrix.clone();
52921
+ const stageMatrix = this.stage.window.getViewBoxTransform();
52922
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
52923
+ chartStage.window.setViewBoxTransform &&
52924
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
52903
52925
  this.activeChartInstance.renderSync();
52904
52926
  table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
52905
52927
  this.activeChartInstance.on('click', (params) => {
@@ -52935,11 +52957,12 @@
52935
52957
  const cellGroup = this.parent;
52936
52958
  const padding = this.attribute.cellPadding;
52937
52959
  const table = this.stage.table;
52960
+ const { x1, y1, x2, y2 } = cellGroup.globalAABBBounds;
52938
52961
  return {
52939
- x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
52940
- x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
52941
- y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
52942
- y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
52962
+ x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
52963
+ x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
52964
+ y1: Math.ceil(y1 + padding[0] + table.scrollTop + (table.options.viewBox?.y1 ?? 0)),
52965
+ y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (table.options.viewBox?.y1 ?? 0))
52943
52966
  };
52944
52967
  }
52945
52968
  }
@@ -52970,6 +52993,10 @@
52970
52993
  bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
52971
52994
  bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
52972
52995
  }
52996
+ bodyBound.x1 = bodyBound.x1 + (table.options.viewBox?.x1 ?? 0);
52997
+ bodyBound.x2 = bodyBound.x2 + (table.options.viewBox?.x1 ?? 0);
52998
+ bodyBound.y1 = bodyBound.y1 + (table.options.viewBox?.y1 ?? 0);
52999
+ bodyBound.y2 = bodyBound.y2 + (table.options.viewBox?.y1 ?? 0);
52973
53000
  return bodyBound;
52974
53001
  }
52975
53002
 
@@ -53051,7 +53078,8 @@
53051
53078
  data: table.getCellValue(col, row),
53052
53079
  cellPadding: padding,
53053
53080
  dpr: table.internalProps.pixelRatio,
53054
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
53081
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : [],
53082
+ tableChartOption: table.options.chartOption
53055
53083
  });
53056
53084
  cellGroup.appendChild(chartGroup);
53057
53085
  table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
@@ -58708,48 +58736,65 @@
58708
58736
  if (viewBox.y2 <= viewBox.y1) {
58709
58737
  viewBox.y2 = viewBox.y1 + 1;
58710
58738
  }
58711
- axes?.forEach((axis, index) => {
58712
- if (axis.type === 'band') {
58713
- chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
58714
- }
58715
- else {
58716
- chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
58717
- }
58718
- });
58719
58739
  chartInstance.updateViewBox({
58720
- x1: viewBox.x1 - chart.getRootNode().table.scrollLeft,
58721
- x2: viewBox.x2 - chart.getRootNode().table.scrollLeft,
58722
- y1: viewBox.y1 - chart.getRootNode().table.scrollTop,
58723
- y2: viewBox.y2 - chart.getRootNode().table.scrollTop
58740
+ x1: 0,
58741
+ x2: viewBox.x2 - viewBox.x1,
58742
+ y1: 0,
58743
+ y2: viewBox.y2 - viewBox.y1
58724
58744
  }, false, false);
58725
- const table = chart.getRootNode().table;
58726
- table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
58727
- if (typeof dataId === 'string') {
58728
- chartInstance.updateDataSync(dataId, data ?? []);
58729
- }
58730
- else {
58731
- const dataBatch = [];
58732
- for (const dataIdStr in dataId) {
58733
- const dataIdAndField = dataId[dataIdStr];
58734
- const series = spec.series.find((item) => item?.data?.id === dataIdStr);
58735
- dataBatch.push({
58736
- id: dataIdStr,
58737
- values: dataIdAndField
58738
- ? data?.filter((item) => {
58739
- return item.hasOwnProperty(dataIdAndField);
58740
- }) ?? []
58741
- : data ?? [],
58742
- fields: series?.data?.fields
58743
- });
58744
- if (!chartInstance.updateFullDataSync) {
58745
- chartInstance.updateDataSync(dataIdStr, dataIdAndField
58746
- ? data?.filter((item) => {
58747
- return item.hasOwnProperty(dataIdAndField);
58748
- }) ?? []
58749
- : data ?? []);
58745
+ const chartStage = chartInstance.getStage();
58746
+ const matrix = chart.globalTransMatrix.clone();
58747
+ const stageMatrix = chart.stage.window.getViewBoxTransform();
58748
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
58749
+ chartStage.window.setViewBoxTransform &&
58750
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
58751
+ const { table } = chart.getRootNode();
58752
+ let updateSpec = false;
58753
+ if (table.options.specFormat) {
58754
+ const formatResult = table.options.specFormat(chart.attribute.spec);
58755
+ if (formatResult.needFormatSpec && formatResult.spec) {
58756
+ const spec = formatResult.spec;
58757
+ chartInstance.updateSpecSync(spec);
58758
+ updateSpec = true;
58759
+ }
58760
+ }
58761
+ if (!updateSpec) {
58762
+ axes?.forEach((axis, index) => {
58763
+ if (axis.type === 'band') {
58764
+ chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
58765
+ }
58766
+ else {
58767
+ chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
58768
+ }
58769
+ });
58770
+ table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
58771
+ if (typeof dataId === 'string') {
58772
+ chartInstance.updateDataSync(dataId, data ?? []);
58773
+ }
58774
+ else {
58775
+ const dataBatch = [];
58776
+ for (const dataIdStr in dataId) {
58777
+ const dataIdAndField = dataId[dataIdStr];
58778
+ const series = spec.series.find((item) => item?.data?.id === dataIdStr);
58779
+ dataBatch.push({
58780
+ id: dataIdStr,
58781
+ values: dataIdAndField
58782
+ ? data?.filter((item) => {
58783
+ return item.hasOwnProperty(dataIdAndField);
58784
+ }) ?? []
58785
+ : data ?? [],
58786
+ fields: series?.data?.fields
58787
+ });
58788
+ if (!chartInstance.updateFullDataSync) {
58789
+ chartInstance.updateDataSync(dataIdStr, dataIdAndField
58790
+ ? data?.filter((item) => {
58791
+ return item.hasOwnProperty(dataIdAndField);
58792
+ }) ?? []
58793
+ : data ?? []);
58794
+ }
58750
58795
  }
58796
+ chartInstance.updateFullDataSync?.(dataBatch);
58751
58797
  }
58752
- chartInstance.updateFullDataSync?.(dataBatch);
58753
58798
  }
58754
58799
  const sg = chartInstance.getStage();
58755
58800
  cacheStageCanvas(sg, chart);
@@ -58811,7 +58856,7 @@
58811
58856
  }
58812
58857
 
58813
58858
  const ChartRender = Symbol.for('ChartRender');
58814
- let DefaultCanvasChartRender = class DefaultCanvasChartRender {
58859
+ let DefaultCanvasChartRender = class DefaultCanvasChartRender extends BaseRender {
58815
58860
  type;
58816
58861
  numberType = CHART_NUMBER_TYPE;
58817
58862
  drawShape(chart, context, x, y, drawContext, params, fillCb, strokeCb) {
@@ -58819,6 +58864,7 @@
58819
58864
  const { dataId, data, spec } = chart.attribute;
58820
58865
  chart.getViewBox();
58821
58866
  const { width = groupAttribute.width, height = groupAttribute.height } = chart.attribute;
58867
+ const { table } = chart.getRootNode();
58822
58868
  const { active, cacheCanvas, activeChartInstance } = chart;
58823
58869
  if (!active && cacheCanvas) {
58824
58870
  if (isArray$1(cacheCanvas)) {
@@ -58832,6 +58878,27 @@
58832
58878
  }
58833
58879
  }
58834
58880
  else if (activeChartInstance) {
58881
+ if (table.options.specFormat) {
58882
+ const formatResult = table.options.specFormat(chart.attribute.spec);
58883
+ if (formatResult.needFormatSpec && formatResult.spec) {
58884
+ const spec = formatResult.spec;
58885
+ activeChartInstance.updateSpecSync(spec);
58886
+ return;
58887
+ }
58888
+ }
58889
+ const viewBox = chart.getViewBox();
58890
+ activeChartInstance.updateViewBox({
58891
+ x1: 0,
58892
+ x2: viewBox.x2 - viewBox.x1,
58893
+ y1: 0,
58894
+ y2: viewBox.y2 - viewBox.y1
58895
+ }, false, false);
58896
+ const chartStage = activeChartInstance.getStage();
58897
+ chartStage.needRender = true;
58898
+ const matrix = chart.globalTransMatrix.clone();
58899
+ const stageMatrix = chart.stage.window.getViewBoxTransform().clone();
58900
+ stageMatrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
58901
+ chartStage.window.setViewBoxTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
58835
58902
  if (typeof dataId === 'string') {
58836
58903
  activeChartInstance.updateDataSync(dataId, data ?? []);
58837
58904
  }
@@ -58861,13 +58928,13 @@
58861
58928
  }
58862
58929
  }
58863
58930
  else {
58864
- if (chart.getRootNode().table.internalProps.renderChartAsync) {
58931
+ if (table.internalProps.renderChartAsync) {
58865
58932
  if (chartRenderKeys.indexOf(`${chart.parent.col}+${chart.parent.row}`) === -1) {
58866
58933
  chartRenderKeys.push(`${chart.parent.col}+${chart.parent.row}`);
58867
58934
  chartRenderQueueList.push(chart);
58868
58935
  }
58869
58936
  if (!IsHandlingChartQueue()) {
58870
- startRenderChartQueue(chart.getRootNode().table);
58937
+ startRenderChartQueue(table);
58871
58938
  }
58872
58939
  }
58873
58940
  else {
@@ -58876,31 +58943,7 @@
58876
58943
  }
58877
58944
  }
58878
58945
  draw(chart, renderService, drawContext, params) {
58879
- const { context } = drawContext;
58880
- if (!context) {
58881
- return;
58882
- }
58883
- const { clip } = chart.attribute;
58884
- if (clip) {
58885
- context.save();
58886
- }
58887
- else {
58888
- context.highPerformanceSave();
58889
- }
58890
- context.transformFromMatrix(chart.transMatrix, true);
58891
- context.beginPath();
58892
- if (params.skipDraw) {
58893
- this.drawShape(chart, context, 0, 0, drawContext, params, () => false, () => false);
58894
- }
58895
- else {
58896
- this.drawShape(chart, context, 0, 0, drawContext);
58897
- }
58898
- if (clip) {
58899
- context.restore();
58900
- }
58901
- else {
58902
- context.highPerformanceRestore();
58903
- }
58946
+ this._draw(chart, {}, false, drawContext, params);
58904
58947
  }
58905
58948
  };
58906
58949
  DefaultCanvasChartRender = __decorate([
@@ -63744,6 +63787,15 @@
63744
63787
  });
63745
63788
  }
63746
63789
  }
63790
+ function clearCellChartCacheImage(col, row, scenegraph) {
63791
+ const cellGroup = scenegraph.getCell(col, row);
63792
+ cellGroup.children.forEach((node) => {
63793
+ if (node.type === 'chart') {
63794
+ node.cacheCanvas = null;
63795
+ node.addUpdateBoundTag();
63796
+ }
63797
+ });
63798
+ }
63747
63799
  function updateChartData(scenegraph) {
63748
63800
  const table = scenegraph.table;
63749
63801
  for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
@@ -64605,7 +64657,12 @@
64605
64657
  setPoptipTheme(this.table.theme.textPopTipStyle);
64606
64658
  let width;
64607
64659
  let height;
64608
- if (Env.mode === 'node') {
64660
+ if (table.options.canvas && table.options.viewBox) {
64661
+ vglobal.setEnv('browser');
64662
+ width = table.options.viewBox.x2 - table.options.viewBox.x1;
64663
+ height = table.options.viewBox.y2 - table.options.viewBox.y1;
64664
+ }
64665
+ else if (Env.mode === 'node') {
64609
64666
  vglobal.setEnv('node', table.options.modeParams);
64610
64667
  width = table.canvasWidth;
64611
64668
  height = table.canvasHeight;
@@ -64623,9 +64680,15 @@
64623
64680
  background: table.theme.underlayBackgroundColor,
64624
64681
  dpr: table.internalProps.pixelRatio,
64625
64682
  enableLayout: true,
64626
- afterRender: () => {
64683
+ beforeRender: (stage) => {
64684
+ this.table.options.beforeRender && this.table.options.beforeRender(stage);
64685
+ },
64686
+ afterRender: (stage) => {
64687
+ this.table.options.afterRender && this.table.options.afterRender(stage);
64627
64688
  this.table.fireListeners('after_render', null);
64628
64689
  },
64690
+ canvasControled: !table.options.canvas,
64691
+ viewBox: table.options.viewBox,
64629
64692
  ...table.options.renderOption
64630
64693
  });
64631
64694
  this.stage.defaultLayer.setTheme({
@@ -69833,17 +69896,19 @@
69833
69896
  e.preventDefault();
69834
69897
  }
69835
69898
  });
69836
- handler.on(table.getContainer(), 'resize', e => {
69837
- if (e.width === 0 && e.height === 0) {
69838
- return;
69839
- }
69840
- if (!isValid$1(table.options.pixelRatio)) {
69841
- table.setPixelRatio(getPixelRatio());
69842
- }
69843
- if (!e.windowSizeNotChange) {
69844
- table.resize();
69845
- }
69846
- });
69899
+ if (!table.options.canvas) {
69900
+ handler.on(table.getContainer(), 'resize', e => {
69901
+ if (e.width === 0 && e.height === 0) {
69902
+ return;
69903
+ }
69904
+ if (!isValid$1(table.options.pixelRatio)) {
69905
+ table.setPixelRatio(getPixelRatio());
69906
+ }
69907
+ if (!e.windowSizeNotChange) {
69908
+ table.resize();
69909
+ }
69910
+ });
69911
+ }
69847
69912
  function pasteHtmlToTable(item) {
69848
69913
  const ranges = table.stateManager.select.ranges;
69849
69914
  const selectRangeLength = ranges.length;
@@ -70391,7 +70456,7 @@
70391
70456
  this.table = table;
70392
70457
  this.handleTextStickBindId = [];
70393
70458
  this.inertiaScroll = new InertiaScroll(table.stateManager);
70394
- if (Env.mode === 'node') {
70459
+ if (Env.mode === 'node' || table.options.disableInteraction) {
70395
70460
  return;
70396
70461
  }
70397
70462
  this.bindOuterEvent();
@@ -72978,6 +73043,7 @@
72978
73043
  }
72979
73044
 
72980
73045
  class FocusInput extends EventTarget {
73046
+ _container;
72981
73047
  _table;
72982
73048
  _input;
72983
73049
  constructor(table, parentElement) {
@@ -72997,6 +73063,7 @@
72997
73063
  input.dataset.vtable = 'vtable';
72998
73064
  input.readOnly = true;
72999
73065
  parentElement.appendChild(div);
73066
+ this._container = div;
73000
73067
  }
73001
73068
  focus() {
73002
73069
  this._input.focus({ preventScroll: true });
@@ -73016,6 +73083,7 @@
73016
73083
  return this._input;
73017
73084
  }
73018
73085
  release() {
73086
+ this._container.parentElement?.removeChild(this._container);
73019
73087
  }
73020
73088
  }
73021
73089
 
@@ -73135,7 +73203,8 @@
73135
73203
  height: this.table.tableNoFrameHeight
73136
73204
  });
73137
73205
  const legend = new DiscreteLegend(merge({}, attrs, {
73138
- defaultSelected: this.selectedData
73206
+ defaultSelected: this.selectedData,
73207
+ disableTriggerEvent: this.table.options.disableInteraction
73139
73208
  }));
73140
73209
  legend.name = 'legend';
73141
73210
  this.legendComponent = legend;
@@ -74697,6 +74766,249 @@
74697
74766
  return customTree;
74698
74767
  }
74699
74768
 
74769
+ function getRowAt(absoluteY, _this) {
74770
+ const frozen = _getTargetFrozenRowAt(_this, absoluteY);
74771
+ if (frozen) {
74772
+ return frozen;
74773
+ }
74774
+ let row = getTargetRowAt(absoluteY, _this);
74775
+ if (!row) {
74776
+ row = {
74777
+ top: -1,
74778
+ row: -1,
74779
+ bottom: -1,
74780
+ height: -1
74781
+ };
74782
+ }
74783
+ return row;
74784
+ }
74785
+ function getColAt(absoluteX, _this) {
74786
+ const frozen = _getTargetFrozenColAt(_this, absoluteX);
74787
+ if (frozen) {
74788
+ return frozen;
74789
+ }
74790
+ let col = getTargetColAt(absoluteX, _this);
74791
+ if (!col) {
74792
+ col = {
74793
+ left: -1,
74794
+ col: -1,
74795
+ right: -1,
74796
+ width: 1
74797
+ };
74798
+ }
74799
+ return col;
74800
+ }
74801
+ function getCellAt(absoluteX, absoluteY, _this) {
74802
+ const rowInfo = getRowAt(absoluteY, _this);
74803
+ const { row, top, bottom, height } = rowInfo;
74804
+ const colInfo = getColAt(absoluteX, _this);
74805
+ const { col, left, right, width } = colInfo;
74806
+ const rect = {
74807
+ left,
74808
+ right,
74809
+ top,
74810
+ bottom,
74811
+ width,
74812
+ height
74813
+ };
74814
+ return {
74815
+ row,
74816
+ col,
74817
+ rect
74818
+ };
74819
+ }
74820
+ function getTargetColAt(absoluteX, _this) {
74821
+ if (absoluteX === 0) {
74822
+ return { left: 0, col: 0, right: 0, width: 0 };
74823
+ }
74824
+ const findBefore = (startCol, startRight) => {
74825
+ let right = startRight;
74826
+ for (let col = startCol; col >= 0; col--) {
74827
+ const width = _this.getColWidth(col);
74828
+ const left = right - width;
74829
+ if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) {
74830
+ return {
74831
+ left,
74832
+ col,
74833
+ right,
74834
+ width
74835
+ };
74836
+ }
74837
+ right = left;
74838
+ }
74839
+ return null;
74840
+ };
74841
+ const findAfter = (startCol, startRight) => {
74842
+ let left = startRight - _this.getColWidth(startCol);
74843
+ const { colCount } = _this.internalProps;
74844
+ for (let col = startCol; col < colCount; col++) {
74845
+ const width = _this.getColWidth(col);
74846
+ const right = left + width;
74847
+ if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) {
74848
+ return {
74849
+ left,
74850
+ col,
74851
+ right,
74852
+ width
74853
+ };
74854
+ }
74855
+ left = right;
74856
+ }
74857
+ return null;
74858
+ };
74859
+ const candCol = computeTargetColByX(absoluteX, _this);
74860
+ const right = _this.getColsWidth(0, candCol);
74861
+ if (absoluteX >= right) {
74862
+ return findAfter(candCol, right);
74863
+ }
74864
+ return findBefore(candCol, right);
74865
+ }
74866
+ function getTargetRowAt(absoluteY, _this) {
74867
+ if (absoluteY === 0) {
74868
+ return { top: 0, row: 0, bottom: 0, height: 0 };
74869
+ }
74870
+ const findBefore = (startRow, startBottom) => {
74871
+ let bottom = startBottom;
74872
+ for (let row = startRow; row >= 0; row--) {
74873
+ const height = _this.getRowHeight(row);
74874
+ const top = bottom - height;
74875
+ if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) {
74876
+ return {
74877
+ top,
74878
+ row,
74879
+ bottom,
74880
+ height
74881
+ };
74882
+ }
74883
+ bottom = top;
74884
+ }
74885
+ return null;
74886
+ };
74887
+ const findAfter = (startRow, startBottom) => {
74888
+ let top = startBottom - _this.getRowHeight(startRow);
74889
+ const { rowCount } = _this.internalProps;
74890
+ for (let row = startRow; row < rowCount; row++) {
74891
+ const height = _this.getRowHeight(row);
74892
+ const bottom = top + height;
74893
+ if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) {
74894
+ return {
74895
+ top,
74896
+ row,
74897
+ bottom,
74898
+ height
74899
+ };
74900
+ }
74901
+ top = bottom;
74902
+ }
74903
+ return null;
74904
+ };
74905
+ const candRow = computeTargetRowByY(absoluteY, _this);
74906
+ const bottom = _this.getRowsHeight(0, candRow);
74907
+ if (absoluteY >= bottom) {
74908
+ return findAfter(candRow, bottom);
74909
+ }
74910
+ return findBefore(candRow, bottom);
74911
+ }
74912
+ function getTargetColAtConsiderRightFrozen(absoluteX, isConsider, _this) {
74913
+ if (absoluteX === 0) {
74914
+ return { left: 0, col: 0, right: 0, width: 0 };
74915
+ }
74916
+ if (isConsider &&
74917
+ absoluteX > _this.tableNoFrameWidth - _this.getRightFrozenColsWidth() &&
74918
+ absoluteX < _this.tableNoFrameWidth) {
74919
+ for (let i = 0; i < _this.rightFrozenColCount; i++) {
74920
+ if (absoluteX > _this.tableNoFrameWidth - _this.getColsWidth(_this.colCount - i - 1, _this.colCount - 1)) {
74921
+ return {
74922
+ col: _this.colCount - i - 1,
74923
+ left: undefined,
74924
+ right: undefined,
74925
+ width: undefined
74926
+ };
74927
+ }
74928
+ }
74929
+ }
74930
+ return getTargetColAt(absoluteX, _this);
74931
+ }
74932
+ function getTargetRowAtConsiderBottomFrozen(absoluteY, isConsider, _this) {
74933
+ if (absoluteY === 0) {
74934
+ return { top: 0, row: 0, bottom: 0, height: 0 };
74935
+ }
74936
+ if (isConsider &&
74937
+ absoluteY > _this.tableNoFrameHeight - _this.getBottomFrozenRowsHeight() &&
74938
+ absoluteY < _this.tableNoFrameHeight) {
74939
+ for (let i = 0; i < _this.rightFrozenColCount; i++) {
74940
+ if (absoluteY > _this.tableNoFrameHeight - _this.getRowsHeight(_this.rowCount - i - 1, _this.rowCount - 1)) {
74941
+ return {
74942
+ row: _this.rowCount - i - 1,
74943
+ top: undefined,
74944
+ bottom: undefined,
74945
+ height: undefined
74946
+ };
74947
+ }
74948
+ }
74949
+ }
74950
+ return getTargetRowAt(absoluteY, _this);
74951
+ }
74952
+ function computeTargetRowByY(absoluteY, _this) {
74953
+ let defaultRowHeight = _this.internalProps.defaultRowHeight;
74954
+ if (_this._rowRangeHeightsMap.get(`$0$${_this.rowCount - 1}`)) {
74955
+ defaultRowHeight = _this._rowRangeHeightsMap.get(`$0$${_this.rowCount - 1}`) / _this.rowCount;
74956
+ }
74957
+ return Math.min(Math.ceil(absoluteY / defaultRowHeight), _this.rowCount - 1);
74958
+ }
74959
+ function computeTargetColByX(absoluteX, _this) {
74960
+ if (_this._colRangeWidthsMap.get(`$0$${_this.colCount - 1}`)) {
74961
+ let startCol = 0;
74962
+ let endCol = _this.colCount - 1;
74963
+ while (endCol - startCol > 1) {
74964
+ const midCol = Math.floor((startCol + endCol) / 2);
74965
+ if (absoluteX < _this._colRangeWidthsMap.get(`$0$${midCol}`)) {
74966
+ endCol = midCol;
74967
+ }
74968
+ else if (absoluteX > _this._colRangeWidthsMap.get(`$0$${midCol}`)) {
74969
+ startCol = midCol;
74970
+ }
74971
+ else {
74972
+ return midCol;
74973
+ }
74974
+ }
74975
+ return endCol;
74976
+ }
74977
+ return Math.min(Math.ceil(absoluteX / _this.internalProps.defaultColWidth), _this.colCount - 1);
74978
+ }
74979
+ function getCellAtRelativePosition(x, y, _this) {
74980
+ x -= _this.tableX;
74981
+ y -= _this.tableY;
74982
+ let bottomFrozen = false;
74983
+ if (y > _this.tableNoFrameHeight - _this.getBottomFrozenRowsHeight() && y < _this.tableNoFrameHeight) {
74984
+ bottomFrozen = true;
74985
+ }
74986
+ let rightFrozen = false;
74987
+ if (x > _this.tableNoFrameWidth - _this.getRightFrozenColsWidth() && x < _this.tableNoFrameWidth) {
74988
+ rightFrozen = true;
74989
+ }
74990
+ const colInfo = getTargetColAtConsiderRightFrozen(rightFrozen ? x : x + _this.scrollLeft, rightFrozen, _this);
74991
+ const rowInfo = getTargetRowAtConsiderBottomFrozen(bottomFrozen ? y : y + _this.scrollTop, bottomFrozen, _this);
74992
+ if (!colInfo || !rowInfo) {
74993
+ return undefined;
74994
+ }
74995
+ const { row, top, bottom, height } = rowInfo;
74996
+ const { col, left, right, width } = colInfo;
74997
+ const rect = {
74998
+ left,
74999
+ right,
75000
+ top,
75001
+ bottom,
75002
+ width,
75003
+ height
75004
+ };
75005
+ return {
75006
+ row,
75007
+ col,
75008
+ rect
75009
+ };
75010
+ }
75011
+
74700
75012
  const { toBoxArray } = style;
74701
75013
  const { isTouchEvent } = event;
74702
75014
  const rangeReg = /^\$(\d+)\$(\d+)$/;
@@ -74729,7 +75041,7 @@
74729
75041
  return TABLE_EVENT_TYPE;
74730
75042
  }
74731
75043
  options;
74732
- version = "1.4.0";
75044
+ version = "1.4.1-beta.0";
74733
75045
  pagination;
74734
75046
  id = `VTable${Date.now()}`;
74735
75047
  headerStyleCache;
@@ -74744,7 +75056,7 @@
74744
75056
  _hasAutoImageColumn;
74745
75057
  constructor(container, options = {}) {
74746
75058
  super();
74747
- if (!container && options.mode !== 'node') {
75059
+ if (!container && options.mode !== 'node' && !options.canvas) {
74748
75060
  throw new Error("vtable's container is undefined");
74749
75061
  }
74750
75062
  const { frozenColCount = 0, 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;
@@ -74782,7 +75094,14 @@
74782
75094
  if (typeof allowFrozenColCount === 'number' && allowFrozenColCount <= 0) {
74783
75095
  this.showFrozenIcon = false;
74784
75096
  }
74785
- if (Env.mode !== 'node') {
75097
+ if (this.options.canvas) {
75098
+ internalProps.element = this.options.canvas.parentElement;
75099
+ internalProps.element.style.position = 'relative';
75100
+ internalProps.focusControl = new FocusInput(this, internalProps.element);
75101
+ internalProps.canvas = this.options.canvas;
75102
+ internalProps.context = internalProps.canvas.getContext('2d');
75103
+ }
75104
+ else if (Env.mode !== 'node') {
74786
75105
  internalProps.element = createRootElement(this.padding);
74787
75106
  internalProps.focusControl = new FocusInput(this, internalProps.element);
74788
75107
  internalProps.canvas = document.createElement('canvas');
@@ -75187,7 +75506,21 @@
75187
75506
  const { padding } = this;
75188
75507
  let widthP = 0;
75189
75508
  let heightP = 0;
75190
- if (Env.mode === 'browser') {
75509
+ this.tableX = 0;
75510
+ this.tableY = 0;
75511
+ if (this.options.canvas && this.options.viewBox) {
75512
+ widthP = this.options.viewBox.x2 - this.options.viewBox.x1;
75513
+ heightP = this.options.viewBox.y2 - this.options.viewBox.y1;
75514
+ if (this?.scenegraph?.stage) {
75515
+ if (this.options.viewBox) {
75516
+ this.scenegraph.stage.setViewBox(this.options.viewBox, false);
75517
+ }
75518
+ else {
75519
+ this.scenegraph.stage.resize(widthP, heightP);
75520
+ }
75521
+ }
75522
+ }
75523
+ else if (Env.mode === 'browser') {
75191
75524
  const element = this.getElement();
75192
75525
  let widthWithoutPadding = 0;
75193
75526
  let heightWithoutPadding = 0;
@@ -75254,6 +75587,23 @@
75254
75587
  }
75255
75588
  }
75256
75589
  }
75590
+ updateViewBox(newViewBox) {
75591
+ const oldWidth = this.options?.viewBox.x2 ?? 0 - this.options?.viewBox.x1 ?? 0;
75592
+ const oldHeight = this.options?.viewBox.y2 ?? 0 - this.options?.viewBox.y1 ?? 0;
75593
+ const newWidth = newViewBox.x2 - newViewBox.x1;
75594
+ const newHeight = newViewBox.y2 - newViewBox.y1;
75595
+ this.options.viewBox = newViewBox;
75596
+ if (oldWidth !== newWidth || oldHeight !== newHeight) {
75597
+ this.resize();
75598
+ }
75599
+ else {
75600
+ this.scenegraph.stage.setViewBox(this.options.viewBox, true);
75601
+ }
75602
+ }
75603
+ setViewBoxTransform(a, b, c, d, e, f) {
75604
+ this.internalProps.modifiedViewBoxTransform = true;
75605
+ this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
75606
+ }
75257
75607
  get rowHierarchyType() {
75258
75608
  return 'grid';
75259
75609
  }
@@ -75714,55 +76064,16 @@
75714
76064
  return null;
75715
76065
  }
75716
76066
  getRowAt(absoluteY) {
75717
- const frozen = _getTargetFrozenRowAt(this, absoluteY);
75718
- if (frozen) {
75719
- return frozen;
75720
- }
75721
- let row = this.getTargetRowAt(absoluteY);
75722
- if (!row) {
75723
- row = {
75724
- top: -1,
75725
- row: -1,
75726
- bottom: -1,
75727
- height: -1
75728
- };
75729
- }
75730
- return row;
76067
+ return getRowAt(absoluteY, this);
75731
76068
  }
75732
76069
  getColAt(absoluteX) {
75733
- const frozen = _getTargetFrozenColAt(this, absoluteX);
75734
- if (frozen) {
75735
- return frozen;
75736
- }
75737
- let col = this.getTargetColAt(absoluteX);
75738
- if (!col) {
75739
- col = {
75740
- left: -1,
75741
- col: -1,
75742
- right: -1,
75743
- width: 1
75744
- };
75745
- }
75746
- return col;
76070
+ return getColAt(absoluteX, this);
75747
76071
  }
75748
76072
  getCellAt(absoluteX, absoluteY) {
75749
- const rowInfo = this.getRowAt(absoluteY);
75750
- const { row, top, bottom, height } = rowInfo;
75751
- const colInfo = this.getColAt(absoluteX);
75752
- const { col, left, right, width } = colInfo;
75753
- const rect = {
75754
- left,
75755
- right,
75756
- top,
75757
- bottom,
75758
- width,
75759
- height
75760
- };
75761
- return {
75762
- row,
75763
- col,
75764
- rect
75765
- };
76073
+ return getCellAt(absoluteX, absoluteY, this);
76074
+ }
76075
+ getCellAtRelativePosition(relativeX, relativeY) {
76076
+ return getCellAtRelativePosition(relativeX, relativeY, this);
75766
76077
  }
75767
76078
  _checkRowCol(col, row) {
75768
76079
  if (col >= 0 && col < this.colCount && row >= 0 && row < this.rowCount) {
@@ -75817,6 +76128,8 @@
75817
76128
  const visibleRect = this.getVisibleRect();
75818
76129
  rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0));
75819
76130
  rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0));
76131
+ rect.offsetLeft(this.options.viewBox?.x1 ?? 0);
76132
+ rect.offsetTop(this.options.viewBox?.y1 ?? 0);
75820
76133
  return rect;
75821
76134
  }
75822
76135
  getVisibleRect() {
@@ -75976,8 +76289,9 @@
75976
76289
  }
75977
76290
  this.scenegraph.stage.release();
75978
76291
  this.scenegraph.proxy.release();
76292
+ internalProps.focusControl.release();
75979
76293
  const { parentElement } = internalProps.element;
75980
- if (parentElement) {
76294
+ if (parentElement && !this.options.canvas) {
75981
76295
  parentElement.removeChild(internalProps.element);
75982
76296
  }
75983
76297
  this.editorManager?.editingEditor?.onEnd?.();
@@ -76021,7 +76335,7 @@
76021
76335
  this.autoFillHeight = autoFillHeight ?? false;
76022
76336
  this.customRender = customRender;
76023
76337
  const internalProps = this.internalProps;
76024
- if (Env.mode !== 'node') {
76338
+ if (Env.mode !== 'node' && !options.canvas) {
76025
76339
  updateRootElementPadding(internalProps.element, this.padding);
76026
76340
  }
76027
76341
  this.columnWidthComputeMode = options.columnWidthComputeMode ?? 'normal';
@@ -76200,171 +76514,29 @@
76200
76514
  const currentHeight = rect.height;
76201
76515
  const originHeight = this.canvas.offsetHeight || currentHeight;
76202
76516
  const heightRatio = currentHeight / originHeight;
76203
- const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0);
76204
- const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0);
76205
- return { x, y, inTable };
76517
+ const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0) - (this.options.viewBox?.x1 ?? 0);
76518
+ const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0) - (this.options.viewBox?.y1 ?? 0);
76519
+ const point = { x, y, inTable };
76520
+ if (this.internalProps.modifiedViewBoxTransform && this.scenegraph.stage.window.getViewBoxTransform()) {
76521
+ const transform = this.scenegraph.stage.window.getViewBoxTransform();
76522
+ transform.transformPoint(point, point);
76523
+ }
76524
+ return point;
76206
76525
  }
76207
76526
  getTheme() {
76208
76527
  return this.internalProps.theme;
76209
76528
  }
76210
76529
  getTargetColAt(absoluteX) {
76211
- if (absoluteX === 0) {
76212
- return { left: 0, col: 0, right: 0, width: 0 };
76213
- }
76214
- const findBefore = (startCol, startRight) => {
76215
- let right = startRight;
76216
- for (let col = startCol; col >= 0; col--) {
76217
- const width = this.getColWidth(col);
76218
- const left = right - width;
76219
- if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) {
76220
- return {
76221
- left,
76222
- col,
76223
- right,
76224
- width
76225
- };
76226
- }
76227
- right = left;
76228
- }
76229
- return null;
76230
- };
76231
- const findAfter = (startCol, startRight) => {
76232
- let left = startRight - this.getColWidth(startCol);
76233
- const { colCount } = this.internalProps;
76234
- for (let col = startCol; col < colCount; col++) {
76235
- const width = this.getColWidth(col);
76236
- const right = left + width;
76237
- if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) {
76238
- return {
76239
- left,
76240
- col,
76241
- right,
76242
- width
76243
- };
76244
- }
76245
- left = right;
76246
- }
76247
- return null;
76248
- };
76249
- const candCol = this.computeTargetColByX(absoluteX);
76250
- const right = this.getColsWidth(0, candCol);
76251
- if (absoluteX >= right) {
76252
- return findAfter(candCol, right);
76253
- }
76254
- return findBefore(candCol, right);
76530
+ return getTargetColAt(absoluteX, this);
76255
76531
  }
76256
76532
  getTargetRowAt(absoluteY) {
76257
- if (absoluteY === 0) {
76258
- return { top: 0, row: 0, bottom: 0, height: 0 };
76259
- }
76260
- const findBefore = (startRow, startBottom) => {
76261
- let bottom = startBottom;
76262
- for (let row = startRow; row >= 0; row--) {
76263
- const height = this.getRowHeight(row);
76264
- const top = bottom - height;
76265
- if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) {
76266
- return {
76267
- top,
76268
- row,
76269
- bottom,
76270
- height
76271
- };
76272
- }
76273
- bottom = top;
76274
- }
76275
- return null;
76276
- };
76277
- const findAfter = (startRow, startBottom) => {
76278
- let top = startBottom - this.getRowHeight(startRow);
76279
- const { rowCount } = this.internalProps;
76280
- for (let row = startRow; row < rowCount; row++) {
76281
- const height = this.getRowHeight(row);
76282
- const bottom = top + height;
76283
- if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) {
76284
- return {
76285
- top,
76286
- row,
76287
- bottom,
76288
- height
76289
- };
76290
- }
76291
- top = bottom;
76292
- }
76293
- return null;
76294
- };
76295
- const candRow = this.computeTargetRowByY(absoluteY);
76296
- const bottom = this.getRowsHeight(0, candRow);
76297
- if (absoluteY >= bottom) {
76298
- return findAfter(candRow, bottom);
76299
- }
76300
- return findBefore(candRow, bottom);
76533
+ return getTargetRowAt(absoluteY, this);
76301
76534
  }
76302
76535
  getTargetColAtConsiderRightFrozen(absoluteX, isConsider) {
76303
- if (absoluteX === 0) {
76304
- return { left: 0, col: 0, right: 0, width: 0 };
76305
- }
76306
- if (isConsider &&
76307
- absoluteX > this.tableNoFrameWidth - this.getRightFrozenColsWidth() &&
76308
- absoluteX < this.tableNoFrameWidth) {
76309
- for (let i = 0; i < this.rightFrozenColCount; i++) {
76310
- if (absoluteX > this.tableNoFrameWidth - this.getColsWidth(this.colCount - i - 1, this.colCount - 1)) {
76311
- return {
76312
- col: this.colCount - i - 1,
76313
- left: undefined,
76314
- right: undefined,
76315
- width: undefined
76316
- };
76317
- }
76318
- }
76319
- }
76320
- return this.getTargetColAt(absoluteX);
76536
+ return getTargetColAtConsiderRightFrozen(absoluteX, isConsider, this);
76321
76537
  }
76322
76538
  getTargetRowAtConsiderBottomFrozen(absoluteY, isConsider) {
76323
- if (absoluteY === 0) {
76324
- return { top: 0, row: 0, bottom: 0, height: 0 };
76325
- }
76326
- if (isConsider &&
76327
- absoluteY > this.tableNoFrameHeight - this.getBottomFrozenRowsHeight() &&
76328
- absoluteY < this.tableNoFrameHeight) {
76329
- for (let i = 0; i < this.rightFrozenColCount; i++) {
76330
- if (absoluteY > this.tableNoFrameHeight - this.getRowsHeight(this.rowCount - i - 1, this.rowCount - 1)) {
76331
- return {
76332
- row: this.rowCount - i - 1,
76333
- top: undefined,
76334
- bottom: undefined,
76335
- height: undefined
76336
- };
76337
- }
76338
- }
76339
- }
76340
- return this.getTargetRowAt(absoluteY);
76341
- }
76342
- computeTargetRowByY(absoluteY) {
76343
- let defaultRowHeight = this.internalProps.defaultRowHeight;
76344
- if (this._rowRangeHeightsMap.get(`$0$${this.rowCount - 1}`)) {
76345
- defaultRowHeight = this._rowRangeHeightsMap.get(`$0$${this.rowCount - 1}`) / this.rowCount;
76346
- }
76347
- return Math.min(Math.ceil(absoluteY / defaultRowHeight), this.rowCount - 1);
76348
- }
76349
- computeTargetColByX(absoluteX) {
76350
- if (this._colRangeWidthsMap.get(`$0$${this.colCount - 1}`)) {
76351
- let startCol = 0;
76352
- let endCol = this.colCount - 1;
76353
- while (endCol - startCol > 1) {
76354
- const midCol = Math.floor((startCol + endCol) / 2);
76355
- if (absoluteX < this._colRangeWidthsMap.get(`$0$${midCol}`)) {
76356
- endCol = midCol;
76357
- }
76358
- else if (absoluteX > this._colRangeWidthsMap.get(`$0$${midCol}`)) {
76359
- startCol = midCol;
76360
- }
76361
- else {
76362
- return midCol;
76363
- }
76364
- }
76365
- return endCol;
76366
- }
76367
- return Math.min(Math.ceil(absoluteX / this.internalProps.defaultColWidth), this.colCount - 1);
76539
+ return getTargetRowAtConsiderBottomFrozen(absoluteY, isConsider, this);
76368
76540
  }
76369
76541
  clearSelected() {
76370
76542
  this.stateManager.updateSelectPos(-1, -1);
@@ -87536,6 +87708,14 @@
87536
87708
  updateChartData(this.scenegraph);
87537
87709
  this.render();
87538
87710
  }
87711
+ clearChartCacheImage(col, row) {
87712
+ if (isNumber$2(col) && isNumber$2(row)) {
87713
+ clearCellChartCacheImage(col, row, this.scenegraph);
87714
+ }
87715
+ else {
87716
+ clearChartCacheImage(this.scenegraph);
87717
+ }
87718
+ }
87539
87719
  getLegendSelected() {
87540
87720
  const selected = [];
87541
87721
  this.internalProps.legends?.forEach(legend => {
@@ -88329,7 +88509,7 @@
88329
88509
  }
88330
88510
 
88331
88511
  registerForVrender();
88332
- const version = "1.4.0";
88512
+ const version = "1.4.1-beta.0";
88333
88513
  function getIcons() {
88334
88514
  return get$2();
88335
88515
  }