@visactor/vtable 1.0.0 → 1.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/cjs/PivotChart.d.ts +1 -0
  2. package/cjs/PivotChart.js +4 -0
  3. package/cjs/PivotChart.js.map +1 -1
  4. package/cjs/components/axis/axis.js +3 -2
  5. package/cjs/components/axis/axis.js.map +1 -1
  6. package/cjs/components/legend/discrete-legend/discrete-legend.js +2 -1
  7. package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  8. package/cjs/core/BaseTable.d.ts +3 -0
  9. package/cjs/core/BaseTable.js +38 -21
  10. package/cjs/core/BaseTable.js.map +1 -1
  11. package/cjs/core/FouseInput.d.ts +1 -0
  12. package/cjs/core/FouseInput.js +5 -2
  13. package/cjs/core/FouseInput.js.map +1 -1
  14. package/cjs/event/event.js +2 -1
  15. package/cjs/event/event.js.map +1 -1
  16. package/cjs/event/listener/container-dom.js +1 -1
  17. package/cjs/event/listener/container-dom.js.map +1 -1
  18. package/cjs/event/util.js +2 -2
  19. package/cjs/event/util.js.map +1 -1
  20. package/cjs/index.d.ts +1 -1
  21. package/cjs/index.js +2 -2
  22. package/cjs/index.js.map +1 -1
  23. package/cjs/scenegraph/animation/appear.d.ts +2 -0
  24. package/cjs/scenegraph/animation/appear.js +26 -0
  25. package/cjs/scenegraph/animation/appear.js.map +1 -0
  26. package/cjs/scenegraph/debug-tool/debug-tool.js +4 -1
  27. package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
  28. package/cjs/scenegraph/graphic/chart.d.ts +1 -0
  29. package/cjs/scenegraph/graphic/chart.js +34 -20
  30. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  31. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
  32. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  33. package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  34. package/cjs/scenegraph/graphic/contributions/chart-render.js +40 -24
  35. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  36. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  37. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  38. package/cjs/scenegraph/refresh-node/update-chart.d.ts +1 -0
  39. package/cjs/scenegraph/refresh-node/update-chart.js +9 -2
  40. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  41. package/cjs/scenegraph/scenegraph.js +14 -7
  42. package/cjs/scenegraph/scenegraph.js.map +1 -1
  43. package/cjs/ts-types/animation/appear.d.ts +6 -0
  44. package/cjs/ts-types/animation/appear.js +6 -0
  45. package/cjs/ts-types/animation/appear.js.map +1 -0
  46. package/cjs/ts-types/base-table.d.ts +14 -1
  47. package/cjs/ts-types/base-table.js.map +1 -1
  48. package/cjs/vrender.js.map +1 -1
  49. package/dist/vtable.js +925 -450
  50. package/dist/vtable.min.js +2 -2
  51. package/es/PivotChart.d.ts +1 -0
  52. package/es/PivotChart.js +5 -2
  53. package/es/PivotChart.js.map +1 -1
  54. package/es/components/axis/axis.js +3 -1
  55. package/es/components/axis/axis.js.map +1 -1
  56. package/es/components/legend/discrete-legend/discrete-legend.js +2 -1
  57. package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -1
  58. package/es/core/BaseTable.d.ts +3 -0
  59. package/es/core/BaseTable.js +37 -20
  60. package/es/core/BaseTable.js.map +1 -1
  61. package/es/core/FouseInput.d.ts +1 -0
  62. package/es/core/FouseInput.js +5 -2
  63. package/es/core/FouseInput.js.map +1 -1
  64. package/es/event/event.js +2 -1
  65. package/es/event/event.js.map +1 -1
  66. package/es/event/listener/container-dom.js +1 -1
  67. package/es/event/listener/container-dom.js.map +1 -1
  68. package/es/event/util.js +2 -2
  69. package/es/event/util.js.map +1 -1
  70. package/es/index.d.ts +1 -1
  71. package/es/index.js +1 -1
  72. package/es/index.js.map +1 -1
  73. package/es/scenegraph/animation/appear.d.ts +2 -0
  74. package/es/scenegraph/animation/appear.js +20 -0
  75. package/es/scenegraph/animation/appear.js.map +1 -0
  76. package/es/scenegraph/debug-tool/debug-tool.js +4 -1
  77. package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
  78. package/es/scenegraph/graphic/chart.d.ts +1 -0
  79. package/es/scenegraph/graphic/chart.js +33 -21
  80. package/es/scenegraph/graphic/chart.js.map +1 -1
  81. package/es/scenegraph/graphic/contributions/chart-render-helper.js +20 -8
  82. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  83. package/es/scenegraph/graphic/contributions/chart-render.d.ts +2 -1
  84. package/es/scenegraph/graphic/contributions/chart-render.js +41 -25
  85. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  86. package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  87. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  88. package/es/scenegraph/refresh-node/update-chart.d.ts +1 -0
  89. package/es/scenegraph/refresh-node/update-chart.js +6 -0
  90. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  91. package/es/scenegraph/scenegraph.js +15 -7
  92. package/es/scenegraph/scenegraph.js.map +1 -1
  93. package/es/ts-types/animation/appear.d.ts +6 -0
  94. package/es/ts-types/animation/appear.js +2 -0
  95. package/es/ts-types/animation/appear.js.map +1 -0
  96. package/es/ts-types/base-table.d.ts +14 -1
  97. package/es/ts-types/base-table.js.map +1 -1
  98. package/es/vrender.js.map +1 -1
  99. package/package.json +8 -8
package/dist/vtable.js CHANGED
@@ -936,6 +936,9 @@
936
936
  createDom(params) {
937
937
  return this._env || this.setEnv("browser"), this.envContribution.createDom(params);
938
938
  }
939
+ updateDom(dom, params) {
940
+ return this._env || this.setEnv("browser"), this.envContribution.updateDom(dom, params);
941
+ }
939
942
  getElementTop(dom) {
940
943
  let baseWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
941
944
  return this._env || this.setEnv("browser"), this.envContribution.getElementTop(dom, baseWindow);
@@ -1571,6 +1574,89 @@
1571
1574
  return Number(a);
1572
1575
  }
1573
1576
 
1577
+ const hasConsole = "undefined" != typeof console;
1578
+ function log(method, level, input) {
1579
+ const args = [level].concat([].slice.call(input));
1580
+ hasConsole && console[method].apply(console, args);
1581
+ }
1582
+ var LoggerLevel;
1583
+ !function (LoggerLevel) {
1584
+ LoggerLevel[LoggerLevel.None = 0] = "None", LoggerLevel[LoggerLevel.Error = 1] = "Error", LoggerLevel[LoggerLevel.Warn = 2] = "Warn", LoggerLevel[LoggerLevel.Info = 3] = "Info", LoggerLevel[LoggerLevel.Debug = 4] = "Debug";
1585
+ }(LoggerLevel || (LoggerLevel = {}));
1586
+ class Logger {
1587
+ static getInstance(level, method) {
1588
+ return Logger._instance && isNumber$4(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
1589
+ }
1590
+ static setInstance(logger) {
1591
+ return Logger._instance = logger;
1592
+ }
1593
+ static setInstanceLevel(level) {
1594
+ Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
1595
+ }
1596
+ static clearInstance() {
1597
+ Logger._instance = null;
1598
+ }
1599
+ constructor() {
1600
+ let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
1601
+ let method = arguments.length > 1 ? arguments[1] : undefined;
1602
+ this._onErrorHandler = [], this._level = level, this._method = method;
1603
+ }
1604
+ addErrorHandler(handler) {
1605
+ this._onErrorHandler.find(h => h === handler) || this._onErrorHandler.push(handler);
1606
+ }
1607
+ removeErrorHandler(handler) {
1608
+ const index = this._onErrorHandler.findIndex(h => h === handler);
1609
+ index < 0 || this._onErrorHandler.splice(index, 1);
1610
+ }
1611
+ callErrorHandler() {
1612
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1613
+ args[_key] = arguments[_key];
1614
+ }
1615
+ this._onErrorHandler.forEach(h => h(...args));
1616
+ }
1617
+ canLogInfo() {
1618
+ return this._level >= LoggerLevel.Info;
1619
+ }
1620
+ canLogDebug() {
1621
+ return this._level >= LoggerLevel.Debug;
1622
+ }
1623
+ canLogError() {
1624
+ return this._level >= LoggerLevel.Error;
1625
+ }
1626
+ canLogWarn() {
1627
+ return this._level >= LoggerLevel.Warn;
1628
+ }
1629
+ level(levelValue) {
1630
+ return arguments.length ? (this._level = +levelValue, this) : this._level;
1631
+ }
1632
+ error() {
1633
+ var _a;
1634
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1635
+ args[_key2] = arguments[_key2];
1636
+ }
1637
+ return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
1638
+ }
1639
+ warn() {
1640
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1641
+ args[_key3] = arguments[_key3];
1642
+ }
1643
+ return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
1644
+ }
1645
+ info() {
1646
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1647
+ args[_key4] = arguments[_key4];
1648
+ }
1649
+ return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
1650
+ }
1651
+ debug() {
1652
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1653
+ args[_key5] = arguments[_key5];
1654
+ }
1655
+ return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
1656
+ }
1657
+ }
1658
+ Logger._instance = null;
1659
+
1574
1660
  function bisect$1(a, x) {
1575
1661
  let lo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1576
1662
  let hi = arguments.length > 3 ? arguments[3] : undefined;
@@ -2638,9 +2724,6 @@
2638
2724
  y: (x - origin.x) * Math.sin(deg) + (origin.y - y) * Math.cos(deg) + origin.y
2639
2725
  };
2640
2726
  }
2641
- function toDeg(angle) {
2642
- return angle / 180 * Math.PI;
2643
- }
2644
2727
  function getCenterPoint(box) {
2645
2728
  return {
2646
2729
  x: (box.x1 + box.x2) / 2,
@@ -2648,7 +2731,7 @@
2648
2731
  };
2649
2732
  }
2650
2733
  function toRect(box, isDeg) {
2651
- const deg = isDeg ? box.angle : toDeg(box.angle),
2734
+ const deg = isDeg ? box.angle : degreeToRadian(box.angle),
2652
2735
  cp = getCenterPoint(box);
2653
2736
  return [rotate$1({
2654
2737
  x: box.x1,
@@ -2683,10 +2766,10 @@
2683
2766
  BC = vector(rect1[1], rect1[2]),
2684
2767
  A1B1 = vector(rect2[0], rect2[1]),
2685
2768
  B1C1 = vector(rect2[1], rect2[2]),
2686
- deg11 = isDeg ? box1.angle : toDeg(box1.angle);
2687
- let deg12 = isDeg ? box1.angle + halfPi$1 : toDeg(90 - box1.angle);
2688
- const deg21 = isDeg ? box2.angle : toDeg(box2.angle);
2689
- let deg22 = isDeg ? box2.angle + halfPi$1 : toDeg(90 - box2.angle);
2769
+ deg11 = isDeg ? box1.angle : degreeToRadian(box1.angle);
2770
+ let deg12 = isDeg ? box1.angle + halfPi$1 : degreeToRadian(90 - box1.angle);
2771
+ const deg21 = isDeg ? box2.angle : degreeToRadian(box2.angle);
2772
+ let deg22 = isDeg ? box2.angle + halfPi$1 : degreeToRadian(90 - box2.angle);
2690
2773
  deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
2691
2774
  const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
2692
2775
  const checkAxis = [Math.cos(deg), Math.sin(deg)];
@@ -2918,88 +3001,53 @@
2918
3001
  }
2919
3002
  TextMeasure.ALPHABET_CHAR_SET = "abcdefghijklmnopqrstuvwxyz", TextMeasure.NUMBERS_CHAR_SET = "0123456789", TextMeasure.FULL_SIZE_CHAR = "字";
2920
3003
 
2921
- const hasConsole = "undefined" != typeof console;
2922
- function log(method, level, input) {
2923
- const args = [level].concat([].slice.call(input));
2924
- hasConsole && console[method].apply(console, args);
2925
- }
2926
- var LoggerLevel;
2927
- !function (LoggerLevel) {
2928
- LoggerLevel[LoggerLevel.None = 0] = "None", LoggerLevel[LoggerLevel.Error = 1] = "Error", LoggerLevel[LoggerLevel.Warn = 2] = "Warn", LoggerLevel[LoggerLevel.Info = 3] = "Info", LoggerLevel[LoggerLevel.Debug = 4] = "Debug";
2929
- }(LoggerLevel || (LoggerLevel = {}));
2930
- class Logger {
2931
- static getInstance(level, method) {
2932
- return Logger._instance && isNumber$4(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
2933
- }
2934
- static setInstance(logger) {
2935
- return Logger._instance = logger;
2936
- }
2937
- static setInstanceLevel(level) {
2938
- Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
2939
- }
2940
- static clearInstance() {
2941
- Logger._instance = null;
2942
- }
2943
- constructor() {
2944
- let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
2945
- let method = arguments.length > 1 ? arguments[1] : undefined;
2946
- this._onErrorHandler = [], this._level = level, this._method = method;
2947
- }
2948
- addErrorHandler(handler) {
2949
- this._onErrorHandler.find(h => h === handler) || this._onErrorHandler.push(handler);
2950
- }
2951
- removeErrorHandler(handler) {
2952
- const index = this._onErrorHandler.findIndex(h => h === handler);
2953
- index < 0 || this._onErrorHandler.splice(index, 1);
2954
- }
2955
- callErrorHandler() {
2956
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2957
- args[_key] = arguments[_key];
2958
- }
2959
- this._onErrorHandler.forEach(h => h(...args));
2960
- }
2961
- canLogInfo() {
2962
- return this._level >= LoggerLevel.Info;
2963
- }
2964
- canLogDebug() {
2965
- return this._level >= LoggerLevel.Debug;
2966
- }
2967
- canLogError() {
2968
- return this._level >= LoggerLevel.Error;
2969
- }
2970
- canLogWarn() {
2971
- return this._level >= LoggerLevel.Warn;
2972
- }
2973
- level(levelValue) {
2974
- return arguments.length ? (this._level = +levelValue, this) : this._level;
2975
- }
2976
- error() {
2977
- var _a;
2978
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2979
- args[_key2] = arguments[_key2];
2980
- }
2981
- return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
2982
- }
2983
- warn() {
2984
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
2985
- args[_key3] = arguments[_key3];
2986
- }
2987
- return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
2988
- }
2989
- info() {
2990
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
2991
- args[_key4] = arguments[_key4];
2992
- }
2993
- return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
2994
- }
2995
- debug() {
2996
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
2997
- args[_key5] = arguments[_key5];
2998
- }
2999
- return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
3004
+ const calculateAnchorOfBounds = (bounds, anchorType) => {
3005
+ const {
3006
+ x1: x1,
3007
+ x2: x2,
3008
+ y1: y1,
3009
+ y2: y2
3010
+ } = bounds,
3011
+ rectWidth = Math.abs(x2 - x1),
3012
+ rectHeight = Math.abs(y2 - y1);
3013
+ let anchorX = (x1 + x2) / 2,
3014
+ anchorY = (y1 + y2) / 2,
3015
+ sx = 0,
3016
+ sy = 0;
3017
+ switch (anchorType) {
3018
+ case "top":
3019
+ case "inside-top":
3020
+ sy = -.5;
3021
+ break;
3022
+ case "bottom":
3023
+ case "inside-bottom":
3024
+ sy = .5;
3025
+ break;
3026
+ case "left":
3027
+ case "inside-left":
3028
+ sx = -.5;
3029
+ break;
3030
+ case "right":
3031
+ case "inside-right":
3032
+ sx = .5;
3033
+ break;
3034
+ case "top-right":
3035
+ sx = .5, sy = -.5;
3036
+ break;
3037
+ case "top-left":
3038
+ sx = -.5, sy = -.5;
3039
+ break;
3040
+ case "bottom-right":
3041
+ sx = .5, sy = .5;
3042
+ break;
3043
+ case "bottom-left":
3044
+ sx = -.5, sy = .5;
3000
3045
  }
3001
- }
3002
- Logger._instance = null;
3046
+ return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
3047
+ x: anchorX,
3048
+ y: anchorY
3049
+ };
3050
+ };
3003
3051
 
3004
3052
  function normalizePadding(padding) {
3005
3053
  if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
@@ -3031,6 +3079,22 @@
3031
3079
  return [0, 0, 0, 0];
3032
3080
  }
3033
3081
 
3082
+ const styleStringToObject = function () {
3083
+ let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
3084
+ const res = {};
3085
+ return styleStr.split(";").forEach(item => {
3086
+ if (item) {
3087
+ const arr = item.split(":");
3088
+ if (2 === arr.length) {
3089
+ const key = arr[0].trim(),
3090
+ value = arr[1].trim();
3091
+ key && value && (res[key] = value);
3092
+ }
3093
+ }
3094
+ }), res;
3095
+ };
3096
+ const lowerCamelCaseToMiddle = str => str.replace(/([A-Z])/g, "-$1").toLowerCase();
3097
+
3034
3098
  const circleThreshold = tau - 1e-8;
3035
3099
  class BoundsContext {
3036
3100
  constructor(bounds) {
@@ -4156,6 +4220,8 @@
4156
4220
  pickStrokeBuffer: 0
4157
4221
  };
4158
4222
  const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
4223
+ forceBoundsWidth: void 0,
4224
+ forceBoundsHeight: void 0,
4159
4225
  opacity: 1,
4160
4226
  background: null,
4161
4227
  backgroundOpacity: 1,
@@ -4182,6 +4248,7 @@
4182
4248
  };
4183
4249
  const DefaultAttribute = Object.assign(Object.assign(Object.assign({
4184
4250
  strokeSeg: null,
4251
+ renderable: !0,
4185
4252
  pickable: !0,
4186
4253
  childrenPickable: !0,
4187
4254
  fillPickable: !0,
@@ -4237,7 +4304,8 @@
4237
4304
  flexWrap: "wrap",
4238
4305
  justifyContent: "flex-start",
4239
4306
  alignItems: "flex-start",
4240
- alignContent: "flex-start"
4307
+ alignContent: "flex-start",
4308
+ baseOpacity: 1
4241
4309
  });
4242
4310
  const DefaultGlyphAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4243
4311
  path: "",
@@ -4273,7 +4341,7 @@
4273
4341
  strokeBoundsBuffer: 0,
4274
4342
  cornerRadius: 0
4275
4343
  });
4276
- const DefaultRect3dAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4344
+ Object.assign(Object.assign({}, DefaultAttribute), {
4277
4345
  width: 0,
4278
4346
  height: 0,
4279
4347
  x1: 0,
@@ -4300,6 +4368,7 @@
4300
4368
  textBaseline: "top",
4301
4369
  layoutDirection: "horizontal",
4302
4370
  textConfig: [],
4371
+ disableAutoWrapLine: !1,
4303
4372
  maxHeight: void 0,
4304
4373
  maxWidth: void 0,
4305
4374
  singleLine: !1
@@ -4374,7 +4443,11 @@
4374
4443
  function applyFillStyle(ctx, character) {
4375
4444
  const fillStyle = character && character.fill || defaultFormatting.fill;
4376
4445
  if (!fillStyle) return void (ctx.globalAlpha = 0);
4377
- ctx.globalAlpha = 1, ctx.fillStyle = fillStyle;
4446
+ const {
4447
+ fillOpacity = 1,
4448
+ opacity = 1
4449
+ } = character;
4450
+ ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle = fillStyle;
4378
4451
  let fontSize = character.fontSize || 16;
4379
4452
  switch (character.script) {
4380
4453
  case "super":
@@ -4393,7 +4466,11 @@
4393
4466
  function applyStrokeStyle(ctx, character) {
4394
4467
  const strokeStyle = character && character.stroke || defaultFormatting.stroke;
4395
4468
  if (!strokeStyle) return void (ctx.globalAlpha = 0);
4396
- ctx.globalAlpha = 1, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle;
4469
+ const {
4470
+ strokeOpacity = 1,
4471
+ opacity = 1
4472
+ } = character;
4473
+ ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle;
4397
4474
  let fontSize = character.fontSize || 16;
4398
4475
  switch (character.script) {
4399
4476
  case "super":
@@ -5113,7 +5190,6 @@
5113
5190
  symbol: DefaultSymbolAttribute,
5114
5191
  text: DefaultTextAttribute,
5115
5192
  rect: DefaultRectAttribute,
5116
- rect3d: DefaultRect3dAttribute,
5117
5193
  polygon: DefaultPolygonAttribute,
5118
5194
  richtext: DefaultRichTextAttribute,
5119
5195
  richtextIcon: DefaultRichTextIconAttribute,
@@ -5132,7 +5208,6 @@
5132
5208
  symbol: Object.assign({}, defaultThemeObj.symbol),
5133
5209
  text: Object.assign({}, defaultThemeObj.text),
5134
5210
  rect: Object.assign({}, defaultThemeObj.rect),
5135
- rect3d: Object.assign({}, defaultThemeObj.rect3d),
5136
5211
  polygon: Object.assign({}, defaultThemeObj.polygon),
5137
5212
  richtext: Object.assign({}, defaultThemeObj.richtext),
5138
5213
  richtextIcon: Object.assign({}, defaultThemeObj.richtextIcon),
@@ -5605,7 +5680,19 @@
5605
5680
  }, this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = manager;
5606
5681
  }
5607
5682
  composedPath() {
5608
- return !this.manager || this.path && this.path[this.path.length - 1] === this.target || (this.path = this.target ? this.manager.propagationPath(this.target) : []), this.path;
5683
+ return !this.manager || this.path && this.path[this.path.length - 1] === this.target || (this.path = this.target ? this.manager.propagationPath(this.target) : []), this.composedDetailPath(), this.path;
5684
+ }
5685
+ composedDetailPath() {
5686
+ this.pickParams && this.pickParams.graphic && (this.detailPath = this.path.slice(), this._composedDetailPath(this.pickParams));
5687
+ }
5688
+ _composedDetailPath(params) {
5689
+ if (params && params.graphic) {
5690
+ const g = this.pickParams.graphic;
5691
+ if (g.stage) {
5692
+ const path = g.stage.eventSystem.manager.propagationPath(g);
5693
+ this.detailPath.push(path), this._composedDetailPath(params.params);
5694
+ }
5695
+ }
5609
5696
  }
5610
5697
  preventDefault() {
5611
5698
  this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.preventDefault(), this.defaultPrevented = !0;
@@ -5724,7 +5811,7 @@
5724
5811
  }
5725
5812
  let EventManager$1 = class EventManager {
5726
5813
  constructor(root, config) {
5727
- this.dispatch = new EventEmitter(), this.cursorTarget = null, this.mappingState = {
5814
+ this.dispatch = new EventEmitter(), this.cursorTarget = null, this.pauseNotify = !1, this.mappingState = {
5728
5815
  trackingData: {}
5729
5816
  }, this.eventPool = new Map(), this.onPointerDown = (from, target) => {
5730
5817
  if (!(from instanceof FederatedPointerEvent)) return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");
@@ -5885,6 +5972,7 @@
5885
5972
  return propagationPath.reverse(), propagationPath;
5886
5973
  }
5887
5974
  notifyTarget(e, type) {
5975
+ if (this.pauseNotify) return;
5888
5976
  type = null != type ? type : e.type;
5889
5977
  const key = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? `${type}capture` : type;
5890
5978
  this.notifyListeners(e, key), e.eventPhase === e.AT_TARGET && this.notifyListeners(e, type);
@@ -5969,7 +6057,7 @@
5969
6057
  dispatchEvent(e) {
5970
6058
  var _a;
5971
6059
  if (!(e instanceof FederatedEvent)) throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");
5972
- return e.defaultPrevented = !1, e.path = [], e.target = this, null === (_a = null == e ? void 0 : e.manager) || void 0 === _a || _a.dispatchEvent(e), !e.defaultPrevented;
6060
+ return e.defaultPrevented = !1, e.path = [], e.detailPath && (e.detailPath = []), e.target = this, null === (_a = null == e ? void 0 : e.manager) || void 0 === _a || _a.dispatchEvent(e), !e.defaultPrevented;
5973
6061
  },
5974
6062
  emit(eventName, object) {
5975
6063
  return this.dispatchEvent(new CustomEvent(eventName, object));
@@ -6156,6 +6244,12 @@
6156
6244
  nativeEvent.composedPath && nativeEvent.composedPath().length > 0 && (target = nativeEvent.composedPath()[0]);
6157
6245
  return target !== (this.domElement.getNativeHandler ? this.domElement.getNativeHandler().nativeCanvas : this.domElement);
6158
6246
  }
6247
+ pauseTriggerEvent() {
6248
+ this.manager.pauseNotify = !0;
6249
+ }
6250
+ resumeTriggerEvent() {
6251
+ this.manager.pauseNotify = !1;
6252
+ }
6159
6253
  }
6160
6254
 
6161
6255
  class ManualTickHandler {
@@ -8546,7 +8640,7 @@
8546
8640
  }
8547
8641
  function drawPathProxy(graphic, context, x, y, drawContext, params, fillCb, strokeCb) {
8548
8642
  if (!graphic.pathProxy) return !1;
8549
- const themeAttributes = getTheme(graphic, null == params ? void 0 : params.theme)[graphic.type],
8643
+ const themeAttributes = getTheme(graphic, null == params ? void 0 : params.theme)[graphic.type.replace("3d", "")],
8550
8644
  {
8551
8645
  fill = themeAttributes.fill,
8552
8646
  stroke = themeAttributes.stroke,
@@ -8904,6 +8998,15 @@
8904
8998
  let buf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
8905
8999
  return "middle" === baseline ? -lineHeight / 2 : "top" === baseline ? 0 : "bottom" === baseline ? buf - lineHeight : baseline && "alphabetic" !== baseline ? 0 : (fontSize || (fontSize = lineHeight), -(lineHeight - fontSize) / 2 - .79 * fontSize);
8906
9000
  }
9001
+ function textAttributesToStyle(attrs) {
9002
+ const style = {};
9003
+ return ["textAlign", "fontFamily", "fontVariant", "fontStyle", "fontWeight"].forEach(key => {
9004
+ attrs[key] && (style[lowerCamelCaseToMiddle(key)] = attrs[key]);
9005
+ }), ["fontSize", "lineHeight"].forEach(key => {
9006
+ const styleKey = lowerCamelCaseToMiddle(key);
9007
+ isNil$3(attrs[key]) || (style[styleKey] = /^[0-9]*$/.test(`${attrs[key]}`) ? `${attrs[key]}px` : `${attrs[key]}`);
9008
+ }), attrs.underline ? style["text-decoration"] = "underline" : attrs.lineThrough && (style["text-decoration"] = "line-through"), attrs.fill && isString$2(attrs.fill) && (style.color = attrs.fill), style;
9009
+ }
8907
9010
 
8908
9011
  class CanvasTextLayout {
8909
9012
  constructor(fontFamily, options, textMeasure) {
@@ -10326,7 +10429,7 @@
10326
10429
  vertices: [],
10327
10430
  edges: []
10328
10431
  },
10329
- rectTheme = getTheme(this).rect3d,
10432
+ rectTheme = getTheme(this).rect,
10330
10433
  {
10331
10434
  x1: x1,
10332
10435
  y1: y1,
@@ -10524,11 +10627,11 @@
10524
10627
  } = this.lines[i];
10525
10628
  if (top + height < this[this.directionKey.top] || top + height > this[this.directionKey.top] + frameHeight) return lastLineTag;
10526
10629
  let lastLine = !1;
10527
- this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight && (lastLine = !0, lastLineTag = !0), this.lines[i].draw(ctx, lastLine, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, drawIcon);
10630
+ this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight && (lastLine = !0, lastLineTag = !0), this.lines[i].draw(ctx, lastLine, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);
10528
10631
  } else {
10529
10632
  const detalHeight = Math.floor((frameHeight - this.actualHeight) / 2);
10530
10633
  "vertical" === this.layoutDirection ? deltaX += detalHeight : deltaY += detalHeight;
10531
- for (let i = 0; i < this.lines.length; i++) this.lines[i].draw(ctx, !1, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, drawIcon);
10634
+ for (let i = 0; i < this.lines.length; i++) this.lines[i].draw(ctx, !1, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);
10532
10635
  }
10533
10636
  } else if ("bottom" === this.verticalDirection && "vertical" !== this.layoutDirection) for (let i = 0; i < this.lines.length; i++) {
10534
10637
  const {
@@ -10536,11 +10639,11 @@
10536
10639
  height: height
10537
10640
  } = this.lines[i],
10538
10641
  y = frameHeight - this.lines[i].top - this.lines[i].height;
10539
- if (0 === frameHeight) this.lines[i].draw(ctx, !1, deltaX, y + deltaY, drawIcon);else {
10642
+ if (0 === frameHeight) this.lines[i].draw(ctx, !1, deltaX, y + deltaY, this.ellipsis, drawIcon);else {
10540
10643
  if (y + height > this[this.directionKey.top] + frameHeight || y < this[this.directionKey.top]) return lastLineTag;
10541
10644
  {
10542
10645
  let lastLine = !1;
10543
- this.ellipsis && this.lines[i + 1] && y - this.lines[i + 1].height < this[this.directionKey.top] && (lastLine = !0, lastLineTag = !0), this.lines[i].draw(ctx, lastLine, deltaX, y + deltaY, drawIcon);
10646
+ this.ellipsis && this.lines[i + 1] && y - this.lines[i + 1].height < this[this.directionKey.top] && (lastLine = !0, lastLineTag = !0), this.lines[i].draw(ctx, lastLine, deltaX, y + deltaY, this.ellipsis, drawIcon);
10544
10647
  }
10545
10648
  }
10546
10649
  } else {
@@ -10551,11 +10654,11 @@
10551
10654
  top: top,
10552
10655
  height: height
10553
10656
  } = this.lines[i];
10554
- if (0 === frameHeight) this.lines[i].draw(ctx, !1, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, drawIcon);else {
10657
+ if (0 === frameHeight) this.lines[i].draw(ctx, !1, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);else {
10555
10658
  if (top + height < this[this.directionKey.top] || top + height > this[this.directionKey.top] + frameHeight) return lastLineTag;
10556
10659
  {
10557
10660
  let lastLine = !1;
10558
- this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight && (lastLine = !0, lastLineTag = !0), this.lines[i].draw(ctx, lastLine, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, drawIcon);
10661
+ this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight && (lastLine = !0, lastLineTag = !0), this.lines[i].draw(ctx, lastLine, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);
10559
10662
  }
10560
10663
  }
10561
10664
  }
@@ -10594,7 +10697,8 @@
10594
10697
  height: height
10595
10698
  } = this.lines[i];
10596
10699
  if (top + height < this[this.directionKey.top] || top + height > this[this.directionKey.top] + frameHeight) ;else if (this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight) {
10597
- const lineWidth = this.lines[i].getWidthWithEllips();
10700
+ const ellipsis = !0 === this.ellipsis ? "..." : this.ellipsis || "",
10701
+ lineWidth = this.lines[i].getWidthWithEllips(ellipsis);
10598
10702
  lineWidth > widthBound && (widthBound = lineWidth), heightBound += this.lines[i].height;
10599
10703
  } else this.lines[i].actualWidth > widthBound && (widthBound = this.lines[i].actualWidth), heightBound += this.lines[i].height;
10600
10704
  } else {
@@ -10609,7 +10713,8 @@
10609
10713
  y = frameHeight - this.lines[i].top - this.lines[i].height;
10610
10714
  if (0 === frameHeight) this.lines[i].actualWidth > widthBound && (widthBound = this.lines[i].actualWidth), heightBound += this.lines[i].height;else if (y + height > this[this.directionKey.top] + frameHeight || y < this[this.directionKey.top]) ;else {
10611
10715
  if (this.ellipsis && this.lines[i + 1] && y - this.lines[i + 1].height < this[this.directionKey.top]) {
10612
- const lineWidth = this.lines[i].getWidthWithEllips();
10716
+ const ellipsis = !0 === this.ellipsis ? "..." : this.ellipsis || "",
10717
+ lineWidth = this.lines[i].getWidthWithEllips(ellipsis);
10613
10718
  lineWidth > widthBound && (widthBound = lineWidth), heightBound += this.lines[i].height;
10614
10719
  } else this.lines[i].actualWidth > widthBound && (widthBound = this.lines[i].actualWidth), heightBound += this.lines[i].height;
10615
10720
  }
@@ -10620,7 +10725,8 @@
10620
10725
  } = this.lines[i];
10621
10726
  if (0 === frameHeight) this.lines[i].actualWidth > widthBound && (widthBound = this.lines[i].actualWidth), heightBound += this.lines[i].height;else if (top + height < this[this.directionKey.top] || top + height > this[this.directionKey.top] + frameHeight) ;else {
10622
10727
  if (this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight) {
10623
- const lineWidth = this.lines[i].getWidthWithEllips();
10728
+ const ellipsis = !0 === this.ellipsis ? "..." : this.ellipsis || "",
10729
+ lineWidth = this.lines[i].getWidthWithEllips(ellipsis);
10624
10730
  lineWidth > widthBound && (widthBound = lineWidth), heightBound += this.lines[i].height;
10625
10731
  } else this.lines[i].actualWidth > widthBound && (widthBound = this.lines[i].actualWidth), heightBound += this.lines[i].height;
10626
10732
  }
@@ -10646,7 +10752,7 @@
10646
10752
  let halfDetaHeight = 0,
10647
10753
  deltaAscent = 0,
10648
10754
  deltaDescent = 0;
10649
- this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height);
10755
+ this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height), this.ellipsisStr = "...";
10650
10756
  }
10651
10757
  updateWidth() {
10652
10758
  const {
@@ -10659,11 +10765,11 @@
10659
10765
  left = this.left + deltaLeft;
10660
10766
  baseline += this.top;
10661
10767
  let direction = this.direction;
10662
- if (this.verticalEllipsis) text = "...", direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
10768
+ if (this.verticalEllipsis) text = this.ellipsisStr, direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
10663
10769
  if ("hide" === this.ellipsis) return;
10664
- if ("add" === this.ellipsis) text += "...", "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
10770
+ if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
10665
10771
  const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
10666
- if (text = text.slice(0, index), text += "...", "right" === textAlign || "end" === textAlign) {
10772
+ if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
10667
10773
  const {
10668
10774
  width: width
10669
10775
  } = measureTextCanvas(this.text.slice(index), this.character);
@@ -10687,7 +10793,7 @@
10687
10793
  if ("add" === this.ellipsis) return width + this.ellipsisWidth;
10688
10794
  if ("replace" === this.ellipsis) {
10689
10795
  const index = getStrByWithCanvas(text, width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
10690
- text = text.slice(0, index), text += "...";
10796
+ text = text.slice(0, index), text += this.ellipsisStr;
10691
10797
  const {
10692
10798
  width: measureWidth
10693
10799
  } = measureTextCanvas(this.text.slice(index), this.character);
@@ -10858,22 +10964,25 @@
10858
10964
  paragraph instanceof RichTextIcon ? (paragraph["_" + directionKey.x] = x, x += paragraph[directionKey.width] + spacing, paragraph["_" + directionKey.y] = "top" === paragraph.attribute.textBaseline ? 0 : "bottom" === paragraph.attribute.textBaseline ? maxHeight - paragraph.height : (maxHeight - paragraph.height) / 2) : (paragraph[directionKey.left] = x, x += paragraph[directionKey.width] + spacing);
10859
10965
  });
10860
10966
  }
10861
- draw(ctx, lastLine, x, y, drawIcon) {
10862
- if (lastLine) {
10967
+ draw(ctx, lastLine, x, y, drawEllipsis, drawIcon) {
10968
+ if (drawEllipsis && (lastLine || this.paragraphs.some(p => p.overflow))) {
10863
10969
  let otherParagraphWidth = 0;
10864
10970
  for (let i = this.paragraphs.length - 1; i >= 0; i--) {
10865
10971
  const paragraph = this.paragraphs[i];
10972
+ if (paragraph.overflow) continue;
10866
10973
  if (paragraph instanceof RichTextIcon) break;
10867
10974
  if ("vertical" === this.direction && "vertical" !== paragraph.direction) {
10868
10975
  paragraph.verticalEllipsis = !0;
10869
10976
  break;
10870
10977
  }
10978
+ const ellipsis = !0 === drawEllipsis ? "..." : drawEllipsis || "";
10979
+ paragraph.ellipsisStr = ellipsis;
10871
10980
  const {
10872
10981
  width: width
10873
- } = measureTextCanvas("...", paragraph.character),
10982
+ } = measureTextCanvas(ellipsis, paragraph.character),
10874
10983
  ellipsisWidth = width || 0;
10875
10984
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
10876
- paragraph.ellipsis = "add";
10985
+ lastLine && (paragraph.ellipsis = "add");
10877
10986
  break;
10878
10987
  }
10879
10988
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth + paragraph.width) {
@@ -10891,14 +11000,14 @@
10891
11000
  paragraph.draw(ctx, y + this.ascent, x, 0 === index, this.textAlign);
10892
11001
  });
10893
11002
  }
10894
- getWidthWithEllips() {
11003
+ getWidthWithEllips(ellipsis) {
10895
11004
  let otherParagraphWidth = 0;
10896
11005
  for (let i = this.paragraphs.length - 1; i >= 0; i--) {
10897
11006
  const paragraph = this.paragraphs[i];
10898
11007
  if (paragraph instanceof RichTextIcon) break;
10899
11008
  const {
10900
11009
  width: width
10901
- } = measureTextCanvas("...", paragraph.character),
11010
+ } = measureTextCanvas(ellipsis, paragraph.character),
10902
11011
  ellipsisWidth = width || 0;
10903
11012
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
10904
11013
  paragraph.ellipsis = "add", paragraph.ellipsisWidth = ellipsisWidth;
@@ -11057,7 +11166,10 @@
11057
11166
  fontFamily: fontFamily,
11058
11167
  fontStyle: fontStyle,
11059
11168
  fontWeight: fontWeight,
11060
- lineWidth: lineWidth
11169
+ lineWidth: lineWidth,
11170
+ opacity: opacity,
11171
+ fillOpacity: fillOpacity,
11172
+ strokeOpacity: strokeOpacity
11061
11173
  } = this.attribute;
11062
11174
  return Object.assign({
11063
11175
  fill: fill,
@@ -11066,7 +11178,10 @@
11066
11178
  fontFamily: fontFamily,
11067
11179
  fontStyle: fontStyle,
11068
11180
  fontWeight: fontWeight,
11069
- lineWidth: lineWidth
11181
+ lineWidth: lineWidth,
11182
+ opacity: opacity,
11183
+ fillOpacity: fillOpacity,
11184
+ strokeOpacity: strokeOpacity
11070
11185
  }, config);
11071
11186
  }
11072
11187
  doUpdateFrameCache() {
@@ -11083,7 +11198,8 @@
11083
11198
  textAlign: textAlign,
11084
11199
  textBaseline: textBaseline,
11085
11200
  layoutDirection: layoutDirection,
11086
- singleLine: singleLine
11201
+ singleLine: singleLine,
11202
+ disableAutoWrapLine: disableAutoWrapLine
11087
11203
  } = this.attribute,
11088
11204
  paragraphs = [];
11089
11205
  for (let i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
@@ -11109,7 +11225,14 @@
11109
11225
  richTextHeightEnable = "number" == typeof height && Number.isFinite(height) && height > 0 && (!maxHeightFinite || height <= maxHeight),
11110
11226
  frame = new Frame(0, 0, (richTextWidthEnable ? width : maxWidthFinite ? maxWidth : 0) || 0, (richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0) || 0, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection || "horizontal", !richTextWidthEnable && maxWidthFinite, !richTextHeightEnable && maxHeightFinite, singleLine || !1, null === (_a = this._frameCache) || void 0 === _a ? void 0 : _a.icons),
11111
11227
  wrapper = new Wrapper(frame);
11112
- for (let i = 0; i < paragraphs.length; i++) wrapper.deal(paragraphs[i]);
11228
+ if (disableAutoWrapLine) {
11229
+ let lineCount = 0,
11230
+ skip = !1;
11231
+ for (let i = 0; i < paragraphs.length; i++) {
11232
+ const p = paragraphs[i];
11233
+ skip ? (p.overflow = !0, p.left = 1 / 0, p.top = 1 / 0, !p.newLine && frame.lines[frame.lines.length - 1].paragraphs.push(p)) : wrapper.deal(p), frame.lines.length !== lineCount && (lineCount = frame.lines.length, wrapper.lineBuffer.length = 0, p.overflow = !0, p.left = 1e3, p.top = 1e3, frame.lines[frame.lines.length - 1].paragraphs.push(p), skip = !0), p.newLine && (skip = !1, wrapper.lineWidth = 0);
11234
+ }
11235
+ } else for (let i = 0; i < paragraphs.length; i++) wrapper.deal(paragraphs[i]);
11113
11236
  wrapper.send();
11114
11237
  if (!("horizontal" === frame.layoutDirection ? richTextWidthEnable : richTextHeightEnable)) {
11115
11238
  const frameSize = frame.getActualSizeWidthEllipsis();
@@ -12044,6 +12167,22 @@
12044
12167
  aabbBounds.union(node.AABBBounds);
12045
12168
  }), aabbBounds) : aabbBounds;
12046
12169
  }
12170
+ updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
12171
+ const {
12172
+ textAlign: textAlign,
12173
+ textBaseline: textBaseline
12174
+ } = attribute;
12175
+ if (null != attribute.forceBoundsHeight) {
12176
+ const h = isNumber$4(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
12177
+ dy = textLayoutOffsetY(textBaseline, h, h);
12178
+ aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);
12179
+ }
12180
+ if (null != attribute.forceBoundsWidth) {
12181
+ const w = isNumber$4(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
12182
+ dx = textDrawOffsetX(textAlign, w);
12183
+ aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);
12184
+ }
12185
+ }
12047
12186
  updateRichTextAABBBounds(attribute, richtextTheme, aabbBounds, graphic) {
12048
12187
  if (!this._validCheck(attribute, richtextTheme, aabbBounds, graphic)) return aabbBounds;
12049
12188
  if (!graphic) return aabbBounds;
@@ -12090,7 +12229,7 @@
12090
12229
  aabbBounds.translate(deltaX, deltaY);
12091
12230
  const tb1 = this.tempAABBBounds1,
12092
12231
  tb2 = this.tempAABBBounds2;
12093
- return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, graphic), aabbBounds;
12232
+ return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || this.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, graphic), aabbBounds;
12094
12233
  }
12095
12234
  updateTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
12096
12235
  if (!this._validCheck(attribute, textTheme, aabbBounds, graphic)) return aabbBounds;
@@ -12112,7 +12251,7 @@
12112
12251
  const shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);
12113
12252
  boundStroke(tb1, shadowBlurHalfWidth, !0, strokeBoundsBuffer), aabbBounds.union(tb1);
12114
12253
  }
12115
- return this.combindShadowAABBBounds(aabbBounds, graphic), transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix), aabbBounds;
12254
+ return this.combindShadowAABBBounds(aabbBounds, graphic), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || this.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix), aabbBounds;
12116
12255
  }
12117
12256
  updatePathAABBBounds(attribute, pathTheme, aabbBounds, graphic) {
12118
12257
  if (!this._validCheck(attribute, pathTheme, aabbBounds, graphic)) return aabbBounds;
@@ -12394,6 +12533,7 @@
12394
12533
  }
12395
12534
  _validCheck(attribute, theme, aabbBounds, graphic) {
12396
12535
  if (!graphic) return !0;
12536
+ if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
12397
12537
  if (!graphic.valid) return aabbBounds.clear(), !1;
12398
12538
  const {
12399
12539
  visible = theme.visible
@@ -12434,11 +12574,17 @@
12434
12574
  }
12435
12575
  beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
12436
12576
  this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(c => {
12577
+ if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
12578
+ if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
12579
+ }
12437
12580
  c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
12438
12581
  });
12439
12582
  }
12440
12583
  afterRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
12441
12584
  this._afterRenderContribitions && this._afterRenderContribitions.forEach(c => {
12585
+ if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
12586
+ if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
12587
+ }
12442
12588
  c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
12443
12589
  });
12444
12590
  }
@@ -12538,6 +12684,10 @@
12538
12684
  context: context
12539
12685
  } = drawContext;
12540
12686
  if (!context) return;
12687
+ const {
12688
+ renderable: renderable
12689
+ } = graphic.attribute;
12690
+ if (!1 === renderable) return;
12541
12691
  context.highPerformanceSave();
12542
12692
  const data = this.transform(graphic, defaultAttr, context, computed3dMatrix),
12543
12693
  {
@@ -13416,11 +13566,17 @@
13416
13566
  }
13417
13567
  drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb) {
13418
13568
  const {
13419
- width = groupAttribute.width,
13420
- height = groupAttribute.height,
13569
+ x1: x1,
13570
+ y1: y1,
13571
+ x: originX = groupAttribute.x,
13572
+ y: originY = groupAttribute.y,
13421
13573
  stroke = groupAttribute.stroke
13422
13574
  } = rect.attribute;
13423
- if (Array.isArray(stroke) && stroke.some(s => !1 === s)) {
13575
+ let {
13576
+ width: width,
13577
+ height: height
13578
+ } = rect.attribute;
13579
+ if (width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0, Array.isArray(stroke) && stroke.some(s => !1 === s)) {
13424
13580
  if (context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute), context.beginPath(), context.moveTo(x, y), stroke[0] ? context.lineTo(x + width, y) : context.moveTo(x + width, y), stroke[1] ? context.lineTo(x + width, y + height) : context.moveTo(x + width, y + height), stroke[2] ? context.lineTo(x, y + height) : context.moveTo(x, y + height), stroke[3]) {
13425
13581
  const adjustY = stroke[0] ? y - context.lineWidth / 2 : y;
13426
13582
  context.lineTo(x, adjustY);
@@ -14844,7 +15000,7 @@
14844
15000
  strokeOpacity: fillOpacity
14845
15001
  };
14846
15002
  if (underline) {
14847
- attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.setLineDash(underlineDash), context.beginPath();
15003
+ attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
14848
15004
  const dy = y + offsetY + fontSize + underlineOffset;
14849
15005
  context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
14850
15006
  }
@@ -14873,7 +15029,7 @@
14873
15029
  };
14874
15030
  let deltaY = -3;
14875
15031
  if (underline) {
14876
- attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.setLineDash(underlineDash), context.beginPath();
15032
+ attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
14877
15033
  const dy = y + offsetY + fontSize + deltaY + underlineOffset;
14878
15034
  context.moveTo(x + 0, dy, z), context.lineTo(x + 0 + w, dy, z), context.stroke();
14879
15035
  }
@@ -15177,6 +15333,13 @@
15177
15333
  }
15178
15334
  beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) {
15179
15335
  const baseGraphic = graphic.baseGraphic;
15336
+ if (!baseGraphic.stage) {
15337
+ const interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
15338
+ if (interactiveLayer) {
15339
+ this.getShadowRoot(interactiveLayer).removeChild(graphic);
15340
+ }
15341
+ return !0;
15342
+ }
15180
15343
  if (baseGraphic) {
15181
15344
  this.processing = !0;
15182
15345
  const {
@@ -15317,7 +15480,7 @@
15317
15480
  DefaultRenderService = __decorate$X([injectable(), __param$u(0, inject(DrawContribution)), __metadata$G("design:paramtypes", [Object])], DefaultRenderService);
15318
15481
 
15319
15482
  var renderModule$1 = new ContainerModule(bind => {
15320
- bind(RenderService).to(DefaultRenderService).inSingletonScope();
15483
+ bind(RenderService).to(DefaultRenderService);
15321
15484
  });
15322
15485
 
15323
15486
  const PickerService = Symbol.for("PickerService");
@@ -15871,7 +16034,7 @@
15871
16034
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
15872
16035
  }).forEach(group => {
15873
16036
  group.isContainer ? this.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : this.renderItem(group, drawContext);
15874
- }), context.restore(), context.draw(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1;
16037
+ }), context.restore(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1, context.draw();
15875
16038
  }
15876
16039
  doRegister() {
15877
16040
  throw new Error("暂不支持");
@@ -16090,9 +16253,10 @@
16090
16253
  } = drawContext;
16091
16254
  if (!context) return;
16092
16255
  const {
16093
- clip: clip
16256
+ clip: clip,
16257
+ baseOpacity = 1
16094
16258
  } = group.attribute;
16095
- clip ? context.save() : context.highPerformanceSave();
16259
+ clip ? context.save() : context.highPerformanceSave(), context.baseGlobalAlpha *= baseOpacity;
16096
16260
  const groupAttribute = getTheme(group, null == params ? void 0 : params.theme).group,
16097
16261
  lastModelMatrix = context.modelMatrix;
16098
16262
  if (context.camera) {
@@ -16106,7 +16270,7 @@
16106
16270
  scrollY = groupAttribute.scrollY
16107
16271
  } = group.attribute;
16108
16272
  let p;
16109
- (scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.drawingCb && (p = params.drawingCb()), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, p && p.then ? p.then(() => {
16273
+ (scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.drawingCb && (p = params.drawingCb()), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, context.baseGlobalAlpha /= baseOpacity, p && p.then ? p.then(() => {
16110
16274
  clip ? context.restore() : context.highPerformanceRestore();
16111
16275
  }) : clip ? context.restore() : context.highPerformanceRestore();
16112
16276
  }
@@ -16465,103 +16629,171 @@
16465
16629
 
16466
16630
  class HtmlAttributePlugin {
16467
16631
  constructor() {
16468
- this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.lastDomContainerSet = new Set(), this.currentDomContainerSet = new Set();
16632
+ this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.htmlMap = {}, this.renderId = 0;
16469
16633
  }
16470
16634
  activate(context) {
16471
16635
  this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
16472
16636
  stage && stage === this.pluginService.stage && this.drawHTML(context.stage.renderService);
16473
- }), application.graphicService.hooks.onRemove.tap(this.key, graphic => {
16474
- this.removeDom(graphic);
16475
- }), application.graphicService.hooks.onRelease.tap(this.key, graphic => {
16476
- this.removeDom(graphic);
16477
16637
  });
16478
16638
  }
16479
16639
  deactivate(context) {
16480
16640
  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();
16481
16641
  }
16642
+ getWrapContainer(stage, userContainer, domParams) {
16643
+ let nativeContainer;
16644
+ return nativeContainer = userContainer ? "string" == typeof userContainer ? application.global.getElementById(userContainer) : userContainer : stage.window.getContainer(), {
16645
+ wrapContainer: application.global.createDom(Object.assign({
16646
+ tagName: "div",
16647
+ parent: nativeContainer
16648
+ }, domParams)),
16649
+ nativeContainer: nativeContainer
16650
+ };
16651
+ }
16652
+ parseDefaultStyleFromGraphic(graphic) {
16653
+ const attrs = "text" === graphic.type && graphic.attribute ? graphic.attribute : getTheme(graphic).text;
16654
+ return textAttributesToStyle(attrs);
16655
+ }
16656
+ getTransformOfText(graphic) {
16657
+ const textTheme = getTheme(graphic).text,
16658
+ {
16659
+ textAlign = textTheme.textAlign,
16660
+ textBaseline = textTheme.textBaseline
16661
+ } = graphic.attribute,
16662
+ cssAttrs = graphic.globalTransMatrix.toTransformAttrs(),
16663
+ {
16664
+ rotateDeg: rotateDeg,
16665
+ scaleX: scaleX,
16666
+ scaleY: scaleY
16667
+ } = cssAttrs,
16668
+ translateMap = {
16669
+ left: "0",
16670
+ start: "0",
16671
+ end: "-100%",
16672
+ center: "-50%",
16673
+ right: "-100%",
16674
+ top: "0",
16675
+ middle: "-50%",
16676
+ bottom: "-100%",
16677
+ alphabetic: "-79%"
16678
+ },
16679
+ originMap = {
16680
+ left: "0",
16681
+ start: "0",
16682
+ end: "100%",
16683
+ center: "50%",
16684
+ right: "100%",
16685
+ top: "0",
16686
+ middle: "50%",
16687
+ bottom: "100%",
16688
+ alphabetic: "79%"
16689
+ };
16690
+ return {
16691
+ textAlign: textAlign,
16692
+ transform: `translate(${translateMap[textAlign]},${translateMap[textBaseline]}) rotate(${rotateDeg}deg) scaleX(${scaleX}) scaleY(${scaleY})`,
16693
+ transformOrigin: `${originMap[textAlign]} ${originMap[textBaseline]}`
16694
+ };
16695
+ }
16696
+ updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, options) {
16697
+ const {
16698
+ pointerEvents: pointerEvents
16699
+ } = options;
16700
+ let calculateStyle = this.parseDefaultStyleFromGraphic(graphic);
16701
+ calculateStyle.display = !1 !== graphic.attribute.visible ? "block" : "none", calculateStyle.pointerEvents = !0 === pointerEvents ? "all" : pointerEvents || "none", wrapContainer.style.position || (wrapContainer.style.position = "absolute", nativeContainer.style.position = "relative");
16702
+ let left = 0,
16703
+ top = 0;
16704
+ const b = graphic.globalAABBBounds;
16705
+ let anchorType = options.anchorType;
16706
+ if (isNil$3(anchorType) && (anchorType = "text" === graphic.type ? "position" : "boundsLeftTop"), "boundsLeftTop" === anchorType && (anchorType = "top-left"), "position" === anchorType || b.empty()) {
16707
+ const matrix = graphic.globalTransMatrix;
16708
+ left = matrix.e, top = matrix.f;
16709
+ } else {
16710
+ const anchor = calculateAnchorOfBounds(b, anchorType);
16711
+ left = anchor.x, top = anchor.y;
16712
+ }
16713
+ const containerTL = application.global.getElementTopLeft(nativeContainer, !1),
16714
+ windowTL = stage.window.getTopLeft(!1),
16715
+ offsetX = left + windowTL.left - containerTL.left,
16716
+ offsetTop = top + windowTL.top - containerTL.top;
16717
+ if (calculateStyle.left = `${offsetX}px`, calculateStyle.top = `${offsetTop}px`, "text" === graphic.type && "position" === anchorType && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), this.getTransformOfText(graphic))), isFunction$1(options.style)) {
16718
+ const userStyle = options.style({
16719
+ top: offsetTop,
16720
+ left: offsetX,
16721
+ width: b.width(),
16722
+ height: b.height()
16723
+ }, graphic, wrapContainer);
16724
+ userStyle && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), userStyle));
16725
+ } else isObject$4(options.style) ? calculateStyle = Object.assign(Object.assign({}, calculateStyle), options.style) : isString$2(options.style) && options.style && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), styleStringToObject(options.style)));
16726
+ application.global.updateDom(wrapContainer, {
16727
+ width: options.width,
16728
+ height: options.width,
16729
+ style: calculateStyle
16730
+ });
16731
+ }
16732
+ clearCacheContainer() {
16733
+ this.htmlMap && Object.keys(this.htmlMap).forEach(key => {
16734
+ this.htmlMap[key] && this.htmlMap[key].renderId !== this.renderId && this.removeElement(key);
16735
+ }), this.renderId += 1;
16736
+ }
16482
16737
  drawHTML(renderService) {
16483
16738
  "browser" === application.global.env && (renderService.renderTreeRoots.sort((a, b) => {
16484
16739
  var _a, _b;
16485
16740
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
16486
16741
  }).forEach(group => {
16487
16742
  this.renderGroupHTML(group);
16488
- }), this.lastDomContainerSet.forEach(item => {
16489
- this.currentDomContainerSet.has(item) || item.parentElement && item.parentElement.removeChild(item);
16490
- }), this.lastDomContainerSet = new Set(this.currentDomContainerSet), this.currentDomContainerSet.clear());
16743
+ }), this.clearCacheContainer());
16491
16744
  }
16492
16745
  renderGroupHTML(group) {
16493
16746
  this.renderGraphicHTML(group), group.forEachChildren(g => {
16494
16747
  g.isContainer ? this.renderGroupHTML(g) : this.renderGraphicHTML(g);
16495
16748
  });
16496
16749
  }
16497
- removeDom(graphic) {
16498
- graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(item => {
16499
- item.dom && item.dom.parentElement.removeChild(item.dom);
16500
- }), graphic.bindDom.clear());
16750
+ removeElement(id) {
16751
+ if (!this.htmlMap || !this.htmlMap[id]) return;
16752
+ const {
16753
+ wrapContainer: wrapContainer
16754
+ } = this.htmlMap[id];
16755
+ wrapContainer && application.global.removeDom(wrapContainer), this.htmlMap[id] = null;
16501
16756
  }
16502
16757
  renderGraphicHTML(graphic) {
16758
+ var _a;
16503
16759
  const {
16504
16760
  html: html
16505
16761
  } = graphic.attribute;
16506
- if (!html) return void (graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(item => {
16507
- item.dom && item.dom.parentElement.removeChild(item.dom);
16508
- }), graphic.bindDom.clear()));
16762
+ if (!html) return;
16509
16763
  const stage = graphic.stage;
16510
16764
  if (!stage) return;
16511
16765
  const {
16512
16766
  dom: dom,
16513
- container: container,
16514
- width: width,
16515
- height: height,
16516
- style: style,
16517
- anchorType = "boundsLeftTop",
16518
- pointerEvents: pointerEvents
16767
+ container: container
16519
16768
  } = html;
16520
- graphic.bindDom || (graphic.bindDom = new Map());
16521
- const lastDom = graphic.bindDom.get(dom);
16522
- let wrapGroup, nativeContainer;
16523
- if (!lastDom || container && container !== lastDom.container) {
16524
- let nativeDom;
16525
- graphic.bindDom.forEach(_ref => {
16526
- let {
16527
- wrapGroup: wrapGroup
16528
- } = _ref;
16529
- application.global.removeDom(wrapGroup);
16530
- }), "string" == typeof dom ? (nativeDom = new DOMParser().parseFromString(dom, "text/html").firstChild, nativeDom.lastChild && (nativeDom = nativeDom.lastChild.firstChild)) : nativeDom = dom;
16531
- const _container = container || (!0 === stage.params.enableHtmlAttribute ? null : stage.params.enableHtmlAttribute);
16532
- nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(), wrapGroup = application.global.createDom({
16533
- tagName: "div",
16534
- width: width,
16535
- height: height,
16536
- style: style,
16537
- parent: nativeContainer
16538
- }), wrapGroup && (wrapGroup.appendChild(nativeDom), graphic.bindDom.set(dom, {
16539
- dom: nativeDom,
16769
+ if (!dom) return;
16770
+ const id = isNil$3(html.id) ? `${null !== (_a = graphic.id) && void 0 !== _a ? _a : graphic._uid}_react` : html.id;
16771
+ if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container && this.removeElement(id), this.htmlMap && this.htmlMap[id]) "string" == typeof dom ? this.htmlMap[id].wrapContainer.innerHTML = dom : dom !== this.htmlMap[id].wrapContainer.firstChild && (this.htmlMap[id].wrapContainer.removeChild(this.htmlMap[id].wrapContainer.firstChild), this.htmlMap[id].wrapContainer.appendChild(dom));else {
16772
+ const {
16773
+ wrapContainer: wrapContainer,
16774
+ nativeContainer: nativeContainer
16775
+ } = this.getWrapContainer(stage, container);
16776
+ wrapContainer && ("string" == typeof dom ? wrapContainer.innerHTML = dom : wrapContainer.appendChild(dom), this.htmlMap || (this.htmlMap = {}), this.htmlMap[id] = {
16777
+ wrapContainer: wrapContainer,
16778
+ nativeContainer: nativeContainer,
16540
16779
  container: container,
16541
- wrapGroup: wrapGroup
16542
- }));
16543
- } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
16544
- wrapGroup.style.pointerEvents = pointerEvents || "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
16545
- let left = 0,
16546
- top = 0;
16547
- const b = graphic.globalAABBBounds;
16548
- if ("position" === anchorType || b.empty()) {
16549
- const matrix = graphic.globalTransMatrix;
16550
- left = matrix.e, top = matrix.f;
16551
- } else left = b.x1, top = b.y1;
16552
- const containerTL = application.global.getElementTopLeft(nativeContainer, !1),
16553
- windowTL = stage.window.getTopLeft(!1),
16554
- offsetX = left + windowTL.left - containerTL.left,
16555
- offsetTop = top + windowTL.top - containerTL.top;
16556
- wrapGroup.style.left = `${offsetX}px`, wrapGroup.style.top = `${offsetTop}px`, this.currentDomContainerSet.add(wrapGroup);
16780
+ renderId: this.renderId
16781
+ });
16782
+ }
16783
+ if (!this.htmlMap || !this.htmlMap[id]) return;
16784
+ const {
16785
+ wrapContainer: wrapContainer,
16786
+ nativeContainer: nativeContainer
16787
+ } = this.htmlMap[id];
16788
+ this.updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, html), this.htmlMap[id].renderId = this.renderId;
16557
16789
  }
16558
16790
  release() {
16559
- "browser" === application.global.env && (this.removeAllDom(this.pluginService.stage.defaultLayer), this.lastDomContainerSet.clear(), this.currentDomContainerSet.clear());
16791
+ "browser" === application.global.env && this.removeAllDom(this.pluginService.stage.defaultLayer);
16560
16792
  }
16561
16793
  removeAllDom(g) {
16562
- this.removeDom(g), g.forEachChildren(item => {
16563
- item.isContainer && this.removeAllDom(g);
16564
- });
16794
+ this.htmlMap && (Object.keys(this.htmlMap).forEach(key => {
16795
+ this.removeElement(key);
16796
+ }), this.htmlMap = null);
16565
16797
  }
16566
16798
  }
16567
16799
 
@@ -16769,7 +17001,7 @@
16769
17001
  }
16770
17002
  } else if ("flex-end" === justifyContent) {
16771
17003
  let pos = main.len;
16772
- for (let i = lastIdx; i <= currSeg.idx; i++) {
17004
+ for (let i = currSeg.idx; i >= lastIdx; i--) {
16773
17005
  pos -= mianLenArray[i].mainLen;
16774
17006
  const posBaseLeftTop = pos + getPadding(children[i], main.field),
16775
17007
  b = this.getAABBBounds(children[i]);
@@ -17010,73 +17242,58 @@
17010
17242
 
17011
17243
  class ReactAttributePlugin extends HtmlAttributePlugin {
17012
17244
  constructor() {
17013
- super(...arguments), this.name = "ReactAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid;
17245
+ super(...arguments), this.name = "ReactAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.htmlMap = {};
17014
17246
  }
17015
- removeDom(graphic) {
17016
- graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(item => {
17017
- item.root && item.root.unmount();
17018
- }), graphic.bindDom.clear());
17247
+ removeElement(id) {
17248
+ if (!this.htmlMap || !this.htmlMap[id]) return;
17249
+ const {
17250
+ root: root,
17251
+ wrapContainer: wrapContainer
17252
+ } = this.htmlMap[id];
17253
+ if (root) {
17254
+ application.global.getRequestAnimationFrame()(() => {
17255
+ root.unmount();
17256
+ });
17257
+ }
17258
+ wrapContainer && application.global.removeDom(wrapContainer), this.htmlMap[id] = null;
17019
17259
  }
17020
17260
  renderGraphicHTML(graphic) {
17261
+ var _a;
17021
17262
  const {
17022
17263
  react: react
17023
17264
  } = graphic.attribute;
17024
- if (!react) return void (graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(item => {
17025
- item.root && item.root.unmount();
17026
- }), graphic.bindDom.clear()));
17265
+ if (!react) return;
17027
17266
  const stage = graphic.stage;
17028
17267
  if (!stage) return;
17029
17268
  const ReactDOM = stage.params.ReactDOM,
17030
17269
  {
17031
17270
  element: element,
17032
- container: container,
17033
- width: width,
17034
- height: height,
17035
- style: style,
17036
- anchorType = "boundsLeftTop",
17037
- pointerEvents: pointerEvents
17271
+ container: container
17038
17272
  } = react;
17039
17273
  if (!(element && ReactDOM && ReactDOM.createRoot)) return;
17040
- graphic.bindDom || (graphic.bindDom = new Map());
17041
- const lastDom = graphic.bindDom.get(element);
17042
- let wrapGroup, nativeContainer;
17043
- if (!lastDom || container && container !== lastDom.container) {
17044
- graphic.bindDom.forEach(_ref => {
17045
- let {
17046
- wrapGroup: wrapGroup
17047
- } = _ref;
17048
- application.global.removeDom(wrapGroup);
17049
- });
17050
- const _container = container;
17051
- if (nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(), wrapGroup = application.global.createDom({
17052
- tagName: "div",
17053
- width: width,
17054
- height: height,
17055
- style: style,
17056
- parent: nativeContainer
17057
- }), wrapGroup) {
17058
- const root = ReactDOM.createRoot(wrapGroup);
17059
- root.render(element), graphic.bindDom.set(element, {
17060
- dom: element,
17274
+ const id = isNil$3(react.id) ? `${null !== (_a = graphic.id) && void 0 !== _a ? _a : graphic._uid}_react` : react.id;
17275
+ if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container && this.removeElement(id), this.htmlMap && this.htmlMap[id]) this.htmlMap[id].root.render(element);else {
17276
+ const {
17277
+ wrapContainer: wrapContainer,
17278
+ nativeContainer: nativeContainer
17279
+ } = this.getWrapContainer(stage, container);
17280
+ if (wrapContainer) {
17281
+ const root = ReactDOM.createRoot(wrapContainer);
17282
+ root.render(element), this.htmlMap || (this.htmlMap = {}), this.htmlMap[id] = {
17283
+ root: root,
17284
+ wrapContainer: wrapContainer,
17285
+ nativeContainer: nativeContainer,
17061
17286
  container: container,
17062
- wrapGroup: wrapGroup,
17063
- root: root
17064
- });
17287
+ renderId: this.renderId
17288
+ };
17065
17289
  }
17066
- } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
17067
- wrapGroup.style.pointerEvents = pointerEvents || "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
17068
- let left = 0,
17069
- top = 0;
17070
- const b = graphic.globalAABBBounds;
17071
- if ("position" === anchorType || b.empty()) {
17072
- const matrix = graphic.globalTransMatrix;
17073
- left = matrix.e, top = matrix.f;
17074
- } else left = b.x1, top = b.y1;
17075
- const containerTL = application.global.getElementTopLeft(nativeContainer, !1),
17076
- windowTL = stage.window.getTopLeft(!1),
17077
- offsetX = left + windowTL.left - containerTL.left,
17078
- offsetTop = top + windowTL.top - containerTL.top;
17079
- wrapGroup.style.left = `${offsetX}px`, wrapGroup.style.top = `${offsetTop}px`;
17290
+ }
17291
+ if (!this.htmlMap || !this.htmlMap[id]) return;
17292
+ const {
17293
+ wrapContainer: wrapContainer,
17294
+ nativeContainer: nativeContainer
17295
+ } = this.htmlMap[id];
17296
+ this.updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, react), this.htmlMap[id].renderId = this.renderId;
17080
17297
  }
17081
17298
  }
17082
17299
 
@@ -17534,6 +17751,16 @@
17534
17751
  getCursor() {
17535
17752
  return this._cursor;
17536
17753
  }
17754
+ eventPointTransform(e) {
17755
+ const point = this.global.mapToCanvasPoint(e, this.window.getContext().canvas.nativeCanvas);
17756
+ return this.stage.window.pointTransform(point.x, point.y);
17757
+ }
17758
+ pauseTriggerEvent() {
17759
+ this._eventSystem && this._eventSystem.pauseTriggerEvent();
17760
+ }
17761
+ resumeTriggerEvent() {
17762
+ this._eventSystem && this._eventSystem.resumeTriggerEvent();
17763
+ }
17537
17764
  }
17538
17765
 
17539
17766
  function createStage(params) {
@@ -17667,6 +17894,9 @@
17667
17894
  createDom(params) {
17668
17895
  return null;
17669
17896
  }
17897
+ updateDom(dom, params) {
17898
+ return !1;
17899
+ }
17670
17900
  getDynamicCanvasCount() {
17671
17901
  return 999;
17672
17902
  }
@@ -18058,7 +18288,7 @@
18058
18288
  }
18059
18289
  drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
18060
18290
  var _a;
18061
- const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect3d,
18291
+ const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect,
18062
18292
  {
18063
18293
  fill = rectAttribute.fill,
18064
18294
  stroke = rectAttribute.stroke,
@@ -18499,6 +18729,36 @@
18499
18729
  graphicCreator.RegisterGraphicCreator("wrapText", createWrapText);
18500
18730
  }
18501
18731
 
18732
+ const MathPickerContribution = Symbol.for("MathPickerContribution");
18733
+ const MathArcPicker = Symbol.for("MathArcPicker");
18734
+ const MathAreaPicker = Symbol.for("MathAreaPicker");
18735
+ const MathCirclePicker = Symbol.for("MathCirclePicker");
18736
+ const MathImagePicker = Symbol.for("MathImagePicker");
18737
+ const MathLinePicker = Symbol.for("MathLinePicker");
18738
+ const MathPathPicker = Symbol.for("MathPathPicker");
18739
+ const MathRectPicker = Symbol.for("MathRectPicker");
18740
+ const MathSymbolPicker = Symbol.for("MathSymbolPicker");
18741
+ const MathTextPicker = Symbol.for("MathTextPicker");
18742
+ const MathPolygonPicker = Symbol.for("MathPolygonPicker");
18743
+ const MathGlyphPicker = Symbol.for("MathGlyphPicker");
18744
+ const CanvasArcPicker = Symbol.for("CanvasArcPicker");
18745
+ const CanvasArc3dPicker = Symbol.for("CanvasArc3dPicker");
18746
+ const CanvasAreaPicker = Symbol.for("CanvasAreaPicker");
18747
+ const CanvasCirclePicker = Symbol.for("CanvasCirclePicker");
18748
+ const CanvasImagePicker = Symbol.for("CanvasImagePicker");
18749
+ const CanvasLinePicker = Symbol.for("CanvasLinePicker");
18750
+ const CanvasPathPicker = Symbol.for("CanvasPathPicker");
18751
+ const CanvasRectPicker = Symbol.for("CanvasRectPicker");
18752
+ const CanvasRect3dPicker = Symbol.for("CanvasRect3dPicker");
18753
+ const CanvasSymbolPicker = Symbol.for("CanvasSymbolPicker");
18754
+ const CanvasTextPicker = Symbol.for("CanvasTextPicker");
18755
+ const CanvasPolygonPicker = Symbol.for("CanvasPolygonPicker");
18756
+ const CanvasPyramid3dPicker = Symbol.for("CanvasPyramid3dPicker");
18757
+ const CanvasRichTextPicker = Symbol.for("CanvasRichTextPicker");
18758
+ const CanvasGlyphPicker = Symbol.for("CanvasGlyphPicker");
18759
+ const CanvasGroupPicker = Symbol.for("CanvasGroupPicker");
18760
+ const CanvasPickerContribution = Symbol.for("CanvasPickerContribution");
18761
+
18502
18762
  const REACT_TO_CANOPUS_EVENTS = {
18503
18763
  onPointerDown: "pointerdown",
18504
18764
  onPointerUp: "pointerup",
@@ -18903,7 +19163,7 @@
18903
19163
  return this.nativeContext.font;
18904
19164
  }
18905
19165
  set globalAlpha(d) {
18906
- this.nativeContext.globalAlpha = d;
19166
+ this.nativeContext.globalAlpha = d * this.baseGlobalAlpha;
18907
19167
  }
18908
19168
  get globalAlpha() {
18909
19169
  return this.nativeContext.globalAlpha;
@@ -18996,7 +19256,7 @@
18996
19256
  }), this._clearShadowStyle = !1, this._clearFilterStyle = !1, this._clearGlobalCompositeOperationStyle = !1;
18997
19257
  const context = canvas.nativeCanvas.getContext("2d");
18998
19258
  if (!context) throw new Error("发生错误,获取2d上下文失败");
18999
- 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);
19259
+ 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), this.baseGlobalAlpha = 1;
19000
19260
  }
19001
19261
  reset() {
19002
19262
  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);
@@ -19237,7 +19497,7 @@
19237
19497
  setLineDash(segments) {
19238
19498
  const a = arguments,
19239
19499
  _context = this.nativeContext;
19240
- this.nativeContext.setLineDash ? _context.setLineDash(a[0]) : "mozDash" in _context ? _context.mozDash = a[0] : "webkitLineDash" in _context && (_context.webkitLineDash = a[0]);
19500
+ this.nativeContext.setLineDash ? a[0] && _context.setLineDash(a[0]) : "mozDash" in _context ? _context.mozDash = a[0] : "webkitLineDash" in _context && (_context.webkitLineDash = a[0]);
19241
19501
  }
19242
19502
  stroke(path) {
19243
19503
  this.disableStroke || (path ? this.nativeContext.stroke(path) : this.nativeContext.stroke());
@@ -19276,7 +19536,7 @@
19276
19536
  opacity = defaultParams.opacity,
19277
19537
  fill = defaultParams.fill
19278
19538
  } = attribute;
19279
- fillOpacity > 1e-12 && opacity > 1e-12 ? (_context.globalAlpha = fillOpacity * opacity, _context.fillStyle = createColor(this, fill, params, offsetX, offsetY)) : _context.globalAlpha = fillOpacity * opacity;
19539
+ fillOpacity > 1e-12 && opacity > 1e-12 ? (_context.globalAlpha = fillOpacity * opacity * this.baseGlobalAlpha, _context.fillStyle = createColor(this, fill, params, offsetX, offsetY)) : _context.globalAlpha = fillOpacity * opacity * this.baseGlobalAlpha;
19280
19540
  }
19281
19541
  setShadowBlendStyle(params, attribute, defaultParams) {
19282
19542
  if (Array.isArray(defaultParams)) {
@@ -19328,7 +19588,7 @@
19328
19588
  lineCap = defaultParams.lineCap,
19329
19589
  miterLimit = defaultParams.miterLimit
19330
19590
  } = attribute;
19331
- _context.globalAlpha = strokeOpacity * opacity, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
19591
+ _context.globalAlpha = strokeOpacity * opacity * this.baseGlobalAlpha, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
19332
19592
  }
19333
19593
  }
19334
19594
  setTextStyleWithoutAlignBaseline(params, defaultParams, z) {
@@ -19452,36 +19712,6 @@
19452
19712
 
19453
19713
  const browserCanvasModule = createModule(BrowserCanvas, BrowserContext2d);
19454
19714
 
19455
- const MathPickerContribution = Symbol.for("MathPickerContribution");
19456
- const MathArcPicker = Symbol.for("MathArcPicker");
19457
- const MathAreaPicker = Symbol.for("MathAreaPicker");
19458
- const MathCirclePicker = Symbol.for("MathCirclePicker");
19459
- const MathImagePicker = Symbol.for("MathImagePicker");
19460
- const MathLinePicker = Symbol.for("MathLinePicker");
19461
- const MathPathPicker = Symbol.for("MathPathPicker");
19462
- const MathRectPicker = Symbol.for("MathRectPicker");
19463
- const MathSymbolPicker = Symbol.for("MathSymbolPicker");
19464
- const MathTextPicker = Symbol.for("MathTextPicker");
19465
- const MathPolygonPicker = Symbol.for("MathPolygonPicker");
19466
- const MathGlyphPicker = Symbol.for("MathGlyphPicker");
19467
- const CanvasArcPicker = Symbol.for("CanvasArcPicker");
19468
- const CanvasArc3dPicker = Symbol.for("CanvasArc3dPicker");
19469
- const CanvasAreaPicker = Symbol.for("CanvasAreaPicker");
19470
- const CanvasCirclePicker = Symbol.for("CanvasCirclePicker");
19471
- const CanvasImagePicker = Symbol.for("CanvasImagePicker");
19472
- const CanvasLinePicker = Symbol.for("CanvasLinePicker");
19473
- const CanvasPathPicker = Symbol.for("CanvasPathPicker");
19474
- const CanvasRectPicker = Symbol.for("CanvasRectPicker");
19475
- const CanvasRect3dPicker = Symbol.for("CanvasRect3dPicker");
19476
- const CanvasSymbolPicker = Symbol.for("CanvasSymbolPicker");
19477
- const CanvasTextPicker = Symbol.for("CanvasTextPicker");
19478
- const CanvasPolygonPicker = Symbol.for("CanvasPolygonPicker");
19479
- const CanvasPyramid3dPicker = Symbol.for("CanvasPyramid3dPicker");
19480
- const CanvasRichTextPicker = Symbol.for("CanvasRichTextPicker");
19481
- const CanvasGlyphPicker = Symbol.for("CanvasGlyphPicker");
19482
- const CanvasGroupPicker = Symbol.for("CanvasGroupPicker");
19483
- const CanvasPickerContribution = Symbol.for("CanvasPickerContribution");
19484
-
19485
19715
  var __decorate$B = undefined && undefined.__decorate || function (decorators, target, key, desc) {
19486
19716
  var d,
19487
19717
  c = arguments.length,
@@ -19524,9 +19754,11 @@
19524
19754
  }
19525
19755
  const picker = this.pickerMap.get(graphic.numberType);
19526
19756
  if (!picker) return null;
19527
- const g = picker.contains(graphic, point, params) ? graphic : null,
19757
+ const pd = picker.contains(graphic, point, params),
19758
+ g = pd ? graphic : null,
19528
19759
  data = {
19529
- graphic: g
19760
+ graphic: g,
19761
+ params: pd
19530
19762
  };
19531
19763
  if (g) return data;
19532
19764
  if (this.InterceptorContributions.length) for (let i = 0; i < this.InterceptorContributions.length; i++) {
@@ -19841,18 +20073,23 @@
19841
20073
  removeDom(dom) {
19842
20074
  return dom.parentElement.removeChild(dom), !0;
19843
20075
  }
20076
+ updateDom(dom, params) {
20077
+ const {
20078
+ width: width,
20079
+ height: height,
20080
+ style: style
20081
+ } = params;
20082
+ return style && (isString$2(style) ? dom.setAttribute("style", style) : Object.keys(style).forEach(k => {
20083
+ dom.style[k] = style[k];
20084
+ })), null != width && (dom.style.width = `${width}px`), null != height && (dom.style.height = `${height}px`), !0;
20085
+ }
19844
20086
  createDom(params) {
19845
20087
  const {
19846
20088
  tagName = "div",
19847
- width: width,
19848
- height: height,
19849
- style: style,
19850
20089
  parent: parent
19851
20090
  } = params,
19852
20091
  element = document.createElement(tagName);
19853
- if (style && (isString$2(style) ? element.setAttribute("style", style) : Object.keys(style).forEach(k => {
19854
- element.setAttribute(k, style[k]);
19855
- })), null != width && (element.style.width = `${width}px`), null != height && (element.style.height = `${height}px`), parent) {
20092
+ if (this.updateDom(element, params), parent) {
19856
20093
  const pd = isString$2(parent) ? this.getElementById(parent) : parent;
19857
20094
  pd && pd.appendChild && pd.appendChild(element);
19858
20095
  }
@@ -25149,7 +25386,8 @@
25149
25386
  }
25150
25387
  bindEvents() {}
25151
25388
  _getNodeId(id) {
25152
- return `${this.id}-${this.name}-${id}`;
25389
+ var _a;
25390
+ return `${null !== (_a = this.id) && void 0 !== _a ? _a : this._uid}-${this.name}-${id}`;
25153
25391
  }
25154
25392
  _dispatchEvent(eventName, details) {
25155
25393
  var _a;
@@ -25215,9 +25453,13 @@
25215
25453
  }, this._onSliderPointerDown = e => {
25216
25454
  e.stopPropagation();
25217
25455
  const {
25218
- direction: direction
25219
- } = this.attribute;
25220
- this._prePos = "horizontal" === direction ? e.clientX : e.clientY, this._dispatchEvent("scrollDown", {
25456
+ direction: direction
25457
+ } = this.attribute,
25458
+ {
25459
+ x: x,
25460
+ y: y
25461
+ } = this.stage.eventPointTransform(e);
25462
+ this._prePos = "horizontal" === direction ? x : y, this._dispatchEvent("scrollDown", {
25221
25463
  pos: this._prePos,
25222
25464
  event: e
25223
25465
  }), "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
@@ -25227,8 +25469,12 @@
25227
25469
  }), this.stage.addEventListener("pointerup", this._onSliderPointerUp), this.stage.addEventListener("pointerupoutside", this._onSliderPointerUp));
25228
25470
  }, this._computeScrollValue = e => {
25229
25471
  const {
25230
- direction: direction
25231
- } = this.attribute;
25472
+ direction: direction
25473
+ } = this.attribute,
25474
+ {
25475
+ x: x,
25476
+ y: y
25477
+ } = this.stage.eventPointTransform(e);
25232
25478
  let currentScrollValue,
25233
25479
  currentPos,
25234
25480
  delta = 0;
@@ -25236,7 +25482,7 @@
25236
25482
  width: width,
25237
25483
  height: height
25238
25484
  } = this._getSliderRenderBounds();
25239
- 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];
25485
+ return "vertical" === direction ? (currentPos = y, delta = currentPos - this._prePos, currentScrollValue = delta / height) : (currentPos = x, delta = currentPos - this._prePos, currentScrollValue = delta / width), [currentPos, currentScrollValue];
25240
25486
  }, this._onSliderPointerMove = e => {
25241
25487
  e.stopPropagation();
25242
25488
  const preScrollRange = this.getScrollRange(),
@@ -25488,12 +25734,42 @@
25488
25734
  }
25489
25735
  function isRichText(attributes) {
25490
25736
  let typeKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "type";
25491
- return typeKey in attributes && "rich" === attributes[typeKey] || isObject$4(attributes.text) && "rich" === attributes.text.type;
25737
+ return "rich" === getTextType(attributes, typeKey);
25738
+ }
25739
+ function getTextType(attributes) {
25740
+ let typeKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "type";
25741
+ var _a, _b;
25742
+ return isObject$4(attributes.text) && "type" in attributes.text ? null !== (_a = attributes.text.type) && void 0 !== _a ? _a : "text" : typeKey in attributes && null !== (_b = attributes[typeKey]) && void 0 !== _b ? _b : "text";
25492
25743
  }
25493
25744
  function richTextAttributeTransform(attributes) {
25494
25745
  var _a, _b;
25495
25746
  return attributes.width = null !== (_a = attributes.width) && void 0 !== _a ? _a : 0, attributes.height = null !== (_b = attributes.height) && void 0 !== _b ? _b : 0, attributes.maxWidth = attributes.maxLineWidth, attributes.textConfig = attributes.text.text || attributes.text, attributes;
25496
25747
  }
25748
+ function htmlAttributeTransform(attributes) {
25749
+ const {
25750
+ text: text,
25751
+ _originText: _originText
25752
+ } = attributes,
25753
+ {
25754
+ text: html
25755
+ } = text;
25756
+ return attributes.html = html, attributes.text = _originText, attributes.renderable = !1, attributes;
25757
+ }
25758
+ function reactAttributeTransform(attributes) {
25759
+ const {
25760
+ text: text,
25761
+ _originText: _originText
25762
+ } = attributes,
25763
+ {
25764
+ text: react
25765
+ } = text;
25766
+ return attributes.react = react, attributes.text = _originText, attributes.renderable = !1, attributes;
25767
+ }
25768
+ function createTextGraphicByType(textAttributes) {
25769
+ let typeKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "type";
25770
+ const textType = getTextType(textAttributes, typeKey);
25771
+ return "rich" === textType ? graphicCreator.richtext(richTextAttributeTransform(textAttributes)) : ("html" === textType ? textAttributes = htmlAttributeTransform(textAttributes) : "react" === textType && (textAttributes = reactAttributeTransform(textAttributes)), graphicCreator.text(textAttributes));
25772
+ }
25497
25773
 
25498
25774
  function loadTagComponent() {
25499
25775
  registerGroup(), registerRect(), registerSymbol(), registerRichtext(), registerText();
@@ -25510,6 +25786,12 @@
25510
25786
  };
25511
25787
  loadTagComponent();
25512
25788
  let Tag$1 = class Tag extends AbstractComponent {
25789
+ getBgRect() {
25790
+ return this._bgRect;
25791
+ }
25792
+ getTextShape() {
25793
+ return this._textShape;
25794
+ }
25513
25795
  constructor(attributes, options) {
25514
25796
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, Tag.defaultAttributes, attributes)), this.name = "tag";
25515
25797
  }
@@ -25583,7 +25865,7 @@
25583
25865
  width: textShape.AABBBounds.width(),
25584
25866
  height: textShape.AABBBounds.height()
25585
25867
  }), "rect");
25586
- isEmpty(null == state ? void 0 : state.panel) || (bgRect.states = state.panel);
25868
+ isEmpty(null == state ? void 0 : state.panel) || (bgRect.states = state.panel), this._bgRect = bgRect;
25587
25869
  }
25588
25870
  } else {
25589
25871
  const textAttrs = Object.assign(Object.assign({
@@ -25635,9 +25917,10 @@
25635
25917
  width: tagWidth,
25636
25918
  height: tagHeight
25637
25919
  }), "rect");
25638
- isEmpty(null == state ? void 0 : state.panel) || (bgRect.states = state.panel);
25920
+ isEmpty(null == state ? void 0 : state.panel) || (bgRect.states = state.panel), this._bgRect = bgRect;
25639
25921
  }
25640
25922
  }
25923
+ this._textShape = textShape;
25641
25924
  }
25642
25925
  };
25643
25926
  Tag$1.defaultAttributes = {
@@ -26089,7 +26372,7 @@
26089
26372
  return this._mainSegmentPoints;
26090
26373
  }
26091
26374
  constructor(attributes, options) {
26092
- super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, Segment.defaultAttributes, attributes)), this.name = "segment";
26375
+ super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, Segment.defaultAttributes, attributes)), this.name = "segment", this.key = "segment", this.lines = [];
26093
26376
  }
26094
26377
  render() {
26095
26378
  this.removeAllChild(!0), this._reset();
@@ -26104,8 +26387,9 @@
26104
26387
  } = this.attribute;
26105
26388
  if (!visible) return;
26106
26389
  this._computeLineAngle();
26107
- const startSymbolShape = this._renderSymbol(startSymbol, "start"),
26108
- endSymbolShape = this._renderSymbol(endSymbol, "end");
26390
+ const points = this._getMainSegmentPoints(),
26391
+ startSymbolShape = this._renderSymbol(startSymbol, points, "start"),
26392
+ endSymbolShape = this._renderSymbol(endSymbol, points, "end");
26109
26393
  if (this.startSymbol = startSymbolShape, this.endSymbol = endSymbolShape, multiSegment) {
26110
26394
  const points = [...this.attribute.points];
26111
26395
  if (isValidNumber$1(mainSegmentIndex)) points[mainSegmentIndex] = this._clipPoints(points[mainSegmentIndex]);else {
@@ -26119,7 +26403,7 @@
26119
26403
  }, isArray$3(lineStyle) ? null !== (_a = lineStyle[index]) && void 0 !== _a ? _a : lineStyle[lineStyle.length - 1] : lineStyle), {
26120
26404
  fill: !1
26121
26405
  }));
26122
- 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);
26406
+ 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), this.lines.push(line);
26123
26407
  });
26124
26408
  } else {
26125
26409
  let lineCreator = graphicCreator.line;
@@ -26130,11 +26414,13 @@
26130
26414
  fill: !1,
26131
26415
  closePath: !1
26132
26416
  }));
26133
- line.name = `${this.name}-line`, line.id = this._getNodeId("line"), isEmpty(null == state ? void 0 : state.line) || (line.states = [].concat(state.line)[0]), this.add(line);
26417
+ line.name = `${this.name}-line`, line.id = this._getNodeId("line"), isEmpty(null == state ? void 0 : state.line) || (line.states = [].concat(state.line)[0]), this.add(line), this.lines.push(line);
26134
26418
  }
26135
26419
  }
26136
- _renderSymbol(attribute, dim) {
26137
- const points = this._getMainSegmentPoints();
26420
+ _computeRotate(angle) {
26421
+ return angle + Math.PI / 2;
26422
+ }
26423
+ _renderSymbol(attribute, points, dim) {
26138
26424
  if (!points.length) return;
26139
26425
  const {
26140
26426
  autoRotate = !0
@@ -26160,15 +26446,15 @@
26160
26446
  "start" === dim ? (position = {
26161
26447
  x: start.x + (isValidNumber$1(startAngle) ? refX * Math.cos(startAngle) + refY * Math.cos(startAngle - Math.PI / 2) : 0),
26162
26448
  y: start.y + (isValidNumber$1(startAngle) ? refX * Math.sin(startAngle) + refY * Math.sin(startAngle - Math.PI / 2) : 0)
26163
- }, rotate = startAngle + Math.PI / 2) : (position = {
26449
+ }, rotate = this._computeRotate(startAngle)) : (position = {
26164
26450
  x: end.x + (isValidNumber$1(endAngle) ? refX * Math.cos(endAngle) + refY * Math.cos(endAngle - Math.PI / 2) : 0),
26165
26451
  y: end.y + (isValidNumber$1(endAngle) ? refX * Math.sin(endAngle) + refY * Math.sin(endAngle - Math.PI / 2) : 0)
26166
- }, rotate = endAngle + Math.PI / 2), symbol = graphicCreator.symbol(Object.assign(Object.assign(Object.assign({}, position), {
26452
+ }, rotate = this._computeRotate(endAngle)), symbol = graphicCreator.symbol(Object.assign(Object.assign(Object.assign({}, position), {
26167
26453
  symbolType: symbolType,
26168
26454
  size: size,
26169
26455
  angle: autoRotate ? rotate + refAngle : 0,
26170
26456
  strokeBoundsBuffer: 0
26171
- }), style)), symbol.name = `${this.name}-${dim}-symbol`, symbol.id = this._getNodeId(`${dim}-symbol`), isEmpty(null == state ? void 0 : state.symbol) || (symbol.states = state.symbol), this.add(symbol);
26457
+ }), style)), symbol.name = `${this.name}-${dim}-symbol`, symbol.id = this._getNodeId(`${dim}-symbol`), isEmpty(null == state ? void 0 : state.symbol) || (symbol.states = state.symbol), "start" === dim ? isEmpty(null == state ? void 0 : state.startSymbol) || (symbol.states = state.startSymbol) : isEmpty(null == state ? void 0 : state.endSymbol) || (symbol.states = state.endSymbol), this.add(symbol);
26172
26458
  }
26173
26459
  return symbol;
26174
26460
  }
@@ -26375,25 +26661,32 @@
26375
26661
  return scale(vector, (inside ? -1 : 1) * (axisInside ? -1 : 1) * offset / length(vector));
26376
26662
  }
26377
26663
 
26664
+ const dispatchHoverState = (e, container, lastHover) => {
26665
+ const target = e.target;
26666
+ return target !== lastHover && target.name && !isEmpty(target.states) ? (target.addState(StateValue.hover, !0), traverseGroup(container, node => {
26667
+ node !== target && node.name && !isEmpty(node.states) && node.addState(StateValue.hoverReverse, !0);
26668
+ }), target) : lastHover;
26669
+ };
26670
+ const dispatchUnHoverState = (e, container, lastHover) => lastHover ? (traverseGroup(container, node => {
26671
+ node.name && !isEmpty(node.states) && (node.removeState(StateValue.hoverReverse), node.removeState(StateValue.hover));
26672
+ }), null) : lastHover;
26673
+ const dispatchClickState = (e, container, lastSelect) => {
26674
+ const target = e.target;
26675
+ return lastSelect === target && target.hasState(StateValue.selected) ? (traverseGroup(container, node => {
26676
+ node.name && !isEmpty(node.states) && (node.removeState(StateValue.selectedReverse), node.removeState(StateValue.selected));
26677
+ }), null) : target.name && !isEmpty(target.states) ? (target.addState(StateValue.selected, !0), traverseGroup(container, node => {
26678
+ node !== target && node.name && !isEmpty(node.states) && node.addState(StateValue.selectedReverse, !0);
26679
+ }), target) : lastSelect;
26680
+ };
26681
+
26378
26682
  class AxisBase extends AbstractComponent {
26379
26683
  constructor() {
26380
26684
  super(...arguments), this.name = "axis", this.data = [], this.tickLineItems = [], this.subTickLineItems = [], this.axisLabelLayerSize = {}, this.axisLabelsContainer = null, this._onHover = e => {
26381
- const target = e.target;
26382
- target !== this._lastHover && target.name && !isEmpty(target.states) && (target.addState(StateValue.hover, !0), traverseGroup(this.axisContainer, node => {
26383
- node !== target && node.name && !isEmpty(node.states) && node.addState(StateValue.hoverReverse, !0);
26384
- }), this._lastHover = target);
26685
+ this._lastHover = dispatchHoverState(e, this.axisContainer, this._lastHover);
26385
26686
  }, this._onUnHover = e => {
26386
- this._lastHover && (traverseGroup(this.axisContainer, node => {
26387
- node.name && !isEmpty(node.states) && (node.removeState(StateValue.hoverReverse), node.removeState(StateValue.hover));
26388
- }), this._lastHover = null);
26687
+ this._lastHover = dispatchUnHoverState(e, this.axisContainer, this._lastHover);
26389
26688
  }, this._onClick = e => {
26390
- const target = e.target;
26391
- if (this._lastSelect === target && target.hasState(StateValue.selected)) return this._lastSelect = null, void traverseGroup(this.axisContainer, node => {
26392
- node.name && !isEmpty(node.states) && (node.removeState(StateValue.selectedReverse), node.removeState(StateValue.selected));
26393
- });
26394
- target.name && !isEmpty(target.states) && (target.addState(StateValue.selected, !0), traverseGroup(this.axisContainer, node => {
26395
- node !== target && node.name && !isEmpty(node.states) && node.addState(StateValue.selectedReverse, !0);
26396
- }), this._lastSelect = target);
26689
+ this._lastSelect = dispatchClickState(e, this.axisContainer, this._lastSelect);
26397
26690
  };
26398
26691
  }
26399
26692
  getInnerView() {
@@ -26520,9 +26813,9 @@
26520
26813
  });
26521
26814
  return labelGroup.name = `${AXIS_ELEMENT_NAME.labelContainer}-layer-${layer}`, labelGroup.id = this._getNodeId(`label-container-layer-${layer}`), container.add(labelGroup), data.forEach((item, index) => {
26522
26815
  var _a;
26523
- const labelStyle = this._getLabelAttribute(item, index, data, layer);
26524
- let text;
26525
- if (text = isRichText(labelStyle) ? graphicCreator.richtext(richTextAttributeTransform(labelStyle)) : graphicCreator.text(labelStyle), text.name = AXIS_ELEMENT_NAME.label, text.id = this._getNodeId(`layer${layer}-label-${item.id}`), isEmpty(null === (_a = this.attribute.label) || void 0 === _a ? void 0 : _a.state)) text.states = DEFAULT_STATES$2;else {
26816
+ const labelStyle = this._getLabelAttribute(item, index, data, layer),
26817
+ text = createTextGraphicByType(labelStyle);
26818
+ if (text.name = AXIS_ELEMENT_NAME.label, text.id = this._getNodeId(`layer${layer}-label-${item.id}`), isEmpty(null === (_a = this.attribute.label) || void 0 === _a ? void 0 : _a.state)) text.states = DEFAULT_STATES$2;else {
26526
26819
  const labelState = merge({}, DEFAULT_STATES$2, this.attribute.label.state);
26527
26820
  Object.keys(labelState).forEach(key => {
26528
26821
  isFunction$1(labelState[key]) && (labelState[key] = labelState[key](item, index, data, layer));
@@ -26663,6 +26956,7 @@
26663
26956
  layer: layer
26664
26957
  })), Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), {
26665
26958
  text: null != text ? text : textContent,
26959
+ _originText: tickDatum.label,
26666
26960
  lineHeight: null == textStyle ? void 0 : textStyle.fontSize,
26667
26961
  type: type
26668
26962
  }), textStyle);
@@ -27607,8 +27901,11 @@
27607
27901
  var _a, _b, _c, _d;
27608
27902
  const target = e.target;
27609
27903
  if (target && target.name && target.name.startsWith(LEGEND_ELEMENT_NAME.item)) {
27610
- const legendItem = target.delegate;
27611
- if (target.name === LEGEND_ELEMENT_NAME.focus) {
27904
+ const legendItem = target.delegate,
27905
+ {
27906
+ selectMode = "multiple"
27907
+ } = this.attribute;
27908
+ if (target.name === LEGEND_ELEMENT_NAME.focus || "focus" === selectMode) {
27612
27909
  const isFocusSelected = legendItem.hasState(LegendStateValue.focus);
27613
27910
  legendItem.toggleState(LegendStateValue.focus), isFocusSelected ? null === (_a = this._itemsContainer) || void 0 === _a || _a.getChildren().forEach(item => {
27614
27911
  this._removeLegendItemState(item, [LegendStateValue.unSelected, LegendStateValue.unSelectedHover, LegendStateValue.focus], e), this._setLegendItemState(item, LegendStateValue.selected, e);
@@ -27620,7 +27917,6 @@
27620
27917
  item.removeState(LegendStateValue.focus);
27621
27918
  });
27622
27919
  const {
27623
- selectMode = "multiple",
27624
27920
  allowAllCanceled = !0
27625
27921
  } = this.attribute,
27626
27922
  isSelected = legendItem.hasState(LegendStateValue.selected),
@@ -27817,8 +28113,7 @@
27817
28113
  shape.fill && isNil$3(shapeStyle.state[key].fill) && color && (shapeStyle.state[key].fill = color), shape.stroke && isNil$3(shapeStyle.state[key].stroke) && color && (shapeStyle.state[key].stroke = color);
27818
28114
  }), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state), itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(itemShape);
27819
28115
  }
27820
- let labelShape,
27821
- focusSpace = 0;
28116
+ let focusSpace = 0;
27822
28117
  if (focus) {
27823
28118
  const focusSize = get$5(focusIconStyle, "size", DEFAULT_SHAPE_SIZE);
27824
28119
  focusShape = graphicCreator.symbol(Object.assign(Object.assign({
@@ -27839,9 +28134,11 @@
27839
28134
  textBaseline: "middle",
27840
28135
  lineHeight: null === (_b = labelStyle.style) || void 0 === _b ? void 0 : _b.fontSize
27841
28136
  }, labelStyle.style), {
27842
- text: text
27843
- });
27844
- labelShape = isRichText(labelAttributes) ? graphicCreator.richtext(richTextAttributeTransform(labelAttributes)) : graphicCreator.text(labelAttributes), this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
28137
+ text: text,
28138
+ _originText: labelAttr.formatMethod ? label : void 0
28139
+ }),
28140
+ labelShape = createTextGraphicByType(labelAttributes);
28141
+ this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
27845
28142
  const labelSpace = get$5(labelAttr, "space", DEFAULT_LABEL_SPACE);
27846
28143
  if (isValid$3(value)) {
27847
28144
  const valueSpace = get$5(valueAttr, "space", focus ? DEFAULT_VALUE_SPACE : 0),
@@ -27853,10 +28150,11 @@
27853
28150
  textBaseline: "middle",
27854
28151
  lineHeight: valueStyle.style.fontSize
27855
28152
  }, valueStyle.style), {
27856
- text: valueText
27857
- });
27858
- let valueShape;
27859
- if (valueShape = isRichText(valueAttributes) ? graphicCreator.richtext(richTextAttributeTransform(valueAttributes)) : graphicCreator.text(valueAttributes), this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
28153
+ text: valueText,
28154
+ _originText: valueAttr.formatMethod ? value : void 0
28155
+ }),
28156
+ valueShape = createTextGraphicByType(valueAttributes);
28157
+ if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
27860
28158
  const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace;
27861
28159
  this._autoEllipsis(autoEllipsisStrategy, layoutWidth, labelShape, valueShape), valueAttr.alignRight ? valueShape.setAttributes({
27862
28160
  textAlign: "right",
@@ -29260,7 +29558,12 @@
29260
29558
  } = this.attribute;
29261
29559
  tooltip && tooltip.alwaysShow || (this._tooltipState = null, this._tooltipShape && this._tooltipShape.setAttribute("visible", !1), this._tooltipText && this._tooltipText.setAttribute("visible", !1), this._dispatchTooltipEvent("sliderTooltipHide"));
29262
29560
  }, this._onHandlerPointerdown = e => {
29263
- e.stopPropagation(), this._isChanging = !0, this._currentHandler = e.target, this._prePos = this._isHorizontal ? e.clientX : e.clientY, "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onHandlerPointerMove, {
29561
+ e.stopPropagation(), this._isChanging = !0;
29562
+ const {
29563
+ x: x,
29564
+ y: y
29565
+ } = this.stage.eventPointTransform(e);
29566
+ this._currentHandler = e.target, this._prePos = this._isHorizontal ? x : y, "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onHandlerPointerMove, {
29264
29567
  capture: !0
29265
29568
  }), vglobal.addEventListener("pointerup", this._onHandlerPointerUp)) : (this.stage.addEventListener("pointermove", this._onHandlerPointerMove, {
29266
29569
  capture: !0
@@ -29275,11 +29578,15 @@
29275
29578
  max: max
29276
29579
  } = this.attribute;
29277
29580
  if (max === min) return;
29581
+ const {
29582
+ x: x,
29583
+ y: y
29584
+ } = this.stage.eventPointTransform(e);
29278
29585
  let currentPos,
29279
29586
  originPos,
29280
29587
  railLen,
29281
29588
  delta = 0;
29282
- 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);
29589
+ this._isHorizontal ? (currentPos = x, delta = currentPos - this._prePos, originPos = null === (_b = this._currentHandler) || void 0 === _b ? void 0 : _b.attribute.x, railLen = railWidth) : (currentPos = y, delta = currentPos - this._prePos, originPos = null === (_a = this._currentHandler) || void 0 === _a ? void 0 : _a.attribute.y, railLen = railHeight);
29283
29590
  const newPos = clamp$3(originPos + delta, 0, railLen),
29284
29591
  currentValue = this.calculateValueByPos(newPos);
29285
29592
  "text" === this._currentHandler.type ? this._updateHandlerText(this._currentHandler, newPos, currentValue) : this._updateHandler(this._currentHandler, newPos, currentValue), this._updateTrack(), this._prePos = currentPos, this._dispatchChangeEvent();
@@ -29290,7 +29597,12 @@
29290
29597
  capture: !0
29291
29598
  }), this.stage.removeEventListener("pointerup", this._onHandlerPointerUp), this.stage.removeEventListener("pointerupoutside", this._onHandlerPointerUp));
29292
29599
  }, this._onTrackPointerdown = e => {
29293
- e.stopPropagation(), this._isChanging = !0, this._prePos = this._isHorizontal ? e.clientX : e.clientY, "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onTrackPointerMove, {
29600
+ e.stopPropagation(), this._isChanging = !0;
29601
+ const {
29602
+ x: x,
29603
+ y: y
29604
+ } = this.stage.eventPointTransform(e);
29605
+ this._prePos = this._isHorizontal ? x : y, "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onTrackPointerMove, {
29294
29606
  capture: !0
29295
29607
  }), vglobal.addEventListener("pointerup", this._onTrackPointerUp)) : (this.stage.addEventListener("pointermove", this._onTrackPointerMove, {
29296
29608
  capture: !0
@@ -29310,7 +29622,11 @@
29310
29622
  endHandler: endHandler
29311
29623
  } = this._getHandlers();
29312
29624
  let currentPos, trackLen, railLen;
29313
- this._isHorizontal ? (currentPos = e.clientX, trackLen = this._track.attribute.width, railLen = railWidth) : (currentPos = e.clientY, trackLen = this._track.attribute.height, railLen = railHeight);
29625
+ const {
29626
+ x: x,
29627
+ y: y
29628
+ } = this.stage.eventPointTransform(e);
29629
+ this._isHorizontal ? (currentPos = x, trackLen = this._track.attribute.width, railLen = railWidth) : (currentPos = y, trackLen = this._track.attribute.height, railLen = railHeight);
29314
29630
  const delta = currentPos - this._prePos;
29315
29631
  if (startHandler) {
29316
29632
  const originPos = this._isHorizontal ? startHandler.attribute.x : startHandler.attribute.y,
@@ -33097,7 +33413,9 @@
33097
33413
  const axisStylrAttrs = getAxisAttributes(this.option);
33098
33414
  const attrs = this.getUpdateAttribute();
33099
33415
  attrs.verticalFactor = this.orient === 'top' || this.orient === 'right' ? -1 : 1;
33100
- this.component = new LineAxis(merge({}, axisStylrAttrs, attrs));
33416
+ this.component = new LineAxis(merge({
33417
+ disableTriggerEvent: this.table.options.disableInteraction
33418
+ }, axisStylrAttrs, attrs));
33101
33419
  this.component.setAttributes(this.setLayoutStartPosition({ x: 0, y: 0 }));
33102
33420
  this.component.originAxis = this;
33103
33421
  }
@@ -37715,7 +38033,7 @@
37715
38033
  this.numberType = CHART_NUMBER_TYPE;
37716
38034
  this.isShareChartSpec = isShareChartSpec;
37717
38035
  if (!params.chartInstance) {
37718
- const chartInstance = new params.ClassType(params.spec, {
38036
+ const chartInstance = (this.chartInstance = new params.ClassType(params.spec, merge({}, this.attribute.tableChartOption, {
37719
38037
  renderCanvas: params.canvas,
37720
38038
  mode: this.attribute.mode === 'node' ? 'node' : 'desktop-browser',
37721
38039
  modeParams: this.attribute.modeParams,
@@ -37725,8 +38043,9 @@
37725
38043
  interactive: false,
37726
38044
  animation: false,
37727
38045
  autoFit: false
37728
- });
38046
+ })));
37729
38047
  chartInstance.renderSync();
38048
+ chartInstance.getStage().enableDirtyBounds();
37730
38049
  params.chartInstance = this.chartInstance = chartInstance;
37731
38050
  }
37732
38051
  else {
@@ -37744,34 +38063,53 @@
37744
38063
  y1: y1 - table.scrollTop,
37745
38064
  y2: y2 - table.scrollTop
37746
38065
  });
37747
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {
38066
+ this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, merge({}, this.attribute.tableChartOption, {
37748
38067
  renderCanvas: this.attribute.canvas,
37749
38068
  mode: 'desktop-browser',
37750
38069
  canvasControled: false,
37751
38070
  viewBox: {
37752
- x1: x1 - table.scrollLeft,
37753
- x2: x2 - table.scrollLeft,
37754
- y1: y1 - table.scrollTop,
37755
- y2: y2 - table.scrollTop
38071
+ x1: 0,
38072
+ x2: x2 - x1,
38073
+ y1: 0,
38074
+ y2: y2 - y1
37756
38075
  },
37757
38076
  dpr: table.internalProps.pixelRatio,
37758
38077
  animation: false,
37759
38078
  interactive: true,
37760
38079
  autoFit: false,
37761
- beforeRender: (stage) => {
37762
- const ctx = stage.window.getContext();
38080
+ beforeRender: (chartStage) => {
38081
+ const stage = this.stage;
38082
+ const ctx = chartStage.window.getContext();
38083
+ const stageMatrix = stage.window.getViewBoxTransform();
38084
+ const viewBox = stage.window.getViewBox();
37763
38085
  ctx.inuse = true;
37764
38086
  ctx.clearMatrix();
38087
+ ctx.setTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f, true);
38088
+ ctx.translate(viewBox.x1, viewBox.y1);
37765
38089
  ctx.setTransformForCurrent(true);
37766
38090
  ctx.beginPath();
37767
38091
  ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);
37768
38092
  ctx.clip();
38093
+ ctx.clearMatrix();
38094
+ if (!chartStage.needRender) {
38095
+ chartStage.pauseRender();
38096
+ table.scenegraph.stage.dirtyBounds.union(this.globalAABBBounds);
38097
+ table.scenegraph.updateNextFrame();
38098
+ }
37769
38099
  },
37770
38100
  afterRender(stage) {
37771
38101
  const ctx = stage.window.getContext();
37772
38102
  ctx.inuse = false;
38103
+ stage.needRender = false;
38104
+ chartStage.resumeRender();
37773
38105
  }
37774
- });
38106
+ }));
38107
+ const chartStage = this.activeChartInstance.getStage();
38108
+ const matrix = this.globalTransMatrix.clone();
38109
+ const stageMatrix = this.stage.window.getViewBoxTransform();
38110
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
38111
+ chartStage.window.setViewBoxTransform &&
38112
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
37775
38113
  this.activeChartInstance.renderSync();
37776
38114
  table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);
37777
38115
  this.activeChartInstance.on('click', (params) => {
@@ -37807,11 +38145,12 @@
37807
38145
  const cellGroup = this.parent;
37808
38146
  const padding = this.attribute.cellPadding;
37809
38147
  const table = this.stage.table;
38148
+ const { x1, y1, x2, y2 } = cellGroup.globalAABBBounds;
37810
38149
  return {
37811
- x1: Math.ceil(cellGroup.globalAABBBounds.x1 + padding[3] + table.scrollLeft),
37812
- x2: Math.ceil(cellGroup.globalAABBBounds.x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft),
37813
- y1: Math.ceil(cellGroup.globalAABBBounds.y1 + padding[0] + table.scrollTop),
37814
- y2: Math.ceil(cellGroup.globalAABBBounds.y1 + cellGroup.attribute.height - padding[2] + table.scrollTop)
38150
+ x1: Math.ceil(x1 + padding[3] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
38151
+ x2: Math.ceil(x1 + cellGroup.attribute.width - padding[1] + table.scrollLeft + (table.options.viewBox?.x1 ?? 0)),
38152
+ y1: Math.ceil(y1 + padding[0] + table.scrollTop + (table.options.viewBox?.y1 ?? 0)),
38153
+ y2: Math.ceil(y1 + cellGroup.attribute.height - padding[2] + table.scrollTop + (table.options.viewBox?.y1 ?? 0))
37815
38154
  };
37816
38155
  }
37817
38156
  }
@@ -37842,6 +38181,10 @@
37842
38181
  bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();
37843
38182
  bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();
37844
38183
  }
38184
+ bodyBound.x1 = bodyBound.x1 + (table.options.viewBox?.x1 ?? 0);
38185
+ bodyBound.x2 = bodyBound.x2 + (table.options.viewBox?.x1 ?? 0);
38186
+ bodyBound.y1 = bodyBound.y1 + (table.options.viewBox?.y1 ?? 0);
38187
+ bodyBound.y2 = bodyBound.y2 + (table.options.viewBox?.y1 ?? 0);
37845
38188
  return bodyBound;
37846
38189
  }
37847
38190
 
@@ -37923,7 +38266,8 @@
37923
38266
  data: table.getCellValue(col, row),
37924
38267
  cellPadding: padding,
37925
38268
  dpr: table.internalProps.pixelRatio,
37926
- axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : []
38269
+ axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : [],
38270
+ tableChartOption: table.options.chartOption
37927
38271
  });
37928
38272
  cellGroup.appendChild(chartGroup);
37929
38273
  table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
@@ -43501,48 +43845,65 @@
43501
43845
  if (viewBox.y2 <= viewBox.y1) {
43502
43846
  viewBox.y2 = viewBox.y1 + 1;
43503
43847
  }
43504
- axes?.forEach((axis, index) => {
43505
- if (axis.type === 'band') {
43506
- chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
43507
- }
43508
- else {
43509
- chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
43510
- }
43511
- });
43512
43848
  chartInstance.updateViewBox({
43513
- x1: viewBox.x1 - chart.getRootNode().table.scrollLeft,
43514
- x2: viewBox.x2 - chart.getRootNode().table.scrollLeft,
43515
- y1: viewBox.y1 - chart.getRootNode().table.scrollTop,
43516
- y2: viewBox.y2 - chart.getRootNode().table.scrollTop
43849
+ x1: 0,
43850
+ x2: viewBox.x2 - viewBox.x1,
43851
+ y1: 0,
43852
+ y2: viewBox.y2 - viewBox.y1
43517
43853
  }, false, false);
43518
- const table = chart.getRootNode().table;
43519
- table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
43520
- if (typeof dataId === 'string') {
43521
- chartInstance.updateDataSync(dataId, data ?? []);
43522
- }
43523
- else {
43524
- const dataBatch = [];
43525
- for (const dataIdStr in dataId) {
43526
- const dataIdAndField = dataId[dataIdStr];
43527
- const series = spec.series.find((item) => item?.data?.id === dataIdStr);
43528
- dataBatch.push({
43529
- id: dataIdStr,
43530
- values: dataIdAndField
43531
- ? data?.filter((item) => {
43532
- return item.hasOwnProperty(dataIdAndField);
43533
- }) ?? []
43534
- : data ?? [],
43535
- fields: series?.data?.fields
43536
- });
43537
- if (!chartInstance.updateFullDataSync) {
43538
- chartInstance.updateDataSync(dataIdStr, dataIdAndField
43539
- ? data?.filter((item) => {
43540
- return item.hasOwnProperty(dataIdAndField);
43541
- }) ?? []
43542
- : data ?? []);
43854
+ const chartStage = chartInstance.getStage();
43855
+ const matrix = chart.globalTransMatrix.clone();
43856
+ const stageMatrix = chart.stage.window.getViewBoxTransform();
43857
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
43858
+ chartStage.window.setViewBoxTransform &&
43859
+ chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
43860
+ const { table } = chart.getRootNode();
43861
+ let updateSpec = false;
43862
+ if (table.options.specFormat) {
43863
+ const formatResult = table.options.specFormat(chart.attribute.spec);
43864
+ if (formatResult.needFormatSpec && formatResult.spec) {
43865
+ const spec = formatResult.spec;
43866
+ chartInstance.updateSpecSync(spec);
43867
+ updateSpec = true;
43868
+ }
43869
+ }
43870
+ if (!updateSpec) {
43871
+ axes?.forEach((axis, index) => {
43872
+ if (axis.type === 'band') {
43873
+ chartInstance.updateModelSpec({ type: 'axes', index }, { domain: axis.domain.slice(0) }, true);
43874
+ }
43875
+ else {
43876
+ chartInstance.updateModelSpecSync({ type: 'axes', index }, { min: axis.range?.min ?? 0, max: axis.range?.max ?? 0 }, true);
43877
+ }
43878
+ });
43879
+ table.internalProps.layoutMap?.updateDataStateToActiveChartInstance?.(chartInstance);
43880
+ if (typeof dataId === 'string') {
43881
+ chartInstance.updateDataSync(dataId, data ?? []);
43882
+ }
43883
+ else {
43884
+ const dataBatch = [];
43885
+ for (const dataIdStr in dataId) {
43886
+ const dataIdAndField = dataId[dataIdStr];
43887
+ const series = spec.series.find((item) => item?.data?.id === dataIdStr);
43888
+ dataBatch.push({
43889
+ id: dataIdStr,
43890
+ values: dataIdAndField
43891
+ ? data?.filter((item) => {
43892
+ return item.hasOwnProperty(dataIdAndField);
43893
+ }) ?? []
43894
+ : data ?? [],
43895
+ fields: series?.data?.fields
43896
+ });
43897
+ if (!chartInstance.updateFullDataSync) {
43898
+ chartInstance.updateDataSync(dataIdStr, dataIdAndField
43899
+ ? data?.filter((item) => {
43900
+ return item.hasOwnProperty(dataIdAndField);
43901
+ }) ?? []
43902
+ : data ?? []);
43903
+ }
43543
43904
  }
43905
+ chartInstance.updateFullDataSync?.(dataBatch);
43544
43906
  }
43545
- chartInstance.updateFullDataSync?.(dataBatch);
43546
43907
  }
43547
43908
  const sg = chartInstance.getStage();
43548
43909
  cacheStageCanvas(sg, chart);
@@ -43604,7 +43965,7 @@
43604
43965
  }
43605
43966
 
43606
43967
  const ChartRender = Symbol.for('ChartRender');
43607
- let DefaultCanvasChartRender = class DefaultCanvasChartRender {
43968
+ let DefaultCanvasChartRender = class DefaultCanvasChartRender extends BaseRender {
43608
43969
  type;
43609
43970
  numberType = CHART_NUMBER_TYPE;
43610
43971
  drawShape(chart, context, x, y, drawContext, params, fillCb, strokeCb) {
@@ -43612,6 +43973,7 @@
43612
43973
  const { dataId, data, spec } = chart.attribute;
43613
43974
  chart.getViewBox();
43614
43975
  const { width = groupAttribute.width, height = groupAttribute.height } = chart.attribute;
43976
+ const { table } = chart.getRootNode();
43615
43977
  const { active, cacheCanvas, activeChartInstance } = chart;
43616
43978
  if (!active && cacheCanvas) {
43617
43979
  if (isArray$3(cacheCanvas)) {
@@ -43625,6 +43987,27 @@
43625
43987
  }
43626
43988
  }
43627
43989
  else if (activeChartInstance) {
43990
+ if (table.options.specFormat) {
43991
+ const formatResult = table.options.specFormat(chart.attribute.spec);
43992
+ if (formatResult.needFormatSpec && formatResult.spec) {
43993
+ const spec = formatResult.spec;
43994
+ activeChartInstance.updateSpecSync(spec);
43995
+ return;
43996
+ }
43997
+ }
43998
+ const viewBox = chart.getViewBox();
43999
+ activeChartInstance.updateViewBox({
44000
+ x1: 0,
44001
+ x2: viewBox.x2 - viewBox.x1,
44002
+ y1: 0,
44003
+ y2: viewBox.y2 - viewBox.y1
44004
+ }, false, false);
44005
+ const chartStage = activeChartInstance.getStage();
44006
+ chartStage.needRender = true;
44007
+ const matrix = chart.globalTransMatrix.clone();
44008
+ const stageMatrix = chart.stage.window.getViewBoxTransform().clone();
44009
+ stageMatrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
44010
+ chartStage.window.setViewBoxTransform(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f);
43628
44011
  if (typeof dataId === 'string') {
43629
44012
  activeChartInstance.updateDataSync(dataId, data ?? []);
43630
44013
  }
@@ -43654,13 +44037,13 @@
43654
44037
  }
43655
44038
  }
43656
44039
  else {
43657
- if (chart.getRootNode().table.internalProps.renderChartAsync) {
44040
+ if (table.internalProps.renderChartAsync) {
43658
44041
  if (chartRenderKeys.indexOf(`${chart.parent.col}+${chart.parent.row}`) === -1) {
43659
44042
  chartRenderKeys.push(`${chart.parent.col}+${chart.parent.row}`);
43660
44043
  chartRenderQueueList.push(chart);
43661
44044
  }
43662
44045
  if (!IsHandlingChartQueue()) {
43663
- startRenderChartQueue(chart.getRootNode().table);
44046
+ startRenderChartQueue(table);
43664
44047
  }
43665
44048
  }
43666
44049
  else {
@@ -43669,31 +44052,7 @@
43669
44052
  }
43670
44053
  }
43671
44054
  draw(chart, renderService, drawContext, params) {
43672
- const { context } = drawContext;
43673
- if (!context) {
43674
- return;
43675
- }
43676
- const { clip } = chart.attribute;
43677
- if (clip) {
43678
- context.save();
43679
- }
43680
- else {
43681
- context.highPerformanceSave();
43682
- }
43683
- context.transformFromMatrix(chart.transMatrix, true);
43684
- context.beginPath();
43685
- if (params.skipDraw) {
43686
- this.drawShape(chart, context, 0, 0, drawContext, params, () => false, () => false);
43687
- }
43688
- else {
43689
- this.drawShape(chart, context, 0, 0, drawContext);
43690
- }
43691
- if (clip) {
43692
- context.restore();
43693
- }
43694
- else {
43695
- context.highPerformanceRestore();
43696
- }
44055
+ this._draw(chart, {}, false, drawContext, params);
43697
44056
  }
43698
44057
  };
43699
44058
  DefaultCanvasChartRender = __decorate([
@@ -48333,6 +48692,15 @@
48333
48692
  });
48334
48693
  }
48335
48694
  }
48695
+ function clearCellChartCacheImage(col, row, scenegraph) {
48696
+ const cellGroup = scenegraph.getCell(col, row);
48697
+ cellGroup.children.forEach((node) => {
48698
+ if (node.type === 'chart') {
48699
+ node.cacheCanvas = null;
48700
+ node.addUpdateBoundTag();
48701
+ }
48702
+ });
48703
+ }
48336
48704
  function updateChartData(scenegraph) {
48337
48705
  const table = scenegraph.table;
48338
48706
  for (let c = scenegraph.proxy.colStart; c <= scenegraph.proxy.colEnd; c++) {
@@ -49118,6 +49486,44 @@
49118
49486
  }
49119
49487
  }
49120
49488
 
49489
+ function dealWithAnimationAppear(table) {
49490
+ if (!table.options.animationAppear) {
49491
+ return;
49492
+ }
49493
+ let duration;
49494
+ let delay;
49495
+ let type;
49496
+ let direction;
49497
+ if (table.options.animationAppear === true) {
49498
+ duration = 500;
49499
+ delay = 0;
49500
+ type = 'one-by-one';
49501
+ direction = 'column';
49502
+ }
49503
+ else {
49504
+ duration = table.options.animationAppear.duration ?? 500;
49505
+ delay = table.options.animationAppear.delay ?? 0;
49506
+ type = table.options.animationAppear.type ?? 'one-by-one';
49507
+ direction = table.options.animationAppear.direction ?? 'row';
49508
+ }
49509
+ const { scenegraph: scene, frozenColCount, frozenRowCount } = table;
49510
+ const { colStart, colEnd, rowStart, rowEnd } = scene.proxy;
49511
+ for (let col = 0; col <= colEnd; col++) {
49512
+ for (let row = 0; row <= rowEnd; row++) {
49513
+ const cellGroup = scene.highPerformanceGetCell(col, row);
49514
+ if (cellGroup && cellGroup.role === 'cell') {
49515
+ cellGroup.forEachChildren((child) => {
49516
+ child.setAttribute('opacity', 0);
49517
+ child
49518
+ .animate()
49519
+ .wait(type === 'one-by-one' ? (direction === 'row' ? row : col) * (duration - delay) : delay)
49520
+ .to({ opacity: 1 }, duration, 'linear');
49521
+ });
49522
+ }
49523
+ }
49524
+ }
49525
+ }
49526
+
49121
49527
  registerForVrender();
49122
49528
  loadPoptip();
49123
49529
  container.load(splitModule);
@@ -49157,7 +49563,12 @@
49157
49563
  setPoptipTheme(this.table.theme.textPopTipStyle);
49158
49564
  let width;
49159
49565
  let height;
49160
- if (Env.mode === 'node') {
49566
+ if (table.options.canvas && table.options.viewBox) {
49567
+ vglobal.setEnv('browser');
49568
+ width = table.options.viewBox.x2 - table.options.viewBox.x1;
49569
+ height = table.options.viewBox.y2 - table.options.viewBox.y1;
49570
+ }
49571
+ else if (Env.mode === 'node') {
49161
49572
  vglobal.setEnv('node', table.options.modeParams);
49162
49573
  width = table.canvasWidth;
49163
49574
  height = table.canvasHeight;
@@ -49175,9 +49586,16 @@
49175
49586
  background: table.theme.underlayBackgroundColor,
49176
49587
  dpr: table.internalProps.pixelRatio,
49177
49588
  enableLayout: true,
49178
- afterRender: () => {
49589
+ beforeRender: (stage) => {
49590
+ this.table.options.beforeRender && this.table.options.beforeRender(stage);
49591
+ },
49592
+ afterRender: (stage) => {
49593
+ this.table.options.afterRender && this.table.options.afterRender(stage);
49179
49594
  this.table.fireListeners('after_render', null);
49180
- }
49595
+ },
49596
+ canvasControled: !table.options.canvas,
49597
+ viewBox: table.options.viewBox,
49598
+ ...table.options.renderOption
49181
49599
  });
49182
49600
  this.stage.defaultLayer.setTheme({
49183
49601
  group: {
@@ -49911,6 +50329,9 @@
49911
50329
  this.updateBorderSizeAndPosition();
49912
50330
  this.component.updateScrollBar();
49913
50331
  handleTextStick(this.table);
50332
+ if (this.table.options.animationAppear) {
50333
+ dealWithAnimationAppear(this.table);
50334
+ }
49914
50335
  this.updateNextFrame();
49915
50336
  }
49916
50337
  dealWidthMode() {
@@ -53028,8 +53449,8 @@
53028
53449
  function getCellEventArgsSet(e) {
53029
53450
  const tableEvent = {
53030
53451
  abstractPos: {
53031
- x: e.x,
53032
- y: e.y
53452
+ x: e.viewport.x,
53453
+ y: e.viewport.y
53033
53454
  }
53034
53455
  };
53035
53456
  const targetCell = getTargetCell(e.target);
@@ -54294,12 +54715,14 @@
54294
54715
  e.preventDefault();
54295
54716
  }
54296
54717
  });
54297
- handler.on(table.getContainer(), 'resize', e => {
54298
- if (e.width === 0 && e.height === 0) {
54299
- return;
54300
- }
54301
- table.resize();
54302
- });
54718
+ if (!table.options.canvas) {
54719
+ handler.on(table.getContainer(), 'resize', e => {
54720
+ if (e.width === 0 && e.height === 0) {
54721
+ return;
54722
+ }
54723
+ table.resize();
54724
+ });
54725
+ }
54303
54726
  function pasteHtmlToTable(item) {
54304
54727
  const ranges = table.stateManager.select.ranges;
54305
54728
  const selectRangeLength = ranges.length;
@@ -54842,7 +55265,7 @@
54842
55265
  this.table = table;
54843
55266
  this.handleTextStickBindId = [];
54844
55267
  this.inertiaScroll = new InertiaScroll(table.stateManager);
54845
- if (Env.mode === 'node') {
55268
+ if (Env.mode === 'node' || table.options.disableInteraction) {
54846
55269
  return;
54847
55270
  }
54848
55271
  this.bindOuterEvent();
@@ -57355,6 +57778,7 @@
57355
57778
  }
57356
57779
 
57357
57780
  class FocusInput extends EventTarget {
57781
+ _container;
57358
57782
  _table;
57359
57783
  _input;
57360
57784
  constructor(table, parentElement) {
@@ -57374,6 +57798,7 @@
57374
57798
  input.dataset.vtable = 'vtable';
57375
57799
  input.readOnly = true;
57376
57800
  parentElement.appendChild(div);
57801
+ this._container = div;
57377
57802
  }
57378
57803
  focus() {
57379
57804
  this._input.focus({ preventScroll: true });
@@ -57393,6 +57818,7 @@
57393
57818
  return this._input;
57394
57819
  }
57395
57820
  release() {
57821
+ this._container.parentElement?.removeChild(this._container);
57396
57822
  }
57397
57823
  }
57398
57824
 
@@ -57526,7 +57952,8 @@
57526
57952
  height: this.table.tableNoFrameHeight
57527
57953
  });
57528
57954
  const legend = new DiscreteLegend(merge({}, attrs, {
57529
- defaultSelected: this.selectedData
57955
+ defaultSelected: this.selectedData,
57956
+ disableTriggerEvent: this.table.options.disableInteraction
57530
57957
  }));
57531
57958
  legend.name = 'legend';
57532
57959
  this.legendComponent = legend;
@@ -58441,7 +58868,7 @@
58441
58868
  return TABLE_EVENT_TYPE;
58442
58869
  }
58443
58870
  options;
58444
- version = "1.0.0";
58871
+ version = "1.0.1-beta.0";
58445
58872
  pagination;
58446
58873
  id = `VTable${Date.now()}`;
58447
58874
  headerStyleCache;
@@ -58454,7 +58881,7 @@
58454
58881
  columnWidthComputeMode;
58455
58882
  constructor(container, options = {}) {
58456
58883
  super();
58457
- if (!container && options.mode !== 'node') {
58884
+ if (!container && options.mode !== 'node' && !options.canvas) {
58458
58885
  throw new Error("vtable's container is undefined");
58459
58886
  }
58460
58887
  const { frozenColCount = 0, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth, widthMode = 'standard', heightMode = 'standard', autoFillWidth = false, autoFillHeight = false, widthAdaptiveMode = 'only-body', heightAdaptiveMode = 'only-body', keyboardOptions, eventOptions, rowSeriesNumber, columnResizeMode, rowResizeMode = 'none', dragHeaderMode, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, customRender, pixelRatio = defaultPixelRatio, renderChartAsync, renderChartAsyncBatchCount, mode, modeParams, canvasWidth, canvasHeight, overscrollBehavior, limitMinWidth, limitMinHeight, clearDOM = true } = options;
@@ -58492,7 +58919,14 @@
58492
58919
  if (typeof allowFrozenColCount === 'number' && allowFrozenColCount <= 0) {
58493
58920
  this.showFrozenIcon = false;
58494
58921
  }
58495
- if (Env.mode !== 'node') {
58922
+ if (this.options.canvas) {
58923
+ internalProps.element = this.options.canvas.parentElement;
58924
+ internalProps.element.style.position = 'relative';
58925
+ internalProps.focusControl = new FocusInput(this, internalProps.element);
58926
+ internalProps.canvas = this.options.canvas;
58927
+ internalProps.context = internalProps.canvas.getContext('2d');
58928
+ }
58929
+ else if (Env.mode !== 'node') {
58496
58930
  internalProps.element = createRootElement(this.padding);
58497
58931
  internalProps.focusControl = new FocusInput(this, internalProps.element);
58498
58932
  internalProps.canvas = document.createElement('canvas');
@@ -58862,7 +59296,21 @@
58862
59296
  const { padding } = this;
58863
59297
  let widthP = 0;
58864
59298
  let heightP = 0;
58865
- if (Env.mode === 'browser') {
59299
+ this.tableX = 0;
59300
+ this.tableY = 0;
59301
+ if (this.options.canvas && this.options.viewBox) {
59302
+ widthP = this.options.viewBox.x2 - this.options.viewBox.x1;
59303
+ heightP = this.options.viewBox.y2 - this.options.viewBox.y1;
59304
+ if (this?.scenegraph?.stage) {
59305
+ if (this.options.viewBox) {
59306
+ this.scenegraph.stage.setViewBox(this.options.viewBox, false);
59307
+ }
59308
+ else {
59309
+ this.scenegraph.stage.resize(widthP, heightP);
59310
+ }
59311
+ }
59312
+ }
59313
+ else if (Env.mode === 'browser') {
58866
59314
  const element = this.getElement();
58867
59315
  let widthWithoutPadding = 0;
58868
59316
  let heightWithoutPadding = 0;
@@ -58921,6 +59369,22 @@
58921
59369
  }
58922
59370
  }
58923
59371
  }
59372
+ updateViewBox(newViewBox) {
59373
+ const oldWidth = this.options?.viewBox.x2 ?? 0 - this.options?.viewBox.x1 ?? 0;
59374
+ const oldHeight = this.options?.viewBox.y2 ?? 0 - this.options?.viewBox.y1 ?? 0;
59375
+ const newWidth = newViewBox.x2 - newViewBox.x1;
59376
+ const newHeight = newViewBox.y2 - newViewBox.y1;
59377
+ this.options.viewBox = newViewBox;
59378
+ if (oldWidth !== newWidth || oldHeight !== newHeight) {
59379
+ this.resize();
59380
+ }
59381
+ else {
59382
+ this.scenegraph.stage.setViewBox(this.options.viewBox, true);
59383
+ }
59384
+ }
59385
+ setViewBoxTransform(a, b, c, d, e, f) {
59386
+ this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
59387
+ }
58924
59388
  get rowHierarchyType() {
58925
59389
  return 'grid';
58926
59390
  }
@@ -59466,6 +59930,8 @@
59466
59930
  const visibleRect = this.getVisibleRect();
59467
59931
  rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0));
59468
59932
  rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0));
59933
+ rect.offsetLeft(this.options.viewBox?.x1 ?? 0);
59934
+ rect.offsetTop(this.options.viewBox?.y1 ?? 0);
59469
59935
  return rect;
59470
59936
  }
59471
59937
  getVisibleRect() {
@@ -59619,8 +60085,9 @@
59619
60085
  }
59620
60086
  this.scenegraph.stage.release();
59621
60087
  this.scenegraph.proxy.release();
60088
+ internalProps.focusControl.release();
59622
60089
  const { parentElement } = internalProps.element;
59623
- if (parentElement) {
60090
+ if (parentElement && !this.options.canvas) {
59624
60091
  parentElement.removeChild(internalProps.element);
59625
60092
  }
59626
60093
  this.editorManager?.editingEditor?.onEnd?.();
@@ -59822,8 +60289,8 @@
59822
60289
  const currentHeight = rect.height;
59823
60290
  const originHeight = this.canvas.offsetHeight || currentHeight;
59824
60291
  const heightRatio = currentHeight / originHeight;
59825
- const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0);
59826
- const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0);
60292
+ const x = (clientX - rect.left) / widthRatio + (isAddScroll ? table.scrollLeft : 0) - (this.options.viewBox?.x1 ?? 0);
60293
+ const y = (clientY - rect.top) / heightRatio + (isAddScroll ? table.scrollTop : 0) - (this.options.viewBox?.y1 ?? 0);
59827
60294
  return { x, y, inTable };
59828
60295
  }
59829
60296
  getTheme() {
@@ -70864,6 +71331,14 @@
70864
71331
  updateChartData(this.scenegraph);
70865
71332
  this.render();
70866
71333
  }
71334
+ clearChartCacheImage(col, row) {
71335
+ if (isNumber$4(col) && isNumber$4(row)) {
71336
+ clearCellChartCacheImage(col, row, this.scenegraph);
71337
+ }
71338
+ else {
71339
+ clearChartCacheImage(this.scenegraph);
71340
+ }
71341
+ }
70867
71342
  getLegendSelected() {
70868
71343
  return this.internalProps.legends.legendComponent._getSelectedLegends().map((d) => d.label);
70869
71344
  }
@@ -71647,7 +72122,7 @@
71647
72122
  }
71648
72123
 
71649
72124
  registerForVrender();
71650
- const version = "1.0.0";
72125
+ const version = "1.0.1-beta.0";
71651
72126
  function getIcons() {
71652
72127
  return get$2();
71653
72128
  }