@visactor/vtable 0.23.1-alpha.1 → 0.23.1-alpha.2

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 (155) hide show
  1. package/cjs/ListTable.js +1 -1
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotChart.d.ts +1 -0
  4. package/cjs/PivotChart.js +4 -0
  5. package/cjs/PivotChart.js.map +1 -1
  6. package/cjs/components/axis/axis.js +3 -2
  7. package/cjs/components/axis/axis.js.map +1 -1
  8. package/cjs/components/legend/discrete-legend/discrete-legend.js +2 -1
  9. package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  10. package/cjs/core/BaseTable.d.ts +15 -0
  11. package/cjs/core/BaseTable.js +76 -31
  12. package/cjs/core/BaseTable.js.map +1 -1
  13. package/cjs/core/FouseInput.d.ts +1 -0
  14. package/cjs/core/FouseInput.js +5 -2
  15. package/cjs/core/FouseInput.js.map +1 -1
  16. package/cjs/data/DataSource.d.ts +1 -1
  17. package/cjs/data/DataSource.js +14 -3
  18. package/cjs/data/DataSource.js.map +1 -1
  19. package/cjs/event/event.d.ts +4 -0
  20. package/cjs/event/event.js +6 -5
  21. package/cjs/event/event.js.map +1 -1
  22. package/cjs/event/listener/container-dom.js +66 -27
  23. package/cjs/event/listener/container-dom.js.map +1 -1
  24. package/cjs/event/listener/table-group.js +1 -1
  25. package/cjs/event/listener/table-group.js.map +1 -1
  26. package/cjs/event/listener/touch.js +7 -18
  27. package/cjs/event/listener/touch.js.map +1 -1
  28. package/cjs/event/scroll.d.ts +16 -1
  29. package/cjs/event/scroll.js +38 -5
  30. package/cjs/event/scroll.js.map +1 -1
  31. package/cjs/event/util.js +2 -2
  32. package/cjs/event/util.js.map +1 -1
  33. package/cjs/index.d.ts +1 -1
  34. package/cjs/index.js +1 -1
  35. package/cjs/index.js.map +1 -1
  36. package/cjs/layout/simple-header-layout.js +1 -1
  37. package/cjs/layout/simple-header-layout.js.map +1 -1
  38. package/cjs/scenegraph/component/table-component.js +1 -1
  39. package/cjs/scenegraph/component/table-component.js.map +1 -1
  40. package/cjs/scenegraph/debug-tool/debug-tool.js +4 -1
  41. package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
  42. package/cjs/scenegraph/graphic/chart.d.ts +1 -0
  43. package/cjs/scenegraph/graphic/chart.js +34 -20
  44. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  45. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
  46. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  47. package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  48. package/cjs/scenegraph/graphic/contributions/chart-render.js +40 -24
  49. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  50. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  51. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  52. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js +2 -1
  53. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  54. package/cjs/scenegraph/icon/icon-update.js +2 -0
  55. package/cjs/scenegraph/icon/icon-update.js.map +1 -1
  56. package/cjs/scenegraph/layout/update-row.js +2 -3
  57. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  58. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -0
  59. package/cjs/scenegraph/refresh-node/update-chart.js +9 -2
  60. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  61. package/cjs/scenegraph/scenegraph.js +14 -8
  62. package/cjs/scenegraph/scenegraph.js.map +1 -1
  63. package/cjs/state/cell-move/index.js +2 -2
  64. package/cjs/state/cell-move/index.js.map +1 -1
  65. package/cjs/state/select/update-position.d.ts +1 -1
  66. package/cjs/state/select/update-position.js +4 -4
  67. package/cjs/state/select/update-position.js.map +1 -1
  68. package/cjs/state/state.d.ts +1 -1
  69. package/cjs/state/state.js +8 -4
  70. package/cjs/state/state.js.map +1 -1
  71. package/cjs/tools/diff-cell.d.ts +1 -1
  72. package/cjs/tools/diff-cell.js +3 -3
  73. package/cjs/tools/diff-cell.js.map +1 -1
  74. package/cjs/ts-types/base-table.d.ts +23 -1
  75. package/cjs/ts-types/base-table.js.map +1 -1
  76. package/cjs/vrender.js.map +1 -1
  77. package/dist/vtable.js +1371 -787
  78. package/dist/vtable.min.js +2 -2
  79. package/es/ListTable.js +1 -1
  80. package/es/ListTable.js.map +1 -1
  81. package/es/PivotChart.d.ts +1 -0
  82. package/es/PivotChart.js +5 -2
  83. package/es/PivotChart.js.map +1 -1
  84. package/es/components/axis/axis.js +3 -1
  85. package/es/components/axis/axis.js.map +1 -1
  86. package/es/components/legend/discrete-legend/discrete-legend.js +2 -1
  87. package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  88. package/es/core/BaseTable.d.ts +15 -0
  89. package/es/core/BaseTable.js +75 -30
  90. package/es/core/BaseTable.js.map +1 -1
  91. package/es/core/FouseInput.d.ts +1 -0
  92. package/es/core/FouseInput.js +5 -2
  93. package/es/core/FouseInput.js.map +1 -1
  94. package/es/data/DataSource.d.ts +1 -1
  95. package/es/data/DataSource.js +13 -4
  96. package/es/data/DataSource.js.map +1 -1
  97. package/es/event/event.d.ts +4 -0
  98. package/es/event/event.js +7 -4
  99. package/es/event/event.js.map +1 -1
  100. package/es/event/listener/container-dom.js +67 -26
  101. package/es/event/listener/container-dom.js.map +1 -1
  102. package/es/event/listener/table-group.js +1 -1
  103. package/es/event/listener/table-group.js.map +1 -1
  104. package/es/event/listener/touch.js +7 -18
  105. package/es/event/listener/touch.js.map +1 -1
  106. package/es/event/scroll.d.ts +16 -1
  107. package/es/event/scroll.js +33 -2
  108. package/es/event/scroll.js.map +1 -1
  109. package/es/event/util.js +2 -2
  110. package/es/event/util.js.map +1 -1
  111. package/es/index.d.ts +1 -1
  112. package/es/index.js +1 -1
  113. package/es/index.js.map +1 -1
  114. package/es/layout/simple-header-layout.js +1 -1
  115. package/es/layout/simple-header-layout.js.map +1 -1
  116. package/es/scenegraph/component/table-component.js +1 -1
  117. package/es/scenegraph/component/table-component.js.map +1 -1
  118. package/es/scenegraph/debug-tool/debug-tool.js +4 -1
  119. package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
  120. package/es/scenegraph/graphic/chart.d.ts +1 -0
  121. package/es/scenegraph/graphic/chart.js +33 -21
  122. package/es/scenegraph/graphic/chart.js.map +1 -1
  123. package/es/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
  124. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  125. package/es/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  126. package/es/scenegraph/graphic/contributions/chart-render.js +41 -25
  127. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  128. package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  129. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  130. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js +2 -1
  131. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  132. package/es/scenegraph/icon/icon-update.js +2 -0
  133. package/es/scenegraph/icon/icon-update.js.map +1 -1
  134. package/es/scenegraph/layout/update-row.js +2 -3
  135. package/es/scenegraph/layout/update-row.js.map +1 -1
  136. package/es/scenegraph/refresh-node/update-chart.d.ts +1 -0
  137. package/es/scenegraph/refresh-node/update-chart.js +6 -0
  138. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  139. package/es/scenegraph/scenegraph.js +14 -8
  140. package/es/scenegraph/scenegraph.js.map +1 -1
  141. package/es/state/cell-move/index.js +2 -2
  142. package/es/state/cell-move/index.js.map +1 -1
  143. package/es/state/select/update-position.d.ts +1 -1
  144. package/es/state/select/update-position.js +4 -4
  145. package/es/state/select/update-position.js.map +1 -1
  146. package/es/state/state.d.ts +1 -1
  147. package/es/state/state.js +8 -4
  148. package/es/state/state.js.map +1 -1
  149. package/es/tools/diff-cell.d.ts +1 -1
  150. package/es/tools/diff-cell.js +3 -3
  151. package/es/tools/diff-cell.js.map +1 -1
  152. package/es/ts-types/base-table.d.ts +23 -1
  153. package/es/ts-types/base-table.js.map +1 -1
  154. package/es/vrender.js.map +1 -1
  155. package/package.json +7 -7
package/dist/vtable.js CHANGED
@@ -1461,7 +1461,7 @@
1461
1461
  function objectKeys(obj) {
1462
1462
  return Object.keys(obj);
1463
1463
  }
1464
- function isEqual$1(a, b, options) {
1464
+ function isEqual(a, b, options) {
1465
1465
  if (a === b) return !0;
1466
1466
  if (typeof a != typeof b) return !1;
1467
1467
  if (null == a || null == b) return !1;
@@ -1471,7 +1471,7 @@
1471
1471
  if ("object" != typeof a) return !1;
1472
1472
  if (isArray$3(a)) {
1473
1473
  if (a.length !== b.length) return !1;
1474
- for (let i = a.length - 1; i >= 0; i--) if (!isEqual$1(a[i], b[i], options)) return !1;
1474
+ for (let i = a.length - 1; i >= 0; i--) if (!isEqual(a[i], b[i], options)) return !1;
1475
1475
  return !0;
1476
1476
  }
1477
1477
  if (!isPlainObject$1(a)) return !1;
@@ -1482,7 +1482,7 @@
1482
1482
  for (let i = ka.length - 1; i >= 0; i--) if (ka[i] != kb[i]) return !1;
1483
1483
  for (let i = ka.length - 1; i >= 0; i--) {
1484
1484
  const key = ka[i];
1485
- if (!isEqual$1(a[key], b[key], options)) return !1;
1485
+ if (!isEqual(a[key], b[key], options)) return !1;
1486
1486
  }
1487
1487
  return !0;
1488
1488
  }
@@ -4161,7 +4161,8 @@
4161
4161
  backgroundFit: !0,
4162
4162
  blur: 0,
4163
4163
  cursor: null,
4164
- html: null
4164
+ html: null,
4165
+ react: null
4165
4166
  }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout), DefaultPickStyle);
4166
4167
  const DefaultConnectAttribute = {
4167
4168
  connectedType: "none",
@@ -4385,7 +4386,7 @@
4385
4386
  function applyStrokeStyle(ctx, character) {
4386
4387
  const strokeStyle = character && character.stroke || defaultFormatting.stroke;
4387
4388
  if (!strokeStyle) return void (ctx.globalAlpha = 0);
4388
- ctx.globalAlpha = 1, ctx.lineWidth = character && "number" == typeof character.lineHeight ? character.lineHeight : 1, ctx.strokeStyle = strokeStyle;
4389
+ ctx.globalAlpha = 1, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle;
4389
4390
  let fontSize = character.fontSize || 16;
4390
4391
  switch (character.script) {
4391
4392
  case "super":
@@ -4813,28 +4814,37 @@
4813
4814
  constructor() {
4814
4815
  this.hooks = {
4815
4816
  onChange: new SyncHook(["x", "y", "width", "height"])
4817
+ }, this.active = () => {
4818
+ const global = this.global;
4819
+ if (!global.env || this.actived) return;
4820
+ container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
4816
4821
  }, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
4817
4822
  }
4818
4823
  postInit() {
4819
- this.global.hooks.onSetEnv.tap("window", () => {
4820
- this.active();
4821
- }), this.active();
4822
- }
4823
- active() {
4824
- const global = this.global;
4825
- if (!global.env || this.actived) return;
4826
- container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
4824
+ this.global.hooks.onSetEnv.tap("window", this.active), this.active();
4827
4825
  }
4828
4826
  get style() {
4829
- return this._handler.getStyle();
4827
+ var _a;
4828
+ return null !== (_a = this._handler.getStyle()) && void 0 !== _a ? _a : {};
4830
4829
  }
4831
4830
  set style(style) {
4832
4831
  this._handler.setStyle(style);
4833
4832
  }
4834
4833
  create(params) {
4834
+ var _a, _b;
4835
4835
  this._handler.createWindow(params);
4836
4836
  const windowWH = this._handler.getWH();
4837
- this._width = windowWH.width, this._height = windowWH.height, this.title = this._handler.getTitle(), this.resizable = !0;
4837
+ this._width = windowWH.width, this._height = windowWH.height, params.viewBox ? this.setViewBox(params.viewBox) : !1 !== params.canvasControled ? this.setViewBox({
4838
+ x1: 0,
4839
+ y1: 0,
4840
+ x2: this._width,
4841
+ y2: this._height
4842
+ }) : this.setViewBox({
4843
+ x1: 0,
4844
+ y1: 0,
4845
+ x2: null !== (_a = params.width) && void 0 !== _a ? _a : this._width,
4846
+ y2: null !== (_b = params.height) && void 0 !== _b ? _b : this._height
4847
+ }), this.title = this._handler.getTitle(), this.resizable = !0;
4838
4848
  }
4839
4849
  setWindowHandler(handler) {
4840
4850
  this._handler = handler;
@@ -4849,7 +4859,7 @@
4849
4859
  throw new Error("暂不支持");
4850
4860
  }
4851
4861
  release() {
4852
- return this._handler.releaseWindow();
4862
+ return this.global.hooks.onSetEnv.unTap("window", this.active), this._handler.releaseWindow();
4853
4863
  }
4854
4864
  getContext() {
4855
4865
  return this._handler.getContext();
@@ -4875,8 +4885,35 @@
4875
4885
  getContainer() {
4876
4886
  return this._handler.container;
4877
4887
  }
4878
- clearViewBox(viewBox, color) {
4879
- this._handler.clearViewBox(viewBox, color);
4888
+ clearViewBox(color) {
4889
+ this._handler.clearViewBox(color);
4890
+ }
4891
+ setViewBox(viewBox) {
4892
+ this._handler.setViewBox(viewBox);
4893
+ }
4894
+ setViewBoxTransform(a, b, c, d, e, f) {
4895
+ this._handler.setViewBoxTransform(a, b, c, d, e, f);
4896
+ }
4897
+ getViewBox() {
4898
+ return this._handler.getViewBox();
4899
+ }
4900
+ getViewBoxTransform() {
4901
+ return this._handler.getViewBoxTransform();
4902
+ }
4903
+ pointTransform(x, y) {
4904
+ const vb = this._handler.getViewBox(),
4905
+ nextP = {
4906
+ x: x,
4907
+ y: y
4908
+ };
4909
+ return this._handler.getViewBoxTransform().transformPoint({
4910
+ x: x,
4911
+ y: y
4912
+ }, nextP), nextP.x -= vb.x1, nextP.y -= vb.y1, nextP;
4913
+ }
4914
+ hasSubView() {
4915
+ const viewBox = this._handler.getViewBox();
4916
+ return !(0 === viewBox.x1 && 0 === viewBox.y1 && this.width === viewBox.width() && this.height === viewBox.height());
4880
4917
  }
4881
4918
  isVisible(bbox) {
4882
4919
  return this._handler.isVisible(bbox);
@@ -4962,8 +4999,16 @@
4962
4999
  const window = container.get(VWindow),
4963
5000
  bounds = graphic.AABBBounds,
4964
5001
  width = bounds.width(),
4965
- height = bounds.height();
5002
+ height = bounds.height(),
5003
+ x1 = -bounds.x1,
5004
+ y1 = -bounds.y1;
4966
5005
  window.create({
5006
+ viewBox: {
5007
+ x1: x1,
5008
+ y1: y1,
5009
+ x2: bounds.x2,
5010
+ y2: bounds.y2
5011
+ },
4967
5012
  width: width,
4968
5013
  height: height,
4969
5014
  canvas: canvas,
@@ -4972,14 +5017,10 @@
4972
5017
  offscreen: !0,
4973
5018
  title: ""
4974
5019
  });
4975
- const x = -bounds.x1,
4976
- y = -bounds.y1,
4977
- disableCheckGraphicWidthOutRange = stage.params.optimize.disableCheckGraphicWidthOutRange;
5020
+ const disableCheckGraphicWidthOutRange = stage.params.optimize.disableCheckGraphicWidthOutRange;
4978
5021
  stage.params.optimize.disableCheckGraphicWidthOutRange = !0, stage.defaultLayer.getNativeHandler().drawTo(window, [graphic], {
4979
- x: x,
4980
- y: y,
4981
- width: width,
4982
- height: height,
5022
+ transMatrix: window.getViewBoxTransform(),
5023
+ viewBox: window.getViewBox(),
4983
5024
  stage: stage,
4984
5025
  layer: stage.defaultLayer,
4985
5026
  renderService: stage.renderService,
@@ -5803,7 +5844,7 @@
5803
5844
  const mappers = this.mappingTable[e.type];
5804
5845
  let target;
5805
5846
  const cacheKey = `${e.canvasX}-${e.canvasY}`;
5806
- 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 = {
5847
+ 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 = {
5807
5848
  [cacheKey]: target,
5808
5849
  stageRenderCount: null !== (_g = null == target ? void 0 : target.stage.renderCount) && void 0 !== _g ? _g : -1
5809
5850
  })), 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}`);
@@ -5838,12 +5879,14 @@
5838
5879
  return currentTarget;
5839
5880
  }
5840
5881
  createPointerEvent(from, type, target) {
5882
+ var _a, _b;
5841
5883
  const event = this.allocateEvent(FederatedPointerEvent);
5842
- return this.copyPointerData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(event.global.x, event.global.y, event), "string" == typeof type && (event.type = type), event;
5884
+ return this.copyPointerData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(null !== (_a = event.viewX) && void 0 !== _a ? _a : event.global.x, null !== (_b = event.viewY) && void 0 !== _b ? _b : event.global.y, event), "string" == typeof type && (event.type = type), event;
5843
5885
  }
5844
5886
  createWheelEvent(from, target) {
5887
+ var _a, _b;
5845
5888
  const event = this.allocateEvent(FederatedWheelEvent);
5846
- return this.copyWheelData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(event.global.x, event.global.y, event), event;
5889
+ return this.copyWheelData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(null !== (_a = event.viewX) && void 0 !== _a ? _a : event.global.x, null !== (_b = event.viewY) && void 0 !== _b ? _b : event.global.y, event), event;
5847
5890
  }
5848
5891
  clonePointerEvent(from, type) {
5849
5892
  const event = this.allocateEvent(FederatedPointerEvent);
@@ -5900,6 +5943,9 @@
5900
5943
  const pickResult = this.rootTarget.pick(x, y);
5901
5944
  return target = pickResult && pickResult.graphic ? pickResult.graphic : pickResult && pickResult.group ? pickResult.group : this.rootTarget.AABBBounds.contains(x, y) ? this.rootTarget : null, e && (e.pickParams = pickResult.params), target;
5902
5945
  }
5946
+ release() {
5947
+ this.dispatch.removeAllListeners(), this.eventPool.clear(), this.rootTarget = null, this.mappingTable = null, this.mappingState = null, this.cursorTarget = null;
5948
+ }
5903
5949
  };
5904
5950
 
5905
5951
  const EventTarget$2 = {
@@ -5947,7 +5993,7 @@
5947
5993
  this.setCursor(this.manager.cursor, this.manager.cursorTarget);
5948
5994
  }, this.onPointerUp = nativeEvent => {
5949
5995
  if (this.supportsTouchEvents && "touch" === nativeEvent.pointerType) return;
5950
- const outside = this.isEventOutsideOfTargetElement(nativeEvent) ? "outside" : "",
5996
+ const outside = this.isEventOutsideOfTargetViewPort(nativeEvent) ? "outside" : "",
5951
5997
  normalizedEvents = this.normalizeToPointerData(nativeEvent);
5952
5998
  for (let i = 0, j = normalizedEvents.length; i < j; i++) {
5953
5999
  const event = this.bootstrapEvent(this.rootPointerEvent, normalizedEvents[i]);
@@ -5971,7 +6017,6 @@
5971
6017
  resolution: resolution,
5972
6018
  rootNode: rootNode,
5973
6019
  global: global,
5974
- viewport: viewport,
5975
6020
  autoPreventDefault = !1,
5976
6021
  clickInterval: clickInterval,
5977
6022
  supportsTouchEvents = global.supportsTouchEvents,
@@ -5979,13 +6024,13 @@
5979
6024
  } = params;
5980
6025
  this.manager = new EventManager$1(rootNode, {
5981
6026
  clickInterval: clickInterval
5982
- }), 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 = {
6027
+ }), 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 = {
5983
6028
  default: "inherit",
5984
6029
  pointer: "pointer"
5985
6030
  }, this.resolution = resolution, this.setTargetElement(targetElement);
5986
6031
  }
5987
6032
  release() {
5988
- this.setTargetElement(null);
6033
+ this.removeEvents(), this.manager && this.manager.release(), this.domElement = null, this.manager = null, this.globalObj = null;
5989
6034
  }
5990
6035
  setCursor(mode, target) {
5991
6036
  if (!target && !this.manager.rootTarget.window._handler.canvas.controled) return;
@@ -6021,25 +6066,19 @@
6021
6066
  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;
6022
6067
  }
6023
6068
  mapToViewportPoint(event) {
6024
- const viewport = this.viewport,
6025
- {
6026
- x: x,
6027
- y: y
6028
- } = event;
6029
- return {
6030
- x: x - viewport.x,
6031
- y: y - viewport.y
6032
- };
6069
+ return this.domElement.pointTransform ? this.domElement.pointTransform(event.x, event.y) : event;
6033
6070
  }
6034
6071
  mapToCanvasPoint(nativeEvent) {
6035
- var _a;
6072
+ var _a, _b;
6036
6073
  const point = null === (_a = this.globalObj) || void 0 === _a ? void 0 : _a.mapToCanvasPoint(nativeEvent, this.domElement);
6037
6074
  if (point) return point;
6038
- const {
6039
- clientX: x,
6040
- clientY: y
6041
- } = nativeEvent,
6042
- rect = this.domElement.getBoundingClientRect();
6075
+ let x = 0,
6076
+ y = 0;
6077
+ if (nativeEvent.changedTouches) {
6078
+ const data = null !== (_b = nativeEvent.changedTouches[0]) && void 0 !== _b ? _b : {};
6079
+ x = data.clientX || 0, y = data.clientY || 0;
6080
+ } else x = nativeEvent.clientX || 0, y = nativeEvent.clientY || 0;
6081
+ const rect = this.domElement.getBoundingClientRect();
6043
6082
  return {
6044
6083
  x: x - rect.left,
6045
6084
  y: y - rect.top
@@ -6086,6 +6125,17 @@
6086
6125
  transferMouseData(event, nativeEvent) {
6087
6126
  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;
6088
6127
  }
6128
+ isEventOutsideOfTargetViewPort(nativeEvent) {
6129
+ if (this.isEventOutsideOfTargetElement(nativeEvent)) return !0;
6130
+ if (this.domElement.getViewBox) {
6131
+ const p = this.mapToViewportPoint(this.mapToCanvasPoint(nativeEvent)),
6132
+ b = this.domElement.getViewBox(),
6133
+ w = b.width(),
6134
+ h = b.height();
6135
+ return !(p.x < w && p.y < h && p.x > 0 && p.y > 0);
6136
+ }
6137
+ return !1;
6138
+ }
6089
6139
  isEventOutsideOfTargetElement(nativeEvent) {
6090
6140
  let target = nativeEvent.target;
6091
6141
  nativeEvent.composedPath && nativeEvent.composedPath().length > 0 && (target = nativeEvent.composedPath()[0]);
@@ -6789,10 +6839,10 @@
6789
6839
  easing: "cubicOut"
6790
6840
  };
6791
6841
 
6792
- var Edge;
6842
+ var Edge$1;
6793
6843
  !function (Edge) {
6794
6844
  Edge[Edge.Top = 1] = "Top", Edge[Edge.Right = 2] = "Right", Edge[Edge.Bottom = 4] = "Bottom", Edge[Edge.Left = 8] = "Left", Edge[Edge.ALL = 15] = "ALL";
6795
- }(Edge || (Edge = {}));
6845
+ }(Edge$1 || (Edge$1 = {}));
6796
6846
  const _strokeVec4 = [!1, !1, !1, !1];
6797
6847
  const parseStroke = stroke => {
6798
6848
  var _a;
@@ -7110,9 +7160,9 @@
7110
7160
  promises.push(end);
7111
7161
  } else data.loadState = "fail", marks.forEach(mark => mark.imageLoadFail(url));
7112
7162
  }), Promise.all(promises).then(() => {
7113
- ResourceLoader.isLoading = !1, ResourceLoader.loading();
7163
+ ResourceLoader.isLoading = !1, this.onLoadSuccessCb.forEach(cb => cb()), ResourceLoader.loading();
7114
7164
  }).catch(error => {
7115
- ResourceLoader.isLoading = !1, ResourceLoader.loading();
7165
+ ResourceLoader.isLoading = !1, this.onLoadSuccessCb.forEach(cb => cb()), ResourceLoader.loading();
7116
7166
  });
7117
7167
  }
7118
7168
  }, 0);
@@ -7132,12 +7182,15 @@
7132
7182
  ResourceLoader.toLoadAueue.unshift(elememt[0]);
7133
7183
  }
7134
7184
  }
7185
+ static onLoadSuccess(cb) {
7186
+ this.onLoadSuccessCb.push(cb);
7187
+ }
7135
7188
  }
7136
7189
  function getIndex(url, arr) {
7137
7190
  for (let i = 0; i < arr.length; i++) if (arr[i].url === url) return i;
7138
7191
  return -1;
7139
7192
  }
7140
- ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [];
7193
+ ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [], ResourceLoader.onLoadSuccessCb = [];
7141
7194
 
7142
7195
  const tempMatrix = new Matrix(),
7143
7196
  tempBounds$1 = new AABBBounds$1();
@@ -7244,7 +7297,7 @@
7244
7297
  }
7245
7298
  tryUpdateGlobalAABBBounds() {
7246
7299
  const b = this.AABBBounds;
7247
- 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;
7300
+ return this._globalAABBBounds ? this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2) : this._globalAABBBounds = b.clone(), this._globalAABBBounds.empty() || this.parent && this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix), this._globalAABBBounds;
7248
7301
  }
7249
7302
  tryUpdateGlobalTransMatrix() {
7250
7303
  if (this._globalTransMatrix) {
@@ -8321,15 +8374,12 @@
8321
8374
  }
8322
8375
  render(params, userParams) {
8323
8376
  var _a;
8324
- const stage = this.stage;
8325
8377
  this.layerHandler.render([this], {
8326
8378
  renderService: params.renderService,
8327
- x: stage.x,
8328
- y: stage.y,
8329
- width: this.viewWidth,
8330
- height: this.viewHeight,
8331
8379
  stage: this.stage,
8332
8380
  layer: this,
8381
+ viewBox: params.viewBox,
8382
+ transMatrix: params.transMatrix,
8333
8383
  background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
8334
8384
  updateBounds: params.updateBounds
8335
8385
  }, userParams), this.afterDrawCbs.forEach(c => c(this)), this.tryRenderSecondaryLayer(params, userParams);
@@ -8353,33 +8403,18 @@
8353
8403
  throw new Error("暂不支持");
8354
8404
  }
8355
8405
  prepare(dirtyBounds, params) {}
8356
- combineTo(target, params) {
8357
- var _a, _b, _c;
8358
- this.offscreen && (this.layerHandler.drawTo(target, [this], Object.assign({
8359
- background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
8360
- renderService: params.renderService,
8361
- x: null !== (_b = params.x) && void 0 !== _b ? _b : this.stage.x,
8362
- y: null !== (_c = params.y) && void 0 !== _c ? _c : this.stage.y,
8363
- width: this.viewWidth,
8364
- height: this.viewHeight,
8365
- stage: this.stage,
8366
- layer: this
8367
- }, params)), this.afterDrawCbs.forEach(c => c(this)));
8368
- }
8369
8406
  release() {
8370
8407
  super.release(), this.layerHandler.release(), this.subLayers && this.subLayers.forEach(l => {
8371
8408
  application.layerService.releaseLayer(this.stage, l.layer);
8372
8409
  });
8373
8410
  }
8374
8411
  drawTo(target, params) {
8375
- var _a, _b, _c;
8412
+ var _a;
8376
8413
  this.layerHandler.drawTo(target, [this], Object.assign({
8377
8414
  background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
8378
8415
  renderService: params.renderService,
8379
- x: null !== (_b = params.x) && void 0 !== _b ? _b : this.stage.x,
8380
- y: null !== (_c = params.y) && void 0 !== _c ? _c : this.stage.y,
8381
- width: this.viewWidth,
8382
- height: this.viewHeight,
8416
+ viewBox: params.viewBox,
8417
+ transMatrix: params.transMatrix,
8383
8418
  stage: this.stage,
8384
8419
  layer: this
8385
8420
  }, params)), this.afterDrawCbs.forEach(c => c(this));
@@ -8461,6 +8496,9 @@
8461
8496
  restLayerCount(stage) {
8462
8497
  return "browser" === this.global.env ? 10 : 0;
8463
8498
  }
8499
+ releaseStage(stage) {
8500
+ this.layerMap.delete(stage);
8501
+ }
8464
8502
  };
8465
8503
  DefaultLayerService.idprefix = "visactor_layer", DefaultLayerService.prefix_count = 0, DefaultLayerService = DefaultLayerService_1 = __decorate$1a([injectable(), __metadata$T("design:paramtypes", [])], DefaultLayerService);
8466
8504
 
@@ -8497,7 +8535,9 @@
8497
8535
  fillOpacity = themeAttributes.fillOpacity,
8498
8536
  lineWidth = themeAttributes.lineWidth,
8499
8537
  strokeOpacity = themeAttributes.strokeOpacity,
8500
- visible = themeAttributes.visible
8538
+ visible = themeAttributes.visible,
8539
+ x: originX = themeAttributes.x,
8540
+ y: originY = themeAttributes.y
8501
8541
  } = graphic.attribute,
8502
8542
  fVisible = fillVisible(opacity, fillOpacity, fill),
8503
8543
  sVisible = strokeVisible(opacity, strokeOpacity),
@@ -8508,7 +8548,7 @@
8508
8548
  if (!(fVisible || sVisible || fillCb || strokeCb)) return !0;
8509
8549
  context.beginPath();
8510
8550
  const path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
8511
- return renderCommandList(path.commandList, context, x, y), context.setShadowBlendStyle && context.setShadowBlendStyle(graphic, graphic.attribute, themeAttributes), doStroke && (strokeCb ? strokeCb(context, graphic.attribute, themeAttributes) : sVisible && (context.setStrokeStyle(graphic, graphic.attribute, x, y, themeAttributes), context.stroke())), doFill && (fillCb ? fillCb(context, graphic.attribute, themeAttributes) : fVisible && (context.setCommonStyle(graphic, graphic.attribute, x, y, themeAttributes), context.fill())), !0;
8551
+ return renderCommandList(path.commandList, context, x, y), context.setShadowBlendStyle && context.setShadowBlendStyle(graphic, graphic.attribute, themeAttributes), doStroke && (strokeCb ? strokeCb(context, graphic.attribute, themeAttributes) : sVisible && (context.setStrokeStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes), context.stroke())), doFill && (fillCb ? fillCb(context, graphic.attribute, themeAttributes) : fVisible && (context.setCommonStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes), context.fill())), !0;
8512
8552
  }
8513
8553
  function intersect$2(x0, y0, x1, y1, x2, y2, x3, y3) {
8514
8554
  const x10 = x1 - x0,
@@ -10997,7 +11037,8 @@
10997
11037
  fontSize: fontSize,
10998
11038
  fontFamily: fontFamily,
10999
11039
  fontStyle: fontStyle,
11000
- fontWeight: fontWeight
11040
+ fontWeight: fontWeight,
11041
+ lineWidth: lineWidth
11001
11042
  } = this.attribute;
11002
11043
  return Object.assign({
11003
11044
  fill: fill,
@@ -11005,7 +11046,8 @@
11005
11046
  fontSize: fontSize,
11006
11047
  fontFamily: fontFamily,
11007
11048
  fontStyle: fontStyle,
11008
- fontWeight: fontWeight
11049
+ fontWeight: fontWeight,
11050
+ lineWidth: lineWidth
11009
11051
  }, config);
11010
11052
  }
11011
11053
  doUpdateFrameCache() {
@@ -14304,7 +14346,9 @@
14304
14346
  const endSeg = segments[segments.length - 1];
14305
14347
  startP = segments[0].points[0], endP = endSeg.points[endSeg.points.length - 1];
14306
14348
  } else startP = points[0], endP = points[points.length - 1];
14307
- direction = abs(endP.x - startP.x) > abs(endP.y - startP.y) ? Direction.ROW : Direction.COLUMN, drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {
14349
+ const xTotalLength = abs(endP.x - startP.x),
14350
+ yTotalLength = abs(endP.y - startP.y);
14351
+ direction = Number.isFinite(xTotalLength + yTotalLength) ? xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN : Direction.ROW, drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {
14308
14352
  offsetX: offsetX,
14309
14353
  offsetY: offsetY,
14310
14354
  offsetZ: offsetZ,
@@ -14682,7 +14726,7 @@
14682
14726
  doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
14683
14727
  context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
14684
14728
  }))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(line => {
14685
- context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), this.drawMultiUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + x, (line.topOffset || 0) + yOffset + y - textDrawOffsetY("bottom", fontSize) - .05 * fontSize, z, line.width, textAttribute, context);
14729
+ context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), this.drawMultiUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y - textDrawOffsetY("bottom", fontSize) - .05 * fontSize, z, line.width, textAttribute, context);
14686
14730
  })));
14687
14731
  } else {
14688
14732
  text.tryUpdateAABBBounds();
@@ -14784,7 +14828,6 @@
14784
14828
  drawMultiUnderLine(underline, lineThrough, text, x, y, z, w, textAttribute, context) {
14785
14829
  if (lineThrough + underline <= 0) return;
14786
14830
  const {
14787
- textAlign = textAttribute.textAlign,
14788
14831
  fontSize = textAttribute.fontSize,
14789
14832
  fill = textAttribute.fill,
14790
14833
  opacity = textAttribute.opacity,
@@ -14792,7 +14835,6 @@
14792
14835
  underlineDash = textAttribute.underlineDash,
14793
14836
  fillOpacity = textAttribute.fillOpacity
14794
14837
  } = text.attribute,
14795
- offsetX = textDrawOffsetX(textAlign, w),
14796
14838
  offsetY = textLayoutOffsetY("alphabetic", fontSize, fontSize),
14797
14839
  attribute = {
14798
14840
  lineWidth: 0,
@@ -14804,12 +14846,12 @@
14804
14846
  if (underline) {
14805
14847
  attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.setLineDash(underlineDash), context.beginPath();
14806
14848
  const dy = y + offsetY + fontSize + deltaY + underlineOffset;
14807
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
14849
+ context.moveTo(x + 0, dy, z), context.lineTo(x + 0 + w, dy, z), context.stroke();
14808
14850
  }
14809
14851
  if (deltaY = -1, lineThrough) {
14810
14852
  attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.beginPath();
14811
14853
  const dy = y + offsetY + fontSize / 2 + deltaY;
14812
- context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
14854
+ context.moveTo(x + 0, dy, z), context.lineTo(x + 0 + w, dy, z), context.stroke();
14813
14855
  }
14814
14856
  }
14815
14857
  };
@@ -15606,10 +15648,10 @@
15606
15648
  render(group, params) {
15607
15649
  var _a;
15608
15650
  params.renderService.render(group, Object.assign(Object.assign({
15609
- context: this.context
15651
+ context: this.context,
15652
+ viewBox: params.stage.window.getViewBox(),
15653
+ transMatrix: params.stage.window.getViewBoxTransform()
15610
15654
  }, params), {
15611
- x: 0,
15612
- y: 0,
15613
15655
  clear: null !== (_a = params.background) && void 0 !== _a ? _a : "#ffffff"
15614
15656
  }));
15615
15657
  }
@@ -15624,11 +15666,12 @@
15624
15666
  const context = target.getContext(),
15625
15667
  targetDpr = target.dpr,
15626
15668
  {
15627
- x = 0,
15628
- y = 0,
15629
- width = this.layer.viewWidth,
15630
- height = this.layer.viewHeight
15631
- } = params;
15669
+ viewBox: viewBox
15670
+ } = params,
15671
+ x = viewBox.x1,
15672
+ y = viewBox.y1,
15673
+ width = viewBox.width(),
15674
+ height = viewBox.height();
15632
15675
  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();
15633
15676
  }
15634
15677
  merge(layerHandlers) {}
@@ -15784,32 +15827,22 @@
15784
15827
  const {
15785
15828
  context: context,
15786
15829
  stage: stage,
15787
- x = 0,
15788
- y = 0,
15789
- width: width,
15790
- height: height
15830
+ viewBox: viewBox,
15831
+ transMatrix: transMatrix
15791
15832
  } = drawContext;
15792
15833
  if (!context) return;
15793
- if (drawContext.keepMatrix) {
15794
- if (context.nativeContext && context.nativeContext.getTransform) {
15795
- const t = context.nativeContext.getTransform();
15796
- context.setTransformFromMatrix(t, !0, 1);
15797
- }
15798
- } else context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
15799
- const dirtyBounds = this.dirtyBounds.setValue(0, 0, width, height);
15834
+ const dirtyBounds = this.dirtyBounds.setValue(0, 0, viewBox.width(), viewBox.height());
15800
15835
  if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {
15801
15836
  const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, !1);
15802
15837
  dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
15803
15838
  }
15804
15839
  const d = context.dpr % 1;
15805
- (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);
15806
- const drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
15807
- 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) => {
15840
+ (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) => {
15808
15841
  var _a, _b;
15809
15842
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
15810
15843
  }).forEach(group => {
15811
15844
  group.isContainer ? this.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : this.renderItem(group, drawContext);
15812
- }), context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1);
15845
+ }), context.restore(), context.draw(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1;
15813
15846
  }
15814
15847
  doRegister() {
15815
15848
  throw new Error("暂不支持");
@@ -15933,29 +15966,25 @@
15933
15966
  clearScreen(renderService, context, drawContext) {
15934
15967
  var _a, _b;
15935
15968
  const {
15936
- clear: clear
15937
- } = drawContext;
15969
+ clear: clear,
15970
+ viewBox: viewBox
15971
+ } = drawContext,
15972
+ width = viewBox.width(),
15973
+ height = viewBox.height();
15938
15974
  if (clear) {
15939
- const canvas = context.getCanvas(),
15940
- {
15941
- width = canvas.width,
15942
- height = canvas.height
15943
- } = drawContext,
15944
- x = 0,
15945
- y = 0;
15946
- context.clearRect(x, y, width, height);
15975
+ context.clearRect(0, 0, width, height);
15947
15976
  const stage = null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage;
15948
15977
  if (stage && (context.globalAlpha = null !== (_b = stage.attribute.opacity) && void 0 !== _b ? _b : 1), stage && stage.backgroundImg && stage.resources) {
15949
15978
  const res = stage.resources.get(clear);
15950
- res && "success" === res.state && res.data && context.drawImage(res.data, x, y, width, height);
15979
+ res && "success" === res.state && res.data && context.drawImage(res.data, 0, 0, width, height);
15951
15980
  } else context.fillStyle = createColor(context, clear, {
15952
15981
  AABBBounds: {
15953
- x1: x,
15954
- y1: y,
15955
- x2: x + width,
15956
- y2: y + height
15982
+ x1: 0,
15983
+ y1: 0,
15984
+ x2: 0 + width,
15985
+ y2: 0 + height
15957
15986
  }
15958
- }, 0, 0), context.fillRect(x, y, width, height);
15987
+ }, 0, 0), context.fillRect(0, 0, width, height);
15959
15988
  }
15960
15989
  }
15961
15990
  afterDraw(renderService, drawParams) {}
@@ -16212,25 +16241,16 @@
16212
16241
  this.currentRenderService = renderService;
16213
16242
  const {
16214
16243
  context: context,
16215
- x = 0,
16216
- y = 0
16244
+ viewBox: viewBox
16217
16245
  } = drawContext;
16218
- if (context) {
16219
- if (drawContext.keepMatrix) {
16220
- if (context.nativeContext && context.nativeContext.getTransform) {
16221
- const t = context.nativeContext.getTransform();
16222
- context.setTransformFromMatrix(t, !0, 1);
16223
- }
16224
- } else context.inuse = !0, context.clearMatrix();
16225
- 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) => {
16226
- var _a, _b;
16227
- return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
16228
- }).forEach(group => {
16229
- this.renderGroup(group, drawContext);
16230
- }), this.hooks.completeDraw.tap("top-draw", () => {
16231
- context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1), this.rendering = !1;
16232
- });
16233
- }
16246
+ 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) => {
16247
+ var _a, _b;
16248
+ return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
16249
+ }).forEach(group => {
16250
+ this.renderGroup(group, drawContext);
16251
+ }), this.hooks.completeDraw.tap("top-draw", () => {
16252
+ context.restore(), context.restore(), context.draw(), context.inuse = !1, this.rendering = !1;
16253
+ }));
16234
16254
  });
16235
16255
  }
16236
16256
  _increaseRender(group, drawContext) {
@@ -16400,12 +16420,10 @@
16400
16420
  if (!layer || !group.layer.subLayers) return;
16401
16421
  const subLayer = group.layer.subLayers.get(group._uid);
16402
16422
  subLayer && subLayer.drawContribution && subLayer.drawContribution.draw(stage.renderService, Object.assign({
16403
- x: stage.x,
16404
- y: stage.y,
16405
- width: layer.viewWidth,
16406
- height: layer.viewHeight,
16407
16423
  stage: stage,
16408
16424
  layer: layer,
16425
+ viewBox: stage.window.getViewBox(),
16426
+ transMatrix: stage.window.getViewBoxTransform(),
16409
16427
  clear: "transparent",
16410
16428
  renderService: stage.renderService,
16411
16429
  updateBounds: !1,
@@ -16418,7 +16436,7 @@
16418
16436
 
16419
16437
  class HtmlAttributePlugin {
16420
16438
  constructor() {
16421
- this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid;
16439
+ this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.lastDomContainerSet = new Set(), this.currentDomContainerSet = new Set();
16422
16440
  }
16423
16441
  activate(context) {
16424
16442
  this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
@@ -16430,15 +16448,17 @@
16430
16448
  });
16431
16449
  }
16432
16450
  deactivate(context) {
16433
- context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => item.name !== this.key);
16451
+ context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => item.name !== this.key), application.graphicService.hooks.onRemove.unTap(this.key), application.graphicService.hooks.onRelease.unTap(this.key), this.release();
16434
16452
  }
16435
16453
  drawHTML(renderService) {
16436
- "browser" === application.global.env && renderService.renderTreeRoots.sort((a, b) => {
16454
+ "browser" === application.global.env && (renderService.renderTreeRoots.sort((a, b) => {
16437
16455
  var _a, _b;
16438
16456
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
16439
16457
  }).forEach(group => {
16440
16458
  this.renderGroupHTML(group);
16441
- });
16459
+ }), this.lastDomContainerSet.forEach(item => {
16460
+ this.currentDomContainerSet.has(item) || item.parentElement && item.parentElement.removeChild(item);
16461
+ }), this.lastDomContainerSet = new Set(this.currentDomContainerSet), this.currentDomContainerSet.clear());
16442
16462
  }
16443
16463
  renderGroupHTML(group) {
16444
16464
  this.renderGraphicHTML(group), group.forEachChildren(g => {
@@ -16465,7 +16485,8 @@
16465
16485
  width: width,
16466
16486
  height: height,
16467
16487
  style: style,
16468
- anchorType = "boundsLeftTop"
16488
+ anchorType = "boundsLeftTop",
16489
+ pointerEvents: pointerEvents
16469
16490
  } = html;
16470
16491
  graphic.bindDom || (graphic.bindDom = new Map());
16471
16492
  const lastDom = graphic.bindDom.get(dom);
@@ -16491,7 +16512,7 @@
16491
16512
  wrapGroup: wrapGroup
16492
16513
  }));
16493
16514
  } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
16494
- wrapGroup.style.pointerEvents = "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
16515
+ wrapGroup.style.pointerEvents = pointerEvents || "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
16495
16516
  let left = 0,
16496
16517
  top = 0;
16497
16518
  const b = graphic.globalAABBBounds;
@@ -16503,7 +16524,15 @@
16503
16524
  windowTL = stage.window.getTopLeft(!1),
16504
16525
  offsetX = left + windowTL.left - containerTL.left,
16505
16526
  offsetTop = top + windowTL.top - containerTL.top;
16506
- wrapGroup.style.left = `${offsetX}px`, wrapGroup.style.top = `${offsetTop}px`;
16527
+ wrapGroup.style.left = `${offsetX}px`, wrapGroup.style.top = `${offsetTop}px`, this.currentDomContainerSet.add(wrapGroup);
16528
+ }
16529
+ release() {
16530
+ "browser" === application.global.env && (this.removeAllDom(this.pluginService.stage.defaultLayer), this.lastDomContainerSet.clear(), this.currentDomContainerSet.clear());
16531
+ }
16532
+ removeAllDom(g) {
16533
+ this.removeDom(g), g.forEachChildren(item => {
16534
+ item.isContainer && this.removeAllDom(g);
16535
+ });
16507
16536
  }
16508
16537
  }
16509
16538
 
@@ -16950,6 +16979,78 @@
16950
16979
  return env ? "node" === env : !_isBrowserEnv;
16951
16980
  }
16952
16981
 
16982
+ class ReactAttributePlugin extends HtmlAttributePlugin {
16983
+ constructor() {
16984
+ super(...arguments), this.name = "ReactAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid;
16985
+ }
16986
+ removeDom(graphic) {
16987
+ graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(item => {
16988
+ item.root && item.root.unmount();
16989
+ }), graphic.bindDom.clear());
16990
+ }
16991
+ renderGraphicHTML(graphic) {
16992
+ const {
16993
+ react: react
16994
+ } = graphic.attribute;
16995
+ if (!react) return void (graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(item => {
16996
+ item.root && item.root.unmount();
16997
+ }), graphic.bindDom.clear()));
16998
+ const stage = graphic.stage;
16999
+ if (!stage) return;
17000
+ const ReactDOM = stage.params.ReactDOM,
17001
+ {
17002
+ element: element,
17003
+ container: container,
17004
+ width: width,
17005
+ height: height,
17006
+ style: style,
17007
+ anchorType = "boundsLeftTop",
17008
+ pointerEvents: pointerEvents
17009
+ } = react;
17010
+ if (!(element && ReactDOM && ReactDOM.createRoot)) return;
17011
+ graphic.bindDom || (graphic.bindDom = new Map());
17012
+ const lastDom = graphic.bindDom.get(element);
17013
+ let wrapGroup, nativeContainer;
17014
+ if (!lastDom || container && container !== lastDom.container) {
17015
+ graphic.bindDom.forEach(_ref => {
17016
+ let {
17017
+ wrapGroup: wrapGroup
17018
+ } = _ref;
17019
+ application.global.removeDom(wrapGroup);
17020
+ });
17021
+ const _container = container;
17022
+ if (nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(), wrapGroup = application.global.createDom({
17023
+ tagName: "div",
17024
+ width: width,
17025
+ height: height,
17026
+ style: style,
17027
+ parent: nativeContainer
17028
+ }), wrapGroup) {
17029
+ const root = ReactDOM.createRoot(wrapGroup);
17030
+ root.render(element), graphic.bindDom.set(element, {
17031
+ dom: element,
17032
+ container: container,
17033
+ wrapGroup: wrapGroup,
17034
+ root: root
17035
+ });
17036
+ }
17037
+ } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
17038
+ wrapGroup.style.pointerEvents = pointerEvents || "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
17039
+ let left = 0,
17040
+ top = 0;
17041
+ const b = graphic.globalAABBBounds;
17042
+ if ("position" === anchorType || b.empty()) {
17043
+ const matrix = graphic.globalTransMatrix;
17044
+ left = matrix.e, top = matrix.f;
17045
+ } else left = b.x1, top = b.y1;
17046
+ const containerTL = application.global.getElementTopLeft(nativeContainer, !1),
17047
+ windowTL = stage.window.getTopLeft(!1),
17048
+ offsetX = left + windowTL.left - containerTL.left,
17049
+ offsetTop = top + windowTL.top - containerTL.top;
17050
+ wrapGroup.style.left = `${offsetX}px`, wrapGroup.style.top = `${offsetTop}px`;
17051
+ }
17052
+ }
17053
+
16953
17054
  const DefaultConfig$1 = {
16954
17055
  WIDTH: 500,
16955
17056
  HEIGHT: 500,
@@ -16959,22 +17060,24 @@
16959
17060
  };
16960
17061
  class Stage extends Group$2 {
16961
17062
  set viewBox(b) {
16962
- this._viewBox.setValue(b.x1, b.y1, b.x2, b.y2);
17063
+ this.window.setViewBox(b);
16963
17064
  }
16964
17065
  get viewBox() {
16965
- return this._viewBox;
17066
+ return this.window.getViewBox();
16966
17067
  }
16967
17068
  get x() {
16968
- return this._viewBox.x1;
17069
+ return this.window.getViewBox().x1;
16969
17070
  }
16970
17071
  set x(x) {
16971
- this._viewBox.translate(x - this._viewBox.x1, 0);
17072
+ const b = this.window.getViewBox();
17073
+ b.translate(x - b.x1, 0), this.window.setViewBox(b);
16972
17074
  }
16973
17075
  get y() {
16974
- return this._viewBox.y1;
17076
+ return this.window.getViewBox().y1;
16975
17077
  }
16976
17078
  set y(y) {
16977
- this._viewBox.translate(0, y - this._viewBox.y1);
17079
+ const b = this.window.getViewBox();
17080
+ b.translate(0, y - b.y1), this.window.setViewBox(b);
16978
17081
  }
16979
17082
  get width() {
16980
17083
  return this.window.width;
@@ -16983,13 +17086,13 @@
16983
17086
  this.resize(w, this.height);
16984
17087
  }
16985
17088
  get viewWidth() {
16986
- return this._viewBox.width();
17089
+ return this.window.getViewBox().width();
16987
17090
  }
16988
17091
  set viewWidth(w) {
16989
17092
  this.resizeView(w, this.viewHeight);
16990
17093
  }
16991
17094
  get viewHeight() {
16992
- return this._viewBox.height();
17095
+ return this.window.getViewBox().height();
16993
17096
  }
16994
17097
  set viewHeight(h) {
16995
17098
  this.resizeView(this.viewWidth, h);
@@ -17023,7 +17126,13 @@
17023
17126
  let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17024
17127
  var _a;
17025
17128
  super({}), this._onVisibleChange = visible => {
17026
- 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);
17129
+ if (!(this._skipRender < 0)) if (visible) {
17130
+ if (this.dirtyBounds) {
17131
+ const b = this.window.getViewBox();
17132
+ this.dirtyBounds.setValue(b.x1, b.y1, b.width(), b.height());
17133
+ }
17134
+ this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
17135
+ } else this._skipRender = 1;
17027
17136
  }, this.beforeRender = stage => {
17028
17137
  this._beforeRender && this._beforeRender(stage);
17029
17138
  }, this.afterRender = stage => {
@@ -17034,17 +17143,24 @@
17034
17143
  }, 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({
17035
17144
  width: params.width,
17036
17145
  height: params.height,
17146
+ viewBox: params.viewBox,
17037
17147
  container: params.container,
17038
17148
  dpr: params.dpr || this.global.devicePixelRatio,
17039
17149
  canvasControled: !1 !== params.canvasControled,
17040
17150
  title: params.title || "",
17041
17151
  canvas: params.canvas
17042
- }), this._viewBox = new AABBBounds$1(), 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, {
17152
+ }), 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, {
17043
17153
  main: !0
17044
- })), 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$4(this._background) && this._background.includes("/") && this.setAttributes({
17154
+ })), 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.ReactDOM && this.enableReactAttribute(params.ReactDOM), 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$4(this._background) && this._background.includes("/") && this.setAttributes({
17045
17155
  background: this._background
17046
17156
  });
17047
17157
  }
17158
+ pauseRender() {
17159
+ this._skipRender = -1;
17160
+ }
17161
+ resumeRender() {
17162
+ this._skipRender = 0;
17163
+ }
17048
17164
  tryInitEventSystem() {
17049
17165
  this.global.supportEvent && !this._eventSystem && (this._eventSystem = new EventSystem(Object.assign({
17050
17166
  targetElement: this.window,
@@ -17052,22 +17168,7 @@
17052
17168
  rootNode: this,
17053
17169
  global: this.global,
17054
17170
  supportsPointerEvents: this.params.supportsPointerEvents,
17055
- supportsTouchEvents: this.params.supportsTouchEvents,
17056
- viewport: {
17057
- viewBox: this._viewBox,
17058
- get x() {
17059
- return this.viewBox.x1;
17060
- },
17061
- get y() {
17062
- return this.viewBox.y1;
17063
- },
17064
- get width() {
17065
- return this.viewBox.width();
17066
- },
17067
- get height() {
17068
- return this.viewBox.height();
17069
- }
17070
- }
17171
+ supportsTouchEvents: this.params.supportsTouchEvents
17071
17172
  }, this.params.event)));
17072
17173
  }
17073
17174
  preventRender(prevent) {
@@ -17210,11 +17311,19 @@
17210
17311
  this.pluginService.unRegister(plugin);
17211
17312
  }));
17212
17313
  }
17314
+ enableReactAttribute(container) {
17315
+ this.reactAttribute || (this.reactAttribute = container, this.pluginService.register(new ReactAttributePlugin()));
17316
+ }
17317
+ disableReactAttribute() {
17318
+ this.reactAttribute && (this.reactAttribute = !1, this.pluginService.findPluginsByName("ReactAttributePlugin").forEach(plugin => {
17319
+ this.pluginService.unRegister(plugin);
17320
+ }));
17321
+ }
17213
17322
  getPluginsByName(name) {
17214
17323
  return this.pluginService.findPluginsByName(name);
17215
17324
  }
17216
17325
  tryUpdateAABBBounds() {
17217
- const viewBox = this._viewBox;
17326
+ const viewBox = this.window.getViewBox();
17218
17327
  return this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2), this._AABBBounds;
17219
17328
  }
17220
17329
  combineLayer(ILayer1, ILayer2) {
@@ -17241,12 +17350,12 @@
17241
17350
  this.supportInteractiveLayer && !this.interactiveLayer && (this.interactiveLayer = this.createLayer(), this.interactiveLayer.name = "_builtin_interactive", this.interactiveLayer.attribute.pickable = !1, this.nextFrameRenderLayerSet.add(this.interactiveLayer));
17242
17351
  }
17243
17352
  clearViewBox(color) {
17244
- this.window.clearViewBox(this._viewBox, color);
17353
+ this.window.clearViewBox(color);
17245
17354
  }
17246
17355
  render(layers, params) {
17247
17356
  this.ticker.start(), this.timeline.resume();
17248
17357
  const state = this.state;
17249
- 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++;
17358
+ 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++;
17250
17359
  }
17251
17360
  combineLayersToWindow() {}
17252
17361
  renderNextFrame(layers, force) {
@@ -17259,7 +17368,7 @@
17259
17368
  _doRenderInThisFrame() {
17260
17369
  this.timeline.resume(), this.ticker.start();
17261
17370
  const state = this.state;
17262
- 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++;
17371
+ 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++;
17263
17372
  }
17264
17373
  renderLayerList(layerList, params) {
17265
17374
  const list = [];
@@ -17271,14 +17380,17 @@
17271
17380
  layer.renderCount > this.renderCount || (layer.renderCount = this.renderCount + 1, layer.render({
17272
17381
  renderService: this.renderService,
17273
17382
  background: layer === this.defaultLayer ? this.background : void 0,
17274
- updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty())
17383
+ updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty()),
17384
+ viewBox: this.window.getViewBox(),
17385
+ transMatrix: this.window.getViewBoxTransform()
17275
17386
  }, Object.assign({
17276
- renderStyle: this.renderStyle,
17277
- keepMatrix: this.params.renderKeepMatrix
17387
+ renderStyle: this.renderStyle
17278
17388
  }, params)));
17279
17389
  }), this.interactiveLayer && !layerList.includes(this.interactiveLayer) && this.interactiveLayer.render({
17280
17390
  renderService: this.renderService,
17281
- updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty())
17391
+ updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty()),
17392
+ viewBox: this.window.getViewBox(),
17393
+ transMatrix: this.window.getViewBoxTransform()
17282
17394
  }, Object.assign({
17283
17395
  renderStyle: this.renderStyle
17284
17396
  }, params));
@@ -17289,9 +17401,9 @@
17289
17401
  }
17290
17402
  resize(w, h) {
17291
17403
  let rerender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
17292
- this.window.resize(w, h), this.forEachChildren(c => {
17404
+ 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 => {
17293
17405
  c.resize(w, h);
17294
- }), 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();
17406
+ }), this.camera && this.option3d && this.set3dOptions(this.option3d), rerender && this.render();
17295
17407
  }
17296
17408
  resizeView(w, h) {
17297
17409
  let rerender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
@@ -17334,7 +17446,7 @@
17334
17446
  throw new Error("暂不支持");
17335
17447
  }
17336
17448
  release() {
17337
- super.release(), this.eventSystem && this.eventSystem.release(), this.pluginService.release(), this.forEach(layer => {
17449
+ super.release(), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(layer => {
17338
17450
  layer.release();
17339
17451
  }), this.interactiveLayer && this.interactiveLayer.release(), this.window.release();
17340
17452
  }
@@ -17345,47 +17457,41 @@
17345
17457
  getLayer(name) {
17346
17458
  return this.children.filter(layer => layer.name === name)[0];
17347
17459
  }
17348
- renderTo(window, params) {
17460
+ renderTo(window) {
17349
17461
  this.forEachChildren((layer, i) => {
17350
- layer.drawTo(window, Object.assign(Object.assign({}, params), {
17462
+ layer.drawTo(window, {
17351
17463
  renderService: this.renderService,
17464
+ viewBox: window.getViewBox(),
17465
+ transMatrix: window.getViewBoxTransform(),
17352
17466
  background: layer === this.defaultLayer ? this.background : void 0,
17353
17467
  clear: 0 === i,
17354
17468
  updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty())
17355
- }));
17469
+ });
17356
17470
  });
17357
17471
  }
17358
17472
  renderToNewWindow() {
17359
- let fullImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
17360
17473
  let viewBox = arguments.length > 1 ? arguments[1] : undefined;
17361
- const window = container.get(VWindow);
17362
- if (fullImage) window.create({
17363
- width: this.viewWidth,
17364
- height: this.viewHeight,
17474
+ const window = container.get(VWindow),
17475
+ x1 = viewBox ? -viewBox.x1 : 0,
17476
+ y1 = viewBox ? -viewBox.y1 : 0,
17477
+ x2 = viewBox ? viewBox.x2 : this.viewWidth,
17478
+ y2 = viewBox ? viewBox.y2 : this.viewHeight,
17479
+ width = viewBox ? viewBox.width() : this.viewWidth,
17480
+ height = viewBox ? viewBox.height() : this.viewHeight;
17481
+ return window.create({
17482
+ viewBox: {
17483
+ x1: x1,
17484
+ y1: y1,
17485
+ x2: x2,
17486
+ y2: y2
17487
+ },
17488
+ width: width,
17489
+ height: height,
17365
17490
  dpr: this.window.dpr,
17366
17491
  canvasControled: !0,
17367
17492
  offscreen: !0,
17368
17493
  title: ""
17369
- });else {
17370
- const width = viewBox ? viewBox.width() : Math.min(this.viewWidth, this.window.width - this.x),
17371
- height = viewBox ? viewBox.height() : Math.min(this.viewHeight, this.window.height - this.y);
17372
- window.create({
17373
- width: width,
17374
- height: height,
17375
- dpr: this.window.dpr,
17376
- canvasControled: !0,
17377
- offscreen: !0,
17378
- title: ""
17379
- });
17380
- }
17381
- const x = viewBox ? -viewBox.x1 : 0,
17382
- y = viewBox ? -viewBox.y1 : 0;
17383
- return this.renderTo(window, {
17384
- x: x,
17385
- y: y,
17386
- width: viewBox ? viewBox.x2 : window.width,
17387
- height: viewBox ? viewBox.y2 : window.height
17388
- }), window;
17494
+ }), this.renderTo(window), window;
17389
17495
  }
17390
17496
  toCanvas() {
17391
17497
  let fullImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
@@ -17599,7 +17705,7 @@
17599
17705
  };
17600
17706
  let BaseWindowHandlerContribution = class {
17601
17707
  constructor() {
17602
- this._uid = Generator.GenAutoIncrementId();
17708
+ this._uid = Generator.GenAutoIncrementId(), this.viewBox = new AABBBounds$1(), this.modelMatrix = new Matrix(1, 0, 0, 1, 0, 0);
17603
17709
  }
17604
17710
  onChange(cb) {
17605
17711
  this._onChangeCb = cb;
@@ -17620,6 +17726,18 @@
17620
17726
  left: 0
17621
17727
  };
17622
17728
  }
17729
+ setViewBox(vb) {
17730
+ this.viewBox.setValue(vb.x1, vb.y1, vb.x2, vb.y2);
17731
+ }
17732
+ getViewBox() {
17733
+ return this.viewBox;
17734
+ }
17735
+ setViewBoxTransform(a, b, c, d, e, f) {
17736
+ this.modelMatrix.setValue(a, b, c, d, e, f);
17737
+ }
17738
+ getViewBoxTransform() {
17739
+ return this.modelMatrix;
17740
+ }
17623
17741
  };
17624
17742
  BaseWindowHandlerContribution = __decorate$K([injectable(), __metadata$x("design:paramtypes", [])], BaseWindowHandlerContribution);
17625
17743
 
@@ -17651,23 +17769,14 @@
17651
17769
  group: null
17652
17770
  };
17653
17771
  params.pickerService = this;
17654
- let offsetX = 0,
17655
- offsetY = 0;
17656
- if (params && params.bounds) {
17657
- if (!params.bounds.contains(point.x, point.y)) return result;
17658
- offsetX = params.bounds.x1, offsetY = params.bounds.y1;
17659
- }
17660
- if (this.pickContext) if (params.keepMatrix) {
17661
- if (this.pickContext.nativeContext && this.pickContext.nativeContext.getTransform) {
17662
- const t = this.pickContext.nativeContext.getTransform();
17663
- this.pickContext.setTransformFromMatrix(t, !0, 1);
17664
- }
17665
- } else this.pickContext.inuse = !0, this.pickContext.clearMatrix(!0, 1);
17666
- params.pickContext = this.pickContext;
17667
- const parentMatrix = new Matrix(1, 0, 0, 1, offsetX, offsetY);
17772
+ const w = params.bounds.width(),
17773
+ h = params.bounds.height();
17774
+ if (!new AABBBounds$1().setValue(0, 0, w, h).containsPoint(point)) return result;
17775
+ this.pickContext && (this.pickContext.inuse = !0), params.pickContext = this.pickContext, this.pickContext && this.pickContext.clearMatrix(!0, 1);
17776
+ const parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);
17668
17777
  let group;
17669
17778
  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);
17670
- if (result.graphic || (result.group = group), this.pickContext && !params.keepMatrix && (this.pickContext.inuse = !1), result.graphic) {
17779
+ if (result.graphic || (result.group = group), this.pickContext && (this.pickContext.inuse = !1), result.graphic) {
17671
17780
  let g = result.graphic;
17672
17781
  for (; g.parent;) g = g.parent;
17673
17782
  g.shadowHost && (result.params = {
@@ -18728,7 +18837,6 @@
18728
18837
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
18729
18838
  };
18730
18839
  const outP = [0, 0, 0],
18731
- initMatrix = new Matrix(1, 0, 0, 1, 0, 0),
18732
18840
  addArcToBezierPath = (bezierPath, startAngle, endAngle, cx, cy, rx, ry, clockwise) => {
18733
18841
  if (clockwise) for (; endAngle > startAngle;) endAngle -= pi2;else for (; endAngle < startAngle;) endAngle += pi2;
18734
18842
  const step = pi / 3 * (endAngle > startAngle ? 1 : -1);
@@ -18859,7 +18967,7 @@
18859
18967
  }), this._clearShadowStyle = !1, this._clearFilterStyle = !1, this._clearGlobalCompositeOperationStyle = !1;
18860
18968
  const context = canvas.nativeCanvas.getContext("2d");
18861
18969
  if (!context) throw new Error("发生错误,获取2d上下文失败");
18862
- 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);
18970
+ 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);
18863
18971
  }
18864
18972
  reset() {
18865
18973
  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);
@@ -19221,7 +19329,10 @@
19221
19329
  clearMatrix() {
19222
19330
  let setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
19223
19331
  let dpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.dpr;
19224
- this.setTransformFromMatrix(initMatrix, setTransform, dpr);
19332
+ this.setTransformFromMatrix(this._clearMatrix, setTransform, dpr);
19333
+ }
19334
+ setClearMatrix(a, b, c, d, e, f) {
19335
+ this._clearMatrix.setValue(a, b, c, d, e, f);
19225
19336
  }
19226
19337
  onlyTranslate() {
19227
19338
  let dpr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.dpr;
@@ -19452,10 +19563,10 @@
19452
19563
  return `${BrowserWindowHandlerContribution_1.idprefix}_${BrowserWindowHandlerContribution_1.prefix_count++}`;
19453
19564
  }
19454
19565
  constructor() {
19455
- super(), this.type = "browser", this._canvasIsIntersecting = !0, this.global = application.global;
19566
+ super(), this.type = "browser", this._canvasIsIntersecting = !0, this.global = application.global, this.viewBox = new AABBBounds$1(), this.modelMatrix = new Matrix(1, 0, 0, 1, 0, 0);
19456
19567
  }
19457
19568
  getTitle() {
19458
- return this.canvas.id.toString();
19569
+ return this.canvas.id && this.canvas.id.toString();
19459
19570
  }
19460
19571
  getWH() {
19461
19572
  return {
@@ -19562,7 +19673,8 @@
19562
19673
  return this.canvas.nativeCanvas.dispatchEvent(event);
19563
19674
  }
19564
19675
  getStyle() {
19565
- return this.canvas.nativeCanvas.style;
19676
+ var _a;
19677
+ return null !== (_a = this.canvas.nativeCanvas.style) && void 0 !== _a ? _a : {};
19566
19678
  }
19567
19679
  setStyle(style) {
19568
19680
  this.canvas.nativeCanvas.style = style;
@@ -19581,8 +19693,9 @@
19581
19693
  bottom: 0
19582
19694
  };
19583
19695
  }
19584
- clearViewBox(vb, color) {
19585
- const context = this.getContext(),
19696
+ clearViewBox(color) {
19697
+ const vb = this.viewBox,
19698
+ context = this.getContext(),
19586
19699
  dpr = this.getDpr();
19587
19700
  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();
19588
19701
  }
@@ -19663,14 +19776,20 @@
19663
19776
  this.applyStyles = !0;
19664
19777
  }
19665
19778
  mapToCanvasPoint(nativeEvent, domElement) {
19666
- var _a;
19779
+ var _a, _b;
19780
+ let clientX = 0,
19781
+ clientY = 0,
19782
+ offsetX = 0,
19783
+ offsetY = 0;
19784
+ if (nativeEvent.changedTouches) {
19785
+ const data = null !== (_a = nativeEvent.changedTouches[0]) && void 0 !== _a ? _a : {};
19786
+ clientX = data.clientX || 0, clientY = data.clientY || 0, offsetX = clientX, offsetY = clientY;
19787
+ } else clientX = nativeEvent.clientX || 0, clientY = nativeEvent.clientY || 0, offsetX = nativeEvent.offsetX || 0, offsetY = nativeEvent.offsetY || 0;
19667
19788
  if (domElement) {
19668
- const {
19669
- clientX: x,
19670
- clientY: y
19671
- } = nativeEvent,
19789
+ const x = clientX,
19790
+ y = clientY,
19672
19791
  rect = domElement.getBoundingClientRect(),
19673
- nativeCanvas = null === (_a = domElement.getNativeHandler) || void 0 === _a ? void 0 : _a.call(domElement).nativeCanvas;
19792
+ nativeCanvas = null === (_b = domElement.getNativeHandler) || void 0 === _b ? void 0 : _b.call(domElement).nativeCanvas;
19674
19793
  let scaleX, scaleY;
19675
19794
  return nativeCanvas && (scaleX = rect.width / nativeCanvas.offsetWidth, scaleY = rect.height / nativeCanvas.offsetHeight), {
19676
19795
  x: (x - rect.left) / (isValidNumber$1(scaleX) ? scaleX : 1),
@@ -19678,8 +19797,8 @@
19678
19797
  };
19679
19798
  }
19680
19799
  return {
19681
- x: nativeEvent.offsetX,
19682
- y: nativeEvent.offsetY
19800
+ x: offsetX,
19801
+ y: offsetY
19683
19802
  };
19684
19803
  }
19685
19804
  getNativeAABBBounds(_dom) {
@@ -19952,7 +20071,7 @@
19952
20071
  getBoundingClientRect() {
19953
20072
  return null;
19954
20073
  }
19955
- clearViewBox(vb, color) {}
20074
+ clearViewBox(color) {}
19956
20075
  };
19957
20076
  NodeWindowHandlerContribution.env = "node", NodeWindowHandlerContribution = __decorate$v([injectable(), __param$n(0, inject(VGlobal)), __metadata$n("design:paramtypes", [Object])], NodeWindowHandlerContribution);
19958
20077
  const nodeWindowModule = new ContainerModule(bind => {
@@ -21360,10 +21479,10 @@
21360
21479
  loadPyramid3dPick || (loadPyramid3dPick = !0, bind(CanvasPyramid3dPicker).to(DefaultCanvasPyramid3dPicker).inSingletonScope(), bind(CanvasPickerContribution).toService(CanvasPyramid3dPicker));
21361
21480
  });
21362
21481
 
21363
- const browser = isBrowserEnv();
21482
+ const browser$1 = isBrowserEnv();
21364
21483
 
21365
21484
  function _registerArc() {
21366
- _registerArc.__loaded || (_registerArc.__loaded = !0, registerArcGraphic(), container.load(arcModule), container.load(browser ? arcCanvasPickModule : arcMathPickModule));
21485
+ _registerArc.__loaded || (_registerArc.__loaded = !0, registerArcGraphic(), container.load(arcModule), container.load(browser$1 ? arcCanvasPickModule : arcMathPickModule));
21367
21486
  }
21368
21487
  _registerArc.__loaded = !1;
21369
21488
  const registerArc = _registerArc;
@@ -21375,19 +21494,19 @@
21375
21494
  const registerArc3d = _registerArc3d;
21376
21495
 
21377
21496
  function _registerArea() {
21378
- _registerArea.__loaded || (_registerArea.__loaded = !0, registerAreaGraphic(), container.load(areaModule), container.load(browser ? areaCanvasPickModule : areaMathPickModule));
21497
+ _registerArea.__loaded || (_registerArea.__loaded = !0, registerAreaGraphic(), container.load(areaModule), container.load(browser$1 ? areaCanvasPickModule : areaMathPickModule));
21379
21498
  }
21380
21499
  _registerArea.__loaded = !1;
21381
21500
  const registerArea = _registerArea;
21382
21501
 
21383
21502
  function _registerCircle() {
21384
- _registerCircle.__loaded || (_registerCircle.__loaded = !0, registerCircleGraphic(), container.load(circleModule), container.load(browser ? circleCanvasPickModule : circleMathPickModule));
21503
+ _registerCircle.__loaded || (_registerCircle.__loaded = !0, registerCircleGraphic(), container.load(circleModule), container.load(browser$1 ? circleCanvasPickModule : circleMathPickModule));
21385
21504
  }
21386
21505
  _registerCircle.__loaded = !1;
21387
21506
  const registerCircle = _registerCircle;
21388
21507
 
21389
21508
  function _registerGlyph() {
21390
- _registerGlyph.__loaded || (_registerGlyph.__loaded = !0, registerGlyphGraphic(), container.load(glyphModule), container.load(browser ? glyphCanvasPickModule : glyphMathPickModule));
21509
+ _registerGlyph.__loaded || (_registerGlyph.__loaded = !0, registerGlyphGraphic(), container.load(glyphModule), container.load(browser$1 ? glyphCanvasPickModule : glyphMathPickModule));
21391
21510
  }
21392
21511
  _registerGlyph.__loaded = !1;
21393
21512
  const registerGlyph = _registerGlyph;
@@ -21399,25 +21518,25 @@
21399
21518
  const registerGroup = _registerGroup;
21400
21519
 
21401
21520
  function _registerImage() {
21402
- _registerImage.__loaded || (_registerImage.__loaded = !0, registerImageGraphic(), container.load(imageModule), container.load(browser ? imageCanvasPickModule : imageMathPickModule));
21521
+ _registerImage.__loaded || (_registerImage.__loaded = !0, registerImageGraphic(), container.load(imageModule), container.load(browser$1 ? imageCanvasPickModule : imageMathPickModule));
21403
21522
  }
21404
21523
  _registerImage.__loaded = !1;
21405
21524
  const registerImage = _registerImage;
21406
21525
 
21407
21526
  function _registerLine() {
21408
- _registerLine.__loaded || (_registerLine.__loaded = !0, registerLineGraphic(), container.load(lineModule), container.load(browser ? lineCanvasPickModule : lineMathPickModule));
21527
+ _registerLine.__loaded || (_registerLine.__loaded = !0, registerLineGraphic(), container.load(lineModule), container.load(browser$1 ? lineCanvasPickModule : lineMathPickModule));
21409
21528
  }
21410
21529
  _registerLine.__loaded = !1;
21411
21530
  const registerLine = _registerLine;
21412
21531
 
21413
21532
  function _registerPath() {
21414
- _registerPath.__loaded || (_registerPath.__loaded = !0, registerPathGraphic(), container.load(pathModule), container.load(browser ? pathCanvasPickModule : pathMathPickModule));
21533
+ _registerPath.__loaded || (_registerPath.__loaded = !0, registerPathGraphic(), container.load(pathModule), container.load(browser$1 ? pathCanvasPickModule : pathMathPickModule));
21415
21534
  }
21416
21535
  _registerPath.__loaded = !1;
21417
21536
  const registerPath = _registerPath;
21418
21537
 
21419
21538
  function _registerPolygon() {
21420
- _registerPolygon.__loaded || (_registerPolygon.__loaded = !0, registerPolygonGraphic(), container.load(polygonModule), container.load(browser ? polygonCanvasPickModule : polygonMathPickModule));
21539
+ _registerPolygon.__loaded || (_registerPolygon.__loaded = !0, registerPolygonGraphic(), container.load(polygonModule), container.load(browser$1 ? polygonCanvasPickModule : polygonMathPickModule));
21421
21540
  }
21422
21541
  _registerPolygon.__loaded = !1;
21423
21542
  const registerPolygon = _registerPolygon;
@@ -21429,7 +21548,7 @@
21429
21548
  const registerPyramid3d = _registerPyramid3d;
21430
21549
 
21431
21550
  function _registerRect() {
21432
- _registerRect.__loaded || (_registerRect.__loaded = !0, registerRectGraphic(), container.load(rectModule), container.load(browser ? rectCanvasPickModule : rectMathPickModule));
21551
+ _registerRect.__loaded || (_registerRect.__loaded = !0, registerRectGraphic(), container.load(rectModule), container.load(browser$1 ? rectCanvasPickModule : rectMathPickModule));
21433
21552
  }
21434
21553
  _registerRect.__loaded = !1;
21435
21554
  const registerRect = _registerRect;
@@ -21441,7 +21560,7 @@
21441
21560
  const registerRect3d = _registerRect3d;
21442
21561
 
21443
21562
  function _registerRichtext() {
21444
- _registerRichtext.__loaded || (_registerRichtext.__loaded = !0, registerRichtextGraphic(), container.load(richtextModule), container.load(browser ? richtextCanvasPickModule : richTextMathPickModule));
21563
+ _registerRichtext.__loaded || (_registerRichtext.__loaded = !0, registerRichtextGraphic(), container.load(richtextModule), container.load(browser$1 ? richtextCanvasPickModule : richTextMathPickModule));
21445
21564
  }
21446
21565
  _registerRichtext.__loaded = !1;
21447
21566
  const registerRichtext = _registerRichtext;
@@ -21453,13 +21572,13 @@
21453
21572
  const registerShadowRoot = _registerShadowRoot;
21454
21573
 
21455
21574
  function _registerSymbol() {
21456
- _registerSymbol.__loaded || (_registerSymbol.__loaded = !0, registerSymbolGraphic(), container.load(symbolModule), container.load(browser ? symbolCanvasPickModule : symbolMathPickModule));
21575
+ _registerSymbol.__loaded || (_registerSymbol.__loaded = !0, registerSymbolGraphic(), container.load(symbolModule), container.load(browser$1 ? symbolCanvasPickModule : symbolMathPickModule));
21457
21576
  }
21458
21577
  _registerSymbol.__loaded = !1;
21459
21578
  const registerSymbol = _registerSymbol;
21460
21579
 
21461
21580
  function _registerText() {
21462
- _registerText.__loaded || (_registerText.__loaded = !0, registerTextGraphic(), container.load(textModule), container.load(browser ? textCanvasPickModule : textMathPickModule));
21581
+ _registerText.__loaded || (_registerText.__loaded = !0, registerTextGraphic(), container.load(textModule), container.load(browser$1 ? textCanvasPickModule : textMathPickModule));
21463
21582
  }
21464
21583
  _registerText.__loaded = !1;
21465
21584
  const registerText = _registerText;
@@ -22869,7 +22988,7 @@
22869
22988
  Safari: ua.indexOf('safari') > -1 && ua.indexOf('edge') === -1
22870
22989
  };
22871
22990
  }
22872
- analyzeUserAgent();
22991
+ const { IE, Chrome, Firefox, Edge, Safari } = analyzeUserAgent();
22873
22992
  function isObject$1(obj) {
22874
22993
  return obj === Object(obj);
22875
22994
  }
@@ -22998,6 +23117,14 @@
22998
23117
  }
22999
23118
  return false;
23000
23119
  }
23120
+ const browser = {
23121
+ IE,
23122
+ Edge,
23123
+ Chrome,
23124
+ Firefox,
23125
+ Safari,
23126
+ heightLimit: Chrome ? 33554431 : Firefox ? 17895588 : 10737433
23127
+ };
23001
23128
  const obj = {
23002
23129
  isObject: isObject$1
23003
23130
  };
@@ -24864,6 +24991,25 @@
24864
24991
  registerGroup(), registerRect();
24865
24992
  }
24866
24993
 
24994
+ const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";
24995
+ var StateValue;
24996
+ !function (StateValue) {
24997
+ StateValue.selected = "selected", StateValue.selectedReverse = "selected_reverse", StateValue.hover = "hover", StateValue.hoverReverse = "hover_reverse";
24998
+ }(StateValue || (StateValue = {}));
24999
+ const DEFAULT_STATES$2 = {
25000
+ [StateValue.selectedReverse]: {},
25001
+ [StateValue.selected]: {},
25002
+ [StateValue.hover]: {},
25003
+ [StateValue.hoverReverse]: {}
25004
+ };
25005
+ const DEFAULT_HTML_TEXT_SPEC = {
25006
+ container: "",
25007
+ width: 30,
25008
+ height: 30,
25009
+ style: {}
25010
+ };
25011
+ const SCROLLBAR_EVENT = "scrollDrag";
25012
+
24867
25013
  const delayMap = {
24868
25014
  debounce: debounce$1,
24869
25015
  throttle: throttle$1
@@ -24903,9 +25049,9 @@
24903
25049
  this._prePos = "horizontal" === direction ? e.clientX : e.clientY, this._dispatchEvent("scrollDown", {
24904
25050
  pos: this._prePos,
24905
25051
  event: e
24906
- }), "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onSliderPointerMove, {
25052
+ }), "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
24907
25053
  capture: !0
24908
- }), vglobal.addEventListener("pointerup", this._onSliderPointerUp)) : (this.stage.addEventListener("pointermove", this._onSliderPointerMove, {
25054
+ }), vglobal.addEventListener("pointerup", this._onSliderPointerUp)) : (this.stage.addEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
24909
25055
  capture: !0
24910
25056
  }), this.stage.addEventListener("pointerup", this._onSliderPointerUp), this.stage.addEventListener("pointerupoutside", this._onSliderPointerUp));
24911
25057
  }, this._computeScrollValue = e => {
@@ -24920,12 +25066,12 @@
24920
25066
  height: height
24921
25067
  } = this._getSliderRenderBounds();
24922
25068
  return "vertical" === direction ? (currentPos = e.clientY, delta = currentPos - this._prePos, currentScrollValue = delta / height) : (currentPos = e.clientX, delta = currentPos - this._prePos, currentScrollValue = delta / width), [currentPos, currentScrollValue];
24923
- }, this._onSliderPointerMove = delayMap[this.attribute.delayType](e => {
25069
+ }, this._onSliderPointerMove = e => {
24924
25070
  e.stopPropagation();
24925
25071
  const preScrollRange = this.getScrollRange(),
24926
25072
  [currentPos, currentScrollValue] = this._computeScrollValue(e);
24927
25073
  this.setScrollRange([preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue], !0), this._prePos = currentPos;
24928
- }, this.attribute.delayTime), this._onSliderPointerUp = e => {
25074
+ }, this._onSliderPointerMoveWithDelay = 0 === this.attribute.delayTime ? this._onSliderPointerMove : delayMap[this.attribute.delayType](this._onSliderPointerMove, this.attribute.delayTime), this._onSliderPointerUp = e => {
24929
25075
  e.preventDefault();
24930
25076
  const {
24931
25077
  realTime = !0,
@@ -24938,9 +25084,9 @@
24938
25084
  this._dispatchEvent("scrollUp", {
24939
25085
  pre: preRange,
24940
25086
  value: clampRange$1(range, limitRange[0], limitRange[1])
24941
- }), "browser" === vglobal.env ? (vglobal.removeEventListener("pointermove", this._onSliderPointerMove, {
25087
+ }), "browser" === vglobal.env ? (vglobal.removeEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
24942
25088
  capture: !0
24943
- }), vglobal.removeEventListener("pointerup", this._onSliderPointerUp)) : (this.stage.removeEventListener("pointermove", this._onSliderPointerMove, {
25089
+ }), vglobal.removeEventListener("pointerup", this._onSliderPointerUp)) : (this.stage.removeEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
24944
25090
  capture: !0
24945
25091
  }), this.stage.removeEventListener("pointerup", this._onSliderPointerUp), this.stage.removeEventListener("pointerupoutside", this._onSliderPointerUp));
24946
25092
  };
@@ -24967,7 +25113,7 @@
24967
25113
  }, !0), this.stage && !this.stage.autoRender && this.stage.renderNextFrame();
24968
25114
  }
24969
25115
  }
24970
- this.attribute.range = currScrollRange, realTime && this._dispatchEvent("scrollDrag", {
25116
+ this.attribute.range = currScrollRange, realTime && this._dispatchEvent(SCROLLBAR_EVENT, {
24971
25117
  pre: preRange,
24972
25118
  value: currScrollRange
24973
25119
  });
@@ -25143,41 +25289,22 @@
25143
25289
  return direct ? angleLargeThanPI ? 2 * Math.PI - ang : ang : angleLargeThanPI ? ang : 2 * Math.PI - ang;
25144
25290
  }
25145
25291
 
25146
- const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";
25147
- var StateValue;
25148
- !function (StateValue) {
25149
- StateValue.selected = "selected", StateValue.selectedReverse = "selected_reverse", StateValue.hover = "hover", StateValue.hoverReverse = "hover_reverse";
25150
- }(StateValue || (StateValue = {}));
25151
- const DEFAULT_STATES$2 = {
25152
- [StateValue.selectedReverse]: {},
25153
- [StateValue.selected]: {},
25154
- [StateValue.hover]: {},
25155
- [StateValue.hoverReverse]: {}
25156
- };
25157
- const DEFAULT_HTML_TEXT_SPEC = {
25158
- container: "",
25159
- width: 30,
25160
- height: 30,
25161
- style: {}
25162
- };
25163
-
25164
25292
  function measureTextSize(text, textSpec) {
25165
- let fontFamily = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_TEXT_FONT_FAMILY$1;
25166
- var _a, _b;
25293
+ let defaultTextTheme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25167
25294
  if (!text) return {
25168
25295
  width: 0,
25169
25296
  height: 0
25170
25297
  };
25171
25298
  const bounds = getTextBounds$1({
25172
25299
  text: text,
25173
- fontFamily: null !== (_a = textSpec.fontFamily) && void 0 !== _a ? _a : fontFamily,
25174
- fontSize: textSpec.fontSize || 12,
25175
- fontWeight: textSpec.fontWeight,
25176
- textAlign: null !== (_b = textSpec.textAlign) && void 0 !== _b ? _b : "center",
25300
+ fontFamily: textSpec.fontFamily || defaultTextTheme.fontFamily || DEFAULT_TEXT_FONT_FAMILY$1,
25301
+ fontSize: textSpec.fontSize || defaultTextTheme.fontSize || 12,
25302
+ fontWeight: textSpec.fontWeight || defaultTextTheme.fontWeight,
25303
+ textAlign: textSpec.textAlign || "center",
25177
25304
  textBaseline: textSpec.textBaseline,
25178
25305
  ellipsis: !!textSpec.ellipsis,
25179
25306
  maxLineWidth: textSpec.maxLineWidth || 1 / 0,
25180
- lineHeight: textSpec.fontSize || 12
25307
+ lineHeight: textSpec.fontSize || defaultTextTheme.fontSize || 12
25181
25308
  });
25182
25309
  return {
25183
25310
  width: bounds.width(),
@@ -25212,7 +25339,7 @@
25212
25339
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, Tag.defaultAttributes, attributes)), this.name = "tag";
25213
25340
  }
25214
25341
  render() {
25215
- var _a, _b;
25342
+ var _a, _b, _c;
25216
25343
  const {
25217
25344
  text = "",
25218
25345
  textStyle = {},
@@ -25293,11 +25420,11 @@
25293
25420
  y: 0
25294
25421
  });
25295
25422
  isNil$3(textAttrs.lineHeight) && (textAttrs.lineHeight = textStyle.fontSize), textShape = group.createOrUpdateChild("tag-text", textAttrs, "text"), isEmpty(null == state ? void 0 : state.text) || (textShape.states = state.text);
25296
- const textBounds = measureTextSize(textAttrs.text, textStyle, null === (_a = this.stage) || void 0 === _a ? void 0 : _a.getTheme().text.fontFamily),
25423
+ const textBounds = measureTextSize(textAttrs.text, textStyle, null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.getTheme()) || void 0 === _b ? void 0 : _b.text),
25297
25424
  textWidth = textBounds.width,
25298
25425
  textHeight = textBounds.height;
25299
25426
  tagWidth += textWidth;
25300
- const size = null !== (_b = shape.size) && void 0 !== _b ? _b : 10,
25427
+ const size = null !== (_c = shape.size) && void 0 !== _c ? _c : 10,
25301
25428
  maxSize = isNumber$4(size) ? size : Math.max(size[0], size[1]);
25302
25429
  tagHeight += Math.max(textHeight, shape.visible ? maxSize : 0);
25303
25430
  const {
@@ -25818,7 +25945,9 @@
25818
25945
  line.name = `${this.name}-line`, line.id = this._getNodeId("line" + index), isEmpty(null == state ? void 0 : state.line) || (line.states = isArray$3(state.line) ? null !== (_b = state.line[index]) && void 0 !== _b ? _b : state.line[state.line.length - 1] : state.line), this.add(line);
25819
25946
  });
25820
25947
  } else {
25821
- const line = graphicCreator$1.polygon(Object.assign(Object.assign({
25948
+ let lineCreator = graphicCreator$1.line;
25949
+ array$1(lineStyle)[0].cornerRadius && (lineCreator = graphicCreator$1.polygon);
25950
+ const line = lineCreator(Object.assign(Object.assign({
25822
25951
  points: this._clipPoints(this.attribute.points)
25823
25952
  }, array$1(lineStyle)[0]), {
25824
25953
  fill: !1,
@@ -26020,6 +26149,19 @@
26020
26149
  }
26021
26150
  };
26022
26151
 
26152
+ function getElMap(g) {
26153
+ const elMap = {};
26154
+ return traverseGroup(g, el => {
26155
+ "group" !== el.type && el.id && (elMap[el.id] = el);
26156
+ }), elMap;
26157
+ }
26158
+ function getVerticalCoord(point, vector) {
26159
+ return {
26160
+ x: point.x + vector[0],
26161
+ y: point.y + vector[1]
26162
+ };
26163
+ }
26164
+
26023
26165
  class AxisBase extends AbstractComponent {
26024
26166
  constructor() {
26025
26167
  super(...arguments), this.name = "axis", this.data = [], this.tickLineItems = [], this.subTickLineItems = [], this.axisLabelLayerSize = {}, this.axisLabelsContainer = null, this._onHover = e => {
@@ -26057,7 +26199,7 @@
26057
26199
  return this.add(offscreenGroup), this._renderInner(offscreenGroup), this.removeChild(offscreenGroup), this.attribute = currentAttribute, offscreenGroup.AABBBounds;
26058
26200
  }
26059
26201
  render() {
26060
- this.removeAllChild(!0), this._prevInnerView = this._innerView, this._innerView = graphicCreator$1.group({
26202
+ this._prevInnerView = this._innerView && getElMap(this._innerView), this.removeAllChild(!0), this._innerView = graphicCreator$1.group({
26061
26203
  x: 0,
26062
26204
  y: 0,
26063
26205
  pickable: !1
@@ -26182,11 +26324,7 @@
26182
26324
  axisTitle.name = AXIS_ELEMENT_NAME.title, axisTitle.id = this._getNodeId("title"), container.add(axisTitle);
26183
26325
  }
26184
26326
  getVerticalCoord(point, offset, inside) {
26185
- const vector = this.getVerticalVector(offset, inside, point);
26186
- return {
26187
- x: point.x + vector[0],
26188
- y: point.y + vector[1]
26189
- };
26327
+ return getVerticalCoord(point, this.getVerticalVector(offset, inside, point));
26190
26328
  }
26191
26329
  getTextAlign(vector) {
26192
26330
  let align = "center";
@@ -26329,6 +26467,9 @@
26329
26467
  }));
26330
26468
  }), data;
26331
26469
  }
26470
+ release() {
26471
+ super.release(), this._prevInnerView = null, this._innerView = null;
26472
+ }
26332
26473
  }
26333
26474
 
26334
26475
  function rotate(x, y, deg, originX, originY) {
@@ -26491,17 +26632,42 @@
26491
26632
  limitLength: limitLength,
26492
26633
  verticalLimitLength: verticalLimitLength,
26493
26634
  ellipsis = "...",
26494
- orient: orient
26635
+ orient: orient,
26636
+ axisLength: axisLength
26495
26637
  } = config;
26496
- !isEmpty(labels) && isValidNumber$1(limitLength) && labels.forEach(label => {
26638
+ if (isEmpty(labels) || !isValidNumber$1(limitLength)) return;
26639
+ const DELTA = Math.sin(Math.PI / 10);
26640
+ labels.forEach(label => {
26497
26641
  var _a;
26498
26642
  const angle = label.attribute.angle,
26499
- isRotated = !isNil$3(angle) && 0 !== angle;
26500
- if (("top" === orient || "bottom" === orient) && (isRotated && Math.floor(label.AABBBounds.height()) <= limitLength || !isRotated && Math.floor(label.AABBBounds.width()) <= verticalLimitLength)) return;
26643
+ hasAngle = !isNil$3(angle),
26644
+ cos = hasAngle ? Math.cos(angle) : 1,
26645
+ sin = hasAngle ? Math.sin(angle) : 0,
26646
+ isHorizontal = !hasAngle || Math.abs(sin) <= DELTA,
26647
+ isVertical = hasAngle && Math.abs(cos) <= DELTA,
26648
+ isX = "top" === orient || "bottom" === orient;
26649
+ if (isX) {
26650
+ if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) return;
26651
+ if (isHorizontal && Math.floor(label.AABBBounds.width()) <= verticalLimitLength) return;
26652
+ }
26501
26653
  const direction = label.attribute.direction;
26502
- if (("left" === orient || "right" === orient) && ("vertical" === direction && Math.floor(label.AABBBounds.height()) <= verticalLimitLength || "vertical" !== direction && Math.floor(label.AABBBounds.width()) <= limitLength)) return;
26654
+ if (!isX) {
26655
+ if ("vertical" === direction && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) return;
26656
+ if ("vertical" !== direction) {
26657
+ if (isHorizontal && Math.floor(label.AABBBounds.width()) <= limitLength) return;
26658
+ if (isVertical && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) return;
26659
+ }
26660
+ }
26503
26661
  let limitLabelLength = null;
26504
- limitLabelLength = isRotated ? Math.abs(limitLength / Math.sin(angle)) : "top" === orient || "bottom" === orient || "vertical" === direction ? verticalLimitLength : limitLength, isValidNumber$1(label.attribute.maxLineWidth) && (limitLabelLength = isValidNumber$1(limitLabelLength) ? Math.min(label.attribute.maxLineWidth, limitLabelLength) : label.attribute.maxLineWidth), label.setAttributes({
26662
+ if (isHorizontal || isVertical) limitLabelLength = isX ? isHorizontal ? verticalLimitLength : limitLength : "vertical" === direction || isVertical ? verticalLimitLength : limitLength;else if (isX) {
26663
+ const {
26664
+ x1: x1,
26665
+ x2: x2
26666
+ } = label.AABBBounds,
26667
+ tan = sin / cos;
26668
+ limitLabelLength = tan > 0 && x1 <= axisLength && limitLength / tan + x1 > axisLength ? (axisLength - x1) / Math.abs(cos) : tan < 0 && x2 >= 0 && limitLength / tan + x2 < 0 ? x2 / Math.abs(cos) : Math.abs(limitLength / sin);
26669
+ } else limitLabelLength = Math.abs(limitLength / cos);
26670
+ isValidNumber$1(label.attribute.maxLineWidth) && (limitLabelLength = isValidNumber$1(limitLabelLength) ? Math.min(label.attribute.maxLineWidth, limitLabelLength) : label.attribute.maxLineWidth), label.setAttributes({
26505
26671
  maxLineWidth: limitLabelLength,
26506
26672
  ellipsis: null !== (_a = label.attribute.ellipsis) && void 0 !== _a ? _a : ellipsis
26507
26673
  });
@@ -26674,9 +26840,10 @@
26674
26840
  autoRotate = !0,
26675
26841
  shape: shape,
26676
26842
  background: background,
26677
- state = {}
26843
+ state = {},
26844
+ maxWidth: maxWidth
26678
26845
  } = _d,
26679
- restAttrs = __rest$1(_d, ["position", "space", "textStyle", "autoRotate", "shape", "background", "state"]);
26846
+ restAttrs = __rest$1(_d, ["position", "space", "textStyle", "autoRotate", "shape", "background", "state", "maxWidth"]);
26680
26847
  let percent = .5;
26681
26848
  "start" === position ? percent = 0 : "end" === position && (percent = 1);
26682
26849
  const {
@@ -26727,7 +26894,28 @@
26727
26894
  } = this.attribute;
26728
26895
  textBaseline = 1 === -1 * verticalFactor ? "bottom" : "top";
26729
26896
  } else textAlign = this.getTextAlign(vector), textBaseline = this.getTextBaseline(vector, !1);
26897
+ let maxTagWidth = maxWidth;
26898
+ if (isNil$3(maxTagWidth)) {
26899
+ const {
26900
+ verticalLimitSize: verticalLimitSize,
26901
+ verticalMinSize: verticalMinSize,
26902
+ orient: orient
26903
+ } = this.attribute,
26904
+ limitSize = Math.min(verticalLimitSize || 1 / 0, verticalMinSize || 1 / 0);
26905
+ if (isValidNumber$1(limitSize)) {
26906
+ if ("bottom" === orient || "top" === orient) {
26907
+ if (angle !== Math.PI / 2) {
26908
+ const cosValue = Math.abs(Math.cos(null != angle ? angle : 0));
26909
+ maxTagWidth = cosValue < 1e-6 ? 1 / 0 : this.attribute.end.x / cosValue;
26910
+ } else maxTagWidth = limitSize - offset;
26911
+ } else if (angle && 0 !== angle) {
26912
+ const sinValue = Math.abs(Math.sin(angle));
26913
+ maxTagWidth = sinValue < 1e-6 ? 1 / 0 : this.attribute.end.y / sinValue;
26914
+ } else maxTagWidth = limitSize - offset;
26915
+ }
26916
+ }
26730
26917
  const attrs = Object.assign(Object.assign(Object.assign({}, titlePoint), restAttrs), {
26918
+ maxWidth: maxTagWidth,
26731
26919
  textStyle: Object.assign({
26732
26920
  textAlign: textAlign,
26733
26921
  textBaseline: textBaseline
@@ -26754,9 +26942,9 @@
26754
26942
  }
26755
26943
  getLabelAlign(vector, inside, angle) {
26756
26944
  const orient = this.attribute.orient;
26757
- if (isValidNumber$1(angle) || 0 === vector[0] && 0 === vector[1]) {
26758
- if ("top" === orient || "bottom" === orient) return getXAxisLabelAlign(orient, angle);
26759
- if ("left" === orient || "right" === orient) return getYAxisLabelAlign(orient, angle);
26945
+ if (["top", "bottom", "right", "left"].includes(orient) || 0 === vector[0] && 0 === vector[1]) {
26946
+ if ("top" === orient || "bottom" === orient) return getXAxisLabelAlign(inside ? "bottom" === orient ? "top" : "bottom" : orient, angle);
26947
+ if ("left" === orient || "right" === orient) return getYAxisLabelAlign(inside ? "left" === orient ? "right" : "left" : orient, angle);
26760
26948
  }
26761
26949
  return {
26762
26950
  textAlign: this.getTextAlign(vector),
@@ -26851,12 +27039,15 @@
26851
27039
  labelRotateAngle: autoRotateAngle,
26852
27040
  orient: orient
26853
27041
  }), autoLimit$1 && isValidNumber$1(limitLength) && limitLength > 0) {
26854
- const verticalLimitLength = "left" === orient || "right" === orient ? Math.abs(this.attribute.start.y - this.attribute.end.y) / labelShapes.length : autoHide$1 || autoRotate$1 ? 1 / 0 : Math.abs(this.attribute.start.x - this.attribute.end.x) / labelShapes.length;
27042
+ const isVertical = "left" === orient || "right" === orient,
27043
+ axisLength = isVertical ? Math.abs(this.attribute.start.y - this.attribute.end.y) : Math.abs(this.attribute.start.x - this.attribute.end.x),
27044
+ verticalLimitLength = isVertical ? axisLength / labelShapes.length : autoHide$1 || autoRotate$1 ? 1 / 0 : axisLength / labelShapes.length;
26855
27045
  autoLimit(labelShapes, {
26856
27046
  limitLength: limitLength,
26857
27047
  verticalLimitLength: verticalLimitLength,
26858
27048
  ellipsis: limitEllipsis,
26859
- orient: orient
27049
+ orient: orient,
27050
+ axisLength: axisLength
26860
27051
  });
26861
27052
  }
26862
27053
  autoHide$1 && autoHide(labelShapes, {
@@ -26897,7 +27088,7 @@
26897
27088
  }
26898
27089
  }
26899
27090
  _getAxisLabelLimitLength(limitSize, layerCount) {
26900
- var _a, _b, _c, _d;
27091
+ var _a, _b, _c, _d, _e;
26901
27092
  const {
26902
27093
  label: label,
26903
27094
  title: title,
@@ -26911,7 +27102,7 @@
26911
27102
  const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0,
26912
27103
  tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0;
26913
27104
  if (title && title.visible && "string" == typeof title.text) {
26914
- titleHeight = measureTextSize(title.text, title.textStyle, null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme().text.fontFamily).height;
27105
+ titleHeight = measureTextSize(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height;
26915
27106
  const padding = normalizePadding(title.padding);
26916
27107
  titleSpacing = title.space + padding[0] + padding[2];
26917
27108
  }
@@ -26974,7 +27165,7 @@
26974
27165
  };
26975
27166
  }
26976
27167
  render() {
26977
- var _a, _b;
27168
+ var _a, _b, _c;
26978
27169
  this._reset();
26979
27170
  const {
26980
27171
  layout = "horizontal",
@@ -27016,7 +27207,7 @@
27016
27207
  } = measureTextSize(this._getPageText(total), Object.assign({
27017
27208
  textAlign: "center",
27018
27209
  textBaseline: "middle"
27019
- }, textStyle), null === (_b = this.stage) || void 0 === _b ? void 0 : _b.getTheme().text.fontFamily),
27210
+ }, textStyle), null === (_c = null === (_b = this.stage) || void 0 === _b ? void 0 : _b.getTheme()) || void 0 === _c ? void 0 : _c.text),
27020
27211
  handlerSizeX = isNumber$4(handlerSize) ? handlerSize : handlerSize[0],
27021
27212
  handlerSizeY = isNumber$4(handlerSize) ? handlerSize : handlerSize[1],
27022
27213
  text = graphicCreator$1.text(Object.assign({
@@ -27246,8 +27437,9 @@
27246
27437
  maxRow = 2,
27247
27438
  maxWidth: maxWidth,
27248
27439
  maxHeight: maxHeight,
27249
- defaultSelected = [],
27250
- lazyload: lazyload
27440
+ defaultSelected: defaultSelected,
27441
+ lazyload: lazyload,
27442
+ autoPage: autoPage
27251
27443
  } = this.attribute,
27252
27444
  {
27253
27445
  spaceCol = DEFAULT_ITEM_SPACE_COL,
@@ -27257,9 +27449,10 @@
27257
27449
  {
27258
27450
  items: legendItems,
27259
27451
  isHorizontal: isHorizontal,
27260
- startIndex: startIndex
27452
+ startIndex: startIndex,
27453
+ isScrollbar: isScrollbar
27261
27454
  } = this._itemContext,
27262
- maxPages = isHorizontal ? maxRow : maxCol;
27455
+ maxPages = isScrollbar ? 1 : isHorizontal ? maxRow : maxCol;
27263
27456
  let item,
27264
27457
  {
27265
27458
  doWrap: doWrap,
@@ -27268,24 +27461,22 @@
27268
27461
  startY: startY,
27269
27462
  pages: pages
27270
27463
  } = this._itemContext;
27271
- for (let index = startIndex, len = legendItems.length; index < len; index++) {
27272
- if (lazyload && pages > this._itemContext.currentPage * maxPages) {
27273
- this._itemContext.startIndex = index;
27274
- break;
27275
- }
27276
- item = legendItems[index], item.id || (item.id = item.label), item.index = index;
27277
- const itemGroup = this._renderEachItem(item, !!isEmpty(defaultSelected) || (null == defaultSelected ? void 0 : defaultSelected.includes(item.label)), index, legendItems),
27464
+ for (let index = startIndex, len = legendItems.length; index < len && !(lazyload && pages > this._itemContext.currentPage * maxPages); index++) {
27465
+ lazyload && (this._itemContext.startIndex = index + 1), item = legendItems[index], item.id || (item.id = item.label), item.index = index;
27466
+ let isSelected = !0;
27467
+ isArray$3(defaultSelected) && (isSelected = defaultSelected.includes(item.label));
27468
+ const itemGroup = this._renderEachItem(item, isSelected, index, legendItems),
27278
27469
  itemWidth = itemGroup.attribute.width,
27279
27470
  itemHeight = itemGroup.attribute.height;
27280
- this._itemHeight = Math.max(this._itemHeight, itemHeight), maxWidthInCol = Math.max(itemWidth, maxWidthInCol), this._itemMaxWidth = Math.max(itemWidth, this._itemMaxWidth), isHorizontal ? (isValid$3(maxWidth) && (itemWidth >= maxWidth ? (doWrap = !0, index > 0 && (startX = 0, startY += itemHeight + spaceRow, pages += 1)) : maxWidth < startX + itemWidth && (doWrap = !0, startX = 0, startY += itemHeight + spaceRow, pages += 1)), index > 0 && itemGroup.setAttributes({
27471
+ this._itemHeight = Math.max(this._itemHeight, itemHeight), maxWidthInCol = Math.max(itemWidth, maxWidthInCol), this._itemMaxWidth = Math.max(itemWidth, this._itemMaxWidth), isHorizontal ? (isValid$3(maxWidth) && (isScrollbar && autoPage ? (pages = Math.ceil((startX + itemWidth) / maxWidth), doWrap = pages > 1) : startX + itemWidth > maxWidth && (doWrap = !0, startX > 0 && (pages += 1, startX = 0, startY += itemHeight + spaceRow))), 0 === startX && 0 === startY || itemGroup.setAttributes({
27281
27472
  x: startX,
27282
27473
  y: startY
27283
- }), startX += spaceCol + itemWidth) : (isValid$3(maxHeight) && maxHeight < startY + itemHeight && (doWrap = !0, startY = 0, startX += maxWidthInCol + spaceCol, maxWidthInCol = 0, pages += 1), index > 0 && itemGroup.setAttributes({
27474
+ }), startX += spaceCol + itemWidth) : (isValid$3(maxHeight) && (isScrollbar && autoPage ? (pages = Math.ceil((startY + itemHeight) / maxHeight), doWrap = pages > 1) : maxHeight < startY + itemHeight && (pages += 1, doWrap = !0, startY = 0, startX += maxWidthInCol + spaceCol, maxWidthInCol = 0)), 0 === startX && 0 === startY || itemGroup.setAttributes({
27284
27475
  x: startX,
27285
27476
  y: startY
27286
27477
  }), startY += spaceRow + itemHeight), itemsContainer.add(itemGroup);
27287
27478
  }
27288
- return this._itemContext.doWrap = doWrap, this._itemContext.startX = startX, this._itemContext.startY = startY, this._itemContext.maxWidthInCol = maxWidthInCol, this._itemContext.pages = pages, this._itemContext.maxPages = maxPages, lazyload || (this._itemContext.startIndex = legendItems.length), this._itemContext;
27479
+ return this._itemContext.doWrap = doWrap, this._itemContext.startX = startX, this._itemContext.startY = startY, this._itemContext.maxWidthInCol = maxWidthInCol, this._itemContext.pages = pages, this._itemContext.maxPages = maxPages, isScrollbar && (this._itemContext.totalPage = pages), lazyload || (this._itemContext.startIndex = legendItems.length), this._itemContext;
27289
27480
  }
27290
27481
  _renderContent() {
27291
27482
  const {
@@ -27313,8 +27504,10 @@
27313
27504
  height: itemHeight
27314
27505
  } = item,
27315
27506
  widthsOptions = [];
27316
- isValid$3(maxItemWidth) && widthsOptions.push(maxItemWidth), isValid$3(itemWidth) && widthsOptions.push(itemWidth), widthsOptions.length && (isValid$3(maxWidth) && widthsOptions.push(maxWidth), this._itemWidthByUser = minInArray$1(widthsOptions)), isValid$3(itemHeight) && (this._itemHeightByUser = itemHeight), this._itemContext = {
27317
- currentPage: this.attribute.pager && this.attribute.pager.defaultCurrent || 1,
27507
+ isValid$3(maxItemWidth) && widthsOptions.push(maxItemWidth), isValid$3(itemWidth) && widthsOptions.push(itemWidth), widthsOptions.length && (isValid$3(maxWidth) && widthsOptions.push(maxWidth), this._itemWidthByUser = minInArray$1(widthsOptions)), isValid$3(itemHeight) && (this._itemHeightByUser = itemHeight);
27508
+ const pager = this.attribute.pager;
27509
+ this._itemContext = {
27510
+ currentPage: pager && pager.defaultCurrent || 1,
27318
27511
  doWrap: !1,
27319
27512
  maxWidthInCol: 0,
27320
27513
  maxPages: 1,
@@ -27324,10 +27517,11 @@
27324
27517
  startIndex: 0,
27325
27518
  items: legendItems,
27326
27519
  isHorizontal: isHorizontal,
27327
- totalPage: 1 / 0
27520
+ totalPage: 1 / 0,
27521
+ isScrollbar: pager && "scrollbar" === pager.type
27328
27522
  }, this._itemContext = this._renderItems();
27329
27523
  let pagerRendered = !1;
27330
- this._itemContext.doWrap && autoPage && this._itemContext.pages > this._itemContext.maxPages && (pagerRendered = this._renderPagerComponent(isHorizontal)), pagerRendered || (itemsContainer.setAttribute("y", this._title ? this._title.AABBBounds.height() + get$5(this.attribute, "title.space", 8) : 0), this._innerView.add(itemsContainer));
27524
+ this._itemContext.doWrap && autoPage && this._itemContext.pages > this._itemContext.maxPages && (pagerRendered = this._renderPagerComponent()), pagerRendered || (itemsContainer.setAttribute("y", this._title ? this._title.AABBBounds.height() + get$5(this.attribute, "title.space", 8) : 0), this._innerView.add(itemsContainer));
27331
27525
  }
27332
27526
  _bindEvents() {
27333
27527
  if (this.attribute.disableTriggerEvent) return;
@@ -27476,27 +27670,13 @@
27476
27670
  itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
27477
27671
  return itemGroup.attribute.width = itemGroupWidth, itemGroup.attribute.height = itemGroupHeight, focusShape && focusShape.setAttribute("visible", !1), innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]), itemGroup;
27478
27672
  }
27479
- _createPager(isScrollbar, isHorizontal, compStyle, compSize) {
27673
+ _createPager(compStyle) {
27480
27674
  var _a, _b;
27481
27675
  const {
27482
27676
  disableTriggerEvent: disableTriggerEvent,
27483
27677
  maxRow: maxRow
27484
27678
  } = this.attribute;
27485
- return isScrollbar ? new ScrollBar(isHorizontal ? Object.assign(Object.assign({
27486
- direction: "vertical",
27487
- width: 12,
27488
- range: [0, .5]
27489
- }, compStyle), {
27490
- height: compSize,
27491
- disableTriggerEvent: disableTriggerEvent
27492
- }) : Object.assign(Object.assign({
27493
- direction: "horizontal",
27494
- disableTriggerEvent: disableTriggerEvent,
27495
- range: [0, .5],
27496
- height: 12
27497
- }, compStyle), {
27498
- width: compSize
27499
- })) : new Pager(isHorizontal ? Object.assign(Object.assign({
27679
+ return this._itemContext.isHorizontal ? new Pager(Object.assign(Object.assign({
27500
27680
  layout: 1 === maxRow ? "horizontal" : "vertical",
27501
27681
  total: 99
27502
27682
  }, merge({
@@ -27507,53 +27687,79 @@
27507
27687
  }, compStyle)), {
27508
27688
  defaultCurrent: null === (_a = this.attribute.pager) || void 0 === _a ? void 0 : _a.defaultCurrent,
27509
27689
  disableTriggerEvent: disableTriggerEvent
27510
- }) : Object.assign({
27690
+ })) : new Pager(Object.assign({
27511
27691
  layout: "horizontal",
27512
27692
  total: 99,
27513
27693
  disableTriggerEvent: disableTriggerEvent,
27514
27694
  defaultCurrent: null === (_b = this.attribute.pager) || void 0 === _b ? void 0 : _b.defaultCurrent
27515
27695
  }, compStyle));
27516
27696
  }
27517
- _updatePositionOfPager(isScrollbar, isHorizontal, contentSize, renderStartY, compSize) {
27697
+ _createScrollbar(compStyle, compSize) {
27698
+ const {
27699
+ disableTriggerEvent: disableTriggerEvent
27700
+ } = this.attribute;
27701
+ return this._itemContext.isHorizontal ? new ScrollBar(Object.assign(Object.assign({
27702
+ direction: "horizontal",
27703
+ disableTriggerEvent: disableTriggerEvent,
27704
+ range: [0, .5],
27705
+ height: 12
27706
+ }, compStyle), {
27707
+ width: compSize
27708
+ })) : new ScrollBar(Object.assign(Object.assign({
27709
+ direction: "vertical",
27710
+ width: 12,
27711
+ range: [0, .5]
27712
+ }, compStyle), {
27713
+ height: compSize,
27714
+ disableTriggerEvent: disableTriggerEvent
27715
+ }));
27716
+ }
27717
+ _updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight) {
27518
27718
  const {
27519
27719
  maxHeight: maxHeight,
27520
27720
  pager: pager
27521
27721
  } = this.attribute,
27522
27722
  {
27523
- currentPage: currentPage,
27524
- totalPage: totalPage
27525
- } = this._itemContext;
27526
- if (isScrollbar) this._pagerComponent.setScrollRange([(currentPage - 1) / totalPage, currentPage / totalPage]), isHorizontal ? this._pagerComponent.setAttributes({
27527
- x: contentSize,
27528
- y: renderStartY
27529
- }) : this._pagerComponent.setAttributes({
27530
- x: 0,
27531
- y: maxHeight - this._pagerComponent.AABBBounds.height()
27532
- });else {
27533
- const position = pager && pager.position || "middle";
27534
- if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
27535
- let y;
27536
- y = "start" === position ? renderStartY : "end" === position ? renderStartY + compSize - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compSize / 2 - this._pagerComponent.AABBBounds.height() / 2, this._pagerComponent.setAttributes({
27537
- x: contentSize,
27538
- y: y
27539
- });
27540
- } else {
27541
- let x;
27542
- x = "start" === position ? 0 : "end" === position ? compSize - this._pagerComponent.AABBBounds.width() : (compSize - this._pagerComponent.AABBBounds.width()) / 2, this._pagerComponent.setAttributes({
27543
- x: x,
27544
- y: maxHeight - this._pagerComponent.AABBBounds.height()
27545
- });
27546
- }
27723
+ totalPage: totalPage,
27724
+ isHorizontal: isHorizontal
27725
+ } = this._itemContext,
27726
+ position = pager && pager.position || "middle";
27727
+ if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
27728
+ let y;
27729
+ y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2, this._pagerComponent.setAttributes({
27730
+ x: contentWidth,
27731
+ y: y
27732
+ });
27733
+ } else {
27734
+ let x;
27735
+ x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2, this._pagerComponent.setAttributes({
27736
+ x: x,
27737
+ y: maxHeight - this._pagerComponent.AABBBounds.height()
27738
+ });
27547
27739
  }
27548
27740
  }
27549
- _bindEventsOfPager(isScrollbar, isHorizontal, compSize, spaceSize) {
27741
+ _updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY) {
27742
+ const {
27743
+ currentPage: currentPage,
27744
+ totalPage: totalPage,
27745
+ isHorizontal: isHorizontal
27746
+ } = this._itemContext;
27747
+ this._pagerComponent.setScrollRange([(currentPage - 1) / totalPage, currentPage / totalPage]), isHorizontal ? this._pagerComponent.setAttributes({
27748
+ x: 0,
27749
+ y: renderStartY + contentHeight
27750
+ }) : this._pagerComponent.setAttributes({
27751
+ x: contentWidth,
27752
+ y: renderStartY
27753
+ });
27754
+ }
27755
+ _bindEventsOfPager(pageSize, channel) {
27550
27756
  const pager = this.attribute.pager || {},
27551
27757
  {
27552
27758
  animation = !0,
27553
27759
  animationDuration = 450,
27554
27760
  animationEasing = "quadIn"
27555
27761
  } = pager,
27556
- pageParser = isScrollbar ? e => {
27762
+ pageParser = this._itemContext.isScrollbar ? e => {
27557
27763
  const {
27558
27764
  value: value
27559
27765
  } = e.detail;
@@ -27568,16 +27774,14 @@
27568
27774
  const newTotalPage = Math.ceil(this._itemContext.pages / this._itemContext.maxPages);
27569
27775
  this._itemContext.totalPage = newTotalPage, this._pagerComponent.setScrollRange([(newPage - 1) / newTotalPage, newPage / newTotalPage]);
27570
27776
  }
27571
- animation ? this._itemsContainer.animate().to(isHorizontal ? {
27572
- y: -(newPage - 1) * (compSize + spaceSize)
27573
- } : {
27574
- x: -(newPage - 1) * (compSize + spaceSize)
27575
- }, animationDuration, animationEasing) : isHorizontal ? this._itemsContainer.setAttribute("y", -(newPage - 1) * (compSize + spaceSize)) : this._itemsContainer.setAttribute("x", -(newPage - 1) * (compSize + spaceSize));
27777
+ animation ? this._itemsContainer.animate().to({
27778
+ [channel]: -(newPage - 1) * pageSize
27779
+ }, animationDuration, animationEasing) : this._itemsContainer.setAttribute(channel, -(newPage - 1) * pageSize);
27576
27780
  }
27577
27781
  };
27578
- isScrollbar ? (this._pagerComponent.addEventListener("scrollDrag", onPaging), this._pagerComponent.addEventListener("scrollUp", onPaging)) : (this._pagerComponent.addEventListener("toPrev", onPaging), this._pagerComponent.addEventListener("toNext", onPaging));
27782
+ this._itemContext.isScrollbar ? (this._pagerComponent.addEventListener("scrollDrag", onPaging), this._pagerComponent.addEventListener("scrollUp", onPaging)) : (this._pagerComponent.addEventListener("toPrev", onPaging), this._pagerComponent.addEventListener("toNext", onPaging));
27579
27783
  }
27580
- _renderPagerComponent(isHorizontal) {
27784
+ _renderPager() {
27581
27785
  const renderStartY = this._title ? this._title.AABBBounds.height() + get$5(this.attribute, "title.space", 8) : 0,
27582
27786
  {
27583
27787
  maxWidth: maxWidth,
@@ -27597,51 +27801,105 @@
27597
27801
  defaultCurrent = 1
27598
27802
  } = pager,
27599
27803
  compStyle = __rest(pager, ["space", "defaultCurrent"]),
27600
- isScrollbar = "scrollbar" === pager.type;
27804
+ {
27805
+ isHorizontal: isHorizontal
27806
+ } = this._itemContext;
27601
27807
  let comp,
27602
- compSize = 0,
27603
- contentSize = 0,
27808
+ compWidth = 0,
27809
+ compHeight = 0,
27810
+ contentWidth = 0,
27811
+ contentHeight = 0,
27604
27812
  startX = 0,
27605
27813
  startY = 0,
27606
27814
  pages = 1;
27607
27815
  if (isHorizontal) {
27608
- if (compSize = (maxRow - 1) * spaceRow + this._itemHeight * maxRow, comp = this._createPager(isScrollbar, isHorizontal, compStyle, compSize), this._pagerComponent = comp, this._innerView.add(comp), contentSize = maxWidth - comp.AABBBounds.width() - pagerSpace, contentSize <= 0) return this._innerView.removeChild(comp), !1;
27816
+ if (compHeight = (maxRow - 1) * spaceRow + this._itemHeight * maxRow, compWidth = maxWidth, comp = this._createPager(compStyle), this._pagerComponent = comp, this._innerView.add(comp), contentWidth = maxWidth - comp.AABBBounds.width() - pagerSpace, contentWidth <= 0) return this._innerView.removeChild(comp), !1;
27609
27817
  itemsContainer.getChildren().forEach((item, index) => {
27610
27818
  const {
27611
27819
  width: width,
27612
27820
  height: height
27613
27821
  } = item.attribute;
27614
- contentSize < startX + width && (startX = 0, startY += height + spaceRow, pages += 1), index > 0 && item.setAttributes({
27822
+ contentWidth < startX + width && (startX = 0, startY += height + spaceRow, pages += 1), index > 0 && item.setAttributes({
27615
27823
  x: startX,
27616
27824
  y: startY
27617
27825
  }), startX += spaceCol + width;
27618
27826
  }), this._itemContext.startX = startX, this._itemContext.startY = startY, this._itemContext.pages = pages;
27619
27827
  const total = Math.ceil(pages / maxRow);
27620
- this._itemContext.totalPage = total, this._updatePositionOfPager(isScrollbar, isHorizontal, contentSize, renderStartY, compSize);
27828
+ this._itemContext.totalPage = total, this._updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight);
27621
27829
  } else {
27622
- if (compSize = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol, comp = this._createPager(isScrollbar, isHorizontal, compStyle, compSize), this._pagerComponent = comp, this._innerView.add(comp), contentSize = maxHeight - comp.AABBBounds.height() - pagerSpace - renderStartY, contentSize <= 0) return this._innerView.removeChild(comp), !1;
27830
+ if (compWidth = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol, compHeight = maxHeight, contentWidth = compWidth, comp = this._createPager(compStyle), this._pagerComponent = comp, this._innerView.add(comp), contentHeight = maxHeight - comp.AABBBounds.height() - pagerSpace - renderStartY, contentHeight <= 0) return this._innerView.removeChild(comp), !1;
27623
27831
  itemsContainer.getChildren().forEach((item, index) => {
27624
27832
  const {
27625
27833
  height: height
27626
27834
  } = item.attribute;
27627
- contentSize < startY + height && (startY = 0, startX += this._itemMaxWidth + spaceCol, pages += 1), index > 0 && item.setAttributes({
27835
+ contentHeight < startY + height && (startY = 0, startX += this._itemMaxWidth + spaceCol, pages += 1), index > 0 && item.setAttributes({
27628
27836
  x: startX,
27629
27837
  y: startY
27630
27838
  }), startY += spaceRow + height;
27631
27839
  });
27632
27840
  const total = Math.ceil(pages / maxCol);
27633
- this._itemContext.totalPage = total, this._updatePositionOfPager(isScrollbar, isHorizontal, contentSize, renderStartY, compSize);
27841
+ this._itemContext.totalPage = total, this._updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight);
27634
27842
  }
27635
- defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compSize + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compSize + spaceCol)));
27843
+ defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compHeight + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compWidth + spaceCol)));
27636
27844
  const clipGroup = graphicCreator$1.group({
27637
27845
  x: 0,
27638
27846
  y: renderStartY,
27639
- width: isHorizontal ? contentSize : compSize,
27640
- height: isHorizontal ? compSize : contentSize,
27847
+ width: isHorizontal ? contentWidth : compWidth,
27848
+ height: isHorizontal ? compHeight : contentHeight,
27641
27849
  clip: !0,
27642
27850
  pickable: !1
27643
27851
  });
27644
- return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(isScrollbar, isHorizontal, compSize, isHorizontal ? spaceRow : spaceCol), !0;
27852
+ return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(isHorizontal ? compHeight + spaceRow : compWidth + spaceCol, isHorizontal ? "y" : "x"), !0;
27853
+ }
27854
+ _renderScrollbar() {
27855
+ const renderStartY = this._title ? this._title.AABBBounds.height() + get$5(this.attribute, "title.space", 8) : 0,
27856
+ {
27857
+ maxWidth: maxWidth,
27858
+ maxHeight: maxHeight,
27859
+ item = {},
27860
+ pager = {}
27861
+ } = this.attribute,
27862
+ {
27863
+ spaceCol = DEFAULT_ITEM_SPACE_COL,
27864
+ spaceRow = DEFAULT_ITEM_SPACE_ROW
27865
+ } = item,
27866
+ itemsContainer = this._itemsContainer,
27867
+ {
27868
+ space: pagerSpace = DEFAULT_PAGER_SPACE,
27869
+ defaultCurrent = 1
27870
+ } = pager,
27871
+ compStyle = __rest(pager, ["space", "defaultCurrent"]),
27872
+ {
27873
+ isHorizontal: isHorizontal
27874
+ } = this._itemContext;
27875
+ let comp,
27876
+ compSize = 0,
27877
+ contentWidth = 0,
27878
+ contentHeight = 0,
27879
+ startY = 0,
27880
+ pages = 1;
27881
+ if (isHorizontal) compSize = maxWidth, contentWidth = maxWidth, contentHeight = this._itemHeight, comp = this._createScrollbar(compStyle, compSize), this._pagerComponent = comp, this._innerView.add(comp), this._updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY);else {
27882
+ if (compSize = maxHeight, comp = this._createScrollbar(compStyle, compSize), this._pagerComponent = comp, this._innerView.add(comp), contentHeight = maxHeight - renderStartY, contentWidth = this._itemMaxWidth, contentHeight <= 0) return this._innerView.removeChild(comp), !1;
27883
+ itemsContainer.getChildren().forEach((item, index) => {
27884
+ const {
27885
+ height: height
27886
+ } = item.attribute;
27887
+ pages = Math.floor((startY + height) / contentHeight) + 1, startY += spaceRow + height;
27888
+ }), this._itemContext.totalPage = pages, this._itemContext.pages = pages, this._updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY);
27889
+ }
27890
+ defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (contentWidth + spaceCol)) : itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (contentHeight + spaceRow)));
27891
+ const clipGroup = graphicCreator$1.group({
27892
+ x: 0,
27893
+ y: renderStartY,
27894
+ width: contentWidth,
27895
+ height: contentHeight,
27896
+ clip: !0,
27897
+ pickable: !1
27898
+ });
27899
+ return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(isHorizontal ? contentWidth : contentHeight, isHorizontal ? "x" : "y"), !0;
27900
+ }
27901
+ _renderPagerComponent() {
27902
+ return this._itemContext.isScrollbar ? this._renderScrollbar() : this._renderPager(), !0;
27645
27903
  }
27646
27904
  _hover(legendItem, e) {
27647
27905
  this._lastActiveItem = legendItem;
@@ -29216,12 +29474,9 @@
29216
29474
  }, this._onTooltipUpdate(e), this._dispatchTooltipEvent("sliderTooltipShow"));
29217
29475
  }, this._onTooltipUpdate = e => {
29218
29476
  if (this._isChanging || !this._tooltipState || !this._tooltipState.isActive) return;
29219
- const {
29220
- min: min,
29221
- max: max
29222
- } = this.attribute,
29223
- pos = clamp$3(this._isHorizontal ? (e.viewX - this._rail.globalAABBBounds.x1) / this._rail.globalAABBBounds.width() : (e.viewY - this._rail.globalAABBBounds.y1) / this._rail.globalAABBBounds.height(), 0, 1);
29224
- pos !== this._tooltipState.pos && (this._tooltipState.pos = pos, this._tooltipState.value = min + (max - min) * pos, this._updateTooltip(), this._dispatchTooltipEvent("sliderTooltipUpdate"));
29477
+ const railLen = this._isHorizontal ? this._rail.globalAABBBounds.width() : this._rail.globalAABBBounds.height(),
29478
+ pos = clamp$3(this._isHorizontal ? (e.viewX - this._rail.globalAABBBounds.x1) / railLen : (e.viewY - this._rail.globalAABBBounds.y1) / railLen, 0, 1);
29479
+ pos !== this._tooltipState.pos && (this._tooltipState.pos = pos, this._tooltipState.value = this.calculateValueByPos(pos * railLen), this._updateTooltip(), this._dispatchTooltipEvent("sliderTooltipUpdate"));
29225
29480
  }, this._onTooltipHide = () => {
29226
29481
  const {
29227
29482
  tooltip: tooltip
@@ -29249,7 +29504,7 @@
29249
29504
  delta = 0;
29250
29505
  this._isHorizontal ? (currentPos = e.clientX, delta = currentPos - this._prePos, originPos = null === (_b = this._currentHandler) || void 0 === _b ? void 0 : _b.attribute.x, railLen = railWidth) : (currentPos = e.clientY, delta = currentPos - this._prePos, originPos = null === (_a = this._currentHandler) || void 0 === _a ? void 0 : _a.attribute.y, railLen = railHeight);
29251
29506
  const newPos = clamp$3(originPos + delta, 0, railLen),
29252
- currentValue = newPos / railLen * (max - min) + min;
29507
+ currentValue = this.calculateValueByPos(newPos);
29253
29508
  "text" === this._currentHandler.type ? this._updateHandlerText(this._currentHandler, newPos, currentValue) : this._updateHandler(this._currentHandler, newPos, currentValue), this._updateTrack(), this._prePos = currentPos, this._dispatchChangeEvent();
29254
29509
  }, this._onHandlerPointerUp = e => {
29255
29510
  e.preventDefault(), this._isChanging = !1, this._currentHandler = null, "browser" === vglobal.env ? (vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
@@ -29269,7 +29524,8 @@
29269
29524
  railWidth: railWidth,
29270
29525
  railHeight: railHeight,
29271
29526
  min: min,
29272
- max: max
29527
+ max: max,
29528
+ inverse: inverse
29273
29529
  } = this.attribute;
29274
29530
  if (max === min) return;
29275
29531
  const {
@@ -29281,14 +29537,14 @@
29281
29537
  const delta = currentPos - this._prePos;
29282
29538
  if (startHandler) {
29283
29539
  const originPos = this._isHorizontal ? startHandler.attribute.x : startHandler.attribute.y,
29284
- newPos = clamp$3(originPos + delta, 0, railLen - trackLen),
29285
- currentValue = newPos / railLen * (max - min) + min;
29540
+ newPos = inverse ? clamp$3(originPos + delta, trackLen, railLen) : clamp$3(originPos + delta, 0, railLen - trackLen),
29541
+ currentValue = this.calculateValueByPos(newPos);
29286
29542
  this._updateHandler(startHandler, newPos, currentValue);
29287
29543
  }
29288
29544
  if (endHandler) {
29289
29545
  const originPos = this._isHorizontal ? endHandler.attribute.x : endHandler.attribute.y,
29290
- newPos = clamp$3(originPos + delta, trackLen, railLen),
29291
- currentValue = newPos / railLen * (max - min) + min,
29546
+ newPos = inverse ? clamp$3(originPos + delta, 0, railLen - trackLen) : clamp$3(originPos + delta, trackLen, railLen),
29547
+ currentValue = this.calculateValueByPos(newPos),
29292
29548
  startHandlerAttribute = null == startHandler ? void 0 : startHandler.attribute;
29293
29549
  this._updateHandler(endHandler, newPos, currentValue), this._track.setAttributes(this._isHorizontal ? {
29294
29550
  x: Math.min(startHandlerAttribute.x, endHandler.attribute.x),
@@ -29316,9 +29572,9 @@
29316
29572
  if (max === min) return;
29317
29573
  const startHandler = this._startHandler,
29318
29574
  endHandler = this._endHandler;
29319
- let currentPos, startHandlerPos, endHandlerPos, railLen;
29320
- this._isHorizontal ? (currentPos = e.viewX - this._rail.globalAABBBounds.x1, startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.x, endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.x, railLen = railWidth) : (currentPos = e.viewY - this._rail.globalAABBBounds.y1, startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.y, endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.y, railLen = railHeight);
29321
- const currentValue = currentPos / railLen * (max - min) + min;
29575
+ let currentPos, startHandlerPos, endHandlerPos;
29576
+ this._isHorizontal ? (currentPos = e.viewX - this._rail.globalAABBBounds.x1, startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.x, endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.x, railWidth) : (currentPos = e.viewY - this._rail.globalAABBBounds.y1, startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.y, endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.y, railHeight);
29577
+ const currentValue = this.calculateValueByPos(currentPos);
29322
29578
  if (isValid$3(endHandlerPos)) {
29323
29579
  const updateHandler = Math.abs(currentPos - startHandlerPos) > Math.abs(currentPos - endHandlerPos) ? endHandler : startHandler;
29324
29580
  this._updateHandler(updateHandler, currentPos, currentValue);
@@ -29326,11 +29582,33 @@
29326
29582
  this._updateTrack(), this._dispatchChangeEvent();
29327
29583
  };
29328
29584
  }
29329
- setValue(value) {
29585
+ calculatePosByValue(value, pos) {
29330
29586
  const {
29331
29587
  layout: layout,
29332
29588
  railWidth: railWidth,
29333
29589
  railHeight: railHeight,
29590
+ min: min,
29591
+ max: max,
29592
+ inverse: inverse
29593
+ } = this.attribute;
29594
+ let ratio = 0;
29595
+ ratio = min === max ? "start" === pos ? 0 : "end" === pos ? 1 : 0 : (value - min) / (max - min);
29596
+ return (inverse ? 1 - ratio : ratio) * ("vertical" === layout ? railHeight : railWidth);
29597
+ }
29598
+ calculateValueByPos(pos) {
29599
+ const {
29600
+ layout: layout,
29601
+ railWidth: railWidth,
29602
+ railHeight: railHeight,
29603
+ min: min,
29604
+ max: max,
29605
+ inverse: inverse
29606
+ } = this.attribute,
29607
+ railLen = "vertical" === layout ? railHeight : railWidth;
29608
+ return min + (max - min) * (inverse ? 1 - pos / railLen : pos / railLen);
29609
+ }
29610
+ setValue(value) {
29611
+ const {
29334
29612
  min: min,
29335
29613
  max: max
29336
29614
  } = this.attribute;
@@ -29339,14 +29617,8 @@
29339
29617
  {
29340
29618
  startHandler: startHandler,
29341
29619
  endHandler: endHandler
29342
- } = this._getHandlers(),
29343
- railLen = "vertical" === layout ? railHeight : railWidth,
29344
- startPos = (startValue - min) / (max - min) * railLen;
29345
- if (startHandler && this._updateHandler(startHandler, startPos, startValue), endHandler) {
29346
- const endPos = (endValue - min) / (max - min) * railLen;
29347
- this._updateHandler(endHandler, endPos, endValue);
29348
- }
29349
- this._updateTrack();
29620
+ } = this._getHandlers();
29621
+ startHandler && this._updateHandler(startHandler, this.calculatePosByValue(startValue), startValue), endHandler && this._updateHandler(endHandler, this.calculatePosByValue(endValue), endValue), this._updateTrack();
29350
29622
  }
29351
29623
  render() {
29352
29624
  var _a, _b;
@@ -29449,30 +29721,29 @@
29449
29721
  isNil$3(value) && (value = [min, max]);
29450
29722
  const handlerTextVisible = handlerText && handlerText.visible,
29451
29723
  isHorizontal = this._isHorizontal,
29452
- railLen = isHorizontal ? railWidth : railHeight,
29453
29724
  [startValue, endValue] = convertValueToRange(value),
29454
- handlerStart = max === min ? range ? 0 : railLen : (startValue - min) / (max - min) * railLen,
29725
+ startPos = this.calculatePosByValue(startValue, range ? "start" : "end"),
29455
29726
  startHandler = this._renderHandler(Object.assign({
29456
- x: isHorizontal ? handlerStart : railWidth / 2,
29457
- y: isHorizontal ? railHeight / 2 : handlerStart,
29727
+ x: isHorizontal ? startPos : railWidth / 2,
29728
+ y: isHorizontal ? railHeight / 2 : startPos,
29458
29729
  size: handlerSize,
29459
29730
  strokeBoundsBuffer: 0,
29460
29731
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
29461
29732
  }, handlerStyle));
29462
- if (startHandler.name = SLIDER_ELEMENT_NAME.startHandler, this._startHandler = startHandler, container.add(startHandler), this._currentValue.startPos = handlerStart, handlerTextVisible) {
29733
+ if (startHandler.name = SLIDER_ELEMENT_NAME.startHandler, this._startHandler = startHandler, container.add(startHandler), this._currentValue.startPos = startPos, handlerTextVisible) {
29463
29734
  const startHandlerText = this._renderHandlerText(startValue, range ? "start" : "end");
29464
29735
  startHandlerText.name = SLIDER_ELEMENT_NAME.startHandlerText, container.add(startHandlerText), this._startHandlerText = startHandlerText;
29465
29736
  }
29466
29737
  if (range) {
29467
- const handlerEnd = max === min ? railLen : (endValue - min) / (max - min) * railLen,
29738
+ const endPos = this.calculatePosByValue(endValue, "end"),
29468
29739
  endHandler = this._renderHandler(Object.assign({
29469
- x: isHorizontal ? handlerEnd : railWidth / 2,
29470
- y: isHorizontal ? railHeight / 2 : handlerEnd,
29740
+ x: isHorizontal ? endPos : railWidth / 2,
29741
+ y: isHorizontal ? railHeight / 2 : endPos,
29471
29742
  size: handlerSize,
29472
29743
  strokeBoundsBuffer: 0,
29473
29744
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
29474
29745
  }, handlerStyle));
29475
- if (endHandler.name = SLIDER_ELEMENT_NAME.endHandler, this._endHandler = endHandler, container.add(endHandler), this._currentValue.endPos = handlerEnd, handlerTextVisible) {
29746
+ if (endHandler.name = SLIDER_ELEMENT_NAME.endHandler, this._endHandler = endHandler, container.add(endHandler), this._currentValue.endPos = endPos, handlerTextVisible) {
29476
29747
  const endHandlerText = this._renderHandlerText(endValue, "end");
29477
29748
  endHandlerText.name = SLIDER_ELEMENT_NAME.endHandlerText, container.add(endHandlerText), this._endHandlerText = endHandlerText;
29478
29749
  }
@@ -29495,8 +29766,7 @@
29495
29766
  const clampValue = clampRange$1(value, min, max);
29496
29767
  startValue = clampValue[0], endValue = clampValue[1];
29497
29768
  } else startValue = min, endValue = clamp$3(value, min, max);
29498
- const isHorizontal = this._isHorizontal,
29499
- railLen = isHorizontal ? railWidth : railHeight;
29769
+ const isHorizontal = this._isHorizontal;
29500
29770
  range || (startValue = min);
29501
29771
  const trackContainer = graphicCreator$1.group({
29502
29772
  x: 0,
@@ -29511,13 +29781,13 @@
29511
29781
  const draggableTrack = isObject$4(range) && !0 === range.draggableTrack;
29512
29782
  let cursor;
29513
29783
  cursor = !1 === slidable ? "default" : !1 === range || !1 === draggableTrack ? "pointer" : getDefaultCursor(isHorizontal);
29514
- const trackWidth = max === min ? railLen : (endValue - startValue) / (max - min) * railLen,
29515
- startPos = max === min ? 0 : (startValue - min) / (max - min) * railLen,
29784
+ const startPos = this.calculatePosByValue(startValue, "start"),
29785
+ endPos = this.calculatePosByValue(endValue, range ? "end" : "start"),
29516
29786
  track = graphicCreator$1.rect(Object.assign({
29517
- x: isHorizontal ? startPos : 0,
29518
- y: isHorizontal ? 0 : startPos,
29519
- width: isHorizontal ? trackWidth : railWidth,
29520
- height: isHorizontal ? railHeight : trackWidth,
29787
+ x: isHorizontal ? Math.min(startPos, endPos) : 0,
29788
+ y: isHorizontal ? 0 : Math.min(startPos, endPos),
29789
+ width: isHorizontal ? Math.abs(endPos - startPos) : railWidth,
29790
+ height: isHorizontal ? railHeight : Math.abs(endPos - startPos),
29521
29791
  cursor: cursor
29522
29792
  }, trackStyle));
29523
29793
  track.name = SLIDER_ELEMENT_NAME.track, this._track = track, trackContainer.add(track), container.add(trackContainer);
@@ -29529,8 +29799,6 @@
29529
29799
  var _a, _b, _c;
29530
29800
  const {
29531
29801
  align: align,
29532
- min: min,
29533
- max: max,
29534
29802
  handlerSize = 14,
29535
29803
  handlerText = {},
29536
29804
  railHeight: railHeight,
@@ -29538,15 +29806,14 @@
29538
29806
  slidable: slidable
29539
29807
  } = this.attribute,
29540
29808
  isHorizontal = this._isHorizontal,
29541
- railLen = isHorizontal ? railWidth : railHeight,
29542
- handlerStart = max === min ? "start" === position ? 0 : railLen : (value - min) / (max - min) * railLen,
29809
+ pos = this.calculatePosByValue(value, position),
29543
29810
  textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
29544
29811
  textStyle = {
29545
29812
  text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
29546
29813
  lineHeight: null === (_c = handlerText.style) || void 0 === _c ? void 0 : _c.lineHeight,
29547
29814
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
29548
29815
  };
29549
- isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = handlerStart, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = handlerStart, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = handlerStart) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = handlerStart);
29816
+ isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos);
29550
29817
  return graphicCreator$1.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
29551
29818
  }
29552
29819
  _renderTooltip() {
@@ -29587,7 +29854,12 @@
29587
29854
  _updateTooltip() {
29588
29855
  var _a, _b;
29589
29856
  if (!this._tooltipShape && !this._tooltipText || !this._tooltipState) return;
29590
- const coord = this._isHorizontal ? this._tooltipState.pos * this.attribute.railWidth : this._tooltipState.pos * this.attribute.railHeight,
29857
+ const {
29858
+ railWidth: railWidth,
29859
+ railHeight: railHeight
29860
+ } = this.attribute,
29861
+ railLen = this._isHorizontal ? railWidth : railHeight,
29862
+ coord = this._tooltipState.pos * railLen,
29591
29863
  coordKey = this._isHorizontal ? "x" : "y";
29592
29864
  this._tooltipShape && this._tooltipShape.setAttributes({
29593
29865
  visible: !0,
@@ -29617,7 +29889,12 @@
29617
29889
  this.attribute.disableTriggerEvent || (this._mainContainer.addEventListener("pointerenter", this._onTooltipShow), this._mainContainer.addEventListener("pointermove", this._onTooltipUpdate), this._mainContainer.addEventListener("pointerleave", this._onTooltipHide));
29618
29890
  }
29619
29891
  _updateTrack() {
29620
- const startHandler = this._startHandler,
29892
+ const {
29893
+ inverse: inverse,
29894
+ railWidth: railWidth,
29895
+ railHeight: railHeight
29896
+ } = this.attribute,
29897
+ startHandler = this._startHandler,
29621
29898
  endHandler = this._endHandler;
29622
29899
  if (this._isHorizontal) {
29623
29900
  const startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.x;
@@ -29627,7 +29904,10 @@
29627
29904
  x: Math.min(startHandlerPos, endHandlerPos),
29628
29905
  width: Math.abs(startHandlerPos - endHandlerPos)
29629
29906
  });
29630
- } else this._track.setAttributes({
29907
+ } else inverse ? this._track.setAttributes({
29908
+ x: startHandlerPos,
29909
+ width: railWidth - startHandlerPos
29910
+ }) : this._track.setAttributes({
29631
29911
  width: startHandlerPos
29632
29912
  });
29633
29913
  } else {
@@ -29638,7 +29918,10 @@
29638
29918
  y: Math.min(startHandlerPos, endHandlerPos),
29639
29919
  height: Math.abs(startHandlerPos - endHandlerPos)
29640
29920
  });
29641
- } else this._track.setAttributes({
29921
+ } else inverse ? this._track.setAttributes({
29922
+ y: startHandlerPos,
29923
+ height: railHeight - startHandlerPos
29924
+ }) : this._track.setAttributes({
29642
29925
  height: startHandlerPos
29643
29926
  });
29644
29927
  }
@@ -29798,6 +30081,7 @@
29798
30081
  handlerText: handlerText,
29799
30082
  showTooltip: showTooltip,
29800
30083
  tooltip: tooltip,
30084
+ inverse: inverse,
29801
30085
  disableTriggerEvent: disableTriggerEvent
29802
30086
  } = this.attribute,
29803
30087
  domain = [],
@@ -29830,7 +30114,8 @@
29830
30114
  handlerText: handlerText,
29831
30115
  showTooltip: showTooltip,
29832
30116
  tooltip: tooltip,
29833
- disableTriggerEvent: disableTriggerEvent
30117
+ disableTriggerEvent: disableTriggerEvent,
30118
+ inverse: inverse
29834
30119
  });
29835
30120
  this._innerView.add(slider), this._slider = slider, slider.translateTo(0 - slider.AABBBounds.x1, (this._title ? this._title.AABBBounds.height() + get$5(this.attribute, "title.space", DEFAULT_TITLE_SPACE) : 0) - slider.AABBBounds.y1), this._updateColor();
29836
30121
  }
@@ -29840,7 +30125,8 @@
29840
30125
  _getTrackColor() {
29841
30126
  const {
29842
30127
  colors: colors,
29843
- layout: layout
30128
+ layout: layout,
30129
+ inverse: inverse
29844
30130
  } = this.attribute;
29845
30131
  if (isEmpty(colors)) return;
29846
30132
  const count = colors.length;
@@ -29853,15 +30139,16 @@
29853
30139
  color: colors[i]
29854
30140
  });
29855
30141
  }
29856
- const isHorizontal = "horizontal" === layout;
29857
- return {
29858
- gradient: "linear",
29859
- stops: stops,
29860
- x0: 0,
29861
- y0: 0,
29862
- x1: isHorizontal ? 1 : 0,
29863
- y1: isHorizontal ? 0 : 1
29864
- };
30142
+ const isHorizontal = "horizontal" === layout,
30143
+ res = {
30144
+ gradient: "linear",
30145
+ stops: stops,
30146
+ x0: 0,
30147
+ y0: 0,
30148
+ x1: isHorizontal ? 1 : 0,
30149
+ y1: isHorizontal ? 0 : 1
30150
+ };
30151
+ return inverse && (isHorizontal ? (res.x0 = 1, res.x1 = 0) : (res.y0 = 1, res.y1 = 0)), res;
29865
30152
  }
29866
30153
  _updateColor() {
29867
30154
  const {
@@ -29983,7 +30270,8 @@
29983
30270
  showTooltip: showTooltip,
29984
30271
  tooltip: tooltip,
29985
30272
  sizeBackground: sizeBackground,
29986
- disableTriggerEvent: disableTriggerEvent
30273
+ disableTriggerEvent: disableTriggerEvent,
30274
+ inverse: inverse
29987
30275
  } = this.attribute,
29988
30276
  mainContainer = graphicCreator$1.group({
29989
30277
  x: 0,
@@ -30017,12 +30305,13 @@
30017
30305
  handlerText: handlerText,
30018
30306
  showTooltip: showTooltip,
30019
30307
  tooltip: tooltip,
30020
- disableTriggerEvent: disableTriggerEvent
30308
+ disableTriggerEvent: disableTriggerEvent,
30309
+ inverse: inverse
30021
30310
  });
30022
30311
  mainContainer.add(slider);
30023
30312
  let path,
30024
30313
  start = 0;
30025
- "horizontal" === layout ? "top" === align ? (path = `M0,0L${railWidth},0L${railWidth},12Z`, start = railHeight) : (path = `M0,12L${railWidth},12L${railWidth},0Z`, slider.setAttribute("y", 12)) : "left" === align ? path = `M${railWidth},0L${railWidth},0L${railWidth + 12},${railHeight}L${railWidth},${railHeight}Z` : (path = `M0,${railHeight}L12,${railHeight}L12,0Z`, slider.setAttribute("x", 12));
30314
+ "horizontal" === layout ? "top" === align ? (path = `M0,0L${railWidth},0L${inverse ? 0 : railWidth},12Z`, start = railHeight) : (path = `M0,12L${railWidth},12L${inverse ? 0 : railWidth},0Z`, slider.setAttribute("y", 12)) : "left" === align ? path = `M${railWidth},0L${railWidth + 12},${inverse ? 0 : railHeight}L${railWidth},${railHeight}Z` : (path = `M0,${inverse ? 0 : railHeight}L12,${railHeight}L12,0Z`, slider.setAttribute("x", 12));
30026
30315
  const background = graphicCreator$1.path(Object.assign(Object.assign({
30027
30316
  x: 0,
30028
30317
  y: start,
@@ -32728,7 +33017,9 @@
32728
33017
  const axisStylrAttrs = getAxisAttributes(this.option);
32729
33018
  const attrs = this.getUpdateAttribute();
32730
33019
  attrs.verticalFactor = this.orient === 'top' || this.orient === 'right' ? -1 : 1;
32731
- this.component = new LineAxis(merge({}, axisStylrAttrs, attrs));
33020
+ this.component = new LineAxis(merge({
33021
+ disableTriggerEvent: this.table.options.disableInteraction
33022
+ }, axisStylrAttrs, attrs));
32732
33023
  this.component.setAttributes(this.setLayoutStartPosition({ x: 0, y: 0 }));
32733
33024
  this.component.originAxis = this;
32734
33025
  }
@@ -32904,89 +33195,6 @@
32904
33195
  }
32905
33196
  }
32906
33197
 
32907
- function diffCellAddress(col, row, oldCellIds, newCellIds, oldRowHeaderCellPositons, layout) {
32908
- const columnHeaderStart = layout.columnHeaderLevelCount;
32909
- const addCellPositions = [];
32910
- const removeCellPositions = [];
32911
- for (let i = 0; i < oldCellIds.length; i++) {
32912
- if (!newCellIds.includes(oldCellIds[i])) {
32913
- removeCellPositions.push(oldRowHeaderCellPositons[i]);
32914
- }
32915
- }
32916
- for (let i = 0; i < newCellIds.length; i++) {
32917
- if (!oldCellIds.includes(newCellIds[i])) {
32918
- const newCellAddr = { col, row: columnHeaderStart + i };
32919
- addCellPositions.push(newCellAddr);
32920
- }
32921
- }
32922
- let parentId = layout.getParentCellId(col, row);
32923
- let parentCellAddress = layout.getRowHeaderCellAddressByCellId(parentId);
32924
- const updateCellPositions = [];
32925
- parentCellAddress && updateCellPositions.push(parentCellAddress);
32926
- while (parentId) {
32927
- parentId = layout.getParentCellId(parentCellAddress.col, parentCellAddress.row);
32928
- if (parentId) {
32929
- parentCellAddress = layout.getRowHeaderCellAddressByCellId(parentId);
32930
- updateCellPositions.push(parentCellAddress);
32931
- }
32932
- }
32933
- return {
32934
- addCellPositions,
32935
- removeCellPositions,
32936
- updateCellPositions
32937
- };
32938
- }
32939
- function calculateArrayDiff(originalArray, targetArray) {
32940
- const add = [];
32941
- const remove = [];
32942
- const originalMap = new Map();
32943
- for (let i = 0; i < originalArray.length; i++) {
32944
- const element = originalArray[i];
32945
- const key = JSON.stringify(element);
32946
- if (originalMap.has(key)) {
32947
- originalMap.get(key).push(i);
32948
- }
32949
- else {
32950
- originalMap.set(key, [i]);
32951
- }
32952
- }
32953
- for (let i = 0; i < targetArray.length; i++) {
32954
- const element = targetArray[i];
32955
- const key = JSON.stringify(element);
32956
- if (!originalMap.has(key)) {
32957
- add.push(i);
32958
- }
32959
- else {
32960
- const indices = originalMap.get(key);
32961
- indices.shift();
32962
- if (indices.length === 0) {
32963
- originalMap.delete(key);
32964
- }
32965
- }
32966
- }
32967
- for (let i = 0; i < originalArray.length; i++) {
32968
- const element = originalArray[i];
32969
- if (!targetArray.some(item => isEqual(item, element))) {
32970
- remove.push(i);
32971
- }
32972
- }
32973
- return { add, remove };
32974
- }
32975
- function isEqual(arr1, arr2) {
32976
- if (arr1 === arr2) {
32977
- return true;
32978
- }
32979
- if (arr1.length !== arr2.length) {
32980
- return false;
32981
- }
32982
- for (let i = 0; i < arr1.length; i++) {
32983
- if (arr1[i] !== arr2[i]) {
32984
- return false;
32985
- }
32986
- }
32987
- return true;
32988
- }
32989
-
32990
33198
  class Aggregator {
32991
33199
  className = 'Aggregator';
32992
33200
  isRecord = true;
@@ -33810,7 +34018,7 @@
33810
34018
  const record = this.getOriginalRecord(this.currentIndexedData[index]);
33811
34019
  return record?.hierarchyState ?? null;
33812
34020
  }
33813
- toggleHierarchyState(index) {
34021
+ toggleHierarchyState(index, bodyStartIndex, bodyEndIndex) {
33814
34022
  const oldIndexedData = this.currentIndexedData.slice(0);
33815
34023
  const indexed = this.getIndexKey(index);
33816
34024
  const state = this.getHierarchyState(index);
@@ -33841,8 +34049,21 @@
33841
34049
  data.hierarchyState = HierarchyState.collapse;
33842
34050
  }
33843
34051
  this.updatePagerData();
33844
- const newDiff = calculateArrayDiff(oldIndexedData, this.currentIndexedData);
33845
- return newDiff;
34052
+ const add = [];
34053
+ const remove = [];
34054
+ if (state === HierarchyState.collapse) {
34055
+ const addLength = this.currentIndexedData.length - oldIndexedData.length;
34056
+ for (let i = 0; i < addLength; i++) {
34057
+ add.push(index + i + 1);
34058
+ }
34059
+ }
34060
+ else if (state === HierarchyState.expand) {
34061
+ const removeLength = oldIndexedData.length - this.currentIndexedData.length;
34062
+ for (let i = 0; i < removeLength; i++) {
34063
+ remove.push(index + i + 1);
34064
+ }
34065
+ }
34066
+ return { add, remove };
33846
34067
  }
33847
34068
  pushChildrenNode(indexKey, hierarchyState, nodeData) {
33848
34069
  if (!hierarchyState || hierarchyState === HierarchyState.collapse || hierarchyState === HierarchyState.none) {
@@ -36640,6 +36861,9 @@
36640
36861
  const barPaddingLeft = Math.max(barPadding[3], Math.ceil(borderWidth[3] / 2));
36641
36862
  contentWidth -= barPaddingRight + barPaddingLeft;
36642
36863
  contentHeight -= barPaddingBottom + barPaddingTop;
36864
+ if (row === table.rowCount - 1) {
36865
+ contentHeight -= 1;
36866
+ }
36643
36867
  const top = barPaddingTop;
36644
36868
  const left = barPaddingLeft;
36645
36869
  const right = contentWidth;
@@ -37267,7 +37491,7 @@
37267
37491
  this.numberType = CHART_NUMBER_TYPE;
37268
37492
  this.isShareChartSpec = isShareChartSpec;
37269
37493
  if (!params.chartInstance) {
37270
- const chartInstance = new params.ClassType(params.spec, {
37494
+ const chartInstance = (this.chartInstance = new params.ClassType(params.spec, merge({}, this.attribute.tableChartOption, {
37271
37495
  renderCanvas: params.canvas,
37272
37496
  mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
37273
37497
  modeParams: this.attribute.modeParams,
@@ -37277,8 +37501,9 @@
37277
37501
  interactive: false,
37278
37502
  animation: false,
37279
37503
  autoFit: false
37280
- });
37504
+ })));
37281
37505
  chartInstance.renderSync();
37506
+ chartInstance.getStage().enableDirtyBounds();
37282
37507
  params.chartInstance = this.chartInstance = chartInstance;
37283
37508
  }
37284
37509
  else {
@@ -37296,34 +37521,53 @@
37296
37521
  y1: y1 - table.scrollTop,
37297
37522
  y2: y2 - table.scrollTop
37298
37523
  });
37299
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
37524
+ this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, merge({}, this.attribute.tableChartOption, {
37300
37525
  renderCanvas: this.attribute.canvas,
37301
37526
  mode: 'desktop-browser',
37302
37527
  canvasControled: false,
37303
37528
  viewBox: {
37304
- x1: x1 - table.scrollLeft,
37305
- x2: x2 - table.scrollLeft,
37306
- y1: y1 - table.scrollTop,
37307
- y2: y2 - table.scrollTop
37529
+ x1: 0,
37530
+ x2: x2 - x1,
37531
+ y1: 0,
37532
+ y2: y2 - y1
37308
37533
  },
37309
37534
  dpr: table.internalProps.pixelRatio,
37310
37535
  animation: false,
37311
37536
  interactive: true,
37312
37537
  autoFit: false,
37313
- beforeRender: (stage) => {
37314
- const ctx = stage.window.getContext();
37538
+ beforeRender: (chartStage) => {
37539
+ const stage = this.stage;
37540
+ const ctx = chartStage.window.getContext();
37541
+ const stageMatrix = stage.window.getViewBoxTransform();
37542
+ const viewBox = stage.window.getViewBox();
37315
37543
  ctx.inuse = true;
37316
37544
  ctx.clearMatrix();
37545
+ ctx.setTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f, true);
37546
+ ctx.translate(viewBox.x1, viewBox.y1);
37317
37547
  ctx.setTransformForCurrent(true);
37318
37548
  ctx.beginPath();
37319
37549
  ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
37320
37550
  ctx.clip();
37551
+ ctx.clearMatrix();
37552
+ if (!chartStage.needRender) {
37553
+ chartStage.pauseRender();
37554
+ table.scenegraph.stage.dirtyBounds.union(this.globalAABBBounds);
37555
+ table.scenegraph.updateNextFrame();
37556
+ }
37321
37557
  },
37322
37558
  afterRender(stage) {
37323
37559
  const ctx = stage.window.getContext();
37324
37560
  ctx.inuse = false;
37561
+ stage.needRender = false;
37562
+ chartStage.resumeRender();
37325
37563
  }
37326
- });
37564
+ }));
37565
+ const chartStage = this.activeChartInstance.getStage();
37566
+ const matrix = this.globalTransMatrix.clone();
37567
+ const stageMatrix = this.stage.window.getViewBoxTransform();
37568
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
37569
+ chartStage.window.setViewBoxTransform &&
37570
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
37327
37571
  this.activeChartInstance.renderSync();
37328
37572
  table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
37329
37573
  this.activeChartInstance.on('click', (params) => {
@@ -37359,11 +37603,12 @@
37359
37603
  const cellGroup = this.parent;
37360
37604
  const padding = this.attribute.cellPadding;
37361
37605
  const table = this.stage.table;
37606
+ const { x1, y1, x2, y2 } = cellGroup.globalAABBBounds;
37362
37607
  return {
37363
- x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
37364
- x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
37365
- y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
37366
- y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
37608
+ x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
37609
+ x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
37610
+ y1: Math.ceil(y1 + padding[0] + table.scrollTop + (table.options.viewBox?.y1 ?? 0)),
37611
+ y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (table.options.viewBox?.y1 ?? 0))
37367
37612
  };
37368
37613
  }
37369
37614
  }
@@ -37394,6 +37639,10 @@
37394
37639
  bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
37395
37640
  bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
37396
37641
  }
37642
+ bodyBound.x1 = bodyBound.x1 + (table.options.viewBox?.x1 ?? 0);
37643
+ bodyBound.x2 = bodyBound.x2 + (table.options.viewBox?.x1 ?? 0);
37644
+ bodyBound.y1 = bodyBound.y1 + (table.options.viewBox?.y1 ?? 0);
37645
+ bodyBound.y2 = bodyBound.y2 + (table.options.viewBox?.y1 ?? 0);
37397
37646
  return bodyBound;
37398
37647
  }
37399
37648
 
@@ -37452,7 +37701,8 @@
37452
37701
  data: table.getCellValue(col, row),
37453
37702
  cellPadding: padding,
37454
37703
  dpr: table.internalProps.pixelRatio,
37455
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
37704
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : [],
37705
+ tableChartOption: table.options.chartOption
37456
37706
  });
37457
37707
  cellGroup.appendChild(chartGroup);
37458
37708
  table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
@@ -41785,7 +42035,7 @@
41785
42035
  this.frozenShadowLine.setAttributes({
41786
42036
  visible: true,
41787
42037
  x: colX,
41788
- height: this.table.tableNoFrameHeight
42038
+ height: this.table.getDrawRange().height
41789
42039
  });
41790
42040
  }
41791
42041
  }
@@ -42208,48 +42458,65 @@
42208
42458
  if (viewBox.y2 <= viewBox.y1) {
42209
42459
  viewBox.y2 = viewBox.y1 + 1;
42210
42460
  }
42211
- axes?.forEach((axis, index) => {
42212
- if (axis.type === 'band') {
42213
- chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
42214
- }
42215
- else {
42216
- chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
42217
- }
42218
- });
42219
42461
  chartInstance.updateViewBox({
42220
- x1: viewBox.x1 - chart.getRootNode().table.scrollLeft,
42221
- x2: viewBox.x2 - chart.getRootNode().table.scrollLeft,
42222
- y1: viewBox.y1 - chart.getRootNode().table.scrollTop,
42223
- y2: viewBox.y2 - chart.getRootNode().table.scrollTop
42462
+ x1: 0,
42463
+ x2: viewBox.x2 - viewBox.x1,
42464
+ y1: 0,
42465
+ y2: viewBox.y2 - viewBox.y1
42224
42466
  }, false, false);
42225
- const table = chart.getRootNode().table;
42226
- table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
42227
- if (typeof dataId === 'string') {
42228
- chartInstance.updateDataSync(dataId, data ?? []);
42229
- }
42230
- else {
42231
- const dataBatch = [];
42232
- for (const dataIdStr in dataId) {
42233
- const dataIdAndField = dataId[dataIdStr];
42234
- const series = spec.series.find((item) => item?.data?.id === dataIdStr);
42235
- dataBatch.push({
42236
- id: dataIdStr,
42237
- values: dataIdAndField
42238
- ? data?.filter((item) => {
42239
- return item.hasOwnProperty(dataIdAndField);
42240
- }) ?? []
42241
- : data ?? [],
42242
- fields: series?.data?.fields
42243
- });
42244
- if (!chartInstance.updateFullDataSync) {
42245
- chartInstance.updateDataSync(dataIdStr, dataIdAndField
42246
- ? data?.filter((item) => {
42247
- return item.hasOwnProperty(dataIdAndField);
42248
- }) ?? []
42249
- : data ?? []);
42467
+ const chartStage = chartInstance.getStage();
42468
+ const matrix = chart.globalTransMatrix.clone();
42469
+ const stageMatrix = chart.stage.window.getViewBoxTransform();
42470
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
42471
+ chartStage.window.setViewBoxTransform &&
42472
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
42473
+ const { table } = chart.getRootNode();
42474
+ let updateSpec = false;
42475
+ if (table.options.specFormat) {
42476
+ const formatResult = table.options.specFormat(chart.attribute.spec);
42477
+ if (formatResult.needFormatSpec && formatResult.spec) {
42478
+ const spec = formatResult.spec;
42479
+ chartInstance.updateSpecSync(spec);
42480
+ updateSpec = true;
42481
+ }
42482
+ }
42483
+ if (!updateSpec) {
42484
+ axes?.forEach((axis, index) => {
42485
+ if (axis.type === 'band') {
42486
+ chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
42487
+ }
42488
+ else {
42489
+ chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
42490
+ }
42491
+ });
42492
+ table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
42493
+ if (typeof dataId === 'string') {
42494
+ chartInstance.updateDataSync(dataId, data ?? []);
42495
+ }
42496
+ else {
42497
+ const dataBatch = [];
42498
+ for (const dataIdStr in dataId) {
42499
+ const dataIdAndField = dataId[dataIdStr];
42500
+ const series = spec.series.find((item) => item?.data?.id === dataIdStr);
42501
+ dataBatch.push({
42502
+ id: dataIdStr,
42503
+ values: dataIdAndField
42504
+ ? data?.filter((item) => {
42505
+ return item.hasOwnProperty(dataIdAndField);
42506
+ }) ?? []
42507
+ : data ?? [],
42508
+ fields: series?.data?.fields
42509
+ });
42510
+ if (!chartInstance.updateFullDataSync) {
42511
+ chartInstance.updateDataSync(dataIdStr, dataIdAndField
42512
+ ? data?.filter((item) => {
42513
+ return item.hasOwnProperty(dataIdAndField);
42514
+ }) ?? []
42515
+ : data ?? []);
42516
+ }
42250
42517
  }
42518
+ chartInstance.updateFullDataSync?.(dataBatch);
42251
42519
  }
42252
- chartInstance.updateFullDataSync?.(dataBatch);
42253
42520
  }
42254
42521
  const sg = chartInstance.getStage();
42255
42522
  cacheStageCanvas(sg, chart);
@@ -42311,7 +42578,7 @@
42311
42578
  }
42312
42579
 
42313
42580
  const ChartRender = Symbol.for('ChartRender');
42314
- let DefaultCanvasChartRender = class DefaultCanvasChartRender {
42581
+ let DefaultCanvasChartRender = class DefaultCanvasChartRender extends BaseRender {
42315
42582
  type;
42316
42583
  numberType = CHART_NUMBER_TYPE;
42317
42584
  drawShape(chart, context, x, y, drawContext, params, fillCb, strokeCb) {
@@ -42319,6 +42586,7 @@
42319
42586
  const { dataId, data, spec } = chart.attribute;
42320
42587
  chart.getViewBox();
42321
42588
  const { width = groupAttribute.width, height = groupAttribute.height } = chart.attribute;
42589
+ const { table } = chart.getRootNode();
42322
42590
  const { active, cacheCanvas, activeChartInstance } = chart;
42323
42591
  if (!active && cacheCanvas) {
42324
42592
  if (isArray$3(cacheCanvas)) {
@@ -42332,6 +42600,27 @@
42332
42600
  }
42333
42601
  }
42334
42602
  else if (activeChartInstance) {
42603
+ if (table.options.specFormat) {
42604
+ const formatResult = table.options.specFormat(chart.attribute.spec);
42605
+ if (formatResult.needFormatSpec && formatResult.spec) {
42606
+ const spec = formatResult.spec;
42607
+ activeChartInstance.updateSpecSync(spec);
42608
+ return;
42609
+ }
42610
+ }
42611
+ const viewBox = chart.getViewBox();
42612
+ activeChartInstance.updateViewBox({
42613
+ x1: 0,
42614
+ x2: viewBox.x2 - viewBox.x1,
42615
+ y1: 0,
42616
+ y2: viewBox.y2 - viewBox.y1
42617
+ }, false, false);
42618
+ const chartStage = activeChartInstance.getStage();
42619
+ chartStage.needRender = true;
42620
+ const matrix = chart.globalTransMatrix.clone();
42621
+ const stageMatrix = chart.stage.window.getViewBoxTransform().clone();
42622
+ stageMatrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
42623
+ chartStage.window.setViewBoxTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
42335
42624
  if (typeof dataId === 'string') {
42336
42625
  activeChartInstance.updateDataSync(dataId, data ?? []);
42337
42626
  }
@@ -42361,13 +42650,13 @@
42361
42650
  }
42362
42651
  }
42363
42652
  else {
42364
- if (chart.getRootNode().table.internalProps.renderChartAsync) {
42653
+ if (table.internalProps.renderChartAsync) {
42365
42654
  if (chartRenderKeys.indexOf(`${chart.parent.col}+${chart.parent.row}`) === -1) {
42366
42655
  chartRenderKeys.push(`${chart.parent.col}+${chart.parent.row}`);
42367
42656
  chartRenderQueueList.push(chart);
42368
42657
  }
42369
42658
  if (!IsHandlingChartQueue()) {
42370
- startRenderChartQueue(chart.getRootNode().table);
42659
+ startRenderChartQueue(table);
42371
42660
  }
42372
42661
  }
42373
42662
  else {
@@ -42376,31 +42665,7 @@
42376
42665
  }
42377
42666
  }
42378
42667
  draw(chart, renderService, drawContext, params) {
42379
- const { context } = drawContext;
42380
- if (!context) {
42381
- return;
42382
- }
42383
- const { clip } = chart.attribute;
42384
- if (clip) {
42385
- context.save();
42386
- }
42387
- else {
42388
- context.highPerformanceSave();
42389
- }
42390
- context.transformFromMatrix(chart.transMatrix, true);
42391
- context.beginPath();
42392
- if (params.skipDraw) {
42393
- this.drawShape(chart, context, 0, 0, drawContext, params, () => false, () => false);
42394
- }
42395
- else {
42396
- this.drawShape(chart, context, 0, 0, drawContext);
42397
- }
42398
- if (clip) {
42399
- context.restore();
42400
- }
42401
- else {
42402
- context.highPerformanceRestore();
42403
- }
42668
+ this._draw(chart, {}, false, drawContext, params);
42404
42669
  }
42405
42670
  };
42406
42671
  DefaultCanvasChartRender = __decorate([
@@ -46075,9 +46340,9 @@
46075
46340
  }
46076
46341
  }
46077
46342
  function removeRow(row, scene) {
46078
- removeCellGroup(row, scene);
46079
46343
  const proxy = scene.proxy;
46080
46344
  if (row >= proxy.rowStart && row <= proxy.rowEnd) {
46345
+ removeCellGroup(row, scene);
46081
46346
  proxy.rowEnd--;
46082
46347
  proxy.currentRow--;
46083
46348
  }
@@ -46966,6 +47231,15 @@
46966
47231
  });
46967
47232
  }
46968
47233
  }
47234
+ function clearCellChartCacheImage(col, row, scenegraph) {
47235
+ const cellGroup = scenegraph.getCell(col, row);
47236
+ cellGroup.children.forEach((node) => {
47237
+ if (node.type === 'chart') {
47238
+ node.cacheCanvas = null;
47239
+ node.addUpdateBoundTag();
47240
+ }
47241
+ });
47242
+ }
46969
47243
  function updateChartData(scenegraph) {
46970
47244
  const table = scenegraph.table;
46971
47245
  for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
@@ -47020,7 +47294,7 @@
47020
47294
  }
47021
47295
  newSelectedDataItemsInChart.push(selectedState);
47022
47296
  }
47023
- if (!isEqual$1(table._selectedDataItemsInChart, newSelectedDataItemsInChart)) {
47297
+ if (!isEqual(table._selectedDataItemsInChart, newSelectedDataItemsInChart)) {
47024
47298
  table._selectedDataItemsInChart = newSelectedDataItemsInChart;
47025
47299
  table.internalProps.layoutMap.updateDataStateToChartInstance();
47026
47300
  clearChartCacheImage(scenegraph);
@@ -47127,6 +47401,10 @@
47127
47401
  }
47128
47402
  updateCellRangeIcon(col, row, (icon) => icon.attribute.visibleTime === 'mouseenter_cell', (icon) => {
47129
47403
  icon.setAttribute('opacity', 0);
47404
+ const iconBack = icon.parent.getChildByName('icon-back');
47405
+ if (iconBack) {
47406
+ iconBack.setAttribute('visible', false);
47407
+ }
47130
47408
  }, scene);
47131
47409
  scene.updateNextFrame();
47132
47410
  }
@@ -47786,7 +48064,12 @@
47786
48064
  setPoptipTheme(this.table.theme.textPopTipStyle);
47787
48065
  let width;
47788
48066
  let height;
47789
- if (Env.mode === 'node') {
48067
+ if (table.options.canvas && table.options.viewBox) {
48068
+ vglobal.setEnv('browser');
48069
+ width = table.options.viewBox.x2 - table.options.viewBox.x1;
48070
+ height = table.options.viewBox.y2 - table.options.viewBox.y1;
48071
+ }
48072
+ else if (Env.mode === 'node') {
47790
48073
  vglobal.setEnv('node', table.options.modeParams);
47791
48074
  width = table.canvasWidth;
47792
48075
  height = table.canvasHeight;
@@ -47804,9 +48087,15 @@
47804
48087
  background: table.theme.underlayBackgroundColor,
47805
48088
  dpr: table.internalProps.pixelRatio,
47806
48089
  enableLayout: true,
47807
- afterRender: () => {
48090
+ beforeRender: (stage) => {
48091
+ this.table.options.beforeRender && this.table.options.beforeRender(stage);
48092
+ },
48093
+ afterRender: (stage) => {
48094
+ this.table.options.afterRender && this.table.options.afterRender(stage);
47808
48095
  this.table.fireListeners('after_render', null);
47809
- }
48096
+ },
48097
+ canvasControled: !table.options.canvas,
48098
+ viewBox: table.options.viewBox
47810
48099
  });
47811
48100
  this.stage.defaultLayer.setTheme({
47812
48101
  group: {
@@ -48410,17 +48699,17 @@
48410
48699
  this.cornerHeaderGroup.setDeltaHeight(detaY);
48411
48700
  this.rowHeaderGroup.setDeltaY(detaY);
48412
48701
  this.bodyGroup.setDeltaY(detaY);
48413
- this.rightFrozenGroup.setDeltaY(detaY);
48702
+ this.table.rightFrozenColCount && this.rightFrozenGroup.setDeltaY(detaY);
48414
48703
  }
48415
48704
  else if (row >= this.table.rowCount - this.table.bottomFrozenRowCount) {
48416
48705
  this.leftBottomCornerGroup.setDeltaHeight(detaY);
48417
48706
  this.bottomFrozenGroup.setDeltaHeight(detaY);
48418
- this.rightBottomCornerGroup.setDeltaHeight(detaY);
48707
+ this.table.rightFrozenColCount && this.rightBottomCornerGroup.setDeltaHeight(detaY);
48419
48708
  }
48420
48709
  else {
48421
48710
  this.rowHeaderGroup.setDeltaHeight(detaY);
48422
48711
  this.bodyGroup.setDeltaHeight(detaY);
48423
- this.rightFrozenGroup.setDeltaHeight(detaY);
48712
+ this.table.rightFrozenColCount && this.rightFrozenGroup.setDeltaHeight(detaY);
48424
48713
  }
48425
48714
  }
48426
48715
  updateContainerHeight(row, detaY) {
@@ -48443,7 +48732,8 @@
48443
48732
  return;
48444
48733
  }
48445
48734
  if ((row >= this.proxy.rowStart && row <= this.proxy.rowEnd) ||
48446
- (row >= this.table.rowCount - this.table.bottomFrozenRowCount && row <= this.table.rowCount - 1)) {
48735
+ (row >= this.table.rowCount - this.table.bottomFrozenRowCount && row <= this.table.rowCount - 1) ||
48736
+ row < this.table.frozenRowCount) {
48447
48737
  this.updateRowHeight(row, height - oldHeight);
48448
48738
  }
48449
48739
  this.table._clearRowRangeHeightsMap(row);
@@ -49250,7 +49540,7 @@
49250
49540
  return table._getLayoutCellId(col, row) === table._getLayoutCellId(range1Col, range1Row);
49251
49541
  }
49252
49542
 
49253
- function updateSelectPosition(state, col, row, isShift, isCtrl, isSelectAll) {
49543
+ function updateSelectPosition(state, col, row, isShift, isCtrl, isSelectAll, isSelectMoving = false) {
49254
49544
  const { table, interactionState } = state;
49255
49545
  const { scenegraph } = table;
49256
49546
  const { highlightScope, disableHeader, cellPos } = state.select;
@@ -49258,7 +49548,7 @@
49258
49548
  col = -1;
49259
49549
  row = -1;
49260
49550
  }
49261
- if (col !== -1 && row !== -1) {
49551
+ if (col !== -1 && row !== -1 && !isSelectMoving) {
49262
49552
  if (interactionState === InteractionState.grabing && state.select.ranges.length > 0) {
49263
49553
  const currentRange = state.select.ranges[state.select.ranges.length - 1];
49264
49554
  if (col > currentRange.start.col && col > currentRange.end.col) {
@@ -49294,7 +49584,9 @@
49294
49584
  state.select.ranges = [];
49295
49585
  scenegraph.deleteAllSelectBorder();
49296
49586
  }
49297
- else if (interactionState === InteractionState.default && !table.stateManager.isResizeCol()) {
49587
+ else if (interactionState === InteractionState.default &&
49588
+ !table.eventManager.isDraging &&
49589
+ !table.stateManager.isResizeCol()) {
49298
49590
  const currentRange = state.select.ranges[state.select.ranges.length - 1];
49299
49591
  if (isShift && currentRange) {
49300
49592
  if (state.select.headerSelectMode !== 'cell' && table.isColumnHeader(col, row)) {
@@ -49367,7 +49659,8 @@
49367
49659
  scenegraph.updateCellSelectBorder(currentRange.start.col, currentRange.start.row, currentRange.end.col, currentRange.end.row, extendSelectRange);
49368
49660
  }
49369
49661
  }
49370
- else if (interactionState === InteractionState.grabing && !table.stateManager.isResizeCol()) {
49662
+ else if ((interactionState === InteractionState.grabing || table.eventManager.isDraging) &&
49663
+ !table.stateManager.isResizeCol()) {
49371
49664
  let extendSelectRange = true;
49372
49665
  if (cellPos.col === -1) {
49373
49666
  cellPos.col = col;
@@ -49697,7 +49990,7 @@
49697
49990
  const cellLocation = state.table.getCellLocation(state.columnMove.colSource, state.columnMove.rowSource);
49698
49991
  if (cellLocation === 'columnHeader') {
49699
49992
  backX = state.columnMove.x;
49700
- if (state.table.isFrozenColumn(col)) {
49993
+ if (state.table.isLeftFrozenColumn(col)) {
49701
49994
  lineX =
49702
49995
  state.columnMove.colTarget >= state.columnMove.colSource
49703
49996
  ? state.table.getColsWidth(0, state.columnMove.colTarget)
@@ -49785,13 +50078,13 @@
49785
50078
  state.table.scenegraph.updateHeaderPosition(0, -1, rowMin, rowMax, moveContext.moveType);
49786
50079
  }
49787
50080
  if (state.table.internalProps.frozenColDragHeaderMode === 'adjustFrozenCount' && state.table.isListTable()) {
49788
- if (state.table.isFrozenColumn(state.columnMove.colTarget) &&
49789
- !state.table.isFrozenColumn(state.columnMove.colSource)) {
50081
+ if (state.table.isLeftFrozenColumn(state.columnMove.colTarget) &&
50082
+ !state.table.isLeftFrozenColumn(state.columnMove.colSource)) {
49790
50083
  state.table.frozenColCount +=
49791
50084
  sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1;
49792
50085
  }
49793
- else if (state.table.isFrozenColumn(state.columnMove.colSource) &&
49794
- !state.table.isFrozenColumn(state.columnMove.colTarget)) {
50086
+ else if (state.table.isLeftFrozenColumn(state.columnMove.colSource) &&
50087
+ !state.table.isLeftFrozenColumn(state.columnMove.colTarget)) {
49795
50088
  state.table.frozenColCount -=
49796
50089
  sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1;
49797
50090
  }
@@ -50281,11 +50574,11 @@
50281
50574
  updateHoverPos(col, row) {
50282
50575
  updateHoverPosition(this, col, row);
50283
50576
  }
50284
- updateSelectPos(col, row, isShift = false, isCtrl = false, isSelectAll = false) {
50577
+ updateSelectPos(col, row, isShift = false, isCtrl = false, isSelectAll = false, isSelectMoving = false) {
50285
50578
  if (row !== -1 && row !== -1) {
50286
50579
  this.select.selecting = true;
50287
50580
  }
50288
- updateSelectPosition(this, col, row, isShift, isCtrl, isSelectAll);
50581
+ updateSelectPosition(this, col, row, isShift, isCtrl, isSelectAll, isSelectMoving);
50289
50582
  }
50290
50583
  checkCellRangeInSelect(cellPosStart, cellPosEnd) {
50291
50584
  return checkMultiCellInSelect(cellPosStart, cellPosEnd, this.select.ranges, this.select.highlightScope);
@@ -50495,6 +50788,9 @@
50495
50788
  const totalHeight = this.table.getAllRowsHeight();
50496
50789
  const oldVerticalBarPos = this.scroll.verticalBarPos;
50497
50790
  this.scroll.verticalBarPos = Math.ceil(yRatio * (totalHeight - this.table.scenegraph.height));
50791
+ if (!isValid$3(this.scroll.verticalBarPos) || isNaN(this.scroll.verticalBarPos)) {
50792
+ this.scroll.verticalBarPos = 0;
50793
+ }
50498
50794
  this.table.scenegraph.setY(-this.scroll.verticalBarPos, yRatio === 1);
50499
50795
  this.scroll.verticalBarPos -= this.table.scenegraph.proxy.deltaY;
50500
50796
  this.table.scenegraph.proxy.deltaY = 0;
@@ -50517,6 +50813,9 @@
50517
50813
  const totalWidth = this.table.getAllColsWidth();
50518
50814
  const oldHorizontalBarPos = this.scroll.horizontalBarPos;
50519
50815
  this.scroll.horizontalBarPos = Math.ceil(xRatio * (totalWidth - this.table.scenegraph.width));
50816
+ if (!isValid$3(this.scroll.horizontalBarPos) || isNaN(this.scroll.horizontalBarPos)) {
50817
+ this.scroll.horizontalBarPos = 0;
50818
+ }
50520
50819
  this.table.scenegraph.setX(-this.scroll.horizontalBarPos, xRatio === 1);
50521
50820
  this.scroll.horizontalBarPos -= this.table.scenegraph.proxy.deltaX;
50522
50821
  this.table.scenegraph.proxy.deltaX = 0;
@@ -50544,6 +50843,9 @@
50544
50843
  }
50545
50844
  const oldVerticalBarPos = this.scroll.verticalBarPos;
50546
50845
  this.scroll.verticalBarPos = top;
50846
+ if (!isValid$3(this.scroll.verticalBarPos) || isNaN(this.scroll.verticalBarPos)) {
50847
+ this.scroll.verticalBarPos = 0;
50848
+ }
50547
50849
  this.table.scenegraph.setY(-top);
50548
50850
  const yRatio = top / (totalHeight - this.table.scenegraph.height);
50549
50851
  this.table.scenegraph.component.updateVerticalScrollBarPos(yRatio);
@@ -50571,6 +50873,9 @@
50571
50873
  }
50572
50874
  const oldHorizontalBarPos = this.scroll.horizontalBarPos;
50573
50875
  this.scroll.horizontalBarPos = left;
50876
+ if (!isValid$3(this.scroll.horizontalBarPos) || isNaN(this.scroll.horizontalBarPos)) {
50877
+ this.scroll.horizontalBarPos = 0;
50878
+ }
50574
50879
  this.table.scenegraph.setX(-left);
50575
50880
  const xRatio = left / (totalWidth - this.table.scenegraph.width);
50576
50881
  this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio);
@@ -51158,8 +51463,8 @@
51158
51463
  function getCellEventArgsSet(e) {
51159
51464
  const tableEvent = {
51160
51465
  abstractPos: {
51161
- x: e.x,
51162
- y: e.y
51466
+ x: e.viewport.x,
51467
+ y: e.viewport.y
51163
51468
  }
51164
51469
  };
51165
51470
  const targetCell = getTargetCell(e.target);
@@ -51196,9 +51501,6 @@
51196
51501
  eventManager.touchSetTimeout = undefined;
51197
51502
  }
51198
51503
  const eventArgsSet = getCellEventArgsSet(e);
51199
- if (stateManager.interactionState === InteractionState.scrolling) {
51200
- return;
51201
- }
51202
51504
  if (stateManager.interactionState === InteractionState.grabing) {
51203
51505
  if (Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1) {
51204
51506
  if (stateManager.isResizeCol()) ;
@@ -51214,6 +51516,9 @@
51214
51516
  }
51215
51517
  return;
51216
51518
  }
51519
+ else if (table.eventManager.isDraging) {
51520
+ eventManager.dealTableSelect(eventArgsSet, true);
51521
+ }
51217
51522
  if (stateManager.isResizeCol() || eventManager.checkColumnResize(eventArgsSet)) {
51218
51523
  if (table.stateManager.select && eventManager.checkCellFillhandle(eventArgsSet)) {
51219
51524
  stateManager.updateCursor('crosshair');
@@ -51870,7 +52175,7 @@
51870
52175
  });
51871
52176
  }
51872
52177
 
51873
- function handleWhell(event, state) {
52178
+ function handleWhell(event, state, isWheelEvent = true) {
51874
52179
  let { deltaX, deltaY } = event;
51875
52180
  if (event.shiftKey && event.deltaY) {
51876
52181
  deltaX = deltaY;
@@ -51890,7 +52195,7 @@
51890
52195
  state.setScrollTop(state.scroll.verticalBarPos + optimizedDeltaY);
51891
52196
  state.showVerticalScrollBar(true);
51892
52197
  }
51893
- state.resetInteractionState();
52198
+ isWheelEvent && state.resetInteractionState();
51894
52199
  if (event.cancelable &&
51895
52200
  (state.table.internalProps.overscrollBehavior === 'none' ||
51896
52201
  (Math.abs(deltaY) >= Math.abs(deltaX) && deltaY !== 0 && isVerticalScrollable(deltaY, state)) ||
@@ -51935,6 +52240,64 @@
51935
52240
  const totalWidth = state.table.getAllColsWidth() - state.table.scenegraph.width;
51936
52241
  return totalWidth !== 0 && deltaX >= 0 && Math.abs(state.scroll.horizontalBarPos - totalWidth) < 1;
51937
52242
  }
52243
+ class InertiaScroll {
52244
+ friction;
52245
+ lastTime;
52246
+ speedX;
52247
+ speedY;
52248
+ stateManager;
52249
+ runingId;
52250
+ scrollHandle;
52251
+ constructor(stateManager) {
52252
+ this.stateManager = stateManager;
52253
+ }
52254
+ setScrollHandle(scrollHandle) {
52255
+ this.scrollHandle = scrollHandle;
52256
+ }
52257
+ startInertia(speedX, speedY, friction) {
52258
+ this.lastTime = Date.now();
52259
+ this.speedX = speedX;
52260
+ this.speedY = speedY;
52261
+ this.friction = friction;
52262
+ if (!this.runingId) {
52263
+ this.runingId = requestAnimationFrame(this.inertia.bind(this));
52264
+ }
52265
+ }
52266
+ inertia() {
52267
+ const now = Date.now();
52268
+ const dffTime = now - this.lastTime;
52269
+ let stopped = true;
52270
+ const f = Math.pow(this.friction, dffTime / 16);
52271
+ const newSpeedX = f * this.speedX;
52272
+ const newSpeedY = f * this.speedY;
52273
+ let dx = 0;
52274
+ let dy = 0;
52275
+ if (Math.abs(newSpeedX) > 0.05) {
52276
+ stopped = false;
52277
+ dx = ((this.speedX + newSpeedX) / 2) * dffTime;
52278
+ }
52279
+ if (Math.abs(newSpeedY) > 0.05) {
52280
+ stopped = false;
52281
+ dy = ((this.speedY + newSpeedY) / 2) * dffTime;
52282
+ }
52283
+ this.scrollHandle?.(dx, dy);
52284
+ if (stopped) {
52285
+ this.runingId = null;
52286
+ return;
52287
+ }
52288
+ this.lastTime = now;
52289
+ this.speedX = newSpeedX;
52290
+ this.speedY = newSpeedY;
52291
+ this.runingId = requestAnimationFrame(this.inertia.bind(this));
52292
+ }
52293
+ endInertia() {
52294
+ cancelAnimationFrame(this.runingId);
52295
+ this.runingId = null;
52296
+ }
52297
+ isInertiaScrolling() {
52298
+ return !!this.runingId;
52299
+ }
52300
+ }
51938
52301
 
51939
52302
  function bindContainerDomListener(eventManager) {
51940
52303
  const table = eventManager.table;
@@ -52057,51 +52420,61 @@
52057
52420
  const data = table.getCopyValue();
52058
52421
  if (isValid$3(data)) {
52059
52422
  e.preventDefault();
52060
- const setDataToHTML = (data) => {
52061
- const result = ['<table>'];
52062
- const META_HEAD = [
52063
- '<meta name="author" content="Visactor"/>',
52064
- '<style type="text/css">td{white-space:normal}br{mso-data-placement:same-cell}</style>'
52065
- ].join('');
52066
- const rows = data.split('\r\n');
52067
- rows.forEach(function (rowCells, rowIndex) {
52068
- const cells = rowCells.split('\t');
52069
- const rowValues = [];
52070
- if (rowIndex === 0) {
52071
- result.push('<tbody>');
52072
- }
52073
- cells.forEach(function (cell, cellIndex) {
52074
- const parsedCellData = !cell
52075
- ? ''
52076
- : cell
52077
- .toString()
52078
- .replace(/&/g, '&amp;')
52079
- .replace(/'/g, '&#39;')
52080
- .replace(/</g, '&lt;')
52081
- .replace(/>/g, '&gt;')
52082
- .replace(/\n/g, '<br>')
52083
- .replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g, '<br>\r\n')
52084
- .replace(/\x20{2,}/gi, (substring) => {
52085
- return `<span style="mso-spacerun: yes">${'&nbsp;'.repeat(substring.length - 1)} </span>`;
52086
- })
52087
- .replace(/\t/gi, '&#9;');
52088
- rowValues.push(`<td>${parsedCellData}</td>`);
52423
+ if (navigator.clipboard?.write) {
52424
+ const setDataToHTML = (data) => {
52425
+ const result = ['<table>'];
52426
+ const META_HEAD = [
52427
+ '<meta name="author" content="Visactor"/>',
52428
+ '<style type="text/css">td{white-space:normal}br{mso-data-placement:same-cell}</style>'
52429
+ ].join('');
52430
+ const rows = data.split('\r\n');
52431
+ rows.forEach(function (rowCells, rowIndex) {
52432
+ const cells = rowCells.split('\t');
52433
+ const rowValues = [];
52434
+ if (rowIndex === 0) {
52435
+ result.push('<tbody>');
52436
+ }
52437
+ cells.forEach(function (cell, cellIndex) {
52438
+ const parsedCellData = !cell
52439
+ ? ''
52440
+ : cell
52441
+ .toString()
52442
+ .replace(/&/g, '&amp;')
52443
+ .replace(/'/g, '&#39;')
52444
+ .replace(/</g, '&lt;')
52445
+ .replace(/>/g, '&gt;')
52446
+ .replace(/\n/g, '<br>')
52447
+ .replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g, '<br>\r\n')
52448
+ .replace(/\x20{2,}/gi, (substring) => {
52449
+ return `<span style="mso-spacerun: yes">${'&nbsp;'.repeat(substring.length - 1)} </span>`;
52450
+ })
52451
+ .replace(/\t/gi, '&#9;');
52452
+ rowValues.push(`<td>${parsedCellData}</td>`);
52453
+ });
52454
+ result.push('<tr>', ...rowValues, '</tr>');
52455
+ if (rowIndex === rowCells.length - 1) {
52456
+ result.push('</tbody>');
52457
+ }
52089
52458
  });
52090
- result.push('<tr>', ...rowValues, '</tr>');
52091
- if (rowIndex === rowCells.length - 1) {
52092
- result.push('</tbody>');
52093
- }
52094
- });
52095
- result.push('</table>');
52096
- return [META_HEAD, result.join('')].join('');
52097
- };
52098
- const dataHTML = setDataToHTML(data);
52099
- navigator.clipboard.write([
52100
- new ClipboardItem({
52101
- 'text/html': new Blob([dataHTML], { type: 'text/html' }),
52102
- 'text/plain': new Blob([data], { type: 'text/plain' })
52103
- })
52104
- ]);
52459
+ result.push('</table>');
52460
+ return [META_HEAD, result.join('')].join('');
52461
+ };
52462
+ const dataHTML = setDataToHTML(data);
52463
+ navigator.clipboard.write([
52464
+ new ClipboardItem({
52465
+ 'text/html': new Blob([dataHTML], { type: 'text/html' }),
52466
+ 'text/plain': new Blob([data], { type: 'text/plain' })
52467
+ })
52468
+ ]);
52469
+ }
52470
+ else {
52471
+ if (browser.IE) {
52472
+ window.clipboardData.setData('Text', data);
52473
+ }
52474
+ else {
52475
+ e.clipboardData.setData('text/plain', data);
52476
+ }
52477
+ }
52105
52478
  table.fireListeners(TABLE_EVENT_TYPE.COPY_DATA, {
52106
52479
  cellRange: table.stateManager.select.ranges,
52107
52480
  copyData: data
@@ -52115,17 +52488,40 @@
52115
52488
  return;
52116
52489
  }
52117
52490
  if (table.stateManager.select.ranges?.length > 0) {
52118
- navigator.clipboard.read().then(clipboardItems => {
52119
- for (const item of clipboardItems) {
52120
- if (item.types.includes('text/html')) {
52121
- pasteHtmlToTable(item);
52122
- }
52123
- else if (item.types.length === 1 && item.types[0] === 'text/plain') {
52124
- pasteTextToTable(item);
52491
+ if (navigator.clipboard?.read) {
52492
+ navigator.clipboard.read().then(clipboardItems => {
52493
+ for (const item of clipboardItems) {
52494
+ if (item.types.includes('text/html')) {
52495
+ pasteHtmlToTable(item);
52496
+ }
52497
+ else if (item.types.length === 1 && item.types[0] === 'text/plain') {
52498
+ pasteTextToTable(item);
52499
+ }
52500
+ else ;
52125
52501
  }
52126
- else ;
52127
- }
52128
- });
52502
+ });
52503
+ }
52504
+ else {
52505
+ const ranges = table.stateManager.select.ranges;
52506
+ const col = Math.min(ranges[0].start.col, ranges[0].end.col);
52507
+ const row = Math.min(ranges[0].start.row, ranges[0].end.row);
52508
+ const clipboardData = e.clipboardData || window.Clipboard;
52509
+ const pastedData = clipboardData.getData('text');
52510
+ const rows = pastedData.split('\n');
52511
+ const values = [];
52512
+ rows.forEach(function (rowCells, rowIndex) {
52513
+ const cells = rowCells.split('\t');
52514
+ const rowValues = [];
52515
+ values.push(rowValues);
52516
+ cells.forEach(function (cell, cellIndex) {
52517
+ if (cellIndex === cells.length - 1) {
52518
+ cell = cell.trim();
52519
+ }
52520
+ rowValues.push(cell);
52521
+ });
52522
+ });
52523
+ table.changeCellValues(col, row, values);
52524
+ }
52129
52525
  }
52130
52526
  }
52131
52527
  });
@@ -52134,12 +52530,14 @@
52134
52530
  e.preventDefault();
52135
52531
  }
52136
52532
  });
52137
- handler.on(table.getContainer(), 'resize', e => {
52138
- if (e.width === 0 && e.height === 0) {
52139
- return;
52140
- }
52141
- table.resize();
52142
- });
52533
+ if (!table.options.canvas) {
52534
+ handler.on(table.getContainer(), 'resize', e => {
52535
+ if (e.width === 0 && e.height === 0) {
52536
+ return;
52537
+ }
52538
+ table.resize();
52539
+ });
52540
+ }
52143
52541
  function pasteHtmlToTable(item) {
52144
52542
  const ranges = table.stateManager.select.ranges;
52145
52543
  const selectRangeLength = ranges.length;
@@ -52286,6 +52684,7 @@
52286
52684
  table.eventManager.LastBodyPointerXY = null;
52287
52685
  table.eventManager.isDown = false;
52288
52686
  table.eventManager.isDraging = false;
52687
+ table.eventManager.inertiaScroll.endInertia();
52289
52688
  };
52290
52689
  eventManager.globalEventListeners.push({
52291
52690
  name: 'pointerup',
@@ -52302,9 +52701,6 @@
52302
52701
  }
52303
52702
  }
52304
52703
  const { x, y } = table._getMouseAbstractPoint(e, false);
52305
- if (stateManager.interactionState === InteractionState.scrolling) {
52306
- return;
52307
- }
52308
52704
  if (stateManager.interactionState === InteractionState.grabing) {
52309
52705
  if (stateManager.isResizeCol()) {
52310
52706
  eventManager.dealColumnResize(x, y);
@@ -52316,6 +52712,95 @@
52316
52712
  }
52317
52713
  }
52318
52714
  }
52715
+ const isSelecting = table.stateManager.isSelecting();
52716
+ if (eventManager.isDraging && isSelecting) {
52717
+ const drawRange = table.getDrawRange();
52718
+ const topFrozenRowHeight = table.getFrozenRowsHeight();
52719
+ const bottomFrozenRowHeight = table.getBottomFrozenRowsHeight();
52720
+ const leftFrozenColsWidth = table.getFrozenColsWidth();
52721
+ const rightFrozenColsWidth = table.getRightFrozenColsWidth();
52722
+ const startCell = table.stateManager.select.ranges[table.stateManager.select.ranges.length - 1].start;
52723
+ const endCell = table.stateManager.select.ranges[table.stateManager.select.ranges.length - 1].end;
52724
+ const canScrollY = table.isFrozenRow(startCell.row) === false || table.isFrozenRow(endCell.row) === false;
52725
+ const canScrollX = table.isFrozenColumn(startCell.col) === false || table.isFrozenColumn(endCell.col) === false;
52726
+ if (((y > drawRange.bottom - bottomFrozenRowHeight || y < drawRange.top + topFrozenRowHeight) && canScrollY) ||
52727
+ ((x > drawRange.right - rightFrozenColsWidth || x < drawRange.left + leftFrozenColsWidth) && canScrollX)) {
52728
+ table.eventManager.scrollXSpeed = 0;
52729
+ table.eventManager.scrollYSpeed = 0;
52730
+ let bottom = false;
52731
+ let top = false;
52732
+ let right = false;
52733
+ let left = false;
52734
+ if (y > drawRange.bottom - bottomFrozenRowHeight &&
52735
+ canScrollY &&
52736
+ table.scrollTop + table.tableNoFrameWidth < table.getAllRowsHeight()) {
52737
+ bottom = true;
52738
+ table.eventManager.scrollYSpeed = -(y - drawRange.bottom + bottomFrozenRowHeight) / 50;
52739
+ }
52740
+ else if (y < drawRange.top + topFrozenRowHeight && canScrollY && table.scrollTop > 0) {
52741
+ top = true;
52742
+ table.eventManager.scrollYSpeed = -(y - drawRange.top - topFrozenRowHeight) / 50;
52743
+ }
52744
+ if (x > drawRange.right - rightFrozenColsWidth &&
52745
+ canScrollX &&
52746
+ table.scrollLeft + table.tableNoFrameWidth < table.getAllColsWidth()) {
52747
+ right = true;
52748
+ table.eventManager.scrollXSpeed = -(x - drawRange.right + rightFrozenColsWidth) / 50;
52749
+ }
52750
+ else if (x < drawRange.left + leftFrozenColsWidth && canScrollX && table.scrollLeft > 0) {
52751
+ left = true;
52752
+ table.eventManager.scrollXSpeed = -(x - drawRange.left - leftFrozenColsWidth) / 50;
52753
+ }
52754
+ table.eventManager.inertiaScroll.startInertia(table.eventManager.scrollXSpeed, table.eventManager.scrollYSpeed, 1);
52755
+ table.eventManager.inertiaScroll.setScrollHandle((dx, dy) => {
52756
+ handleWhell({ deltaX: -dx, deltaY: -dy }, table.stateManager, false);
52757
+ let selectX;
52758
+ let selectY;
52759
+ if (bottom) {
52760
+ selectY = table.scrollTop + drawRange.height - bottomFrozenRowHeight - 20;
52761
+ }
52762
+ else if (top) {
52763
+ selectY = table.scrollTop + topFrozenRowHeight + 20;
52764
+ }
52765
+ if (right) {
52766
+ selectX = table.scrollLeft + drawRange.width - rightFrozenColsWidth - 20;
52767
+ }
52768
+ else if (left) {
52769
+ selectX = table.scrollLeft + leftFrozenColsWidth + 20;
52770
+ }
52771
+ let considerFrozenY = false;
52772
+ let considerFrozenX = false;
52773
+ if (!right && !left) {
52774
+ if ((x > table.tableNoFrameWidth - table.getRightFrozenColsWidth() && x < table.tableNoFrameWidth) ||
52775
+ (x > 0 && x < table.getFrozenColsWidth())) {
52776
+ selectX = x;
52777
+ considerFrozenX = true;
52778
+ }
52779
+ else {
52780
+ selectX = table.scrollLeft + x;
52781
+ }
52782
+ }
52783
+ if (!bottom && !top) {
52784
+ if ((y > table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() && y < table.tableNoFrameHeight) ||
52785
+ (y > 0 && y < table.getFrozenRowsHeight())) {
52786
+ selectY = y;
52787
+ considerFrozenY = true;
52788
+ }
52789
+ else {
52790
+ selectY = table.scrollTop + y;
52791
+ }
52792
+ }
52793
+ table.stateManager.updateInteractionState(InteractionState.grabing);
52794
+ table.stateManager.updateSelectPos(table.getTargetColAtConsiderRightFrozen(selectX, considerFrozenX).col, table.getTargetRowAtConsiderBottomFrozen(selectY, considerFrozenY).row, false, false, false, true);
52795
+ });
52796
+ }
52797
+ else if (table.eventManager.inertiaScroll.isInertiaScrolling()) {
52798
+ table.eventManager.inertiaScroll.endInertia();
52799
+ }
52800
+ else {
52801
+ table.eventManager.scrollYSpeed = 0;
52802
+ }
52803
+ }
52319
52804
  };
52320
52805
  eventManager.globalEventListeners.push({
52321
52806
  name: 'pointermove',
@@ -52393,7 +52878,10 @@
52393
52878
  const lastPoint = eventManager.touchMovePoints[eventManager.touchMovePoints?.length - 1];
52394
52879
  const vX = (lastPoint.x - firstPoint.x) / (lastPoint.timestamp - firstPoint.timestamp);
52395
52880
  const vY = (lastPoint.y - firstPoint.y) / (lastPoint.timestamp - firstPoint.timestamp);
52396
- startInertia(vX, vY, stateManager);
52881
+ eventManager.inertiaScroll.startInertia(vX, vY, 0.95);
52882
+ table.eventManager.inertiaScroll.setScrollHandle((dx, dy) => {
52883
+ handleWhell({ deltaX: -dx, deltaY: -dy }, table.stateManager);
52884
+ });
52397
52885
  }
52398
52886
  eventManager.isTouchdown = false;
52399
52887
  eventManager.touchMovePoints = [];
@@ -52423,37 +52911,6 @@
52423
52911
  function isTouchEvent$1(e) {
52424
52912
  return !!e.changedTouches;
52425
52913
  }
52426
- function startInertia(vX, vY, stateManager) {
52427
- let time = Date.now();
52428
- const friction = 0.95;
52429
- const inertia = () => {
52430
- const now = Date.now();
52431
- const dffTime = now - time;
52432
- let stopped = true;
52433
- const f = Math.pow(friction, dffTime / 16);
52434
- const newVX = f * vX;
52435
- const newVY = f * vY;
52436
- let dx = 0;
52437
- let dy = 0;
52438
- if (Math.abs(newVX) > 0.05) {
52439
- stopped = false;
52440
- dx = ((vX + newVX) / 2) * dffTime;
52441
- }
52442
- if (Math.abs(newVY) > 0.05) {
52443
- stopped = false;
52444
- dy = ((vY + newVY) / 2) * dffTime;
52445
- }
52446
- handleWhell({ deltaX: -dx, deltaY: -dy }, stateManager);
52447
- if (stopped) {
52448
- return;
52449
- }
52450
- time = now;
52451
- vX = newVX;
52452
- vY = newVY;
52453
- requestAnimationFrame(inertia);
52454
- };
52455
- requestAnimationFrame(inertia);
52456
- }
52457
52914
 
52458
52915
  function bindAxisClickEvent(table) {
52459
52916
  if (!table.isPivotChart()) {
@@ -52593,10 +53050,14 @@
52593
53050
  LastBodyPointerXY;
52594
53051
  isDown = false;
52595
53052
  isDraging = false;
53053
+ scrollYSpeed;
53054
+ scrollXSpeed;
52596
53055
  globalEventListeners = [];
53056
+ inertiaScroll;
52597
53057
  constructor(table) {
52598
53058
  this.table = table;
52599
- if (Env.mode === 'node') {
53059
+ this.inertiaScroll = new InertiaScroll(table.stateManager);
53060
+ if (Env.mode === 'node' || table.options.disableInteraction) {
52600
53061
  return;
52601
53062
  }
52602
53063
  this.bindOuterEvent();
@@ -52745,7 +53206,7 @@
52745
53206
  this.table.stateManager.updateSelectPos(-1, -1);
52746
53207
  return false;
52747
53208
  }
52748
- this.table.stateManager.updateSelectPos(eventArgs.col, eventArgs.row, eventArgs.event.shiftKey, eventArgs.event.ctrlKey || eventArgs.event.metaKey);
53209
+ this.table.stateManager.updateSelectPos(eventArgs.col, eventArgs.row, eventArgs.event.shiftKey, eventArgs.event.ctrlKey || eventArgs.event.metaKey, false, isSelectMoving);
52749
53210
  return true;
52750
53211
  }
52751
53212
  return false;
@@ -52793,10 +53254,10 @@
52793
53254
  updateCol = eventArgs.col;
52794
53255
  }
52795
53256
  }
52796
- this.table.stateManager.updateSelectPos(isSelectMoving ? updateCol : currentRange.end.col, isSelectMoving ? updateRow : currentRange.end.row, true, eventArgs.event.ctrlKey || eventArgs.event.metaKey);
53257
+ this.table.stateManager.updateSelectPos(isSelectMoving ? updateCol : currentRange.end.col, isSelectMoving ? updateRow : currentRange.end.row, true, eventArgs.event.ctrlKey || eventArgs.event.metaKey, false, isSelectMoving);
52797
53258
  }
52798
53259
  else {
52799
- this.table.stateManager.updateSelectPos(eventArgs.col, eventArgs.row, eventArgs.event.shiftKey, eventArgs.event.ctrlKey || eventArgs.event.metaKey);
53260
+ this.table.stateManager.updateSelectPos(eventArgs.col, eventArgs.row, eventArgs.event.shiftKey, eventArgs.event.ctrlKey || eventArgs.event.metaKey, false, isSelectMoving);
52800
53261
  }
52801
53262
  return true;
52802
53263
  }
@@ -55063,6 +55524,7 @@
55063
55524
  }
55064
55525
 
55065
55526
  class FocusInput extends EventTarget {
55527
+ _container;
55066
55528
  _table;
55067
55529
  _input;
55068
55530
  constructor(table, parentElement) {
@@ -55082,6 +55544,7 @@
55082
55544
  input.dataset.vtable = 'vtable';
55083
55545
  input.readOnly = true;
55084
55546
  parentElement.appendChild(div);
55547
+ this._container = div;
55085
55548
  }
55086
55549
  focus() {
55087
55550
  this._input.focus({ preventScroll: true });
@@ -55101,6 +55564,7 @@
55101
55564
  return this._input;
55102
55565
  }
55103
55566
  release() {
55567
+ this._container.parentElement?.removeChild(this._container);
55104
55568
  }
55105
55569
  }
55106
55570
 
@@ -55234,7 +55698,8 @@
55234
55698
  height: this.table.tableNoFrameHeight
55235
55699
  });
55236
55700
  const legend = new DiscreteLegend(merge({}, attrs, {
55237
- defaultSelected: this.selectedData
55701
+ defaultSelected: this.selectedData,
55702
+ disableTriggerEvent: this.table.options.disableInteraction
55238
55703
  }));
55239
55704
  legend.name = 'legend';
55240
55705
  this.legendComponent = legend;
@@ -56133,7 +56598,7 @@
56133
56598
  return TABLE_EVENT_TYPE;
56134
56599
  }
56135
56600
  options;
56136
- version = "0.23.1-alpha.1";
56601
+ version = "0.23.1-alpha.2";
56137
56602
  pagination;
56138
56603
  id = `VTable${Date.now()}`;
56139
56604
  headerStyleCache;
@@ -56146,13 +56611,12 @@
56146
56611
  columnWidthComputeMode;
56147
56612
  constructor(container, options = {}) {
56148
56613
  super();
56149
- if (!container && options.mode !== 'node') {
56614
+ if (!container && options.mode !== 'node' && !options.canvas) {
56150
56615
  throw new Error("vtable's container is undefined");
56151
56616
  }
56152
56617
  const { frozenColCount = 0, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth, widthMode = 'standard', heightMode = 'standard', autoFillWidth = false, autoFillHeight = false, keyboardOptions, eventOptions, rowSeriesNumber, columnResizeMode, dragHeaderMode, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, customRender, pixelRatio = defaultPixelRatio, renderChartAsync, renderChartAsyncBatchCount, mode, modeParams, canvasWidth, canvasHeight, overscrollBehavior, limitMinWidth } = options;
56153
56618
  this.container = container;
56154
56619
  this.options = options;
56155
- this.options.container = container;
56156
56620
  this._widthMode = widthMode;
56157
56621
  this._heightMode = heightMode;
56158
56622
  this._autoFillWidth = autoFillWidth;
@@ -56183,7 +56647,14 @@
56183
56647
  if (typeof allowFrozenColCount === 'number' && allowFrozenColCount <= 0) {
56184
56648
  this.showFrozenIcon = false;
56185
56649
  }
56186
- if (Env.mode !== 'node') {
56650
+ if (this.options.canvas) {
56651
+ internalProps.element = this.options.canvas.parentElement;
56652
+ internalProps.element.style.position = 'relative';
56653
+ internalProps.focusControl = new FocusInput(this, internalProps.element);
56654
+ internalProps.canvas = this.options.canvas;
56655
+ internalProps.context = internalProps.canvas.getContext('2d');
56656
+ }
56657
+ else if (Env.mode !== 'node') {
56187
56658
  internalProps.element = createRootElement(this.padding);
56188
56659
  internalProps.focusControl = new FocusInput(this, internalProps.element);
56189
56660
  internalProps.canvas = document.createElement('canvas');
@@ -56524,7 +56995,21 @@
56524
56995
  const { padding } = this;
56525
56996
  let widthP = 0;
56526
56997
  let heightP = 0;
56527
- if (Env.mode === 'browser') {
56998
+ this.tableX = 0;
56999
+ this.tableY = 0;
57000
+ if (this.options.canvas && this.options.viewBox) {
57001
+ widthP = this.options.viewBox.x2 - this.options.viewBox.x1;
57002
+ heightP = this.options.viewBox.y2 - this.options.viewBox.y1;
57003
+ if (this?.scenegraph?.stage) {
57004
+ if (this.options.viewBox) {
57005
+ this.scenegraph.stage.setViewBox(this.options.viewBox, false);
57006
+ }
57007
+ else {
57008
+ this.scenegraph.stage.resize(widthP, heightP);
57009
+ }
57010
+ }
57011
+ }
57012
+ else if (Env.mode === 'browser') {
56528
57013
  const element = this.getElement();
56529
57014
  const width1 = element.parentElement?.offsetWidth ?? 1 - 1;
56530
57015
  const height1 = element.parentElement?.offsetHeight ?? 1 - 1;
@@ -56570,6 +57055,22 @@
56570
57055
  }
56571
57056
  }
56572
57057
  }
57058
+ updateViewBox(newViewBox) {
57059
+ const oldWidth = this.options?.viewBox.x2 ?? 0 - this.options?.viewBox.x1 ?? 0;
57060
+ const oldHeight = this.options?.viewBox.y2 ?? 0 - this.options?.viewBox.y1 ?? 0;
57061
+ const newWidth = newViewBox.x2 - newViewBox.x1;
57062
+ const newHeight = newViewBox.y2 - newViewBox.y1;
57063
+ this.options.viewBox = newViewBox;
57064
+ if (oldWidth !== newWidth || oldHeight !== newHeight) {
57065
+ this.resize();
57066
+ }
57067
+ else {
57068
+ this.scenegraph.stage.setViewBox(this.options.viewBox, true);
57069
+ }
57070
+ }
57071
+ setViewBoxTransform(a, b, c, d, e, f) {
57072
+ this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
57073
+ }
56573
57074
  get rowHierarchyType() {
56574
57075
  return 'grid';
56575
57076
  }
@@ -56948,8 +57449,8 @@
56948
57449
  return this.getCellsRectWidth(cellRange.start.col, cellRange.start.row, cellRange.end.col, cellRange.end.row);
56949
57450
  }
56950
57451
  isFrozenCell(col, row) {
56951
- const isFrozenRow = this.isFrozenRow(row) || this.isBottomFrozenRow(row);
56952
- const isFrozenCol = this.isFrozenColumn(col) || this.isRightFrozenColumn(col);
57452
+ const isFrozenRow = this.isFrozenRow(row);
57453
+ const isFrozenCol = this.isFrozenColumn(col);
56953
57454
  if (isFrozenRow || isFrozenCol) {
56954
57455
  return {
56955
57456
  row: isFrozenRow,
@@ -57062,6 +57563,8 @@
57062
57563
  const visibleRect = this.getVisibleRect();
57063
57564
  rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0));
57064
57565
  rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0));
57566
+ rect.offsetLeft(this.options.viewBox?.x1 ?? 0);
57567
+ rect.offsetTop(this.options.viewBox?.y1 ?? 0);
57065
57568
  return rect;
57066
57569
  }
57067
57570
  getVisibleRect() {
@@ -57215,8 +57718,9 @@
57215
57718
  }
57216
57719
  this.scenegraph.stage.release();
57217
57720
  this.scenegraph.proxy.release();
57721
+ internalProps.focusControl.release();
57218
57722
  const { parentElement } = internalProps.element;
57219
- if (parentElement) {
57723
+ if (parentElement && !this.options.canvas) {
57220
57724
  parentElement.removeChild(internalProps.element);
57221
57725
  }
57222
57726
  this.isReleased = true;
@@ -57397,8 +57901,8 @@
57397
57901
  const currentHeight = rect.height;
57398
57902
  const originHeight = this.canvas.offsetHeight || currentHeight;
57399
57903
  const heightRatio = currentHeight / originHeight;
57400
- const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0);
57401
- const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0);
57904
+ const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0) - (this.options.viewBox?.x1 ?? 0);
57905
+ const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0) - (this.options.viewBox?.y1 ?? 0);
57402
57906
  return { x, y, inTable };
57403
57907
  }
57404
57908
  getTheme() {
@@ -57496,6 +58000,46 @@
57496
58000
  }
57497
58001
  return findBefore(candRow, bottom);
57498
58002
  }
58003
+ getTargetColAtConsiderRightFrozen(absoluteX, isConsider) {
58004
+ if (absoluteX === 0) {
58005
+ return { left: 0, col: 0, right: 0, width: 0 };
58006
+ }
58007
+ if (isConsider &&
58008
+ absoluteX > this.tableNoFrameWidth - this.getRightFrozenColsWidth() &&
58009
+ absoluteX < this.tableNoFrameWidth) {
58010
+ for (let i = 0; i < this.rightFrozenColCount; i++) {
58011
+ if (absoluteX > this.tableNoFrameWidth - this.getColsWidth(this.colCount - i - 1, this.colCount - 1)) {
58012
+ return {
58013
+ col: this.colCount - i - 1,
58014
+ left: undefined,
58015
+ right: undefined,
58016
+ width: undefined
58017
+ };
58018
+ }
58019
+ }
58020
+ }
58021
+ return this.getTargetColAt(absoluteX);
58022
+ }
58023
+ getTargetRowAtConsiderBottomFrozen(absoluteY, isConsider) {
58024
+ if (absoluteY === 0) {
58025
+ return { top: 0, row: 0, bottom: 0, height: 0 };
58026
+ }
58027
+ if (isConsider &&
58028
+ absoluteY > this.tableNoFrameHeight - this.getBottomFrozenRowsHeight() &&
58029
+ absoluteY < this.tableNoFrameHeight) {
58030
+ for (let i = 0; i < this.rightFrozenColCount; i++) {
58031
+ if (absoluteY > this.tableNoFrameHeight - this.getRowsHeight(this.rowCount - i - 1, this.rowCount - 1)) {
58032
+ return {
58033
+ row: this.rowCount - i - 1,
58034
+ top: undefined,
58035
+ bottom: undefined,
58036
+ height: undefined
58037
+ };
58038
+ }
58039
+ }
58040
+ }
58041
+ return this.getTargetRowAt(absoluteY);
58042
+ }
57499
58043
  computeTargetRowByY(absoluteY) {
57500
58044
  let defaultRowHeight = this.internalProps.defaultRowHeight;
57501
58045
  if (this._rowRangeHeightsMap.get(`$0$${this.rowCount - 1}`)) {
@@ -57776,7 +58320,7 @@
57776
58320
  return this.internalProps.layoutMap?.isCornerHeader(col, row);
57777
58321
  }
57778
58322
  isFrozenColumn(col, row) {
57779
- return this.internalProps.layoutMap?.isFrozenColumn(col, row);
58323
+ return this.isLeftFrozenColumn(col, row) || this.isRightFrozenColumn(col, row);
57780
58324
  }
57781
58325
  isLeftFrozenColumn(col, row) {
57782
58326
  return this.internalProps.layoutMap?.isFrozenColumn(col, row);
@@ -57785,7 +58329,7 @@
57785
58329
  return this.internalProps.layoutMap?.isRightFrozenColumn(col, row);
57786
58330
  }
57787
58331
  isFrozenRow(col, row) {
57788
- return this.internalProps.layoutMap?.isFrozenRow(col, row);
58332
+ return this.isTopFrozenRow(col, row) || this.isBottomFrozenRow(col, row);
57789
58333
  }
57790
58334
  isTopFrozenRow(col, row) {
57791
58335
  return this.internalProps.layoutMap?.isFrozenRow(col, row);
@@ -58023,8 +58567,7 @@
58023
58567
  }
58024
58568
  _canDragHeaderPosition(col, row) {
58025
58569
  if (this.isHeader(col, row) && this.stateManager.isSelected(col, row)) {
58026
- if (this.internalProps.frozenColDragHeaderMode === 'disabled' &&
58027
- (this.isFrozenColumn(col) || this.isRightFrozenColumn(col))) {
58570
+ if (this.internalProps.frozenColDragHeaderMode === 'disabled' && this.isFrozenColumn(col)) {
58028
58571
  return false;
58029
58572
  }
58030
58573
  const selectRange = this.stateManager.select.ranges[0];
@@ -60584,7 +61127,7 @@
60584
61127
  return false;
60585
61128
  }
60586
61129
  if (this._table.internalProps.frozenColDragHeaderMode === 'disabled') {
60587
- if (this._table.isFrozenColumn(target.col) || this._table.isRightFrozenColumn(target.col)) {
61130
+ if (this._table.isFrozenColumn(target.col)) {
60588
61131
  return false;
60589
61132
  }
60590
61133
  }
@@ -60805,7 +61348,7 @@
60805
61348
  }
60806
61349
  _createOrUpdateTitleComponent(attrs) {
60807
61350
  if (this._titleComponent) {
60808
- if (!isEqual$1(attrs, this._cacheAttrs)) {
61351
+ if (!isEqual(attrs, this._cacheAttrs)) {
60809
61352
  this._titleComponent.setAttributes(attrs);
60810
61353
  }
60811
61354
  }
@@ -61583,7 +62126,7 @@
61583
62126
  }
61584
62127
  }
61585
62128
  const index = this.getRecordShowIndexByCell(col, row);
61586
- const diffDataIndices = this.dataSource.toggleHierarchyState(index);
62129
+ const diffDataIndices = this.dataSource.toggleHierarchyState(index, this.scenegraph.proxy.rowStart - this.columnHeaderLevelCount, Math.max(this.scenegraph.proxy.rowEnd - this.columnHeaderLevelCount, this.scenegraph.proxy.rowStart - this.columnHeaderLevelCount + this.scenegraph.proxy.rowLimit - 1));
61587
62130
  const diffPositions = this.internalProps.layoutMap.toggleHierarchyState(diffDataIndices);
61588
62131
  this.refreshRowColCount();
61589
62132
  this.clearCellStyleCache();
@@ -62325,6 +62868,39 @@
62325
62868
  }
62326
62869
  }
62327
62870
 
62871
+ function diffCellAddress(col, row, oldCellIds, newCellIds, oldRowHeaderCellPositons, layout) {
62872
+ const columnHeaderStart = layout.columnHeaderLevelCount;
62873
+ const addCellPositions = [];
62874
+ const removeCellPositions = [];
62875
+ for (let i = 0; i < oldCellIds.length; i++) {
62876
+ if (!newCellIds.includes(oldCellIds[i])) {
62877
+ removeCellPositions.push(oldRowHeaderCellPositons[i]);
62878
+ }
62879
+ }
62880
+ for (let i = 0; i < newCellIds.length; i++) {
62881
+ if (!oldCellIds.includes(newCellIds[i])) {
62882
+ const newCellAddr = { col, row: columnHeaderStart + i };
62883
+ addCellPositions.push(newCellAddr);
62884
+ }
62885
+ }
62886
+ let parentId = layout.getParentCellId(col, row);
62887
+ let parentCellAddress = layout.getRowHeaderCellAddressByCellId(parentId);
62888
+ const updateCellPositions = [];
62889
+ parentCellAddress && updateCellPositions.push(parentCellAddress);
62890
+ while (parentId) {
62891
+ parentId = layout.getParentCellId(parentCellAddress.col, parentCellAddress.row);
62892
+ if (parentId) {
62893
+ parentCellAddress = layout.getRowHeaderCellAddressByCellId(parentId);
62894
+ updateCellPositions.push(parentCellAddress);
62895
+ }
62896
+ }
62897
+ return {
62898
+ addCellPositions,
62899
+ removeCellPositions,
62900
+ updateCellPositions
62901
+ };
62902
+ }
62903
+
62328
62904
  const defaultDimension = { startInTotal: 0, level: 0 };
62329
62905
  class PivotHeaderLayoutMap {
62330
62906
  sharedVar;
@@ -67602,6 +68178,14 @@
67602
68178
  updateChartData(this.scenegraph);
67603
68179
  this.render();
67604
68180
  }
68181
+ clearChartCacheImage(col, row) {
68182
+ if (isNumber$4(col) && isNumber$4(row)) {
68183
+ clearCellChartCacheImage(col, row, this.scenegraph);
68184
+ }
68185
+ else {
68186
+ clearChartCacheImage(this.scenegraph);
68187
+ }
68188
+ }
67605
68189
  getLegendSelected() {
67606
68190
  return this.internalProps.legends.legendComponent._getSelectedLegends().map((d) => d.label);
67607
68191
  }
@@ -68300,7 +68884,7 @@
68300
68884
  }
68301
68885
 
68302
68886
  registerForVrender();
68303
- const version = "0.23.1-alpha.1";
68887
+ const version = "0.23.1-alpha.2";
68304
68888
  function getIcons() {
68305
68889
  return get$2();
68306
68890
  }