@visactor/vtable 0.19.1 → 0.19.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 (83) 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/core/BaseTable.d.ts +4 -0
  5. package/cjs/core/BaseTable.js +50 -34
  6. package/cjs/core/BaseTable.js.map +1 -1
  7. package/cjs/event/event.js +2 -1
  8. package/cjs/event/event.js.map +1 -1
  9. package/cjs/event/listener/container-dom.js +1 -1
  10. package/cjs/event/listener/container-dom.js.map +1 -1
  11. package/cjs/event/util.js +2 -2
  12. package/cjs/event/util.js.map +1 -1
  13. package/cjs/index.d.ts +1 -1
  14. package/cjs/index.js +1 -1
  15. package/cjs/index.js.map +1 -1
  16. package/cjs/scenegraph/debug-tool/debug-tool.js +4 -1
  17. package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
  18. package/cjs/scenegraph/graphic/chart.d.ts +1 -0
  19. package/cjs/scenegraph/graphic/chart.js +33 -19
  20. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  21. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
  22. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  23. package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  24. package/cjs/scenegraph/graphic/contributions/chart-render.js +40 -24
  25. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  26. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  27. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  28. package/cjs/scenegraph/layout/compute-col-width.js +2 -2
  29. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  30. package/cjs/scenegraph/layout/compute-row-height.js +2 -2
  31. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  32. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -0
  33. package/cjs/scenegraph/refresh-node/update-chart.js +9 -2
  34. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  35. package/cjs/scenegraph/scenegraph.js +10 -4
  36. package/cjs/scenegraph/scenegraph.js.map +1 -1
  37. package/cjs/ts-types/base-table.d.ts +12 -1
  38. package/cjs/ts-types/base-table.js.map +1 -1
  39. package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
  40. package/cjs/vrender.js.map +1 -1
  41. package/dist/vtable.js +524 -351
  42. package/dist/vtable.min.js +2 -2
  43. package/es/PivotChart.d.ts +1 -0
  44. package/es/PivotChart.js +5 -2
  45. package/es/PivotChart.js.map +1 -1
  46. package/es/core/BaseTable.d.ts +4 -0
  47. package/es/core/BaseTable.js +49 -33
  48. package/es/core/BaseTable.js.map +1 -1
  49. package/es/event/event.js +2 -1
  50. package/es/event/event.js.map +1 -1
  51. package/es/event/listener/container-dom.js +1 -1
  52. package/es/event/listener/container-dom.js.map +1 -1
  53. package/es/event/util.js +2 -2
  54. package/es/event/util.js.map +1 -1
  55. package/es/index.d.ts +1 -1
  56. package/es/index.js +1 -1
  57. package/es/index.js.map +1 -1
  58. package/es/scenegraph/debug-tool/debug-tool.js +4 -1
  59. package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
  60. package/es/scenegraph/graphic/chart.d.ts +1 -0
  61. package/es/scenegraph/graphic/chart.js +32 -20
  62. package/es/scenegraph/graphic/chart.js.map +1 -1
  63. package/es/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
  64. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  65. package/es/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  66. package/es/scenegraph/graphic/contributions/chart-render.js +41 -25
  67. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  68. package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  69. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  70. package/es/scenegraph/layout/compute-col-width.js +2 -2
  71. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  72. package/es/scenegraph/layout/compute-row-height.js +2 -2
  73. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  74. package/es/scenegraph/refresh-node/update-chart.d.ts +1 -0
  75. package/es/scenegraph/refresh-node/update-chart.js +6 -0
  76. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  77. package/es/scenegraph/scenegraph.js +10 -4
  78. package/es/scenegraph/scenegraph.js.map +1 -1
  79. package/es/ts-types/base-table.d.ts +12 -1
  80. package/es/ts-types/base-table.js.map +1 -1
  81. package/es/ts-types/list-table/define/basic-define.js.map +1 -1
  82. package/es/vrender.js.map +1 -1
  83. package/package.json +8 -8
package/dist/vtable.js CHANGED
@@ -4280,7 +4280,7 @@
4280
4280
  strokeBoundsBuffer: 0,
4281
4281
  keepDirIn3d: !0
4282
4282
  });
4283
- const DefaultRichTextAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4283
+ const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), {
4284
4284
  width: 300,
4285
4285
  height: 300,
4286
4286
  ellipsis: !0,
@@ -4830,9 +4830,20 @@
4830
4830
  this._handler.setStyle(style);
4831
4831
  }
4832
4832
  create(params) {
4833
+ var _a, _b;
4833
4834
  this._handler.createWindow(params);
4834
4835
  const windowWH = this._handler.getWH();
4835
- this._width = windowWH.width, this._height = windowWH.height, this.title = this._handler.getTitle(), this.resizable = !0;
4836
+ this._width = windowWH.width, this._height = windowWH.height, params.viewBox ? this.setViewBox(params.viewBox) : !1 !== params.canvasControled ? this.setViewBox({
4837
+ x1: 0,
4838
+ y1: 0,
4839
+ x2: this._width,
4840
+ y2: this._height
4841
+ }) : this.setViewBox({
4842
+ x1: 0,
4843
+ y1: 0,
4844
+ x2: null !== (_a = params.width) && void 0 !== _a ? _a : this._width,
4845
+ y2: null !== (_b = params.height) && void 0 !== _b ? _b : this._height
4846
+ }), this.title = this._handler.getTitle(), this.resizable = !0;
4836
4847
  }
4837
4848
  setWindowHandler(handler) {
4838
4849
  this._handler = handler;
@@ -4873,8 +4884,35 @@
4873
4884
  getContainer() {
4874
4885
  return this._handler.container;
4875
4886
  }
4876
- clearViewBox(viewBox, color) {
4877
- this._handler.clearViewBox(viewBox, color);
4887
+ clearViewBox(color) {
4888
+ this._handler.clearViewBox(color);
4889
+ }
4890
+ setViewBox(viewBox) {
4891
+ this._handler.setViewBox(viewBox);
4892
+ }
4893
+ setViewBoxTransform(a, b, c, d, e, f) {
4894
+ this._handler.setViewBoxTransform(a, b, c, d, e, f);
4895
+ }
4896
+ getViewBox() {
4897
+ return this._handler.getViewBox();
4898
+ }
4899
+ getViewBoxTransform() {
4900
+ return this._handler.getViewBoxTransform();
4901
+ }
4902
+ pointTransform(x, y) {
4903
+ const vb = this._handler.getViewBox(),
4904
+ nextP = {
4905
+ x: x,
4906
+ y: y
4907
+ };
4908
+ return this._handler.getViewBoxTransform().transformPoint({
4909
+ x: x,
4910
+ y: y
4911
+ }, nextP), nextP.x -= vb.x1, nextP.y -= vb.y1, nextP;
4912
+ }
4913
+ hasSubView() {
4914
+ const viewBox = this._handler.getViewBox();
4915
+ return !(0 === viewBox.x1 && 0 === viewBox.y1 && this.width === viewBox.width() && this.height === viewBox.height());
4878
4916
  }
4879
4917
  isVisible(bbox) {
4880
4918
  return this._handler.isVisible(bbox);
@@ -4960,8 +4998,16 @@
4960
4998
  const window = container.get(VWindow),
4961
4999
  bounds = graphic.AABBBounds,
4962
5000
  width = bounds.width(),
4963
- height = bounds.height();
5001
+ height = bounds.height(),
5002
+ x1 = -bounds.x1,
5003
+ y1 = -bounds.y1;
4964
5004
  window.create({
5005
+ viewBox: {
5006
+ x1: x1,
5007
+ y1: y1,
5008
+ x2: bounds.x2,
5009
+ y2: bounds.y2
5010
+ },
4965
5011
  width: width,
4966
5012
  height: height,
4967
5013
  canvas: canvas,
@@ -4970,14 +5016,10 @@
4970
5016
  offscreen: !0,
4971
5017
  title: ""
4972
5018
  });
4973
- const x = -bounds.x1,
4974
- y = -bounds.y1,
4975
- disableCheckGraphicWidthOutRange = stage.params.optimize.disableCheckGraphicWidthOutRange;
5019
+ const disableCheckGraphicWidthOutRange = stage.params.optimize.disableCheckGraphicWidthOutRange;
4976
5020
  stage.params.optimize.disableCheckGraphicWidthOutRange = !0, stage.defaultLayer.getNativeHandler().drawTo(window, [graphic], {
4977
- x: x,
4978
- y: y,
4979
- width: width,
4980
- height: height,
5021
+ transMatrix: window.getViewBoxTransform(),
5022
+ viewBox: window.getViewBox(),
4981
5023
  stage: stage,
4982
5024
  layer: stage.defaultLayer,
4983
5025
  renderService: stage.renderService,
@@ -5316,7 +5358,7 @@
5316
5358
  delete() {
5317
5359
  this.parent && this.parent.removeChild(this);
5318
5360
  }
5319
- removeAllChild() {
5361
+ removeAllChild(deep) {
5320
5362
  if (!this._idMap) return;
5321
5363
  let child = this._firstChild;
5322
5364
  for (; child;) {
@@ -5801,7 +5843,7 @@
5801
5843
  const mappers = this.mappingTable[e.type];
5802
5844
  let target;
5803
5845
  const cacheKey = `${e.canvasX}-${e.canvasY}`;
5804
- if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage) && (null === (_e = null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d[cacheKey]) || void 0 === _e ? void 0 : _e.stage.renderCount) === (null === (_f = this._prePointTargetCache) || void 0 === _f ? void 0 : _f.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.canvasX, e.canvasY, e), e.pickParams || (this._prePointTargetCache = {
5846
+ if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage) && (null === (_e = null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d[cacheKey]) || void 0 === _e ? void 0 : _e.stage.renderCount) === (null === (_f = this._prePointTargetCache) || void 0 === _f ? void 0 : _f.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.viewX, e.viewY, e), e.pickParams || (this._prePointTargetCache = {
5805
5847
  [cacheKey]: target,
5806
5848
  stageRenderCount: null !== (_g = null == target ? void 0 : target.stage.renderCount) && void 0 !== _g ? _g : -1
5807
5849
  })), mappers) for (let i = 0, j = mappers.length; i < j; i++) mappers[i].fn(e, target);else Logger.getInstance().warn(`[EventManager]: Event mapping not defined for ${e.type}`);
@@ -5945,7 +5987,7 @@
5945
5987
  this.setCursor(this.manager.cursor, this.manager.cursorTarget);
5946
5988
  }, this.onPointerUp = nativeEvent => {
5947
5989
  if (this.supportsTouchEvents && "touch" === nativeEvent.pointerType) return;
5948
- const outside = this.isEventOutsideOfTargetElement(nativeEvent) ? "outside" : "",
5990
+ const outside = this.isEventOutsideOfTargetViewPort(nativeEvent) ? "outside" : "",
5949
5991
  normalizedEvents = this.normalizeToPointerData(nativeEvent);
5950
5992
  for (let i = 0, j = normalizedEvents.length; i < j; i++) {
5951
5993
  const event = this.bootstrapEvent(this.rootPointerEvent, normalizedEvents[i]);
@@ -5969,7 +6011,6 @@
5969
6011
  resolution: resolution,
5970
6012
  rootNode: rootNode,
5971
6013
  global: global,
5972
- viewport: viewport,
5973
6014
  autoPreventDefault = !1,
5974
6015
  clickInterval: clickInterval,
5975
6016
  supportsTouchEvents = global.supportsTouchEvents,
@@ -5977,7 +6018,7 @@
5977
6018
  } = params;
5978
6019
  this.manager = new EventManager$1(rootNode, {
5979
6020
  clickInterval: clickInterval
5980
- }), this.globalObj = global, this.supportsPointerEvents = supportsPointerEvents, this.supportsTouchEvents = supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.viewport = viewport, this.rootPointerEvent = new FederatedPointerEvent(), this.rootWheelEvent = new FederatedWheelEvent(), this.cursorStyles = {
6021
+ }), this.globalObj = global, this.supportsPointerEvents = supportsPointerEvents, this.supportsTouchEvents = supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.rootPointerEvent = new FederatedPointerEvent(), this.rootWheelEvent = new FederatedWheelEvent(), this.cursorStyles = {
5981
6022
  default: "inherit",
5982
6023
  pointer: "pointer"
5983
6024
  }, this.resolution = resolution, this.setTargetElement(targetElement);
@@ -6019,15 +6060,7 @@
6019
6060
  this.supportsPointerEvents ? (globalObj.getDocument() ? (globalObj.getDocument().removeEventListener("pointermove", this.onPointerMove, !0), globalObj.getDocument().removeEventListener("pointerup", this.onPointerUp, !0)) : (domElement.removeEventListener("pointermove", this.onPointerMove, !0), domElement.removeEventListener("pointerup", this.onPointerUp, !0)), domElement.removeEventListener("pointerdown", this.onPointerDown, !0), domElement.removeEventListener("pointerleave", this.onPointerOverOut, !0), domElement.removeEventListener("pointerover", this.onPointerOverOut, !0)) : (globalObj.getDocument() ? (globalObj.getDocument().removeEventListener("mousemove", this.onPointerMove, !0), globalObj.getDocument().removeEventListener("mouseup", this.onPointerUp, !0)) : (domElement.removeEventListener("mousemove", this.onPointerMove, !0), domElement.removeEventListener("mouseup", this.onPointerUp, !0)), domElement.removeEventListener("mousedown", this.onPointerDown, !0), domElement.removeEventListener("mouseout", this.onPointerOverOut, !0), domElement.removeEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.removeEventListener("touchstart", this.onPointerDown, !0), domElement.removeEventListener("touchend", this.onPointerUp, !0), domElement.removeEventListener("touchmove", this.onPointerMove, !0)), domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this.eventsAdded = !1;
6020
6061
  }
6021
6062
  mapToViewportPoint(event) {
6022
- const viewport = this.viewport,
6023
- {
6024
- x: x,
6025
- y: y
6026
- } = event;
6027
- return {
6028
- x: x - viewport.x,
6029
- y: y - viewport.y
6030
- };
6063
+ return this.domElement.pointTransform ? this.domElement.pointTransform(event.x, event.y) : event;
6031
6064
  }
6032
6065
  mapToCanvasPoint(nativeEvent) {
6033
6066
  var _a;
@@ -6084,6 +6117,17 @@
6084
6117
  transferMouseData(event, nativeEvent) {
6085
6118
  event.isTrusted = nativeEvent.isTrusted, event.srcElement = nativeEvent.srcElement, event.timeStamp = clock.now(), event.type = nativeEvent.type, event.altKey = nativeEvent.altKey, event.button = nativeEvent.button, event.buttons = nativeEvent.buttons, event.client.x = nativeEvent.clientX, event.client.y = nativeEvent.clientY, event.ctrlKey = nativeEvent.ctrlKey, event.shiftKey = nativeEvent.shiftKey, event.metaKey = nativeEvent.metaKey, event.movement.x = nativeEvent.movementX, event.movement.y = nativeEvent.movementY, event.page.x = nativeEvent.pageX, event.page.y = nativeEvent.pageY, event.relatedTarget = null;
6086
6119
  }
6120
+ isEventOutsideOfTargetViewPort(nativeEvent) {
6121
+ if (this.isEventOutsideOfTargetElement(nativeEvent)) return !0;
6122
+ if (this.domElement.getViewBox) {
6123
+ const p = this.mapToViewportPoint(this.mapToCanvasPoint(nativeEvent)),
6124
+ b = this.domElement.getViewBox(),
6125
+ w = b.width(),
6126
+ h = b.height();
6127
+ return !(p.x < w && p.y < h && p.x > 0 && p.y > 0);
6128
+ }
6129
+ return !1;
6130
+ }
6087
6131
  isEventOutsideOfTargetElement(nativeEvent) {
6088
6132
  let target = nativeEvent.target;
6089
6133
  nativeEvent.composedPath && nativeEvent.composedPath().length > 0 && (target = nativeEvent.composedPath()[0]);
@@ -7242,7 +7286,8 @@
7242
7286
  }
7243
7287
  }
7244
7288
  tryUpdateGlobalAABBBounds() {
7245
- return this._globalAABBBounds ? this._globalAABBBounds.setValue(this._AABBBounds.x1, this._AABBBounds.y1, this._AABBBounds.x2, this._AABBBounds.y2) : this._globalAABBBounds = this.AABBBounds.clone(), this.parent && this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix), this._globalAABBBounds;
7289
+ const b = this.AABBBounds;
7290
+ return this._globalAABBBounds ? this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2) : this._globalAABBBounds = b.clone(), this.parent && this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix), this._globalAABBBounds;
7246
7291
  }
7247
7292
  tryUpdateGlobalTransMatrix() {
7248
7293
  if (this._globalTransMatrix) {
@@ -8204,8 +8249,9 @@
8204
8249
  return child.stage = null, application.graphicService.onRemove(child), this.addUpdateBoundTag(), data;
8205
8250
  }
8206
8251
  removeAllChild() {
8252
+ let deep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
8207
8253
  this.forEachChildren(child => {
8208
- application.graphicService.onRemove(child);
8254
+ application.graphicService.onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
8209
8255
  }), super.removeAllChild(), this.addUpdateBoundTag();
8210
8256
  }
8211
8257
  setStage(stage, layer) {
@@ -8318,15 +8364,12 @@
8318
8364
  }
8319
8365
  render(params, userParams) {
8320
8366
  var _a;
8321
- const stage = this.stage;
8322
8367
  this.layerHandler.render([this], {
8323
8368
  renderService: params.renderService,
8324
- x: stage.x,
8325
- y: stage.y,
8326
- width: this.viewWidth,
8327
- height: this.viewHeight,
8328
8369
  stage: this.stage,
8329
8370
  layer: this,
8371
+ viewBox: params.viewBox,
8372
+ transMatrix: params.transMatrix,
8330
8373
  background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
8331
8374
  updateBounds: params.updateBounds
8332
8375
  }, userParams), this.afterDrawCbs.forEach(c => c(this)), this.tryRenderSecondaryLayer(params, userParams);
@@ -8350,33 +8393,18 @@
8350
8393
  throw new Error("暂不支持");
8351
8394
  }
8352
8395
  prepare(dirtyBounds, params) {}
8353
- combineTo(target, params) {
8354
- var _a, _b, _c;
8355
- this.offscreen && (this.layerHandler.drawTo(target, [this], Object.assign({
8356
- background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
8357
- renderService: params.renderService,
8358
- x: null !== (_b = params.x) && void 0 !== _b ? _b : this.stage.x,
8359
- y: null !== (_c = params.y) && void 0 !== _c ? _c : this.stage.y,
8360
- width: this.viewWidth,
8361
- height: this.viewHeight,
8362
- stage: this.stage,
8363
- layer: this
8364
- }, params)), this.afterDrawCbs.forEach(c => c(this)));
8365
- }
8366
8396
  release() {
8367
8397
  super.release(), this.layerHandler.release(), this.subLayers && this.subLayers.forEach(l => {
8368
8398
  application.layerService.releaseLayer(this.stage, l.layer);
8369
8399
  });
8370
8400
  }
8371
8401
  drawTo(target, params) {
8372
- var _a, _b, _c;
8402
+ var _a;
8373
8403
  this.layerHandler.drawTo(target, [this], Object.assign({
8374
8404
  background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
8375
8405
  renderService: params.renderService,
8376
- x: null !== (_b = params.x) && void 0 !== _b ? _b : this.stage.x,
8377
- y: null !== (_c = params.y) && void 0 !== _c ? _c : this.stage.y,
8378
- width: this.viewWidth,
8379
- height: this.viewHeight,
8406
+ viewBox: params.viewBox,
8407
+ transMatrix: params.transMatrix,
8380
8408
  stage: this.stage,
8381
8409
  layer: this
8382
8410
  }, params)), this.afterDrawCbs.forEach(c => c(this));
@@ -10980,6 +11008,24 @@
10980
11008
  getFrameCache() {
10981
11009
  return this.shouldUpdateShape() && (this.doUpdateFrameCache(), this.clearUpdateShapeTag()), this._frameCache;
10982
11010
  }
11011
+ combinedStyleToCharacter(config) {
11012
+ const {
11013
+ fill: fill,
11014
+ stroke: stroke,
11015
+ fontSize: fontSize,
11016
+ fontFamily: fontFamily,
11017
+ fontStyle: fontStyle,
11018
+ fontWeight: fontWeight
11019
+ } = this.attribute;
11020
+ return Object.assign({
11021
+ fill: fill,
11022
+ stroke: stroke,
11023
+ fontSize: fontSize,
11024
+ fontFamily: fontFamily,
11025
+ fontStyle: fontStyle,
11026
+ fontWeight: fontWeight
11027
+ }, config);
11028
+ }
10983
11029
  doUpdateFrameCache() {
10984
11030
  var _a;
10985
11031
  const {
@@ -10998,7 +11044,7 @@
10998
11044
  } = this.attribute,
10999
11045
  paragraphs = [];
11000
11046
  for (let i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
11001
- const config = textConfig[i],
11047
+ const config = this.combinedStyleToCharacter(textConfig[i]),
11002
11048
  iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
11003
11049
  if (iconCache) paragraphs.push(iconCache);else {
11004
11050
  const icon = new RichTextIcon(config);
@@ -11008,7 +11054,7 @@
11008
11054
  }, icon.richtextId = config.id, paragraphs.push(icon);
11009
11055
  }
11010
11056
  } else {
11011
- const richTextConfig = textConfig[i];
11057
+ const richTextConfig = this.combinedStyleToCharacter(textConfig[i]);
11012
11058
  if (isNumber$2(richTextConfig.text) && (richTextConfig.text = `${richTextConfig.text}`), richTextConfig.text && richTextConfig.text.includes("\n")) {
11013
11059
  const textParts = richTextConfig.text.split("\n");
11014
11060
  for (let j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, richTextConfig));
@@ -15535,10 +15581,10 @@
15535
15581
  render(group, params) {
15536
15582
  var _a;
15537
15583
  params.renderService.render(group, Object.assign(Object.assign({
15538
- context: this.context
15584
+ context: this.context,
15585
+ viewBox: params.stage.window.getViewBox(),
15586
+ transMatrix: params.stage.window.getViewBoxTransform()
15539
15587
  }, params), {
15540
- x: 0,
15541
- y: 0,
15542
15588
  clear: null !== (_a = params.background) && void 0 !== _a ? _a : "#ffffff"
15543
15589
  }));
15544
15590
  }
@@ -15553,11 +15599,12 @@
15553
15599
  const context = target.getContext(),
15554
15600
  targetDpr = target.dpr,
15555
15601
  {
15556
- x = 0,
15557
- y = 0,
15558
- width = this.layer.viewWidth,
15559
- height = this.layer.viewHeight
15560
- } = params;
15602
+ viewBox: viewBox
15603
+ } = params,
15604
+ x = viewBox.x1,
15605
+ y = viewBox.y1,
15606
+ width = viewBox.width(),
15607
+ height = viewBox.height();
15561
15608
  context.nativeContext.save(), context.nativeContext.setTransform(targetDpr, 0, 0, targetDpr, 0, 0), params.clear && context.clearRect(x, y, width, height), context.drawImage(this.canvas.nativeCanvas, 0, 0, this.canvas.width, this.canvas.height, x, y, width, height), context.nativeContext.restore();
15562
15609
  }
15563
15610
  merge(layerHandlers) {}
@@ -15713,32 +15760,22 @@
15713
15760
  const {
15714
15761
  context: context,
15715
15762
  stage: stage,
15716
- x = 0,
15717
- y = 0,
15718
- width: width,
15719
- height: height
15763
+ viewBox: viewBox,
15764
+ transMatrix: transMatrix
15720
15765
  } = drawContext;
15721
15766
  if (!context) return;
15722
- if (drawContext.keepMatrix) {
15723
- if (context.nativeContext && context.nativeContext.getTransform) {
15724
- const t = context.nativeContext.getTransform();
15725
- context.setTransformFromMatrix(t, !0, 1);
15726
- }
15727
- } else context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
15728
- const dirtyBounds = this.dirtyBounds.setValue(0, 0, width, height);
15767
+ const dirtyBounds = this.dirtyBounds.setValue(0, 0, viewBox.width(), viewBox.height());
15729
15768
  if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {
15730
15769
  const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, !1);
15731
15770
  dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
15732
15771
  }
15733
15772
  const d = context.dpr % 1;
15734
- (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds);
15735
- const drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
15736
- context.save(), context.translate(x, y, !0), drawInArea && (context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip()), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort((a, b) => {
15773
+ (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.inuse = !0, context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f), context.clearMatrix(), context.setTransformForCurrent(!0), context.translate(viewBox.x1, viewBox.y1, !0), context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip(), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort((a, b) => {
15737
15774
  var _a, _b;
15738
15775
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
15739
15776
  }).forEach(group => {
15740
15777
  group.isContainer ? this.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : this.renderItem(group, drawContext);
15741
- }), context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1);
15778
+ }), context.restore(), context.draw(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1;
15742
15779
  }
15743
15780
  doRegister() {
15744
15781
  throw new Error("暂不支持");
@@ -15857,29 +15894,25 @@
15857
15894
  clearScreen(renderService, context, drawContext) {
15858
15895
  var _a, _b;
15859
15896
  const {
15860
- clear: clear
15861
- } = drawContext;
15897
+ clear: clear,
15898
+ viewBox: viewBox
15899
+ } = drawContext,
15900
+ width = viewBox.width(),
15901
+ height = viewBox.height();
15862
15902
  if (clear) {
15863
- const canvas = context.getCanvas(),
15864
- {
15865
- width = canvas.width,
15866
- height = canvas.height
15867
- } = drawContext,
15868
- x = 0,
15869
- y = 0;
15870
- context.clearRect(x, y, width, height);
15903
+ context.clearRect(0, 0, width, height);
15871
15904
  const stage = null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage;
15872
15905
  if (stage && (context.globalAlpha = null !== (_b = stage.attribute.opacity) && void 0 !== _b ? _b : 1), stage && stage.backgroundImg && stage.resources) {
15873
15906
  const res = stage.resources.get(clear);
15874
- res && "success" === res.state && res.data && context.drawImage(res.data, x, y, width, height);
15907
+ res && "success" === res.state && res.data && context.drawImage(res.data, 0, 0, width, height);
15875
15908
  } else context.fillStyle = createColor(context, clear, {
15876
15909
  AABBBounds: {
15877
- x1: x,
15878
- y1: y,
15879
- x2: x + width,
15880
- y2: y + height
15910
+ x1: 0,
15911
+ y1: 0,
15912
+ x2: 0 + width,
15913
+ y2: 0 + height
15881
15914
  }
15882
- }, 0, 0), context.fillRect(x, y, width, height);
15915
+ }, 0, 0), context.fillRect(0, 0, width, height);
15883
15916
  }
15884
15917
  }
15885
15918
  afterDraw(renderService, drawParams) {}
@@ -16136,25 +16169,16 @@
16136
16169
  this.currentRenderService = renderService;
16137
16170
  const {
16138
16171
  context: context,
16139
- x = 0,
16140
- y = 0
16172
+ viewBox: viewBox
16141
16173
  } = drawContext;
16142
- if (context) {
16143
- if (drawContext.keepMatrix) {
16144
- if (context.nativeContext && context.nativeContext.getTransform) {
16145
- const t = context.nativeContext.getTransform();
16146
- context.setTransformFromMatrix(t, !0, 1);
16147
- }
16148
- } else context.inuse = !0, context.clearMatrix();
16149
- context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(x, y, !0), context.save(), renderService.renderTreeRoots.sort((a, b) => {
16150
- var _a, _b;
16151
- return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
16152
- }).forEach(group => {
16153
- this.renderGroup(group, drawContext);
16154
- }), this.hooks.completeDraw.tap("top-draw", () => {
16155
- context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1), this.rendering = !1;
16156
- });
16157
- }
16174
+ context && (context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(viewBox.x1, viewBox.y1, !0), context.save(), renderService.renderTreeRoots.sort((a, b) => {
16175
+ var _a, _b;
16176
+ return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
16177
+ }).forEach(group => {
16178
+ this.renderGroup(group, drawContext);
16179
+ }), this.hooks.completeDraw.tap("top-draw", () => {
16180
+ context.restore(), context.restore(), context.draw(), context.inuse = !1, this.rendering = !1;
16181
+ }));
16158
16182
  });
16159
16183
  }
16160
16184
  _increaseRender(group, drawContext) {
@@ -16324,12 +16348,10 @@
16324
16348
  if (!layer || !group.layer.subLayers) return;
16325
16349
  const subLayer = group.layer.subLayers.get(group._uid);
16326
16350
  subLayer && subLayer.drawContribution && subLayer.drawContribution.draw(stage.renderService, Object.assign({
16327
- x: stage.x,
16328
- y: stage.y,
16329
- width: layer.viewWidth,
16330
- height: layer.viewHeight,
16331
16351
  stage: stage,
16332
16352
  layer: layer,
16353
+ viewBox: stage.window.getViewBox(),
16354
+ transMatrix: stage.window.getViewBoxTransform(),
16333
16355
  clear: "transparent",
16334
16356
  renderService: stage.renderService,
16335
16357
  updateBounds: !1,
@@ -16347,6 +16369,8 @@
16347
16369
  activate(context) {
16348
16370
  this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
16349
16371
  stage && stage === this.pluginService.stage && this.drawHTML(context.stage.renderService);
16372
+ }), application.graphicService.hooks.onRemove.tap(this.key, graphic => {
16373
+ this.removeDom(graphic);
16350
16374
  }), application.graphicService.hooks.onRelease.tap(this.key, graphic => {
16351
16375
  this.removeDom(graphic);
16352
16376
  });
@@ -16391,28 +16415,29 @@
16391
16415
  } = html;
16392
16416
  graphic.bindDom || (graphic.bindDom = new Map());
16393
16417
  const lastDom = graphic.bindDom.get(dom);
16394
- if (lastDom && (!container || container === lastDom.container)) return;
16395
- let nativeDom, nativeContainer;
16396
- graphic.bindDom.forEach(_ref => {
16397
- let {
16418
+ let wrapGroup, nativeContainer;
16419
+ if (!lastDom || container && container !== lastDom.container) {
16420
+ let nativeDom;
16421
+ graphic.bindDom.forEach(_ref => {
16422
+ let {
16423
+ wrapGroup: wrapGroup
16424
+ } = _ref;
16425
+ application.global.removeDom(wrapGroup);
16426
+ }), "string" == typeof dom ? (nativeDom = new DOMParser().parseFromString(dom, "text/html").firstChild, nativeDom.lastChild && (nativeDom = nativeDom.lastChild.firstChild)) : nativeDom = dom;
16427
+ const _container = container || (!0 === stage.params.enableHtmlAttribute ? null : stage.params.enableHtmlAttribute);
16428
+ nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(), wrapGroup = application.global.createDom({
16429
+ tagName: "div",
16430
+ width: width,
16431
+ height: height,
16432
+ style: style,
16433
+ parent: nativeContainer
16434
+ }), wrapGroup && (wrapGroup.appendChild(nativeDom), graphic.bindDom.set(dom, {
16435
+ dom: nativeDom,
16436
+ container: container,
16398
16437
  wrapGroup: wrapGroup
16399
- } = _ref;
16400
- application.global.removeDom(wrapGroup);
16401
- }), "string" == typeof dom ? (nativeDom = new DOMParser().parseFromString(dom, "text/html").firstChild, nativeDom.lastChild && (nativeDom = nativeDom.lastChild.firstChild)) : nativeDom = dom;
16402
- const _container = container || (!0 === stage.params.enableHtmlAttribute ? null : stage.params.enableHtmlAttribute);
16403
- nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer();
16404
- const wrapGroup = application.global.createDom({
16405
- tagName: "div",
16406
- width: width,
16407
- height: height,
16408
- style: style,
16409
- parent: nativeContainer
16410
- });
16411
- wrapGroup && (wrapGroup.appendChild(nativeDom), graphic.bindDom.set(dom, {
16412
- dom: nativeDom,
16413
- container: container,
16414
- wrapGroup: wrapGroup
16415
- })), wrapGroup.style.pointerEvents = "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
16438
+ }));
16439
+ } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
16440
+ wrapGroup.style.pointerEvents = "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
16416
16441
  let left = 0,
16417
16442
  top = 0;
16418
16443
  const b = graphic.globalAABBBounds;
@@ -16880,22 +16905,24 @@
16880
16905
  };
16881
16906
  class Stage extends Group$2 {
16882
16907
  set viewBox(b) {
16883
- this._viewBox.setValue(b.x1, b.y1, b.x2, b.y2);
16908
+ this.window.setViewBox(b);
16884
16909
  }
16885
16910
  get viewBox() {
16886
- return this._viewBox;
16911
+ return this.window.getViewBox();
16887
16912
  }
16888
16913
  get x() {
16889
- return this._viewBox.x1;
16914
+ return this.window.getViewBox().x1;
16890
16915
  }
16891
16916
  set x(x) {
16892
- this._viewBox.translate(x - this._viewBox.x1, 0);
16917
+ const b = this.window.getViewBox();
16918
+ b.translate(x - b.x1, 0), this.window.setViewBox(b);
16893
16919
  }
16894
16920
  get y() {
16895
- return this._viewBox.y1;
16921
+ return this.window.getViewBox().y1;
16896
16922
  }
16897
16923
  set y(y) {
16898
- this._viewBox.translate(0, y - this._viewBox.y1);
16924
+ const b = this.window.getViewBox();
16925
+ b.translate(0, y - b.y1), this.window.setViewBox(b);
16899
16926
  }
16900
16927
  get width() {
16901
16928
  return this.window.width;
@@ -16904,13 +16931,13 @@
16904
16931
  this.resize(w, this.height);
16905
16932
  }
16906
16933
  get viewWidth() {
16907
- return this._viewBox.width();
16934
+ return this.window.getViewBox().width();
16908
16935
  }
16909
16936
  set viewWidth(w) {
16910
16937
  this.resizeView(w, this.viewHeight);
16911
16938
  }
16912
16939
  get viewHeight() {
16913
- return this._viewBox.height();
16940
+ return this.window.getViewBox().height();
16914
16941
  }
16915
16942
  set viewHeight(h) {
16916
16943
  this.resizeView(this.viewWidth, h);
@@ -16944,7 +16971,13 @@
16944
16971
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16945
16972
  var _a;
16946
16973
  super({}), this._onVisibleChange = visible => {
16947
- this._skipRender < 0 || (visible ? (this.dirtyBounds && this.dirtyBounds.setValue(0, 0, this._viewBox.width(), this._viewBox.height()), this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0) : this._skipRender = 1);
16974
+ if (!(this._skipRender < 0)) if (visible) {
16975
+ if (this.dirtyBounds) {
16976
+ const b = this.window.getViewBox();
16977
+ this.dirtyBounds.setValue(b.x1, b.y1, b.width(), b.height());
16978
+ }
16979
+ this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
16980
+ } else this._skipRender = 1;
16948
16981
  }, this.beforeRender = stage => {
16949
16982
  this._beforeRender && this._beforeRender(stage);
16950
16983
  }, this.afterRender = stage => {
@@ -16955,17 +16988,24 @@
16955
16988
  }, this.global = application.global, !this.global.env && isBrowserEnv() && this.global.setEnv("browser"), this.window = container.get(VWindow), this.renderService = container.get(RenderService), this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService), this.pluginService.active(this, params), this.window.create({
16956
16989
  width: params.width,
16957
16990
  height: params.height,
16991
+ viewBox: params.viewBox,
16958
16992
  container: params.container,
16959
16993
  dpr: params.dpr || this.global.devicePixelRatio,
16960
16994
  canvasControled: !1 !== params.canvasControled,
16961
16995
  title: params.title || "",
16962
16996
  canvas: params.canvas
16963
- }), this._viewBox = new AABBBounds(), params.viewBox ? this._viewBox.setValue(params.viewBox.x1, params.viewBox.y1, params.viewBox.x2, params.viewBox.y2) : this._viewBox.setValue(0, 0, this.width, this.height), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._subView = !(this._viewBox.width() === this.width && this._viewBox.height() === this.height), this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig$1.BACKGROUND, this.appendChild(this.layerService.createLayer(this, {
16997
+ }), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig$1.BACKGROUND, this.appendChild(this.layerService.createLayer(this, {
16964
16998
  main: !0
16965
16999
  })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.ticker = params.ticker || defaultTicker, this.supportInteractiveLayer = !1 !== params.interactiveLayer, this.timeline = new DefaultTimeline(), this.ticker.addTimeline(this.timeline), this.timeline.pause(), params.optimize || (params.optimize = {}), this.optmize(params.optimize), params.background && isString$2(this._background) && this._background.includes("/") && this.setAttributes({
16966
17000
  background: this._background
16967
17001
  });
16968
17002
  }
17003
+ pauseRender() {
17004
+ this._skipRender = -1;
17005
+ }
17006
+ resumeRender() {
17007
+ this._skipRender = 0;
17008
+ }
16969
17009
  tryInitEventSystem() {
16970
17010
  this.global.supportEvent && !this._eventSystem && (this._eventSystem = new EventSystem(Object.assign({
16971
17011
  targetElement: this.window,
@@ -16973,22 +17013,7 @@
16973
17013
  rootNode: this,
16974
17014
  global: this.global,
16975
17015
  supportsPointerEvents: this.params.supportsPointerEvents,
16976
- supportsTouchEvents: this.params.supportsTouchEvents,
16977
- viewport: {
16978
- viewBox: this._viewBox,
16979
- get x() {
16980
- return this.viewBox.x1;
16981
- },
16982
- get y() {
16983
- return this.viewBox.y1;
16984
- },
16985
- get width() {
16986
- return this.viewBox.width();
16987
- },
16988
- get height() {
16989
- return this.viewBox.height();
16990
- }
16991
- }
17016
+ supportsTouchEvents: this.params.supportsTouchEvents
16992
17017
  }, this.params.event)));
16993
17018
  }
16994
17019
  preventRender(prevent) {
@@ -17135,7 +17160,7 @@
17135
17160
  return this.pluginService.findPluginsByName(name);
17136
17161
  }
17137
17162
  tryUpdateAABBBounds() {
17138
- const viewBox = this._viewBox;
17163
+ const viewBox = this.window.getViewBox();
17139
17164
  return this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2), this._AABBBounds;
17140
17165
  }
17141
17166
  combineLayer(ILayer1, ILayer2) {
@@ -17162,12 +17187,12 @@
17162
17187
  this.supportInteractiveLayer && !this.interactiveLayer && (this.interactiveLayer = this.createLayer(), this.interactiveLayer.name = "_builtin_interactive", this.interactiveLayer.attribute.pickable = !1, this.nextFrameRenderLayerSet.add(this.interactiveLayer));
17163
17188
  }
17164
17189
  clearViewBox(color) {
17165
- this.window.clearViewBox(this._viewBox, color);
17190
+ this.window.clearViewBox(color);
17166
17191
  }
17167
17192
  render(layers, params) {
17168
17193
  this.ticker.start(), this.timeline.resume();
17169
17194
  const state = this.state;
17170
- this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this.renderLayerList(this.children, params), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
17195
+ this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(this.children), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
17171
17196
  }
17172
17197
  combineLayersToWindow() {}
17173
17198
  renderNextFrame(layers, force) {
@@ -17180,7 +17205,7 @@
17180
17205
  _doRenderInThisFrame() {
17181
17206
  this.timeline.resume(), this.ticker.start();
17182
17207
  const state = this.state;
17183
- this.state = "rendering", this.layerService.prepareStageLayer(this), this.nextFrameRenderLayerSet.size && !this._skipRender && (this.hooks.beforeRender.call(this), this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()), this.lastRenderparams || {}), this.combineLayersToWindow(), this.hooks.afterRender.call(this), this.nextFrameRenderLayerSet.clear()), this.state = state, this._skipRender && this._skipRender++;
17208
+ this.state = "rendering", this.layerService.prepareStageLayer(this), this.nextFrameRenderLayerSet.size && !this._skipRender && (this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()), this.lastRenderparams || {}), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
17184
17209
  }
17185
17210
  renderLayerList(layerList, params) {
17186
17211
  const list = [];
@@ -17192,14 +17217,17 @@
17192
17217
  layer.renderCount > this.renderCount || (layer.renderCount = this.renderCount + 1, layer.render({
17193
17218
  renderService: this.renderService,
17194
17219
  background: layer === this.defaultLayer ? this.background : void 0,
17195
- updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty())
17220
+ updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty()),
17221
+ viewBox: this.window.getViewBox(),
17222
+ transMatrix: this.window.getViewBoxTransform()
17196
17223
  }, Object.assign({
17197
- renderStyle: this.renderStyle,
17198
- keepMatrix: this.params.renderKeepMatrix
17224
+ renderStyle: this.renderStyle
17199
17225
  }, params)));
17200
17226
  }), this.interactiveLayer && !layerList.includes(this.interactiveLayer) && this.interactiveLayer.render({
17201
17227
  renderService: this.renderService,
17202
- updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty())
17228
+ updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty()),
17229
+ viewBox: this.window.getViewBox(),
17230
+ transMatrix: this.window.getViewBoxTransform()
17203
17231
  }, Object.assign({
17204
17232
  renderStyle: this.renderStyle
17205
17233
  }, params));
@@ -17210,9 +17238,9 @@
17210
17238
  }
17211
17239
  resize(w, h) {
17212
17240
  let rerender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
17213
- this.window.resize(w, h), this.forEachChildren(c => {
17241
+ this.window.hasSubView() || this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h), this.window.resize(w, h), this.forEachChildren(c => {
17214
17242
  c.resize(w, h);
17215
- }), this._subView || this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h), this.camera && this.option3d && this.set3dOptions(this.option3d), rerender && this.render();
17243
+ }), this.camera && this.option3d && this.set3dOptions(this.option3d), rerender && this.render();
17216
17244
  }
17217
17245
  resizeView(w, h) {
17218
17246
  let rerender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
@@ -17266,47 +17294,41 @@
17266
17294
  getLayer(name) {
17267
17295
  return this.children.filter(layer => layer.name === name)[0];
17268
17296
  }
17269
- renderTo(window, params) {
17297
+ renderTo(window) {
17270
17298
  this.forEachChildren((layer, i) => {
17271
- layer.drawTo(window, Object.assign(Object.assign({}, params), {
17299
+ layer.drawTo(window, {
17272
17300
  renderService: this.renderService,
17301
+ viewBox: window.getViewBox(),
17302
+ transMatrix: window.getViewBoxTransform(),
17273
17303
  background: layer === this.defaultLayer ? this.background : void 0,
17274
17304
  clear: 0 === i,
17275
17305
  updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty())
17276
- }));
17306
+ });
17277
17307
  });
17278
17308
  }
17279
17309
  renderToNewWindow() {
17280
- let fullImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
17281
17310
  let viewBox = arguments.length > 1 ? arguments[1] : undefined;
17282
- const window = container.get(VWindow);
17283
- if (fullImage) window.create({
17284
- width: this.viewWidth,
17285
- height: this.viewHeight,
17311
+ const window = container.get(VWindow),
17312
+ x1 = viewBox ? -viewBox.x1 : 0,
17313
+ y1 = viewBox ? -viewBox.y1 : 0,
17314
+ x2 = viewBox ? viewBox.x2 : this.viewWidth,
17315
+ y2 = viewBox ? viewBox.y2 : this.viewHeight,
17316
+ width = viewBox ? viewBox.width() : this.viewWidth,
17317
+ height = viewBox ? viewBox.height() : this.viewHeight;
17318
+ return window.create({
17319
+ viewBox: {
17320
+ x1: x1,
17321
+ y1: y1,
17322
+ x2: x2,
17323
+ y2: y2
17324
+ },
17325
+ width: width,
17326
+ height: height,
17286
17327
  dpr: this.window.dpr,
17287
17328
  canvasControled: !0,
17288
17329
  offscreen: !0,
17289
17330
  title: ""
17290
- });else {
17291
- const width = viewBox ? viewBox.width() : Math.min(this.viewWidth, this.window.width - this.x),
17292
- height = viewBox ? viewBox.height() : Math.min(this.viewHeight, this.window.height - this.y);
17293
- window.create({
17294
- width: width,
17295
- height: height,
17296
- dpr: this.window.dpr,
17297
- canvasControled: !0,
17298
- offscreen: !0,
17299
- title: ""
17300
- });
17301
- }
17302
- const x = viewBox ? -viewBox.x1 : 0,
17303
- y = viewBox ? -viewBox.y1 : 0;
17304
- return this.renderTo(window, {
17305
- x: x,
17306
- y: y,
17307
- width: viewBox ? viewBox.x2 : window.width,
17308
- height: viewBox ? viewBox.y2 : window.height
17309
- }), window;
17331
+ }), this.renderTo(window), window;
17310
17332
  }
17311
17333
  toCanvas() {
17312
17334
  let fullImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
@@ -17520,7 +17542,7 @@
17520
17542
  };
17521
17543
  let BaseWindowHandlerContribution = class {
17522
17544
  constructor() {
17523
- this._uid = Generator.GenAutoIncrementId();
17545
+ this._uid = Generator.GenAutoIncrementId(), this.viewBox = new AABBBounds(), this.modelMatrix = new Matrix(1, 0, 0, 1, 0, 0);
17524
17546
  }
17525
17547
  onChange(cb) {
17526
17548
  this._onChangeCb = cb;
@@ -17541,6 +17563,18 @@
17541
17563
  left: 0
17542
17564
  };
17543
17565
  }
17566
+ setViewBox(vb) {
17567
+ this.viewBox.setValue(vb.x1, vb.y1, vb.x2, vb.y2);
17568
+ }
17569
+ getViewBox() {
17570
+ return this.viewBox;
17571
+ }
17572
+ setViewBoxTransform(a, b, c, d, e, f) {
17573
+ this.modelMatrix.setValue(a, b, c, d, e, f);
17574
+ }
17575
+ getViewBoxTransform() {
17576
+ return this.modelMatrix;
17577
+ }
17544
17578
  };
17545
17579
  BaseWindowHandlerContribution = __decorate$K([injectable(), __metadata$x("design:paramtypes", [])], BaseWindowHandlerContribution);
17546
17580
 
@@ -17572,23 +17606,14 @@
17572
17606
  group: null
17573
17607
  };
17574
17608
  params.pickerService = this;
17575
- let offsetX = 0,
17576
- offsetY = 0;
17577
- if (params && params.bounds) {
17578
- if (!params.bounds.contains(point.x, point.y)) return result;
17579
- offsetX = params.bounds.x1, offsetY = params.bounds.y1;
17580
- }
17581
- if (this.pickContext) if (params.keepMatrix) {
17582
- if (this.pickContext.nativeContext && this.pickContext.nativeContext.getTransform) {
17583
- const t = this.pickContext.nativeContext.getTransform();
17584
- this.pickContext.setTransformFromMatrix(t, !0, 1);
17585
- }
17586
- } else this.pickContext.inuse = !0, this.pickContext.clearMatrix(!0, 1);
17587
- params.pickContext = this.pickContext;
17588
- const parentMatrix = new Matrix(1, 0, 0, 1, offsetX, offsetY);
17609
+ const w = params.bounds.width(),
17610
+ h = params.bounds.height();
17611
+ if (!new AABBBounds().setValue(0, 0, w, h).containsPoint(point)) return result;
17612
+ this.pickContext && (this.pickContext.inuse = !0), params.pickContext = this.pickContext, this.pickContext && this.pickContext.clearMatrix(!0, 1);
17613
+ const parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);
17589
17614
  let group;
17590
17615
  for (let i = graphics.length - 1; i >= 0 && (result = graphics[i].isContainer ? this.pickGroup(graphics[i], point, parentMatrix, params) : this.pickItem(graphics[i], point, parentMatrix, params), !result.graphic); i--) group || (group = result.group);
17591
- if (result.graphic || (result.group = group), this.pickContext && !params.keepMatrix && (this.pickContext.inuse = !1), result.graphic) {
17616
+ if (result.graphic || (result.group = group), this.pickContext && (this.pickContext.inuse = !1), result.graphic) {
17592
17617
  let g = result.graphic;
17593
17618
  for (; g.parent;) g = g.parent;
17594
17619
  g.shadowHost && (result.params = {
@@ -18642,7 +18667,6 @@
18642
18667
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
18643
18668
  };
18644
18669
  const outP = [0, 0, 0],
18645
- initMatrix = new Matrix(1, 0, 0, 1, 0, 0),
18646
18670
  addArcToBezierPath = (bezierPath, startAngle, endAngle, cx, cy, rx, ry, clockwise) => {
18647
18671
  if (clockwise) for (; endAngle > startAngle;) endAngle -= pi2;else for (; endAngle < startAngle;) endAngle += pi2;
18648
18672
  const step = pi / 3 * (endAngle > startAngle ? 1 : -1);
@@ -18773,7 +18797,7 @@
18773
18797
  }), this._clearShadowStyle = !1, this._clearFilterStyle = !1, this._clearGlobalCompositeOperationStyle = !1;
18774
18798
  const context = canvas.nativeCanvas.getContext("2d");
18775
18799
  if (!context) throw new Error("发生错误,获取2d上下文失败");
18776
- this.nativeContext = context, this.canvas = canvas, this.matrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack = [], this.dpr = dpr, this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0);
18800
+ this.nativeContext = context, this.canvas = canvas, this.matrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack = [], this.dpr = dpr, this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this._clearMatrix = new Matrix(1, 0, 0, 1, 0, 0);
18777
18801
  }
18778
18802
  reset() {
18779
18803
  this.stack.length && Logger.getInstance().warn("可能存在bug,matrix没有清空"), this.matrix.setValue(1, 0, 0, 1, 0, 0), this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack.length = 0, this.nativeContext.setTransform(1, 0, 0, 1, 0, 0);
@@ -19135,7 +19159,10 @@
19135
19159
  clearMatrix() {
19136
19160
  let setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
19137
19161
  let dpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.dpr;
19138
- this.setTransformFromMatrix(initMatrix, setTransform, dpr);
19162
+ this.setTransformFromMatrix(this._clearMatrix, setTransform, dpr);
19163
+ }
19164
+ setClearMatrix(a, b, c, d, e, f) {
19165
+ this._clearMatrix.setValue(a, b, c, d, e, f);
19139
19166
  }
19140
19167
  onlyTranslate() {
19141
19168
  let dpr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.dpr;
@@ -19366,7 +19393,7 @@
19366
19393
  return `${BrowserWindowHandlerContribution_1.idprefix}_${BrowserWindowHandlerContribution_1.prefix_count++}`;
19367
19394
  }
19368
19395
  constructor() {
19369
- super(), this.type = "browser", this._canvasIsIntersecting = !0, this.global = application.global;
19396
+ super(), this.type = "browser", this._canvasIsIntersecting = !0, this.global = application.global, this.viewBox = new AABBBounds(), this.modelMatrix = new Matrix(1, 0, 0, 1, 0, 0);
19370
19397
  }
19371
19398
  getTitle() {
19372
19399
  return this.canvas.id.toString();
@@ -19495,8 +19522,9 @@
19495
19522
  bottom: 0
19496
19523
  };
19497
19524
  }
19498
- clearViewBox(vb, color) {
19499
- const context = this.getContext(),
19525
+ clearViewBox(color) {
19526
+ const vb = this.viewBox,
19527
+ context = this.getContext(),
19500
19528
  dpr = this.getDpr();
19501
19529
  context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
19502
19530
  }
@@ -19866,7 +19894,7 @@
19866
19894
  getBoundingClientRect() {
19867
19895
  return null;
19868
19896
  }
19869
- clearViewBox(vb, color) {}
19897
+ clearViewBox(color) {}
19870
19898
  };
19871
19899
  NodeWindowHandlerContribution.env = "node", NodeWindowHandlerContribution = __decorate$v([injectable(), __param$n(0, inject(VGlobal)), __metadata$n("design:paramtypes", [Object])], NodeWindowHandlerContribution);
19872
19900
  const nodeWindowModule = new ContainerModule(bind => {
@@ -25372,7 +25400,7 @@
25372
25400
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, Segment.defaultAttributes, attributes)), this.name = "segment";
25373
25401
  }
25374
25402
  render() {
25375
- this.removeAllChild(), this._reset();
25403
+ this.removeAllChild(!0), this._reset();
25376
25404
  const {
25377
25405
  startSymbol: startSymbol,
25378
25406
  endSymbol: endSymbol,
@@ -25641,7 +25669,7 @@
25641
25669
  return this.add(offscreenGroup), this._renderInner(offscreenGroup), this.removeChild(offscreenGroup), this.attribute = currentAttribute, offscreenGroup.AABBBounds;
25642
25670
  }
25643
25671
  render() {
25644
- this.removeAllChild(), this._prevInnerView = this._innerView, this._innerView = graphicCreator$1.group({
25672
+ this.removeAllChild(!0), this._prevInnerView = this._innerView, this._innerView = graphicCreator$1.group({
25645
25673
  x: 0,
25646
25674
  y: 0,
25647
25675
  pickable: !1
@@ -26629,7 +26657,7 @@
26629
26657
  this.attribute.disableTriggerEvent || (this.preHandler && (this.preHandler.addEventListener("pointerenter", this._onHover), this.preHandler.addEventListener("pointerleave", this._onUnHover), this.preHandler.addEventListener("pointerdown", this._onClick)), this.nextHandler && (this.nextHandler.addEventListener("pointerenter", this._onHover), this.nextHandler.addEventListener("pointerleave", this._onUnHover), this.nextHandler.addEventListener("pointerdown", this._onClick)));
26630
26658
  }
26631
26659
  _reset() {
26632
- this.removeAllChild(), this._current = 1, this._total = this.attribute.total, this.preHandler = this.nextHandler = this.text = null;
26660
+ this.removeAllChild(!0), this._current = 1, this._total = this.attribute.total, this.preHandler = this.nextHandler = this.text = null;
26633
26661
  }
26634
26662
  }
26635
26663
  Pager.defaultAttributes = {
@@ -26666,7 +26694,7 @@
26666
26694
  super(...arguments), this.name = "legend", this._title = null;
26667
26695
  }
26668
26696
  render() {
26669
- this.removeAllChild();
26697
+ this.removeAllChild(!0);
26670
26698
  const {
26671
26699
  interactive = !0,
26672
26700
  title: title,
@@ -28365,7 +28393,7 @@
28365
28393
  }
28366
28394
  render() {
28367
28395
  var _a, _b;
28368
- this.removeAllChild();
28396
+ this.removeAllChild(!0);
28369
28397
  const {
28370
28398
  layout = "horizontal",
28371
28399
  railWidth: railWidth,
@@ -29157,7 +29185,7 @@
29157
29185
  }, this.addEventListener("click", this.handleClick);
29158
29186
  }
29159
29187
  render() {
29160
- this.removeAllChild(), this.renderBox(), this.renderIcon(), this.renderText(), this.layout();
29188
+ this.removeAllChild(!0), this.renderBox(), this.renderIcon(), this.renderText(), this.layout();
29161
29189
  }
29162
29190
  renderBox() {
29163
29191
  this._box = new Rect$2(merge({}, this.attribute.box));
@@ -32603,7 +32631,7 @@
32603
32631
  super(params);
32604
32632
  this.numberType = CHART_NUMBER_TYPE;
32605
32633
  if (!params.chartInstance) {
32606
- params.chartInstance = this.chartInstance = new params.ClassType(params.spec, {
32634
+ params.chartInstance = this.chartInstance = new params.ClassType(params.spec, merge({}, this.attribute.tableChartOption, {
32607
32635
  renderCanvas: params.canvas,
32608
32636
  mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
32609
32637
  modeParams: this.attribute.modeParams,
@@ -32613,8 +32641,9 @@
32613
32641
  interactive: false,
32614
32642
  animation: false,
32615
32643
  autoFit: false
32616
- });
32644
+ }));
32617
32645
  this.chartInstance.renderSync();
32646
+ this.chartInstance.getStage().enableDirtyBounds();
32618
32647
  }
32619
32648
  else {
32620
32649
  this.chartInstance = params.chartInstance;
@@ -32631,34 +32660,52 @@
32631
32660
  y1: y1 - table.scrollTop,
32632
32661
  y2: y2 - table.scrollTop
32633
32662
  });
32634
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
32663
+ this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, merge({}, this.attribute.tableChartOption, {
32635
32664
  renderCanvas: this.attribute.canvas,
32636
32665
  mode: 'desktop-browser',
32637
32666
  canvasControled: false,
32638
32667
  viewBox: {
32639
- x1: x1 - table.scrollLeft,
32640
- x2: x2 - table.scrollLeft,
32641
- y1: y1 - table.scrollTop,
32642
- y2: y2 - table.scrollTop
32668
+ x1: 0,
32669
+ x2: x2 - x1,
32670
+ y1: 0,
32671
+ y2: y2 - y1
32643
32672
  },
32644
32673
  dpr: table.internalProps.pixelRatio,
32645
32674
  animation: false,
32646
32675
  interactive: true,
32647
32676
  autoFit: false,
32648
- beforeRender: (stage) => {
32649
- const ctx = stage.window.getContext();
32677
+ beforeRender: (chartStage) => {
32678
+ const stage = this.stage;
32679
+ const ctx = chartStage.window.getContext();
32680
+ const stageMatrix = stage.window.getViewBoxTransform();
32681
+ const viewBox = stage.window.getViewBox();
32650
32682
  ctx.inuse = true;
32651
32683
  ctx.clearMatrix();
32684
+ ctx.setTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f, true);
32685
+ ctx.translate(viewBox.x1, viewBox.y1);
32652
32686
  ctx.setTransformForCurrent(true);
32653
32687
  ctx.beginPath();
32654
32688
  ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
32655
32689
  ctx.clip();
32690
+ ctx.clearMatrix();
32691
+ if (!chartStage.needRender) {
32692
+ chartStage.pauseRender();
32693
+ table.scenegraph.stage.dirtyBounds.union(this.globalAABBBounds);
32694
+ table.scenegraph.updateNextFrame();
32695
+ }
32656
32696
  },
32657
32697
  afterRender(stage) {
32658
32698
  const ctx = stage.window.getContext();
32659
32699
  ctx.inuse = false;
32700
+ stage.needRender = false;
32701
+ chartStage.resumeRender();
32660
32702
  }
32661
- });
32703
+ }));
32704
+ const chartStage = this.activeChartInstance.getStage();
32705
+ const matrix = this.globalTransMatrix.clone();
32706
+ const stageMatrix = this.stage.window.getViewBoxTransform();
32707
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
32708
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
32662
32709
  this.activeChartInstance.renderSync();
32663
32710
  table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
32664
32711
  this.activeChartInstance.on('click', (params) => {
@@ -32694,11 +32741,12 @@
32694
32741
  const cellGroup = this.parent;
32695
32742
  const padding = this.attribute.cellPadding;
32696
32743
  const table = this.stage.table;
32744
+ const { x1, y1, x2, y2 } = cellGroup.globalAABBBounds;
32697
32745
  return {
32698
- x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
32699
- x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
32700
- y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
32701
- y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
32746
+ x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
32747
+ x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
32748
+ y1: Math.ceil(y1 + padding[0] + table.scrollTop + (table.options.viewBox?.y1 ?? 0)),
32749
+ y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (table.options.viewBox?.y1 ?? 0))
32702
32750
  };
32703
32751
  }
32704
32752
  }
@@ -32729,6 +32777,10 @@
32729
32777
  bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
32730
32778
  bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
32731
32779
  }
32780
+ bodyBound.x1 = bodyBound.x1 + (table.options.viewBox?.x1 ?? 0);
32781
+ bodyBound.x2 = bodyBound.x2 + (table.options.viewBox?.x1 ?? 0);
32782
+ bodyBound.y1 = bodyBound.y1 + (table.options.viewBox?.y1 ?? 0);
32783
+ bodyBound.y2 = bodyBound.y2 + (table.options.viewBox?.y1 ?? 0);
32732
32784
  return bodyBound;
32733
32785
  }
32734
32786
 
@@ -32786,7 +32838,8 @@
32786
32838
  data: table.getCellValue(col, row),
32787
32839
  cellPadding: padding,
32788
32840
  dpr: table.internalProps.pixelRatio,
32789
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
32841
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : [],
32842
+ tableChartOption: table.options.chartOption
32790
32843
  });
32791
32844
  cellGroup.appendChild(chartGroup);
32792
32845
  table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
@@ -37215,7 +37268,9 @@
37215
37268
  let height = 0;
37216
37269
  let renderDefault = false;
37217
37270
  let enableCellPadding = false;
37218
- if (table.isHeader(col, row) || table.getBodyColumnDefine(col, row)?.mergeCell) {
37271
+ if (table.isHeader(col, row) ||
37272
+ table.getBodyColumnDefine(col, row)?.mergeCell ||
37273
+ table.hasCustomMerge()) {
37219
37274
  const cellRange = table.getCellRange(col, row);
37220
37275
  spanRow = cellRange.end.row - cellRange.start.row + 1;
37221
37276
  }
@@ -37301,7 +37356,9 @@
37301
37356
  }
37302
37357
  let spanRow = 1;
37303
37358
  let endCol = col;
37304
- if (table.isHeader(col, row) || table.getBodyColumnDefine(col, row)?.mergeCell) {
37359
+ if (table.isHeader(col, row) ||
37360
+ table.getBodyColumnDefine(col, row)?.mergeCell ||
37361
+ table.hasCustomMerge()) {
37305
37362
  const cellRange = table.getCellRange(col, row);
37306
37363
  spanRow = cellRange.end.row - cellRange.start.row + 1;
37307
37364
  col = cellRange.start.col;
@@ -39132,48 +39189,65 @@
39132
39189
  if (viewBox.y2 <= viewBox.y1) {
39133
39190
  viewBox.y2 = viewBox.y1 + 1;
39134
39191
  }
39135
- axes?.forEach((axis, index) => {
39136
- if (axis.type === 'band') {
39137
- chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
39138
- }
39139
- else {
39140
- chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
39141
- }
39142
- });
39143
39192
  chartInstance.updateViewBox({
39144
- x1: viewBox.x1 - chart.getRootNode().table.scrollLeft,
39145
- x2: viewBox.x2 - chart.getRootNode().table.scrollLeft,
39146
- y1: viewBox.y1 - chart.getRootNode().table.scrollTop,
39147
- y2: viewBox.y2 - chart.getRootNode().table.scrollTop
39193
+ x1: 0,
39194
+ x2: viewBox.x2 - viewBox.x1,
39195
+ y1: 0,
39196
+ y2: viewBox.y2 - viewBox.y1
39148
39197
  }, false, false);
39149
- const table = chart.getRootNode().table;
39150
- table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
39151
- if (typeof dataId === 'string') {
39152
- chartInstance.updateDataSync(dataId, data ?? []);
39153
- }
39154
- else {
39155
- const dataBatch = [];
39156
- for (const dataIdStr in dataId) {
39157
- const dataIdAndField = dataId[dataIdStr];
39158
- const series = spec.series.find((item) => item?.data?.id === dataIdStr);
39159
- dataBatch.push({
39160
- id: dataIdStr,
39161
- values: dataIdAndField
39162
- ? data?.filter((item) => {
39163
- return item.hasOwnProperty(dataIdAndField);
39164
- }) ?? []
39165
- : data ?? [],
39166
- fields: series?.data?.fields
39167
- });
39168
- if (!chartInstance.updateFullDataSync) {
39169
- chartInstance.updateDataSync(dataIdStr, dataIdAndField
39170
- ? data?.filter((item) => {
39171
- return item.hasOwnProperty(dataIdAndField);
39172
- }) ?? []
39173
- : data ?? []);
39198
+ const chartStage = chartInstance.getStage();
39199
+ const matrix = chart.globalTransMatrix.clone();
39200
+ const stageMatrix = chart.stage.window.getViewBoxTransform();
39201
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
39202
+ chartStage.window.setViewBoxTransform &&
39203
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
39204
+ const { table } = chart.getRootNode();
39205
+ let updateSpec = false;
39206
+ if (table.options.specFormat) {
39207
+ const formatResult = table.options.specFormat(chart.attribute.spec);
39208
+ if (formatResult.needFormatSpec && formatResult.spec) {
39209
+ const spec = formatResult.spec;
39210
+ chartInstance.updateSpecSync(spec);
39211
+ updateSpec = true;
39212
+ }
39213
+ }
39214
+ if (!updateSpec) {
39215
+ axes?.forEach((axis, index) => {
39216
+ if (axis.type === 'band') {
39217
+ chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
39218
+ }
39219
+ else {
39220
+ chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
39174
39221
  }
39222
+ });
39223
+ table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
39224
+ if (typeof dataId === 'string') {
39225
+ chartInstance.updateDataSync(dataId, data ?? []);
39226
+ }
39227
+ else {
39228
+ const dataBatch = [];
39229
+ for (const dataIdStr in dataId) {
39230
+ const dataIdAndField = dataId[dataIdStr];
39231
+ const series = spec.series.find((item) => item?.data?.id === dataIdStr);
39232
+ dataBatch.push({
39233
+ id: dataIdStr,
39234
+ values: dataIdAndField
39235
+ ? data?.filter((item) => {
39236
+ return item.hasOwnProperty(dataIdAndField);
39237
+ }) ?? []
39238
+ : data ?? [],
39239
+ fields: series?.data?.fields
39240
+ });
39241
+ if (!chartInstance.updateFullDataSync) {
39242
+ chartInstance.updateDataSync(dataIdStr, dataIdAndField
39243
+ ? data?.filter((item) => {
39244
+ return item.hasOwnProperty(dataIdAndField);
39245
+ }) ?? []
39246
+ : data ?? []);
39247
+ }
39248
+ }
39249
+ chartInstance.updateFullDataSync?.(dataBatch);
39175
39250
  }
39176
- chartInstance.updateFullDataSync?.(dataBatch);
39177
39251
  }
39178
39252
  const sg = chartInstance.getStage();
39179
39253
  cacheStageCanvas(sg, chart);
@@ -39230,7 +39304,7 @@
39230
39304
  }
39231
39305
 
39232
39306
  const ChartRender = Symbol.for('ChartRender');
39233
- let DefaultCanvasChartRender = class DefaultCanvasChartRender {
39307
+ let DefaultCanvasChartRender = class DefaultCanvasChartRender extends BaseRender {
39234
39308
  type;
39235
39309
  numberType = CHART_NUMBER_TYPE;
39236
39310
  drawShape(chart, context, x, y, drawContext, params, fillCb, strokeCb) {
@@ -39238,6 +39312,7 @@
39238
39312
  const { dataId, data, spec } = chart.attribute;
39239
39313
  chart.getViewBox();
39240
39314
  const { width = groupAttribute.width, height = groupAttribute.height } = chart.attribute;
39315
+ const { table } = chart.getRootNode();
39241
39316
  const { chartInstance, active, cacheCanvas, activeChartInstance } = chart;
39242
39317
  if (!active && cacheCanvas) {
39243
39318
  if (isArray$1(cacheCanvas)) {
@@ -39251,6 +39326,27 @@
39251
39326
  }
39252
39327
  }
39253
39328
  else if (activeChartInstance) {
39329
+ if (table.options.specFormat) {
39330
+ const formatResult = table.options.specFormat(chart.attribute.spec);
39331
+ if (formatResult.needFormatSpec && formatResult.spec) {
39332
+ const spec = formatResult.spec;
39333
+ activeChartInstance.updateSpecSync(spec);
39334
+ return;
39335
+ }
39336
+ }
39337
+ const viewBox = chart.getViewBox();
39338
+ activeChartInstance.updateViewBox({
39339
+ x1: 0,
39340
+ x2: viewBox.x2 - viewBox.x1,
39341
+ y1: 0,
39342
+ y2: viewBox.y2 - viewBox.y1
39343
+ }, false, false);
39344
+ const chartStage = activeChartInstance.getStage();
39345
+ chartStage.needRender = true;
39346
+ const matrix = chart.globalTransMatrix.clone();
39347
+ const stageMatrix = chart.stage.window.getViewBoxTransform();
39348
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
39349
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
39254
39350
  if (typeof dataId === 'string') {
39255
39351
  activeChartInstance.updateDataSync(dataId, data ?? []);
39256
39352
  }
@@ -39280,13 +39376,13 @@
39280
39376
  }
39281
39377
  }
39282
39378
  else {
39283
- if (chart.getRootNode().table.internalProps.renderChartAsync) {
39379
+ if (table.internalProps.renderChartAsync) {
39284
39380
  if (chartRenderKeys.indexOf(`${chart.parent.col}+${chart.parent.row}`) === -1) {
39285
39381
  chartRenderKeys.push(`${chart.parent.col}+${chart.parent.row}`);
39286
39382
  chartRenderQueueList.push(chart);
39287
39383
  }
39288
39384
  if (!IsHandlingChartQueue()) {
39289
- startRenderChartQueue(chart.getRootNode().table);
39385
+ startRenderChartQueue(table);
39290
39386
  }
39291
39387
  }
39292
39388
  else {
@@ -39295,31 +39391,7 @@
39295
39391
  }
39296
39392
  }
39297
39393
  draw(chart, renderService, drawContext, params) {
39298
- const { context } = drawContext;
39299
- if (!context) {
39300
- return;
39301
- }
39302
- const { clip } = chart.attribute;
39303
- if (clip) {
39304
- context.save();
39305
- }
39306
- else {
39307
- context.highPerformanceSave();
39308
- }
39309
- context.transformFromMatrix(chart.transMatrix, true);
39310
- context.beginPath();
39311
- if (params.skipDraw) {
39312
- this.drawShape(chart, context, 0, 0, drawContext, params, () => false, () => false);
39313
- }
39314
- else {
39315
- this.drawShape(chart, context, 0, 0, drawContext);
39316
- }
39317
- if (clip) {
39318
- context.restore();
39319
- }
39320
- else {
39321
- context.highPerformanceRestore();
39322
- }
39394
+ this._draw(chart, {}, false, drawContext, params);
39323
39395
  }
39324
39396
  };
39325
39397
  DefaultCanvasChartRender = __decorate([
@@ -40327,7 +40399,9 @@
40327
40399
  let width = 0;
40328
40400
  let renderDefault = false;
40329
40401
  let enableCellPadding = false;
40330
- if (table.isHeader(col, row) || table.getBodyColumnDefine(col, row)?.mergeCell) {
40402
+ if (table.isHeader(col, row) ||
40403
+ table.getBodyColumnDefine(col, row)?.mergeCell ||
40404
+ table.hasCustomMerge()) {
40331
40405
  const cellRange = table.getCellRange(col, row);
40332
40406
  spanCol = cellRange.end.col - cellRange.start.col + 1;
40333
40407
  }
@@ -40396,7 +40470,9 @@
40396
40470
  });
40397
40471
  }
40398
40472
  let spanCol = 1;
40399
- if (table.isHeader(col, row) || table.getBodyColumnDefine(col, row)?.mergeCell) {
40473
+ if (table.isHeader(col, row) ||
40474
+ table.getBodyColumnDefine(col, row)?.mergeCell ||
40475
+ table.hasCustomMerge()) {
40400
40476
  const cellRange = table.getCellRange(col, row);
40401
40477
  spanCol = cellRange.end.col - cellRange.start.col + 1;
40402
40478
  }
@@ -43191,6 +43267,15 @@
43191
43267
  });
43192
43268
  }
43193
43269
  }
43270
+ function clearCellChartCacheImage(col, row, scenegraph) {
43271
+ const cellGroup = scenegraph.getCell(col, row);
43272
+ cellGroup.children.forEach((node) => {
43273
+ if (node.type === 'chart') {
43274
+ node.cacheCanvas = null;
43275
+ node.addUpdateBoundTag();
43276
+ }
43277
+ });
43278
+ }
43194
43279
  function updateChartData(scenegraph) {
43195
43280
  const table = scenegraph.table;
43196
43281
  for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
@@ -44135,7 +44220,12 @@
44135
44220
  setPoptipTheme(this.table.theme.textPopTipStyle);
44136
44221
  let width;
44137
44222
  let height;
44138
- if (Env.mode === 'node') {
44223
+ if (table.options.canvas && table.options.viewBox) {
44224
+ vglobal.setEnv('browser');
44225
+ width = table.options.viewBox.x2 - table.options.viewBox.x1;
44226
+ height = table.options.viewBox.y2 - table.options.viewBox.y1;
44227
+ }
44228
+ else if (Env.mode === 'node') {
44139
44229
  vglobal.setEnv('node', table.options.modeParams);
44140
44230
  width = table.canvasWidth;
44141
44231
  height = table.canvasHeight;
@@ -44153,9 +44243,15 @@
44153
44243
  background: table.theme.underlayBackgroundColor,
44154
44244
  dpr: table.internalProps.pixelRatio,
44155
44245
  enableLayout: true,
44156
- afterRender: () => {
44246
+ beforeRender: (stage) => {
44247
+ this.table.options.beforeRender && this.table.options.beforeRender(stage);
44248
+ },
44249
+ afterRender: (stage) => {
44250
+ this.table.options.afterRender && this.table.options.afterRender(stage);
44157
44251
  this.table.fireListeners('after_render', null);
44158
- }
44252
+ },
44253
+ canvasControled: !table.options.canvas,
44254
+ viewBox: table.options.viewBox
44159
44255
  });
44160
44256
  this.stage.defaultLayer.setTheme({
44161
44257
  group: {
@@ -47193,8 +47289,8 @@
47193
47289
  function getCellEventArgsSet(e) {
47194
47290
  const tableEvent = {
47195
47291
  abstractPos: {
47196
- x: e.x,
47197
- y: e.y
47292
+ x: e.viewport.x,
47293
+ y: e.viewport.y
47198
47294
  }
47199
47295
  };
47200
47296
  const targetCell = getTargetCell(e.target);
@@ -48141,12 +48237,14 @@
48141
48237
  e.preventDefault();
48142
48238
  }
48143
48239
  });
48144
- handler.on(table.getContainer(), 'resize', e => {
48145
- if (e.width === 0 && e.height === 0) {
48146
- return;
48147
- }
48148
- table.resize();
48149
- });
48240
+ if (!table.options.canvas) {
48241
+ handler.on(table.getContainer(), 'resize', e => {
48242
+ if (e.width === 0 && e.height === 0) {
48243
+ return;
48244
+ }
48245
+ table.resize();
48246
+ });
48247
+ }
48150
48248
  }
48151
48249
 
48152
48250
  function bindTouchListener(eventManager) {
@@ -48402,7 +48500,7 @@
48402
48500
  isDraging = false;
48403
48501
  constructor(table) {
48404
48502
  this.table = table;
48405
- if (Env.mode === 'node') {
48503
+ if (Env.mode === 'node' || table.options.disableInteraction) {
48406
48504
  return;
48407
48505
  }
48408
48506
  this.bindOuterEvent();
@@ -51714,7 +51812,7 @@
51714
51812
  return TABLE_EVENT_TYPE;
51715
51813
  }
51716
51814
  options;
51717
- version = "0.19.1";
51815
+ version = "0.19.2-alpha.1";
51718
51816
  pagination;
51719
51817
  id = `VTable${Date.now()}`;
51720
51818
  headerStyleCache;
@@ -51725,7 +51823,7 @@
51725
51823
  _chartEventMap = {};
51726
51824
  constructor(container, options = {}) {
51727
51825
  super();
51728
- if (!container && options.mode !== 'node') {
51826
+ if (!container && options.mode !== 'node' && !options.canvas) {
51729
51827
  throw new Error("vtable's container is undefined");
51730
51828
  }
51731
51829
  const { frozenColCount = 0, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth, widthMode = 'standard', heightMode = 'standard', autoFillWidth = false, autoFillHeight = false, keyboardOptions, eventOptions, columnResizeMode, dragHeaderMode, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, customRender, pixelRatio = defaultPixelRatio, renderChartAsync, renderChartAsyncBatchCount, mode, modeParams, canvasWidth, canvasHeight, overscrollBehavior, limitMinWidth } = options;
@@ -51761,7 +51859,14 @@
51761
51859
  if (typeof allowFrozenColCount === 'number' && allowFrozenColCount <= 0) {
51762
51860
  this.showFrozenIcon = false;
51763
51861
  }
51764
- if (Env.mode !== 'node') {
51862
+ if (this.options.canvas) {
51863
+ internalProps.element = this.options.canvas.parentElement;
51864
+ internalProps.element.style.position = 'relative';
51865
+ internalProps.focusControl = new FocusInput(this, internalProps.element);
51866
+ internalProps.canvas = this.options.canvas;
51867
+ internalProps.context = internalProps.canvas.getContext('2d');
51868
+ }
51869
+ else if (Env.mode !== 'node') {
51765
51870
  internalProps.element = createRootElement(this.padding);
51766
51871
  internalProps.focusControl = new FocusInput(this, internalProps.element);
51767
51872
  internalProps.canvas = document.createElement('canvas');
@@ -52097,7 +52202,21 @@
52097
52202
  const { padding } = this;
52098
52203
  let widthP = 0;
52099
52204
  let heightP = 0;
52100
- if (Env.mode === 'browser') {
52205
+ this.tableX = 0;
52206
+ this.tableY = 0;
52207
+ if (this.options.canvas && this.options.viewBox) {
52208
+ widthP = this.options.viewBox.x2 - this.options.viewBox.x1;
52209
+ heightP = this.options.viewBox.y2 - this.options.viewBox.y1;
52210
+ if (this?.scenegraph?.stage) {
52211
+ if (this.options.viewBox) {
52212
+ this.scenegraph.stage.setViewBox(this.options.viewBox, false);
52213
+ }
52214
+ else {
52215
+ this.scenegraph.stage.resize(widthP, heightP);
52216
+ }
52217
+ }
52218
+ }
52219
+ else if (Env.mode === 'browser') {
52101
52220
  const element = this.getElement();
52102
52221
  const width1 = element.parentElement?.offsetWidth ?? 1 - 1;
52103
52222
  const height1 = element.parentElement?.offsetHeight ?? 1 - 1;
@@ -52127,18 +52246,43 @@
52127
52246
  if (this.internalProps.theme?.frameStyle) {
52128
52247
  const lineWidths = toBoxArray(this.internalProps.theme.frameStyle?.borderLineWidth ?? [null]);
52129
52248
  const shadowWidths = toBoxArray(this.internalProps.theme.frameStyle?.shadowBlur ?? [0]);
52130
- this.tableX = (lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0);
52131
- this.tableY = (lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0);
52249
+ this.tableX += (lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0);
52250
+ this.tableY += (lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0);
52132
52251
  this.tableNoFrameWidth =
52133
52252
  width - ((lineWidths[1] ?? 0) + (shadowWidths[1] ?? 0)) - ((lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0));
52134
52253
  this.tableNoFrameHeight =
52135
52254
  height - ((lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0)) - ((lineWidths[2] ?? 0) + (shadowWidths[2] ?? 0));
52136
52255
  }
52256
+ else {
52257
+ this.tableX += 0;
52258
+ this.tableY += 0;
52259
+ this.tableNoFrameWidth = width;
52260
+ this.tableNoFrameHeight = height;
52261
+ }
52262
+ }
52263
+ updateViewBox(newViewBox) {
52264
+ const oldWidth = this.options?.viewBox.x2 ?? 0 - this.options?.viewBox.x1 ?? 0;
52265
+ const oldHeight = this.options?.viewBox.y2 ?? 0 - this.options?.viewBox.y1 ?? 0;
52266
+ const newWidth = newViewBox.x2 - newViewBox.x1;
52267
+ const newHeight = newViewBox.y2 - newViewBox.y1;
52268
+ this.options.viewBox = newViewBox;
52269
+ if (oldWidth !== newWidth || oldHeight !== newHeight) {
52270
+ this.resize();
52271
+ }
52272
+ else {
52273
+ this.scenegraph.stage.setViewBox(this.options.viewBox, true);
52274
+ }
52275
+ }
52276
+ setViewBoxTransform(a, b, c, d, e, f) {
52277
+ this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
52137
52278
  }
52138
52279
  get rowHierarchyType() {
52139
52280
  return 'grid';
52140
52281
  }
52141
52282
  getColsWidth(startCol, endCol) {
52283
+ if (startCol > endCol) {
52284
+ return 0;
52285
+ }
52142
52286
  startCol = Math.max(startCol, 0);
52143
52287
  endCol = Math.min(endCol, (this.colCount ?? Infinity) - 1);
52144
52288
  const cachedColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol}`);
@@ -52193,6 +52337,9 @@
52193
52337
  }
52194
52338
  }
52195
52339
  getRowsHeight(startRow, endRow) {
52340
+ if (startRow > endRow) {
52341
+ return 0;
52342
+ }
52196
52343
  startRow = Math.max(startRow, 0);
52197
52344
  endRow = Math.min(endRow, (this.rowCount ?? Infinity) - 1);
52198
52345
  let h = 0;
@@ -52445,27 +52592,40 @@
52445
52592
  return rect;
52446
52593
  }
52447
52594
  getCellsRect(startCol, startRow, endCol, endRow) {
52448
- const isFrozenStartCell = this.isFrozenCell(startCol, startRow);
52449
- const isFrozenEndCell = this.isFrozenCell(endCol, endRow);
52450
52595
  let absoluteLeft = this.getColsWidth(0, startCol - 1) || 0;
52451
52596
  let width = this.getColsWidth(startCol, endCol);
52452
- if (isFrozenStartCell?.col) {
52453
- const scrollLeft = this.scrollLeft;
52454
- absoluteLeft += scrollLeft;
52455
- if (!isFrozenEndCell?.col) {
52456
- width -= scrollLeft;
52457
- width = Math.max(width, this.getColsWidth(startCol, this.frozenColCount - 1));
52458
- }
52597
+ const scrollLeft = this.scrollLeft;
52598
+ if (this.isLeftFrozenColumn(startCol) && this.isRightFrozenColumn(endCol)) {
52599
+ width = this.tableNoFrameWidth - (this.getColsWidth(startCol + 1, this.colCount - 1) ?? 0) - absoluteLeft;
52600
+ }
52601
+ else if (this.isLeftFrozenColumn(startCol) && !this.isLeftFrozenColumn(endCol)) {
52602
+ width = Math.max(width - scrollLeft, this.getColsWidth(startCol, this.frozenColCount - 1));
52603
+ }
52604
+ else if (!this.isRightFrozenColumn(startCol) && this.isRightFrozenColumn(endCol)) {
52605
+ absoluteLeft = Math.min(absoluteLeft - scrollLeft, this.tableNoFrameWidth - this.getRightFrozenColsWidth());
52606
+ width = this.tableNoFrameWidth - (this.getColsWidth(startCol + 1, this.colCount - 1) ?? 0) - absoluteLeft;
52607
+ }
52608
+ else if (this.isRightFrozenColumn(startCol)) {
52609
+ absoluteLeft = this.tableNoFrameWidth - (this.getColsWidth(startCol, this.colCount - 1) ?? 0);
52459
52610
  }
52460
- const absoluteTop = this.getRowsHeight(0, startRow - 1);
52611
+ else ;
52612
+ let absoluteTop = this.getRowsHeight(0, startRow - 1);
52461
52613
  let height = this.getRowsHeight(startRow, endRow);
52462
- if (isFrozenStartCell?.row) {
52463
- const scrollTop = this.scrollTop;
52464
- if (!isFrozenEndCell?.row) {
52465
- height -= scrollTop;
52466
- height = Math.max(height, this.getRowsHeight(startRow, this.frozenRowCount - 1));
52467
- }
52614
+ const scrollTop = this.scrollTop;
52615
+ if (this.isTopFrozenRow(startRow) && this.isBottomFrozenRow(endRow)) {
52616
+ height = this.tableNoFrameHeight - (this.getRowsHeight(startRow + 1, this.rowCount - 1) ?? 0) - absoluteTop;
52617
+ }
52618
+ else if (this.isTopFrozenRow(startRow) && !this.isTopFrozenRow(endRow)) {
52619
+ height = Math.max(height - scrollTop, this.getRowsHeight(startRow, this.frozenRowCount - 1));
52468
52620
  }
52621
+ else if (!this.isBottomFrozenRow(startRow) && this.isBottomFrozenRow(endRow)) {
52622
+ absoluteTop = Math.min(absoluteTop - scrollTop, this.tableNoFrameHeight - this.getBottomFrozenRowsHeight());
52623
+ height = this.tableNoFrameHeight - (this.getRowsHeight(startRow + 1, this.rowCount - 1) ?? 0) - absoluteTop;
52624
+ }
52625
+ else if (this.isBottomFrozenRow(startRow)) {
52626
+ absoluteTop = this.tableNoFrameHeight - (this.getRowsHeight(startRow, this.rowCount - 1) ?? 0);
52627
+ }
52628
+ else ;
52469
52629
  return new Rect$1(Math.round(absoluteLeft), Math.round(absoluteTop), Math.round(width), Math.round(height));
52470
52630
  }
52471
52631
  getCellsRectWidth(startCol, startRow, endCol, endRow) {
@@ -52610,6 +52770,8 @@
52610
52770
  const visibleRect = this.getVisibleRect();
52611
52771
  rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0));
52612
52772
  rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0));
52773
+ rect.offsetLeft(this.options.viewBox?.x1 ?? 0);
52774
+ rect.offsetTop(this.options.viewBox?.y1 ?? 0);
52613
52775
  return rect;
52614
52776
  }
52615
52777
  getVisibleRect() {
@@ -52764,7 +52926,7 @@
52764
52926
  this.scenegraph.stage.release();
52765
52927
  this.scenegraph.proxy.release();
52766
52928
  const { parentElement } = internalProps.element;
52767
- if (parentElement) {
52929
+ if (parentElement && !this.options.canvas) {
52768
52930
  parentElement.removeChild(internalProps.element);
52769
52931
  }
52770
52932
  this.isReleased = true;
@@ -52937,8 +53099,8 @@
52937
53099
  const currentHeight = rect.height;
52938
53100
  const originHeight = this.canvas.offsetHeight || currentHeight;
52939
53101
  const heightRatio = currentHeight / originHeight;
52940
- const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0);
52941
- const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0);
53102
+ const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0) - (this.options.viewBox?.x1 ?? 0);
53103
+ const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0) - (this.options.viewBox?.y1 ?? 0);
52942
53104
  return { x, y, inTable };
52943
53105
  }
52944
53106
  getTheme() {
@@ -53244,6 +53406,9 @@
53244
53406
  }
53245
53407
  return this.internalProps.layoutMap.getCellRange(col, row);
53246
53408
  }
53409
+ hasCustomMerge() {
53410
+ return !!this.internalProps.customMergeCell;
53411
+ }
53247
53412
  getCustomMerge(col, row) {
53248
53413
  if (this.internalProps.customMergeCell) {
53249
53414
  const customMerge = this.internalProps.customMergeCell(col, row, this);
@@ -62418,6 +62583,14 @@
62418
62583
  updateChartData(this.scenegraph);
62419
62584
  this.render();
62420
62585
  }
62586
+ clearChartCacheImage(col, row) {
62587
+ if (isNumber$2(col) && isNumber$2(row)) {
62588
+ clearCellChartCacheImage(col, row, this.scenegraph);
62589
+ }
62590
+ else {
62591
+ clearChartCacheImage(this.scenegraph);
62592
+ }
62593
+ }
62421
62594
  getLegendSelected() {
62422
62595
  return this.internalProps.legends.legendComponent._getSelectedLegends().map((d) => d.label);
62423
62596
  }
@@ -63114,7 +63287,7 @@
63114
63287
  }
63115
63288
 
63116
63289
  registerForVrender();
63117
- const version = "0.19.1";
63290
+ const version = "0.19.2-alpha.1";
63118
63291
  function getIcons() {
63119
63292
  return get$1();
63120
63293
  }