@visactor/vtable 1.3.1 → 1.3.2-alpha.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 (93) 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 +54 -170
  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/utils/get-cell-position.d.ts +42 -0
  15. package/cjs/core/utils/get-cell-position.js +204 -0
  16. package/cjs/core/utils/get-cell-position.js.map +1 -0
  17. package/cjs/event/event.js +2 -1
  18. package/cjs/event/event.js.map +1 -1
  19. package/cjs/event/listener/container-dom.js +1 -1
  20. package/cjs/event/listener/container-dom.js.map +1 -1
  21. package/cjs/event/util.js +2 -2
  22. package/cjs/event/util.js.map +1 -1
  23. package/cjs/index.d.ts +1 -1
  24. package/cjs/index.js +2 -2
  25. package/cjs/index.js.map +1 -1
  26. package/cjs/scenegraph/debug-tool/debug-tool.js +4 -1
  27. package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
  28. package/cjs/scenegraph/graphic/chart.d.ts +1 -0
  29. package/cjs/scenegraph/graphic/chart.js +34 -20
  30. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  31. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
  32. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  33. package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  34. package/cjs/scenegraph/graphic/contributions/chart-render.js +40 -24
  35. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  36. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  37. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  38. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -0
  39. package/cjs/scenegraph/refresh-node/update-chart.js +9 -2
  40. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  41. package/cjs/scenegraph/scenegraph.js +10 -4
  42. package/cjs/scenegraph/scenegraph.js.map +1 -1
  43. package/cjs/ts-types/base-table.d.ts +14 -1
  44. package/cjs/ts-types/base-table.js.map +1 -1
  45. package/cjs/vrender.js.map +1 -1
  46. package/dist/vtable.js +481 -304
  47. package/dist/vtable.min.js +2 -2
  48. package/es/PivotChart.d.ts +1 -0
  49. package/es/PivotChart.js +5 -2
  50. package/es/PivotChart.js.map +1 -1
  51. package/es/components/axis/axis.js +3 -1
  52. package/es/components/axis/axis.js.map +1 -1
  53. package/es/components/legend/discrete-legend/discrete-legend.js +2 -1
  54. package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  55. package/es/core/BaseTable.d.ts +4 -2
  56. package/es/core/BaseTable.js +55 -169
  57. package/es/core/BaseTable.js.map +1 -1
  58. package/es/core/FouseInput.d.ts +1 -0
  59. package/es/core/FouseInput.js +5 -2
  60. package/es/core/FouseInput.js.map +1 -1
  61. package/es/core/utils/get-cell-position.d.ts +42 -0
  62. package/es/core/utils/get-cell-position.js +192 -0
  63. package/es/core/utils/get-cell-position.js.map +1 -0
  64. package/es/event/event.js +2 -1
  65. package/es/event/event.js.map +1 -1
  66. package/es/event/listener/container-dom.js +1 -1
  67. package/es/event/listener/container-dom.js.map +1 -1
  68. package/es/event/util.js +2 -2
  69. package/es/event/util.js.map +1 -1
  70. package/es/index.d.ts +1 -1
  71. package/es/index.js +1 -1
  72. package/es/index.js.map +1 -1
  73. package/es/scenegraph/debug-tool/debug-tool.js +4 -1
  74. package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
  75. package/es/scenegraph/graphic/chart.d.ts +1 -0
  76. package/es/scenegraph/graphic/chart.js +33 -21
  77. package/es/scenegraph/graphic/chart.js.map +1 -1
  78. package/es/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
  79. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  80. package/es/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  81. package/es/scenegraph/graphic/contributions/chart-render.js +41 -25
  82. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  83. package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  84. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  85. package/es/scenegraph/refresh-node/update-chart.d.ts +1 -0
  86. package/es/scenegraph/refresh-node/update-chart.js +6 -0
  87. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  88. package/es/scenegraph/scenegraph.js +10 -4
  89. package/es/scenegraph/scenegraph.js.map +1 -1
  90. package/es/ts-types/base-table.d.ts +14 -1
  91. package/es/ts-types/base-table.js.map +1 -1
  92. package/es/vrender.js.map +1 -1
  93. package/package.json +5 -5
package/dist/vtable.js CHANGED
@@ -32684,7 +32684,9 @@
32684
32684
  const axisStylrAttrs = getAxisAttributes(this.option);
32685
32685
  const attrs = this.getUpdateAttribute();
32686
32686
  attrs.verticalFactor = this.orient === 'top' || this.orient === 'right' ? -1 : 1;
32687
- this.component = new LineAxis(merge({}, axisStylrAttrs, attrs));
32687
+ this.component = new LineAxis(merge({
32688
+ disableTriggerEvent: this.table.options.disableInteraction
32689
+ }, axisStylrAttrs, attrs));
32688
32690
  this.component.setAttributes(this.setLayoutStartPosition({ x: 0, y: 0 }));
32689
32691
  this.component.originAxis = this;
32690
32692
  }
@@ -35274,8 +35276,8 @@
35274
35276
  function getCellEventArgsSet(e) {
35275
35277
  const tableEvent = {
35276
35278
  abstractPos: {
35277
- x: e.x,
35278
- y: e.y
35279
+ x: e.viewport.x,
35280
+ y: e.viewport.y
35279
35281
  }
35280
35282
  };
35281
35283
  const targetCell = getTargetCell(e.target);
@@ -37413,7 +37415,7 @@
37413
37415
  this.numberType = CHART_NUMBER_TYPE;
37414
37416
  this.isShareChartSpec = isShareChartSpec;
37415
37417
  if (!params.chartInstance) {
37416
- const chartInstance = new params.ClassType(params.spec, {
37418
+ const chartInstance = (this.chartInstance = new params.ClassType(params.spec, merge({}, this.attribute.tableChartOption, {
37417
37419
  renderCanvas: params.canvas,
37418
37420
  mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
37419
37421
  modeParams: this.attribute.modeParams,
@@ -37423,8 +37425,9 @@
37423
37425
  interactive: false,
37424
37426
  animation: false,
37425
37427
  autoFit: false
37426
- });
37428
+ })));
37427
37429
  chartInstance.renderSync();
37430
+ chartInstance.getStage().enableDirtyBounds();
37428
37431
  params.chartInstance = this.chartInstance = chartInstance;
37429
37432
  }
37430
37433
  else {
@@ -37442,34 +37445,53 @@
37442
37445
  y1: y1 - table.scrollTop,
37443
37446
  y2: y2 - table.scrollTop
37444
37447
  });
37445
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
37448
+ this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, merge({}, this.attribute.tableChartOption, {
37446
37449
  renderCanvas: this.attribute.canvas,
37447
37450
  mode: 'desktop-browser',
37448
37451
  canvasControled: false,
37449
37452
  viewBox: {
37450
- x1: x1 - table.scrollLeft,
37451
- x2: x2 - table.scrollLeft,
37452
- y1: y1 - table.scrollTop,
37453
- y2: y2 - table.scrollTop
37453
+ x1: 0,
37454
+ x2: x2 - x1,
37455
+ y1: 0,
37456
+ y2: y2 - y1
37454
37457
  },
37455
37458
  dpr: table.internalProps.pixelRatio,
37456
37459
  animation: false,
37457
37460
  interactive: true,
37458
37461
  autoFit: false,
37459
- beforeRender: (stage) => {
37460
- const ctx = stage.window.getContext();
37462
+ beforeRender: (chartStage) => {
37463
+ const stage = this.stage;
37464
+ const ctx = chartStage.window.getContext();
37465
+ const stageMatrix = stage.window.getViewBoxTransform();
37466
+ const viewBox = stage.window.getViewBox();
37461
37467
  ctx.inuse = true;
37462
37468
  ctx.clearMatrix();
37469
+ ctx.setTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f, true);
37470
+ ctx.translate(viewBox.x1, viewBox.y1);
37463
37471
  ctx.setTransformForCurrent(true);
37464
37472
  ctx.beginPath();
37465
37473
  ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
37466
37474
  ctx.clip();
37475
+ ctx.clearMatrix();
37476
+ if (!chartStage.needRender) {
37477
+ chartStage.pauseRender();
37478
+ table.scenegraph.stage.dirtyBounds.union(this.globalAABBBounds);
37479
+ table.scenegraph.updateNextFrame();
37480
+ }
37467
37481
  },
37468
37482
  afterRender(stage) {
37469
37483
  const ctx = stage.window.getContext();
37470
37484
  ctx.inuse = false;
37485
+ stage.needRender = false;
37486
+ chartStage.resumeRender();
37471
37487
  }
37472
- });
37488
+ }));
37489
+ const chartStage = this.activeChartInstance.getStage();
37490
+ const matrix = this.globalTransMatrix.clone();
37491
+ const stageMatrix = this.stage.window.getViewBoxTransform();
37492
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
37493
+ chartStage.window.setViewBoxTransform &&
37494
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
37473
37495
  this.activeChartInstance.renderSync();
37474
37496
  table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
37475
37497
  this.activeChartInstance.on('click', (params) => {
@@ -37505,11 +37527,12 @@
37505
37527
  const cellGroup = this.parent;
37506
37528
  const padding = this.attribute.cellPadding;
37507
37529
  const table = this.stage.table;
37530
+ const { x1, y1, x2, y2 } = cellGroup.globalAABBBounds;
37508
37531
  return {
37509
- x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
37510
- x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
37511
- y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
37512
- y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
37532
+ x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
37533
+ x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
37534
+ y1: Math.ceil(y1 + padding[0] + table.scrollTop + (table.options.viewBox?.y1 ?? 0)),
37535
+ y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (table.options.viewBox?.y1 ?? 0))
37513
37536
  };
37514
37537
  }
37515
37538
  }
@@ -37540,6 +37563,10 @@
37540
37563
  bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
37541
37564
  bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
37542
37565
  }
37566
+ bodyBound.x1 = bodyBound.x1 + (table.options.viewBox?.x1 ?? 0);
37567
+ bodyBound.x2 = bodyBound.x2 + (table.options.viewBox?.x1 ?? 0);
37568
+ bodyBound.y1 = bodyBound.y1 + (table.options.viewBox?.y1 ?? 0);
37569
+ bodyBound.y2 = bodyBound.y2 + (table.options.viewBox?.y1 ?? 0);
37543
37570
  return bodyBound;
37544
37571
  }
37545
37572
 
@@ -37621,7 +37648,8 @@
37621
37648
  data: table.getCellValue(col, row),
37622
37649
  cellPadding: padding,
37623
37650
  dpr: table.internalProps.pixelRatio,
37624
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
37651
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : [],
37652
+ tableChartOption: table.options.chartOption
37625
37653
  });
37626
37654
  cellGroup.appendChild(chartGroup);
37627
37655
  table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
@@ -43262,48 +43290,65 @@
43262
43290
  if (viewBox.y2 <= viewBox.y1) {
43263
43291
  viewBox.y2 = viewBox.y1 + 1;
43264
43292
  }
43265
- axes?.forEach((axis, index) => {
43266
- if (axis.type === 'band') {
43267
- chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
43268
- }
43269
- else {
43270
- chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
43271
- }
43272
- });
43273
43293
  chartInstance.updateViewBox({
43274
- x1: viewBox.x1 - chart.getRootNode().table.scrollLeft,
43275
- x2: viewBox.x2 - chart.getRootNode().table.scrollLeft,
43276
- y1: viewBox.y1 - chart.getRootNode().table.scrollTop,
43277
- y2: viewBox.y2 - chart.getRootNode().table.scrollTop
43294
+ x1: 0,
43295
+ x2: viewBox.x2 - viewBox.x1,
43296
+ y1: 0,
43297
+ y2: viewBox.y2 - viewBox.y1
43278
43298
  }, false, false);
43279
- const table = chart.getRootNode().table;
43280
- table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
43281
- if (typeof dataId === 'string') {
43282
- chartInstance.updateDataSync(dataId, data ?? []);
43283
- }
43284
- else {
43285
- const dataBatch = [];
43286
- for (const dataIdStr in dataId) {
43287
- const dataIdAndField = dataId[dataIdStr];
43288
- const series = spec.series.find((item) => item?.data?.id === dataIdStr);
43289
- dataBatch.push({
43290
- id: dataIdStr,
43291
- values: dataIdAndField
43292
- ? data?.filter((item) => {
43293
- return item.hasOwnProperty(dataIdAndField);
43294
- }) ?? []
43295
- : data ?? [],
43296
- fields: series?.data?.fields
43297
- });
43298
- if (!chartInstance.updateFullDataSync) {
43299
- chartInstance.updateDataSync(dataIdStr, dataIdAndField
43300
- ? data?.filter((item) => {
43301
- return item.hasOwnProperty(dataIdAndField);
43302
- }) ?? []
43303
- : data ?? []);
43299
+ const chartStage = chartInstance.getStage();
43300
+ const matrix = chart.globalTransMatrix.clone();
43301
+ const stageMatrix = chart.stage.window.getViewBoxTransform();
43302
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
43303
+ chartStage.window.setViewBoxTransform &&
43304
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
43305
+ const { table } = chart.getRootNode();
43306
+ let updateSpec = false;
43307
+ if (table.options.specFormat) {
43308
+ const formatResult = table.options.specFormat(chart.attribute.spec);
43309
+ if (formatResult.needFormatSpec && formatResult.spec) {
43310
+ const spec = formatResult.spec;
43311
+ chartInstance.updateSpecSync(spec);
43312
+ updateSpec = true;
43313
+ }
43314
+ }
43315
+ if (!updateSpec) {
43316
+ axes?.forEach((axis, index) => {
43317
+ if (axis.type === 'band') {
43318
+ chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
43304
43319
  }
43320
+ else {
43321
+ chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
43322
+ }
43323
+ });
43324
+ table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
43325
+ if (typeof dataId === 'string') {
43326
+ chartInstance.updateDataSync(dataId, data ?? []);
43327
+ }
43328
+ else {
43329
+ const dataBatch = [];
43330
+ for (const dataIdStr in dataId) {
43331
+ const dataIdAndField = dataId[dataIdStr];
43332
+ const series = spec.series.find((item) => item?.data?.id === dataIdStr);
43333
+ dataBatch.push({
43334
+ id: dataIdStr,
43335
+ values: dataIdAndField
43336
+ ? data?.filter((item) => {
43337
+ return item.hasOwnProperty(dataIdAndField);
43338
+ }) ?? []
43339
+ : data ?? [],
43340
+ fields: series?.data?.fields
43341
+ });
43342
+ if (!chartInstance.updateFullDataSync) {
43343
+ chartInstance.updateDataSync(dataIdStr, dataIdAndField
43344
+ ? data?.filter((item) => {
43345
+ return item.hasOwnProperty(dataIdAndField);
43346
+ }) ?? []
43347
+ : data ?? []);
43348
+ }
43349
+ }
43350
+ chartInstance.updateFullDataSync?.(dataBatch);
43305
43351
  }
43306
- chartInstance.updateFullDataSync?.(dataBatch);
43307
43352
  }
43308
43353
  const sg = chartInstance.getStage();
43309
43354
  cacheStageCanvas(sg, chart);
@@ -43365,7 +43410,7 @@
43365
43410
  }
43366
43411
 
43367
43412
  const ChartRender = Symbol.for('ChartRender');
43368
- let DefaultCanvasChartRender = class DefaultCanvasChartRender {
43413
+ let DefaultCanvasChartRender = class DefaultCanvasChartRender extends BaseRender {
43369
43414
  type;
43370
43415
  numberType = CHART_NUMBER_TYPE;
43371
43416
  drawShape(chart, context, x, y, drawContext, params, fillCb, strokeCb) {
@@ -43373,6 +43418,7 @@
43373
43418
  const { dataId, data, spec } = chart.attribute;
43374
43419
  chart.getViewBox();
43375
43420
  const { width = groupAttribute.width, height = groupAttribute.height } = chart.attribute;
43421
+ const { table } = chart.getRootNode();
43376
43422
  const { active, cacheCanvas, activeChartInstance } = chart;
43377
43423
  if (!active && cacheCanvas) {
43378
43424
  if (isArray$1(cacheCanvas)) {
@@ -43386,6 +43432,27 @@
43386
43432
  }
43387
43433
  }
43388
43434
  else if (activeChartInstance) {
43435
+ if (table.options.specFormat) {
43436
+ const formatResult = table.options.specFormat(chart.attribute.spec);
43437
+ if (formatResult.needFormatSpec && formatResult.spec) {
43438
+ const spec = formatResult.spec;
43439
+ activeChartInstance.updateSpecSync(spec);
43440
+ return;
43441
+ }
43442
+ }
43443
+ const viewBox = chart.getViewBox();
43444
+ activeChartInstance.updateViewBox({
43445
+ x1: 0,
43446
+ x2: viewBox.x2 - viewBox.x1,
43447
+ y1: 0,
43448
+ y2: viewBox.y2 - viewBox.y1
43449
+ }, false, false);
43450
+ const chartStage = activeChartInstance.getStage();
43451
+ chartStage.needRender = true;
43452
+ const matrix = chart.globalTransMatrix.clone();
43453
+ const stageMatrix = chart.stage.window.getViewBoxTransform().clone();
43454
+ stageMatrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
43455
+ chartStage.window.setViewBoxTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
43389
43456
  if (typeof dataId === 'string') {
43390
43457
  activeChartInstance.updateDataSync(dataId, data ?? []);
43391
43458
  }
@@ -43415,13 +43482,13 @@
43415
43482
  }
43416
43483
  }
43417
43484
  else {
43418
- if (chart.getRootNode().table.internalProps.renderChartAsync) {
43485
+ if (table.internalProps.renderChartAsync) {
43419
43486
  if (chartRenderKeys.indexOf(`${chart.parent.col}+${chart.parent.row}`) === -1) {
43420
43487
  chartRenderKeys.push(`${chart.parent.col}+${chart.parent.row}`);
43421
43488
  chartRenderQueueList.push(chart);
43422
43489
  }
43423
43490
  if (!IsHandlingChartQueue()) {
43424
- startRenderChartQueue(chart.getRootNode().table);
43491
+ startRenderChartQueue(table);
43425
43492
  }
43426
43493
  }
43427
43494
  else {
@@ -43430,31 +43497,7 @@
43430
43497
  }
43431
43498
  }
43432
43499
  draw(chart, renderService, drawContext, params) {
43433
- const { context } = drawContext;
43434
- if (!context) {
43435
- return;
43436
- }
43437
- const { clip } = chart.attribute;
43438
- if (clip) {
43439
- context.save();
43440
- }
43441
- else {
43442
- context.highPerformanceSave();
43443
- }
43444
- context.transformFromMatrix(chart.transMatrix, true);
43445
- context.beginPath();
43446
- if (params.skipDraw) {
43447
- this.drawShape(chart, context, 0, 0, drawContext, params, () => false, () => false);
43448
- }
43449
- else {
43450
- this.drawShape(chart, context, 0, 0, drawContext);
43451
- }
43452
- if (clip) {
43453
- context.restore();
43454
- }
43455
- else {
43456
- context.highPerformanceRestore();
43457
- }
43500
+ this._draw(chart, {}, false, drawContext, params);
43458
43501
  }
43459
43502
  };
43460
43503
  DefaultCanvasChartRender = __decorate([
@@ -48289,6 +48332,15 @@
48289
48332
  });
48290
48333
  }
48291
48334
  }
48335
+ function clearCellChartCacheImage(col, row, scenegraph) {
48336
+ const cellGroup = scenegraph.getCell(col, row);
48337
+ cellGroup.children.forEach((node) => {
48338
+ if (node.type === 'chart') {
48339
+ node.cacheCanvas = null;
48340
+ node.addUpdateBoundTag();
48341
+ }
48342
+ });
48343
+ }
48292
48344
  function updateChartData(scenegraph) {
48293
48345
  const table = scenegraph.table;
48294
48346
  for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
@@ -49150,7 +49202,12 @@
49150
49202
  setPoptipTheme(this.table.theme.textPopTipStyle);
49151
49203
  let width;
49152
49204
  let height;
49153
- if (Env.mode === 'node') {
49205
+ if (table.options.canvas && table.options.viewBox) {
49206
+ vglobal.setEnv('browser');
49207
+ width = table.options.viewBox.x2 - table.options.viewBox.x1;
49208
+ height = table.options.viewBox.y2 - table.options.viewBox.y1;
49209
+ }
49210
+ else if (Env.mode === 'node') {
49154
49211
  vglobal.setEnv('node', table.options.modeParams);
49155
49212
  width = table.canvasWidth;
49156
49213
  height = table.canvasHeight;
@@ -49168,9 +49225,15 @@
49168
49225
  background: table.theme.underlayBackgroundColor,
49169
49226
  dpr: table.internalProps.pixelRatio,
49170
49227
  enableLayout: true,
49171
- afterRender: () => {
49228
+ beforeRender: (stage) => {
49229
+ this.table.options.beforeRender && this.table.options.beforeRender(stage);
49230
+ },
49231
+ afterRender: (stage) => {
49232
+ this.table.options.afterRender && this.table.options.afterRender(stage);
49172
49233
  this.table.fireListeners('after_render', null);
49173
49234
  },
49235
+ canvasControled: !table.options.canvas,
49236
+ viewBox: table.options.viewBox,
49174
49237
  ...table.options.renderOption
49175
49238
  });
49176
49239
  this.stage.defaultLayer.setTheme({
@@ -54355,17 +54418,19 @@
54355
54418
  e.preventDefault();
54356
54419
  }
54357
54420
  });
54358
- handler.on(table.getContainer(), 'resize', e => {
54359
- if (e.width === 0 && e.height === 0) {
54360
- return;
54361
- }
54362
- if (!isValid$1(table.options.pixelRatio)) {
54363
- table.setPixelRatio(getPixelRatio());
54364
- }
54365
- if (!e.windowSizeNotChange) {
54366
- table.resize();
54367
- }
54368
- });
54421
+ if (!table.options.canvas) {
54422
+ handler.on(table.getContainer(), 'resize', e => {
54423
+ if (e.width === 0 && e.height === 0) {
54424
+ return;
54425
+ }
54426
+ if (!isValid$1(table.options.pixelRatio)) {
54427
+ table.setPixelRatio(getPixelRatio());
54428
+ }
54429
+ if (!e.windowSizeNotChange) {
54430
+ table.resize();
54431
+ }
54432
+ });
54433
+ }
54369
54434
  function pasteHtmlToTable(item) {
54370
54435
  const ranges = table.stateManager.select.ranges;
54371
54436
  const selectRangeLength = ranges.length;
@@ -54913,7 +54978,7 @@
54913
54978
  this.table = table;
54914
54979
  this.handleTextStickBindId = [];
54915
54980
  this.inertiaScroll = new InertiaScroll(table.stateManager);
54916
- if (Env.mode === 'node') {
54981
+ if (Env.mode === 'node' || table.options.disableInteraction) {
54917
54982
  return;
54918
54983
  }
54919
54984
  this.bindOuterEvent();
@@ -57475,6 +57540,7 @@
57475
57540
  }
57476
57541
 
57477
57542
  class FocusInput extends EventTarget {
57543
+ _container;
57478
57544
  _table;
57479
57545
  _input;
57480
57546
  constructor(table, parentElement) {
@@ -57494,6 +57560,7 @@
57494
57560
  input.dataset.vtable = 'vtable';
57495
57561
  input.readOnly = true;
57496
57562
  parentElement.appendChild(div);
57563
+ this._container = div;
57497
57564
  }
57498
57565
  focus() {
57499
57566
  this._input.focus({ preventScroll: true });
@@ -57513,6 +57580,7 @@
57513
57580
  return this._input;
57514
57581
  }
57515
57582
  release() {
57583
+ this._container.parentElement?.removeChild(this._container);
57516
57584
  }
57517
57585
  }
57518
57586
 
@@ -57632,7 +57700,8 @@
57632
57700
  height: this.table.tableNoFrameHeight
57633
57701
  });
57634
57702
  const legend = new DiscreteLegend(merge({}, attrs, {
57635
- defaultSelected: this.selectedData
57703
+ defaultSelected: this.selectedData,
57704
+ disableTriggerEvent: this.table.options.disableInteraction
57636
57705
  }));
57637
57706
  legend.name = 'legend';
57638
57707
  this.legendComponent = legend;
@@ -59194,6 +59263,246 @@
59194
59263
  return customTree;
59195
59264
  }
59196
59265
 
59266
+ function getRowAt(absoluteY, _this) {
59267
+ const frozen = _getTargetFrozenRowAt(_this, absoluteY);
59268
+ if (frozen) {
59269
+ return frozen;
59270
+ }
59271
+ let row = getTargetRowAt(absoluteY, _this);
59272
+ if (!row) {
59273
+ row = {
59274
+ top: -1,
59275
+ row: -1,
59276
+ bottom: -1,
59277
+ height: -1
59278
+ };
59279
+ }
59280
+ return row;
59281
+ }
59282
+ function getColAt(absoluteX, _this) {
59283
+ const frozen = _getTargetFrozenColAt(_this, absoluteX);
59284
+ if (frozen) {
59285
+ return frozen;
59286
+ }
59287
+ let col = getTargetColAt(absoluteX, _this);
59288
+ if (!col) {
59289
+ col = {
59290
+ left: -1,
59291
+ col: -1,
59292
+ right: -1,
59293
+ width: 1
59294
+ };
59295
+ }
59296
+ return col;
59297
+ }
59298
+ function getCellAt(absoluteX, absoluteY, _this) {
59299
+ const rowInfo = getRowAt(absoluteY, _this);
59300
+ const { row, top, bottom, height } = rowInfo;
59301
+ const colInfo = getColAt(absoluteX, _this);
59302
+ const { col, left, right, width } = colInfo;
59303
+ const rect = {
59304
+ left,
59305
+ right,
59306
+ top,
59307
+ bottom,
59308
+ width,
59309
+ height
59310
+ };
59311
+ return {
59312
+ row,
59313
+ col,
59314
+ rect
59315
+ };
59316
+ }
59317
+ function getTargetColAt(absoluteX, _this) {
59318
+ if (absoluteX === 0) {
59319
+ return { left: 0, col: 0, right: 0, width: 0 };
59320
+ }
59321
+ const findBefore = (startCol, startRight) => {
59322
+ let right = startRight;
59323
+ for (let col = startCol; col >= 0; col--) {
59324
+ const width = _this.getColWidth(col);
59325
+ const left = right - width;
59326
+ if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) {
59327
+ return {
59328
+ left,
59329
+ col,
59330
+ right,
59331
+ width
59332
+ };
59333
+ }
59334
+ right = left;
59335
+ }
59336
+ return null;
59337
+ };
59338
+ const findAfter = (startCol, startRight) => {
59339
+ let left = startRight - _this.getColWidth(startCol);
59340
+ const { colCount } = _this.internalProps;
59341
+ for (let col = startCol; col < colCount; col++) {
59342
+ const width = _this.getColWidth(col);
59343
+ const right = left + width;
59344
+ if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) {
59345
+ return {
59346
+ left,
59347
+ col,
59348
+ right,
59349
+ width
59350
+ };
59351
+ }
59352
+ left = right;
59353
+ }
59354
+ return null;
59355
+ };
59356
+ const candCol = computeTargetColByX(absoluteX, _this);
59357
+ const right = _this.getColsWidth(0, candCol);
59358
+ if (absoluteX >= right) {
59359
+ return findAfter(candCol, right);
59360
+ }
59361
+ return findBefore(candCol, right);
59362
+ }
59363
+ function getTargetRowAt(absoluteY, _this) {
59364
+ if (absoluteY === 0) {
59365
+ return { top: 0, row: 0, bottom: 0, height: 0 };
59366
+ }
59367
+ const findBefore = (startRow, startBottom) => {
59368
+ let bottom = startBottom;
59369
+ for (let row = startRow; row >= 0; row--) {
59370
+ const height = _this.getRowHeight(row);
59371
+ const top = bottom - height;
59372
+ if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) {
59373
+ return {
59374
+ top,
59375
+ row,
59376
+ bottom,
59377
+ height
59378
+ };
59379
+ }
59380
+ bottom = top;
59381
+ }
59382
+ return null;
59383
+ };
59384
+ const findAfter = (startRow, startBottom) => {
59385
+ let top = startBottom - _this.getRowHeight(startRow);
59386
+ const { rowCount } = _this.internalProps;
59387
+ for (let row = startRow; row < rowCount; row++) {
59388
+ const height = _this.getRowHeight(row);
59389
+ const bottom = top + height;
59390
+ if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) {
59391
+ return {
59392
+ top,
59393
+ row,
59394
+ bottom,
59395
+ height
59396
+ };
59397
+ }
59398
+ top = bottom;
59399
+ }
59400
+ return null;
59401
+ };
59402
+ const candRow = computeTargetRowByY(absoluteY, _this);
59403
+ const bottom = _this.getRowsHeight(0, candRow);
59404
+ if (absoluteY >= bottom) {
59405
+ return findAfter(candRow, bottom);
59406
+ }
59407
+ return findBefore(candRow, bottom);
59408
+ }
59409
+ function getTargetColAtConsiderRightFrozen(absoluteX, isConsider, _this) {
59410
+ if (absoluteX === 0) {
59411
+ return { left: 0, col: 0, right: 0, width: 0 };
59412
+ }
59413
+ if (isConsider &&
59414
+ absoluteX > _this.tableNoFrameWidth - _this.getRightFrozenColsWidth() &&
59415
+ absoluteX < _this.tableNoFrameWidth) {
59416
+ for (let i = 0; i < _this.rightFrozenColCount; i++) {
59417
+ if (absoluteX > _this.tableNoFrameWidth - _this.getColsWidth(_this.colCount - i - 1, _this.colCount - 1)) {
59418
+ return {
59419
+ col: _this.colCount - i - 1,
59420
+ left: undefined,
59421
+ right: undefined,
59422
+ width: undefined
59423
+ };
59424
+ }
59425
+ }
59426
+ }
59427
+ return getTargetColAt(absoluteX, _this);
59428
+ }
59429
+ function getTargetRowAtConsiderBottomFrozen(absoluteY, isConsider, _this) {
59430
+ if (absoluteY === 0) {
59431
+ return { top: 0, row: 0, bottom: 0, height: 0 };
59432
+ }
59433
+ if (isConsider &&
59434
+ absoluteY > _this.tableNoFrameHeight - _this.getBottomFrozenRowsHeight() &&
59435
+ absoluteY < _this.tableNoFrameHeight) {
59436
+ for (let i = 0; i < _this.rightFrozenColCount; i++) {
59437
+ if (absoluteY > _this.tableNoFrameHeight - _this.getRowsHeight(_this.rowCount - i - 1, _this.rowCount - 1)) {
59438
+ return {
59439
+ row: _this.rowCount - i - 1,
59440
+ top: undefined,
59441
+ bottom: undefined,
59442
+ height: undefined
59443
+ };
59444
+ }
59445
+ }
59446
+ }
59447
+ return getTargetRowAt(absoluteY, _this);
59448
+ }
59449
+ function computeTargetRowByY(absoluteY, _this) {
59450
+ let defaultRowHeight = _this.internalProps.defaultRowHeight;
59451
+ if (_this._rowRangeHeightsMap.get(`$0$${_this.rowCount - 1}`)) {
59452
+ defaultRowHeight = _this._rowRangeHeightsMap.get(`$0$${_this.rowCount - 1}`) / _this.rowCount;
59453
+ }
59454
+ return Math.min(Math.ceil(absoluteY / defaultRowHeight), _this.rowCount - 1);
59455
+ }
59456
+ function computeTargetColByX(absoluteX, _this) {
59457
+ if (_this._colRangeWidthsMap.get(`$0$${_this.colCount - 1}`)) {
59458
+ let startCol = 0;
59459
+ let endCol = _this.colCount - 1;
59460
+ while (endCol - startCol > 1) {
59461
+ const midCol = Math.floor((startCol + endCol) / 2);
59462
+ if (absoluteX < _this._colRangeWidthsMap.get(`$0$${midCol}`)) {
59463
+ endCol = midCol;
59464
+ }
59465
+ else if (absoluteX > _this._colRangeWidthsMap.get(`$0$${midCol}`)) {
59466
+ startCol = midCol;
59467
+ }
59468
+ else {
59469
+ return midCol;
59470
+ }
59471
+ }
59472
+ return endCol;
59473
+ }
59474
+ return Math.min(Math.ceil(absoluteX / _this.internalProps.defaultColWidth), _this.colCount - 1);
59475
+ }
59476
+ function getCellAtRelativePosition(x, y, _this) {
59477
+ x -= _this.tableX;
59478
+ y -= _this.tableY;
59479
+ let bottomFrozen = false;
59480
+ if (y > _this.tableNoFrameHeight - _this.getBottomFrozenRowsHeight() && y < _this.tableNoFrameHeight) {
59481
+ bottomFrozen = true;
59482
+ }
59483
+ let rightFrozen = false;
59484
+ if (x > _this.tableNoFrameWidth - _this.getRightFrozenColsWidth() && x < _this.tableNoFrameWidth) {
59485
+ rightFrozen = true;
59486
+ }
59487
+ const colInfo = getTargetColAtConsiderRightFrozen(rightFrozen ? x : x + _this.scrollLeft, rightFrozen, _this);
59488
+ const rowInfo = getTargetRowAtConsiderBottomFrozen(bottomFrozen ? y : y + _this.scrollTop, bottomFrozen, _this);
59489
+ const { row, top, bottom, height } = rowInfo;
59490
+ const { col, left, right, width } = colInfo;
59491
+ const rect = {
59492
+ left,
59493
+ right,
59494
+ top,
59495
+ bottom,
59496
+ width,
59497
+ height
59498
+ };
59499
+ return {
59500
+ row,
59501
+ col,
59502
+ rect
59503
+ };
59504
+ }
59505
+
59197
59506
  const { toBoxArray } = style;
59198
59507
  const { isTouchEvent } = event;
59199
59508
  const rangeReg = /^\$(\d+)\$(\d+)$/;
@@ -59226,7 +59535,7 @@
59226
59535
  return TABLE_EVENT_TYPE;
59227
59536
  }
59228
59537
  options;
59229
- version = "1.3.1";
59538
+ version = "1.3.2-alpha.1";
59230
59539
  pagination;
59231
59540
  id = `VTable${Date.now()}`;
59232
59541
  headerStyleCache;
@@ -59240,7 +59549,7 @@
59240
59549
  _hasAutoImageColumn;
59241
59550
  constructor(container, options = {}) {
59242
59551
  super();
59243
- if (!container && options.mode !== 'node') {
59552
+ if (!container && options.mode !== 'node' && !options.canvas) {
59244
59553
  throw new Error("vtable's container is undefined");
59245
59554
  }
59246
59555
  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;
@@ -59278,7 +59587,14 @@
59278
59587
  if (typeof allowFrozenColCount === 'number' && allowFrozenColCount <= 0) {
59279
59588
  this.showFrozenIcon = false;
59280
59589
  }
59281
- if (Env.mode !== 'node') {
59590
+ if (this.options.canvas) {
59591
+ internalProps.element = this.options.canvas.parentElement;
59592
+ internalProps.element.style.position = 'relative';
59593
+ internalProps.focusControl = new FocusInput(this, internalProps.element);
59594
+ internalProps.canvas = this.options.canvas;
59595
+ internalProps.context = internalProps.canvas.getContext('2d');
59596
+ }
59597
+ else if (Env.mode !== 'node') {
59282
59598
  internalProps.element = createRootElement(this.padding);
59283
59599
  internalProps.focusControl = new FocusInput(this, internalProps.element);
59284
59600
  internalProps.canvas = document.createElement('canvas');
@@ -59675,7 +59991,21 @@
59675
59991
  const { padding } = this;
59676
59992
  let widthP = 0;
59677
59993
  let heightP = 0;
59678
- if (Env.mode === 'browser') {
59994
+ this.tableX = 0;
59995
+ this.tableY = 0;
59996
+ if (this.options.canvas && this.options.viewBox) {
59997
+ widthP = this.options.viewBox.x2 - this.options.viewBox.x1;
59998
+ heightP = this.options.viewBox.y2 - this.options.viewBox.y1;
59999
+ if (this?.scenegraph?.stage) {
60000
+ if (this.options.viewBox) {
60001
+ this.scenegraph.stage.setViewBox(this.options.viewBox, false);
60002
+ }
60003
+ else {
60004
+ this.scenegraph.stage.resize(widthP, heightP);
60005
+ }
60006
+ }
60007
+ }
60008
+ else if (Env.mode === 'browser') {
59679
60009
  const element = this.getElement();
59680
60010
  let widthWithoutPadding = 0;
59681
60011
  let heightWithoutPadding = 0;
@@ -59734,6 +60064,23 @@
59734
60064
  }
59735
60065
  }
59736
60066
  }
60067
+ updateViewBox(newViewBox) {
60068
+ const oldWidth = this.options?.viewBox.x2 ?? 0 - this.options?.viewBox.x1 ?? 0;
60069
+ const oldHeight = this.options?.viewBox.y2 ?? 0 - this.options?.viewBox.y1 ?? 0;
60070
+ const newWidth = newViewBox.x2 - newViewBox.x1;
60071
+ const newHeight = newViewBox.y2 - newViewBox.y1;
60072
+ this.options.viewBox = newViewBox;
60073
+ if (oldWidth !== newWidth || oldHeight !== newHeight) {
60074
+ this.resize();
60075
+ }
60076
+ else {
60077
+ this.scenegraph.stage.setViewBox(this.options.viewBox, true);
60078
+ }
60079
+ }
60080
+ setViewBoxTransform(a, b, c, d, e, f) {
60081
+ this.internalProps.modifiedViewBoxTransform = true;
60082
+ this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
60083
+ }
59737
60084
  get rowHierarchyType() {
59738
60085
  return 'grid';
59739
60086
  }
@@ -60184,55 +60531,16 @@
60184
60531
  return null;
60185
60532
  }
60186
60533
  getRowAt(absoluteY) {
60187
- const frozen = _getTargetFrozenRowAt(this, absoluteY);
60188
- if (frozen) {
60189
- return frozen;
60190
- }
60191
- let row = this.getTargetRowAt(absoluteY);
60192
- if (!row) {
60193
- row = {
60194
- top: -1,
60195
- row: -1,
60196
- bottom: -1,
60197
- height: -1
60198
- };
60199
- }
60200
- return row;
60534
+ return getRowAt(absoluteY, this);
60201
60535
  }
60202
60536
  getColAt(absoluteX) {
60203
- const frozen = _getTargetFrozenColAt(this, absoluteX);
60204
- if (frozen) {
60205
- return frozen;
60206
- }
60207
- let col = this.getTargetColAt(absoluteX);
60208
- if (!col) {
60209
- col = {
60210
- left: -1,
60211
- col: -1,
60212
- right: -1,
60213
- width: 1
60214
- };
60215
- }
60216
- return col;
60537
+ return getColAt(absoluteX, this);
60217
60538
  }
60218
60539
  getCellAt(absoluteX, absoluteY) {
60219
- const rowInfo = this.getRowAt(absoluteY);
60220
- const { row, top, bottom, height } = rowInfo;
60221
- const colInfo = this.getColAt(absoluteX);
60222
- const { col, left, right, width } = colInfo;
60223
- const rect = {
60224
- left,
60225
- right,
60226
- top,
60227
- bottom,
60228
- width,
60229
- height
60230
- };
60231
- return {
60232
- row,
60233
- col,
60234
- rect
60235
- };
60540
+ return getCellAt(absoluteX, absoluteY, this);
60541
+ }
60542
+ getCellAtRelativePosition(relativeX, relativeY) {
60543
+ return getCellAtRelativePosition(relativeX, relativeY, this);
60236
60544
  }
60237
60545
  _checkRowCol(col, row) {
60238
60546
  if (col >= 0 && col < this.colCount && row >= 0 && row < this.rowCount) {
@@ -60287,6 +60595,8 @@
60287
60595
  const visibleRect = this.getVisibleRect();
60288
60596
  rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0));
60289
60597
  rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0));
60598
+ rect.offsetLeft(this.options.viewBox?.x1 ?? 0);
60599
+ rect.offsetTop(this.options.viewBox?.y1 ?? 0);
60290
60600
  return rect;
60291
60601
  }
60292
60602
  getVisibleRect() {
@@ -60446,8 +60756,9 @@
60446
60756
  }
60447
60757
  this.scenegraph.stage.release();
60448
60758
  this.scenegraph.proxy.release();
60759
+ internalProps.focusControl.release();
60449
60760
  const { parentElement } = internalProps.element;
60450
- if (parentElement) {
60761
+ if (parentElement && !this.options.canvas) {
60451
60762
  parentElement.removeChild(internalProps.element);
60452
60763
  }
60453
60764
  this.editorManager?.editingEditor?.onEnd?.();
@@ -60670,171 +60981,29 @@
60670
60981
  const currentHeight = rect.height;
60671
60982
  const originHeight = this.canvas.offsetHeight || currentHeight;
60672
60983
  const heightRatio = currentHeight / originHeight;
60673
- const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0);
60674
- const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0);
60675
- return { x, y, inTable };
60984
+ const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0) - (this.options.viewBox?.x1 ?? 0);
60985
+ const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0) - (this.options.viewBox?.y1 ?? 0);
60986
+ const point = { x, y, inTable };
60987
+ if (this.internalProps.modifiedViewBoxTransform && this.scenegraph.stage.window.getViewBoxTransform()) {
60988
+ const transform = this.scenegraph.stage.window.getViewBoxTransform();
60989
+ transform.transformPoint(point, point);
60990
+ }
60991
+ return point;
60676
60992
  }
60677
60993
  getTheme() {
60678
60994
  return this.internalProps.theme;
60679
60995
  }
60680
60996
  getTargetColAt(absoluteX) {
60681
- if (absoluteX === 0) {
60682
- return { left: 0, col: 0, right: 0, width: 0 };
60683
- }
60684
- const findBefore = (startCol, startRight) => {
60685
- let right = startRight;
60686
- for (let col = startCol; col >= 0; col--) {
60687
- const width = this.getColWidth(col);
60688
- const left = right - width;
60689
- if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) {
60690
- return {
60691
- left,
60692
- col,
60693
- right,
60694
- width
60695
- };
60696
- }
60697
- right = left;
60698
- }
60699
- return null;
60700
- };
60701
- const findAfter = (startCol, startRight) => {
60702
- let left = startRight - this.getColWidth(startCol);
60703
- const { colCount } = this.internalProps;
60704
- for (let col = startCol; col < colCount; col++) {
60705
- const width = this.getColWidth(col);
60706
- const right = left + width;
60707
- if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) {
60708
- return {
60709
- left,
60710
- col,
60711
- right,
60712
- width
60713
- };
60714
- }
60715
- left = right;
60716
- }
60717
- return null;
60718
- };
60719
- const candCol = this.computeTargetColByX(absoluteX);
60720
- const right = this.getColsWidth(0, candCol);
60721
- if (absoluteX >= right) {
60722
- return findAfter(candCol, right);
60723
- }
60724
- return findBefore(candCol, right);
60997
+ return getTargetColAt(absoluteX, this);
60725
60998
  }
60726
60999
  getTargetRowAt(absoluteY) {
60727
- if (absoluteY === 0) {
60728
- return { top: 0, row: 0, bottom: 0, height: 0 };
60729
- }
60730
- const findBefore = (startRow, startBottom) => {
60731
- let bottom = startBottom;
60732
- for (let row = startRow; row >= 0; row--) {
60733
- const height = this.getRowHeight(row);
60734
- const top = bottom - height;
60735
- if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) {
60736
- return {
60737
- top,
60738
- row,
60739
- bottom,
60740
- height
60741
- };
60742
- }
60743
- bottom = top;
60744
- }
60745
- return null;
60746
- };
60747
- const findAfter = (startRow, startBottom) => {
60748
- let top = startBottom - this.getRowHeight(startRow);
60749
- const { rowCount } = this.internalProps;
60750
- for (let row = startRow; row < rowCount; row++) {
60751
- const height = this.getRowHeight(row);
60752
- const bottom = top + height;
60753
- if (Math.round(top) <= Math.round(absoluteY) && Math.round(absoluteY) < Math.round(bottom)) {
60754
- return {
60755
- top,
60756
- row,
60757
- bottom,
60758
- height
60759
- };
60760
- }
60761
- top = bottom;
60762
- }
60763
- return null;
60764
- };
60765
- const candRow = this.computeTargetRowByY(absoluteY);
60766
- const bottom = this.getRowsHeight(0, candRow);
60767
- if (absoluteY >= bottom) {
60768
- return findAfter(candRow, bottom);
60769
- }
60770
- return findBefore(candRow, bottom);
61000
+ return getTargetRowAt(absoluteY, this);
60771
61001
  }
60772
61002
  getTargetColAtConsiderRightFrozen(absoluteX, isConsider) {
60773
- if (absoluteX === 0) {
60774
- return { left: 0, col: 0, right: 0, width: 0 };
60775
- }
60776
- if (isConsider &&
60777
- absoluteX > this.tableNoFrameWidth - this.getRightFrozenColsWidth() &&
60778
- absoluteX < this.tableNoFrameWidth) {
60779
- for (let i = 0; i < this.rightFrozenColCount; i++) {
60780
- if (absoluteX > this.tableNoFrameWidth - this.getColsWidth(this.colCount - i - 1, this.colCount - 1)) {
60781
- return {
60782
- col: this.colCount - i - 1,
60783
- left: undefined,
60784
- right: undefined,
60785
- width: undefined
60786
- };
60787
- }
60788
- }
60789
- }
60790
- return this.getTargetColAt(absoluteX);
61003
+ return getTargetColAtConsiderRightFrozen(absoluteX, isConsider, this);
60791
61004
  }
60792
61005
  getTargetRowAtConsiderBottomFrozen(absoluteY, isConsider) {
60793
- if (absoluteY === 0) {
60794
- return { top: 0, row: 0, bottom: 0, height: 0 };
60795
- }
60796
- if (isConsider &&
60797
- absoluteY > this.tableNoFrameHeight - this.getBottomFrozenRowsHeight() &&
60798
- absoluteY < this.tableNoFrameHeight) {
60799
- for (let i = 0; i < this.rightFrozenColCount; i++) {
60800
- if (absoluteY > this.tableNoFrameHeight - this.getRowsHeight(this.rowCount - i - 1, this.rowCount - 1)) {
60801
- return {
60802
- row: this.rowCount - i - 1,
60803
- top: undefined,
60804
- bottom: undefined,
60805
- height: undefined
60806
- };
60807
- }
60808
- }
60809
- }
60810
- return this.getTargetRowAt(absoluteY);
60811
- }
60812
- computeTargetRowByY(absoluteY) {
60813
- let defaultRowHeight = this.internalProps.defaultRowHeight;
60814
- if (this._rowRangeHeightsMap.get(`$0$${this.rowCount - 1}`)) {
60815
- defaultRowHeight = this._rowRangeHeightsMap.get(`$0$${this.rowCount - 1}`) / this.rowCount;
60816
- }
60817
- return Math.min(Math.ceil(absoluteY / defaultRowHeight), this.rowCount - 1);
60818
- }
60819
- computeTargetColByX(absoluteX) {
60820
- if (this._colRangeWidthsMap.get(`$0$${this.colCount - 1}`)) {
60821
- let startCol = 0;
60822
- let endCol = this.colCount - 1;
60823
- while (endCol - startCol > 1) {
60824
- const midCol = Math.floor((startCol + endCol) / 2);
60825
- if (absoluteX < this._colRangeWidthsMap.get(`$0$${midCol}`)) {
60826
- endCol = midCol;
60827
- }
60828
- else if (absoluteX > this._colRangeWidthsMap.get(`$0$${midCol}`)) {
60829
- startCol = midCol;
60830
- }
60831
- else {
60832
- return midCol;
60833
- }
60834
- }
60835
- return endCol;
60836
- }
60837
- return Math.min(Math.ceil(absoluteX / this.internalProps.defaultColWidth), this.colCount - 1);
61006
+ return getTargetRowAtConsiderBottomFrozen(absoluteY, isConsider, this);
60838
61007
  }
60839
61008
  clearSelected() {
60840
61009
  this.stateManager.updateSelectPos(-1, -1);
@@ -71575,6 +71744,14 @@
71575
71744
  updateChartData(this.scenegraph);
71576
71745
  this.render();
71577
71746
  }
71747
+ clearChartCacheImage(col, row) {
71748
+ if (isNumber$2(col) && isNumber$2(row)) {
71749
+ clearCellChartCacheImage(col, row, this.scenegraph);
71750
+ }
71751
+ else {
71752
+ clearChartCacheImage(this.scenegraph);
71753
+ }
71754
+ }
71578
71755
  getLegendSelected() {
71579
71756
  const selected = [];
71580
71757
  this.internalProps.legends?.forEach(legend => {
@@ -72368,7 +72545,7 @@
72368
72545
  }
72369
72546
 
72370
72547
  registerForVrender();
72371
- const version = "1.3.1";
72548
+ const version = "1.3.2-alpha.1";
72372
72549
  function getIcons() {
72373
72550
  return get$2();
72374
72551
  }