@visactor/vtable 0.18.4 → 0.19.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 (161) hide show
  1. package/cjs/ListTable.d.ts +1 -1
  2. package/cjs/ListTable.js +7 -5
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotTable.d.ts +2 -2
  5. package/cjs/PivotTable.js.map +1 -1
  6. package/cjs/core/BaseTable.d.ts +3 -2
  7. package/cjs/core/BaseTable.js +14 -31
  8. package/cjs/core/BaseTable.js.map +1 -1
  9. package/cjs/edit/edit-manager.d.ts +1 -1
  10. package/cjs/edit/edit-manager.js +30 -13
  11. package/cjs/edit/edit-manager.js.map +1 -1
  12. package/cjs/event/event.js +2 -2
  13. package/cjs/event/event.js.map +1 -1
  14. package/cjs/event/listener/table-group.js +1 -1
  15. package/cjs/event/listener/table-group.js.map +1 -1
  16. package/cjs/icons.js +10 -0
  17. package/cjs/icons.js.map +1 -1
  18. package/cjs/index.d.ts +1 -1
  19. package/cjs/index.js +1 -1
  20. package/cjs/index.js.map +1 -1
  21. package/cjs/layout/{pivot-layout-helper.d.ts → layout-helper.d.ts} +18 -16
  22. package/cjs/layout/{pivot-layout-helper.js → layout-helper.js} +33 -16
  23. package/cjs/layout/layout-helper.js.map +1 -0
  24. package/cjs/layout/pivot-header-layout.d.ts +4 -4
  25. package/cjs/layout/pivot-header-layout.js +42 -10
  26. package/cjs/layout/pivot-header-layout.js.map +1 -1
  27. package/cjs/layout/row-height-map.d.ts +32 -0
  28. package/cjs/layout/row-height-map.js +144 -0
  29. package/cjs/layout/row-height-map.js.map +1 -0
  30. package/cjs/layout/simple-header-layout.d.ts +2 -0
  31. package/cjs/layout/simple-header-layout.js +8 -3
  32. package/cjs/layout/simple-header-layout.js.map +1 -1
  33. package/cjs/scenegraph/component/cell-mover.js +3 -5
  34. package/cjs/scenegraph/component/cell-mover.js.map +1 -1
  35. package/cjs/scenegraph/graphic/contributions/draw-interceptor.d.ts +13 -0
  36. package/cjs/scenegraph/graphic/contributions/draw-interceptor.js +90 -0
  37. package/cjs/scenegraph/graphic/contributions/draw-interceptor.js.map +1 -0
  38. package/cjs/scenegraph/graphic/contributions/index.js +4 -2
  39. package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
  40. package/cjs/scenegraph/group-creater/cell-type/image-cell.js +38 -18
  41. package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  42. package/cjs/scenegraph/group-creater/progress/proxy.js +3 -3
  43. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  44. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -2
  45. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  46. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +3 -3
  47. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  48. package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.d.ts +1 -1
  49. package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js +9 -3
  50. package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
  51. package/cjs/scenegraph/layout/compute-row-height.js +14 -4
  52. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  53. package/cjs/scenegraph/layout/move-cell.js +7 -1
  54. package/cjs/scenegraph/layout/move-cell.js.map +1 -1
  55. package/cjs/scenegraph/layout/update-height.js +2 -2
  56. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  57. package/cjs/scenegraph/layout/update-row.js +6 -10
  58. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  59. package/cjs/scenegraph/scenegraph.js +16 -9
  60. package/cjs/scenegraph/scenegraph.js.map +1 -1
  61. package/cjs/scenegraph/stick-text/index.js +5 -5
  62. package/cjs/scenegraph/stick-text/index.js.map +1 -1
  63. package/cjs/scenegraph/utils/keep-aspect-ratio.js +5 -4
  64. package/cjs/scenegraph/utils/keep-aspect-ratio.js.map +1 -1
  65. package/cjs/state/cell-move/index.js +6 -4
  66. package/cjs/state/cell-move/index.js.map +1 -1
  67. package/cjs/state/select/update-position.js +10 -1
  68. package/cjs/state/select/update-position.js.map +1 -1
  69. package/cjs/themes/ARCO.js +2 -1
  70. package/cjs/tools/LimitPromiseQueue.js +1 -1
  71. package/cjs/tools/util.d.ts +1 -0
  72. package/cjs/tools/util.js +8 -2
  73. package/cjs/tools/util.js.map +1 -1
  74. package/cjs/ts-types/base-table.d.ts +5 -3
  75. package/cjs/ts-types/base-table.js.map +1 -1
  76. package/cjs/ts-types/table-engine.d.ts +1 -0
  77. package/cjs/ts-types/table-engine.js.map +1 -1
  78. package/cjs/vrender.js.map +1 -1
  79. package/dist/vtable.js +1439 -811
  80. package/dist/vtable.min.js +2 -2
  81. package/es/ListTable.d.ts +1 -1
  82. package/es/ListTable.js +5 -4
  83. package/es/ListTable.js.map +1 -1
  84. package/es/PivotTable.d.ts +2 -2
  85. package/es/PivotTable.js.map +1 -1
  86. package/es/core/BaseTable.d.ts +3 -2
  87. package/es/core/BaseTable.js +16 -28
  88. package/es/core/BaseTable.js.map +1 -1
  89. package/es/edit/edit-manager.d.ts +1 -1
  90. package/es/edit/edit-manager.js +30 -13
  91. package/es/edit/edit-manager.js.map +1 -1
  92. package/es/event/event.js +3 -1
  93. package/es/event/event.js.map +1 -1
  94. package/es/event/listener/table-group.js +1 -1
  95. package/es/event/listener/table-group.js.map +1 -1
  96. package/es/icons.js +10 -0
  97. package/es/icons.js.map +1 -1
  98. package/es/index.d.ts +1 -1
  99. package/es/index.js +1 -1
  100. package/es/index.js.map +1 -1
  101. package/es/layout/{pivot-layout-helper.d.ts → layout-helper.d.ts} +18 -16
  102. package/es/layout/{pivot-layout-helper.js → layout-helper.js} +33 -16
  103. package/es/layout/layout-helper.js.map +1 -0
  104. package/es/layout/pivot-header-layout.d.ts +4 -4
  105. package/es/layout/pivot-header-layout.js +34 -2
  106. package/es/layout/pivot-header-layout.js.map +1 -1
  107. package/es/layout/row-height-map.d.ts +32 -0
  108. package/es/layout/row-height-map.js +136 -0
  109. package/es/layout/row-height-map.js.map +1 -0
  110. package/es/layout/simple-header-layout.d.ts +2 -0
  111. package/es/layout/simple-header-layout.js +9 -2
  112. package/es/layout/simple-header-layout.js.map +1 -1
  113. package/es/scenegraph/component/cell-mover.js +3 -5
  114. package/es/scenegraph/component/cell-mover.js.map +1 -1
  115. package/es/scenegraph/graphic/contributions/draw-interceptor.d.ts +13 -0
  116. package/es/scenegraph/graphic/contributions/draw-interceptor.js +64 -0
  117. package/es/scenegraph/graphic/contributions/draw-interceptor.js.map +1 -0
  118. package/es/scenegraph/graphic/contributions/index.js +5 -2
  119. package/es/scenegraph/graphic/contributions/index.js.map +1 -1
  120. package/es/scenegraph/group-creater/cell-type/image-cell.js +35 -17
  121. package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  122. package/es/scenegraph/group-creater/progress/proxy.js +3 -3
  123. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  124. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -2
  125. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  126. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +3 -3
  127. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  128. package/es/scenegraph/group-creater/progress/update-position/update-auto-row.d.ts +1 -1
  129. package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js +9 -3
  130. package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
  131. package/es/scenegraph/layout/compute-row-height.js +14 -4
  132. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  133. package/es/scenegraph/layout/move-cell.js +7 -1
  134. package/es/scenegraph/layout/move-cell.js.map +1 -1
  135. package/es/scenegraph/layout/update-height.js +2 -2
  136. package/es/scenegraph/layout/update-height.js.map +1 -1
  137. package/es/scenegraph/layout/update-row.js +4 -8
  138. package/es/scenegraph/layout/update-row.js.map +1 -1
  139. package/es/scenegraph/scenegraph.js +16 -9
  140. package/es/scenegraph/scenegraph.js.map +1 -1
  141. package/es/scenegraph/stick-text/index.js +5 -5
  142. package/es/scenegraph/stick-text/index.js.map +1 -1
  143. package/es/scenegraph/utils/keep-aspect-ratio.js +5 -4
  144. package/es/scenegraph/utils/keep-aspect-ratio.js.map +1 -1
  145. package/es/state/cell-move/index.js +6 -4
  146. package/es/state/cell-move/index.js.map +1 -1
  147. package/es/state/select/update-position.js +10 -1
  148. package/es/state/select/update-position.js.map +1 -1
  149. package/es/themes/ARCO.js +2 -1
  150. package/es/tools/LimitPromiseQueue.js +1 -1
  151. package/es/tools/util.d.ts +1 -0
  152. package/es/tools/util.js +6 -0
  153. package/es/tools/util.js.map +1 -1
  154. package/es/ts-types/base-table.d.ts +5 -3
  155. package/es/ts-types/base-table.js.map +1 -1
  156. package/es/ts-types/table-engine.d.ts +1 -0
  157. package/es/ts-types/table-engine.js.map +1 -1
  158. package/es/vrender.js.map +1 -1
  159. package/package.json +7 -7
  160. package/cjs/layout/pivot-layout-helper.js.map +0 -1
  161. package/es/layout/pivot-layout-helper.js.map +0 -1
package/dist/vtable.js CHANGED
@@ -1329,14 +1329,14 @@
1329
1329
  const isDate = value => isType$1(value, "Date");
1330
1330
  var isDate$1 = isDate;
1331
1331
 
1332
- const isNumber$2 = function (value) {
1332
+ const isNumber$1 = function (value) {
1333
1333
  let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1334
1334
  const type = typeof value;
1335
1335
  return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
1336
1336
  };
1337
- var isNumber$3 = isNumber$2;
1337
+ var isNumber$2 = isNumber$1;
1338
1338
 
1339
- const isValidNumber = value => isNumber$3(value) && Number.isFinite(value);
1339
+ const isValidNumber = value => isNumber$2(value) && Number.isFinite(value);
1340
1340
  var isValidNumber$1 = isValidNumber;
1341
1341
 
1342
1342
  const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
@@ -1382,7 +1382,7 @@
1382
1382
  if (!isValid$1(value) || "object" != typeof value) return value;
1383
1383
  const isArr = isArray$1(value),
1384
1384
  length = value.length;
1385
- result = isArr ? new Array(length) : "object" == typeof value ? {} : isBoolean$2(value) || isNumber$3(value) || isString$2(value) ? value : isDate$1(value) ? new Date(+value) : void 0;
1385
+ result = isArr ? new Array(length) : "object" == typeof value ? {} : isBoolean$2(value) || isNumber$2(value) || isString$2(value) ? value : isDate$1(value) ? new Date(+value) : void 0;
1386
1386
  const props = isArr ? void 0 : Object.keys(Object(value));
1387
1387
  let index = -1;
1388
1388
  if (result) for (; ++index < (props || value).length;) {
@@ -1767,10 +1767,10 @@
1767
1767
  return this.x = x, this.y = y, this;
1768
1768
  }
1769
1769
  add(point) {
1770
- return isNumber$3(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
1770
+ return isNumber$2(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
1771
1771
  }
1772
1772
  sub(point) {
1773
- return isNumber$3(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
1773
+ return isNumber$2(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
1774
1774
  }
1775
1775
  multi(point) {
1776
1776
  throw new Error("暂不支持");
@@ -2357,10 +2357,10 @@
2357
2357
  return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
2358
2358
  }
2359
2359
  function rgb(value) {
2360
- return isNumber$3(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
2360
+ return isNumber$2(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
2361
2361
  }
2362
2362
  function rgba(value) {
2363
- return isNumber$3(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
2363
+ return isNumber$2(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
2364
2364
  }
2365
2365
  function SRGBToLinear(c) {
2366
2366
  return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
@@ -2929,7 +2929,7 @@
2929
2929
  }(LoggerLevel || (LoggerLevel = {}));
2930
2930
  class Logger {
2931
2931
  static getInstance(level, method) {
2932
- return Logger._instance && isNumber$3(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
2932
+ return Logger._instance && isNumber$2(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
2933
2933
  }
2934
2934
  static setInstance(logger) {
2935
2935
  return Logger._instance = logger;
@@ -4726,9 +4726,6 @@
4726
4726
  function wrapCanvas(params) {
4727
4727
  return container.getNamed(CanvasFactory, application.global.env)(params);
4728
4728
  }
4729
- function isNumber$1(data) {
4730
- return "number" == typeof data && Number.isFinite(data);
4731
- }
4732
4729
 
4733
4730
  class DefaultCanvasAllocate {
4734
4731
  constructor() {
@@ -5154,7 +5151,7 @@
5154
5151
  }
5155
5152
  const globalTheme = new Theme();
5156
5153
  function getTheme(graphic, theme) {
5157
- return graphic.glyphHost ? getTheme(graphic.glyphHost) : theme ? (graphic.isContainer, theme) : getThemeFromGroup(graphic) || globalTheme.getTheme();
5154
+ return graphic.glyphHost ? getTheme(graphic.glyphHost) : theme ? (graphic.isContainer, theme) : getThemeFromGroup(graphic) || graphic.attachedThemeGraphic && getTheme(graphic.attachedThemeGraphic) || globalTheme.getTheme();
5158
5155
  }
5159
5156
  function getThemeFromGroup(graphic) {
5160
5157
  let g;
@@ -5324,7 +5321,7 @@
5324
5321
  let child = this._firstChild;
5325
5322
  for (; child;) {
5326
5323
  const next = child._next;
5327
- child.parent = null, child._prev = null, child._next = null, child = next;
5324
+ child.parent = null, child._prev = null, child._next = null, child = child._next, child = next;
5328
5325
  }
5329
5326
  this._firstChild = null, this._lastChild = null, this._idMap.clear(), this._structEdit = !0, this.setCount(1 - this._count);
5330
5327
  }
@@ -7236,7 +7233,7 @@
7236
7233
  if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
7237
7234
  application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
7238
7235
  const bounds = this.doUpdateAABBBounds(full);
7239
- return this.addUpdateLayoutTag(), application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), bounds;
7236
+ return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), bounds;
7240
7237
  }
7241
7238
  combindShadowAABBBounds(bounds) {
7242
7239
  if (this.shadowRoot) {
@@ -9534,7 +9531,7 @@
9534
9531
 
9535
9532
  class BaseSymbol {
9536
9533
  bounds(size, bounds) {
9537
- if (isNumber$3(size)) {
9534
+ if (isNumber$2(size)) {
9538
9535
  const halfS = size / 2;
9539
9536
  bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
9540
9537
  } else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
@@ -9965,10 +9962,10 @@
9965
9962
  super(...arguments), this.type = "rect", this.pathStr = "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z";
9966
9963
  }
9967
9964
  draw(ctx, size, x, y) {
9968
- return isNumber$3(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
9965
+ return isNumber$2(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
9969
9966
  }
9970
9967
  drawOffset(ctx, size, x, y, offset) {
9971
- return isNumber$3(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
9968
+ return isNumber$2(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
9972
9969
  }
9973
9970
  }
9974
9971
  var rect = new RectSymbol();
@@ -10446,16 +10443,7 @@
10446
10443
  deltaY = -height;
10447
10444
  }
10448
10445
  let deltaX = 0;
10449
- switch (this.globalAlign) {
10450
- case "left":
10451
- deltaX = 0;
10452
- break;
10453
- case "center":
10454
- deltaX = -width / 2;
10455
- break;
10456
- case "right":
10457
- deltaX = -width;
10458
- }
10446
+ "right" === this.globalAlign || "end" === this.globalAlign ? deltaX = -width : "center" === this.globalAlign && (deltaX = -width / 2);
10459
10447
  let frameHeight = this[this.directionKey.height];
10460
10448
  this.singleLine && (frameHeight = this.lines[0].height + 1);
10461
10449
  let lastLineTag = !1;
@@ -10604,9 +10592,9 @@
10604
10592
  let direction = this.direction;
10605
10593
  if (this.verticalEllipsis) text = "...", direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
10606
10594
  if ("hide" === this.ellipsis) return;
10607
- if ("add" === this.ellipsis) text += "...", "right" === textAlign && (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
10595
+ if ("add" === this.ellipsis) text += "...", "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
10608
10596
  const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
10609
- if (text = text.slice(0, index), text += "...", "right" === textAlign) {
10597
+ if (text = text.slice(0, index), text += "...", "right" === textAlign || "end" === textAlign) {
10610
10598
  const {
10611
10599
  width: width
10612
10600
  } = measureTextCanvas(this.text.slice(index), this.character);
@@ -10797,17 +10785,7 @@
10797
10785
  maxHeight = this.height;
10798
10786
  let x = this.left,
10799
10787
  spacing = 0;
10800
- if (this.actualWidth < width && !isWidthMax) switch (this.textAlign) {
10801
- case "right":
10802
- x = width - this.actualWidth;
10803
- break;
10804
- case "center":
10805
- x = (width - this.actualWidth) / 2;
10806
- break;
10807
- case "justify":
10808
- this.paragraphs.length < 2 ? x = (width - this.actualWidth) / 2 : spacing = (width - this.actualWidth) / (this.paragraphs.length - 1);
10809
- }
10810
- this.paragraphs.map(function (paragraph) {
10788
+ this.actualWidth < width && !isWidthMax && ("right" === this.textAlign || "end" === this.textAlign ? x = width - this.actualWidth : "center" === this.textAlign ? x = (width - this.actualWidth) / 2 : "justify" === this.textAlign && (this.paragraphs.length < 2 ? x = (width - this.actualWidth) / 2 : spacing = (width - this.actualWidth) / (this.paragraphs.length - 1))), this.paragraphs.map(function (paragraph) {
10811
10789
  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);
10812
10790
  });
10813
10791
  }
@@ -11031,10 +11009,10 @@
11031
11009
  }
11032
11010
  } else {
11033
11011
  const richTextConfig = textConfig[i];
11034
- if (isNumber$3(richTextConfig.text) && (richTextConfig.text = `${richTextConfig.text}`), richTextConfig.text.includes("\n")) {
11012
+ if (isNumber$2(richTextConfig.text) && (richTextConfig.text = `${richTextConfig.text}`), richTextConfig.text && richTextConfig.text.includes("\n")) {
11035
11013
  const textParts = richTextConfig.text.split("\n");
11036
11014
  for (let j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, richTextConfig));
11037
- } else paragraphs.push(new Paragraph(richTextConfig.text, !1, richTextConfig));
11015
+ } else richTextConfig.text && paragraphs.push(new Paragraph(richTextConfig.text, !1, richTextConfig));
11038
11016
  }
11039
11017
  const maxWidthFinite = "number" == typeof maxWidth && Number.isFinite(maxWidth) && maxWidth > 0,
11040
11018
  maxHeightFinite = "number" == typeof maxHeight && Number.isFinite(maxHeight) && maxHeight > 0,
@@ -11279,7 +11257,7 @@
11279
11257
  } = this.attribute;
11280
11258
  if (0 === cornerRadius || "0%" === cornerRadius) return 0;
11281
11259
  const deltaRadius = Math.abs(outerRadius - innerRadius);
11282
- return Math.min(isNumber$3(cornerRadius, !0) ? cornerRadius : deltaRadius * parseFloat(cornerRadius) / 100, deltaRadius / 2);
11260
+ return Math.min(isNumber$2(cornerRadius, !0) ? cornerRadius : deltaRadius * parseFloat(cornerRadius) / 100, deltaRadius / 2);
11283
11261
  }
11284
11262
  getParsedAngle() {
11285
11263
  const arcTheme = getTheme(this).arc;
@@ -13120,7 +13098,7 @@
13120
13098
  const halfPi = pi / 2;
13121
13099
  function createRectPath(path, x, y, width, height, rectCornerRadius) {
13122
13100
  let cornerRadius;
13123
- if (width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$3(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
13101
+ if (width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$2(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
13124
13102
  const cornerRadiusArr = rectCornerRadius;
13125
13103
  let cr0, cr1;
13126
13104
  switch (cornerRadiusArr.length) {
@@ -13228,7 +13206,7 @@
13228
13206
  y = bounds.y1,
13229
13207
  width = bounds.width(),
13230
13208
  height = bounds.height();
13231
- return isNumber$3(boundsPadding) ? (x += boundsPadding, y += boundsPadding, width -= 2 * boundsPadding, height -= 2 * boundsPadding) : (x += boundsPadding[3], y += boundsPadding[0], width -= boundsPadding[1] + boundsPadding[3], height -= boundsPadding[0] + boundsPadding[2]), {
13209
+ return isNumber$2(boundsPadding) ? (x += boundsPadding, y += boundsPadding, width -= 2 * boundsPadding, height -= 2 * boundsPadding) : (x += boundsPadding[3], y += boundsPadding[0], width -= boundsPadding[1] + boundsPadding[3], height -= boundsPadding[0] + boundsPadding[2]), {
13232
13210
  x: x,
13233
13211
  y: y,
13234
13212
  width: width,
@@ -15741,20 +15719,26 @@
15741
15719
  height: height
15742
15720
  } = drawContext;
15743
15721
  if (!context) return;
15722
+ if (drawContext.keepMatrix) {
15723
+ if (context.nativeContext && context.nativeContext.getTransform) {
15724
+ const t = context.nativeContext.getTransform();
15725
+ context.setTransformFromMatrix(t, !0, 1);
15726
+ }
15727
+ } else context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
15744
15728
  const dirtyBounds = this.dirtyBounds.setValue(0, 0, width, height);
15745
15729
  if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {
15746
15730
  const b = getRectIntersect(dirtyBounds, stage.dirtyBounds, !1);
15747
15731
  dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
15748
15732
  }
15749
15733
  const d = context.dpr % 1;
15750
- (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
15734
+ (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds);
15751
15735
  const drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
15752
- context.save(), context.translate(x, y, !0), drawInArea && (context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip()), stage.camera && (this.dirtyBounds.clear(), this.backupDirtyBounds.clear()), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort((a, b) => {
15736
+ context.save(), context.translate(x, y, !0), drawInArea && (context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip()), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort((a, b) => {
15753
15737
  var _a, _b;
15754
15738
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
15755
15739
  }).forEach(group => {
15756
15740
  group.isContainer ? this.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : this.renderItem(group, drawContext);
15757
- }), context.restore(), context.restore(), context.draw(), context.inuse = !1;
15741
+ }), context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1);
15758
15742
  }
15759
15743
  doRegister() {
15760
15744
  throw new Error("暂不支持");
@@ -15807,7 +15791,7 @@
15807
15791
  }, subLayers.set(group._uid, incrementalLayer));
15808
15792
  const incrementalContext = incrementalLayer.layer.getNativeHandler().getContext(),
15809
15793
  idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);
15810
- idc.dirtyBounds.clear(), idc.backupDirtyBounds.clear(), idc.draw(this.currentRenderService, Object.assign(Object.assign({}, drawContext), {
15794
+ idc.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), idc.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), idc.draw(this.currentRenderService, Object.assign(Object.assign({}, drawContext), {
15811
15795
  drawContribution: idc,
15812
15796
  clear: "transparent",
15813
15797
  layer: incrementalLayer.layer,
@@ -16155,14 +16139,22 @@
16155
16139
  x = 0,
16156
16140
  y = 0
16157
16141
  } = drawContext;
16158
- context && (context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(x, y, !0), context.save(), renderService.renderTreeRoots.sort((a, b) => {
16159
- var _a, _b;
16160
- return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
16161
- }).forEach(group => {
16162
- this.renderGroup(group, drawContext);
16163
- }), this.hooks.completeDraw.tap("top-draw", () => {
16164
- context.restore(), context.restore(), context.draw(), context.inuse = !1, this.rendering = !1;
16165
- }));
16142
+ if (context) {
16143
+ if (drawContext.keepMatrix) {
16144
+ if (context.nativeContext && context.nativeContext.getTransform) {
16145
+ const t = context.nativeContext.getTransform();
16146
+ context.setTransformFromMatrix(t, !0, 1);
16147
+ }
16148
+ } else context.inuse = !0, context.clearMatrix();
16149
+ context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(x, y, !0), context.save(), renderService.renderTreeRoots.sort((a, b) => {
16150
+ var _a, _b;
16151
+ return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
16152
+ }).forEach(group => {
16153
+ this.renderGroup(group, drawContext);
16154
+ }), this.hooks.completeDraw.tap("top-draw", () => {
16155
+ context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1), this.rendering = !1;
16156
+ });
16157
+ }
16166
16158
  });
16167
16159
  }
16168
16160
  _increaseRender(group, drawContext) {
@@ -16463,34 +16455,48 @@
16463
16455
  constructor() {
16464
16456
  this.name = "FlexLayoutPlugin", this.activeEvent = "onRegister", this.id = Generator.GenAutoIncrementId(), this.key = this.name + this.id, this.tempBounds = new AABBBounds();
16465
16457
  }
16458
+ pauseLayout(p) {
16459
+ this.pause = p;
16460
+ }
16461
+ tryLayoutChildren(graphic) {
16462
+ graphic.firstChild && this.tryLayout(graphic.firstChild);
16463
+ }
16466
16464
  tryLayout(graphic) {
16467
- if (this.layouting) return;
16468
- this.layouting = !0;
16465
+ let force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
16466
+ if (this.pause) return;
16469
16467
  const p = graphic.parent;
16470
- if (!p || !graphic.needUpdateLayout()) return;
16468
+ if (!(force || p && graphic.needUpdateLayout())) return;
16471
16469
  const theme = getTheme(p).group,
16472
16470
  {
16473
16471
  display = theme.display
16474
16472
  } = p.attribute;
16475
16473
  if ("flex" !== display) return;
16476
16474
  const {
16477
- flexDirection = theme.flexDirection,
16478
- flexWrap = theme.flexWrap,
16479
- justifyContent = theme.justifyContent,
16480
- alignItems = theme.alignItems,
16481
- alignContent = theme.alignContent,
16482
- clip = theme.clip
16475
+ flexDirection = theme.flexDirection,
16476
+ flexWrap = theme.flexWrap,
16477
+ alignItems = theme.alignItems,
16478
+ clip = theme.clip
16479
+ } = p.attribute,
16480
+ {
16481
+ alignContent = null != alignItems ? alignItems : theme.alignContent
16482
+ } = p.attribute;
16483
+ let {
16484
+ width: width,
16485
+ height: height,
16486
+ justifyContent = theme.justifyContent
16483
16487
  } = p.attribute;
16484
- let childrenWidth = 0,
16485
- childrenHeight = 0,
16486
- boundsLegal = 0;
16487
- if (p.forEachChildren(child => {
16488
- const bounds = child.AABBBounds;
16489
- "column" === flexDirection || "column-reverse" === flexDirection ? (childrenHeight += bounds.height(), childrenWidth = Math.max(childrenWidth, bounds.width())) : (childrenWidth += bounds.width(), childrenHeight = Math.max(childrenHeight, bounds.height())), boundsLegal += bounds.x1, boundsLegal += bounds.y1, boundsLegal += bounds.x2, boundsLegal += bounds.y2;
16490
- }), !isFinite(boundsLegal)) return;
16491
- const width = p.attribute.width || childrenWidth,
16492
- height = p.attribute.height || childrenHeight;
16493
- p.attribute.width || (p.attribute.width = 0), p.attribute.height || (p.attribute.height = 0), this.tempBounds.copy(p._AABBBounds);
16488
+ const children = p.getChildren();
16489
+ if (null == width || null == height) {
16490
+ let childrenWidth = 0,
16491
+ childrenHeight = 0,
16492
+ boundsLegal = 0;
16493
+ if (children.forEach(child => {
16494
+ const bounds = this.getAABBBounds(child);
16495
+ bounds.empty() || ("column" === flexDirection || "column-reverse" === flexDirection ? (childrenHeight += bounds.height(), childrenWidth = Math.max(childrenWidth, bounds.width())) : (childrenWidth += bounds.width(), childrenHeight = Math.max(childrenHeight, bounds.height())), boundsLegal += bounds.x1, boundsLegal += bounds.y1, boundsLegal += bounds.x2, boundsLegal += bounds.y2);
16496
+ }), !isFinite(boundsLegal)) return;
16497
+ width = childrenWidth, height = childrenHeight;
16498
+ }
16499
+ p.attribute.width = width, p.attribute.height = height, this.tempBounds.copy(p._AABBBounds);
16494
16500
  const result = {
16495
16501
  main: {
16496
16502
  len: width,
@@ -16499,18 +16505,18 @@
16499
16505
  cross: {
16500
16506
  len: height,
16501
16507
  field: "y"
16502
- },
16503
- dir: 1
16508
+ }
16504
16509
  },
16505
16510
  main = result.main,
16506
16511
  cross = result.cross;
16507
- "row-reverse" === flexDirection ? result.dir = -1 : "column" === flexDirection ? (main.len = height, cross.len = width, main.field = "y", cross.field = "x") : "column-reverse" === flexDirection && (main.len = height, cross.len = width, main.field = "y", cross.field = "x", result.dir = -1);
16512
+ "column" !== flexDirection && "column-reverse" !== flexDirection || (main.len = height, cross.len = width, main.field = "y", cross.field = "x"), "row-reverse" !== flexDirection && "column-reverse" !== flexDirection || ("flex-start" === justifyContent ? justifyContent = "flex-end" : "flex-end" === justifyContent ? justifyContent = "flex-start" : children.reverse());
16508
16513
  let mainLen = 0,
16509
16514
  crossLen = 0;
16510
16515
  const mianLenArray = [];
16511
- p.forEachChildren(c => {
16512
- const b = c.AABBBounds,
16513
- ml = "x" === main.field ? b.width() : b.height(),
16516
+ children.forEach(c => {
16517
+ const b = this.getAABBBounds(c);
16518
+ if (b.empty()) return;
16519
+ const ml = "x" === main.field ? b.width() : b.height(),
16514
16520
  cl = "x" === cross.field ? b.width() : b.height();
16515
16521
  mianLenArray.push({
16516
16522
  mainLen: ml,
@@ -16545,107 +16551,168 @@
16545
16551
  mainLen: mainLen,
16546
16552
  crossLen: crossLen
16547
16553
  });
16548
- const children = p.getChildren();
16549
16554
  let lastIdx = 0;
16550
16555
  if (mainList.forEach(s => {
16551
16556
  this.layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, s), lastIdx = s.idx + 1;
16552
16557
  }), crossLen = mainList.reduce((a, b) => a + b.crossLen, 0), 1 === mainList.length) {
16553
- if ("flex-end" === alignItems) {
16554
- const anchorPos = cross.len;
16555
- this.layoutCross(children, alignItems, cross, anchorPos, mianLenArray, mainList[0], 0);
16556
- } else if ("center" === alignItems) {
16557
- const anchorPos = cross.len / 2;
16558
- this.layoutCross(children, alignItems, cross, anchorPos, mianLenArray, mainList[0], 0);
16559
- } else children.forEach(child => {
16560
- child.attribute[cross.field] = getPadding(child, cross.field);
16561
- });
16558
+ const anchorPosMap = {
16559
+ "flex-start": 0,
16560
+ "flex-end": cross.len,
16561
+ center: cross.len / 2
16562
+ };
16563
+ this.layoutCross(children, alignItems, cross, anchorPosMap, mianLenArray, mainList[0], 0);
16562
16564
  } else if ("flex-start" === alignContent) {
16563
16565
  lastIdx = 0;
16564
16566
  let anchorPos = 0;
16565
16567
  mainList.forEach((s, i) => {
16566
- this.layoutCross(children, "flex-start", cross, anchorPos, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen;
16568
+ const anchorPosMap = {
16569
+ "flex-start": anchorPos,
16570
+ "flex-end": anchorPos + s.crossLen,
16571
+ center: anchorPos + s.crossLen / 2
16572
+ };
16573
+ this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen;
16567
16574
  });
16568
16575
  } else if ("center" === alignContent) {
16569
16576
  lastIdx = 0;
16570
16577
  let anchorPos = Math.max(0, (cross.len - crossLen) / 2);
16571
16578
  mainList.forEach((s, i) => {
16572
- this.layoutCross(children, "center", cross, anchorPos + s.crossLen / 2, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen;
16579
+ const anchorPosMap = {
16580
+ "flex-start": anchorPos,
16581
+ "flex-end": anchorPos + s.crossLen,
16582
+ center: anchorPos + s.crossLen / 2
16583
+ };
16584
+ this.layoutCross(children, "center", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen;
16573
16585
  });
16574
16586
  } else if ("space-around" === alignContent) {
16575
16587
  lastIdx = 0;
16576
16588
  const padding = Math.max(0, (cross.len - crossLen) / mainList.length / 2);
16577
16589
  let anchorPos = padding;
16578
16590
  mainList.forEach((s, i) => {
16579
- this.layoutCross(children, "flex-start", cross, anchorPos, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen + 2 * padding;
16591
+ const anchorPosMap = {
16592
+ "flex-start": anchorPos,
16593
+ "flex-end": anchorPos + s.crossLen,
16594
+ center: anchorPos + s.crossLen / 2
16595
+ };
16596
+ this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen + 2 * padding;
16580
16597
  });
16581
16598
  } else if ("space-between" === alignContent) {
16582
16599
  lastIdx = 0;
16583
16600
  const padding = Math.max(0, (cross.len - crossLen) / (2 * mainList.length - 2));
16584
16601
  let anchorPos = 0;
16585
16602
  mainList.forEach((s, i) => {
16586
- this.layoutCross(children, "flex-start", cross, anchorPos, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen + 2 * padding;
16603
+ const anchorPosMap = {
16604
+ "flex-start": anchorPos,
16605
+ "flex-end": anchorPos + s.crossLen,
16606
+ center: anchorPos + s.crossLen / 2
16607
+ };
16608
+ this.layoutCross(children, "flex-start", cross, anchorPosMap, mianLenArray, mainList[i], lastIdx), lastIdx = s.idx + 1, anchorPos += s.crossLen + 2 * padding;
16587
16609
  });
16588
16610
  }
16589
16611
  children.forEach((child, idx) => {
16590
16612
  child.addUpdateBoundTag(), child.addUpdatePositionTag(), child.clearUpdateLayoutTag();
16591
- }), p.addUpdateLayoutTag(), clip || this.tempBounds.equals(p.AABBBounds) || (this.tryLayout(p), this.layouting = !1);
16613
+ }), p.addUpdateLayoutTag();
16614
+ const b = this.getAABBBounds(p);
16615
+ clip || this.tempBounds.equals(b) || this.tryLayout(p, !1);
16616
+ }
16617
+ getAABBBounds(graphic) {
16618
+ this.skipBoundsTrigger = !0;
16619
+ const b = graphic.AABBBounds;
16620
+ return this.skipBoundsTrigger = !1, b;
16621
+ }
16622
+ updateChildPos(posBaseLeftTop, lastP, lastBP) {
16623
+ return posBaseLeftTop + (null != lastP ? lastP : 0) - lastBP;
16592
16624
  }
16593
16625
  layoutMain(p, children, justifyContent, main, mianLenArray, lastIdx, currSeg) {
16594
16626
  if ("flex-start" === justifyContent) {
16595
16627
  let pos = 0;
16596
- for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos + getPadding(children[i], main.field), pos += mianLenArray[i].mainLen;
16628
+ for (let i = lastIdx; i <= currSeg.idx; i++) {
16629
+ const posBaseLeftTop = pos + getPadding(children[i], main.field),
16630
+ b = this.getAABBBounds(children[i]);
16631
+ !b.empty() && (children[i].attribute[main.field] = this.updateChildPos(posBaseLeftTop, children[i].attribute[main.field], b[`${main.field}1`])), pos += mianLenArray[i].mainLen;
16632
+ }
16597
16633
  } else if ("flex-end" === justifyContent) {
16598
16634
  let pos = main.len;
16599
- for (let i = lastIdx; i <= currSeg.idx; i++) pos -= mianLenArray[i].mainLen, children[i].attribute[main.field] = pos + getPadding(children[i], main.field);
16635
+ for (let i = lastIdx; i <= currSeg.idx; i++) {
16636
+ pos -= mianLenArray[i].mainLen;
16637
+ const posBaseLeftTop = pos + getPadding(children[i], main.field),
16638
+ b = this.getAABBBounds(children[i]);
16639
+ !b.empty() && (children[i].attribute[main.field] = this.updateChildPos(posBaseLeftTop, children[i].attribute[main.field], b[`${main.field}1`]));
16640
+ }
16600
16641
  } else if ("space-around" === justifyContent) {
16601
16642
  if (currSeg.mainLen >= main.len) {
16602
16643
  let pos = 0;
16603
- for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos + getPadding(children[i], main.field), pos += mianLenArray[i].mainLen;
16644
+ for (let i = lastIdx; i <= currSeg.idx; i++) {
16645
+ const posBaseLeftTop = pos + getPadding(children[i], main.field),
16646
+ b = this.getAABBBounds(children[i]);
16647
+ !b.empty() && (children[i].attribute[main.field] = this.updateChildPos(posBaseLeftTop, children[i].attribute[main.field], b[`${main.field}1`])), pos += mianLenArray[i].mainLen;
16648
+ }
16604
16649
  } else {
16605
16650
  const size = currSeg.idx - lastIdx + 1,
16606
16651
  padding = (main.len - currSeg.mainLen) / size / 2;
16607
16652
  let pos = padding;
16608
- for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos + getPadding(children[i], main.field), pos += mianLenArray[i].mainLen + 2 * padding;
16653
+ for (let i = lastIdx; i <= currSeg.idx; i++) {
16654
+ const posBaseLeftTop = pos + getPadding(children[i], main.field),
16655
+ b = this.getAABBBounds(children[i]);
16656
+ !b.empty() && (children[i].attribute[main.field] = this.updateChildPos(posBaseLeftTop, children[i].attribute[main.field], b[`${main.field}1`])), pos += mianLenArray[i].mainLen + 2 * padding;
16657
+ }
16609
16658
  }
16610
16659
  } else if ("space-between" === justifyContent) {
16611
16660
  if (currSeg.mainLen >= main.len) {
16612
16661
  let pos = 0;
16613
- for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos + getPadding(children[i], main.field), pos += mianLenArray[i].mainLen;
16662
+ for (let i = lastIdx; i <= currSeg.idx; i++) {
16663
+ const posBaseLeftTop = pos + getPadding(children[i], main.field),
16664
+ b = this.getAABBBounds(children[i]);
16665
+ !b.empty() && (children[i].attribute[main.field] = this.updateChildPos(posBaseLeftTop, children[i].attribute[main.field], b[`${main.field}1`])), pos += mianLenArray[i].mainLen;
16666
+ }
16614
16667
  } else {
16615
16668
  const size = currSeg.idx - lastIdx + 1,
16616
16669
  padding = (main.len - currSeg.mainLen) / (2 * size - 2);
16617
16670
  let pos = 0;
16618
- for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos + getPadding(children[i], main.field), pos += mianLenArray[i].mainLen + 2 * padding;
16671
+ for (let i = lastIdx; i <= currSeg.idx; i++) {
16672
+ const posBaseLeftTop = pos + getPadding(children[i], main.field),
16673
+ b = this.getAABBBounds(children[i]);
16674
+ !b.empty() && (children[i].attribute[main.field] = this.updateChildPos(posBaseLeftTop, children[i].attribute[main.field], b[`${main.field}1`])), pos += mianLenArray[i].mainLen + 2 * padding;
16675
+ }
16619
16676
  }
16620
16677
  } else if ("center" === justifyContent) {
16621
16678
  let pos = (main.len - currSeg.mainLen) / 2;
16622
- for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[main.field] = pos + getPadding(children[i], main.field), pos += mianLenArray[i].mainLen;
16679
+ for (let i = lastIdx; i <= currSeg.idx; i++) {
16680
+ const posBaseLeftTop = pos + getPadding(children[i], main.field),
16681
+ b = this.getAABBBounds(children[i]);
16682
+ !b.empty() && (children[i].attribute[main.field] = this.updateChildPos(posBaseLeftTop, children[i].attribute[main.field], b[`${main.field}1`])), pos += mianLenArray[i].mainLen;
16683
+ }
16623
16684
  }
16624
16685
  }
16625
- layoutCross(children, alignItem, cross, anchorPos, lenArray, currSeg, lastIdx) {
16626
- if ("flex-end" === alignItem) for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[cross.field] = anchorPos - lenArray[i].crossLen + getPadding(children[i], cross.field);else if ("center" === alignItem) for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[cross.field] = anchorPos - lenArray[i].crossLen / 2 + getPadding(children[i], cross.field);else for (let i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[cross.field] = anchorPos + getPadding(children[i], cross.field);
16686
+ layoutCross(children, alignItem, cross, anchorPosMap, lenArray, currSeg, lastIdx) {
16687
+ var _a;
16688
+ for (let i = lastIdx; i <= currSeg.idx; i++) {
16689
+ const child = children[i];
16690
+ let {
16691
+ alignSelf: alignSelf
16692
+ } = child.attribute;
16693
+ alignSelf && "auto" !== alignSelf || (alignSelf = alignItem);
16694
+ const b = this.getAABBBounds(child),
16695
+ anchorPos = null !== (_a = anchorPosMap[alignSelf]) && void 0 !== _a ? _a : anchorPosMap["flex-start"];
16696
+ "flex-end" === alignSelf ? !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos - lenArray[i].crossLen + getPadding(child, cross.field), child.attribute[cross.field], b[`${cross.field}1`])) : "center" === alignSelf ? !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos - lenArray[i].crossLen / 2 + getPadding(child, cross.field), child.attribute[cross.field], b[`${cross.field}1`])) : !b.empty() && (child.attribute[cross.field] = this.updateChildPos(anchorPos + getPadding(child, cross.field), child.attribute[cross.field], b[`${cross.field}1`]));
16697
+ }
16627
16698
  }
16628
16699
  activate(context) {
16629
16700
  this.pluginService = context, application.graphicService.hooks.onAttributeUpdate.tap(this.key, graphic => {
16630
- graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic), this.layouting = !1;
16701
+ graphic.glyphHost && (graphic = graphic.glyphHost), graphic.stage && graphic.stage === this.pluginService.stage && this.tryLayout(graphic, !1);
16631
16702
  }), application.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
16632
- graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && graphic.isContainer && _tempBounds.copy(bounds);
16703
+ graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && _tempBounds.copy(bounds);
16633
16704
  }), application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
16634
- stage && stage === this.pluginService.stage && graphic.isContainer && (_tempBounds.equals(bounds) || (this.tryLayout(graphic), this.layouting = !1));
16705
+ stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && (_tempBounds.equals(bounds) || this.tryLayout(graphic, !1));
16635
16706
  }), application.graphicService.hooks.onSetStage.tap(this.key, graphic => {
16636
- graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic), this.layouting = !1;
16707
+ graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic, !1);
16637
16708
  });
16638
16709
  }
16639
16710
  deactivate(context) {
16640
- application.graphicService.hooks.onAttributeUpdate.taps = application.graphicService.hooks.onAttributeUpdate.taps.filter(item => item.name !== this.key), application.graphicService.hooks.onSetStage.taps = application.graphicService.hooks.onSetStage.taps.filter(item => item.name !== this.key);
16711
+ application.graphicService.hooks.onAttributeUpdate.taps = application.graphicService.hooks.onAttributeUpdate.taps.filter(item => item.name !== this.key), application.graphicService.hooks.beforeUpdateAABBBounds.taps = application.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => item.name !== this.key), application.graphicService.hooks.afterUpdateAABBBounds.taps = application.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => item.name !== this.key), application.graphicService.hooks.onSetStage.taps = application.graphicService.hooks.onSetStage.taps.filter(item => item.name !== this.key);
16641
16712
  }
16642
16713
  }
16643
16714
  function getPadding(graphic, field) {
16644
- if (!graphic.attribute.boundsPadding) return 0;
16645
- if (isNumber$1(graphic.attribute.boundsPadding)) return graphic.attribute.boundsPadding;
16646
- if (isArray$1(graphic.attribute.boundsPadding) && 1 === graphic.attribute.boundsPadding.length) return graphic.attribute.boundsPadding[0];
16647
- const paddingArray = parsePadding(graphic.attribute.boundsPadding);
16648
- return "x" === field ? paddingArray[3] : "y" === field ? paddingArray[0] : 0;
16715
+ return 0;
16649
16716
  }
16650
16717
 
16651
16718
  const defaultTicker = new DefaultTicker();
@@ -17064,6 +17131,9 @@
17064
17131
  this.pluginService.unRegister(plugin);
17065
17132
  }));
17066
17133
  }
17134
+ getPluginsByName(name) {
17135
+ return this.pluginService.findPluginsByName(name);
17136
+ }
17067
17137
  tryUpdateAABBBounds() {
17068
17138
  const viewBox = this._viewBox;
17069
17139
  return this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2), this._AABBBounds;
@@ -17097,7 +17167,7 @@
17097
17167
  render(layers, params) {
17098
17168
  this.ticker.start(), this.timeline.resume();
17099
17169
  const state = this.state;
17100
- this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this.renderLayerList(this.children), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
17170
+ this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this.renderLayerList(this.children, params), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear(), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
17101
17171
  }
17102
17172
  combineLayersToWindow() {}
17103
17173
  renderNextFrame(layers, force) {
@@ -17124,7 +17194,8 @@
17124
17194
  background: layer === this.defaultLayer ? this.background : void 0,
17125
17195
  updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty())
17126
17196
  }, Object.assign({
17127
- renderStyle: this.renderStyle
17197
+ renderStyle: this.renderStyle,
17198
+ keepMatrix: this.params.renderKeepMatrix
17128
17199
  }, params)));
17129
17200
  }), this.interactiveLayer && !layerList.includes(this.interactiveLayer) && this.interactiveLayer.render({
17130
17201
  renderService: this.renderService,
@@ -17507,11 +17578,17 @@
17507
17578
  if (!params.bounds.contains(point.x, point.y)) return result;
17508
17579
  offsetX = params.bounds.x1, offsetY = params.bounds.y1;
17509
17580
  }
17510
- this.pickContext && (this.pickContext.inuse = !0), params.pickContext = this.pickContext, this.pickContext && this.pickContext.clearMatrix(!0, 1);
17581
+ if (this.pickContext) if (params.keepMatrix) {
17582
+ if (this.pickContext.nativeContext && this.pickContext.nativeContext.getTransform) {
17583
+ const t = this.pickContext.nativeContext.getTransform();
17584
+ this.pickContext.setTransformFromMatrix(t, !0, 1);
17585
+ }
17586
+ } else this.pickContext.inuse = !0, this.pickContext.clearMatrix(!0, 1);
17587
+ params.pickContext = this.pickContext;
17511
17588
  const parentMatrix = new Matrix(1, 0, 0, 1, offsetX, offsetY);
17512
17589
  let group;
17513
17590
  for (let i = graphics.length - 1; i >= 0 && (result = graphics[i].isContainer ? this.pickGroup(graphics[i], point, parentMatrix, params) : this.pickItem(graphics[i], point, parentMatrix, params), !result.graphic); i--) group || (group = result.group);
17514
- if (result.graphic || (result.group = group), this.pickContext && (this.pickContext.inuse = !1), result.graphic) {
17591
+ if (result.graphic || (result.group = group), this.pickContext && !params.keepMatrix && (this.pickContext.inuse = !1), result.graphic) {
17515
17592
  let g = result.graphic;
17516
17593
  for (; g.parent;) g = g.parent;
17517
17594
  g.shadowHost && (result.params = {
@@ -20039,7 +20116,7 @@
20039
20116
  x += point.x, y += point.y, pickContext.setTransformForCurrent();
20040
20117
  } else x = 0, y = 0, onlyTranslate = !1, pickContext.transformFromMatrix(rect.transMatrix, !0);
20041
20118
  let picked = !0;
20042
- if (!onlyTranslate || rect.shadowRoot || isNumber$3(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(num => 0 !== num)) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, (context, rectAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, rectAttribute, themeAttribute) => {
20119
+ if (!onlyTranslate || rect.shadowRoot || isNumber$2(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(num => 0 !== num)) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, (context, rectAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, rectAttribute, themeAttribute) => {
20043
20120
  if (picked) return !0;
20044
20121
  const lineWidth = rectAttribute.lineWidth || themeAttribute.lineWidth,
20045
20122
  pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
@@ -20107,7 +20184,7 @@
20107
20184
  x += point.x, y += point.y, pickContext.setTransformForCurrent();
20108
20185
  } else x = 0, y = 0, onlyTranslate = !1, pickContext.transformFromMatrix(rect.transMatrix, !0);
20109
20186
  let picked = !0;
20110
- if (!onlyTranslate || isNumber$3(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(num => 0 !== num)) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, (context, rectAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, rectAttribute, themeAttribute) => {
20187
+ if (!onlyTranslate || isNumber$2(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(num => 0 !== num)) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, (context, rectAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, rectAttribute, themeAttribute) => {
20111
20188
  if (picked) return !0;
20112
20189
  const lineWidth = rectAttribute.lineWidth || themeAttribute.lineWidth,
20113
20190
  pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer;
@@ -22393,6 +22470,15 @@
22393
22470
  const pattern = /^-?\d+(\.\d+)?$/;
22394
22471
  return pattern.test(str);
22395
22472
  }
22473
+ function deduplication$1(array) {
22474
+ const result = [];
22475
+ for (let i = 0; i < array.length; i++) {
22476
+ if (result.indexOf(array[i]) === -1) {
22477
+ result.push(array[i]);
22478
+ }
22479
+ }
22480
+ return result;
22481
+ }
22396
22482
 
22397
22483
  const isNode = typeof window === 'undefined' || typeof window.window === 'undefined';
22398
22484
  let arrayFind;
@@ -22955,7 +23041,7 @@
22955
23041
  }
22956
23042
  }
22957
23043
 
22958
- const indexFirst = (arr, elm) => {
23044
+ const indexFirst$1 = (arr, elm) => {
22959
23045
  let low = 0;
22960
23046
  let high = arr.length - 1;
22961
23047
  while (low <= high) {
@@ -23001,7 +23087,7 @@
23001
23087
  }
23002
23088
  if (sourceIndex > targetIndex) {
23003
23089
  const sourceVals = [];
23004
- for (let i = indexFirst(keys, sourceIndex + moveCount - 1); i >= 0; i--) {
23090
+ for (let i = indexFirst$1(keys, sourceIndex + moveCount - 1); i >= 0; i--) {
23005
23091
  const key = keys[i];
23006
23092
  if (key >= sourceIndex) {
23007
23093
  sourceVals.push(this.get(key));
@@ -23020,7 +23106,7 @@
23020
23106
  const { length } = keys;
23021
23107
  if (sourceIndex < targetIndex) {
23022
23108
  const sourceVals = [];
23023
- for (let i = indexFirst(keys, sourceIndex); i < length; i++) {
23109
+ for (let i = indexFirst$1(keys, sourceIndex); i < length; i++) {
23024
23110
  const key = keys[i];
23025
23111
  if (key >= sourceIndex && key < sourceIndex + moveCount) {
23026
23112
  sourceVals.push(this.get(key));
@@ -23075,7 +23161,7 @@
23075
23161
  });
23076
23162
  this._sorted = true;
23077
23163
  }
23078
- for (let i = indexFirst(keys, keyFrom); i < length; i++) {
23164
+ for (let i = indexFirst$1(keys, keyFrom); i < length; i++) {
23079
23165
  const key = keys[i];
23080
23166
  if (keyFrom <= key && key <= keyTo) {
23081
23167
  const callRes = fn(this.get(key), key);
@@ -24682,6 +24768,14 @@
24682
24768
  height: bounds.height()
24683
24769
  };
24684
24770
  }
24771
+ function isRichText(attributes) {
24772
+ let typeKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "type";
24773
+ return typeKey in attributes && "rich" === attributes[typeKey] || isObject$4(attributes.text) && "rich" === attributes.text.type;
24774
+ }
24775
+ function richTextAttributeTransform(attributes) {
24776
+ var _a, _b;
24777
+ 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;
24778
+ }
24685
24779
 
24686
24780
  function loadTagComponent() {
24687
24781
  registerGroup(), registerRect(), registerSymbol(), registerRichtext(), registerText();
@@ -24702,7 +24796,7 @@
24702
24796
  super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, Tag.defaultAttributes, attributes)), this.name = "tag";
24703
24797
  }
24704
24798
  render() {
24705
- var _a, _b, _c, _d;
24799
+ var _a, _b;
24706
24800
  const {
24707
24801
  text = "",
24708
24802
  textStyle = {},
@@ -24734,7 +24828,7 @@
24734
24828
  shapeStyle = __rest$3(shape, ["visible"]);
24735
24829
  if (isBoolean$2(shapeVisible)) {
24736
24830
  const size = (null == shapeStyle ? void 0 : shapeStyle.size) || 10,
24737
- maxSize = isNumber$3(size) ? size : Math.max(size[0], size[1]);
24831
+ maxSize = isNumber$2(size) ? size : Math.max(size[0], size[1]);
24738
24832
  symbol = group.createOrUpdateChild("tag-shape", Object.assign(Object.assign({
24739
24833
  symbolType: "circle",
24740
24834
  size: size,
@@ -24746,39 +24840,15 @@
24746
24840
  }), "symbol"), isEmpty(null == state ? void 0 : state.shape) || (symbol.states = state.shape), shapeVisible && (symbolPlaceWidth = maxSize + space);
24747
24841
  }
24748
24842
  let textShape;
24749
- if (tagWidth += symbolPlaceWidth, textX += symbolPlaceWidth, "rich" === type) {
24750
- const richTextAttrs = Object.assign(Object.assign({
24751
- textConfig: text,
24752
- visible: isValid$1(text) && !1 !== visible
24753
- }, textStyle), {
24754
- x: textX,
24755
- y: 0,
24756
- width: null !== (_a = textStyle.width) && void 0 !== _a ? _a : 0,
24757
- height: null !== (_b = textStyle.height) && void 0 !== _b ? _b : 0
24758
- });
24759
- textShape = group.createOrUpdateChild("tag-text", richTextAttrs, "richtext");
24760
- const {
24761
- visible: bgVisible
24762
- } = panel,
24763
- backgroundStyle = __rest$3(panel, ["visible"]);
24764
- if (visible && isBoolean$2(bgVisible)) {
24765
- const bgRect = this.createOrUpdateChild("tag-panel", Object.assign(Object.assign({}, backgroundStyle), {
24766
- visible: bgVisible && !!text,
24767
- x: textShape.AABBBounds.x1,
24768
- y: textShape.AABBBounds.y1,
24769
- width: textShape.AABBBounds.width(),
24770
- height: textShape.AABBBounds.height()
24771
- }), "rect");
24772
- isEmpty(null == state ? void 0 : state.panel) || (bgRect.states = state.panel);
24773
- }
24774
- } else if ("html" === type) {
24775
- const richTextAttrs = Object.assign(Object.assign({
24776
- textConfig: [],
24843
+ tagWidth += symbolPlaceWidth, textX += symbolPlaceWidth;
24844
+ if (isRichText({
24845
+ text: text
24846
+ }) || "rich" === type) {
24847
+ const richTextAttrs = Object.assign(Object.assign(Object.assign({}, richTextAttributeTransform(Object.assign({
24848
+ type: type,
24849
+ text: text
24850
+ }, textStyle))), textStyle), {
24777
24851
  visible: isValid$1(text) && !1 !== visible,
24778
- html: Object.assign(Object.assign({
24779
- dom: text
24780
- }, DEFAULT_HTML_TEXT_SPEC), textStyle)
24781
- }, textStyle), {
24782
24852
  x: textX,
24783
24853
  y: 0
24784
24854
  });
@@ -24799,7 +24869,7 @@
24799
24869
  }
24800
24870
  } else {
24801
24871
  const textAttrs = Object.assign(Object.assign({
24802
- text: text,
24872
+ text: isObject$4(text) && "type" in text && "text" === text.type ? text.text : text,
24803
24873
  visible: isValid$1(text) && !1 !== visible,
24804
24874
  lineHeight: null == textStyle ? void 0 : textStyle.fontSize
24805
24875
  }, textStyle), {
@@ -24807,12 +24877,12 @@
24807
24877
  y: 0
24808
24878
  });
24809
24879
  isNil$1(textAttrs.lineHeight) && (textAttrs.lineHeight = textStyle.fontSize), textShape = group.createOrUpdateChild("tag-text", textAttrs, "text"), isEmpty(null == state ? void 0 : state.text) || (textShape.states = state.text);
24810
- const textBounds = measureTextSize(textAttrs.text, textStyle, null === (_c = this.stage) || void 0 === _c ? void 0 : _c.getTheme().text.fontFamily),
24880
+ const textBounds = measureTextSize(textAttrs.text, textStyle, null === (_a = this.stage) || void 0 === _a ? void 0 : _a.getTheme().text.fontFamily),
24811
24881
  textWidth = textBounds.width,
24812
24882
  textHeight = textBounds.height;
24813
24883
  tagWidth += textWidth;
24814
- const size = null !== (_d = shape.size) && void 0 !== _d ? _d : 10,
24815
- maxSize = isNumber$3(size) ? size : Math.max(size[0], size[1]);
24884
+ const size = null !== (_b = shape.size) && void 0 !== _b ? _b : 10,
24885
+ maxSize = isNumber$2(size) ? size : Math.max(size[0], size[1]);
24816
24886
  tagHeight += Math.max(textHeight, shape.visible ? maxSize : 0);
24817
24887
  const {
24818
24888
  textAlign: textAlign,
@@ -24820,11 +24890,21 @@
24820
24890
  } = textStyle;
24821
24891
  (isValid$1(minWidth) || isValid$1(maxWidth)) && (isValid$1(minWidth) && tagWidth < minWidth && (tagWidth = minWidth), isValid$1(maxWidth) && tagWidth > maxWidth && (tagWidth = maxWidth, textShape.setAttribute("maxLineWidth", maxWidth - parsedPadding[1] - parsedPadding[2])));
24822
24892
  let x = 0,
24823
- y = 0;
24824
- "center" === textAlign ? (x -= tagWidth / 2, symbol && symbol.setAttribute("x", (symbol.attribute.x || 0) - textWidth / 2), group.setAttribute("x", -symbolPlaceWidth / 2)) : "right" === textAlign || "end" === textAlign ? (x -= tagWidth, symbol && symbol.setAttribute("x", (symbol.attribute.x || 0) - textWidth), group.setAttribute("x", -parsedPadding[1] - symbolPlaceWidth)) : "left" !== textAlign && "start" !== textAlign || group.setAttribute("x", parsedPadding[3]), !textAlwaysCenter || "left" !== textAlign && "start" !== textAlign || textShape.setAttributes({
24825
- x: textX + tagWidth / 2,
24826
- textAlign: "center"
24827
- }), "middle" === textBaseline ? (y -= tagHeight / 2, symbol && symbol.setAttribute("y", 0)) : "bottom" === textBaseline ? (y -= tagHeight, symbol && symbol.setAttribute("y", -textHeight / 2), group.setAttribute("y", -parsedPadding[2])) : "top" === textBaseline && (group.setAttribute("y", parsedPadding[0]), symbol && symbol.setAttribute("y", textHeight / 2));
24893
+ y = 0,
24894
+ flag = 0;
24895
+ if ("left" === textAlign || "start" === textAlign ? flag = 1 : "right" === textAlign || "end" === textAlign ? flag = -1 : "center" === textAlign && (flag = 0), flag ? flag < 0 ? (x -= tagWidth, symbol && symbol.setAttribute("x", (symbol.attribute.x || 0) - textWidth), group.setAttribute("x", -parsedPadding[1] - symbolPlaceWidth)) : flag > 0 && group.setAttribute("x", parsedPadding[3]) : (x -= tagWidth / 2, symbol && symbol.setAttribute("x", (symbol.attribute.x || 0) - textWidth / 2), group.setAttribute("x", -symbolPlaceWidth / 2)), textAlwaysCenter && flag) {
24896
+ const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3],
24897
+ tsWidth = textWidth + symbolPlaceWidth,
24898
+ textX = (containerWidth - tsWidth) / 2 + symbolPlaceWidth + textWidth / 2,
24899
+ symbolX = (containerWidth - tsWidth) / 2 + maxSize / 2;
24900
+ textShape.setAttributes({
24901
+ x: textX * flag,
24902
+ textAlign: "center"
24903
+ }), null == symbol || symbol.setAttributes({
24904
+ x: symbolX * flag
24905
+ }), group.setAttribute("x", parsedPadding[2 + flag] * flag);
24906
+ }
24907
+ "middle" === textBaseline ? (y -= tagHeight / 2, symbol && symbol.setAttribute("y", 0)) : "bottom" === textBaseline ? (y -= tagHeight, symbol && symbol.setAttribute("y", -textHeight / 2), group.setAttribute("y", -parsedPadding[2])) : "top" === textBaseline && (group.setAttribute("y", parsedPadding[0]), symbol && symbol.setAttribute("y", textHeight / 2));
24828
24908
  const {
24829
24909
  visible: bgVisible
24830
24910
  } = panel,
@@ -25668,12 +25748,10 @@
25668
25748
  pickable: !1
25669
25749
  });
25670
25750
  return labelGroup.name = `${AXIS_ELEMENT_NAME.labelContainer}-layer-${layer}`, labelGroup.id = this._getNodeId(`label-container-layer-${layer}`), container.add(labelGroup), data.forEach((item, index) => {
25671
- var _a, _b, _c;
25751
+ var _a;
25672
25752
  const labelStyle = this._getLabelAttribute(item, index, data, layer);
25673
25753
  let text;
25674
- if ("rich" === labelStyle.type ? (labelStyle.textConfig = labelStyle.text, labelStyle.width = null !== (_a = labelStyle.width) && void 0 !== _a ? _a : 0, labelStyle.height = null !== (_b = labelStyle.height) && void 0 !== _b ? _b : 0, text = graphicCreator$1.richtext(labelStyle)) : "html" === labelStyle.type ? (labelStyle.textConfig = [], labelStyle.html = Object.assign(Object.assign({
25675
- dom: labelStyle.text
25676
- }, DEFAULT_HTML_TEXT_SPEC), labelStyle), text = graphicCreator$1.richtext(labelStyle)) : text = graphicCreator$1.text(labelStyle), text.name = AXIS_ELEMENT_NAME.label, text.id = this._getNodeId(`layer${layer}-label-${item.id}`), isEmpty(null === (_c = this.attribute.label) || void 0 === _c ? void 0 : _c.state)) text.states = DEFAULT_STATES$2;else {
25754
+ if (text = isRichText(labelStyle) ? graphicCreator$1.richtext(richTextAttributeTransform(labelStyle)) : graphicCreator$1.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 {
25677
25755
  const labelState = merge({}, DEFAULT_STATES$2, this.attribute.label.state);
25678
25756
  Object.keys(labelState).forEach(key => {
25679
25757
  isFunction$1(labelState[key]) && (labelState[key] = labelState[key](item, index, data, layer));
@@ -26521,8 +26599,8 @@
26521
26599
  textAlign: "center",
26522
26600
  textBaseline: "middle"
26523
26601
  }, textStyle), null === (_b = this.stage) || void 0 === _b ? void 0 : _b.getTheme().text.fontFamily),
26524
- handlerSizeX = isNumber$3(handlerSize) ? handlerSize : handlerSize[0],
26525
- handlerSizeY = isNumber$3(handlerSize) ? handlerSize : handlerSize[1],
26602
+ handlerSizeX = isNumber$2(handlerSize) ? handlerSize : handlerSize[0],
26603
+ handlerSizeY = isNumber$2(handlerSize) ? handlerSize : handlerSize[1],
26526
26604
  text = graphicCreator$1.text(Object.assign({
26527
26605
  x: isHorizontal ? handlerSizeX / 2 + handlerSpace + maxTextWidth / 2 : 0,
26528
26606
  y: isHorizontal ? 0 : handlerSizeY / 2 + handlerSpace + maxTextHeight / 2,
@@ -26851,7 +26929,8 @@
26851
26929
  shape.fill && isNil$1(shapeStyle.state[key].fill) && color && (shapeStyle.state[key].fill = color), shape.stroke && isNil$1(shapeStyle.state[key].stroke) && color && (shapeStyle.state[key].stroke = color);
26852
26930
  }), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state), itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(itemShape);
26853
26931
  }
26854
- let focusSpace = 0;
26932
+ let labelShape,
26933
+ focusSpace = 0;
26855
26934
  if (focus) {
26856
26935
  const focusSize = get$5(focusIconStyle, "size", DEFAULT_SHAPE_SIZE);
26857
26936
  focusShape = graphicCreator$1.symbol(Object.assign(Object.assign({
@@ -26864,29 +26943,32 @@
26864
26943
  boundsPadding: parsedPadding
26865
26944
  })), this._appendDataToShape(focusShape, LEGEND_ELEMENT_NAME.focus, item, itemGroup), focusSpace = focusSize;
26866
26945
  }
26867
- const labelShape = graphicCreator$1.text(Object.assign(Object.assign({
26868
- x: shapeSize / 2 + shapeSpace,
26869
- y: 0,
26870
- textAlign: "start",
26871
- textBaseline: "middle",
26872
- lineHeight: null === (_b = labelStyle.style) || void 0 === _b ? void 0 : _b.fontSize
26873
- }, labelStyle.style), {
26874
- text: labelAttr.formatMethod ? labelAttr.formatMethod(label, item, index) : label
26875
- }));
26876
- this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
26946
+ const text = labelAttr.formatMethod ? labelAttr.formatMethod(label, item, index) : label,
26947
+ labelAttributes = Object.assign(Object.assign({
26948
+ x: shapeSize / 2 + shapeSpace,
26949
+ y: 0,
26950
+ textAlign: "start",
26951
+ textBaseline: "middle",
26952
+ lineHeight: null === (_b = labelStyle.style) || void 0 === _b ? void 0 : _b.fontSize
26953
+ }, labelStyle.style), {
26954
+ text: text
26955
+ });
26956
+ labelShape = isRichText(labelAttributes) ? graphicCreator$1.richtext(richTextAttributeTransform(labelAttributes)) : graphicCreator$1.text(labelAttributes), this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state), labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), innerGroup.add(labelShape);
26877
26957
  const labelSpace = get$5(labelAttr, "space", DEFAULT_LABEL_SPACE);
26878
26958
  if (isValid$1(value)) {
26879
26959
  const valueSpace = get$5(valueAttr, "space", focus ? DEFAULT_VALUE_SPACE : 0),
26880
- valueShape = graphicCreator$1.text(Object.assign(Object.assign({
26960
+ valueText = valueAttr.formatMethod ? valueAttr.formatMethod(value, item, index) : value,
26961
+ valueAttributes = Object.assign(Object.assign({
26881
26962
  x: 0,
26882
26963
  y: 0,
26883
26964
  textAlign: "start",
26884
26965
  textBaseline: "middle",
26885
26966
  lineHeight: valueStyle.style.fontSize
26886
26967
  }, valueStyle.style), {
26887
- text: valueAttr.formatMethod ? valueAttr.formatMethod(value, item, index) : value
26888
- }));
26889
- if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
26968
+ text: valueText
26969
+ });
26970
+ let valueShape;
26971
+ if (valueShape = isRichText(valueAttributes) ? graphicCreator$1.richtext(richTextAttributeTransform(valueAttributes)) : graphicCreator$1.text(valueAttributes), this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state), valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected), this._itemWidthByUser) {
26890
26972
  const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace,
26891
26973
  valueBounds = valueShape.AABBBounds,
26892
26974
  labelBounds = labelShape.AABBBounds,
@@ -27566,7 +27648,7 @@
27566
27648
  return this._isFixed && !!this._bandwidth;
27567
27649
  }
27568
27650
  _isBandwidthFixedByUser() {
27569
- return this._isFixed && this._userBandwidth && isNumber$3(this._userBandwidth);
27651
+ return this._isFixed && this._userBandwidth && isNumber$2(this._userBandwidth);
27570
27652
  }
27571
27653
  clone() {
27572
27654
  var _a, _b, _c;
@@ -27834,13 +27916,13 @@
27834
27916
  }
27835
27917
  }
27836
27918
  function parseNiceOptions(originalDomain, option) {
27837
- const hasForceMin = isNumber$3(option.forceMin),
27838
- hasForceMax = isNumber$3(option.forceMax);
27919
+ const hasForceMin = isNumber$2(option.forceMin),
27920
+ hasForceMax = isNumber$2(option.forceMax);
27839
27921
  let niceType = null;
27840
27922
  const niceMinMax = [];
27841
27923
  let niceDomain = null;
27842
27924
  const domainValidator = hasForceMin && hasForceMax ? x => x >= option.forceMin && x <= option.forceMax : hasForceMin ? x => x >= option.forceMin : hasForceMax ? x => x <= option.forceMax : null;
27843
- return hasForceMin ? niceMinMax[0] = option.forceMin : isNumber$3(option.min) && option.min <= Math.min(originalDomain[0], originalDomain[originalDomain.length - 1]) && (niceMinMax[0] = option.min), hasForceMax ? niceMinMax[1] = option.forceMax : isNumber$3(option.max) && option.max >= Math.max(originalDomain[0], originalDomain[originalDomain.length - 1]) && (niceMinMax[1] = option.max), isNumber$3(niceMinMax[0]) && isNumber$3(niceMinMax[1]) ? (niceDomain = originalDomain.slice(), niceDomain[0] = niceMinMax[0], niceDomain[niceDomain.length - 1] = niceMinMax[1]) : niceType = isNumber$3(niceMinMax[0]) || isNumber$3(niceMinMax[1]) ? isNumber$3(niceMinMax[0]) ? "max" : "min" : "all", {
27925
+ return hasForceMin ? niceMinMax[0] = option.forceMin : isNumber$2(option.min) && option.min <= Math.min(originalDomain[0], originalDomain[originalDomain.length - 1]) && (niceMinMax[0] = option.min), hasForceMax ? niceMinMax[1] = option.forceMax : isNumber$2(option.max) && option.max >= Math.max(originalDomain[0], originalDomain[originalDomain.length - 1]) && (niceMinMax[1] = option.max), isNumber$2(niceMinMax[0]) && isNumber$2(niceMinMax[1]) ? (niceDomain = originalDomain.slice(), niceDomain[0] = niceMinMax[0], niceDomain[niceDomain.length - 1] = niceMinMax[1]) : niceType = isNumber$2(niceMinMax[0]) || isNumber$2(niceMinMax[1]) ? isNumber$2(niceMinMax[0]) ? "max" : "min" : "all", {
27844
27926
  niceType: niceType,
27845
27927
  niceDomain: niceDomain,
27846
27928
  niceMinMax: niceMinMax,
@@ -31668,7 +31750,7 @@
31668
31750
  }
31669
31751
 
31670
31752
  function getQuadProps(paddingOrigin) {
31671
- if (isNumber$3(paddingOrigin) || isString$2(paddingOrigin) || isArray$1(paddingOrigin)) {
31753
+ if (isNumber$2(paddingOrigin) || isString$2(paddingOrigin) || isArray$1(paddingOrigin)) {
31672
31754
  let padding = parsePadding(paddingOrigin);
31673
31755
  if (typeof padding === 'number' || typeof padding === 'string') {
31674
31756
  padding = [padding, padding, padding, padding];
@@ -31934,7 +32016,7 @@
31934
32016
  if (isNil$1(v)) {
31935
32017
  return false;
31936
32018
  }
31937
- if (isNumber$3(v)) {
32019
+ if (isNumber$2(v)) {
31938
32020
  return true;
31939
32021
  }
31940
32022
  return +v === +v;
@@ -32900,6 +32982,16 @@
32900
32982
  cursor: 'pointer'
32901
32983
  };
32902
32984
  },
32985
+ get loading_pic() {
32986
+ return {
32987
+ type: 'svg',
32988
+ svg: '<svg viewBox="0 0 400 300" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="a" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="50" y="65" width="301" height="170"><path d="M350.3 65H50v169.8h300.3V65Z" fill="#fff"/></mask><g mask="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M58.3 233.2h32.8v-36.8H58.3v36.8Z" fill="#C7DEFF"/><path d="M91.1 224.5v8.8H58.3M82.4 196.2H58.3" stroke="#071F4D"/><path fill-rule="evenodd" clip-rule="evenodd" d="M305.4 182.5s-2.7 12.6 0 17.4c2.7 4.8 8.3 6.7 12.4 4.4 4.2-2.4 5.3-8.1 2.6-12.9-2.7-4.8-15-8.9-15-8.9ZM336 204.7c4.3 2 9.7-.4 12-5.4 2.3-5-1.5-17.3-1.5-17.3s-11.8 5.1-14.1 10.1c-2.3 5-.7 10.6 3.6 12.6Z" fill="#00E4E5"/><path fill-rule="evenodd" clip-rule="evenodd" d="M326.7 174s-10 11.8-10 18.6c0 6.7 4.5 12.2 10 12.2s10-5.5 10-12.3c0-6.8-10-18.5-10-18.5Z" fill="#00E4E5"/><path d="M332.3 181.5c2.3 3.6 4.4 7.8 4.4 10.9M316.7 192.5c0-3.1 2.1-7.2 4.3-10.8" stroke="#071F4D"/><path fill-rule="evenodd" clip-rule="evenodd" d="M343.1 227.3v-9.7h-34v9.7c0 3.7 3 6.6 6.6 6.6h20.9c3.6 0 6.5-2.9 6.5-6.6Z" fill="#071F4D"/><path fill-rule="evenodd" clip-rule="evenodd" d="M350.4 220.8V198H302v22.8c0 5.9 4.8 10.7 10.7 10.7h26.9c5.9 0 10.7-4.8 10.8-10.7Z" fill="#C7DEFF"/><path fill-rule="evenodd" clip-rule="evenodd" d="M331.7 74.2H117.8L87.4 203h213.8l30.5-128.8Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M337 74.2h-6.2l-30.6 129.2h6.2L337 74.2Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M303.8 203.5h2.4l30.7-129.3h-1.8l-31.3 129.3Z" fill="#C7DEFF"/><path d="m337 74.2-30.6 129.2h-5.9" stroke="#071F4D"/><path fill-rule="evenodd" clip-rule="evenodd" d="M229.9 202.1h-47.6l2 9.6h47.3l-1.7-9.6Z" fill="#C7DEFF"/><path fill-rule="evenodd" clip-rule="evenodd" d="M94.7 172.6 87.4 203h213.1l7.8-30.4H94.7Z" fill="#006EFF"/><path fill-rule="evenodd" clip-rule="evenodd" d="M94.7 172.6 87.4 203h213.1l7.8-30.4H94.7Z" fill="#006EFF"/><path d="M138.5 74.2h193.2l-23.4 98.6M94.5 172.7l11-46.3M104.8 155.4l-2.3 11.5h6.7M316 112.1l1.1-4.5" stroke="#071F4D"/><path fill-rule="evenodd" clip-rule="evenodd" d="M148.3 138.1h97V119h-97v19.1Z" fill="#00E4E5"/><path d="M303.1 80.6h20.3l-4.6 19.6M228.3 234.3c3.6 0 6.3-3.2 5.7-6.8l-4.1-24.1" stroke="#071F4D"/><path fill-rule="evenodd" clip-rule="evenodd" d="M226.2 229.5h-68.9v1.2c0 2 1.6 3.7 3.7 3.7h60.1c2.8 0 5-2.2 5.1-4.9Z" fill="#C7DEFF"/><path d="M180.699 226.8h-19.9c-2.8 0-4.6 3-3.3 5.5m0 0c.6 1.2 1.9 2 3.3 2h57.8M175.9 203.4l3.6 17.6M241.2 234.3h65.1M104.6 234.3h41.3" stroke="#071F4D"/><path d="M206.2 234.3h14.9c3.1 0 5.5-2.8 5-5.9l-4.3-24.9M160.7 226.8h46M62.2 226.1h-9.5c-1.2 0-2.2-1-2.2-2.2v-18.3c0-1.2 1-2.2 2.2-2.2h9.5" stroke="#071F4D"/><path d="M53.4 171.7H68c2.1 0 3.7 1.7 3.7 3.7v16.1M79.1 192v-21.8c0-2.5 2-4.6 4.6-4.6h2.2c2.5 0 4.5-2 4.5-4.5m0 0c0-2.5-2-4.5-4.5-4.5H56.1c-2.4 0-4.3-1.9-4.3-4.3V148M71.2 165.2h-18M64 181.7v10.1" stroke="#C7DEFF"/><path fill-rule="evenodd" clip-rule="evenodd" d="M85.7 120H124c4.3 0 7.7-3.5 7.7-7.7V65.5H94.2c-4.7 0-8.5 4.9-8.5 11V120Z" fill="#C7DEFF"/><path d="M85.7 110.7V73c0-4.1 3.4-7.5 7.5-7.5h38.5M146.2 73.8v-2.5c0-3.2-2-5.8-5.8-5.8-2.8 0-6 1.1-6 5.8v42.4c0 4.7-3.8 8.5-8.5 8.5h-15.6" stroke="#071F4D"/><path d="M119.7 122.3H87c-6.1 0-11.1-5-11.1-11.1m0 0h39M126.1 122.3c-6.1 0-11.1-5-11.1-11.1" stroke="#071F4D"/><path fill-rule="evenodd" clip-rule="evenodd" d="M85.4 122.1h37.2c-6.5-1.8-8-10.5-8-10.5H76.2c.6 8.8 9.2 10.5 9.2 10.5Z" fill="#071F4D"/><path fill-rule="evenodd" clip-rule="evenodd" d="M95.8 102.9h4.8V83.6h-4.8v19.3ZM106.6 102.9h4.8V77.6h-4.8v25.3ZM117.3 102.9h4.8V89.1h-4.8v13.8Z" fill="#fff"/><path d="M273.2 195.9h16.9M261.2 195.9h5" stroke="#fff"/><path d="M62.4 201.9v2.9M62.4 224.5v2.9" stroke="#071F4D"/><path d="m153.6 138.1 9.7-19.1M168.8 138.1l9.7-19.1M184.1 138.1l9.7-19.1M199.4 138.1l9.7-19.1M214.6 138.1l9.8-19.1M229.9 138.1l9.7-19.1" stroke="#fff"/><path d="M148.3 138.1h121.6V119H148.3v19.1Z" stroke="#071F4D"/></g></svg>',
32989
+ width: 400,
32990
+ height: 300,
32991
+ name: 'loading_pic',
32992
+ positionType: IconPosition.left
32993
+ };
32994
+ },
32903
32995
  get expand() {
32904
32996
  return {
32905
32997
  type: 'svg',
@@ -32972,15 +33064,21 @@
32972
33064
  }
32973
33065
 
32974
33066
  function calcKeepAspectRatioSize(width, height, maxWidth, maxHeight) {
32975
- let newWidth = width;
32976
- let newHeight = height;
32977
- if (newWidth > maxWidth) {
32978
- newWidth = maxWidth;
32979
- newHeight = (newWidth * height) / width;
33067
+ const rectWidth = width;
33068
+ const rectHeight = height;
33069
+ const containerWidth = maxWidth;
33070
+ const containerHeight = maxHeight;
33071
+ const containerRatio = containerWidth / containerHeight;
33072
+ const rectRatio = rectWidth / rectHeight;
33073
+ let newWidth;
33074
+ let newHeight;
33075
+ if (rectRatio > containerRatio) {
33076
+ newWidth = containerWidth;
33077
+ newHeight = newWidth / rectRatio;
32980
33078
  }
32981
- if (newHeight > maxHeight) {
32982
- newHeight = maxHeight;
32983
- newWidth = (newHeight * width) / height;
33079
+ else {
33080
+ newHeight = containerHeight;
33081
+ newWidth = newHeight * rectRatio;
32984
33082
  }
32985
33083
  return {
32986
33084
  width: newWidth,
@@ -33008,7 +33106,6 @@
33008
33106
  return { x, y };
33009
33107
  }
33010
33108
 
33011
- get$1();
33012
33109
  function createImageCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme) {
33013
33110
  const headerStyle = table._getCellStyle(col, row);
33014
33111
  const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);
@@ -33052,31 +33149,29 @@
33052
33149
  image.name = 'image';
33053
33150
  image.keepAspectRatio = keepAspectRatio;
33054
33151
  if (keepAspectRatio || imageAutoSizing) {
33055
- image.successCallback = () => {
33056
- const originImage = image.resources.get(image.attribute.image).data;
33057
- if (imageAutoSizing) {
33058
- _adjustWidthHeight(col, row, originImage.width, originImage.height, table.scenegraph, padding);
33059
- }
33060
- if (keepAspectRatio) {
33061
- const { width: cellWidth, height: cellHeight, isMerge } = getCellRange(cellGroup, table);
33062
- const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize(originImage.width, originImage.height, cellWidth - padding[1] - padding[3], cellHeight - padding[0] - padding[2]);
33063
- const pos = calcStartPosition(0, 0, cellWidth, cellHeight, imageWidth, imageHeight, textAlign, textBaseline, padding);
33064
- image.setAttributes({
33065
- x: pos.x,
33066
- y: pos.y,
33067
- width: imageWidth,
33068
- height: imageHeight,
33069
- dx: isMerge ? -table.getColsWidth(cellGroup.mergeStartCol, col - 1) : 0,
33070
- dy: isMerge ? -table.getRowsHeight(cellGroup.mergeStartRow, row - 1) : 0
33071
- });
33072
- }
33073
- table.scenegraph.updateNextFrame();
33074
- };
33152
+ if (image.resources &&
33153
+ image.resources.has(image.attribute.image) &&
33154
+ image.resources.get(image.attribute.image).state === 'success') {
33155
+ updateAutoSizingAndKeepAspectRatio(imageAutoSizing, keepAspectRatio, padding, textAlign, textBaseline, image, cellGroup, table);
33156
+ }
33157
+ else {
33158
+ image.successCallback = () => {
33159
+ updateAutoSizingAndKeepAspectRatio(imageAutoSizing, keepAspectRatio, padding, textAlign, textBaseline, image, cellGroup, table);
33160
+ table.scenegraph.updateNextFrame();
33161
+ };
33162
+ }
33075
33163
  }
33076
33164
  else {
33077
- image.successCallback = () => {
33165
+ if (image.resources &&
33166
+ image.resources.has(image.attribute.image) &&
33167
+ image.resources.get(image.attribute.image).state === 'success') {
33078
33168
  updateImageCellContentWhileResize(cellGroup, col, row, table);
33079
- };
33169
+ }
33170
+ else {
33171
+ image.successCallback = () => {
33172
+ updateImageCellContentWhileResize(cellGroup, col, row, table);
33173
+ };
33174
+ }
33080
33175
  }
33081
33176
  image.failCallback = () => {
33082
33177
  const regedIcons = get$1();
@@ -33189,6 +33284,47 @@
33189
33284
  isMerge: false
33190
33285
  };
33191
33286
  }
33287
+ function updateImageDxDy(startCol, endCol, startRow, endRow, table) {
33288
+ for (let col = startCol; col <= endCol; col++) {
33289
+ for (let row = startRow; row <= endRow; row++) {
33290
+ const cellGroup = table.scenegraph.getCell(col, row);
33291
+ if (cellGroup) {
33292
+ const image = cellGroup.getChildByName('image');
33293
+ if (image) {
33294
+ image.setAttributes({
33295
+ dx: -table.getColsWidth(cellGroup.mergeStartCol, col - 1),
33296
+ dy: -table.getRowsHeight(cellGroup.mergeStartRow, row - 1)
33297
+ });
33298
+ }
33299
+ }
33300
+ }
33301
+ }
33302
+ }
33303
+ function updateAutoSizingAndKeepAspectRatio(imageAutoSizing, keepAspectRatio, padding, textAlign, textBaseline, image, cellGroup, table) {
33304
+ const originImage = image.resources.get(image.attribute.image).data;
33305
+ const { col, row } = cellGroup;
33306
+ if (imageAutoSizing && !isDamagePic(image)) {
33307
+ _adjustWidthHeight(col, row, originImage.width, originImage.height, table.scenegraph, padding);
33308
+ }
33309
+ if (keepAspectRatio || isDamagePic(image)) {
33310
+ const { width: cellWidth, height: cellHeight, isMerge } = getCellRange(cellGroup, table);
33311
+ const { width: imageWidth, height: imageHeight } = calcKeepAspectRatioSize(originImage.width, originImage.height, cellWidth - padding[1] - padding[3], cellHeight - padding[0] - padding[2]);
33312
+ const pos = calcStartPosition(0, 0, cellWidth, cellHeight, imageWidth, imageHeight, textAlign, textBaseline, padding);
33313
+ image.setAttributes({
33314
+ x: pos.x,
33315
+ y: pos.y,
33316
+ width: imageWidth,
33317
+ height: imageHeight
33318
+ });
33319
+ if (isMerge) {
33320
+ updateImageDxDy(cellGroup.mergeStartCol, cellGroup.mergeEndCol, cellGroup.mergeStartRow, cellGroup.mergeEndRow, table);
33321
+ }
33322
+ }
33323
+ }
33324
+ function isDamagePic(image) {
33325
+ const regedIcons = get$1();
33326
+ return image.attribute.image === regedIcons.damage_pic.svg;
33327
+ }
33192
33328
 
33193
33329
  function createProgressBarCell(progressBarDefine, style, width, value, dataValue, col, row, padding, table) {
33194
33330
  if (progressBarDefine.dependField) {
@@ -34295,8 +34431,8 @@
34295
34431
  iconAttribute.funcType = icon.funcType;
34296
34432
  iconAttribute.interactive = icon.interactive;
34297
34433
  let hierarchyOffset = 0;
34298
- if (isNumber$3(col) &&
34299
- isNumber$3(row) &&
34434
+ if (isNumber$2(col) &&
34435
+ isNumber$2(row) &&
34300
34436
  table &&
34301
34437
  (icon.funcType === IconFuncTypeEnum.collapse || icon.funcType === IconFuncTypeEnum.expand)) {
34302
34438
  hierarchyOffset = range
@@ -35739,10 +35875,10 @@
35739
35875
 
35740
35876
  function isMergeCellGroup(cellGroup) {
35741
35877
  if (cellGroup.role === 'cell' &&
35742
- isNumber$3(cellGroup.mergeStartCol) &&
35743
- isNumber$3(cellGroup.mergeStartRow) &&
35744
- isNumber$3(cellGroup.mergeEndCol) &&
35745
- isNumber$3(cellGroup.mergeEndRow)) {
35878
+ isNumber$2(cellGroup.mergeStartCol) &&
35879
+ isNumber$2(cellGroup.mergeStartRow) &&
35880
+ isNumber$2(cellGroup.mergeEndCol) &&
35881
+ isNumber$2(cellGroup.mergeEndRow)) {
35746
35882
  return true;
35747
35883
  }
35748
35884
  return false;
@@ -35764,10 +35900,10 @@
35764
35900
  max = domainMax + (domainMax - domainMin) * axisOption.expand.max;
35765
35901
  }
35766
35902
  }
35767
- if (isNumber$3(axisOption?.min)) {
35903
+ if (isNumber$2(axisOption?.min)) {
35768
35904
  min = axisOption.min;
35769
35905
  }
35770
- if (isNumber$3(axisOption?.max)) {
35906
+ if (isNumber$2(axisOption?.max)) {
35771
35907
  max = axisOption.max;
35772
35908
  }
35773
35909
  let scale;
@@ -35809,7 +35945,7 @@
35809
35945
  delete scale._niceType;
35810
35946
  let scaleTicks;
35811
35947
  if (!skipTick) {
35812
- scaleTicks = scale.ticks(isNumber$3(axisOption?.tickCount) ? axisOption?.tickCount : DEFAULT_CONTINUOUS_TICK_COUNT, {
35948
+ scaleTicks = scale.ticks(isNumber$2(axisOption?.tickCount) ? axisOption?.tickCount : DEFAULT_CONTINUOUS_TICK_COUNT, {
35813
35949
  noDecimals: axisOption?.tick?.noDecimals
35814
35950
  });
35815
35951
  }
@@ -36044,13 +36180,13 @@
36044
36180
  }
36045
36181
  }
36046
36182
  }
36047
- if (isNumber$3(axisOption?.min)) {
36183
+ if (isNumber$2(axisOption?.min)) {
36048
36184
  range.min = axisOption.min;
36049
36185
  if (range.min > 0) {
36050
36186
  axisOption.zero = false;
36051
36187
  }
36052
36188
  }
36053
- if (isNumber$3(axisOption?.max)) {
36189
+ if (isNumber$2(axisOption?.max)) {
36054
36190
  range.max = axisOption.max;
36055
36191
  if (range.max < 0) {
36056
36192
  axisOption.zero = false;
@@ -36095,13 +36231,13 @@
36095
36231
  }
36096
36232
  }
36097
36233
  }
36098
- if (isNumber$3(axisOption?.min)) {
36234
+ if (isNumber$2(axisOption?.min)) {
36099
36235
  range.min = axisOption.min;
36100
36236
  if (range.min > 0) {
36101
36237
  axisOption.zero = false;
36102
36238
  }
36103
36239
  }
36104
- if (isNumber$3(axisOption?.max)) {
36240
+ if (isNumber$2(axisOption?.max)) {
36105
36241
  range.max = axisOption.max;
36106
36242
  if (range.max < 0) {
36107
36243
  axisOption.zero = false;
@@ -36177,13 +36313,13 @@
36177
36313
  }
36178
36314
  }
36179
36315
  }
36180
- if (isNumber$3(axisOption?.min)) {
36316
+ if (isNumber$2(axisOption?.min)) {
36181
36317
  range.min = axisOption.min;
36182
36318
  if (range.min > 0) {
36183
36319
  axisOption.zero = false;
36184
36320
  }
36185
36321
  }
36186
- if (isNumber$3(axisOption?.max)) {
36322
+ if (isNumber$2(axisOption?.max)) {
36187
36323
  range.max = axisOption.max;
36188
36324
  if (range.max < 0) {
36189
36325
  axisOption.zero = false;
@@ -36225,13 +36361,13 @@
36225
36361
  }
36226
36362
  }
36227
36363
  }
36228
- if (isNumber$3(axisOption?.min)) {
36364
+ if (isNumber$2(axisOption?.min)) {
36229
36365
  range.min = axisOption.min;
36230
36366
  if (range.min > 0) {
36231
36367
  axisOption.zero = false;
36232
36368
  }
36233
36369
  }
36234
- if (isNumber$3(axisOption?.max)) {
36370
+ if (isNumber$2(axisOption?.max)) {
36235
36371
  range.max = axisOption.max;
36236
36372
  if (range.max < 0) {
36237
36373
  axisOption.zero = false;
@@ -36411,13 +36547,13 @@
36411
36547
  const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign, layout._table.getColWidth(col));
36412
36548
  range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;
36413
36549
  range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;
36414
- if (isNumber$3(axisOption?.min)) {
36550
+ if (isNumber$2(axisOption?.min)) {
36415
36551
  range.min = axisOption.min;
36416
36552
  if (range.min > 0) {
36417
36553
  axisOption.zero = false;
36418
36554
  }
36419
36555
  }
36420
- if (isNumber$3(axisOption?.max)) {
36556
+ if (isNumber$2(axisOption?.max)) {
36421
36557
  range.max = axisOption.max;
36422
36558
  if (range.max < 0) {
36423
36559
  axisOption.zero = false;
@@ -36707,12 +36843,8 @@
36707
36843
  }
36708
36844
  if (isAllRowsAuto || table.getDefaultRowHeight(row) === 'auto') {
36709
36845
  const height = computeRowHeight(row, startCol, endCol, table);
36710
- if (update) {
36711
- newHeights[row] = Math.round(height);
36712
- }
36713
- else {
36714
- table._setRowHeight(row, height);
36715
- }
36846
+ newHeights[row] = Math.round(height);
36847
+ table._setRowHeight(row, height);
36716
36848
  }
36717
36849
  }
36718
36850
  for (let row = table.rowCount - table.bottomFrozenRowCount; row <= rowEnd; row++) {
@@ -36775,7 +36907,7 @@
36775
36907
  }
36776
36908
  }
36777
36909
  else {
36778
- table.rowHeightsMap.clear();
36910
+ table.clearRowHeightCache();
36779
36911
  for (let row = 0; row < table.rowCount; row++) {
36780
36912
  newHeights[row] = table.getRowHeight(row);
36781
36913
  }
@@ -36872,7 +37004,22 @@
36872
37004
  table._setRowHeight(row, newRowHeight);
36873
37005
  }
36874
37006
  }
36875
- for (let row = 0; row < table.rowCount; row++) {
37007
+ if (table.heightMode === 'adaptive' ||
37008
+ (table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight)) {
37009
+ for (let row = 0; row <= table.columnHeaderLevelCount - 1; row++) {
37010
+ const newRowHeight = table.getRowHeight(row);
37011
+ if (newRowHeight !== oldRowHeights[row]) {
37012
+ table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
37013
+ }
37014
+ }
37015
+ for (let row = table.rowCount - table.bottomFrozenRowCount; row <= table.rowCount - 1; row++) {
37016
+ const newRowHeight = table.getRowHeight(row);
37017
+ if (newRowHeight !== oldRowHeights[row]) {
37018
+ table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
37019
+ }
37020
+ }
37021
+ }
37022
+ for (let row = table.scenegraph.proxy.rowStart; row <= table.scenegraph.proxy.rowEnd; row++) {
36876
37023
  const newRowHeight = table.getRowHeight(row);
36877
37024
  if (newRowHeight !== oldRowHeights[row]) {
36878
37025
  table.scenegraph.updateRowHeight(row, newRowHeight - oldRowHeights[row], true);
@@ -36893,7 +37040,7 @@
36893
37040
  }
36894
37041
  else {
36895
37042
  const defaultHeight = table.getDefaultRowHeight(row);
36896
- if (isNumber$3(defaultHeight)) {
37043
+ if (isNumber$2(defaultHeight)) {
36897
37044
  return defaultHeight;
36898
37045
  }
36899
37046
  }
@@ -36927,7 +37074,7 @@
36927
37074
  : table.getBodyColumnType(col, row);
36928
37075
  if (cellType !== 'text' && cellType !== 'link' && cellType !== 'progressbar' && cellType !== 'checkbox') {
36929
37076
  const defaultHeight = table.getDefaultRowHeight(row);
36930
- maxHeight = Math.max(maxHeight, isNumber$3(defaultHeight) ? defaultHeight : table.defaultRowHeight);
37077
+ maxHeight = Math.max(maxHeight, isNumber$2(defaultHeight) ? defaultHeight : table.defaultRowHeight);
36931
37078
  continue;
36932
37079
  }
36933
37080
  const textHeight = computeTextHeight(col, row, cellType, table);
@@ -37201,7 +37348,7 @@
37201
37348
  wordBreak: 'break-word',
37202
37349
  whiteSpace: lines.length === 1 && !autoWrapText ? 'no-wrap' : 'normal'
37203
37350
  });
37204
- maxHeight = utilTextMark.AABBBounds.height();
37351
+ maxHeight = utilTextMark.AABBBounds.height() || (typeof lineHeight === 'number' ? lineHeight : fontSize);
37205
37352
  }
37206
37353
  else {
37207
37354
  maxHeight = lines.length * lineHeight;
@@ -37242,9 +37389,13 @@
37242
37389
  rowStart = row + 1;
37243
37390
  rowEnd = scene.table.columnHeaderLevelCount - 1;
37244
37391
  }
37392
+ else if (row >= scene.table.rowCount - scene.table.bottomFrozenRowCount) {
37393
+ rowStart = row + 1;
37394
+ rowEnd = scene.table.rowCount - 1;
37395
+ }
37245
37396
  else {
37246
37397
  rowStart = row + 1;
37247
- rowEnd = scene.bodyRowEnd;
37398
+ rowEnd = Math.min(scene.proxy.rowEnd, scene.table.rowCount - scene.table.bottomFrozenRowCount - 1);
37248
37399
  }
37249
37400
  for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {
37250
37401
  for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {
@@ -38153,13 +38304,13 @@
38153
38304
  }
38154
38305
  update(backX, lineX, backY, lineY) {
38155
38306
  if (typeof backX === 'number' && typeof lineX === 'number') {
38156
- this.columnMoverLabel.setAttribute('x', lineX - this.table.stateManager.scroll.horizontalBarPos);
38157
- this.columnMoverLine.setAttribute('x', lineX - this.table.stateManager.scroll.horizontalBarPos);
38307
+ this.columnMoverLabel.setAttribute('x', lineX);
38308
+ this.columnMoverLine.setAttribute('x', lineX);
38158
38309
  this.columnMoverBack.setAttribute('x', backX);
38159
38310
  }
38160
38311
  else if (typeof backY === 'number' && typeof lineY === 'number') {
38161
- this.columnMoverLabel.setAttribute('y', lineY - this.table.stateManager.scroll.verticalBarPos);
38162
- this.columnMoverLine.setAttribute('y', lineY - this.table.stateManager.scroll.verticalBarPos);
38312
+ this.columnMoverLabel.setAttribute('y', lineY);
38313
+ this.columnMoverLine.setAttribute('y', lineY);
38163
38314
  this.columnMoverBack.setAttribute('y', backY);
38164
38315
  }
38165
38316
  }
@@ -39765,6 +39916,90 @@
39765
39916
  injectable()
39766
39917
  ], SplitRectAfterRenderContribution);
39767
39918
 
39919
+ let loadingImage;
39920
+ let VTableDrawItemInterceptorContribution = class VTableDrawItemInterceptorContribution {
39921
+ order = 1;
39922
+ interceptors;
39923
+ constructor() {
39924
+ this.interceptors = [new ImageDrawItemInterceptorContribution()];
39925
+ }
39926
+ afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
39927
+ for (let i = 0; i < this.interceptors.length; i++) {
39928
+ if (this.interceptors[i].afterDrawItem &&
39929
+ this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)) {
39930
+ return true;
39931
+ }
39932
+ }
39933
+ return false;
39934
+ }
39935
+ beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
39936
+ if ((!graphic.in3dMode || drawContext.in3dInterceptor) &&
39937
+ !graphic.shadowRoot &&
39938
+ !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) {
39939
+ return false;
39940
+ }
39941
+ for (let i = 0; i < this.interceptors.length; i++) {
39942
+ if (this.interceptors[i].beforeDrawItem &&
39943
+ this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)) {
39944
+ return true;
39945
+ }
39946
+ }
39947
+ return false;
39948
+ }
39949
+ };
39950
+ VTableDrawItemInterceptorContribution = __decorate([
39951
+ injectable()
39952
+ ], VTableDrawItemInterceptorContribution);
39953
+ class ImageDrawItemInterceptorContribution {
39954
+ order = 1;
39955
+ afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
39956
+ if (graphic.type === 'image') {
39957
+ this.drawItem(graphic, renderService, drawContext, drawContribution, params);
39958
+ }
39959
+ return false;
39960
+ }
39961
+ drawItem(graphic, renderService, drawContext, drawContribution, params) {
39962
+ const { image: url } = graphic.attribute;
39963
+ if (!url || !graphic.resources) {
39964
+ return false;
39965
+ }
39966
+ const res = graphic.resources.get(url);
39967
+ if (res.state !== 'loading') {
39968
+ return false;
39969
+ }
39970
+ if (!loadingImage) {
39971
+ const regedIcons = get$1();
39972
+ const svg = regedIcons.loading_pic.svg;
39973
+ const width = regedIcons.loading_pic.width;
39974
+ const height = regedIcons.loading_pic.height;
39975
+ loadingImage = createImage({
39976
+ width,
39977
+ height,
39978
+ image: svg
39979
+ });
39980
+ }
39981
+ const { image: loadingUrl } = loadingImage.attribute;
39982
+ if (!url || !loadingImage.resources) {
39983
+ return false;
39984
+ }
39985
+ const loadingRes = loadingImage.resources.get(loadingUrl);
39986
+ if (loadingRes.state !== 'success') {
39987
+ return false;
39988
+ }
39989
+ const { context } = drawContext;
39990
+ context.highPerformanceSave();
39991
+ graphic.parent && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);
39992
+ graphic.glyphHost &&
39993
+ graphic.glyphHost.parent &&
39994
+ context.setTransformFromMatrix(graphic.glyphHost.parent.globalTransMatrix, true);
39995
+ const b = graphic.AABBBounds;
39996
+ const { width, height } = calcKeepAspectRatioSize(loadingRes.data.width, loadingRes.data.height, b.width(), b.height());
39997
+ context.drawImage(loadingRes.data, b.x1 + (b.width() - width) / 2, b.y1 + (b.height() - height) / 2, width, height);
39998
+ context.highPerformanceRestore();
39999
+ return true;
40000
+ }
40001
+ }
40002
+
39768
40003
  var splitModule = new ContainerModule((bind, unbind, isBound, rebind) => {
39769
40004
  if (isBound(SplitRectBeforeRenderContribution$1)) {
39770
40005
  rebind(SplitRectBeforeRenderContribution$1).to(SplitRectBeforeRenderContribution).inSingletonScope();
@@ -39807,6 +40042,8 @@
39807
40042
  bind(GroupRenderContribution).toService(ClipBodyGroupBeforeRenderContribution);
39808
40043
  bind(ClipBodyGroupAfterRenderContribution).toSelf().inSingletonScope();
39809
40044
  bind(GroupRenderContribution).toService(ClipBodyGroupAfterRenderContribution);
40045
+ bind(VTableDrawItemInterceptorContribution).toSelf().inSingletonScope();
40046
+ bind(DrawItemInterceptor).toService(VTableDrawItemInterceptorContribution);
39810
40047
  });
39811
40048
 
39812
40049
  function computeColsWidth(table, colStart, colEnd, update) {
@@ -40218,7 +40455,7 @@
40218
40455
  columnGroup.role = 'column';
40219
40456
  columnGroup.col = i;
40220
40457
  containerGroup.addChild(columnGroup);
40221
- const { width: default2Width, height: default2Height } = createComplexColumn(columnGroup, col, colWidth, rowStart, rowEnd, table.scenegraph.mergeMap, cellLocation === 'columnHeader' && isNumber$3(defaultHeaderRowHeight) ? defaultHeaderRowHeight : defaultRowHeight, table, cellLocation, rowLimit);
40458
+ const { width: default2Width, height: default2Height } = createComplexColumn(columnGroup, col, colWidth, rowStart, rowEnd, table.scenegraph.mergeMap, cellLocation === 'columnHeader' && isNumber$2(defaultHeaderRowHeight) ? defaultHeaderRowHeight : defaultRowHeight, table, cellLocation, rowLimit);
40222
40459
  x += default2Width;
40223
40460
  heightMax = Math.max(heightMax, default2Height);
40224
40461
  }
@@ -40436,7 +40673,7 @@
40436
40673
  const deltaX = screenLeftX - (colGroup.attribute.x + proxy.table.getFrozenColsWidth() + proxy.table.scenegraph.proxy.deltaX);
40437
40674
  proxy.table.scenegraph.proxy.deltaX += deltaX;
40438
40675
  proxy.currentCol = direction === 'left' ? proxy.currentCol + count : proxy.currentCol - count;
40439
- proxy.totalCol = direction === 'left' ? proxy.totalCol + count : proxy.totalCol - count;
40676
+ proxy.totalCol = Math.max(0, Math.min(proxy.table.colCount - 1, direction === 'left' ? proxy.totalCol + count : proxy.totalCol - count));
40440
40677
  proxy.referenceCol = proxy.colStart + Math.floor((proxy.colEnd - proxy.colStart) / 2);
40441
40678
  proxy.colUpdatePos = distStartCol;
40442
40679
  proxy.colUpdateDirection = direction;
@@ -40473,7 +40710,7 @@
40473
40710
  proxy.table.scenegraph.proxy.deltaX = deltaX;
40474
40711
  }
40475
40712
  proxy.currentCol = direction === 'left' ? proxy.currentCol + count : proxy.currentCol - count;
40476
- proxy.totalCol = direction === 'left' ? proxy.totalCol + count : proxy.totalCol - count;
40713
+ proxy.totalCol = Math.max(0, Math.min(proxy.table.colCount - 1, direction === 'left' ? proxy.totalCol + count : proxy.totalCol - count));
40477
40714
  proxy.referenceCol = proxy.colStart + Math.floor((proxy.colEnd - proxy.colStart) / 2);
40478
40715
  proxy.colUpdatePos = proxy.colStart;
40479
40716
  proxy.colUpdateDirection = distEndCol > proxy.bodyRightCol - (proxy.colEnd - proxy.colStart + 1) ? 'right' : 'left';
@@ -40572,7 +40809,7 @@
40572
40809
  });
40573
40810
  }
40574
40811
 
40575
- function updateAutoRow(colStart, colEnd, rowStart, rowEnd, table, direction = 'up') {
40812
+ function updateAutoRow(colStart, colEnd, rowStart, rowEnd, table, direction = 'up', part) {
40576
40813
  if (direction === 'up') {
40577
40814
  for (let col = colStart; col <= colEnd; col++) {
40578
40815
  for (let row = rowStart; row <= rowEnd; row++) {
@@ -40584,6 +40821,13 @@
40584
40821
  if (cellGroup._prev) {
40585
40822
  y = cellGroup._prev?.attribute.y + table.getRowHeight(cellGroup._prev.row);
40586
40823
  }
40824
+ else if (part) {
40825
+ const baseCellGroup = table.scenegraph.highPerformanceGetCell(col, rowEnd + 1, true);
40826
+ y = baseCellGroup.attribute.y;
40827
+ for (let r = rowStart; r <= rowEnd; r++) {
40828
+ y -= table.getRowHeight(r);
40829
+ }
40830
+ }
40587
40831
  else {
40588
40832
  y = table.getRowsHeight(table.columnHeaderLevelCount, cellGroup.row - 1);
40589
40833
  }
@@ -40602,6 +40846,13 @@
40602
40846
  if (cellGroup._next) {
40603
40847
  y = cellGroup._next?.attribute.y - table.getRowHeight(cellGroup.row);
40604
40848
  }
40849
+ else if (part) {
40850
+ const baseCellGroup = table.scenegraph.highPerformanceGetCell(col, rowStart - 1, true);
40851
+ y = baseCellGroup.attribute.y;
40852
+ for (let r = rowStart; r <= rowEnd; r++) {
40853
+ y += table.getRowHeight(r);
40854
+ }
40855
+ }
40605
40856
  else {
40606
40857
  y = table.getRowsHeight(table.columnHeaderLevelCount, cellGroup.row - 1);
40607
40858
  }
@@ -40677,9 +40928,9 @@
40677
40928
  proxy.rowEnd = direction === 'up' ? proxy.rowEnd + count : proxy.rowEnd - count;
40678
40929
  updateRowContent(syncTopRow, syncBottomRow, proxy);
40679
40930
  if (proxy.table.heightMode === 'autoHeight') {
40680
- updateAutoRow(proxy.bodyLeftCol, proxy.bodyRightCol, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
40681
- updateAutoRow(0, proxy.table.frozenColCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
40682
- updateAutoRow(proxy.table.colCount - proxy.table.rightFrozenColCount, proxy.table.colCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up');
40931
+ updateAutoRow(proxy.bodyLeftCol, proxy.bodyRightCol, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up', true);
40932
+ updateAutoRow(0, proxy.table.frozenColCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up', true);
40933
+ updateAutoRow(proxy.table.colCount - proxy.table.rightFrozenColCount, proxy.table.colCount - 1, syncTopRow, syncBottomRow, proxy.table, distEndRow > proxy.bodyBottomRow - (proxy.rowEnd - proxy.rowStart + 1) ? 'down' : 'up', true);
40683
40934
  const cellGroup = proxy.table.scenegraph.highPerformanceGetCell(proxy.colStart, screenTopRow, true);
40684
40935
  const deltaY = screenTopY - (cellGroup.attribute.y + proxy.table.getFrozenRowsHeight() + proxy.table.scenegraph.proxy.deltaY);
40685
40936
  proxy.table.scenegraph.proxy.deltaY += deltaY;
@@ -41137,7 +41388,7 @@
41137
41388
  computeColsWidth(this.table, this.currentCol + 1, endCol);
41138
41389
  for (let row = 0; row < this.table.rowCount; row++) {
41139
41390
  const cellGroup = this.highPerformanceGetCell(this.currentCol, row);
41140
- if (isNumber$3(cellGroup.mergeStartCol) && cellGroup.mergeStartCol > this.currentCol) {
41391
+ if (isNumber$2(cellGroup.mergeStartCol) && cellGroup.mergeStartCol > this.currentCol) {
41141
41392
  this.table.scenegraph.updateCellContent(cellGroup.col, cellGroup.row);
41142
41393
  }
41143
41394
  }
@@ -41231,9 +41482,9 @@
41231
41482
  }
41232
41483
  updateRowContent(this.rowUpdatePos, distRow, this);
41233
41484
  if (this.table.heightMode === 'autoHeight') {
41234
- updateAutoRow(this.bodyLeftCol, this.bodyRightCol, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection);
41235
- updateAutoRow(0, this.table.frozenColCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection);
41236
- updateAutoRow(this.table.colCount - this.table.rightFrozenColCount, this.table.colCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection);
41485
+ updateAutoRow(this.bodyLeftCol, this.bodyRightCol, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, true);
41486
+ updateAutoRow(0, this.table.frozenColCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, true);
41487
+ updateAutoRow(this.table.colCount - this.table.rightFrozenColCount, this.table.colCount - 1, this.rowUpdatePos, distRow, this.table, this.rowUpdateDirection, true);
41237
41488
  }
41238
41489
  this.rowUpdatePos = distRow + 1;
41239
41490
  }
@@ -41401,6 +41652,8 @@
41401
41652
  const columnHeaderGroup = table.scenegraph.getColGroup(col, true);
41402
41653
  const columnGroup = table.scenegraph.getColGroup(col);
41403
41654
  const columnBottomGroup = table.scenegraph.getColGroupInBottom(col);
41655
+ const columnLeftBottomGroup = table.scenegraph.getColGroupInLeftBottomCorner(col);
41656
+ const columnRightBottomGroup = table.scenegraph.getColGroupInRightBottomCorner(col);
41404
41657
  if (columnHeaderGroup) {
41405
41658
  columnHeaderGroup.setAttribute('width', columnWidth);
41406
41659
  columnHeaderGroup.forEachChildren((child) => {
@@ -41419,6 +41672,18 @@
41419
41672
  child.setAttribute('width', columnWidth);
41420
41673
  });
41421
41674
  }
41675
+ if (columnRightBottomGroup) {
41676
+ columnRightBottomGroup.setAttribute('width', columnWidth);
41677
+ columnRightBottomGroup.forEachChildren((child) => {
41678
+ child.setAttribute('width', columnWidth);
41679
+ });
41680
+ }
41681
+ if (columnLeftBottomGroup) {
41682
+ columnLeftBottomGroup.setAttribute('width', columnWidth);
41683
+ columnLeftBottomGroup.forEachChildren((child) => {
41684
+ child.setAttribute('width', columnWidth);
41685
+ });
41686
+ }
41422
41687
  }
41423
41688
  scene.updateContainer();
41424
41689
  if (direction === 'column') {
@@ -41938,28 +42203,28 @@
41938
42203
  });
41939
42204
  const rowHeightsMap = table.rowHeightsMap;
41940
42205
  removeRows.forEach(row => {
41941
- rowHeightsMap.delAndReorder(row);
42206
+ rowHeightsMap.delete(row);
41942
42207
  });
41943
42208
  if (removeRows.length) {
41944
42209
  resetRowNumber(scene);
41945
42210
  const beforeRow = removeRows[removeRows.length - 1] - 1;
41946
42211
  const afterRow = removeRows[0] - removeRows.length + 1;
41947
42212
  const rowUpdatePos = updateMergeCellGroup(beforeRow, afterRow, scene);
41948
- isNumber$3(rowUpdatePos) && (scene.proxy.rowUpdatePos = Math.min(scene.proxy.rowUpdatePos, rowUpdatePos));
42213
+ isNumber$2(rowUpdatePos) && (scene.proxy.rowUpdatePos = Math.min(scene.proxy.rowUpdatePos, rowUpdatePos));
41949
42214
  }
41950
42215
  scene.table._clearRowRangeHeightsMap();
41951
42216
  let updateAfter;
41952
42217
  addRows.forEach(row => {
41953
42218
  const needUpdateAfter = addRow(row, scene);
41954
42219
  updateAfter = updateAfter ?? needUpdateAfter;
41955
- rowHeightsMap.addAndReorder(row);
42220
+ rowHeightsMap.insert(row);
41956
42221
  });
41957
42222
  resetRowNumberAndY(scene);
41958
42223
  if (addRows.length) {
41959
42224
  const beforeRow = addRows[0] - 1;
41960
42225
  const afterRow = addRows[addRows.length - 1] + 1;
41961
42226
  const rowUpdatePos = updateMergeCellGroup(beforeRow, afterRow, scene);
41962
- isNumber$3(rowUpdatePos) && (scene.proxy.rowUpdatePos = Math.min(scene.proxy.rowUpdatePos, rowUpdatePos));
42227
+ isNumber$2(rowUpdatePos) && (scene.proxy.rowUpdatePos = Math.min(scene.proxy.rowUpdatePos, rowUpdatePos));
41963
42228
  }
41964
42229
  for (let col = 0; col < table.colCount; col++) {
41965
42230
  updateRows.forEach(r => {
@@ -41980,9 +42245,9 @@
41980
42245
  const beforeRow = updateRows[0] - 1;
41981
42246
  const afterRow = updateRows[updateRows.length - 1] + 1;
41982
42247
  const rowUpdatePos = updateMergeCellGroup(beforeRow, afterRow, scene);
41983
- isNumber$3(rowUpdatePos) && (scene.proxy.rowUpdatePos = Math.min(scene.proxy.rowUpdatePos, rowUpdatePos));
42248
+ isNumber$2(rowUpdatePos) && (scene.proxy.rowUpdatePos = Math.min(scene.proxy.rowUpdatePos, rowUpdatePos));
41984
42249
  }
41985
- if (isNumber$3(updateAfter)) {
42250
+ if (isNumber$2(updateAfter)) {
41986
42251
  for (let col = 0; col < table.colCount; col++) {
41987
42252
  for (let row = updateAfter; row < table.rowCount; row++) {
41988
42253
  const cellGroup = scene.highPerformanceGetCell(col, row, true);
@@ -41992,7 +42257,7 @@
41992
42257
  scene.proxy.rowUpdatePos = Math.min(scene.proxy.rowUpdatePos, updateAfter);
41993
42258
  }
41994
42259
  if (addRows.length) {
41995
- if (!isNumber$3(updateAfter)) {
42260
+ if (!isNumber$2(updateAfter)) {
41996
42261
  const minRow = Math.min(...addRows);
41997
42262
  scene.proxy.rowUpdatePos = Math.min(minRow, scene.proxy.rowUpdatePos);
41998
42263
  }
@@ -42060,15 +42325,6 @@
42060
42325
  }
42061
42326
  return row;
42062
42327
  }
42063
- function deduplication$1(array) {
42064
- const result = [];
42065
- for (let i = 0; i < array.length; i++) {
42066
- if (result.indexOf(array[i]) === -1) {
42067
- result.push(array[i]);
42068
- }
42069
- }
42070
- return result;
42071
- }
42072
42328
  function resetRowNumber(scene) {
42073
42329
  scene.bodyGroup.forEachChildren((colGroup) => {
42074
42330
  let rowIndex = scene.bodyRowStart;
@@ -42300,7 +42556,7 @@
42300
42556
  });
42301
42557
  });
42302
42558
  });
42303
- changedCells.length = 0;
42559
+ changedCells.clear();
42304
42560
  const { scrollTop, scrollLeft, frozenRowCount, frozenColCount } = table;
42305
42561
  const frozenRowsHeight = table.getFrozenRowsHeight();
42306
42562
  const frozenColsWidth = table.getFrozenColsWidth();
@@ -42364,10 +42620,10 @@
42364
42620
  }
42365
42621
  }
42366
42622
  function adjustCellContentVerticalLayout(cellGroup, minTop, maxTop, changedCells, table) {
42367
- if (isNumber$3(cellGroup.mergeStartCol) &&
42368
- isNumber$3(cellGroup.mergeStartRow) &&
42369
- isNumber$3(cellGroup.mergeEndCol) &&
42370
- isNumber$3(cellGroup.mergeEndRow)) {
42623
+ if (isNumber$2(cellGroup.mergeStartCol) &&
42624
+ isNumber$2(cellGroup.mergeStartRow) &&
42625
+ isNumber$2(cellGroup.mergeEndCol) &&
42626
+ isNumber$2(cellGroup.mergeEndRow)) {
42371
42627
  for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) {
42372
42628
  for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) {
42373
42629
  const singleCellGroup = table.scenegraph.getCell(col, row);
@@ -42399,34 +42655,36 @@
42399
42655
  const textBottom = graphic.globalAABBBounds.y2;
42400
42656
  if (textTop < minTop) {
42401
42657
  const deltaHeight = textTop - minTop;
42402
- changedCells.push({
42403
- col: cellGroup.col,
42404
- row: cellGroup.row,
42405
- dx: cellGroup.firstChild?.attribute.dx ?? 0,
42406
- dy: cellGroup.firstChild?.attribute.dy ?? 0
42407
- });
42658
+ !changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
42659
+ changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
42660
+ col: cellGroup.col,
42661
+ row: cellGroup.row,
42662
+ dx: cellGroup.firstChild?.attribute.dx ?? 0,
42663
+ dy: cellGroup.firstChild?.attribute.dy ?? 0
42664
+ });
42408
42665
  cellGroup.forEachChildren((child) => {
42409
42666
  child.setAttribute('dy', (child.attribute.dy ?? 0) - deltaHeight + 2);
42410
42667
  });
42411
42668
  }
42412
42669
  else if (textBottom > maxTop) {
42413
42670
  const deltaHeight = textBottom - maxTop;
42414
- changedCells.push({
42415
- col: cellGroup.col,
42416
- row: cellGroup.row,
42417
- dx: cellGroup.firstChild?.attribute.dx ?? 0,
42418
- dy: cellGroup.firstChild?.attribute.dy ?? 0
42419
- });
42671
+ !changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
42672
+ changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
42673
+ col: cellGroup.col,
42674
+ row: cellGroup.row,
42675
+ dx: cellGroup.firstChild?.attribute.dx ?? 0,
42676
+ dy: cellGroup.firstChild?.attribute.dy ?? 0
42677
+ });
42420
42678
  cellGroup.forEachChildren((child) => {
42421
42679
  child.setAttribute('dy', (child.attribute.dy ?? 0) - deltaHeight);
42422
42680
  });
42423
42681
  }
42424
42682
  }
42425
42683
  function adjustCellContentHorizontalLayout(cellGroup, minLeft, maxLeft, changedCells, table) {
42426
- if (isNumber$3(cellGroup.mergeStartCol) &&
42427
- isNumber$3(cellGroup.mergeStartRow) &&
42428
- isNumber$3(cellGroup.mergeEndCol) &&
42429
- isNumber$3(cellGroup.mergeEndRow)) {
42684
+ if (isNumber$2(cellGroup.mergeStartCol) &&
42685
+ isNumber$2(cellGroup.mergeStartRow) &&
42686
+ isNumber$2(cellGroup.mergeEndCol) &&
42687
+ isNumber$2(cellGroup.mergeEndRow)) {
42430
42688
  for (let col = cellGroup.mergeStartCol; col <= cellGroup.mergeEndCol; col++) {
42431
42689
  for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) {
42432
42690
  const singleCellGroup = table.scenegraph.getCell(col, row);
@@ -42448,24 +42706,26 @@
42448
42706
  const textRight = text.globalAABBBounds.x2;
42449
42707
  if (textLeft < minLeft) {
42450
42708
  const deltaWidth = textLeft - minLeft;
42451
- changedCells.push({
42452
- col: cellGroup.col,
42453
- row: cellGroup.row,
42454
- dx: cellGroup.firstChild?.attribute.dx ?? 0,
42455
- dy: cellGroup.firstChild?.attribute.dy ?? 0
42456
- });
42709
+ !changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
42710
+ changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
42711
+ col: cellGroup.col,
42712
+ row: cellGroup.row,
42713
+ dx: cellGroup.firstChild?.attribute.dx ?? 0,
42714
+ dy: cellGroup.firstChild?.attribute.dy ?? 0
42715
+ });
42457
42716
  cellGroup.forEachChildren((child) => {
42458
42717
  child.setAttribute('dx', (child.attribute.dx ?? 0) - deltaWidth + 2);
42459
42718
  });
42460
42719
  }
42461
42720
  else if (textRight > maxLeft) {
42462
42721
  const deltaWidth = textRight - maxLeft;
42463
- changedCells.push({
42464
- col: cellGroup.col,
42465
- row: cellGroup.row,
42466
- dx: cellGroup.firstChild?.attribute.dx ?? 0,
42467
- dy: cellGroup.firstChild?.attribute.dy ?? 0
42468
- });
42722
+ !changedCells.has(`${cellGroup.col}-${cellGroup.row}`) &&
42723
+ changedCells.set(`${cellGroup.col}-${cellGroup.row}`, {
42724
+ col: cellGroup.col,
42725
+ row: cellGroup.row,
42726
+ dx: cellGroup.firstChild?.attribute.dx ?? 0,
42727
+ dy: cellGroup.firstChild?.attribute.dy ?? 0
42728
+ });
42469
42729
  cellGroup.forEachChildren((child) => {
42470
42730
  child.setAttribute('dx', (child.attribute.dx ?? 0) - deltaWidth);
42471
42731
  });
@@ -43458,7 +43718,7 @@
43458
43718
  }
43459
43719
  }
43460
43720
  });
43461
- if (isNumber$3(updateAfter)) {
43721
+ if (isNumber$2(updateAfter)) {
43462
43722
  for (let col = updateAfter; col < table.colCount; col++) {
43463
43723
  for (let row = 0; row < table.rowCount; row++) {
43464
43724
  const cellGroup = scene.highPerformanceGetCell(col, row, true);
@@ -43468,7 +43728,7 @@
43468
43728
  scene.proxy.colUpdatePos = updateAfter;
43469
43729
  }
43470
43730
  if (addCols.length) {
43471
- if (!isNumber$3(updateAfter)) {
43731
+ if (!isNumber$2(updateAfter)) {
43472
43732
  const minCol = Math.min(...addCols);
43473
43733
  scene.proxy.colUpdatePos = minCol;
43474
43734
  }
@@ -44351,11 +44611,9 @@
44351
44611
  }
44352
44612
  }
44353
44613
  updateRowHeight(row, detaY, skipTableHeightMap) {
44354
- if (row >= this.proxy.rowStart && row <= this.proxy.rowEnd) {
44355
- detaY = Math.round(detaY);
44356
- updateRowHeight(this, row, detaY, skipTableHeightMap);
44357
- this.updateContainerHeight(row, detaY);
44358
- }
44614
+ detaY = Math.round(detaY);
44615
+ updateRowHeight(this, row, detaY, skipTableHeightMap);
44616
+ this.updateContainerHeight(row, detaY);
44359
44617
  }
44360
44618
  updateRowsHeight(rows, detaYs, skipTableHeightMap) {
44361
44619
  for (let i = 0; i < rows.length; i++) {
@@ -44423,7 +44681,10 @@
44423
44681
  if (oldHeight === height) {
44424
44682
  return;
44425
44683
  }
44426
- this.updateRowHeight(row, height - oldHeight);
44684
+ if ((row >= this.proxy.rowStart && row <= this.proxy.rowEnd) ||
44685
+ (row >= this.table.rowCount - this.table.bottomFrozenRowCount && row <= this.table.rowCount - 1)) {
44686
+ this.updateRowHeight(row, height - oldHeight);
44687
+ }
44427
44688
  this.table._clearRowRangeHeightsMap(row);
44428
44689
  }
44429
44690
  setX(x) {
@@ -44663,7 +44924,7 @@
44663
44924
  this.colHeaderGroup.setDeltaWidth(colHeaderX - this.colHeaderGroup.attribute.width);
44664
44925
  this.rowHeaderGroup.setDeltaWidth(rowHeaderX - this.rowHeaderGroup.attribute.width);
44665
44926
  this.bottomFrozenGroup.setDeltaWidth(colHeaderX - this.bottomFrozenGroup.attribute.width);
44666
- this.rightFrozenGroup.setDeltaWidth(rightX - this.table.getRightFrozenColsWidth());
44927
+ this.rightFrozenGroup.setDeltaWidth(rightX - this.rightFrozenGroup.attribute.width);
44667
44928
  this.rightTopCornerGroup.setDeltaWidth(rightX - this.rightTopCornerGroup.attribute.width);
44668
44929
  this.rightBottomCornerGroup.setDeltaWidth(rightX - this.rightBottomCornerGroup.attribute.width);
44669
44930
  this.bodyGroup.setDeltaWidth(bodyX - this.bodyGroup.attribute.width);
@@ -44832,9 +45093,30 @@
44832
45093
  this.stage.enableDirtyBounds();
44833
45094
  }
44834
45095
  updateRow(removeCells, addCells, updateCells = []) {
45096
+ const addRows = deduplication$1(addCells.map(cell => cell.row)).sort((a, b) => a - b);
45097
+ const updateRows = deduplication$1(updateCells.map(cell => cell.row)).sort((a, b) => a - b);
45098
+ const isNotFillHeight = this.table.getAllRowsHeight() -
45099
+ [...addRows, ...updateRows].reduce((tolHeight, rowNumber) => {
45100
+ return tolHeight + this.table.getRowHeight(rowNumber);
45101
+ }, 0) <=
45102
+ this.table.tableNoFrameHeight;
44835
45103
  updateRow(removeCells, addCells, updateCells, this.table);
44836
45104
  this.recalculateColWidths();
44837
- this.recalculateRowHeights();
45105
+ if (this.table.heightMode === 'adaptive' ||
45106
+ (this.table.autoFillHeight && (this.table.getAllRowsHeight() <= this.table.tableNoFrameHeight || isNotFillHeight))) {
45107
+ this.table.scenegraph.recalculateRowHeights();
45108
+ }
45109
+ else if (this.table.heightMode === 'autoHeight') {
45110
+ for (let i = 0; i < updateRows.length; i++) {
45111
+ const row = updateRows[i];
45112
+ const oldHeight = this.table.getRowHeight(row);
45113
+ const newHeight = computeRowHeight(row, 0, this.table.colCount - 1, this.table);
45114
+ if ((row >= this.proxy.rowStart && row <= this.proxy.rowEnd) ||
45115
+ (row >= this.table.rowCount - this.table.bottomFrozenRowCount && row <= this.table.rowCount - 1)) {
45116
+ this.table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
45117
+ }
45118
+ }
45119
+ }
44838
45120
  this.table.stateManager.checkFrozen();
44839
45121
  if (!this.isPivot && !this.transpose) {
44840
45122
  this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
@@ -45242,7 +45524,10 @@
45242
45524
  }
45243
45525
  else if (col >= 0 && row >= 0) {
45244
45526
  const cellRange = table.getCellRange(col, row);
45245
- state.select.ranges.push(cellRange);
45527
+ state.select.ranges.push({
45528
+ start: { col: cellRange.start.col, row: cellRange.start.row },
45529
+ end: { col: cellRange.end.col, row: cellRange.end.row }
45530
+ });
45246
45531
  }
45247
45532
  cellPos.col = col;
45248
45533
  cellPos.row = row;
@@ -45496,20 +45781,44 @@
45496
45781
  let backX;
45497
45782
  let lineY;
45498
45783
  let backY;
45499
- const cellLocation = state.table.getCellLocation(col, row);
45784
+ const cellLocation = state.table.getCellLocation(state.columnMove.colSource, state.columnMove.rowSource);
45500
45785
  if (cellLocation === 'columnHeader') {
45501
- (backX = state.columnMove.x),
45502
- (lineX =
45786
+ backX = state.columnMove.x;
45787
+ if (state.table.isFrozenColumn(col)) {
45788
+ lineX =
45503
45789
  state.columnMove.colTarget >= state.columnMove.colSource
45504
45790
  ? state.table.getColsWidth(0, state.columnMove.colTarget)
45505
- : state.table.getColsWidth(0, state.columnMove.colTarget - 1));
45791
+ : state.table.getColsWidth(0, state.columnMove.colTarget - 1);
45792
+ }
45793
+ else if (state.table.isRightFrozenColumn(col)) {
45794
+ lineX = state.table.tableNoFrameWidth - state.table.getColsWidth(targetCell.col + 1, state.table.colCount - 1);
45795
+ }
45796
+ else {
45797
+ lineX =
45798
+ (state.columnMove.colTarget >= state.columnMove.colSource
45799
+ ? state.table.getColsWidth(0, state.columnMove.colTarget)
45800
+ : state.table.getColsWidth(0, state.columnMove.colTarget - 1)) -
45801
+ state.table.stateManager.scroll.horizontalBarPos;
45802
+ }
45506
45803
  }
45507
45804
  else if (cellLocation === 'rowHeader') {
45508
- (backY = state.columnMove.y),
45509
- (lineY =
45805
+ backY = state.columnMove.y;
45806
+ if (state.table.isFrozenRow(row)) {
45807
+ lineY =
45510
45808
  state.columnMove.rowTarget >= state.columnMove.rowSource
45511
45809
  ? state.table.getRowsHeight(0, state.columnMove.rowTarget)
45512
- : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1));
45810
+ : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1);
45811
+ }
45812
+ else if (state.table.isBottomFrozenRow(row)) {
45813
+ lineY = state.table.tableNoFrameHeight - state.table.getRowsHeight(targetCell.row + 1, state.table.rowCount - 1);
45814
+ }
45815
+ else {
45816
+ lineY =
45817
+ (state.columnMove.rowTarget >= state.columnMove.rowSource
45818
+ ? state.table.getRowsHeight(0, state.columnMove.rowTarget)
45819
+ : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1)) -
45820
+ state.table.stateManager.scroll.verticalBarPos;
45821
+ }
45513
45822
  }
45514
45823
  state.table.scenegraph.component.updateMoveCol(backX, lineX, backY, lineY);
45515
45824
  state.table.scenegraph.updateNextFrame();
@@ -45528,6 +45837,28 @@
45528
45837
  clearWidthsAndHeightsCache(state.columnMove.colSource, state.columnMove.rowSource, state.columnMove.colTarget, state.columnMove.rowTarget, state.table);
45529
45838
  state.table.clearCellStyleCache();
45530
45839
  state.table.scenegraph.updateHeaderPosition(state.columnMove.colSource, state.columnMove.rowSource, state.columnMove.colTarget, state.columnMove.rowTarget, sourceMergeInfo, targetMergeInfo);
45840
+ if (state.table.internalProps.frozenColDragHeaderMode === 'adjustFrozenCount' && state.table.isListTable()) {
45841
+ if (state.table.isFrozenColumn(state.columnMove.colTarget) &&
45842
+ !state.table.isFrozenColumn(state.columnMove.colSource)) {
45843
+ state.table.frozenColCount +=
45844
+ sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1;
45845
+ }
45846
+ else if (state.table.isFrozenColumn(state.columnMove.colSource) &&
45847
+ !state.table.isFrozenColumn(state.columnMove.colTarget)) {
45848
+ state.table.frozenColCount -=
45849
+ sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1;
45850
+ }
45851
+ if (state.table.isRightFrozenColumn(state.columnMove.colTarget) &&
45852
+ !state.table.isRightFrozenColumn(state.columnMove.colSource)) {
45853
+ state.table.rightFrozenColCount +=
45854
+ sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1;
45855
+ }
45856
+ else if (state.table.isRightFrozenColumn(state.columnMove.colSource) &&
45857
+ !state.table.isRightFrozenColumn(state.columnMove.colTarget)) {
45858
+ state.table.rightFrozenColCount -=
45859
+ sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1;
45860
+ }
45861
+ }
45531
45862
  }
45532
45863
  state.updateCursor();
45533
45864
  }
@@ -46854,14 +47185,15 @@
46854
47185
  if (stateManager.interactionState === InteractionState.scrolling) {
46855
47186
  return;
46856
47187
  }
46857
- if (stateManager.interactionState === InteractionState.grabing &&
46858
- Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1) {
46859
- if (stateManager.isResizeCol()) ;
46860
- else if (stateManager.isMoveCol()) {
46861
- eventManager.dealColumnMover(eventArgsSet);
46862
- }
46863
- else {
46864
- eventManager.dealTableSelect(eventArgsSet, true);
47188
+ if (stateManager.interactionState === InteractionState.grabing) {
47189
+ if (Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1) {
47190
+ if (stateManager.isResizeCol()) ;
47191
+ else if (stateManager.isMoveCol()) {
47192
+ eventManager.dealColumnMover(eventArgsSet);
47193
+ }
47194
+ else {
47195
+ eventManager.dealTableSelect(eventArgsSet, true);
47196
+ }
46865
47197
  }
46866
47198
  return;
46867
47199
  }
@@ -48164,7 +48496,9 @@
48164
48496
  }
48165
48497
  dealColumnMover(eventArgsSet) {
48166
48498
  const { eventArgs } = eventArgsSet;
48167
- this.table.stateManager.updateMoveCol(eventArgs.col, eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
48499
+ if (isValid$1(eventArgs.col) && isValid$1(eventArgs.row)) {
48500
+ this.table.stateManager.updateMoveCol(eventArgs.col, eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
48501
+ }
48168
48502
  }
48169
48503
  startColumnResize(eventArgsSet) {
48170
48504
  }
@@ -51030,6 +51364,238 @@
51030
51364
  return new DiscreteTableLegend(option, table);
51031
51365
  }
51032
51366
 
51367
+ class NumberRangeMap {
51368
+ data;
51369
+ cumulativeSum;
51370
+ difference;
51371
+ totalSum;
51372
+ table;
51373
+ isUpdate = false;
51374
+ _keys = [];
51375
+ _sorted = false;
51376
+ constructor(table) {
51377
+ this.data = new Map();
51378
+ this._keys.length = 0;
51379
+ this.cumulativeSum = new Map();
51380
+ this.difference = new Map();
51381
+ this.totalSum = 0;
51382
+ this.table = table;
51383
+ }
51384
+ clear() {
51385
+ this.data.clear();
51386
+ this.cumulativeSum.clear();
51387
+ this.difference.clear();
51388
+ this.totalSum = 0;
51389
+ }
51390
+ clearRange() {
51391
+ this.cumulativeSum.clear();
51392
+ this.difference.clear();
51393
+ }
51394
+ add(position, value) {
51395
+ const defaultValue = this.table.getRowHeight(position);
51396
+ if (!this.data.has(position)) {
51397
+ this._keys.push(position);
51398
+ this._sorted = false;
51399
+ }
51400
+ this.data.set(position, value);
51401
+ this.totalSum += value;
51402
+ this.updateDifference(position, value - defaultValue);
51403
+ }
51404
+ remove(position) {
51405
+ if (this.data.has(position)) {
51406
+ const value = this.data.get(position);
51407
+ this.data.delete(position);
51408
+ const index = this._keys.indexOf(position);
51409
+ if (index !== -1) {
51410
+ this._keys.splice(index, 1);
51411
+ }
51412
+ this.totalSum -= value;
51413
+ const defaultValue = this.table.getRowHeight(position);
51414
+ this.updateDifference(position, defaultValue - value);
51415
+ }
51416
+ }
51417
+ put(position, newValue) {
51418
+ if (this.data.has(position)) {
51419
+ const oldValue = this.data.get(position);
51420
+ this.data.set(position, newValue);
51421
+ const difference = newValue - oldValue;
51422
+ this.totalSum += difference;
51423
+ this.updateDifference(position, difference);
51424
+ }
51425
+ else {
51426
+ this.add(position, newValue);
51427
+ }
51428
+ }
51429
+ get(position) {
51430
+ return this.data.get(position);
51431
+ }
51432
+ has(position) {
51433
+ return this.data.has(position);
51434
+ }
51435
+ _sort() {
51436
+ const { _keys: keys } = this;
51437
+ if (!this._sorted) {
51438
+ keys.sort((a, b) => {
51439
+ if (a < b) {
51440
+ return -1;
51441
+ }
51442
+ if (a > b) {
51443
+ return 1;
51444
+ }
51445
+ return 0;
51446
+ });
51447
+ this._sorted = true;
51448
+ }
51449
+ }
51450
+ updateDifference(position, difference) {
51451
+ const oldDifference = this.difference.get(position) ?? 0;
51452
+ this.difference.set(position, oldDifference + difference);
51453
+ this.update();
51454
+ }
51455
+ getSumInRange(start, end) {
51456
+ return this.calculatePrefixSum(end) - this.calculatePrefixSum(start - 1);
51457
+ }
51458
+ updateCumulativeSum(position, difference) {
51459
+ for (const [pos, sum] of this.cumulativeSum) {
51460
+ if (pos >= position) {
51461
+ this.cumulativeSum.set(pos, sum + difference);
51462
+ }
51463
+ }
51464
+ }
51465
+ calculatePrefixSum(position) {
51466
+ if (position < 0) {
51467
+ return 0;
51468
+ }
51469
+ if (this.cumulativeSum.has(position)) {
51470
+ let cache = this.cumulativeSum.get(position);
51471
+ for (const [pos, difference] of this.difference) {
51472
+ if (pos <= position) {
51473
+ cache += difference;
51474
+ }
51475
+ }
51476
+ return cache;
51477
+ }
51478
+ this.dealDiffenence();
51479
+ return this.getCumulativeSum(position);
51480
+ }
51481
+ getCumulativeSum(position) {
51482
+ let sum = 0;
51483
+ for (let i = position; i >= 0; i--) {
51484
+ if (this.cumulativeSum.has(i)) {
51485
+ sum += this.cumulativeSum.get(i);
51486
+ break;
51487
+ }
51488
+ else {
51489
+ sum += this.data.get(i) ?? this.table.getRowHeight(i);
51490
+ }
51491
+ }
51492
+ this.cumulativeSum.set(position, sum);
51493
+ return sum;
51494
+ }
51495
+ update() {
51496
+ if (this.isUpdate) {
51497
+ return;
51498
+ }
51499
+ this.isUpdate = true;
51500
+ setTimeout(() => {
51501
+ this.dealDiffenence();
51502
+ this.isUpdate = false;
51503
+ }, 0);
51504
+ }
51505
+ dealDiffenence() {
51506
+ for (const [sumPos, sum] of this.cumulativeSum) {
51507
+ for (const [difPos, difference] of this.difference) {
51508
+ if (sumPos >= difPos) {
51509
+ this.cumulativeSum.set(sumPos, sum + difference);
51510
+ }
51511
+ }
51512
+ }
51513
+ this.difference.clear();
51514
+ }
51515
+ insert(position, value) {
51516
+ const lastIndex = this.getLastIndex() + 1;
51517
+ this.adjustOrder(position, position + 1, lastIndex - position);
51518
+ if (isValid$1(value)) {
51519
+ this.put(position, value);
51520
+ }
51521
+ }
51522
+ getLastIndex() {
51523
+ this._sort();
51524
+ return this._keys[this._keys.length - 1];
51525
+ }
51526
+ delLast() {
51527
+ const lastIndex = this.getLastIndex();
51528
+ this.remove(lastIndex);
51529
+ }
51530
+ delete(position) {
51531
+ if (!this.has(position)) {
51532
+ return;
51533
+ }
51534
+ const lastIndex = this.getLastIndex();
51535
+ this.adjustOrder(position + 1, position, lastIndex - position);
51536
+ this.delLast();
51537
+ }
51538
+ adjustOrder(sourceIndex, targetIndex, moveCount) {
51539
+ this.clearRange();
51540
+ this._sort();
51541
+ const { _keys: keys } = this;
51542
+ if (sourceIndex > targetIndex) {
51543
+ const sourceVals = [];
51544
+ for (let i = indexFirst(keys, sourceIndex + moveCount - 1); i >= 0; i--) {
51545
+ const key = keys[i];
51546
+ if (key >= sourceIndex) {
51547
+ sourceVals.push(this.get(key));
51548
+ }
51549
+ else if (targetIndex <= key && key < sourceIndex) {
51550
+ this.put(key + moveCount, this.get(key));
51551
+ }
51552
+ else if (key < targetIndex) {
51553
+ break;
51554
+ }
51555
+ }
51556
+ for (let i = 0; i < moveCount; i++) {
51557
+ this.put(targetIndex + i, sourceVals[moveCount - 1 - i]);
51558
+ }
51559
+ }
51560
+ const { length } = keys;
51561
+ if (sourceIndex < targetIndex) {
51562
+ const sourceVals = [];
51563
+ for (let i = indexFirst(keys, sourceIndex); i < length; i++) {
51564
+ const key = keys[i];
51565
+ if (key >= sourceIndex && key < sourceIndex + moveCount) {
51566
+ sourceVals.push(this.get(key));
51567
+ }
51568
+ else if (sourceIndex + moveCount <= key && key <= targetIndex) {
51569
+ this.put(key - moveCount, this.get(key));
51570
+ }
51571
+ else if (key > targetIndex) {
51572
+ break;
51573
+ }
51574
+ }
51575
+ for (let i = 0; i < moveCount; i++) {
51576
+ this.put(targetIndex + i, sourceVals[i]);
51577
+ }
51578
+ }
51579
+ }
51580
+ }
51581
+ function indexFirst(arr, elm) {
51582
+ let low = 0;
51583
+ let high = arr.length - 1;
51584
+ while (low <= high) {
51585
+ const i = Math.floor((low + high) / 2);
51586
+ if (arr[i] === elm) {
51587
+ return i;
51588
+ }
51589
+ else if (arr[i] > elm) {
51590
+ high = i - 1;
51591
+ }
51592
+ else {
51593
+ low = i + 1;
51594
+ }
51595
+ }
51596
+ return high < 0 ? 0 : high;
51597
+ }
51598
+
51033
51599
  const { toBoxArray } = style;
51034
51600
  const { isTouchEvent } = event;
51035
51601
  const rangeReg = /^\$(\d+)\$(\d+)$/;
@@ -51061,7 +51627,7 @@
51061
51627
  return TABLE_EVENT_TYPE;
51062
51628
  }
51063
51629
  options;
51064
- version = "0.18.4";
51630
+ version = "0.19.0";
51065
51631
  pagination;
51066
51632
  id = `VTable${Date.now()}`;
51067
51633
  headerStyleCache;
@@ -51116,7 +51682,7 @@
51116
51682
  internalProps.context = internalProps.canvas.getContext('2d');
51117
51683
  }
51118
51684
  internalProps.handler = new EventHandler();
51119
- if (isNumber$3(this.options.resizeTime)) {
51685
+ if (isNumber$2(this.options.resizeTime)) {
51120
51686
  internalProps.handler.resizeTime = this.options.resizeTime;
51121
51687
  }
51122
51688
  internalProps.pixelRatio = pixelRatio;
@@ -51132,7 +51698,7 @@
51132
51698
  internalProps.renderChartAsync = renderChartAsync;
51133
51699
  setBatchRenderChartCount(renderChartAsyncBatchCount);
51134
51700
  internalProps.overscrollBehavior = overscrollBehavior ?? 'auto';
51135
- internalProps._rowHeightsMap = new NumberMap();
51701
+ internalProps._rowHeightsMap = new NumberRangeMap(this);
51136
51702
  internalProps._rowRangeHeightsMap = new Map();
51137
51703
  internalProps._colRangeWidthsMap = new Map();
51138
51704
  internalProps._widthResizedColMap = new Set();
@@ -51206,7 +51772,7 @@
51206
51772
  this.headerStyleCache = new Map();
51207
51773
  this.bodyStyleCache = new Map();
51208
51774
  this.bodyBottomStyleCache = new Map();
51209
- internalProps.stick = { changedCells: [] };
51775
+ internalProps.stick = { changedCells: new Map() };
51210
51776
  internalProps.customMergeCell = options.customMergeCell;
51211
51777
  }
51212
51778
  throttleInvalidate = throttle2(this.render.bind(this), 200);
@@ -51486,7 +52052,8 @@
51486
52052
  return 'grid';
51487
52053
  }
51488
52054
  getColsWidth(startCol, endCol) {
51489
- endCol = Math.min(endCol, this.colCount - 1);
52055
+ startCol = Math.max(startCol, 0);
52056
+ endCol = Math.min(endCol, (this.colCount ?? Infinity) - 1);
51490
52057
  const cachedColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol}`);
51491
52058
  if (cachedColWidth !== null && cachedColWidth !== undefined) {
51492
52059
  return cachedColWidth;
@@ -51510,11 +52077,11 @@
51510
52077
  return Math.round(w);
51511
52078
  }
51512
52079
  getRowHeight(row) {
51513
- if (this.rowHeightsMap.get(row)) {
52080
+ if (isValid$1(this.rowHeightsMap.get(row))) {
51514
52081
  return this.rowHeightsMap.get(row);
51515
52082
  }
51516
52083
  const defaultHeight = this.getDefaultRowHeight(row);
51517
- if (isNumber$3(defaultHeight)) {
52084
+ if (isNumber$2(defaultHeight)) {
51518
52085
  return defaultHeight;
51519
52086
  }
51520
52087
  return this.defaultRowHeight;
@@ -51539,26 +52106,8 @@
51539
52106
  }
51540
52107
  }
51541
52108
  getRowsHeight(startRow, endRow) {
51542
- const cachedRowHeight = this._rowRangeHeightsMap.get(`$${startRow}$${endRow}`);
51543
- if (cachedRowHeight !== null && cachedRowHeight !== undefined) {
51544
- return cachedRowHeight;
51545
- }
51546
- const cachedLowerRowHeight = this._rowRangeHeightsMap.get(`$${startRow}$${endRow - 1}`);
51547
- if (cachedLowerRowHeight !== null && cachedLowerRowHeight !== undefined) {
51548
- const height = Math.round(cachedLowerRowHeight +
51549
- (this.rowHeightsMap.get(endRow) ??
51550
- (this.isColumnHeader(0, endRow) || this.isCornerHeader(0, endRow)
51551
- ? Array.isArray(this.defaultHeaderRowHeight) && isNumber$3(this.defaultHeaderRowHeight[endRow])
51552
- ? this.defaultHeaderRowHeight[endRow]
51553
- : isNumber$3(this.defaultHeaderRowHeight)
51554
- ? this.defaultHeaderRowHeight
51555
- : this.internalProps.defaultRowHeight
51556
- : this.internalProps.defaultRowHeight)));
51557
- if (startRow >= 0 && endRow >= 0) {
51558
- this._rowRangeHeightsMap.set(`$${startRow}$${endRow}`, Math.round(height));
51559
- }
51560
- return height;
51561
- }
52109
+ startRow = Math.max(startRow, 0);
52110
+ endRow = Math.min(endRow, (this.rowCount ?? Infinity) - 1);
51562
52111
  let h = 0;
51563
52112
  if (this.heightMode === 'standard' &&
51564
52113
  !this.autoFillHeight &&
@@ -51572,12 +52121,7 @@
51572
52121
  h += this.defaultRowHeight * (endRow - Math.max(this.columnHeaderLevelCount, startRow) + 1);
51573
52122
  }
51574
52123
  else {
51575
- for (let i = startRow; i <= endRow; i++) {
51576
- h += this.getRowHeight(i);
51577
- }
51578
- }
51579
- if (startRow >= 0 && endRow >= 0 && h > 0) {
51580
- this._rowRangeHeightsMap.set(`$${startRow}$${endRow}`, Math.round(h));
52124
+ h = this.rowHeightsMap.getSumInRange(startRow, endRow);
51581
52125
  }
51582
52126
  return Math.round(h);
51583
52127
  }
@@ -51653,22 +52197,7 @@
51653
52197
  }
51654
52198
  }
51655
52199
  _clearRowRangeHeightsMap(row) {
51656
- if (typeof row !== 'number') {
51657
- this._rowRangeHeightsMap.clear();
51658
- }
51659
- else {
51660
- const keys = this._rowRangeHeightsMap.keys();
51661
- for (const key of keys) {
51662
- const reg = rangeReg.exec(key);
51663
- if (reg) {
51664
- const start = Number(reg[1]);
51665
- const end = Number(reg[2]);
51666
- if (row >= start && row <= end) {
51667
- this._rowRangeHeightsMap.delete(key);
51668
- }
51669
- }
51670
- }
51671
- }
52200
+ this.rowHeightsMap.clearRange();
51672
52201
  }
51673
52202
  _getColContentWidth(col) {
51674
52203
  return Number(this.colContentWidthsMap.get(col));
@@ -52205,13 +52734,14 @@
52205
52734
  setBatchRenderChartCount(renderChartAsyncBatchCount);
52206
52735
  internalProps.overscrollBehavior = overscrollBehavior ?? 'auto';
52207
52736
  internalProps.cellTextOverflows = {};
52208
- internalProps._rowHeightsMap = new NumberMap();
52737
+ internalProps._rowHeightsMap = new NumberRangeMap(this);
52209
52738
  internalProps._rowRangeHeightsMap = new Map();
52210
52739
  internalProps._colRangeWidthsMap = new Map();
52211
52740
  internalProps._widthResizedColMap = new Set();
52212
52741
  this.colWidthsMap = new NumberMap();
52213
52742
  this.colContentWidthsMap = new NumberMap();
52214
52743
  this.colWidthsLimit = {};
52744
+ internalProps.stick.changedCells.clear();
52215
52745
  internalProps.theme = themes.of(options.theme ?? themes.DEFAULT);
52216
52746
  this.scenegraph.updateStageBackground();
52217
52747
  internalProps.autoWrapText = options.autoWrapText;
@@ -52909,6 +53439,10 @@
52909
53439
  }
52910
53440
  _canDragHeaderPosition(col, row) {
52911
53441
  if (this.isHeader(col, row) && this.stateManager.isSelected(col, row)) {
53442
+ if (this.internalProps.frozenColDragHeaderMode === 'disabled' &&
53443
+ (this.isFrozenColumn(col) || this.isRightFrozenColumn(col))) {
53444
+ return false;
53445
+ }
52912
53446
  const selectRange = this.stateManager.select.ranges[0];
52913
53447
  if (this.isColumnHeader(col, row)) {
52914
53448
  if (selectRange.end.row !== this.rowCount - 1) {
@@ -53668,10 +54202,10 @@
53668
54202
  }
53669
54203
  }
53670
54204
  }
53671
- if (isNumber$3(axisOption?.min)) {
54205
+ if (isNumber$2(axisOption?.min)) {
53672
54206
  range.min = axisOption.min;
53673
54207
  }
53674
- if (isNumber$3(axisOption?.max)) {
54208
+ if (isNumber$2(axisOption?.max)) {
53675
54209
  range.max = axisOption.max;
53676
54210
  }
53677
54211
  axes.push(merge({
@@ -53724,10 +54258,10 @@
53724
54258
  }
53725
54259
  }
53726
54260
  }
53727
- if (isNumber$3(axisOption?.min)) {
54261
+ if (isNumber$2(axisOption?.min)) {
53728
54262
  range.min = axisOption.min;
53729
54263
  }
53730
- if (isNumber$3(axisOption?.max)) {
54264
+ if (isNumber$2(axisOption?.max)) {
53731
54265
  range.max = axisOption.max;
53732
54266
  }
53733
54267
  axes.push(merge({
@@ -53807,10 +54341,10 @@
53807
54341
  range.min = axisRange[0];
53808
54342
  range.max = axisRange[1];
53809
54343
  }
53810
- if (isNumber$3(axisOption?.min)) {
54344
+ if (isNumber$2(axisOption?.min)) {
53811
54345
  range.min = axisOption.min;
53812
54346
  }
53813
- if (isNumber$3(axisOption?.max)) {
54347
+ if (isNumber$2(axisOption?.max)) {
53814
54348
  range.max = axisOption.max;
53815
54349
  }
53816
54350
  return {
@@ -53831,12 +54365,425 @@
53831
54365
  return isHasChart;
53832
54366
  }
53833
54367
 
54368
+ class DimensionTree {
54369
+ sharedVar;
54370
+ sizeIncludeParent = false;
54371
+ rowExpandLevel;
54372
+ hierarchyType;
54373
+ tree = {
54374
+ id: 0,
54375
+ dimensionKey: '',
54376
+ value: '',
54377
+ children: [],
54378
+ level: -1,
54379
+ levelSpan: 1,
54380
+ startIndex: 0,
54381
+ size: 0,
54382
+ startInTotal: 0,
54383
+ hierarchyState: undefined
54384
+ };
54385
+ totalLevel = 0;
54386
+ dimensionKeys = new NumberMap();
54387
+ cache = new Map();
54388
+ constructor(tree, sharedVar, hierarchyType = 'grid', rowExpandLevel = undefined) {
54389
+ this.sizeIncludeParent = rowExpandLevel !== null && rowExpandLevel !== undefined;
54390
+ this.rowExpandLevel = rowExpandLevel;
54391
+ this.hierarchyType = hierarchyType;
54392
+ this.sharedVar = sharedVar;
54393
+ this.reset(tree);
54394
+ }
54395
+ reset(tree, updateTreeNode = false) {
54396
+ this.cache.clear();
54397
+ this.dimensionKeys = new NumberMap();
54398
+ this.tree.children = tree;
54399
+ this.setTreeNode(this.tree, 0, this.tree);
54400
+ this.totalLevel = this.dimensionKeys.count();
54401
+ }
54402
+ setTreeNode(node, startIndex, parent) {
54403
+ node.startIndex = startIndex;
54404
+ node.startInTotal = (parent.startInTotal ?? 0) + node.startIndex;
54405
+ if (node.dimensionKey ?? node.indicatorKey) {
54406
+ !this.dimensionKeys.contain(node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey) &&
54407
+ this.dimensionKeys.put(node.level, node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey);
54408
+ if (!node.id) {
54409
+ node.id = ++this.sharedVar.seqId;
54410
+ }
54411
+ }
54412
+ let size = node.dimensionKey ? (this.sizeIncludeParent ? 1 : 0) : 0;
54413
+ const children = node.children || node.columns;
54414
+ if (this.hierarchyType === 'grid') {
54415
+ if (children?.length >= 1) {
54416
+ children.forEach((n) => {
54417
+ n.level = (node.level ?? 0) + 1;
54418
+ size += this.setTreeNode(n, size, node);
54419
+ });
54420
+ }
54421
+ else {
54422
+ size = 1;
54423
+ }
54424
+ }
54425
+ else if (node.hierarchyState === HierarchyState.expand && children?.length >= 1) {
54426
+ children.forEach((n) => {
54427
+ n.level = (node.level ?? 0) + 1;
54428
+ size += this.setTreeNode(n, size, node);
54429
+ });
54430
+ }
54431
+ else if (node.hierarchyState === HierarchyState.collapse && children?.length >= 1) {
54432
+ children.forEach((n) => {
54433
+ n.level = (node.level ?? 0) + 1;
54434
+ this.setTreeNode(n, size, node);
54435
+ });
54436
+ }
54437
+ else if (!node.hierarchyState && node.level + 1 < this.rowExpandLevel && children?.length >= 1) {
54438
+ node.hierarchyState = HierarchyState.expand;
54439
+ children.forEach((n) => {
54440
+ n.level = (node.level ?? 0) + 1;
54441
+ size += this.setTreeNode(n, size, node);
54442
+ });
54443
+ }
54444
+ else if (children?.length >= 1) {
54445
+ node.hierarchyState = HierarchyState.collapse;
54446
+ children.forEach((n) => {
54447
+ n.level = (node.level ?? 0) + 1;
54448
+ this.setTreeNode(n, size, node);
54449
+ });
54450
+ }
54451
+ else {
54452
+ node.hierarchyState = HierarchyState.none;
54453
+ size = 1;
54454
+ }
54455
+ node.size = size;
54456
+ return size;
54457
+ }
54458
+ getTreePath(index, maxDeep = 30) {
54459
+ const path = [];
54460
+ this.searchPath(index, this.tree, path, maxDeep);
54461
+ path.shift();
54462
+ return path;
54463
+ }
54464
+ getTreePathByCellIds(ids) {
54465
+ const path = [];
54466
+ let nodes = this.tree.children;
54467
+ for (let i = 0; i < ids.length; i++) {
54468
+ const id = ids[i];
54469
+ const pathNode = this.findNodeById(nodes, id);
54470
+ if (pathNode) {
54471
+ path.push(pathNode);
54472
+ nodes = pathNode.children;
54473
+ }
54474
+ else {
54475
+ break;
54476
+ }
54477
+ }
54478
+ return path;
54479
+ }
54480
+ findNodeById(nodes, id) {
54481
+ return nodes.find(node => {
54482
+ return node.id === id;
54483
+ });
54484
+ }
54485
+ searchPath(index, node, path, maxDeep) {
54486
+ if (!node) {
54487
+ return;
54488
+ }
54489
+ if (index < node.startIndex || index >= node.startIndex + node.size) {
54490
+ return;
54491
+ }
54492
+ path.push(node);
54493
+ if (!node.children || node.children.length === 0 || node.level >= maxDeep) {
54494
+ return;
54495
+ }
54496
+ const cIndex = index - node.startIndex;
54497
+ if (this.cache.has(node.level + 1)) {
54498
+ const cacheNode = this.cache.get(node.level + 1);
54499
+ if (cIndex >= cacheNode.startIndex && cIndex < cacheNode.startIndex + cacheNode.size) {
54500
+ this.searchPath(cIndex, cacheNode, path, maxDeep);
54501
+ return;
54502
+ }
54503
+ }
54504
+ let left = 0;
54505
+ let right = node.children.length - 1;
54506
+ while (left <= right) {
54507
+ const middle = Math.floor((left + right) / 2);
54508
+ const element = node.children[middle];
54509
+ if (cIndex >= element.startIndex && cIndex < element.startIndex + element.size) {
54510
+ this.cache.set(element.level, element);
54511
+ const deleteLevels = [];
54512
+ this.cache.forEach((node, key) => {
54513
+ if (key > element.level) {
54514
+ deleteLevels.push(key);
54515
+ }
54516
+ });
54517
+ deleteLevels.forEach(key => {
54518
+ this.cache.delete(key);
54519
+ });
54520
+ this.searchPath(cIndex, element, path, maxDeep);
54521
+ break;
54522
+ }
54523
+ else if (cIndex < element.startIndex) {
54524
+ right = middle - 1;
54525
+ }
54526
+ else {
54527
+ left = middle + 1;
54528
+ }
54529
+ }
54530
+ return;
54531
+ }
54532
+ movePosition(level, sourceIndex, targetIndex) {
54533
+ let parNode;
54534
+ let sourceSubIndex;
54535
+ let targetSubIndex;
54536
+ const findTargetNode = (node, subIndex) => {
54537
+ if (sourceSubIndex !== undefined && targetSubIndex !== undefined) {
54538
+ return;
54539
+ }
54540
+ if (node.level === level) {
54541
+ if (node.startInTotal === sourceIndex) {
54542
+ sourceSubIndex = subIndex;
54543
+ }
54544
+ if (node.startInTotal <= targetIndex && targetIndex <= node.startInTotal + node.size - 1) {
54545
+ targetSubIndex = subIndex;
54546
+ }
54547
+ }
54548
+ const children = node.children || node.columns;
54549
+ if (children && node.level < level) {
54550
+ parNode = node;
54551
+ for (let i = 0; i < children.length; i++) {
54552
+ if ((sourceIndex >= children[i].startInTotal && sourceIndex <= children[i].startInTotal + children[i].size) ||
54553
+ (targetIndex >= children[i].startInTotal && targetIndex <= children[i].startInTotal + children[i].size)) {
54554
+ findTargetNode(children[i], i);
54555
+ }
54556
+ }
54557
+ }
54558
+ };
54559
+ findTargetNode(this.tree, 0);
54560
+ const children = parNode.children || parNode.columns;
54561
+ const sourceColumns = children.splice(sourceSubIndex, 1);
54562
+ sourceColumns.unshift(targetSubIndex, 0);
54563
+ Array.prototype.splice.apply(children, sourceColumns);
54564
+ }
54565
+ getCopiedTree() {
54566
+ const children = cloneDeep(this.tree.children);
54567
+ clearNode(children);
54568
+ return children;
54569
+ }
54570
+ }
54571
+ function generateLayoutTree(tree, children) {
54572
+ children?.forEach((node) => {
54573
+ const diemnsonNode = {
54574
+ dimensionKey: node.dimensionKey,
54575
+ indicatorKey: node.indicatorKey,
54576
+ value: node.value,
54577
+ hierarchyState: node.hierarchyState,
54578
+ children: undefined
54579
+ };
54580
+ tree.push(diemnsonNode);
54581
+ if (node.children) {
54582
+ diemnsonNode.children = [];
54583
+ generateLayoutTree(diemnsonNode.children, node.children);
54584
+ }
54585
+ });
54586
+ }
54587
+ function countLayoutTree(children, countParentNode) {
54588
+ let count = 0;
54589
+ children?.forEach((node) => {
54590
+ if (countParentNode) {
54591
+ count++;
54592
+ }
54593
+ else {
54594
+ if (!node.children || node.children.length === 0) {
54595
+ count++;
54596
+ }
54597
+ }
54598
+ if (node.children) {
54599
+ count += countLayoutTree(node.children, countParentNode);
54600
+ }
54601
+ });
54602
+ return count;
54603
+ }
54604
+ function dealHeader(hd, _headerCellIds, results, roots, row, layoutMap) {
54605
+ const id = hd.id;
54606
+ const dimensionInfo = layoutMap.rowsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey) ??
54607
+ layoutMap.columnsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
54608
+ const indicatorInfo = layoutMap.indicatorsDefine?.find(indicator => {
54609
+ if (typeof indicator === 'string') {
54610
+ return false;
54611
+ }
54612
+ if (hd.indicatorKey) {
54613
+ return indicator.indicatorKey === hd.indicatorKey;
54614
+ }
54615
+ return indicator.title === hd.value;
54616
+ });
54617
+ const cell = {
54618
+ id,
54619
+ title: hd.value ?? indicatorInfo?.title,
54620
+ field: hd.dimensionKey,
54621
+ style: typeof (indicatorInfo ?? dimensionInfo)?.headerStyle === 'function'
54622
+ ? (indicatorInfo ?? dimensionInfo)?.headerStyle
54623
+ : Object.assign({}, (indicatorInfo ?? dimensionInfo)?.headerStyle),
54624
+ headerType: indicatorInfo?.headerType ?? dimensionInfo?.headerType ?? 'text',
54625
+ headerIcon: indicatorInfo?.headerIcon ?? dimensionInfo?.headerIcon,
54626
+ define: Object.assign({}, hd, indicatorInfo ?? dimensionInfo),
54627
+ fieldFormat: indicatorInfo?.headerFormat ?? dimensionInfo?.headerFormat,
54628
+ dropDownMenu: indicatorInfo?.dropDownMenu ?? dimensionInfo?.dropDownMenu,
54629
+ pivotInfo: {
54630
+ value: hd.value,
54631
+ dimensionKey: hd.dimensionKey,
54632
+ isPivotCorner: false
54633
+ },
54634
+ width: dimensionInfo?.width,
54635
+ minWidth: dimensionInfo?.minWidth,
54636
+ maxWidth: dimensionInfo?.maxWidth,
54637
+ showSort: indicatorInfo?.showSort ?? dimensionInfo?.showSort,
54638
+ description: dimensionInfo?.description
54639
+ };
54640
+ if (indicatorInfo) {
54641
+ if (indicatorInfo.customRender) {
54642
+ hd.customRender = indicatorInfo.customRender;
54643
+ }
54644
+ if (!isValid$1(layoutMap._indicators?.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) {
54645
+ layoutMap._indicators?.push({
54646
+ id: ++layoutMap.sharedVar.seqId,
54647
+ indicatorKey: indicatorInfo.indicatorKey,
54648
+ field: indicatorInfo.indicatorKey,
54649
+ fieldFormat: indicatorInfo?.format,
54650
+ cellType: indicatorInfo?.cellType ?? indicatorInfo?.columnType ?? 'text',
54651
+ chartModule: 'chartModule' in indicatorInfo ? indicatorInfo.chartModule : null,
54652
+ chartSpec: 'chartSpec' in indicatorInfo ? indicatorInfo.chartSpec : null,
54653
+ sparklineSpec: 'sparklineSpec' in indicatorInfo ? indicatorInfo.sparklineSpec : null,
54654
+ style: indicatorInfo?.style,
54655
+ icon: indicatorInfo?.icon,
54656
+ define: Object.assign({}, hd, indicatorInfo, {
54657
+ dragHeader: dimensionInfo?.dragHeader
54658
+ }),
54659
+ width: indicatorInfo?.width,
54660
+ minWidth: indicatorInfo?.minWidth,
54661
+ maxWidth: indicatorInfo?.maxWidth,
54662
+ disableColumnResize: indicatorInfo?.disableColumnResize
54663
+ });
54664
+ }
54665
+ }
54666
+ else if (hd.indicatorKey) {
54667
+ if (!isValid$1(layoutMap._indicators?.find(indicator => indicator.indicatorKey === hd.indicatorKey))) {
54668
+ layoutMap._indicators?.push({
54669
+ id: ++layoutMap.sharedVar.seqId,
54670
+ indicatorKey: hd.indicatorKey,
54671
+ field: hd.indicatorKey,
54672
+ cellType: 'text',
54673
+ define: Object.assign({}, hd)
54674
+ });
54675
+ }
54676
+ }
54677
+ results[id] = cell;
54678
+ layoutMap._headerObjects[id] = cell;
54679
+ _headerCellIds[row][layoutMap.colIndex] = id;
54680
+ for (let r = row - 1; r >= 0; r--) {
54681
+ _headerCellIds[r][layoutMap.colIndex] = roots[r];
54682
+ }
54683
+ if (hd.levelSpan > 1) {
54684
+ for (let i = 1; i < hd.levelSpan; i++) {
54685
+ if (!_headerCellIds[row + i]) {
54686
+ _headerCellIds[row + i] = [];
54687
+ }
54688
+ _headerCellIds[row + i][layoutMap.colIndex] = id;
54689
+ }
54690
+ }
54691
+ if (hd.children?.length >= 1) {
54692
+ layoutMap
54693
+ ._addHeaders(_headerCellIds, row + (hd.levelSpan ?? 1), hd.children ?? [], [
54694
+ ...roots,
54695
+ ...Array(hd.levelSpan ?? 1).fill(id)
54696
+ ])
54697
+ .forEach(c => results.push(c));
54698
+ }
54699
+ else {
54700
+ for (let r = row + 1; r < _headerCellIds.length; r++) {
54701
+ _headerCellIds[r][layoutMap.colIndex] = id;
54702
+ }
54703
+ layoutMap.colIndex++;
54704
+ }
54705
+ }
54706
+ function dealHeaderForTreeMode(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, layoutMap) {
54707
+ const id = hd.id;
54708
+ const dimensionInfo = dimensions.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
54709
+ const cell = {
54710
+ id,
54711
+ title: hd.value,
54712
+ field: hd.dimensionKey,
54713
+ style: hd.level + 1 === totalLevel || typeof dimensionInfo?.headerStyle === 'function'
54714
+ ? dimensionInfo?.headerStyle
54715
+ : Object.assign({}, dimensionInfo?.headerStyle, { textAlign: 'left' }),
54716
+ headerType: dimensionInfo?.headerType ?? 'text',
54717
+ headerIcon: dimensionInfo?.headerIcon,
54718
+ define: Object.assign(hd, {
54719
+ linkJump: dimensionInfo?.linkJump,
54720
+ linkDetect: dimensionInfo?.linkDetect,
54721
+ templateLink: dimensionInfo?.templateLink,
54722
+ keepAspectRatio: dimensionInfo?.keepAspectRatio ?? false,
54723
+ imageAutoSizing: dimensionInfo?.imageAutoSizing,
54724
+ headerCustomRender: dimensionInfo?.headerCustomRender,
54725
+ headerCustomLayout: dimensionInfo?.headerCustomLayout,
54726
+ dragHeader: dimensionInfo?.dragHeader,
54727
+ disableHeaderHover: !!dimensionInfo?.disableHeaderHover,
54728
+ disableHeaderSelect: !!dimensionInfo?.disableHeaderSelect
54729
+ }),
54730
+ fieldFormat: dimensionInfo?.headerFormat,
54731
+ dropDownMenu: dimensionInfo?.dropDownMenu,
54732
+ pivotInfo: {
54733
+ value: hd.value,
54734
+ dimensionKey: hd.dimensionKey,
54735
+ isPivotCorner: false
54736
+ },
54737
+ hierarchyLevel: hd.level,
54738
+ dimensionTotalLevel: totalLevel,
54739
+ hierarchyState: hd.level + 1 === totalLevel ? undefined : hd.hierarchyState,
54740
+ width: dimensionInfo?.width,
54741
+ minWidth: dimensionInfo?.minWidth,
54742
+ maxWidth: dimensionInfo?.maxWidth,
54743
+ parentCellId: roots[roots.length - 1]
54744
+ };
54745
+ results[id] = cell;
54746
+ layoutMap._headerObjects[id] = cell;
54747
+ _headerCellIds[row][layoutMap.colIndex] = id;
54748
+ for (let r = row - 1; r >= 0; r--) {
54749
+ _headerCellIds[r][layoutMap.colIndex] = roots[r];
54750
+ }
54751
+ if (hd.hierarchyState === HierarchyState.expand && hd.children?.length >= 1) {
54752
+ show && layoutMap.colIndex++;
54753
+ layoutMap
54754
+ ._addHeadersForTreeMode(_headerCellIds, row, hd.children ?? [], [...roots, id], totalLevel, show && hd.hierarchyState === HierarchyState.expand, dimensions)
54755
+ .forEach(c => results.push(c));
54756
+ }
54757
+ else {
54758
+ show && layoutMap.colIndex++;
54759
+ for (let r = row + 1; r < _headerCellIds.length; r++) {
54760
+ _headerCellIds[r][layoutMap.colIndex] = id;
54761
+ }
54762
+ }
54763
+ }
54764
+ function clearNode(children) {
54765
+ for (let i = 0; i < children.length; i++) {
54766
+ const node = children[i];
54767
+ delete node.level;
54768
+ delete node.startIndex;
54769
+ delete node.id;
54770
+ delete node.levelSpan;
54771
+ delete node.size;
54772
+ delete node.startInTotal;
54773
+ const childrenNew = node.children || node.columns;
54774
+ if (childrenNew) {
54775
+ clearNode(childrenNew);
54776
+ }
54777
+ }
54778
+ }
54779
+
53834
54780
  class SimpleHeaderLayoutMap {
53835
54781
  seqId = 0;
53836
54782
  _headerObjects;
53837
54783
  _headerObjectMap;
53838
54784
  _headerCellIds;
53839
54785
  _columns;
54786
+ columnTree;
53840
54787
  bodyRowSpanCount = 1;
53841
54788
  hierarchyIndent;
53842
54789
  _transpose = false;
@@ -53851,6 +54798,7 @@
53851
54798
  this._columns = [];
53852
54799
  this._headerCellIds = [];
53853
54800
  this.hierarchyIndent = hierarchyIndent ?? 20;
54801
+ this.columnTree = new DimensionTree(columns, { seqId: 0 });
53854
54802
  this._headerObjects = this._addHeaders(0, columns, []);
53855
54803
  this._headerObjectMap = this._headerObjects.reduce((o, e) => {
53856
54804
  o[e.id] = e;
@@ -53957,7 +54905,7 @@
53957
54905
  }
53958
54906
  else {
53959
54907
  row = col;
53960
- if (this.frozenRowCount > 0 && row >= this.rowCount - this.bottomFrozenRowCount) {
54908
+ if (this.bottomFrozenRowCount > 0 && row >= this.rowCount - this.bottomFrozenRowCount) {
53961
54909
  return true;
53962
54910
  }
53963
54911
  }
@@ -54494,6 +55442,11 @@
54494
55442
  if (source.col < 0 || source.row < 0 || target.col < 0 || target.row < 0) {
54495
55443
  return false;
54496
55444
  }
55445
+ if (this._table.internalProps.frozenColDragHeaderMode === 'disabled') {
55446
+ if (this._table.isFrozenColumn(target.col) || this._table.isRightFrozenColumn(target.col)) {
55447
+ return false;
55448
+ }
55449
+ }
54497
55450
  const sourceCellRange = this.getCellRange(source.col, source.row);
54498
55451
  if (this.isColumnHeader(source.col, source.row)) {
54499
55452
  const sourceTopId = this.getParentCellId(source.col, sourceCellRange.start.row);
@@ -54531,6 +55484,7 @@
54531
55484
  const sourceColumns = this._columns.splice(sourceCellRange.start.col, moveSize);
54532
55485
  sourceColumns.unshift(targetIndex, 0);
54533
55486
  Array.prototype.splice.apply(this._columns, sourceColumns);
55487
+ this.columnTree.movePosition(sourceCellRange.start.row, sourceCellRange.start.col, targetIndex);
54534
55488
  this._cellRangeMap = new Map();
54535
55489
  return {
54536
55490
  sourceIndex: sourceCellRange.start.col,
@@ -54560,6 +55514,7 @@
54560
55514
  const sourceColumns = this._columns.splice(sourceCellRange.start.row, moveSize);
54561
55515
  sourceColumns.unshift(targetIndex, 0);
54562
55516
  Array.prototype.splice.apply(this._columns, sourceColumns);
55517
+ this.columnTree.movePosition(sourceCellRange.start.col, sourceCellRange.start.row, targetIndex);
54563
55518
  this._cellRangeMap = new Map();
54564
55519
  return {
54565
55520
  sourceIndex: sourceCellRange.start.row,
@@ -54814,28 +55769,52 @@
54814
55769
  return;
54815
55770
  }
54816
55771
  }
54817
- editor.bindSuccessCallback?.(() => {
54818
- this.completeEdit();
54819
- });
54820
55772
  this.editingEditor = editor;
54821
55773
  this.editCell = { col, row };
54822
55774
  const dataValue = this.table.getCellOriginValue(col, row);
54823
55775
  const rect = this.table.getCellRangeRelativeRect(this.table.getCellRange(col, row));
54824
- editor.beginEditing(this.table.getElement(), { rect: { left: rect.left, top: rect.top, width: rect.width, height: rect.height } }, dataValue);
55776
+ const referencePosition = { rect: { left: rect.left, top: rect.top, width: rect.width, height: rect.height } };
55777
+ editor.beginEditing && (void 0);
55778
+ editor.beginEditing?.(this.table.getElement(), referencePosition, dataValue);
55779
+ if (editor.bindSuccessCallback) ;
55780
+ editor.bindSuccessCallback?.(() => {
55781
+ this.completeEdit();
55782
+ });
55783
+ editor.onStart?.({
55784
+ value: dataValue,
55785
+ endEdit: () => {
55786
+ this.completeEdit();
55787
+ },
55788
+ referencePosition,
55789
+ container: this.table.getElement()
55790
+ });
54825
55791
  }
54826
55792
  }
54827
55793
  completeEdit(e) {
55794
+ if (!this.editingEditor) {
55795
+ return;
55796
+ }
54828
55797
  const target = e?.target;
54829
- if (this.editingEditor && (!target || (target && !this.editingEditor.targetIsOnEditor(target)))) {
54830
- const changedValue = this.editingEditor.getValue();
54831
- this.table.changeCellValue(this.editCell.col, this.editCell.row, changedValue);
54832
- this.editingEditor.exit();
54833
- this.editingEditor = null;
55798
+ if (this.editingEditor.targetIsOnEditor) {
55799
+ if (target && this.editingEditor.targetIsOnEditor(target)) {
55800
+ return;
55801
+ }
55802
+ }
55803
+ else if (!this.editingEditor.isEditorElement || (target && this.editingEditor.isEditorElement?.(target))) {
55804
+ return;
54834
55805
  }
55806
+ if (!this.editingEditor.getValue) ;
55807
+ const changedValue = this.editingEditor.getValue?.();
55808
+ this.table.changeCellValue(this.editCell.col, this.editCell.row, changedValue);
55809
+ this.editingEditor.exit && (void 0);
55810
+ this.editingEditor.exit?.();
55811
+ this.editingEditor.onEnd?.();
55812
+ this.editingEditor = null;
54835
55813
  }
54836
55814
  cancelEdit() {
54837
55815
  if (this.editingEditor) {
54838
- this.editingEditor.exit();
55816
+ this.editingEditor.exit?.();
55817
+ this.editingEditor.onEnd?.();
54839
55818
  this.editingEditor = null;
54840
55819
  }
54841
55820
  }
@@ -54860,6 +55839,7 @@
54860
55839
  }
54861
55840
  super(container, options);
54862
55841
  const internalProps = this.internalProps;
55842
+ internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode;
54863
55843
  this.pagination = options.pagination;
54864
55844
  internalProps.sortState = options.sortState;
54865
55845
  internalProps.columns = options.columns
@@ -54927,7 +55907,7 @@
54927
55907
  this.eventManager.updateEventBinder();
54928
55908
  }
54929
55909
  get columns() {
54930
- return this.internalProps.columns;
55910
+ return this.internalProps.layoutMap.columnTree.getCopiedTree();
54931
55911
  }
54932
55912
  get header() {
54933
55913
  return this.internalProps.columns;
@@ -55049,6 +56029,7 @@
55049
56029
  updateOption(options, accelerateFirstScreen = false) {
55050
56030
  const internalProps = this.internalProps;
55051
56031
  super.updateOption(options);
56032
+ internalProps.frozenColDragHeaderMode = options.frozenColDragHeaderMode;
55052
56033
  this.pagination = options.pagination;
55053
56034
  this.showHeader = options.showHeader ?? true;
55054
56035
  internalProps.columns = options.columns
@@ -55962,397 +56943,6 @@
55962
56943
  }
55963
56944
  }
55964
56945
 
55965
- class DimensionTree {
55966
- sharedVar;
55967
- sizeIncludeParent = false;
55968
- rowExpandLevel;
55969
- hierarchyType;
55970
- tree = {
55971
- id: 0,
55972
- dimensionKey: '',
55973
- value: '',
55974
- children: [],
55975
- level: -1,
55976
- levelSpan: 1,
55977
- startIndex: 0,
55978
- size: 0,
55979
- startInTotal: 0,
55980
- hierarchyState: undefined
55981
- };
55982
- totalLevel = 0;
55983
- dimensionKeys = new NumberMap();
55984
- cache = new Map();
55985
- constructor(tree, sharedVar, hierarchyType = 'grid', rowExpandLevel = undefined) {
55986
- this.sizeIncludeParent = rowExpandLevel !== null && rowExpandLevel !== undefined;
55987
- this.rowExpandLevel = rowExpandLevel;
55988
- this.hierarchyType = hierarchyType;
55989
- this.sharedVar = sharedVar;
55990
- this.reset(tree);
55991
- }
55992
- reset(tree, updateTreeNode = false) {
55993
- this.cache.clear();
55994
- this.dimensionKeys = new NumberMap();
55995
- this.tree.children = tree;
55996
- this.setTreeNode(this.tree, 0, this.tree);
55997
- this.totalLevel = this.dimensionKeys.count();
55998
- }
55999
- setTreeNode(node, startIndex, parent) {
56000
- node.startIndex = startIndex;
56001
- node.startInTotal = (parent.startInTotal ?? 0) + node.startIndex;
56002
- if (node.dimensionKey ?? node.indicatorKey) {
56003
- !this.dimensionKeys.contain(node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey) &&
56004
- this.dimensionKeys.put(node.level, node.indicatorKey ? IndicatorDimensionKeyPlaceholder : node.dimensionKey);
56005
- if (!node.id) {
56006
- node.id = ++this.sharedVar.seqId;
56007
- }
56008
- }
56009
- let size = node.dimensionKey ? (this.sizeIncludeParent ? 1 : 0) : 0;
56010
- if (this.hierarchyType === 'grid') {
56011
- if (node.children?.length >= 1) {
56012
- node.children.forEach(n => {
56013
- n.level = (node.level ?? 0) + 1;
56014
- size += this.setTreeNode(n, size, node);
56015
- });
56016
- }
56017
- else {
56018
- size = 1;
56019
- }
56020
- }
56021
- else if (node.hierarchyState === HierarchyState.expand && node.children?.length >= 1) {
56022
- node.children.forEach(n => {
56023
- n.level = (node.level ?? 0) + 1;
56024
- size += this.setTreeNode(n, size, node);
56025
- });
56026
- }
56027
- else if (node.hierarchyState === HierarchyState.collapse && node.children?.length >= 1) {
56028
- node.children.forEach(n => {
56029
- n.level = (node.level ?? 0) + 1;
56030
- this.setTreeNode(n, size, node);
56031
- });
56032
- }
56033
- else if (!node.hierarchyState && node.level + 1 < this.rowExpandLevel && node.children?.length >= 1) {
56034
- node.hierarchyState = HierarchyState.expand;
56035
- node.children.forEach(n => {
56036
- n.level = (node.level ?? 0) + 1;
56037
- size += this.setTreeNode(n, size, node);
56038
- });
56039
- }
56040
- else if (node.children?.length >= 1) {
56041
- node.hierarchyState = HierarchyState.collapse;
56042
- node.children.forEach(n => {
56043
- n.level = (node.level ?? 0) + 1;
56044
- this.setTreeNode(n, size, node);
56045
- });
56046
- }
56047
- else {
56048
- node.hierarchyState = HierarchyState.none;
56049
- size = 1;
56050
- }
56051
- node.size = size;
56052
- return size;
56053
- }
56054
- getTreePath(index, maxDeep = 30) {
56055
- const path = [];
56056
- this.searchPath(index, this.tree, path, maxDeep);
56057
- path.shift();
56058
- return path;
56059
- }
56060
- getTreePathByCellIds(ids) {
56061
- const path = [];
56062
- let nodes = this.tree.children;
56063
- for (let i = 0; i < ids.length; i++) {
56064
- const id = ids[i];
56065
- const pathNode = this.findNodeById(nodes, id);
56066
- if (pathNode) {
56067
- path.push(pathNode);
56068
- nodes = pathNode.children;
56069
- }
56070
- else {
56071
- break;
56072
- }
56073
- }
56074
- return path;
56075
- }
56076
- findNodeById(nodes, id) {
56077
- return nodes.find(node => {
56078
- return node.id === id;
56079
- });
56080
- }
56081
- searchPath(index, node, path, maxDeep) {
56082
- if (!node) {
56083
- return;
56084
- }
56085
- if (index < node.startIndex || index >= node.startIndex + node.size) {
56086
- return;
56087
- }
56088
- path.push(node);
56089
- if (!node.children || node.children.length === 0 || node.level >= maxDeep) {
56090
- return;
56091
- }
56092
- const cIndex = index - node.startIndex;
56093
- if (this.cache.has(node.level + 1)) {
56094
- const cacheNode = this.cache.get(node.level + 1);
56095
- if (cIndex >= cacheNode.startIndex && cIndex < cacheNode.startIndex + cacheNode.size) {
56096
- this.searchPath(cIndex, cacheNode, path, maxDeep);
56097
- return;
56098
- }
56099
- }
56100
- let left = 0;
56101
- let right = node.children.length - 1;
56102
- while (left <= right) {
56103
- const middle = Math.floor((left + right) / 2);
56104
- const element = node.children[middle];
56105
- if (cIndex >= element.startIndex && cIndex < element.startIndex + element.size) {
56106
- this.cache.set(element.level, element);
56107
- const deleteLevels = [];
56108
- this.cache.forEach((node, key) => {
56109
- if (key > element.level) {
56110
- deleteLevels.push(key);
56111
- }
56112
- });
56113
- deleteLevels.forEach(key => {
56114
- this.cache.delete(key);
56115
- });
56116
- this.searchPath(cIndex, element, path, maxDeep);
56117
- break;
56118
- }
56119
- else if (cIndex < element.startIndex) {
56120
- right = middle - 1;
56121
- }
56122
- else {
56123
- left = middle + 1;
56124
- }
56125
- }
56126
- return;
56127
- }
56128
- movePosition(level, sourceIndex, targetIndex) {
56129
- let parNode;
56130
- let sourceSubIndex;
56131
- let targetSubIndex;
56132
- const findTargetNode = (node, subIndex) => {
56133
- if (sourceSubIndex !== undefined && targetSubIndex !== undefined) {
56134
- return;
56135
- }
56136
- if (node.level === level) {
56137
- if (node.startInTotal === sourceIndex) {
56138
- sourceSubIndex = subIndex;
56139
- }
56140
- if (node.startInTotal <= targetIndex && targetIndex <= node.startInTotal + node.size - 1) {
56141
- targetSubIndex = subIndex;
56142
- }
56143
- }
56144
- if (node.children && node.level < level) {
56145
- parNode = node;
56146
- for (let i = 0; i < node.children.length; i++) {
56147
- if ((sourceIndex >= node.children[i].startInTotal &&
56148
- sourceIndex <= node.children[i].startInTotal + node.children[i].size) ||
56149
- (targetIndex >= node.children[i].startInTotal &&
56150
- targetIndex <= node.children[i].startInTotal + node.children[i].size)) {
56151
- findTargetNode(node.children[i], i);
56152
- }
56153
- }
56154
- }
56155
- };
56156
- findTargetNode(this.tree, 0);
56157
- const sourceColumns = parNode.children.splice(sourceSubIndex, 1);
56158
- sourceColumns.unshift(targetSubIndex, 0);
56159
- Array.prototype.splice.apply(parNode.children, sourceColumns);
56160
- }
56161
- }
56162
- function generateLayoutTree(tree, children) {
56163
- children?.forEach((node) => {
56164
- const diemnsonNode = {
56165
- dimensionKey: node.dimensionKey,
56166
- indicatorKey: node.indicatorKey,
56167
- value: node.value,
56168
- hierarchyState: node.hierarchyState,
56169
- children: undefined
56170
- };
56171
- tree.push(diemnsonNode);
56172
- if (node.children) {
56173
- diemnsonNode.children = [];
56174
- generateLayoutTree(diemnsonNode.children, node.children);
56175
- }
56176
- });
56177
- }
56178
- function countLayoutTree(children, countParentNode) {
56179
- let count = 0;
56180
- children?.forEach((node) => {
56181
- if (countParentNode) {
56182
- count++;
56183
- }
56184
- else {
56185
- if (!node.children || node.children.length === 0) {
56186
- count++;
56187
- }
56188
- }
56189
- if (node.children) {
56190
- count += countLayoutTree(node.children, countParentNode);
56191
- }
56192
- });
56193
- return count;
56194
- }
56195
- function dealHeader(hd, _headerCellIds, results, roots, row, layoutMap) {
56196
- const id = hd.id;
56197
- const dimensionInfo = layoutMap.rowsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey) ??
56198
- layoutMap.columnsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
56199
- const indicatorInfo = layoutMap.indicatorsDefine?.find(indicator => {
56200
- if (typeof indicator === 'string') {
56201
- return false;
56202
- }
56203
- if (hd.indicatorKey) {
56204
- return indicator.indicatorKey === hd.indicatorKey;
56205
- }
56206
- return indicator.title === hd.value;
56207
- });
56208
- const cell = {
56209
- id,
56210
- title: hd.value ?? indicatorInfo?.title,
56211
- field: hd.dimensionKey,
56212
- style: typeof (indicatorInfo ?? dimensionInfo)?.headerStyle === 'function'
56213
- ? (indicatorInfo ?? dimensionInfo)?.headerStyle
56214
- : Object.assign({}, (indicatorInfo ?? dimensionInfo)?.headerStyle),
56215
- headerType: indicatorInfo?.headerType ?? dimensionInfo?.headerType ?? 'text',
56216
- headerIcon: indicatorInfo?.headerIcon ?? dimensionInfo?.headerIcon,
56217
- define: Object.assign({}, hd, indicatorInfo ?? dimensionInfo),
56218
- fieldFormat: indicatorInfo?.headerFormat ?? dimensionInfo?.headerFormat,
56219
- dropDownMenu: indicatorInfo?.dropDownMenu ?? dimensionInfo?.dropDownMenu,
56220
- pivotInfo: {
56221
- value: hd.value,
56222
- dimensionKey: hd.dimensionKey,
56223
- isPivotCorner: false
56224
- },
56225
- width: dimensionInfo?.width,
56226
- minWidth: dimensionInfo?.minWidth,
56227
- maxWidth: dimensionInfo?.maxWidth,
56228
- showSort: indicatorInfo?.showSort ?? dimensionInfo?.showSort,
56229
- description: dimensionInfo?.description
56230
- };
56231
- if (indicatorInfo) {
56232
- if (indicatorInfo.customRender) {
56233
- hd.customRender = indicatorInfo.customRender;
56234
- }
56235
- if (!isValid$1(layoutMap._indicators?.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) {
56236
- layoutMap._indicators?.push({
56237
- id: ++layoutMap.sharedVar.seqId,
56238
- indicatorKey: indicatorInfo.indicatorKey,
56239
- field: indicatorInfo.indicatorKey,
56240
- fieldFormat: indicatorInfo?.format,
56241
- cellType: indicatorInfo?.cellType ?? indicatorInfo?.columnType ?? 'text',
56242
- chartModule: 'chartModule' in indicatorInfo ? indicatorInfo.chartModule : null,
56243
- chartSpec: 'chartSpec' in indicatorInfo ? indicatorInfo.chartSpec : null,
56244
- sparklineSpec: 'sparklineSpec' in indicatorInfo ? indicatorInfo.sparklineSpec : null,
56245
- style: indicatorInfo?.style,
56246
- icon: indicatorInfo?.icon,
56247
- define: Object.assign({}, hd, indicatorInfo, {
56248
- dragHeader: dimensionInfo?.dragHeader
56249
- }),
56250
- width: indicatorInfo?.width,
56251
- minWidth: indicatorInfo?.minWidth,
56252
- maxWidth: indicatorInfo?.maxWidth,
56253
- disableColumnResize: indicatorInfo?.disableColumnResize
56254
- });
56255
- }
56256
- }
56257
- else if (hd.indicatorKey) {
56258
- if (!isValid$1(layoutMap._indicators?.find(indicator => indicator.indicatorKey === hd.indicatorKey))) {
56259
- layoutMap._indicators?.push({
56260
- id: ++layoutMap.sharedVar.seqId,
56261
- indicatorKey: hd.indicatorKey,
56262
- field: hd.indicatorKey,
56263
- cellType: 'text',
56264
- define: Object.assign({}, hd)
56265
- });
56266
- }
56267
- }
56268
- results[id] = cell;
56269
- layoutMap._headerObjects[id] = cell;
56270
- _headerCellIds[row][layoutMap.colIndex] = id;
56271
- for (let r = row - 1; r >= 0; r--) {
56272
- _headerCellIds[r][layoutMap.colIndex] = roots[r];
56273
- }
56274
- if (hd.levelSpan > 1) {
56275
- for (let i = 1; i < hd.levelSpan; i++) {
56276
- if (!_headerCellIds[row + i]) {
56277
- _headerCellIds[row + i] = [];
56278
- }
56279
- _headerCellIds[row + i][layoutMap.colIndex] = id;
56280
- }
56281
- }
56282
- if (hd.children?.length >= 1) {
56283
- layoutMap
56284
- ._addHeaders(_headerCellIds, row + (hd.levelSpan ?? 1), hd.children ?? [], [
56285
- ...roots,
56286
- ...Array(hd.levelSpan ?? 1).fill(id)
56287
- ])
56288
- .forEach(c => results.push(c));
56289
- }
56290
- else {
56291
- for (let r = row + 1; r < _headerCellIds.length; r++) {
56292
- _headerCellIds[r][layoutMap.colIndex] = id;
56293
- }
56294
- layoutMap.colIndex++;
56295
- }
56296
- }
56297
- function dealHeaderForTreeMode(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, layoutMap) {
56298
- const id = hd.id;
56299
- const dimensionInfo = dimensions.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === hd.dimensionKey);
56300
- const cell = {
56301
- id,
56302
- title: hd.value,
56303
- field: hd.dimensionKey,
56304
- style: hd.level + 1 === totalLevel || typeof dimensionInfo?.headerStyle === 'function'
56305
- ? dimensionInfo?.headerStyle
56306
- : Object.assign({}, dimensionInfo?.headerStyle, { textAlign: 'left' }),
56307
- headerType: dimensionInfo?.headerType ?? 'text',
56308
- headerIcon: dimensionInfo?.headerIcon,
56309
- define: Object.assign(hd, {
56310
- linkJump: dimensionInfo?.linkJump,
56311
- linkDetect: dimensionInfo?.linkDetect,
56312
- templateLink: dimensionInfo?.templateLink,
56313
- keepAspectRatio: dimensionInfo?.keepAspectRatio ?? false,
56314
- imageAutoSizing: dimensionInfo?.imageAutoSizing,
56315
- headerCustomRender: dimensionInfo?.headerCustomRender,
56316
- headerCustomLayout: dimensionInfo?.headerCustomLayout,
56317
- dragHeader: dimensionInfo?.dragHeader,
56318
- disableHeaderHover: !!dimensionInfo?.disableHeaderHover,
56319
- disableHeaderSelect: !!dimensionInfo?.disableHeaderSelect
56320
- }),
56321
- fieldFormat: dimensionInfo?.headerFormat,
56322
- dropDownMenu: dimensionInfo?.dropDownMenu,
56323
- pivotInfo: {
56324
- value: hd.value,
56325
- dimensionKey: hd.dimensionKey,
56326
- isPivotCorner: false
56327
- },
56328
- hierarchyLevel: hd.level,
56329
- dimensionTotalLevel: totalLevel,
56330
- hierarchyState: hd.level + 1 === totalLevel ? undefined : hd.hierarchyState,
56331
- width: dimensionInfo?.width,
56332
- minWidth: dimensionInfo?.minWidth,
56333
- maxWidth: dimensionInfo?.maxWidth,
56334
- parentCellId: roots[roots.length - 1]
56335
- };
56336
- results[id] = cell;
56337
- layoutMap._headerObjects[id] = cell;
56338
- _headerCellIds[row][layoutMap.colIndex] = id;
56339
- for (let r = row - 1; r >= 0; r--) {
56340
- _headerCellIds[r][layoutMap.colIndex] = roots[r];
56341
- }
56342
- if (hd.hierarchyState === HierarchyState.expand && hd.children?.length >= 1) {
56343
- show && layoutMap.colIndex++;
56344
- layoutMap
56345
- ._addHeadersForTreeMode(_headerCellIds, row, hd.children ?? [], [...roots, id], totalLevel, show && hd.hierarchyState === HierarchyState.expand, dimensions)
56346
- .forEach(c => results.push(c));
56347
- }
56348
- else {
56349
- show && layoutMap.colIndex++;
56350
- for (let r = row + 1; r < _headerCellIds.length; r++) {
56351
- _headerCellIds[r][layoutMap.colIndex] = id;
56352
- }
56353
- }
56354
- }
56355
-
56356
56946
  const defaultDimension = { startInTotal: 0, level: 0 };
56357
56947
  class PivotHeaderLayoutMap {
56358
56948
  sharedVar;
@@ -57342,6 +57932,44 @@
57342
57932
  if (this.isRightFrozenColumn(col, row) || this.isBottomFrozenRow(col, row)) {
57343
57933
  return result;
57344
57934
  }
57935
+ if (this._table.isPivotChart()) {
57936
+ if (this.isLeftBottomCorner(col, row)) {
57937
+ return {
57938
+ start: {
57939
+ col: 0,
57940
+ row: this.rowCount - this.bottomFrozenRowCount
57941
+ },
57942
+ end: {
57943
+ col: this.frozenColCount - 1,
57944
+ row: this.rowCount - 1
57945
+ }
57946
+ };
57947
+ }
57948
+ else if (this.isRightTopCorner(col, row)) {
57949
+ return {
57950
+ start: {
57951
+ col: this.colCount - this.rightFrozenColCount,
57952
+ row: 0
57953
+ },
57954
+ end: {
57955
+ col: this.colCount - 1,
57956
+ row: this.frozenRowCount - 1
57957
+ }
57958
+ };
57959
+ }
57960
+ else if (this.isRightBottomCorner(col, row)) {
57961
+ return {
57962
+ start: {
57963
+ col: this.colCount - this.rightFrozenColCount,
57964
+ row: this.rowCount - this.bottomFrozenRowCount
57965
+ },
57966
+ end: {
57967
+ col: this.colCount - 1,
57968
+ row: this.rowCount - 1
57969
+ }
57970
+ };
57971
+ }
57972
+ }
57345
57973
  for (let i = 0; i < this._largeCellRangeCache.length; i++) {
57346
57974
  const range = this._largeCellRangeCache[i];
57347
57975
  if (col >= range.start.col && col <= range.end.col && row >= range.start.row && row <= range.end.row) {
@@ -57826,7 +58454,7 @@
57826
58454
  const sourceColumns = this._columnWidths.splice(sourceCellRange.start.col, moveSize);
57827
58455
  sourceColumns.unshift(targetIndex, 0);
57828
58456
  Array.prototype.splice.apply(this._columnWidths, sourceColumns);
57829
- this.columnDimensionTree.movePosition(source.row, sourceCellRange.start.col - this.rowHeaderLevelCount, targetIndex - this.rowHeaderLevelCount);
58457
+ this.columnDimensionTree.movePosition(this.getCellHeaderPathsWidthTreeNode(source.col, source.row).colHeaderPaths.length - 1, sourceCellRange.start.col - this.rowHeaderLevelCount, targetIndex - this.rowHeaderLevelCount);
57830
58458
  this.columnDimensionTree.reset(this.columnDimensionTree.tree.children, true);
57831
58459
  this._CellHeaderPathMap = new Map();
57832
58460
  this._largeCellRangeCache.length = 0;
@@ -62359,7 +62987,7 @@
62359
62987
  }
62360
62988
 
62361
62989
  registerForVrender();
62362
- const version = "0.18.4";
62990
+ const version = "0.19.0";
62363
62991
  function getIcons() {
62364
62992
  return get$1();
62365
62993
  }