k-vtable 1.0.14 → 1.0.16

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 (200) hide show
  1. package/cjs/ListTable.d.ts +8 -2
  2. package/cjs/ListTable.js +64 -13
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.d.ts +4 -1
  5. package/cjs/PivotChart.js +9 -4
  6. package/cjs/PivotChart.js.map +1 -1
  7. package/cjs/PivotTable.d.ts +4 -1
  8. package/cjs/PivotTable.js +9 -4
  9. package/cjs/PivotTable.js.map +1 -1
  10. package/cjs/body-helper/style.js +2 -1
  11. package/cjs/core/BaseTable.d.ts +15 -1
  12. package/cjs/core/BaseTable.js +124 -29
  13. package/cjs/core/BaseTable.js.map +1 -1
  14. package/cjs/core/TABLE_EVENT_TYPE.d.ts +4 -0
  15. package/cjs/core/TABLE_EVENT_TYPE.js +5 -1
  16. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  17. package/cjs/core/animation.js.map +1 -1
  18. package/cjs/core/group-helper.d.ts +4 -2
  19. package/cjs/core/group-helper.js +7 -2
  20. package/cjs/core/group-helper.js.map +1 -1
  21. package/cjs/core/utils/get-cell-position.js +2 -2
  22. package/cjs/core/utils/get-cell-position.js.map +1 -1
  23. package/cjs/data/DataSource.d.ts +1 -0
  24. package/cjs/data/DataSource.js +21 -12
  25. package/cjs/data/DataSource.js.map +1 -1
  26. package/cjs/dataset/dataset-pivot-table.js +2 -1
  27. package/cjs/dataset/flatDataToObject.js +1 -2
  28. package/cjs/edit/edit-manager.js +5 -4
  29. package/cjs/edit/edit-manager.js.map +1 -1
  30. package/cjs/event/event.d.ts +17 -0
  31. package/cjs/event/event.js +254 -9
  32. package/cjs/event/event.js.map +1 -1
  33. package/cjs/event/listener/container-dom.js +8 -153
  34. package/cjs/event/listener/container-dom.js.map +1 -1
  35. package/cjs/event/listener/scroll-bar.js +1 -1
  36. package/cjs/event/listener/scroll-bar.js.map +1 -1
  37. package/cjs/event/listener/table-group.js +35 -32
  38. package/cjs/event/listener/table-group.js.map +1 -1
  39. package/cjs/event/scroll.js +3 -1
  40. package/cjs/event/scroll.js.map +1 -1
  41. package/cjs/index.d.ts +1 -1
  42. package/cjs/index.js +1 -1
  43. package/cjs/index.js.map +1 -1
  44. package/cjs/layout/index.js +2 -1
  45. package/cjs/layout/pivot-header-layout.js +0 -1
  46. package/cjs/scenegraph/component/table-component.d.ts +1 -1
  47. package/cjs/scenegraph/component/table-component.js +1 -1
  48. package/cjs/scenegraph/component/table-component.js.map +1 -1
  49. package/cjs/scenegraph/group-creater/cell-helper.js +2 -1
  50. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  51. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  52. package/cjs/scenegraph/layout/compute-col-width.js +3 -1
  53. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  54. package/cjs/scenegraph/layout/frozen-react.js +3 -5
  55. package/cjs/scenegraph/layout/frozen-react.js.map +1 -1
  56. package/cjs/scenegraph/layout/frozen.js +7 -4
  57. package/cjs/scenegraph/layout/frozen.js.map +1 -1
  58. package/cjs/scenegraph/scenegraph.d.ts +6 -2
  59. package/cjs/scenegraph/scenegraph.js +34 -10
  60. package/cjs/scenegraph/scenegraph.js.map +1 -1
  61. package/cjs/scenegraph/select/create-select-border.d.ts +2 -0
  62. package/cjs/scenegraph/select/create-select-border.js +2 -2
  63. package/cjs/scenegraph/select/create-select-border.js.map +1 -1
  64. package/cjs/scenegraph/select/update-custom-select-border.d.ts +6 -0
  65. package/cjs/scenegraph/select/update-custom-select-border.js +69 -0
  66. package/cjs/scenegraph/select/update-custom-select-border.js.map +1 -0
  67. package/cjs/scenegraph/select/update-select-border.js +37 -27
  68. package/cjs/scenegraph/select/update-select-border.js.map +1 -1
  69. package/cjs/scenegraph/utils/cell-pos.d.ts +12 -0
  70. package/cjs/scenegraph/utils/cell-pos.js +26 -1
  71. package/cjs/scenegraph/utils/cell-pos.js.map +1 -1
  72. package/cjs/scenegraph/utils/update-container.d.ts +1 -0
  73. package/cjs/scenegraph/utils/update-container.js +8 -1
  74. package/cjs/scenegraph/utils/update-container.js.map +1 -1
  75. package/cjs/state/select/custom-select.d.ts +2 -2
  76. package/cjs/state/select/custom-select.js +2 -14
  77. package/cjs/state/select/custom-select.js.map +1 -1
  78. package/cjs/state/select/update-position.js +1 -1
  79. package/cjs/state/select/update-position.js.map +1 -1
  80. package/cjs/state/state.d.ts +4 -7
  81. package/cjs/state/state.js +28 -4
  82. package/cjs/state/state.js.map +1 -1
  83. package/cjs/themes/theme-define.js +1 -1
  84. package/cjs/themes/theme-define.js.map +1 -1
  85. package/cjs/tools/style.d.ts +3 -1
  86. package/cjs/tools/style.js +23 -2
  87. package/cjs/tools/style.js.map +1 -1
  88. package/cjs/ts-types/base-table.d.ts +7 -0
  89. package/cjs/ts-types/base-table.js.map +1 -1
  90. package/cjs/ts-types/events.d.ts +21 -1
  91. package/cjs/ts-types/events.js.map +1 -1
  92. package/cjs/ts-types/new-data-set.d.ts +1 -0
  93. package/cjs/ts-types/new-data-set.js.map +1 -1
  94. package/cjs/ts-types/style-define.d.ts +6 -0
  95. package/cjs/ts-types/style-define.js.map +1 -1
  96. package/cjs/ts-types/table-engine.d.ts +3 -0
  97. package/cjs/ts-types/table-engine.js.map +1 -1
  98. package/cjs/vrender.js.map +1 -1
  99. package/dist/vtable.js +2523 -497
  100. package/dist/vtable.min.js +2 -2
  101. package/es/ListTable.d.ts +8 -2
  102. package/es/ListTable.js +65 -11
  103. package/es/ListTable.js.map +1 -1
  104. package/es/PivotChart.d.ts +4 -1
  105. package/es/PivotChart.js +9 -4
  106. package/es/PivotChart.js.map +1 -1
  107. package/es/PivotTable.d.ts +4 -1
  108. package/es/PivotTable.js +9 -4
  109. package/es/PivotTable.js.map +1 -1
  110. package/es/body-helper/style.js +2 -1
  111. package/es/core/BaseTable.d.ts +15 -1
  112. package/es/core/BaseTable.js +119 -25
  113. package/es/core/BaseTable.js.map +1 -1
  114. package/es/core/TABLE_EVENT_TYPE.d.ts +4 -0
  115. package/es/core/TABLE_EVENT_TYPE.js +5 -1
  116. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  117. package/es/core/animation.js +1 -1
  118. package/es/core/animation.js.map +1 -1
  119. package/es/core/group-helper.d.ts +4 -2
  120. package/es/core/group-helper.js +7 -2
  121. package/es/core/group-helper.js.map +1 -1
  122. package/es/core/utils/get-cell-position.js +2 -2
  123. package/es/core/utils/get-cell-position.js.map +1 -1
  124. package/es/data/DataSource.d.ts +1 -0
  125. package/es/data/DataSource.js +21 -12
  126. package/es/data/DataSource.js.map +1 -1
  127. package/es/dataset/dataset-pivot-table.js +2 -1
  128. package/es/dataset/flatDataToObject.js +1 -2
  129. package/es/edit/edit-manager.js +5 -4
  130. package/es/edit/edit-manager.js.map +1 -1
  131. package/es/event/event.d.ts +17 -0
  132. package/es/event/event.js +256 -8
  133. package/es/event/event.js.map +1 -1
  134. package/es/event/listener/container-dom.js +9 -154
  135. package/es/event/listener/container-dom.js.map +1 -1
  136. package/es/event/listener/scroll-bar.js +1 -1
  137. package/es/event/listener/scroll-bar.js.map +1 -1
  138. package/es/event/listener/table-group.js +35 -32
  139. package/es/event/listener/table-group.js.map +1 -1
  140. package/es/event/scroll.js +3 -1
  141. package/es/event/scroll.js.map +1 -1
  142. package/es/index.d.ts +1 -1
  143. package/es/index.js +1 -1
  144. package/es/index.js.map +1 -1
  145. package/es/layout/index.js +2 -1
  146. package/es/layout/pivot-header-layout.js +1 -2
  147. package/es/scenegraph/component/table-component.d.ts +1 -1
  148. package/es/scenegraph/component/table-component.js +1 -1
  149. package/es/scenegraph/component/table-component.js.map +1 -1
  150. package/es/scenegraph/group-creater/cell-helper.js +2 -1
  151. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  152. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  153. package/es/scenegraph/layout/compute-col-width.js +3 -1
  154. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  155. package/es/scenegraph/layout/frozen-react.js +3 -5
  156. package/es/scenegraph/layout/frozen-react.js.map +1 -1
  157. package/es/scenegraph/layout/frozen.js +7 -4
  158. package/es/scenegraph/layout/frozen.js.map +1 -1
  159. package/es/scenegraph/scenegraph.d.ts +6 -2
  160. package/es/scenegraph/scenegraph.js +32 -11
  161. package/es/scenegraph/scenegraph.js.map +1 -1
  162. package/es/scenegraph/select/create-select-border.d.ts +2 -0
  163. package/es/scenegraph/select/create-select-border.js +1 -1
  164. package/es/scenegraph/select/create-select-border.js.map +1 -1
  165. package/es/scenegraph/select/update-custom-select-border.d.ts +6 -0
  166. package/es/scenegraph/select/update-custom-select-border.js +63 -0
  167. package/es/scenegraph/select/update-custom-select-border.js.map +1 -0
  168. package/es/scenegraph/select/update-select-border.js +37 -26
  169. package/es/scenegraph/select/update-select-border.js.map +1 -1
  170. package/es/scenegraph/utils/cell-pos.d.ts +12 -0
  171. package/es/scenegraph/utils/cell-pos.js +24 -0
  172. package/es/scenegraph/utils/cell-pos.js.map +1 -1
  173. package/es/scenegraph/utils/update-container.d.ts +1 -0
  174. package/es/scenegraph/utils/update-container.js +6 -0
  175. package/es/scenegraph/utils/update-container.js.map +1 -1
  176. package/es/state/select/custom-select.d.ts +2 -2
  177. package/es/state/select/custom-select.js +3 -15
  178. package/es/state/select/custom-select.js.map +1 -1
  179. package/es/state/select/update-position.js +1 -1
  180. package/es/state/select/update-position.js.map +1 -1
  181. package/es/state/state.d.ts +4 -7
  182. package/es/state/state.js +28 -4
  183. package/es/state/state.js.map +1 -1
  184. package/es/themes/theme-define.js +1 -1
  185. package/es/themes/theme-define.js.map +1 -1
  186. package/es/tools/style.d.ts +3 -1
  187. package/es/tools/style.js +20 -0
  188. package/es/tools/style.js.map +1 -1
  189. package/es/ts-types/base-table.d.ts +7 -0
  190. package/es/ts-types/base-table.js.map +1 -1
  191. package/es/ts-types/events.d.ts +21 -1
  192. package/es/ts-types/events.js.map +1 -1
  193. package/es/ts-types/new-data-set.d.ts +1 -0
  194. package/es/ts-types/new-data-set.js.map +1 -1
  195. package/es/ts-types/style-define.d.ts +6 -0
  196. package/es/ts-types/style-define.js.map +1 -1
  197. package/es/ts-types/table-engine.d.ts +3 -0
  198. package/es/ts-types/table-engine.js.map +1 -1
  199. package/es/vrender.js.map +1 -1
  200. package/package.json +12 -8
package/dist/vtable.js CHANGED
@@ -588,7 +588,15 @@
588
588
  const VGlobal = Symbol.for("VGlobal");
589
589
  const DEFAULT_TEXT_FONT_FAMILY$2 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
590
590
 
591
- class Application {}
591
+ const container = new Container$2();
592
+
593
+ const RenderService = Symbol.for("RenderService");
594
+
595
+ class Application {
596
+ get renderService() {
597
+ return this._renderService || (this._renderService = container.get(RenderService)), this._renderService;
598
+ }
599
+ }
592
600
  const application = new Application();
593
601
 
594
602
  let idx = 0;
@@ -4635,7 +4643,8 @@
4635
4643
  y1: 0,
4636
4644
  strokeBoundsBuffer: 0,
4637
4645
  cornerRadius: 0,
4638
- cornerType: "round"
4646
+ cornerType: "round",
4647
+ drawStrokeWhenZeroWH: !1
4639
4648
  });
4640
4649
  Object.assign(Object.assign({}, DefaultAttribute), {
4641
4650
  width: 0,
@@ -4644,7 +4653,8 @@
4644
4653
  y1: 0,
4645
4654
  cornerRadius: 0,
4646
4655
  length: 0,
4647
- cornerType: "round"
4656
+ cornerType: "round",
4657
+ drawStrokeWhenZeroWH: !1
4648
4658
  });
4649
4659
  const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4650
4660
  symbolType: "circle",
@@ -4871,6 +4881,34 @@
4871
4881
  }
4872
4882
  return c;
4873
4883
  }
4884
+ static processColorStops(colorStops) {
4885
+ if (!colorStops || 0 === colorStops.length) return [];
4886
+ if (colorStops.some(item => item.length)) {
4887
+ const stops = colorStops.map(item => ({
4888
+ color: item.value,
4889
+ offset: item.length ? parseFloat(item.length.value) / 100 : -1
4890
+ }));
4891
+ stops[0].offset < 0 && (stops[0].offset = 0), stops[stops.length - 1].offset < 0 && (stops[stops.length - 1].offset = 1);
4892
+ for (let i = 1; i < stops.length - 1; i++) if (stops[i].offset < 0) {
4893
+ const prevWithOffsetIdx = i - 1;
4894
+ let nextWithOffsetIdx = i + 1;
4895
+ for (; nextWithOffsetIdx < stops.length && stops[nextWithOffsetIdx].offset < 0;) nextWithOffsetIdx++;
4896
+ const startOffset = stops[prevWithOffsetIdx].offset,
4897
+ endOffset = stops[nextWithOffsetIdx].offset,
4898
+ unspecCount = nextWithOffsetIdx - prevWithOffsetIdx;
4899
+ for (let j = 1; j < unspecCount; j++) stops[prevWithOffsetIdx + j].offset = startOffset + (endOffset - startOffset) * j / unspecCount;
4900
+ i = nextWithOffsetIdx - 1;
4901
+ }
4902
+ return stops;
4903
+ }
4904
+ return colorStops.map((item, index) => {
4905
+ const offset = colorStops.length > 1 ? index / (colorStops.length - 1) : 0;
4906
+ return {
4907
+ color: item.value,
4908
+ offset: offset
4909
+ };
4910
+ });
4911
+ }
4874
4912
  static ParseConic(datum) {
4875
4913
  const {
4876
4914
  orientation: orientation,
@@ -4884,10 +4922,7 @@
4884
4922
  y: .5,
4885
4923
  startAngle: sa,
4886
4924
  endAngle: sa + pi2,
4887
- stops: colorStops.map(item => ({
4888
- color: item.value,
4889
- offset: parseFloat(item.length.value) / 100
4890
- }))
4925
+ stops: GradientParser.processColorStops(colorStops)
4891
4926
  };
4892
4927
  }
4893
4928
  static ParseRadial(datum) {
@@ -4902,10 +4937,7 @@
4902
4937
  y1: .5,
4903
4938
  r0: 0,
4904
4939
  r1: 1,
4905
- stops: colorStops.map(item => ({
4906
- color: item.value,
4907
- offset: parseFloat(item.length.value) / 100
4908
- }))
4940
+ stops: GradientParser.processColorStops(colorStops)
4909
4941
  };
4910
4942
  }
4911
4943
  static ParseLinear(datum) {
@@ -4927,10 +4959,7 @@
4927
4959
  y0: y0,
4928
4960
  x1: x1,
4929
4961
  y1: y1,
4930
- stops: colorStops.map(item => ({
4931
- color: item.value,
4932
- offset: parseFloat(item.length.value) / 100
4933
- }))
4962
+ stops: GradientParser.processColorStops(colorStops)
4934
4963
  };
4935
4964
  }
4936
4965
  }
@@ -5126,6 +5155,9 @@
5126
5155
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5127
5156
  };
5128
5157
  let ATextMeasure = class {
5158
+ constructor() {
5159
+ this.id = "ATextMeasure";
5160
+ }
5129
5161
  configure(service, env) {
5130
5162
  this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
5131
5163
  }
@@ -5518,11 +5550,13 @@
5518
5550
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5519
5551
  };
5520
5552
  const TextMeasureContribution = Symbol.for("TextMeasureContribution");
5521
- let DefaultTextMeasureContribution = class extends ATextMeasure {};
5553
+ let DefaultTextMeasureContribution = class extends ATextMeasure {
5554
+ constructor() {
5555
+ super(...arguments), this.id = "DefaultTextMeasureContribution";
5556
+ }
5557
+ };
5522
5558
  DefaultTextMeasureContribution = __decorate$$([injectable()], DefaultTextMeasureContribution);
5523
5559
 
5524
- const container = new Container$2();
5525
-
5526
5560
  const CanvasFactory = Symbol.for("CanvasFactory");
5527
5561
  const Context2dFactory = Symbol.for("Context2dFactory");
5528
5562
 
@@ -6099,13 +6133,17 @@
6099
6133
  return this.tryInitCanvas(), this._context;
6100
6134
  }
6101
6135
  constructor(contributions) {
6102
- this.contributions = contributions, this.configured = !1, this.global = application.global, this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
6136
+ this.contributions = contributions, this.configured = !1, this.global = application.global, this._textMeasureMap = new Map(), this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
6103
6137
  this.configured = !1, this.configure(global, env);
6104
6138
  });
6105
6139
  }
6106
6140
  get textMeasure() {
6107
6141
  return this._textMeasure || this.configure(this.global, this.global.env), this._textMeasure;
6108
6142
  }
6143
+ getTextMeasureInstance(textMeasureId) {
6144
+ if (!textMeasureId) return this.textMeasure;
6145
+ return this._textMeasureMap.get(textMeasureId) || this.textMeasure;
6146
+ }
6109
6147
  configure(global, env) {
6110
6148
  this.configured || (this.contributions.getContributions().forEach(contribution => {
6111
6149
  contribution.configure(this, env);
@@ -6118,7 +6156,7 @@
6118
6156
  }
6119
6157
  }
6120
6158
  bindTextMeasure(tm) {
6121
- this._textMeasure = tm;
6159
+ this._textMeasure && "DefaultTextMeasureContribution" !== tm.id || (this._textMeasure = tm), this._textMeasureMap.has(tm.id) || this._textMeasureMap.set(tm.id, tm);
6122
6160
  }
6123
6161
  measureText(text, tc, method = "native") {
6124
6162
  var _a;
@@ -9298,7 +9336,7 @@
9298
9336
  });
9299
9337
  }
9300
9338
  setAttributes(params, forceUpdateTag = !1, context) {
9301
- (params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context);
9339
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
9302
9340
  }
9303
9341
  _setAttributes(params, forceUpdateTag = !1, context) {
9304
9342
  const keys = Object.keys(params);
@@ -10123,8 +10161,8 @@
10123
10161
  function strokeVisible(opacity, strokeOpacity) {
10124
10162
  return opacity * strokeOpacity > 0;
10125
10163
  }
10126
- function rectStrokeVisible(opacity, strokeOpacity, width, height) {
10127
- return opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
10164
+ function rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH) {
10165
+ return drawStrokeWhenZeroWH ? opacity * strokeOpacity > 0 : opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
10128
10166
  }
10129
10167
  function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
10130
10168
  const x10 = x1 - x0,
@@ -10715,7 +10753,7 @@
10715
10753
  this.cache.layoutData.lines.forEach(item => {
10716
10754
  mergedText += item.str;
10717
10755
  });
10718
- return (Array.isArray(text) ? text.join("") : text) !== mergedText;
10756
+ return (Array.isArray(text) ? text.join("") : text).toString() !== mergedText;
10719
10757
  }
10720
10758
  return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
10721
10759
  }
@@ -10814,7 +10852,7 @@
10814
10852
  return fontSize ? .1 * fontSize : 0;
10815
10853
  }
10816
10854
  updateHorizontalMultilineAABBBounds(text) {
10817
- var _a;
10855
+ var _a, _b;
10818
10856
  const textTheme = this.getGraphicTheme(),
10819
10857
  attribute = this.attribute,
10820
10858
  {
@@ -10841,7 +10879,7 @@
10841
10879
  const bbox = this.cache.layoutData.bbox;
10842
10880
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
10843
10881
  }
10844
- const textMeasure = application.graphicUtil.textMeasure,
10882
+ const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
10845
10883
  layoutData = new CanvasTextLayout(fontFamily, {
10846
10884
  fontSize: fontSize,
10847
10885
  fontWeight: fontWeight,
@@ -10859,7 +10897,7 @@
10859
10897
  return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
10860
10898
  }
10861
10899
  updateWrapAABBBounds(text) {
10862
- var _a, _b, _c;
10900
+ var _a, _b, _c, _d;
10863
10901
  const textTheme = this.getGraphicTheme(),
10864
10902
  {
10865
10903
  fontFamily = textTheme.fontFamily,
@@ -10885,7 +10923,7 @@
10885
10923
  const bbox = this.cache.layoutData.bbox;
10886
10924
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
10887
10925
  }
10888
- const textMeasure = application.graphicUtil.textMeasure,
10926
+ const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
10889
10927
  textOptions = {
10890
10928
  fontSize: fontSize,
10891
10929
  fontWeight: fontWeight,
@@ -10917,7 +10955,7 @@
10917
10955
  if ("" !== str && "" === clip.str || clip.wordBreaked) {
10918
10956
  if (ellipsis) {
10919
10957
  const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
10920
- clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
10958
+ clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
10921
10959
  } else clip.str = "", clip.width = 0;
10922
10960
  needCut = !1;
10923
10961
  }
@@ -10980,9 +11018,9 @@
10980
11018
  return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
10981
11019
  }
10982
11020
  updateVerticalMultilineAABBBounds(text) {
10983
- var _a, _b;
11021
+ var _a, _b, _c;
10984
11022
  const textTheme = this.getGraphicTheme(),
10985
- textMeasure = application.graphicUtil.textMeasure;
11023
+ textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.textMeasureId));
10986
11024
  let width;
10987
11025
  const attribute = this.attribute,
10988
11026
  {
@@ -11003,7 +11041,7 @@
11003
11041
  } = attribute;
11004
11042
  if (!verticalMode) {
11005
11043
  const t = textAlign;
11006
- textAlign = null !== (_a = Text.baselineMapAlign[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = Text.alignMapBaseline[t]) && void 0 !== _b ? _b : "top";
11044
+ textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
11007
11045
  }
11008
11046
  if (width = 0, !this.shouldUpdateShape() && this.cache) {
11009
11047
  this.cache.verticalList.forEach(item => {
@@ -11117,7 +11155,7 @@
11117
11155
  return isArray$9(text) ? !text.every(t => null == t || "" === t) : null != text && "" !== text;
11118
11156
  }
11119
11157
  updateMultilineAABBBounds(text) {
11120
- var _a, _b, _c, _d;
11158
+ var _a, _b, _c, _d, _e;
11121
11159
  const textTheme = this.getGraphicTheme(),
11122
11160
  {
11123
11161
  fontFamily = textTheme.fontFamily,
@@ -11141,7 +11179,7 @@
11141
11179
  const bbox = this.cache.layoutData.bbox;
11142
11180
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
11143
11181
  }
11144
- const textMeasure = application.graphicUtil.textMeasure,
11182
+ const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_c = this.stage) || void 0 === _c ? void 0 : _c.textMeasureId)),
11145
11183
  layoutObj = new CanvasTextLayout(fontFamily, {
11146
11184
  fontSize: fontSize,
11147
11185
  fontWeight: fontWeight,
@@ -11170,7 +11208,7 @@
11170
11208
  if ("" !== str && "" === clip.str) {
11171
11209
  if (ellipsis) {
11172
11210
  const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
11173
- clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
11211
+ clip.str = null !== (_d = clipEllipsis.str) && void 0 !== _d ? _d : "", clip.width = null !== (_e = clipEllipsis.width) && void 0 !== _e ? _e : 0;
11174
11212
  } else clip.str = "", clip.width = 0;
11175
11213
  needCut = !1;
11176
11214
  }
@@ -12274,7 +12312,7 @@
12274
12312
  case "right":
12275
12313
  deltaX = -aabbBounds.width();
12276
12314
  }
12277
- return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
12315
+ return height || ("middle" === this.verticalDirection ? deltaY -= aabbBounds.height() / 2 : "bottom" === this.verticalDirection && (deltaY -= aabbBounds.height())), aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
12278
12316
  }
12279
12317
  needUpdateTags(keys) {
12280
12318
  return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
@@ -13941,7 +13979,7 @@
13941
13979
  doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
13942
13980
  }
13943
13981
  _runStroke(arc, context, x, y, arcAttribute, doStroke, isFullStroke, sVisible, strokeCb) {
13944
- doStroke && isFullStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
13982
+ doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
13945
13983
  }
13946
13984
  draw(arc, renderService, drawContext, params) {
13947
13985
  const arcAttribute = getTheme(arc, null == params ? void 0 : params.theme).arc;
@@ -14673,7 +14711,8 @@
14673
14711
  y1: y1,
14674
14712
  x: originX = rectAttribute.x,
14675
14713
  y: originY = rectAttribute.y,
14676
- fillStrokeOrder = rectAttribute.fillStrokeOrder
14714
+ fillStrokeOrder = rectAttribute.fillStrokeOrder,
14715
+ drawStrokeWhenZeroWH = rectAttribute.drawStrokeWhenZeroWH
14677
14716
  } = rect.attribute;
14678
14717
  let {
14679
14718
  width: width,
@@ -14681,7 +14720,7 @@
14681
14720
  } = rect.attribute;
14682
14721
  width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
14683
14722
  const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
14684
- sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
14723
+ sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
14685
14724
  doFill = runFill(fill, background),
14686
14725
  doStroke = runStroke(stroke, lineWidth);
14687
14726
  if (!rect.valid || !visible) return;
@@ -15599,7 +15638,6 @@
15599
15638
  decorator(target, key, paramIndex);
15600
15639
  };
15601
15640
  };
15602
- const RenderService = Symbol.for("RenderService");
15603
15641
  let DefaultRenderService = class {
15604
15642
  constructor(drawContribution) {
15605
15643
  this.drawContribution = drawContribution;
@@ -16488,8 +16526,6 @@
16488
16526
  application.transformUtil = transformUtil;
16489
16527
  const graphicService = container.get(GraphicService);
16490
16528
  application.graphicService = graphicService;
16491
- const renderService = container.get(RenderService);
16492
- application.renderService = renderService;
16493
16529
  const layerService = container.get(LayerService);
16494
16530
  application.layerService = layerService;
16495
16531
 
@@ -16742,13 +16778,13 @@
16742
16778
  this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
16743
16779
  } else this._skipRender = 1;
16744
16780
  }, this.beforeRender = stage => {
16745
- this._beforeRender && this._beforeRender(stage);
16781
+ this._beforeRenderList.forEach(cb => cb(stage));
16746
16782
  }, this.afterClearScreen = drawParams => {
16747
16783
  this._afterClearScreen && this._afterClearScreen(drawParams);
16748
16784
  }, this.afterClearRect = drawParams => {
16749
16785
  this._afterClearRect && this._afterClearRect(drawParams);
16750
16786
  }, this.afterRender = stage => {
16751
- this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
16787
+ this.renderCount++, this._afterRenderList.forEach(cb => cb(stage)), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
16752
16788
  }, this.afterTickCb = () => {
16753
16789
  this.tickedBeforeRender = !0, "rendering" !== this.state && this.renderNextFrame();
16754
16790
  }, this.params = params, this.theme = new Theme(), this.hooks = {
@@ -16756,7 +16792,7 @@
16756
16792
  afterRender: new SyncHook(["stage"]),
16757
16793
  afterClearScreen: new SyncHook(["stage"]),
16758
16794
  afterClearRect: new SyncHook(["stage"])
16759
- }, this.global = application.global, !this.global.env && isBrowserEnv() && this.global.setEnv("browser"), this.window = container.get(VWindow), this.renderService = container.get(RenderService), this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService), this.graphicService = container.get(GraphicService), this.pluginService.active(this, params), this.window.create({
16795
+ }, this.global = application.global, !this.global.env && isBrowserEnv() && this.global.setEnv("browser"), this.window = container.get(VWindow), this.renderService = container.get(RenderService), this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService), this.graphicService = container.get(GraphicService), this.pluginService.active(this, params), this._beforeRenderList = [], this._afterRenderList = [], this.window.create({
16760
16796
  width: params.width,
16761
16797
  height: params.height,
16762
16798
  viewBox: params.viewBox,
@@ -16767,7 +16803,7 @@
16767
16803
  canvas: params.canvas
16768
16804
  }), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND, this.appendChild(this.layerService.createLayer(this, {
16769
16805
  main: !0
16770
- })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this.hooks.afterClearScreen.tap("constructor", this.afterClearScreen), this.hooks.afterClearRect.tap("constructor", this.afterClearRect), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this._afterClearScreen = params.afterClearScreen, this._afterClearRect = params.afterClearRect, this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
16806
+ })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), params.beforeRender && this._beforeRenderList.push(params.beforeRender), params.afterRender && this._afterRenderList.push(params.afterRender), this.hooks.afterClearScreen.tap("constructor", this.afterClearScreen), this.hooks.afterClearRect.tap("constructor", this.afterClearRect), this._afterClearScreen = params.afterClearScreen, this._afterClearRect = params.afterClearRect, this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
16771
16807
  tickRenderMode: "effect"
16772
16808
  }), this.optmize(params.optimize), params.background && isString$6(this._background) && this._background.includes("/") && this.setAttributes({
16773
16809
  background: this._background
@@ -16882,10 +16918,16 @@
16882
16918
  options.enableView3dTransform && this.enableView3dTransform();
16883
16919
  }
16884
16920
  setBeforeRender(cb) {
16885
- this._beforeRender = cb;
16921
+ this._beforeRenderList.push(cb);
16922
+ }
16923
+ removeBeforeRender(cb) {
16924
+ this._beforeRenderList = this._beforeRenderList.filter(c => c !== cb);
16886
16925
  }
16887
16926
  setAfterRender(cb) {
16888
- this._afterRender = cb;
16927
+ this._afterRenderList.push(cb);
16928
+ }
16929
+ removeAfterRender(cb) {
16930
+ this._afterRenderList = this._afterRenderList.filter(c => c !== cb);
16889
16931
  }
16890
16932
  afterNextRender(cb) {
16891
16933
  this._afterNextRenderCbs || (this._afterNextRenderCbs = []), this._afterNextRenderCbs.push(cb);
@@ -23678,6 +23720,7 @@
23678
23720
  return this.getEndProps();
23679
23721
  }
23680
23722
  stop() {}
23723
+ release() {}
23681
23724
  }
23682
23725
  class WaitStep extends Step {
23683
23726
  constructor(type, props, duration, easing) {
@@ -23685,8 +23728,6 @@
23685
23728
  }
23686
23729
  onStart() {
23687
23730
  super.onStart();
23688
- }
23689
- onFirstRun() {
23690
23731
  const fromProps = this.getFromProps();
23691
23732
  this.target.setAttributes(fromProps);
23692
23733
  }
@@ -23895,7 +23936,9 @@
23895
23936
  this.status !== AnimateStatus.END && this.onEnd(), this.status = AnimateStatus.END, this.target && ("start" === type ? this.target.setAttributes(this._startProps) : "end" === type ? this.target.setAttributes(this._endProps) : type && this.target.setAttributes(type));
23896
23937
  }
23897
23938
  release() {
23898
- this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [];
23939
+ this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [], this.forEachStep(step => {
23940
+ step.release();
23941
+ });
23899
23942
  }
23900
23943
  getDuration() {
23901
23944
  return this._duration;
@@ -23969,6 +24012,10 @@
23969
24012
  getLoop() {
23970
24013
  return this._loopCount;
23971
24014
  }
24015
+ forEachStep(cb) {
24016
+ let step = this._firstStep;
24017
+ for (; step;) cb(step), step = step.next;
24018
+ }
23972
24019
  }
23973
24020
 
23974
24021
  const performanceRAF = new PerformanceRAF();
@@ -24201,6 +24248,9 @@
24201
24248
  constructor(target) {
24202
24249
  this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._target = target;
24203
24250
  }
24251
+ get started() {
24252
+ return this._started;
24253
+ }
24204
24254
  onStart(cb) {
24205
24255
  cb ? (this._startCallbacks.push(cb), this._started && this._activeCount > 0 && cb()) : this._startCallbacks.forEach(cb => {
24206
24256
  cb();
@@ -24341,14 +24391,14 @@
24341
24391
  return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
24342
24392
  }
24343
24393
  _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
24344
- var _a, _b, _c, _d;
24394
+ var _a, _b, _c, _d, _e, _f;
24345
24395
  if (custom && customType) {
24346
24396
  const customParams = Object.assign({
24347
- width: graphic.stage.width,
24348
- height: graphic.stage.height,
24397
+ width: (null === (_a = graphic.stage) || void 0 === _a ? void 0 : _a.width) || 0,
24398
+ height: (null === (_b = graphic.stage) || void 0 === _b ? void 0 : _b.height) || 0,
24349
24399
  group: this._target.parent
24350
24400
  }, this.resolveValue(customParameters, graphic)),
24351
- objOptions = isFunction$7(options) ? options.call(null, null !== (_b = customParams && (null === (_a = customParams.data) || void 0 === _a ? void 0 : _a[0])) && void 0 !== _b ? _b : null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, customParams) : options;
24401
+ objOptions = isFunction$7(options) ? options.call(null, null !== (_d = customParams && (null === (_c = customParams.data) || void 0 === _c ? void 0 : _c[0])) && void 0 !== _d ? _d : null === (_f = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.data) || void 0 === _f ? void 0 : _f[0], graphic, customParams) : options;
24352
24402
  customParams.options = objOptions, customParams.controlOptions = controlOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
24353
24403
  } else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
24354
24404
  }
@@ -24568,7 +24618,7 @@
24568
24618
  reApplyState(state) {
24569
24619
  var _a;
24570
24620
  const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
24571
- if (stateInfo) {
24621
+ if (stateInfo && stateInfo.executor.started) {
24572
24622
  const stateList = this.stateList.slice();
24573
24623
  stateInfo.executor.stop(), this.stateList = stateList, stateInfo.executor.execute(stateInfo.animationConfig);
24574
24624
  }
@@ -24711,6 +24761,45 @@
24711
24761
  this._animator && this._animator.stop();
24712
24762
  }
24713
24763
  }
24764
+ class AStageAnimate extends ACustomAnimate {
24765
+ constructor(customFrom, customTo, duration, easing, params) {
24766
+ super(customFrom, customTo, duration, easing, params), this.willCallBeforeStageRender = !0, this.willCallAfterStageRender = !0, this._beforeStageRender = () => {
24767
+ if (!this.willCallBeforeStageRender) return;
24768
+ this.willCallBeforeStageRender = !1;
24769
+ const stage = this.target.stage,
24770
+ canvas = stage.window.getContext().canvas.nativeCanvas,
24771
+ outputCanvas = this.beforeStageRender(stage, canvas);
24772
+ outputCanvas && this.renderToStage(stage, outputCanvas);
24773
+ }, this._afterStageRender = () => {
24774
+ if (!this.willCallAfterStageRender) return;
24775
+ this.willCallAfterStageRender = !1;
24776
+ const stage = this.target.stage,
24777
+ canvas = stage.window.getContext().canvas.nativeCanvas,
24778
+ outputCanvas = this.afterStageRender(stage, canvas);
24779
+ outputCanvas && this.renderToStage(stage, outputCanvas);
24780
+ }, this.props = {};
24781
+ }
24782
+ beforeStageRender(stage, canvas) {
24783
+ return !1;
24784
+ }
24785
+ afterStageRender(stage, canvas) {
24786
+ return !1;
24787
+ }
24788
+ onFirstRun() {
24789
+ super.onFirstRun(), this.target.stage.setBeforeRender(this._beforeStageRender), this.target.stage.setAfterRender(this._afterStageRender), this.target.stage.disableDirtyBounds();
24790
+ }
24791
+ stop() {
24792
+ super.stop(), this.target.stage.removeBeforeRender(this._beforeStageRender), this.target.stage.removeAfterRender(this._afterStageRender);
24793
+ }
24794
+ onUpdate(end, ratio, out) {
24795
+ super.onUpdate(end, ratio, out), this.willCallBeforeStageRender = !0, this.willCallAfterStageRender = !0;
24796
+ }
24797
+ renderToStage(stage, canvas) {
24798
+ const stageCanvas = stage.window.getContext().canvas.nativeCanvas,
24799
+ ctx = stageCanvas.getContext("2d");
24800
+ return !!ctx && (ctx.clearRect(0, 0, stageCanvas.width, stageCanvas.height), ctx.drawImage(canvas, 0, 0), stageCanvas);
24801
+ }
24802
+ }
24714
24803
 
24715
24804
  class ComponentAnimator {
24716
24805
  constructor(component) {
@@ -25093,7 +25182,7 @@
25093
25182
  }
25094
25183
  class GrowAngleIn extends GrowAngleBase {
25095
25184
  onBind() {
25096
- var _a, _b;
25185
+ var _a, _b, _c;
25097
25186
  super.onBind();
25098
25187
  const {
25099
25188
  from: from,
@@ -25102,7 +25191,7 @@
25102
25191
  fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
25103
25192
  this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
25104
25193
  const finalAttribute = this.target.getFinalAttribute();
25105
- finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs), this.determineUpdateFunction();
25194
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(fromAttrs), this.determineUpdateFunction();
25106
25195
  }
25107
25196
  }
25108
25197
  class GrowAngleOut extends GrowAngleBase {
@@ -25710,7 +25799,7 @@
25710
25799
  }
25711
25800
  class GrowRadiusIn extends GrowPointsBase {
25712
25801
  onBind() {
25713
- var _a, _b;
25802
+ var _a, _b, _c;
25714
25803
  super.onBind();
25715
25804
  const {
25716
25805
  from: from,
@@ -25719,7 +25808,7 @@
25719
25808
  fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
25720
25809
  this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
25721
25810
  const finalAttribute = this.target.getFinalAttribute();
25722
- finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
25811
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(fromAttrs);
25723
25812
  }
25724
25813
  }
25725
25814
  class GrowRadiusOut extends GrowPointsBase {
@@ -25834,7 +25923,7 @@
25834
25923
  super(from, to, duration, easing, params);
25835
25924
  }
25836
25925
  onBind() {
25837
- var _a, _b;
25926
+ var _a, _b, _c;
25838
25927
  super.onBind();
25839
25928
  const {
25840
25929
  from: from,
@@ -25843,7 +25932,7 @@
25843
25932
  fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
25844
25933
  this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
25845
25934
  const finalAttribute = this.target.getFinalAttribute();
25846
- finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
25935
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(fromAttrs);
25847
25936
  }
25848
25937
  onEnd(cb) {
25849
25938
  super.onEnd(cb);
@@ -27627,8 +27716,1271 @@
27627
27716
  }
27628
27717
  }
27629
27718
 
27719
+ class DisappearAnimateBase extends AStageAnimate {
27720
+ constructor(from, to, duration, easing, params) {
27721
+ super(from, to, duration, easing, params), this.webglCanvas = null, this.gl = null, this.program = null, this.currentAnimationRatio = 0, this.animationTime = 0;
27722
+ }
27723
+ onUpdate(end, ratio, out) {
27724
+ super.onUpdate(end, ratio, out), this.currentAnimationRatio = ratio, this.animationTime = ratio * Math.PI * 2;
27725
+ }
27726
+ getAnimationTime() {
27727
+ return this.currentAnimationRatio > 0 ? this.animationTime : Date.now() / 1e3;
27728
+ }
27729
+ getDurationFromParent() {
27730
+ return this.duration || 1e3;
27731
+ }
27732
+ initWebGL(canvas) {
27733
+ try {
27734
+ if (this.webglCanvas = vglobal.createCanvas({
27735
+ width: canvas.width,
27736
+ height: canvas.height,
27737
+ dpr: vglobal.devicePixelRatio
27738
+ }), !this.webglCanvas) return (void 0), !1;
27739
+ this.webglCanvas.style.width = canvas.style.width || `${canvas.width}px`, this.webglCanvas.style.height = canvas.style.height || `${canvas.height}px`;
27740
+ let glContext = null;
27741
+ try {
27742
+ glContext = this.webglCanvas.getContext("webgl"), glContext || (glContext = this.webglCanvas.getContext("experimental-webgl"));
27743
+ } catch (e) {
27744
+ }
27745
+ if (this.gl = glContext, !this.gl) return (void 0), !1;
27746
+ const shaders = this.getShaderSources();
27747
+ return this.program = this.createShaderProgram(shaders.vertex, shaders.fragment), null !== this.program;
27748
+ } catch (error) {
27749
+ return !1;
27750
+ }
27751
+ }
27752
+ createShaderProgram(vertexSource, fragmentSource) {
27753
+ if (!this.gl) return null;
27754
+ const vertexShader = this.createShader(this.gl.VERTEX_SHADER, vertexSource),
27755
+ fragmentShader = this.createShader(this.gl.FRAGMENT_SHADER, fragmentSource);
27756
+ if (!vertexShader || !fragmentShader) return null;
27757
+ const program = this.gl.createProgram();
27758
+ return program ? (this.gl.attachShader(program, vertexShader), this.gl.attachShader(program, fragmentShader), this.gl.linkProgram(program), this.gl.getProgramParameter(program, this.gl.LINK_STATUS) ? program : (null)) : null;
27759
+ }
27760
+ createShader(type, source) {
27761
+ if (!this.gl) return null;
27762
+ const shader = this.gl.createShader(type);
27763
+ return shader ? (this.gl.shaderSource(shader, source), this.gl.compileShader(shader), this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS) ? shader : (this.gl.deleteShader(shader), null)) : null;
27764
+ }
27765
+ setupWebGLState(canvas) {
27766
+ this.gl && this.webglCanvas && (this.webglCanvas.width === canvas.width && this.webglCanvas.height === canvas.height || (this.webglCanvas.width = canvas.width, this.webglCanvas.height = canvas.height), this.gl.viewport(0, 0, this.webglCanvas.width, this.webglCanvas.height), this.gl.clearColor(0, 0, 0, 0), this.gl.clear(this.gl.COLOR_BUFFER_BIT));
27767
+ }
27768
+ createFullScreenQuad() {
27769
+ if (!this.gl) return null;
27770
+ const vertices = new Float32Array([-1, -1, 0, 1, 1, -1, 1, 1, -1, 1, 0, 0, 1, 1, 1, 0]),
27771
+ vertexBuffer = this.gl.createBuffer();
27772
+ return this.gl.bindBuffer(this.gl.ARRAY_BUFFER, vertexBuffer), this.gl.bufferData(this.gl.ARRAY_BUFFER, vertices, this.gl.STATIC_DRAW), vertexBuffer;
27773
+ }
27774
+ createTextureFromCanvas(canvas) {
27775
+ if (!this.gl) return null;
27776
+ const texture = this.gl.createTexture();
27777
+ return this.gl.activeTexture(this.gl.TEXTURE0), this.gl.bindTexture(this.gl.TEXTURE_2D, texture), this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, this.gl.RGBA, this.gl.UNSIGNED_BYTE, canvas), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR), texture;
27778
+ }
27779
+ setupVertexAttributes() {
27780
+ if (!this.gl || !this.program) return;
27781
+ const positionLocation = this.gl.getAttribLocation(this.program, "a_position"),
27782
+ texCoordLocation = this.gl.getAttribLocation(this.program, "a_texCoord");
27783
+ this.gl.enableVertexAttribArray(positionLocation), this.gl.vertexAttribPointer(positionLocation, 2, this.gl.FLOAT, !1, 16, 0), this.gl.enableVertexAttribArray(texCoordLocation), this.gl.vertexAttribPointer(texCoordLocation, 2, this.gl.FLOAT, !1, 16, 8);
27784
+ }
27785
+ createOutputCanvas(canvas) {
27786
+ const outputCanvas = vglobal.createCanvas({
27787
+ width: canvas.width,
27788
+ height: canvas.height,
27789
+ dpr: vglobal.devicePixelRatio
27790
+ }),
27791
+ ctx = outputCanvas.getContext("2d");
27792
+ return ctx ? (ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.drawImage(canvas, 0, 0), {
27793
+ canvas: outputCanvas,
27794
+ ctx: ctx
27795
+ }) : null;
27796
+ }
27797
+ getShaderSources() {
27798
+ return null;
27799
+ }
27800
+ applyWebGLEffect(canvas) {
27801
+ return null;
27802
+ }
27803
+ applyCanvas2DEffect(canvas) {
27804
+ return null;
27805
+ }
27806
+ supportsWebGL() {
27807
+ return null !== this.getShaderSources();
27808
+ }
27809
+ supportsCanvas2D() {
27810
+ return this.applyCanvas2DEffect !== DisappearAnimateBase.prototype.applyCanvas2DEffect;
27811
+ }
27812
+ release() {
27813
+ super.release(), this.gl && (this.program && (this.gl.deleteProgram(this.program), this.program = null), this.gl = null), this.webglCanvas && (this.webglCanvas = null), this.currentAnimationRatio = 0, this.animationTime = 0;
27814
+ }
27815
+ afterStageRender(stage, canvas) {
27816
+ let result = null;
27817
+ if (this.supportsWebGL() && (this.gl || this.initWebGL(canvas) || (void 0), this.gl)) {
27818
+ if (result = this.applyWebGLEffect(canvas), result) return result;
27819
+ }
27820
+ if (this.supportsCanvas2D()) {
27821
+ if (result = this.applyCanvas2DEffect(canvas), result) return result;
27822
+ }
27823
+ return this.supportsWebGL() || this.supportsCanvas2D() || (void 0), canvas;
27824
+ }
27825
+ }
27826
+
27827
+ class Canvas2DEffectBase extends DisappearAnimateBase {
27828
+ constructor(from, to, duration, easing, params) {
27829
+ super(from, to, duration, easing, params);
27830
+ }
27831
+ getShaderSources() {
27832
+ return null;
27833
+ }
27834
+ applyWebGLEffect(canvas) {
27835
+ return null;
27836
+ }
27837
+ }
27838
+ class HybridEffectBase extends DisappearAnimateBase {
27839
+ constructor(from, to, duration, easing, params) {
27840
+ super(from, to, duration, easing, params);
27841
+ }
27842
+ getShaderSources() {
27843
+ return null;
27844
+ }
27845
+ applyWebGLEffect(canvas) {
27846
+ return null;
27847
+ }
27848
+ applyCanvas2DEffect(canvas) {
27849
+ return null;
27850
+ }
27851
+ supportsWebGL() {
27852
+ return this.getShaderSources !== HybridEffectBase.prototype.getShaderSources && null !== this.getShaderSources();
27853
+ }
27854
+ supportsCanvas2D() {
27855
+ return this.applyCanvas2DEffect !== HybridEffectBase.prototype.applyCanvas2DEffect;
27856
+ }
27857
+ afterStageRender(stage, canvas) {
27858
+ var _a, _b;
27859
+ let result = null;
27860
+ if (!1 !== (null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.options) || void 0 === _b ? void 0 : _b.useWebGL)) {
27861
+ if (this.supportsWebGL() && (this.gl || this.initWebGL(canvas) || (void 0), this.gl)) {
27862
+ if (result = this.applyWebGLEffect(canvas), result) return result;
27863
+ }
27864
+ if (this.supportsCanvas2D()) {
27865
+ if (result = this.applyCanvas2DEffect(canvas), result) return result;
27866
+ }
27867
+ } else if (this.supportsCanvas2D()) {
27868
+ if (result = this.applyCanvas2DEffect(canvas), result) return result;
27869
+ } else ;
27870
+ return this.supportsWebGL() || this.supportsCanvas2D() || (void 0), canvas;
27871
+ }
27872
+ }
27873
+
27874
+ class ImageProcessUtils {
27875
+ static createTempCanvas(width, height, dpr) {
27876
+ return vglobal.createCanvas({
27877
+ width: width,
27878
+ height: height,
27879
+ dpr: dpr || vglobal.devicePixelRatio
27880
+ });
27881
+ }
27882
+ static cloneImageData(imageData) {
27883
+ const clonedData = new Uint8ClampedArray(imageData.data);
27884
+ return new ImageData(clonedData, imageData.width, imageData.height);
27885
+ }
27886
+ static lerp(start, end, t) {
27887
+ return start * (1 - t) + end * t;
27888
+ }
27889
+ static smoothstep(edge0, edge1, x) {
27890
+ const t = Math.max(0, Math.min(1, (x - edge0) / (edge1 - edge0)));
27891
+ return t * t * (3 - 2 * t);
27892
+ }
27893
+ static distance(x1, y1, x2, y2) {
27894
+ const dx = x2 - x1,
27895
+ dy = y2 - y1;
27896
+ return Math.sqrt(dx * dx + dy * dy);
27897
+ }
27898
+ static normalizeAngle(angle) {
27899
+ return (angle + Math.PI) / (2 * Math.PI);
27900
+ }
27901
+ static pixelNoise(x, y, pixelSize) {
27902
+ if (pixelSize <= 0) return 0;
27903
+ const gridX = Math.floor(x / pixelSize) * pixelSize,
27904
+ gridY = Math.floor(y / pixelSize) * pixelSize,
27905
+ n = 43758.5453 * Math.sin(12.9898 * gridX + 78.233 * gridY);
27906
+ return n - Math.floor(n);
27907
+ }
27908
+ static generateNoiseTexture(width, height) {
27909
+ const data = new Uint8Array(width * height);
27910
+ for (let i = 0; i < data.length; i++) data[i] = Math.floor(256 * Math.random());
27911
+ return data;
27912
+ }
27913
+ static applyCSSFilter(canvas, filter) {
27914
+ const outputCanvas = this.createTempCanvas(canvas.width, canvas.height),
27915
+ ctx = outputCanvas.getContext("2d");
27916
+ return ctx ? (ctx.filter = filter, ctx.drawImage(canvas, 0, 0), ctx.filter = "none", outputCanvas) : canvas;
27917
+ }
27918
+ static extractChannel(imageData, channelIndex) {
27919
+ const {
27920
+ data: data,
27921
+ width: width,
27922
+ height: height
27923
+ } = imageData,
27924
+ channelData = new Uint8ClampedArray(data.length);
27925
+ for (let i = 0; i < data.length; i += 4) channelData[i] = 0, channelData[i + 1] = 0, channelData[i + 2] = 0, channelData[i + 3] = data[i + 3], channelIndex >= 0 && channelIndex <= 2 && (channelData[i + channelIndex] = data[i + channelIndex]);
27926
+ return new ImageData(channelData, width, height);
27927
+ }
27928
+ static blendImageData(imageData1, imageData2, ratio) {
27929
+ const {
27930
+ data: data1,
27931
+ width: width,
27932
+ height: height
27933
+ } = imageData1,
27934
+ {
27935
+ data: data2
27936
+ } = imageData2,
27937
+ result = new Uint8ClampedArray(data1.length);
27938
+ for (let i = 0; i < data1.length; i += 4) result[i] = Math.round(this.lerp(data1[i], data2[i], ratio)), result[i + 1] = Math.round(this.lerp(data1[i + 1], data2[i + 1], ratio)), result[i + 2] = Math.round(this.lerp(data1[i + 2], data2[i + 2], ratio)), result[i + 3] = Math.round(this.lerp(data1[i + 3], data2[i + 3], ratio));
27939
+ return new ImageData(result, width, height);
27940
+ }
27941
+ static getLuminance(r, g, b) {
27942
+ return .299 * r + .587 * g + .114 * b;
27943
+ }
27944
+ static applySepiaToPixel(r, g, b) {
27945
+ return [Math.min(255, .393 * r + .769 * g + .189 * b), Math.min(255, .349 * r + .686 * g + .168 * b), Math.min(255, .272 * r + .534 * g + .131 * b)];
27946
+ }
27947
+ static calculateDynamicStrength(baseStrength, animationTime) {
27948
+ return baseStrength * (animationTime / (2 * Math.PI));
27949
+ }
27950
+ }
27951
+ class ShaderLibrary {}
27952
+ ShaderLibrary.STANDARD_VERTEX_SHADER = "\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ", ShaderLibrary.SHADER_FUNCTIONS = "\n // 亮度计算函数\n float luminance(vec3 color) {\n return dot(color, vec3(0.299, 0.587, 0.114));\n }\n\n // 褐色调函数\n vec3 sepia(vec3 color) {\n float r = color.r * 0.393 + color.g * 0.769 + color.b * 0.189;\n float g = color.r * 0.349 + color.g * 0.686 + color.b * 0.168;\n float b = color.r * 0.272 + color.g * 0.534 + color.b * 0.131;\n return vec3(r, g, b);\n }\n\n // 线性插值函数\n float lerp(float a, float b, float t) {\n return a * (1.0 - t) + b * t;\n }\n\n\n // 简单噪声函数\n float pixelNoise(vec2 coord, float pixelSize) {\n vec2 gridCoord = floor(coord / pixelSize) * pixelSize;\n return fract(sin(dot(gridCoord, vec2(12.9898, 78.233))) * 43758.5453123);\n }\n\n // 动态强度计算\n float calculateDynamicStrength(float baseStrength, float time) {\n return baseStrength * (time / 6.28318531); // 2π\n }\n ";
27953
+
27954
+ class Dissolve extends HybridEffectBase {
27955
+ constructor(from, to, duration, easing, params) {
27956
+ var _a, _b, _c, _d;
27957
+ super(from, to, duration, easing, params), this.noiseData = null;
27958
+ const rawNoiseScale = null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.noiseScale,
27959
+ clampedNoiseScale = void 0 !== rawNoiseScale ? Math.max(0, Math.floor(rawNoiseScale)) : 8;
27960
+ this.dissolveConfig = {
27961
+ dissolveType: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.dissolveType) || "outward",
27962
+ useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL,
27963
+ noiseScale: clampedNoiseScale,
27964
+ fadeEdge: void 0 === (null === (_d = null == params ? void 0 : params.options) || void 0 === _d ? void 0 : _d.fadeEdge) || params.options.fadeEdge
27965
+ };
27966
+ }
27967
+ getShaderSources() {
27968
+ return {
27969
+ vertex: ShaderLibrary.STANDARD_VERTEX_SHADER,
27970
+ fragment: `\n precision mediump float;\n uniform sampler2D u_texture;\n uniform sampler2D u_noiseTexture;\n uniform float u_time;\n uniform int u_dissolveType;\n uniform vec2 u_resolution;\n uniform float u_noiseScale;\n uniform bool u_fadeEdge;\n varying vec2 v_texCoord;\n\n ${ShaderLibrary.SHADER_FUNCTIONS}\n\n // 向外溶解函数\n float outwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n // 归一化距离 (0为中心,1为边缘)\n float normalizedDist = distFromCenter / maxDist;\n\n // 向外溶解:从边缘开始溶解,time控制溶解进度\n // 增加安全边距,确保动画结束时完全溶解\n float edgeThreshold = 1.2 - time * 1.5;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `
27971
+ };
27972
+ }
27973
+ applyWebGLEffect(canvas) {
27974
+ if (!this.gl || !this.program || !this.webglCanvas) return canvas;
27975
+ this.setupWebGLState(canvas);
27976
+ const texture = this.createTextureFromCanvas(canvas);
27977
+ if (!texture) return canvas;
27978
+ this.noiseData || (this.noiseData = ImageProcessUtils.generateNoiseTexture(256, 256));
27979
+ const noiseTexture = this.gl.createTexture();
27980
+ this.gl.activeTexture(this.gl.TEXTURE1), this.gl.bindTexture(this.gl.TEXTURE_2D, noiseTexture), this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.LUMINANCE, 256, 256, 0, this.gl.LUMINANCE, this.gl.UNSIGNED_BYTE, this.noiseData), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.REPEAT), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.REPEAT), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR);
27981
+ const vertexBuffer = this.createFullScreenQuad();
27982
+ return vertexBuffer ? (this.gl.useProgram(this.program), this.setupVertexAttributes(), this.setUniforms(), this.gl.enable(this.gl.BLEND), this.gl.blendFunc(this.gl.SRC_ALPHA, this.gl.ONE_MINUS_SRC_ALPHA), this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4), this.gl.deleteTexture(texture), this.gl.deleteTexture(noiseTexture), this.gl.deleteBuffer(vertexBuffer), this.webglCanvas) : canvas;
27983
+ }
27984
+ setUniforms() {
27985
+ if (!this.gl || !this.program || !this.webglCanvas) return;
27986
+ const textureLocation = this.gl.getUniformLocation(this.program, "u_texture"),
27987
+ noiseTextureLocation = this.gl.getUniformLocation(this.program, "u_noiseTexture"),
27988
+ timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
27989
+ dissolveTypeLocation = this.gl.getUniformLocation(this.program, "u_dissolveType"),
27990
+ resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution"),
27991
+ noiseScaleLocation = this.gl.getUniformLocation(this.program, "u_noiseScale"),
27992
+ fadeEdgeLocation = this.gl.getUniformLocation(this.program, "u_fadeEdge");
27993
+ this.gl.uniform1i(textureLocation, 0), this.gl.uniform1i(noiseTextureLocation, 1), this.gl.uniform1f(timeLocation, this.currentAnimationRatio), this.gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height), this.gl.uniform1f(noiseScaleLocation, this.dissolveConfig.noiseScale), this.gl.uniform1i(fadeEdgeLocation, this.dissolveConfig.fadeEdge ? 1 : 0);
27994
+ this.gl.uniform1i(dissolveTypeLocation, {
27995
+ outward: 0,
27996
+ inward: 1,
27997
+ radial: 2,
27998
+ leftToRight: 3,
27999
+ rightToLeft: 4,
28000
+ topToBottom: 5,
28001
+ bottomToTop: 6
28002
+ }[this.dissolveConfig.dissolveType] || 0);
28003
+ }
28004
+ applyCanvas2DEffect(canvas) {
28005
+ const outputCanvas = this.createOutputCanvas(canvas);
28006
+ if (!outputCanvas) return canvas;
28007
+ const {
28008
+ canvas: outputCanvasElement,
28009
+ ctx: ctx
28010
+ } = outputCanvas,
28011
+ imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
28012
+ progress = this.currentAnimationRatio;
28013
+ let dissolvedImageData;
28014
+ switch (this.dissolveConfig.dissolveType) {
28015
+ case "outward":
28016
+ dissolvedImageData = this.applyOutwardDissolve(imageData, progress);
28017
+ break;
28018
+ case "inward":
28019
+ dissolvedImageData = this.applyInwardDissolve(imageData, progress);
28020
+ break;
28021
+ case "radial":
28022
+ dissolvedImageData = this.applyRadialDissolve(imageData, progress);
28023
+ break;
28024
+ case "leftToRight":
28025
+ dissolvedImageData = this.applyLeftToRightDissolve(imageData, progress);
28026
+ break;
28027
+ case "rightToLeft":
28028
+ dissolvedImageData = this.applyRightToLeftDissolve(imageData, progress);
28029
+ break;
28030
+ case "topToBottom":
28031
+ dissolvedImageData = this.applyTopToBottomDissolve(imageData, progress);
28032
+ break;
28033
+ case "bottomToTop":
28034
+ dissolvedImageData = this.applyBottomToTopDissolve(imageData, progress);
28035
+ break;
28036
+ default:
28037
+ dissolvedImageData = imageData;
28038
+ }
28039
+ return ctx.putImageData(dissolvedImageData, 0, 0), outputCanvasElement;
28040
+ }
28041
+ applyOutwardDissolve(imageData, progress) {
28042
+ const {
28043
+ data: data,
28044
+ width: width,
28045
+ height: height
28046
+ } = imageData,
28047
+ result = new Uint8ClampedArray(data.length);
28048
+ result.set(data);
28049
+ const centerX = width / 2,
28050
+ centerY = height / 2,
28051
+ maxDist = Math.sqrt(centerX * centerX + centerY * centerY),
28052
+ pixelSize = this.dissolveConfig.noiseScale;
28053
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
28054
+ const dx = x - centerX,
28055
+ dy = y - centerY,
28056
+ normalizedDist = Math.sqrt(dx * dx + dy * dy) / maxDist;
28057
+ let dissolveThreshold = 1.2 - 1.4 * progress,
28058
+ alpha = 1;
28059
+ if (pixelSize > 0) {
28060
+ dissolveThreshold += .4 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedDist > dissolveThreshold ? 0 : 1;
28061
+ } else if (this.dissolveConfig.fadeEdge) {
28062
+ const fadeStart = dissolveThreshold - .15;
28063
+ alpha = normalizedDist < fadeStart ? 1 : normalizedDist > dissolveThreshold ? 0 : 1 - (normalizedDist - fadeStart) / (dissolveThreshold - fadeStart);
28064
+ } else alpha = normalizedDist > dissolveThreshold ? 0 : 1;
28065
+ const index = 4 * (y * width + x);
28066
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
28067
+ }
28068
+ return new ImageData(result, width, height);
28069
+ }
28070
+ applyInwardDissolve(imageData, progress) {
28071
+ const {
28072
+ data: data,
28073
+ width: width,
28074
+ height: height
28075
+ } = imageData,
28076
+ result = new Uint8ClampedArray(data.length);
28077
+ result.set(data);
28078
+ const centerX = width / 2,
28079
+ centerY = height / 2,
28080
+ maxDist = Math.sqrt(centerX * centerX + centerY * centerY),
28081
+ pixelSize = this.dissolveConfig.noiseScale;
28082
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
28083
+ const dx = x - centerX,
28084
+ dy = y - centerY,
28085
+ normalizedDist = Math.sqrt(dx * dx + dy * dy) / maxDist;
28086
+ let dissolveThreshold = 1.4 * progress,
28087
+ alpha = 1;
28088
+ if (pixelSize > 0) {
28089
+ dissolveThreshold += .4 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedDist < dissolveThreshold ? 0 : 1;
28090
+ } else if (this.dissolveConfig.fadeEdge) {
28091
+ const fadeEnd = dissolveThreshold + .15;
28092
+ alpha = normalizedDist < dissolveThreshold ? 0 : normalizedDist > fadeEnd ? 1 : (normalizedDist - dissolveThreshold) / (fadeEnd - dissolveThreshold);
28093
+ } else alpha = normalizedDist < dissolveThreshold ? 0 : 1;
28094
+ const index = 4 * (y * width + x);
28095
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
28096
+ }
28097
+ return new ImageData(result, width, height);
28098
+ }
28099
+ applyRadialDissolve(imageData, progress) {
28100
+ const {
28101
+ data: data,
28102
+ width: width,
28103
+ height: height
28104
+ } = imageData,
28105
+ result = new Uint8ClampedArray(data.length);
28106
+ result.set(data);
28107
+ const centerX = width / 2,
28108
+ centerY = height / 2,
28109
+ pixelSize = this.dissolveConfig.noiseScale;
28110
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
28111
+ const dx = x - centerX,
28112
+ dy = y - centerY,
28113
+ normalizedAngle = (Math.atan2(dy, dx) + Math.PI) / (2 * Math.PI);
28114
+ let dissolveThreshold = 1.2 * progress,
28115
+ alpha = 1;
28116
+ if (pixelSize > 0) {
28117
+ dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedAngle < dissolveThreshold ? 0 : 1;
28118
+ } else if (this.dissolveConfig.fadeEdge) {
28119
+ const fadeEnd = dissolveThreshold + .08;
28120
+ alpha = normalizedAngle < dissolveThreshold ? 0 : normalizedAngle > fadeEnd ? 1 : (normalizedAngle - dissolveThreshold) / (fadeEnd - dissolveThreshold);
28121
+ } else alpha = normalizedAngle < dissolveThreshold ? 0 : 1;
28122
+ const index = 4 * (y * width + x);
28123
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
28124
+ }
28125
+ return new ImageData(result, width, height);
28126
+ }
28127
+ applyLeftToRightDissolve(imageData, progress) {
28128
+ const {
28129
+ data: data,
28130
+ width: width,
28131
+ height: height
28132
+ } = imageData,
28133
+ result = new Uint8ClampedArray(data.length);
28134
+ result.set(data);
28135
+ const pixelSize = this.dissolveConfig.noiseScale;
28136
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
28137
+ const normalizedX = x / width;
28138
+ let dissolveThreshold = 1.2 * progress,
28139
+ alpha = 1;
28140
+ if (pixelSize > 0) {
28141
+ dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedX < dissolveThreshold ? 0 : 1;
28142
+ } else if (this.dissolveConfig.fadeEdge) {
28143
+ const fadeEnd = dissolveThreshold + .08;
28144
+ alpha = normalizedX < dissolveThreshold ? 0 : normalizedX > fadeEnd ? 1 : (normalizedX - dissolveThreshold) / (fadeEnd - dissolveThreshold);
28145
+ } else alpha = normalizedX < dissolveThreshold ? 0 : 1;
28146
+ const index = 4 * (y * width + x);
28147
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
28148
+ }
28149
+ return new ImageData(result, width, height);
28150
+ }
28151
+ applyRightToLeftDissolve(imageData, progress) {
28152
+ const {
28153
+ data: data,
28154
+ width: width,
28155
+ height: height
28156
+ } = imageData,
28157
+ result = new Uint8ClampedArray(data.length);
28158
+ result.set(data);
28159
+ const pixelSize = this.dissolveConfig.noiseScale;
28160
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
28161
+ const normalizedX = x / width;
28162
+ let dissolveThreshold = 1 - 1.2 * progress,
28163
+ alpha = 1;
28164
+ if (pixelSize > 0) {
28165
+ dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedX > dissolveThreshold ? 0 : 1;
28166
+ } else if (this.dissolveConfig.fadeEdge) {
28167
+ const fadeStart = dissolveThreshold - .08;
28168
+ alpha = normalizedX < fadeStart ? 1 : normalizedX > dissolveThreshold ? 0 : 1 - (normalizedX - fadeStart) / (dissolveThreshold - fadeStart);
28169
+ } else alpha = normalizedX > dissolveThreshold ? 0 : 1;
28170
+ const index = 4 * (y * width + x);
28171
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
28172
+ }
28173
+ return new ImageData(result, width, height);
28174
+ }
28175
+ applyTopToBottomDissolve(imageData, progress) {
28176
+ const {
28177
+ data: data,
28178
+ width: width,
28179
+ height: height
28180
+ } = imageData,
28181
+ result = new Uint8ClampedArray(data.length);
28182
+ result.set(data);
28183
+ const pixelSize = this.dissolveConfig.noiseScale;
28184
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
28185
+ const normalizedY = y / height;
28186
+ let dissolveThreshold = 1.2 * progress,
28187
+ alpha = 1;
28188
+ if (pixelSize > 0) {
28189
+ dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedY < dissolveThreshold ? 0 : 1;
28190
+ } else if (this.dissolveConfig.fadeEdge) {
28191
+ const fadeEnd = dissolveThreshold + .08;
28192
+ alpha = normalizedY < dissolveThreshold ? 0 : normalizedY > fadeEnd ? 1 : (normalizedY - dissolveThreshold) / (fadeEnd - dissolveThreshold);
28193
+ } else alpha = normalizedY < dissolveThreshold ? 0 : 1;
28194
+ const index = 4 * (y * width + x);
28195
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
28196
+ }
28197
+ return new ImageData(result, width, height);
28198
+ }
28199
+ applyBottomToTopDissolve(imageData, progress) {
28200
+ const {
28201
+ data: data,
28202
+ width: width,
28203
+ height: height
28204
+ } = imageData,
28205
+ result = new Uint8ClampedArray(data.length);
28206
+ result.set(data);
28207
+ const pixelSize = this.dissolveConfig.noiseScale;
28208
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
28209
+ const normalizedY = y / height;
28210
+ let dissolveThreshold = 1 - 1.2 * progress,
28211
+ alpha = 1;
28212
+ if (pixelSize > 0) {
28213
+ dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedY > dissolveThreshold ? 0 : 1;
28214
+ } else if (this.dissolveConfig.fadeEdge) {
28215
+ const fadeStart = dissolveThreshold - .08;
28216
+ alpha = normalizedY < fadeStart ? 1 : normalizedY > dissolveThreshold ? 0 : 1 - (normalizedY - fadeStart) / (dissolveThreshold - fadeStart);
28217
+ } else alpha = normalizedY > dissolveThreshold ? 0 : 1;
28218
+ const index = 4 * (y * width + x);
28219
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
28220
+ }
28221
+ return new ImageData(result, width, height);
28222
+ }
28223
+ }
28224
+
28225
+ class Grayscale extends HybridEffectBase {
28226
+ constructor(from, to, duration, easing, params) {
28227
+ var _a, _b, _c;
28228
+ super(from, to, duration, easing, params);
28229
+ const rawStrength = void 0 !== (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.strength) ? params.options.strength : 1,
28230
+ clampedStrength = Math.max(0, Math.min(1, rawStrength));
28231
+ this.colorConfig = {
28232
+ effectType: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.effectType) || "grayscale",
28233
+ strength: clampedStrength,
28234
+ useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL
28235
+ };
28236
+ }
28237
+ getShaderSources() {
28238
+ return {
28239
+ vertex: ShaderLibrary.STANDARD_VERTEX_SHADER,
28240
+ fragment: `\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_effectType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n ${ShaderLibrary.SHADER_FUNCTIONS}\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 originalColor = texture2D(u_texture, uv);\n vec3 color = originalColor.rgb;\n\n // 计算动态强度\n float dynamicStrength = calculateDynamicStrength(u_strength, u_time);\n\n if (u_effectType == 0) {\n // 灰度效果\n float gray = luminance(color);\n vec3 grayColor = vec3(gray);\n color = mix(color, grayColor, dynamicStrength);\n } else if (u_effectType == 1) {\n // 褐色调效果\n vec3 sepiaColor = sepia(color);\n color = mix(color, sepiaColor, dynamicStrength);\n }\n\n gl_FragColor = vec4(color, originalColor.a);\n }\n `
28241
+ };
28242
+ }
28243
+ applyWebGLEffect(canvas) {
28244
+ if (!this.gl || !this.program || !this.webglCanvas) return null;
28245
+ this.setupWebGLState(canvas);
28246
+ const texture = this.createTextureFromCanvas(canvas);
28247
+ if (!texture) return null;
28248
+ const vertexBuffer = this.createFullScreenQuad();
28249
+ if (!vertexBuffer) return this.gl.deleteTexture(texture), null;
28250
+ try {
28251
+ return this.gl.useProgram(this.program), this.setupVertexAttributes(), this.setColorUniforms(), this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4), this.webglCanvas;
28252
+ } finally {
28253
+ this.gl.deleteTexture(texture), this.gl.deleteBuffer(vertexBuffer);
28254
+ }
28255
+ }
28256
+ setColorUniforms() {
28257
+ if (!this.gl || !this.program) return;
28258
+ const currentTime = this.getAnimationTime(),
28259
+ timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
28260
+ strengthLocation = this.gl.getUniformLocation(this.program, "u_strength"),
28261
+ effectTypeLocation = this.gl.getUniformLocation(this.program, "u_effectType"),
28262
+ resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution");
28263
+ this.gl.uniform1f(timeLocation, currentTime), this.gl.uniform1f(strengthLocation, this.colorConfig.strength), this.gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height);
28264
+ this.gl.uniform1i(effectTypeLocation, {
28265
+ grayscale: 0,
28266
+ sepia: 1
28267
+ }[this.colorConfig.effectType] || 0);
28268
+ }
28269
+ applyCanvas2DEffect(canvas) {
28270
+ if (this.colorConfig.strength <= 0) {
28271
+ const outputCanvas = this.createOutputCanvas(canvas);
28272
+ return outputCanvas ? outputCanvas.canvas : null;
28273
+ }
28274
+ if (this.canUseCSSFilter()) return this.applyCSSFilter(canvas);
28275
+ const outputCanvas = this.createOutputCanvas(canvas);
28276
+ if (!outputCanvas) return null;
28277
+ const {
28278
+ ctx: ctx
28279
+ } = outputCanvas;
28280
+ try {
28281
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
28282
+ currentTime = this.getAnimationTime();
28283
+ let processedImageData;
28284
+ switch (this.colorConfig.effectType) {
28285
+ case "grayscale":
28286
+ default:
28287
+ processedImageData = this.applyGrayscaleEffect(imageData, this.colorConfig.strength, currentTime);
28288
+ break;
28289
+ case "sepia":
28290
+ processedImageData = this.applySepiaEffect(imageData, this.colorConfig.strength, currentTime);
28291
+ }
28292
+ return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(processedImageData, 0, 0), outputCanvas.canvas;
28293
+ } catch (error) {
28294
+ return null;
28295
+ }
28296
+ }
28297
+ canUseCSSFilter() {
28298
+ var _a;
28299
+ return !!window.useFilterAPI && "undefined" != typeof CSS && (null === (_a = CSS.supports) || void 0 === _a ? void 0 : _a.call(CSS, "filter", "grayscale(1)"));
28300
+ }
28301
+ applyCSSFilter(canvas) {
28302
+ try {
28303
+ const outputCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height),
28304
+ ctx = outputCanvas.getContext("2d");
28305
+ if (!ctx) return null;
28306
+ const currentTime = this.getAnimationTime(),
28307
+ dynamicStrength = ImageProcessUtils.calculateDynamicStrength(this.colorConfig.strength, currentTime);
28308
+ let filterValue = "";
28309
+ return "grayscale" === this.colorConfig.effectType ? filterValue = `grayscale(${Math.min(1, dynamicStrength)})` : "sepia" === this.colorConfig.effectType && (filterValue = `sepia(${Math.min(1, dynamicStrength)})`), ctx.filter = filterValue, ctx.drawImage(canvas, 0, 0), ctx.filter = "none", outputCanvas;
28310
+ } catch (error) {
28311
+ return null;
28312
+ }
28313
+ }
28314
+ applyGrayscaleEffect(imageData, strength, time) {
28315
+ const {
28316
+ data: data,
28317
+ width: width,
28318
+ height: height
28319
+ } = imageData,
28320
+ result = new Uint8ClampedArray(data.length),
28321
+ dynamicStrength = ImageProcessUtils.calculateDynamicStrength(strength, time);
28322
+ for (let i = 0; i < data.length; i += 4) {
28323
+ const r = data[i],
28324
+ g = data[i + 1],
28325
+ b = data[i + 2],
28326
+ a = data[i + 3],
28327
+ gray = ImageProcessUtils.getLuminance(r, g, b);
28328
+ result[i] = Math.round(ImageProcessUtils.lerp(r, gray, dynamicStrength)), result[i + 1] = Math.round(ImageProcessUtils.lerp(g, gray, dynamicStrength)), result[i + 2] = Math.round(ImageProcessUtils.lerp(b, gray, dynamicStrength)), result[i + 3] = a;
28329
+ }
28330
+ return new ImageData(result, width, height);
28331
+ }
28332
+ applySepiaEffect(imageData, strength, time) {
28333
+ const {
28334
+ data: data,
28335
+ width: width,
28336
+ height: height
28337
+ } = imageData,
28338
+ result = new Uint8ClampedArray(data.length),
28339
+ dynamicStrength = ImageProcessUtils.calculateDynamicStrength(strength, time);
28340
+ for (let i = 0; i < data.length; i += 4) {
28341
+ const r = data[i],
28342
+ g = data[i + 1],
28343
+ b = data[i + 2],
28344
+ a = data[i + 3],
28345
+ [sepiaR, sepiaG, sepiaB] = ImageProcessUtils.applySepiaToPixel(r, g, b);
28346
+ result[i] = Math.round(ImageProcessUtils.lerp(r, sepiaR, dynamicStrength)), result[i + 1] = Math.round(ImageProcessUtils.lerp(g, sepiaG, dynamicStrength)), result[i + 2] = Math.round(ImageProcessUtils.lerp(b, sepiaB, dynamicStrength)), result[i + 3] = a;
28347
+ }
28348
+ return new ImageData(result, width, height);
28349
+ }
28350
+ afterStageRender(stage, canvas) {
28351
+ if (this.canUseCSSFilter() && this.colorConfig.strength > 0) {
28352
+ const cssResult = this.applyCSSFilter(canvas);
28353
+ if (cssResult) return cssResult;
28354
+ }
28355
+ return super.afterStageRender(stage, canvas);
28356
+ }
28357
+ }
28358
+
28359
+ class Distortion extends HybridEffectBase {
28360
+ constructor(from, to, duration, easing, params) {
28361
+ var _a, _b, _c;
28362
+ super(from, to, duration, easing, params), this.distortionConfig = {
28363
+ distortionType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.distortionType) || "wave",
28364
+ strength: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.strength) || .3,
28365
+ useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL
28366
+ };
28367
+ }
28368
+ getShaderSources() {
28369
+ return {
28370
+ vertex: "\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",
28371
+ fragment: "\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "
28372
+ };
28373
+ }
28374
+ applyWebGLEffect(canvas) {
28375
+ if (!this.gl || !this.program || !this.webglCanvas) return null;
28376
+ this.setupWebGLState(canvas);
28377
+ const texture = this.createTextureFromCanvas(canvas);
28378
+ if (!texture) return null;
28379
+ const vertexBuffer = this.createFullScreenQuad();
28380
+ if (!vertexBuffer) return this.gl.deleteTexture(texture), null;
28381
+ try {
28382
+ return this.gl.useProgram(this.program), this.setupVertexAttributes(), this.setDistortionUniforms(), this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4), this.webglCanvas;
28383
+ } finally {
28384
+ this.gl.deleteTexture(texture), this.gl.deleteBuffer(vertexBuffer);
28385
+ }
28386
+ }
28387
+ setDistortionUniforms() {
28388
+ if (!this.gl || !this.program) return;
28389
+ const currentTime = this.getAnimationTime(),
28390
+ timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
28391
+ strengthLocation = this.gl.getUniformLocation(this.program, "u_strength"),
28392
+ distortionTypeLocation = this.gl.getUniformLocation(this.program, "u_distortionType"),
28393
+ resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution");
28394
+ this.gl.uniform1f(timeLocation, currentTime), this.gl.uniform1f(strengthLocation, this.distortionConfig.strength), this.gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height);
28395
+ this.gl.uniform1i(distortionTypeLocation, {
28396
+ wave: 0,
28397
+ ripple: 1,
28398
+ swirl: 2
28399
+ }[this.distortionConfig.distortionType] || 0);
28400
+ }
28401
+ applyCanvas2DEffect(canvas) {
28402
+ const outputCanvas = this.createOutputCanvas(canvas);
28403
+ if (!outputCanvas) return null;
28404
+ const {
28405
+ ctx: ctx
28406
+ } = outputCanvas;
28407
+ try {
28408
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
28409
+ currentTime = this.getAnimationTime();
28410
+ let distortedImageData;
28411
+ switch (this.distortionConfig.distortionType) {
28412
+ case "wave":
28413
+ distortedImageData = this.applyWaveDistortion(imageData, this.distortionConfig.strength, currentTime);
28414
+ break;
28415
+ case "ripple":
28416
+ distortedImageData = this.applyRippleDistortion(imageData, this.distortionConfig.strength, currentTime);
28417
+ break;
28418
+ case "swirl":
28419
+ distortedImageData = this.applySwirlDistortion(imageData, this.distortionConfig.strength, currentTime);
28420
+ break;
28421
+ default:
28422
+ distortedImageData = imageData;
28423
+ }
28424
+ return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(distortedImageData, 0, 0), outputCanvas.canvas;
28425
+ } catch (error) {
28426
+ return null;
28427
+ }
28428
+ }
28429
+ applyWaveDistortion(imageData, strength, time) {
28430
+ const {
28431
+ data: data,
28432
+ width: width,
28433
+ height: height
28434
+ } = imageData,
28435
+ result = new Uint8ClampedArray(data.length);
28436
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
28437
+ const waveX = Math.sin(.1 * y + 3 * time) * strength * 20,
28438
+ waveY = Math.sin(.1 * x + 2 * time) * strength * 20,
28439
+ sourceX = Math.round(x - waveX),
28440
+ sourceY = Math.round(y - waveY),
28441
+ targetIndex = 4 * (y * width + x);
28442
+ if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
28443
+ const sourceIndex = 4 * (sourceY * width + sourceX);
28444
+ result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
28445
+ } else result[targetIndex + 3] = 0;
28446
+ }
28447
+ return new ImageData(result, width, height);
28448
+ }
28449
+ applyRippleDistortion(imageData, strength, time) {
28450
+ const {
28451
+ data: data,
28452
+ width: width,
28453
+ height: height
28454
+ } = imageData,
28455
+ result = new Uint8ClampedArray(data.length),
28456
+ centerX = width / 2,
28457
+ centerY = height / 2;
28458
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
28459
+ const dx = x - centerX,
28460
+ dy = y - centerY,
28461
+ distance = Math.sqrt(dx * dx + dy * dy),
28462
+ ripple = Math.sin(.2 * distance - 5 * time) * strength * 10,
28463
+ angle = Math.atan2(dy, dx),
28464
+ sourceX = Math.round(x - Math.cos(angle) * ripple),
28465
+ sourceY = Math.round(y - Math.sin(angle) * ripple),
28466
+ targetIndex = 4 * (y * width + x);
28467
+ if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
28468
+ const sourceIndex = 4 * (sourceY * width + sourceX);
28469
+ result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
28470
+ } else result[targetIndex + 3] = 0;
28471
+ }
28472
+ return new ImageData(result, width, height);
28473
+ }
28474
+ applySwirlDistortion(imageData, strength, time) {
28475
+ const {
28476
+ data: data,
28477
+ width: width,
28478
+ height: height
28479
+ } = imageData,
28480
+ result = new Uint8ClampedArray(data.length),
28481
+ centerX = width / 2,
28482
+ centerY = height / 2;
28483
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
28484
+ const dx = x - centerX,
28485
+ dy = y - centerY,
28486
+ distance = Math.sqrt(dx * dx + dy * dy),
28487
+ finalAngle = Math.atan2(dy, dx) + distance * strength * time * .02,
28488
+ sourceX = Math.round(centerX + distance * Math.cos(finalAngle)),
28489
+ sourceY = Math.round(centerY + distance * Math.sin(finalAngle)),
28490
+ targetIndex = 4 * (y * width + x);
28491
+ if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
28492
+ const sourceIndex = 4 * (sourceY * width + sourceX);
28493
+ result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
28494
+ } else result[targetIndex + 3] = 0;
28495
+ }
28496
+ return new ImageData(result, width, height);
28497
+ }
28498
+ afterStageRender(stage, canvas) {
28499
+ return this.distortionConfig.strength <= 0 ? canvas : super.afterStageRender(stage, canvas);
28500
+ }
28501
+ }
28502
+
28503
+ class Particle extends HybridEffectBase {
28504
+ constructor(from, to, duration, easing, params) {
28505
+ var _a, _b, _c, _d, _e;
28506
+ super(from, to, duration, easing, params), this.particles = [], this.positionBuffer = null, this.colorBuffer = null, this.particleConfig = {
28507
+ effectType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.effectType) || "gravity",
28508
+ count: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.count) || 4e3,
28509
+ size: (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.size) || 20,
28510
+ strength: (null === (_d = null == params ? void 0 : params.options) || void 0 === _d ? void 0 : _d.strength) || 1.5,
28511
+ useWebGL: void 0 === (null === (_e = null == params ? void 0 : params.options) || void 0 === _e ? void 0 : _e.useWebGL) || params.options.useWebGL
28512
+ };
28513
+ }
28514
+ getShaderSources() {
28515
+ return {
28516
+ vertex: "\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",
28517
+ fragment: "\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "
28518
+ };
28519
+ }
28520
+ applyWebGLEffect(canvas) {
28521
+ if (!this.gl || !this.program || !this.webglCanvas) return null;
28522
+ this.setupWebGLState(canvas), 0 === this.particles.length && this.extractParticles(canvas), this.updateParticles(canvas);
28523
+ const gl = this.gl;
28524
+ return gl.enable(gl.BLEND), gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA), gl.useProgram(this.program), this.prepareAndDrawParticles(gl), this.webglCanvas;
28525
+ }
28526
+ applyCanvas2DEffect(canvas) {
28527
+ const output = this.createOutputCanvas(canvas);
28528
+ if (!output) return null;
28529
+ const {
28530
+ canvas: outputCanvas,
28531
+ ctx: ctx
28532
+ } = output,
28533
+ progress = this.currentAnimationRatio;
28534
+ switch (this.particleConfig.effectType) {
28535
+ case "explode":
28536
+ this.applyCanvas2DExplode(ctx, canvas, progress);
28537
+ break;
28538
+ case "gravity":
28539
+ this.applyCanvas2DGravity(ctx, canvas, progress);
28540
+ break;
28541
+ case "vortex":
28542
+ this.applyCanvas2DVortex(ctx, canvas, progress);
28543
+ break;
28544
+ default:
28545
+ ctx.globalAlpha = Math.max(0, 1 - progress), ctx.drawImage(canvas, 0, 0);
28546
+ }
28547
+ return outputCanvas;
28548
+ }
28549
+ extractParticles(canvas) {
28550
+ const tempCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height, 1),
28551
+ tempCtx = tempCanvas.getContext("2d");
28552
+ if (!tempCtx) return;
28553
+ tempCtx.drawImage(canvas, 0, 0, tempCanvas.width, tempCanvas.height);
28554
+ const data = tempCtx.getImageData(0, 0, tempCanvas.width, tempCanvas.height).data;
28555
+ this.particles = [];
28556
+ const step = Math.max(1, Math.floor(Math.sqrt(tempCanvas.width * tempCanvas.height / (1.5 * this.particleConfig.count))));
28557
+ for (let y = 0; y < tempCanvas.height; y += step) for (let x = 0; x < tempCanvas.width; x += step) {
28558
+ const index = 4 * (y * tempCanvas.width + x),
28559
+ r = data[index],
28560
+ g = data[index + 1],
28561
+ b = data[index + 2],
28562
+ a = data[index + 3];
28563
+ if (a > 5) {
28564
+ const realX = x / tempCanvas.width * canvas.width,
28565
+ realY = y / tempCanvas.height * canvas.height,
28566
+ particle = {
28567
+ x: realX,
28568
+ y: realY,
28569
+ originX: realX,
28570
+ originY: realY,
28571
+ vx: 0,
28572
+ vy: 0,
28573
+ r: r / 255,
28574
+ g: g / 255,
28575
+ b: b / 255,
28576
+ a: Math.max(.6, a / 255),
28577
+ life: 1,
28578
+ size: this.particleConfig.size * (1 + .5 * Math.random())
28579
+ };
28580
+ this.particles.push(particle);
28581
+ }
28582
+ }
28583
+ }
28584
+ updateParticles(canvas) {
28585
+ const centerX = canvas.width / 2,
28586
+ centerY = canvas.height / 2,
28587
+ progress = this.currentAnimationRatio,
28588
+ duration = this.getDurationFromParent(),
28589
+ isShortAnimation = duration < 2e3,
28590
+ timeMultiplier = isShortAnimation ? Math.max(1.5, 3e3 / duration) : 1,
28591
+ intensityBoost = isShortAnimation ? Math.min(2, 2e3 / duration) : 1;
28592
+ this.particles.forEach(particle => {
28593
+ const dx = particle.x - centerX,
28594
+ dy = particle.y - centerY,
28595
+ distance = Math.sqrt(dx * dx + dy * dy),
28596
+ angle = Math.atan2(dy, dx);
28597
+ this.applyParticleForces(particle, angle, distance, progress, intensityBoost, canvas), this.updateParticleProperties(particle, progress, isShortAnimation, timeMultiplier, intensityBoost);
28598
+ });
28599
+ }
28600
+ applyParticleForces(particle, angle, distance, progress, intensityBoost, canvas) {
28601
+ const time = this.getAnimationTime();
28602
+ switch (this.particleConfig.effectType) {
28603
+ case "explode":
28604
+ const explodeIntensity = progress * this.particleConfig.strength * intensityBoost * 5;
28605
+ particle.vx += Math.cos(angle) * explodeIntensity, particle.vy += Math.sin(angle) * explodeIntensity;
28606
+ break;
28607
+ case "gravity":
28608
+ this.applyGravityEffect(particle, progress, intensityBoost, canvas, time);
28609
+ break;
28610
+ case "vortex":
28611
+ this.applyVortexEffect(particle, progress, intensityBoost, canvas, angle, distance);
28612
+ }
28613
+ }
28614
+ applyGravityEffect(particle, progress, intensityBoost, canvas, time) {
28615
+ const gravityThreshold = (particle.originX + .7 * particle.originY) / (canvas.width + canvas.height) * .8;
28616
+ if (progress > gravityThreshold) {
28617
+ const gravityProgress = (progress - gravityThreshold) / (1 - gravityThreshold),
28618
+ gravityForce = this.particleConfig.strength * gravityProgress * gravityProgress * 12 * intensityBoost;
28619
+ particle.vy += gravityForce;
28620
+ const turbulence = Math.sin(3 * time + .02 * particle.originX) * Math.cos(2 * time + .015 * particle.originY);
28621
+ particle.vx += turbulence * this.particleConfig.strength * 2 * intensityBoost;
28622
+ }
28623
+ }
28624
+ applyVortexEffect(particle, progress, intensityBoost, canvas, angle, distance) {
28625
+ const centerX = canvas.width / 2,
28626
+ centerY = canvas.height / 2,
28627
+ spiralAngle = angle + progress * Math.PI * .8,
28628
+ targetRadius = distance + progress * Math.max(canvas.width, canvas.height) * .7 * 1.8,
28629
+ targetX = centerX + Math.cos(spiralAngle) * targetRadius,
28630
+ targetY = centerY + Math.sin(spiralAngle) * targetRadius,
28631
+ baseForce = progress * this.particleConfig.strength * .08 * intensityBoost;
28632
+ particle.vx += (targetX - particle.x) * baseForce, particle.vy += (targetY - particle.y) * baseForce;
28633
+ }
28634
+ updateParticleProperties(particle, progress, isShortAnimation, timeMultiplier, intensityBoost) {
28635
+ const dragCoeff = isShortAnimation ? .99 : .98;
28636
+ if (particle.vx *= dragCoeff, particle.vy *= dragCoeff, particle.x += particle.vx, particle.y += particle.vy, isShortAnimation) {
28637
+ const lifeDecayRate = Math.max(.1, .5 / timeMultiplier);
28638
+ particle.life = Math.max(0, 1 - progress * lifeDecayRate), particle.a = Math.max(.2, particle.life * Math.min(1, 1.2 * particle.a)), particle.size = Math.max(.7 * this.particleConfig.size, this.particleConfig.size * (.5 + .5 * particle.life));
28639
+ } else particle.life = Math.max(0, 1 - .2 * progress), particle.a = Math.max(.1, particle.life * Math.min(1, 1.5 * particle.a)), particle.size = Math.max(.5 * this.particleConfig.size, this.particleConfig.size * (.3 + .7 * particle.life));
28640
+ }
28641
+ prepareAndDrawParticles(gl) {
28642
+ const positions = new Float32Array(2 * this.particles.length),
28643
+ colors = new Float32Array(4 * this.particles.length),
28644
+ sizes = new Float32Array(this.particles.length);
28645
+ this.particles.forEach((particle, i) => {
28646
+ positions[2 * i] = particle.x, positions[2 * i + 1] = particle.y, colors[4 * i] = particle.r, colors[4 * i + 1] = particle.g, colors[4 * i + 2] = particle.b, colors[4 * i + 3] = Math.max(.1, particle.a), sizes[i] = Math.max(6, 1.5 * particle.size);
28647
+ }), this.updateParticleBuffers(gl, positions, colors, sizes), this.setParticleUniforms(gl), gl.drawArrays(gl.POINTS, 0, this.particles.length), this.cleanupTempBuffers(gl);
28648
+ }
28649
+ updateParticleBuffers(gl, positions, colors, sizes) {
28650
+ this.positionBuffer || (this.positionBuffer = gl.createBuffer()), gl.bindBuffer(gl.ARRAY_BUFFER, this.positionBuffer), gl.bufferData(gl.ARRAY_BUFFER, positions, gl.DYNAMIC_DRAW);
28651
+ const positionLocation = gl.getAttribLocation(this.program, "a_position");
28652
+ gl.enableVertexAttribArray(positionLocation), gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, !1, 0, 0), this.colorBuffer || (this.colorBuffer = gl.createBuffer()), gl.bindBuffer(gl.ARRAY_BUFFER, this.colorBuffer), gl.bufferData(gl.ARRAY_BUFFER, colors, gl.DYNAMIC_DRAW);
28653
+ const colorLocation = gl.getAttribLocation(this.program, "a_color");
28654
+ gl.enableVertexAttribArray(colorLocation), gl.vertexAttribPointer(colorLocation, 4, gl.FLOAT, !1, 0, 0);
28655
+ const sizeBuffer = gl.createBuffer();
28656
+ gl.bindBuffer(gl.ARRAY_BUFFER, sizeBuffer), gl.bufferData(gl.ARRAY_BUFFER, sizes, gl.DYNAMIC_DRAW);
28657
+ const sizeLocation = gl.getAttribLocation(this.program, "a_size");
28658
+ gl.enableVertexAttribArray(sizeLocation), gl.vertexAttribPointer(sizeLocation, 1, gl.FLOAT, !1, 0, 0), this._tempSizeBuffer = sizeBuffer;
28659
+ }
28660
+ setParticleUniforms(gl) {
28661
+ const resolutionLocation = gl.getUniformLocation(this.program, "u_resolution"),
28662
+ timeLocation = gl.getUniformLocation(this.program, "u_time"),
28663
+ forceStrengthLocation = gl.getUniformLocation(this.program, "u_forceStrength"),
28664
+ effectTypeLocation = gl.getUniformLocation(this.program, "u_effectType");
28665
+ gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height), gl.uniform1f(timeLocation, this.getAnimationTime()), gl.uniform1f(forceStrengthLocation, this.particleConfig.strength);
28666
+ gl.uniform1i(effectTypeLocation, {
28667
+ explode: 0,
28668
+ vortex: 1,
28669
+ gravity: 2
28670
+ }[this.particleConfig.effectType] || 0);
28671
+ }
28672
+ cleanupTempBuffers(gl) {
28673
+ const tempSizeBuffer = this._tempSizeBuffer;
28674
+ tempSizeBuffer && (gl.deleteBuffer(tempSizeBuffer), delete this._tempSizeBuffer);
28675
+ }
28676
+ applyCanvas2DExplode(ctx, canvas, progress) {
28677
+ const centerX = canvas.width / 2,
28678
+ centerY = canvas.height / 2;
28679
+ ctx.save(), ctx.globalAlpha = Math.max(0, 1 - progress), ctx.translate(centerX, centerY);
28680
+ const scale = 1 + .5 * progress;
28681
+ ctx.scale(scale, scale), ctx.translate(-centerX, -centerY), ctx.drawImage(canvas, 0, 0), ctx.restore();
28682
+ }
28683
+ applyCanvas2DGravity(ctx, canvas, progress) {
28684
+ ctx.save(), ctx.globalAlpha = Math.max(0, 1 - progress);
28685
+ const offsetY = progress * canvas.height * .3;
28686
+ ctx.drawImage(canvas, 0, offsetY), ctx.restore();
28687
+ }
28688
+ applyCanvas2DVortex(ctx, canvas, progress) {
28689
+ const centerX = canvas.width / 2,
28690
+ centerY = canvas.height / 2;
28691
+ ctx.save(), ctx.globalAlpha = Math.max(0, 1 - progress), ctx.translate(centerX, centerY), ctx.rotate(progress * Math.PI * 2), ctx.translate(-centerX, -centerY), ctx.drawImage(canvas, 0, 0), ctx.restore();
28692
+ }
28693
+ }
28694
+
28695
+ class Glitch extends Canvas2DEffectBase {
28696
+ constructor(from, to, duration, easing, params) {
28697
+ var _a, _b;
28698
+ super(from, to, duration, easing, params), this.glitchConfig = {
28699
+ effectType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.effectType) || "rgb-shift",
28700
+ intensity: void 0 !== (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.intensity) ? params.options.intensity : .5
28701
+ };
28702
+ }
28703
+ applyCanvas2DEffect(canvas) {
28704
+ if (this.glitchConfig.intensity <= 0) {
28705
+ const outputCanvas = this.createOutputCanvas(canvas);
28706
+ return outputCanvas ? outputCanvas.canvas : null;
28707
+ }
28708
+ try {
28709
+ switch (this.glitchConfig.effectType) {
28710
+ case "rgb-shift":
28711
+ default:
28712
+ return this.applyRGBShiftGlitch(canvas);
28713
+ case "digital-distortion":
28714
+ return this.applyDigitalDistortionGlitch(canvas);
28715
+ case "scan-lines":
28716
+ return this.applyScanLineGlitch(canvas);
28717
+ case "data-corruption":
28718
+ return this.applyDataCorruptionGlitch(canvas);
28719
+ }
28720
+ } catch (error) {
28721
+ return null;
28722
+ }
28723
+ }
28724
+ applyRGBShiftGlitch(canvas) {
28725
+ const outputCanvas = this.createOutputCanvas(canvas);
28726
+ if (!outputCanvas) return null;
28727
+ const {
28728
+ ctx: ctx
28729
+ } = outputCanvas;
28730
+ try {
28731
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
28732
+ const dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
28733
+ maxOffset = Math.floor(20 * dynamicIntensity),
28734
+ redOffset = this.generateRandomOffset(maxOffset),
28735
+ greenOffset = this.generateRandomOffset(maxOffset, .3),
28736
+ blueOffset = this.generateRandomOffset(-maxOffset),
28737
+ tempCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height),
28738
+ tempCtx = tempCanvas.getContext("2d");
28739
+ tempCtx.drawImage(canvas, 0, 0);
28740
+ const originalImageData = tempCtx.getImageData(0, 0, canvas.width, canvas.height),
28741
+ redChannelData = ImageProcessUtils.extractChannel(originalImageData, 0),
28742
+ greenChannelData = ImageProcessUtils.extractChannel(originalImageData, 1),
28743
+ blueChannelData = ImageProcessUtils.extractChannel(originalImageData, 2);
28744
+ return ctx.globalCompositeOperation = "screen", tempCtx.clearRect(0, 0, canvas.width, canvas.height), tempCtx.putImageData(redChannelData, 0, 0), ctx.drawImage(tempCanvas, redOffset.x, redOffset.y), tempCtx.clearRect(0, 0, canvas.width, canvas.height), tempCtx.putImageData(greenChannelData, 0, 0), ctx.drawImage(tempCanvas, greenOffset.x, greenOffset.y), tempCtx.clearRect(0, 0, canvas.width, canvas.height), tempCtx.putImageData(blueChannelData, 0, 0), ctx.drawImage(tempCanvas, blueOffset.x, blueOffset.y), ctx.globalCompositeOperation = "source-over", outputCanvas.canvas;
28745
+ } catch (error) {
28746
+ return null;
28747
+ }
28748
+ }
28749
+ applyDigitalDistortionGlitch(canvas) {
28750
+ const outputCanvas = this.createOutputCanvas(canvas);
28751
+ if (!outputCanvas) return null;
28752
+ const {
28753
+ ctx: ctx
28754
+ } = outputCanvas;
28755
+ try {
28756
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
28757
+ dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
28758
+ distortedImageData = this.processDigitalDistortion(imageData, dynamicIntensity);
28759
+ return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(distortedImageData, 0, 0), outputCanvas.canvas;
28760
+ } catch (error) {
28761
+ return null;
28762
+ }
28763
+ }
28764
+ applyScanLineGlitch(canvas) {
28765
+ const outputCanvas = this.createOutputCanvas(canvas);
28766
+ if (!outputCanvas) return null;
28767
+ const {
28768
+ ctx: ctx
28769
+ } = outputCanvas;
28770
+ try {
28771
+ const dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
28772
+ lineSpacing = Math.max(2, Math.floor(10 - 8 * dynamicIntensity));
28773
+ ctx.globalCompositeOperation = "multiply";
28774
+ for (let y = 0; y < canvas.height; y += lineSpacing) if (Math.random() < dynamicIntensity) {
28775
+ const opacity = .1 + .4 * dynamicIntensity;
28776
+ ctx.fillStyle = `rgba(0, 0, 0, ${opacity})`, ctx.fillRect(0, y, canvas.width, 1);
28777
+ }
28778
+ ctx.globalCompositeOperation = "screen";
28779
+ const brightLineCount = Math.floor(20 * dynamicIntensity);
28780
+ for (let i = 0; i < brightLineCount; i++) {
28781
+ const y = Math.random() * canvas.height,
28782
+ opacity = .3 * dynamicIntensity;
28783
+ ctx.fillStyle = `rgba(255, 255, 255, ${opacity})`, ctx.fillRect(0, Math.floor(y), canvas.width, 1);
28784
+ }
28785
+ return ctx.globalCompositeOperation = "source-over", outputCanvas.canvas;
28786
+ } catch (error) {
28787
+ return null;
28788
+ }
28789
+ }
28790
+ applyDataCorruptionGlitch(canvas) {
28791
+ const outputCanvas = this.createOutputCanvas(canvas);
28792
+ if (!outputCanvas) return null;
28793
+ const {
28794
+ ctx: ctx
28795
+ } = outputCanvas;
28796
+ try {
28797
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
28798
+ dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
28799
+ corruptedImageData = this.processDataCorruption(imageData, dynamicIntensity);
28800
+ return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(corruptedImageData, 0, 0), outputCanvas.canvas;
28801
+ } catch (error) {
28802
+ return null;
28803
+ }
28804
+ }
28805
+ generateRandomOffset(maxOffset, scale = 1) {
28806
+ return {
28807
+ x: (Math.random() - .5) * maxOffset,
28808
+ y: (Math.random() - .5) * maxOffset * scale
28809
+ };
28810
+ }
28811
+ processDigitalDistortion(imageData, intensity) {
28812
+ const {
28813
+ data: data,
28814
+ width: width,
28815
+ height: height
28816
+ } = imageData,
28817
+ result = new Uint8ClampedArray(data),
28818
+ sliceCount = Math.floor(20 * intensity) + 5,
28819
+ sliceHeight = Math.floor(height / sliceCount);
28820
+ for (let i = 0; i < sliceCount; i++) if (Math.random() < intensity) {
28821
+ const y = i * sliceHeight,
28822
+ sliceEnd = Math.min(y + sliceHeight, height),
28823
+ offset = Math.floor((Math.random() - .5) * width * intensity * .1);
28824
+ this.shiftSliceHorizontal(result, width, height, y, sliceEnd, offset);
28825
+ }
28826
+ const noiseIntensity = .3 * intensity;
28827
+ for (let i = 0; i < data.length; i += 4) Math.random() < noiseIntensity && (result[i] = 255 * Math.random(), result[i + 1] = 255 * Math.random(), result[i + 2] = 255 * Math.random());
28828
+ return new ImageData(result, width, height);
28829
+ }
28830
+ shiftSliceHorizontal(data, width, height, startY, endY, offset) {
28831
+ const tempRow = new Uint8ClampedArray(4 * width);
28832
+ for (let y = startY; y < endY; y++) {
28833
+ const rowStart = y * width * 4;
28834
+ for (let x = 0; x < 4 * width; x++) tempRow[x] = data[rowStart + x];
28835
+ for (let x = 0; x < width; x++) {
28836
+ const targetIndex = rowStart + 4 * x,
28837
+ sourceIndex = 4 * ((x - offset + width) % width);
28838
+ data[targetIndex] = tempRow[sourceIndex], data[targetIndex + 1] = tempRow[sourceIndex + 1], data[targetIndex + 2] = tempRow[sourceIndex + 2], data[targetIndex + 3] = tempRow[sourceIndex + 3];
28839
+ }
28840
+ }
28841
+ }
28842
+ processDataCorruption(imageData, intensity) {
28843
+ const {
28844
+ data: data,
28845
+ width: width,
28846
+ height: height
28847
+ } = imageData,
28848
+ result = new Uint8ClampedArray(data),
28849
+ stripeCount = Math.floor(15 * intensity) + 5;
28850
+ for (let i = 0; i < stripeCount; i++) if (Math.random() < intensity) {
28851
+ const x = Math.floor(Math.random() * width),
28852
+ stripeWidth = Math.floor(5 * Math.random()) + 1,
28853
+ color = Math.random() < .5 ? 0 : 255;
28854
+ for (let y = 0; y < height; y++) for (let dx = 0; dx < stripeWidth && x + dx < width; dx++) {
28855
+ const index = 4 * (y * width + x + dx);
28856
+ result[index] = color, result[index + 1] = color, result[index + 2] = color;
28857
+ }
28858
+ }
28859
+ const corruptionCount = Math.floor(20 * intensity);
28860
+ for (let i = 0; i < corruptionCount; i++) {
28861
+ const blockX = Math.floor(Math.random() * width),
28862
+ blockY = Math.floor(Math.random() * height),
28863
+ blockW = Math.floor(20 * Math.random()) + 5,
28864
+ blockH = Math.floor(10 * Math.random()) + 2;
28865
+ this.corruptBlock(result, width, height, blockX, blockY, blockW, blockH);
28866
+ }
28867
+ return new ImageData(result, width, height);
28868
+ }
28869
+ corruptBlock(data, width, height, x, y, w, h) {
28870
+ for (let dy = 0; dy < h && y + dy < height; dy++) for (let dx = 0; dx < w && x + dx < width; dx++) {
28871
+ const index = 4 * ((y + dy) * width + (x + dx));
28872
+ Math.random() < .7 && (data[index] = 255 * Math.random(), data[index + 1] = 255 * Math.random(), data[index + 2] = 255 * Math.random());
28873
+ }
28874
+ }
28875
+ }
28876
+
28877
+ class GaussianBlur extends AStageAnimate {
28878
+ constructor(from, to, duration, easing, params) {
28879
+ var _a, _b;
28880
+ super(from, to, duration, easing, params), this.blurConfig = {
28881
+ blurRadius: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.blurRadius) || 8,
28882
+ useOptimizedBlur: void 0 === (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.useOptimizedBlur) || params.options.useOptimizedBlur
28883
+ };
28884
+ }
28885
+ applyCSSBlur(canvas, radius) {
28886
+ const c = vglobal.createCanvas({
28887
+ width: canvas.width,
28888
+ height: canvas.height,
28889
+ dpr: vglobal.devicePixelRatio
28890
+ }),
28891
+ ctx = c.getContext("2d");
28892
+ return ctx ? (ctx.filter = `blur(${radius}px)`, ctx.drawImage(canvas, 0, 0), ctx.filter = "none", c) : canvas;
28893
+ }
28894
+ applyDownsampleBlur(imageData, radius) {
28895
+ const {
28896
+ width: width,
28897
+ height: height
28898
+ } = imageData,
28899
+ downsample = Math.max(1, Math.floor(radius / 2)),
28900
+ smallWidth = Math.floor(width / downsample),
28901
+ smallHeight = Math.floor(height / downsample),
28902
+ tempCanvas = vglobal.createCanvas({
28903
+ width: smallWidth,
28904
+ height: smallHeight,
28905
+ dpr: 1
28906
+ }),
28907
+ tempCtx = tempCanvas.getContext("2d");
28908
+ if (!tempCtx) return imageData;
28909
+ const originalCanvas = vglobal.createCanvas({
28910
+ width: width,
28911
+ height: height,
28912
+ dpr: 1
28913
+ }),
28914
+ originalCtx = originalCanvas.getContext("2d");
28915
+ return originalCtx ? (originalCtx.putImageData(imageData, 0, 0), tempCtx.drawImage(originalCanvas, 0, 0, smallWidth, smallHeight), tempCtx.filter = `blur(${radius / downsample}px)`, tempCtx.drawImage(tempCanvas, 0, 0), tempCtx.filter = "none", originalCtx.clearRect(0, 0, width, height), originalCtx.drawImage(tempCanvas, 0, 0, width, height), originalCtx.getImageData(0, 0, width, height)) : imageData;
28916
+ }
28917
+ afterStageRender(stage, canvas) {
28918
+ if (this.blurConfig.blurRadius <= 0) return canvas;
28919
+ let result;
28920
+ if (this.blurConfig.useOptimizedBlur) result = this.applyCSSBlur(canvas, this.blurConfig.blurRadius);else {
28921
+ const c = vglobal.createCanvas({
28922
+ width: canvas.width,
28923
+ height: canvas.height,
28924
+ dpr: vglobal.devicePixelRatio
28925
+ }),
28926
+ ctx = c.getContext("2d");
28927
+ if (!ctx) return !1;
28928
+ ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.drawImage(canvas, 0, 0);
28929
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
28930
+ blurredImageData = this.applyDownsampleBlur(imageData, this.blurConfig.blurRadius);
28931
+ ctx.putImageData(blurredImageData, 0, 0), result = c;
28932
+ }
28933
+ const ctx = result.getContext("2d");
28934
+ return ctx && (ctx.globalCompositeOperation = "overlay", ctx.fillStyle = "rgba(255, 255, 255, 0.1)", ctx.fillRect(0, 0, result.width, result.height), ctx.globalCompositeOperation = "source-over"), result;
28935
+ }
28936
+ }
28937
+
28938
+ class Pixelation extends DisappearAnimateBase {
28939
+ constructor(from, to, duration, easing, params) {
28940
+ var _a, _b;
28941
+ super(from, to, duration, easing, params), this.pixelationConfig = {
28942
+ maxPixelSize: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.maxPixelSize) || 20,
28943
+ method: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.method) || "out"
28944
+ };
28945
+ }
28946
+ applyDownsamplePixelation(canvas, pixelSize) {
28947
+ if (pixelSize <= 1) return canvas;
28948
+ const {
28949
+ width: width,
28950
+ height: height
28951
+ } = canvas,
28952
+ smallWidth = Math.ceil(width / pixelSize),
28953
+ smallHeight = Math.ceil(height / pixelSize),
28954
+ smallCanvas = vglobal.createCanvas({
28955
+ width: smallWidth,
28956
+ height: smallHeight,
28957
+ dpr: 1
28958
+ }),
28959
+ smallCtx = smallCanvas.getContext("2d");
28960
+ if (!smallCtx) return canvas;
28961
+ const outputCanvas = vglobal.createCanvas({
28962
+ width: width,
28963
+ height: height,
28964
+ dpr: vglobal.devicePixelRatio
28965
+ }),
28966
+ outputCtx = outputCanvas.getContext("2d");
28967
+ return outputCtx ? (smallCtx.imageSmoothingEnabled = !1, outputCtx.imageSmoothingEnabled = !1, smallCtx.drawImage(canvas, 0, 0, smallWidth, smallHeight), outputCtx.drawImage(smallCanvas, 0, 0, width, height), outputCanvas) : canvas;
28968
+ }
28969
+ updateAnimationProgress() {
28970
+ if ("in" === this.pixelationConfig.method) {
28971
+ return this.pixelationConfig.maxPixelSize - this.currentAnimationRatio * (this.pixelationConfig.maxPixelSize - 1);
28972
+ }
28973
+ return 1 + this.currentAnimationRatio * (this.pixelationConfig.maxPixelSize - 1);
28974
+ }
28975
+ afterStageRender(stage, canvas) {
28976
+ const currentPixelSize = this.updateAnimationProgress();
28977
+ if (currentPixelSize <= 1) return canvas;
28978
+ return this.applyDownsamplePixelation(canvas, currentPixelSize);
28979
+ }
28980
+ }
28981
+
27630
28982
  const registerCustomAnimate = () => {
27631
- AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight);
28983
+ AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight), AnimateExecutor.registerBuiltInAnimate("dissolve", Dissolve), AnimateExecutor.registerBuiltInAnimate("grayscale", Grayscale), AnimateExecutor.registerBuiltInAnimate("distortion", Distortion), AnimateExecutor.registerBuiltInAnimate("particle", Particle), AnimateExecutor.registerBuiltInAnimate("glitch", Glitch), AnimateExecutor.registerBuiltInAnimate("gaussianBlur", GaussianBlur), AnimateExecutor.registerBuiltInAnimate("pixelation", Pixelation);
27632
28984
  };
27633
28985
 
27634
28986
  class AxisEnter extends AComponentAnimate {
@@ -34442,6 +35794,25 @@
34442
35794
  function isZeroStyle(style) {
34443
35795
  return style === 0 || (isArray$7(style) && style.every(s => s === 0));
34444
35796
  }
35797
+ function setActiveCellRangeState(table) {
35798
+ const selectRanges = table.stateManager.select.ranges;
35799
+ const setRanges = [];
35800
+ for (let i = 0; i < selectRanges.length; i++) {
35801
+ const range = selectRanges[i];
35802
+ setRanges.push({
35803
+ range,
35804
+ style: {
35805
+ cellBorderColor: 'blue',
35806
+ cellBorderLineWidth: 2,
35807
+ cellBorderLineDash: [5, 5]
35808
+ }
35809
+ });
35810
+ }
35811
+ table.stateManager.setCustomSelectRanges(setRanges);
35812
+ }
35813
+ function clearActiveCellRangeState(table) {
35814
+ table.stateManager.setCustomSelectRanges([]);
35815
+ }
34445
35816
 
34446
35817
  const judgeType$1 = (value) => {
34447
35818
  switch (Object.prototype.toString.call(value)) {
@@ -34924,6 +36295,7 @@
34924
36295
  DROPDOWN_MENU_CLICK: 'dropdown_menu_click',
34925
36296
  MOUSEOVER_CHART_SYMBOL: 'mouseover_chart_symbol',
34926
36297
  DRAG_SELECT_END: 'drag_select_end',
36298
+ SELECTED_CHANGED: 'selected_changed',
34927
36299
  COPY_DATA: 'copy_data',
34928
36300
  DROPDOWN_ICON_CLICK: 'dropdown_icon_click',
34929
36301
  DROPDOWN_MENU_CLEAR: 'dropdown_menu_clear',
@@ -34942,8 +36314,10 @@
34942
36314
  SWITCH_STATE_CHANGE: 'switch_state_change',
34943
36315
  BEFORE_SET_SIZE: 'before_set_size',
34944
36316
  BEFORE_INIT: 'before_init',
36317
+ BEFORE_UPDATE_OPTION: 'before_update_option',
34945
36318
  AFTER_RENDER: 'after_render',
34946
36319
  INITIALIZED: 'initialized',
36320
+ UPDATED: 'updated',
34947
36321
  CHANGE_CELL_VALUE: 'change_cell_value',
34948
36322
  DRAG_FILL_HANDLE_END: 'drag_fill_handle_end',
34949
36323
  MOUSEDOWN_FILL_HANDLE: 'mousedown_fill_handle',
@@ -34952,7 +36326,8 @@
34952
36326
  EMPTY_TIP_DBLCLICK: 'empty_tip_dblclick',
34953
36327
  BUTTON_CLICK: 'button_click',
34954
36328
  BEFORE_CACHE_CHART_IMAGE: 'before_cache_chart_image',
34955
- PASTED_DATA: 'pasted_data'
36329
+ PASTED_DATA: 'pasted_data',
36330
+ PLUGIN_EVENT: 'plugin_event'
34956
36331
  };
34957
36332
 
34958
36333
  const judgeType = (value) => {
@@ -36642,7 +38017,7 @@
36642
38017
  return hasThemeProperty(obj, names) || hasThemeProperty(superTheme, names);
36643
38018
  }
36644
38019
  extends(obj) {
36645
- return new TableTheme(ingoreNoneValueMerge({}, obj), ingoreNoneValueMerge(this.internalTheme.superTheme, this.internalTheme.obj));
38020
+ return new TableTheme(ingoreNoneValueMerge({}, obj), ingoreNoneValueMerge({}, this.internalTheme.superTheme, this.internalTheme.obj));
36646
38021
  }
36647
38022
  getStyle(style) {
36648
38023
  const that = this;
@@ -37005,6 +38380,7 @@
37005
38380
  return isValid$3(mapIndex) ? mapIndex : index;
37006
38381
  }
37007
38382
  class DataSource extends EventTarget$1 {
38383
+ addRecordRule = 'Object';
37008
38384
  dataConfig;
37009
38385
  dataSourceObj;
37010
38386
  _get;
@@ -37029,6 +38405,7 @@
37029
38405
  lastFilterRules;
37030
38406
  constructor(dataSourceObj, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
37031
38407
  super();
38408
+ this.addRecordRule = dataConfig?.addRecordRule || 'Object';
37032
38409
  this.registerAggregators();
37033
38410
  this.dataSourceObj = dataSourceObj;
37034
38411
  this.dataConfig = dataConfig;
@@ -37177,6 +38554,9 @@
37177
38554
  if (isHasFilterRule || isHasAggregation) {
37178
38555
  for (let i = 0, len = records.length; i < len; i++) {
37179
38556
  const record = records[i];
38557
+ if (record === undefined || record === null) {
38558
+ continue;
38559
+ }
37180
38560
  if (this.dataConfig?.filterRules?.length >= 1) {
37181
38561
  if (this.filterRecord(record)) {
37182
38562
  filteredRecords.push(record);
@@ -37427,7 +38807,7 @@
37427
38807
  record[field] = formatValue;
37428
38808
  }
37429
38809
  else {
37430
- this.records[dataIndex] = {};
38810
+ this.records[dataIndex] = this.addRecordRule === 'Array' ? [] : {};
37431
38811
  this.records[dataIndex][field] = formatValue;
37432
38812
  }
37433
38813
  }
@@ -37684,10 +39064,30 @@
37684
39064
  }
37685
39065
  const sortedIndexArray = Array.from({ length: this._sourceLength }, (_, i) => i);
37686
39066
  sortedIndexArray.sort((indexA, indexB) => {
39067
+ const recordA = this.getOriginalRecord(indexA);
39068
+ const recordB = this.getOriginalRecord(indexB);
39069
+ const isEmptyA = recordA === null || recordA === undefined || (typeof recordA === 'object' && Object.keys(recordA).length === 0);
39070
+ const isEmptyB = recordB === null || recordB === undefined || (typeof recordB === 'object' && Object.keys(recordB).length === 0);
37687
39071
  return states.reduce((result, state) => {
37688
39072
  if (result !== 0) {
37689
39073
  return result;
37690
39074
  }
39075
+ if (state.order === 'asc' || state.order === 'desc') {
39076
+ if (isEmptyA && !isEmptyB) {
39077
+ return 1;
39078
+ }
39079
+ if (!isEmptyA && isEmptyB) {
39080
+ return -1;
39081
+ }
39082
+ if (isEmptyA && isEmptyB) {
39083
+ return indexA - indexB;
39084
+ }
39085
+ }
39086
+ else {
39087
+ if (isEmptyA || isEmptyB) {
39088
+ return indexA - indexB;
39089
+ }
39090
+ }
37691
39091
  const orderFn = state.orderFn ||
37692
39092
  (state.order !== 'desc'
37693
39093
  ? (v1, v2) => (v1 === v2 ? 0 : v1 > v2 ? 1 : -1)
@@ -42115,6 +43515,66 @@
42115
43515
  }
42116
43516
  return { x, y };
42117
43517
  }
43518
+ function calculateCellRangeDistribution(startCol, startRow, endCol, endRow, table) {
43519
+ let needRowHeader = false;
43520
+ let needRightRowHeader = false;
43521
+ let needColumnHeader = false;
43522
+ let needBottomColumnHeader = false;
43523
+ let needBody = false;
43524
+ let needCornerHeader = false;
43525
+ let needRightTopCornerHeader = false;
43526
+ let needRightBottomCornerHeader = false;
43527
+ let needLeftBottomCornerHeader = false;
43528
+ if (startCol <= table.frozenColCount - 1 && startRow <= table.frozenRowCount - 1) {
43529
+ needCornerHeader = true;
43530
+ }
43531
+ if (endCol >= table.colCount - table.rightFrozenColCount && startRow <= table.frozenRowCount - 1) {
43532
+ needRightTopCornerHeader = true;
43533
+ }
43534
+ if (startCol <= table.frozenColCount - 1 && endRow >= table.rowCount - table.bottomFrozenRowCount) {
43535
+ needLeftBottomCornerHeader = true;
43536
+ }
43537
+ if (endCol >= table.colCount - table.rightFrozenColCount && endRow >= table.rowCount - table.bottomFrozenRowCount) {
43538
+ needRightBottomCornerHeader = true;
43539
+ }
43540
+ if (startCol <= table.frozenColCount - 1 &&
43541
+ endRow >= table.frozenRowCount &&
43542
+ startRow <= table.rowCount - table.bottomFrozenRowCount - 1) {
43543
+ needRowHeader = true;
43544
+ }
43545
+ if (endCol >= table.colCount - table.rightFrozenColCount &&
43546
+ endRow >= table.frozenRowCount &&
43547
+ startRow <= table.rowCount - table.bottomFrozenRowCount - 1) {
43548
+ needRightRowHeader = true;
43549
+ }
43550
+ if (startRow <= table.frozenRowCount - 1 &&
43551
+ endCol >= table.frozenColCount &&
43552
+ startCol <= table.colCount - table.rightFrozenColCount - 1) {
43553
+ needColumnHeader = true;
43554
+ }
43555
+ if (endRow >= table.rowCount - table.bottomFrozenRowCount &&
43556
+ endCol >= table.frozenColCount &&
43557
+ startCol <= table.colCount - table.rightFrozenColCount - 1) {
43558
+ needBottomColumnHeader = true;
43559
+ }
43560
+ if (startCol <= table.colCount - table.rightFrozenColCount - 1 &&
43561
+ endCol >= table.frozenColCount &&
43562
+ startRow <= table.rowCount - table.bottomFrozenRowCount - 1 &&
43563
+ endRow >= table.frozenRowCount) {
43564
+ needBody = true;
43565
+ }
43566
+ return {
43567
+ needRowHeader,
43568
+ needRightRowHeader,
43569
+ needColumnHeader,
43570
+ needBottomColumnHeader,
43571
+ needBody,
43572
+ needCornerHeader,
43573
+ needRightTopCornerHeader,
43574
+ needLeftBottomCornerHeader,
43575
+ needRightBottomCornerHeader
43576
+ };
43577
+ }
42118
43578
 
42119
43579
  function getProp(name, cellStyle, col, row, _table) {
42120
43580
  const prop = cellStyle && isValid$3(cellStyle[name]) ? cellStyle[name] : undefined;
@@ -43705,6 +45165,10 @@
43705
45165
  lineDash: cellTheme?.group?.lineDash ?? undefined,
43706
45166
  y: table.scenegraph.getCellGroupY(row)
43707
45167
  });
45168
+ oldCellGroup.mergeStartCol = undefined;
45169
+ oldCellGroup.mergeStartRow = undefined;
45170
+ oldCellGroup.mergeEndCol = undefined;
45171
+ oldCellGroup.mergeEndRow = undefined;
43708
45172
  oldCellGroup.forEachChildren((child) => {
43709
45173
  child.setAttributes({
43710
45174
  dx: 0,
@@ -46736,7 +48200,7 @@
46736
48200
  });
46737
48201
  }
46738
48202
  }
46739
- setBottonFrozenColumnShadow() {
48203
+ setBottomFrozenColumnShadow() {
46740
48204
  const rowY = getRowBottomY(this.table);
46741
48205
  if (this.table.bottomFrozenRowCount === 0 || this.table.theme.frozenColumnLine?.shadow?.visible !== 'always') {
46742
48206
  this.bottonFrozenShadowLine.setAttributes({
@@ -49399,7 +50863,7 @@
49399
50863
  table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col], true, true);
49400
50864
  }
49401
50865
  }
49402
- table.scenegraph.updateContainer(true);
50866
+ table.scenegraph.updateContainer({ async: true });
49403
50867
  }
49404
50868
  if (table.isPivotTable()) {
49405
50869
  layoutMap.disableUseGetBodyCache();
@@ -51955,17 +53419,32 @@
51955
53419
  }
51956
53420
 
51957
53421
  function updateAllSelectComponent(scene) {
53422
+ const size0 = scene.customSelectedRangeComponents.size;
53423
+ let index0 = 0;
51958
53424
  scene.customSelectedRangeComponents.forEach((selectComp, key) => {
51959
- updateComponent(selectComp, key, scene);
53425
+ updateComponent(selectComp, key, scene, {
53426
+ size: size0,
53427
+ index: ++index0
53428
+ });
51960
53429
  });
53430
+ const size1 = scene.selectingRangeComponents.size;
53431
+ let index1 = 0;
51961
53432
  scene.selectingRangeComponents.forEach((selectComp, key) => {
51962
- updateComponent(selectComp, key, scene);
53433
+ updateComponent(selectComp, key, scene, {
53434
+ size: size1,
53435
+ index: ++index1
53436
+ });
51963
53437
  });
53438
+ const size2 = scene.selectedRangeComponents.size;
53439
+ let index2 = 0;
51964
53440
  scene.selectedRangeComponents.forEach((selectComp, key) => {
51965
- updateComponent(selectComp, key, scene);
53441
+ updateComponent(selectComp, key, scene, {
53442
+ size: size2,
53443
+ index: ++index2
53444
+ });
51966
53445
  });
51967
53446
  }
51968
- function updateComponent(selectComp, key, scene) {
53447
+ function updateComponent(selectComp, key, scene, other) {
51969
53448
  const table = scene.table;
51970
53449
  const [startColStr, startRowStr, endColStr, endRowStr] = key.split('-');
51971
53450
  const startCol = parseInt(startColStr, 10);
@@ -52028,12 +53507,20 @@
52028
53507
  const rowsHeight = table.getRowsHeight(computeRectCellRangeStartRow, computeRectCellRangeEndRow);
52029
53508
  const firstCellBound = scene.highPerformanceGetCell(computeRectCellRangeStartCol, computeRectCellRangeStartRow).globalAABBBounds;
52030
53509
  selectComp.rect.setAttributes({
52031
- x: firstCellBound.x1 - scene.tableGroup.attribute.x + 1,
52032
- y: firstCellBound.y1 - scene.tableGroup.attribute.y + 1,
52033
- width: colsWidth - 2,
52034
- height: rowsHeight - 2,
53510
+ x: firstCellBound.x1 - scene.tableGroup.attribute.x,
53511
+ y: firstCellBound.y1 - scene.tableGroup.attribute.y,
53512
+ width: colsWidth,
53513
+ height: rowsHeight,
52035
53514
  visible: true,
52036
- cornerRadius: 2
53515
+ cornerRadius: other
53516
+ ? other.size === 1
53517
+ ? 2
53518
+ : other.index === 1
53519
+ ? [2, 0, 0, 2]
53520
+ : other.index === other.size
53521
+ ? [0, 2, 2, 0]
53522
+ : 0
53523
+ : 0
52037
53524
  });
52038
53525
  if (selectComp.fillhandle) {
52039
53526
  const fillHandle = scene.table.options.excelOptions?.fillHandle;
@@ -52042,18 +53529,26 @@
52042
53529
  visible = fillHandle({ selectRanges: scene.table.stateManager.select.ranges, table: scene.table });
52043
53530
  }
52044
53531
  let lastCellBound;
52045
- if (computeRectCellRangeEndCol < table.colCount - 1) {
52046
- lastCellBound = scene.highPerformanceGetCell(computeRectCellRangeEndCol, computeRectCellRangeEndRow).globalAABBBounds;
53532
+ let handlerX;
53533
+ if (endCol < table.colCount - 1) {
53534
+ lastCellBound = scene.highPerformanceGetCell(endCol, endRow).globalAABBBounds;
53535
+ handlerX = lastCellBound.x2 - scene.tableGroup.attribute.x - 3;
52047
53536
  }
52048
53537
  else {
52049
- lastCellBound = scene.highPerformanceGetCell(computeRectCellRangeStartCol - 1, computeRectCellRangeEndRow).globalAABBBounds;
53538
+ if (startCol === 0) {
53539
+ lastCellBound = scene.highPerformanceGetCell(0, endRow).globalAABBBounds;
53540
+ handlerX = lastCellBound.x1 - scene.tableGroup.attribute.x;
53541
+ }
53542
+ else {
53543
+ lastCellBound = scene.highPerformanceGetCell(startCol - 1, endRow).globalAABBBounds;
53544
+ handlerX = lastCellBound.x2 - scene.tableGroup.attribute.x - 3;
53545
+ }
52050
53546
  }
52051
- const handlerX = lastCellBound.x2 - scene.tableGroup.attribute.x - 3;
52052
- if (computeRectCellRangeEndRow < table.rowCount - 1) {
52053
- lastCellBound = scene.highPerformanceGetCell(computeRectCellRangeEndCol, computeRectCellRangeEndRow).globalAABBBounds;
53547
+ if (endRow < table.rowCount - 1) {
53548
+ lastCellBound = scene.highPerformanceGetCell(endCol, endRow).globalAABBBounds;
52054
53549
  }
52055
53550
  else {
52056
- lastCellBound = scene.highPerformanceGetCell(computeRectCellRangeEndCol, computeRectCellRangeStartRow - 1).globalAABBBounds;
53551
+ lastCellBound = scene.highPerformanceGetCell(endCol, startRow - 1).globalAABBBounds;
52057
53552
  }
52058
53553
  const handlerY = lastCellBound.y2 - scene.tableGroup.attribute.y - 3;
52059
53554
  selectComp.fillhandle?.setAttributes({
@@ -52362,53 +53857,7 @@
52362
53857
  selectComp.fillhandle?.delete();
52363
53858
  });
52364
53859
  scene.selectingRangeComponents = new Map();
52365
- let needRowHeader = false;
52366
- let needRightRowHeader = false;
52367
- let needColumnHeader = false;
52368
- let needBottomColumnHeader = false;
52369
- let needBody = false;
52370
- let needCornerHeader = false;
52371
- let needRightTopCornerHeader = false;
52372
- let needRightBottomCornerHeader = false;
52373
- let needLeftBottomCornerHeader = false;
52374
- if (startCol <= table.frozenColCount - 1 && startRow <= table.frozenRowCount - 1) {
52375
- needCornerHeader = true;
52376
- }
52377
- if (endCol >= table.colCount - table.rightFrozenColCount && startRow <= table.frozenRowCount - 1) {
52378
- needRightTopCornerHeader = true;
52379
- }
52380
- if (startCol <= table.frozenColCount - 1 && endRow >= table.rowCount - table.bottomFrozenRowCount) {
52381
- needLeftBottomCornerHeader = true;
52382
- }
52383
- if (endCol >= table.colCount - table.rightFrozenColCount && endRow >= table.rowCount - table.bottomFrozenRowCount) {
52384
- needRightBottomCornerHeader = true;
52385
- }
52386
- if (startCol <= table.frozenColCount - 1 &&
52387
- endRow >= table.frozenRowCount &&
52388
- startRow <= table.rowCount - table.bottomFrozenRowCount - 1) {
52389
- needRowHeader = true;
52390
- }
52391
- if (endCol >= table.colCount - table.rightFrozenColCount &&
52392
- endRow >= table.frozenRowCount &&
52393
- startRow <= table.rowCount - table.bottomFrozenRowCount - 1) {
52394
- needRightRowHeader = true;
52395
- }
52396
- if (startRow <= table.frozenRowCount - 1 &&
52397
- endCol >= table.frozenColCount &&
52398
- startCol <= table.colCount - table.rightFrozenColCount - 1) {
52399
- needColumnHeader = true;
52400
- }
52401
- if (endRow >= table.rowCount - table.bottomFrozenRowCount &&
52402
- endCol >= table.frozenColCount &&
52403
- startCol <= table.colCount - table.rightFrozenColCount - 1) {
52404
- needBottomColumnHeader = true;
52405
- }
52406
- if (startCol <= table.colCount - table.rightFrozenColCount - 1 &&
52407
- endCol >= table.frozenColCount &&
52408
- startRow <= table.rowCount - table.bottomFrozenRowCount - 1 &&
52409
- endRow >= table.frozenRowCount) {
52410
- needBody = true;
52411
- }
53860
+ const { needRowHeader, needRightRowHeader, needColumnHeader, needBottomColumnHeader, needBody, needCornerHeader, needRightTopCornerHeader, needLeftBottomCornerHeader, needRightBottomCornerHeader } = calculateCellRangeDistribution(startCol, startRow, endCol, endRow, table);
52412
53861
  if (needCornerHeader) {
52413
53862
  const cornerEndCol = Math.min(endCol, table.frozenColCount - 1);
52414
53863
  const cornerEndRow = Math.min(endRow, table.frozenRowCount - 1);
@@ -53192,12 +54641,11 @@
53192
54641
  const frozenRowsHeight = table.getFrozenRowsHeight();
53193
54642
  const bottomFrozenRowsHeight = table.getBottomFrozenRowsHeight();
53194
54643
  const totalFrozenRowsHeight = frozenRowsHeight + bottomFrozenRowsHeight;
53195
- const h = tableNoFrameHeight - totalFrozenRowsHeight;
54644
+ const h = table.tableNoFrameHeight - totalFrozenRowsHeight;
53196
54645
  const hh = Math.min(allRowsHeight - totalFrozenRowsHeight, tableNoFrameHeight - totalFrozenRowsHeight);
53197
54646
  const bodyHeight = hh < h ? h : hh;
53198
54647
  tableBodyDomContainer.style.width = `${tableNoFrameWidth}px`;
53199
- const tableHeight = Math.min(allRowsHeight - frozenRowsHeight, tableNoFrameHeight - frozenRowsHeight);
53200
- tableBodyDomContainer.style.height = `${tableHeight}px`;
54648
+ tableBodyDomContainer.style.height = `${bodyHeight}px`;
53201
54649
  tableBodyDomContainer.style.top = `${table.tableY + frozenRowsHeight}px`;
53202
54650
  if (table.frozenColCount > 0) {
53203
54651
  headerDomContainer.style.left = `${table.tableX + frozenColsWidth}px`;
@@ -53688,7 +55136,7 @@
53688
55136
  scene.proxy.rowStart = scene.bodyGroup.firstChild?.firstChild?.row ?? scene.table.frozenRowCount;
53689
55137
  scene.bodyGroup.setAttribute('y', scene.colHeaderGroup.attribute.height);
53690
55138
  scene.rowHeaderGroup.setAttribute('y', scene.cornerHeaderGroup.attribute.height);
53691
- scene.updateContainer();
55139
+ scene.updateContainer({ needUpdateCellY: true });
53692
55140
  scene.updateBorderSizeAndPosition();
53693
55141
  scene.hasFrozen = true;
53694
55142
  }
@@ -53700,6 +55148,9 @@
53700
55148
  continue;
53701
55149
  }
53702
55150
  const rowCell = child.firstChild;
55151
+ if (!scene.colHeaderGroup.children[i]) {
55152
+ createColGroup(scene.colHeaderGroup, 0, 0, rowCell.col, rowCell.col, 0, 0, 'columnHeader', scene.table);
55153
+ }
53703
55154
  scene.colHeaderGroup.children[i]?.appendChild(rowCell);
53704
55155
  if (!hasSetedHeight) {
53705
55156
  scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + rowCell.attribute.height);
@@ -53716,6 +55167,9 @@
53716
55167
  continue;
53717
55168
  }
53718
55169
  const rowCell = child.firstChild;
55170
+ if (!scene.cornerHeaderGroup.children[i]) {
55171
+ createColGroup(scene.cornerHeaderGroup, 0, 0, rowCell.col, rowCell.col, 0, 0, scene.table.isListTable() ? 'columnHeader' : 'cornerHeader', scene.table);
55172
+ }
53719
55173
  scene.cornerHeaderGroup.children[i]?.appendChild(rowCell);
53720
55174
  if (!hasSetedHeight) {
53721
55175
  scene.cornerHeaderGroup.setAttribute('height', scene.cornerHeaderGroup.attribute.height + rowCell.attribute.height);
@@ -53732,7 +55186,10 @@
53732
55186
  continue;
53733
55187
  }
53734
55188
  const rowCell = child.firstChild;
53735
- scene.rightTopCornerGroup.children[i]?.appendChild(rowCell);
55189
+ if (!scene.rightTopCornerGroup.children[i]) {
55190
+ createColGroup(scene.rightTopCornerGroup, 0, 0, rowCell.col, rowCell.col, 0, 0, 'columnHeader', scene.table);
55191
+ }
55192
+ scene.rightTopCornerGroup.children[i].appendChild(rowCell);
53736
55193
  if (!hasSetedHeight) {
53737
55194
  scene.rightTopCornerGroup.setAttribute('height', scene.rightTopCornerGroup.attribute.height + rowCell.attribute.height);
53738
55195
  scene.rightFrozenGroup.setAttribute('height', scene.rightFrozenGroup.attribute.height - rowCell.attribute.height);
@@ -54183,6 +55640,13 @@
54183
55640
  });
54184
55641
  return x;
54185
55642
  }
55643
+ function updateContainerChildrenY(containerGroup, y) {
55644
+ containerGroup.forEachChildrenSkipChild((row, index) => {
55645
+ row.setAttribute('y', y);
55646
+ y += row.attribute.height;
55647
+ });
55648
+ return y;
55649
+ }
54186
55650
 
54187
55651
  function hideHoverIcon(col, row, scene) {
54188
55652
  if (col === -1 || row === -1) {
@@ -55352,7 +56816,7 @@
55352
56816
  updateColWidth(col, detaX, skipUpdateContainer, skipTableWidthMap) {
55353
56817
  updateColWidth(this, col, Math.round(detaX), skipTableWidthMap);
55354
56818
  if (!skipUpdateContainer) {
55355
- this.updateContainer(true);
56819
+ this.updateContainer({ async: true });
55356
56820
  }
55357
56821
  }
55358
56822
  updateChartSizeForResizeColWidth(col) {
@@ -55835,7 +57299,7 @@
55835
57299
  if (!this.isPivot && !this.table.transpose) {
55836
57300
  this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
55837
57301
  this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount);
55838
- this.component.setBottonFrozenColumnShadow();
57302
+ this.component.setBottomFrozenColumnShadow();
55839
57303
  this.component.setTopFrozenColumnShadow();
55840
57304
  }
55841
57305
  else if (this.table.options.frozenColCount) {
@@ -56073,26 +57537,67 @@
56073
57537
  this.bottomFrozenGroup.setAttribute('x', this.table.getFrozenColsWidth());
56074
57538
  this.bodyGroup.setAttribute('x', this.rowHeaderGroup.attribute.width);
56075
57539
  }
56076
- updateContainer(async = false) {
56077
- if (async) {
57540
+ updateContainerAttrHeightAndY() {
57541
+ for (let i = 0; i < this.cornerHeaderGroup.children.length; i++) {
57542
+ updateContainerChildrenY(this.cornerHeaderGroup.children[i], 0);
57543
+ }
57544
+ for (let i = 0; i < this.colHeaderGroup.children.length; i++) {
57545
+ updateContainerChildrenY(this.colHeaderGroup.children[i], 0);
57546
+ }
57547
+ for (let i = 0; i < this.rightTopCornerGroup.children.length; i++) {
57548
+ updateContainerChildrenY(this.rightTopCornerGroup.children[i], 0);
57549
+ }
57550
+ for (let i = 0; i < this.rowHeaderGroup.children.length; i++) {
57551
+ this.rowHeaderGroup.children[i].firstChild &&
57552
+ updateContainerChildrenY(this.rowHeaderGroup.children[i], this.rowHeaderGroup.children[i].firstChild.row > 0
57553
+ ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, this.rowHeaderGroup.children[i].firstChild.row - 1)
57554
+ : 0);
57555
+ }
57556
+ for (let i = 0; i < this.bodyGroup.children.length; i++) {
57557
+ this.bodyGroup.children[i].firstChild &&
57558
+ updateContainerChildrenY(this.bodyGroup.children[i], this.bodyGroup.children[i].firstChild.row > 0
57559
+ ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, this.bodyGroup.children[i].firstChild.row - 1)
57560
+ : 0);
57561
+ }
57562
+ for (let i = 0; i < this.rightFrozenGroup.children.length; i++) {
57563
+ this.rightFrozenGroup.children[i].firstChild &&
57564
+ updateContainerChildrenY(this.rightFrozenGroup.children[i], this.rightFrozenGroup.children[i].firstChild.row > 0
57565
+ ? this.table.getRowsHeight(this.table.frozenRowCount ?? 0, this.rightFrozenGroup.children[i].firstChild.row - 1)
57566
+ : 0);
57567
+ }
57568
+ for (let i = 0; i < this.leftBottomCornerGroup.children.length; i++) {
57569
+ updateContainerChildrenY(this.leftBottomCornerGroup.children[i], 0);
57570
+ }
57571
+ for (let i = 0; i < this.bottomFrozenGroup.children.length; i++) {
57572
+ updateContainerChildrenY(this.bottomFrozenGroup.children[i], 0);
57573
+ }
57574
+ for (let i = 0; i < this.rightBottomCornerGroup.children.length; i++) {
57575
+ updateContainerChildrenY(this.rightBottomCornerGroup.children[i], 0);
57576
+ }
57577
+ }
57578
+ updateContainer(updateConfig = { async: false, needUpdateCellY: false }) {
57579
+ if (updateConfig.async) {
56078
57580
  if (!this._needUpdateContainer) {
56079
57581
  this._needUpdateContainer = true;
56080
57582
  setTimeout(() => {
56081
- this.updateContainerSync();
57583
+ this.updateContainerSync(updateConfig.needUpdateCellY ?? false);
56082
57584
  }, 0);
56083
57585
  }
56084
57586
  }
56085
57587
  else {
56086
57588
  this._needUpdateContainer = true;
56087
- this.updateContainerSync();
57589
+ this.updateContainerSync(updateConfig.needUpdateCellY ?? false);
56088
57590
  }
56089
57591
  }
56090
- updateContainerSync() {
57592
+ updateContainerSync(needUpdateCellY = false) {
56091
57593
  if (!this._needUpdateContainer) {
56092
57594
  return;
56093
57595
  }
56094
57596
  this._needUpdateContainer = false;
56095
57597
  this.updateContainerAttrWidthAndX();
57598
+ if (needUpdateCellY) {
57599
+ this.updateContainerAttrHeightAndY();
57600
+ }
56096
57601
  this.updateTableSize();
56097
57602
  this.component.updateScrollBar();
56098
57603
  this.updateNextFrame();
@@ -56354,7 +57859,7 @@
56354
57859
  if (!this.isPivot && !this.table.transpose) {
56355
57860
  this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
56356
57861
  this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount);
56357
- this.component.setBottonFrozenColumnShadow();
57862
+ this.component.setBottomFrozenColumnShadow();
56358
57863
  this.component.setTopFrozenColumnShadow();
56359
57864
  }
56360
57865
  else if (this.table.options.frozenColCount) {
@@ -56376,7 +57881,7 @@
56376
57881
  if (!this.isPivot && !this.table.transpose) {
56377
57882
  this.component.setFrozenColumnShadow(this.table.frozenColCount - 1);
56378
57883
  this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount);
56379
- this.component.setBottonFrozenColumnShadow();
57884
+ this.component.setBottomFrozenColumnShadow();
56380
57885
  this.component.setTopFrozenColumnShadow();
56381
57886
  }
56382
57887
  else if (this.table.options.frozenColCount) {
@@ -56748,6 +58253,7 @@
56748
58253
  const { table, interactionState } = state;
56749
58254
  const { scenegraph } = table;
56750
58255
  const { highlightScope, disableHeader, cellPos, disableCtrlMultiSelect } = state.select;
58256
+ state.select.isSelectAll = isSelectAll;
56751
58257
  if (col !== -1 && row !== -1 && makeSelectCellVisible) {
56752
58258
  table._makeVisibleCell(col, row);
56753
58259
  }
@@ -58451,6 +59957,126 @@
58451
59957
  }
58452
59958
  }
58453
59959
 
59960
+ function updateCustomSelectBorder(scene, selectRange, style) {
59961
+ const table = scene.table;
59962
+ const newStartCol = selectRange.start.col;
59963
+ const newStartRow = selectRange.start.row;
59964
+ const newEndCol = selectRange.end.col;
59965
+ const newEndRow = selectRange.end.row;
59966
+ selectRange.skipBodyMerge;
59967
+ const startCol = Math.max(Math.min(newEndCol, newStartCol), 0);
59968
+ const startRow = Math.max(Math.min(newEndRow, newStartRow), 0);
59969
+ const endCol = Math.min(Math.max(newEndCol, newStartCol), table.colCount - 1);
59970
+ const endRow = Math.min(Math.max(newEndRow, newStartRow), table.rowCount - 1);
59971
+ const { needRowHeader, needRightRowHeader, needColumnHeader, needBottomColumnHeader, needBody, needCornerHeader, needRightTopCornerHeader, needLeftBottomCornerHeader, needRightBottomCornerHeader } = calculateCellRangeDistribution(startCol, startRow, endCol, endRow, table);
59972
+ if (needCornerHeader) {
59973
+ const cornerEndCol = Math.min(endCol, table.frozenColCount - 1);
59974
+ const cornerEndRow = Math.min(endRow, table.frozenRowCount - 1);
59975
+ const strokeArray = [true, !needColumnHeader, !needRowHeader, true];
59976
+ createCustomCellSelectBorder(scene, startCol, startRow, cornerEndCol, cornerEndRow, 'cornerHeader', `${startCol}${startRow}${endCol}${endRow}`, strokeArray, style);
59977
+ }
59978
+ if (needRightTopCornerHeader) {
59979
+ const cornerStartCol = Math.max(startCol, table.colCount - table.rightFrozenColCount);
59980
+ const cornerEndRow = Math.min(endRow, table.frozenRowCount - 1);
59981
+ const strokeArray = [true, true, !needRightRowHeader, !needColumnHeader];
59982
+ createCustomCellSelectBorder(scene, cornerStartCol, startRow, endCol, cornerEndRow, 'rightTopCorner', `${startCol}${startRow}${endCol}${endRow}`, strokeArray, style);
59983
+ }
59984
+ if (needLeftBottomCornerHeader) {
59985
+ const cornerEndCol = Math.min(endCol, table.frozenColCount - 1);
59986
+ const cornerStartRow = Math.max(startRow, table.rowCount - table.bottomFrozenRowCount);
59987
+ const strokeArray = [!needRowHeader, !needBottomColumnHeader, true, true];
59988
+ createCustomCellSelectBorder(scene, startCol, cornerStartRow, cornerEndCol, endRow, 'leftBottomCorner', `${startCol}${startRow}${endCol}${endRow}`, strokeArray, style);
59989
+ }
59990
+ if (needRightBottomCornerHeader) {
59991
+ const cornerStartCol = Math.max(startCol, table.colCount - table.rightFrozenColCount);
59992
+ const cornerStartRow = Math.max(startRow, table.rowCount - table.bottomFrozenRowCount);
59993
+ const strokeArray = [!needRightRowHeader, true, true, !needBottomColumnHeader];
59994
+ createCustomCellSelectBorder(scene, cornerStartCol, cornerStartRow, endCol, endRow, 'rightBottomCorner', `${startCol}${startRow}${endCol}${endRow}`, strokeArray, style);
59995
+ }
59996
+ if (needColumnHeader) {
59997
+ const columnHeaderStartCol = Math.max(startCol, table.frozenColCount);
59998
+ const columnHeaderEndCol = Math.min(endCol, table.colCount - table.rightFrozenColCount - 1);
59999
+ const columnHeaderEndRow = Math.min(endRow, table.frozenRowCount - 1);
60000
+ const strokeArray = [true, !needRightTopCornerHeader, !needBody, !needCornerHeader];
60001
+ createCustomCellSelectBorder(scene, columnHeaderStartCol, startRow, columnHeaderEndCol, columnHeaderEndRow, 'columnHeader', `${startCol}${startRow}${endCol}${endRow}`, strokeArray, style);
60002
+ }
60003
+ if (needBottomColumnHeader) {
60004
+ const columnHeaderStartCol = Math.max(startCol, table.frozenColCount);
60005
+ const columnHeaderEndCol = Math.min(endCol, table.colCount - table.rightFrozenColCount - 1);
60006
+ const columnHeaderStartRow = Math.max(startRow, table.rowCount - table.bottomFrozenRowCount);
60007
+ const strokeArray = [!needBody, !needRightBottomCornerHeader, true, !needLeftBottomCornerHeader];
60008
+ createCustomCellSelectBorder(scene, columnHeaderStartCol, columnHeaderStartRow, columnHeaderEndCol, endRow, 'bottomFrozen', `${startCol}${startRow}${endCol}${endRow}`, strokeArray, style);
60009
+ }
60010
+ if (needRowHeader) {
60011
+ const columnHeaderStartRow = Math.max(startRow, table.frozenRowCount);
60012
+ const columnHeaderEndRow = Math.min(endRow, table.rowCount - table.bottomFrozenRowCount - 1);
60013
+ const columnHeaderEndCol = Math.min(endCol, table.frozenColCount - 1);
60014
+ const strokeArray = [!needCornerHeader, !needBody, !needLeftBottomCornerHeader, true];
60015
+ createCustomCellSelectBorder(scene, startCol, columnHeaderStartRow, columnHeaderEndCol, columnHeaderEndRow, 'rowHeader', `${startCol}${startRow}${endCol}${endRow}`, strokeArray, style);
60016
+ }
60017
+ if (needRightRowHeader) {
60018
+ const columnHeaderStartRow = Math.max(startRow, table.frozenRowCount);
60019
+ const columnHeaderEndRow = Math.min(endRow, table.rowCount - table.bottomFrozenRowCount - 1);
60020
+ const columnHeaderStartCol = Math.max(startCol, table.colCount - table.rightFrozenColCount);
60021
+ const strokeArray = [!needRightTopCornerHeader, true, !needRightBottomCornerHeader, !needBody];
60022
+ createCustomCellSelectBorder(scene, columnHeaderStartCol, columnHeaderStartRow, endCol, columnHeaderEndRow, 'rightFrozen', `${startCol}${startRow}${endCol}${endRow}`, strokeArray, style);
60023
+ }
60024
+ if (needBody) {
60025
+ const columnHeaderStartCol = Math.max(startCol, table.frozenColCount);
60026
+ const columnHeaderStartRow = Math.max(startRow, table.frozenRowCount);
60027
+ const columnHeaderEndCol = Math.min(endCol, table.colCount - table.rightFrozenColCount - 1);
60028
+ const columnHeaderEndRow = Math.min(endRow, table.rowCount - table.bottomFrozenRowCount - 1);
60029
+ const strokeArray = [!needColumnHeader, !needRightRowHeader, !needBottomColumnHeader, !needRowHeader];
60030
+ createCustomCellSelectBorder(scene, columnHeaderStartCol, columnHeaderStartRow, columnHeaderEndCol, columnHeaderEndRow, 'body', `${startCol}${startRow}${endCol}${endRow}`, strokeArray, style);
60031
+ }
60032
+ }
60033
+ function createCustomCellSelectBorder(scene, start_Col, start_Row, end_Col, end_Row, selectRangeType, selectId, strokes, style) {
60034
+ const startCol = Math.min(start_Col, end_Col);
60035
+ const startRow = Math.min(start_Row, end_Row);
60036
+ const endCol = Math.max(start_Col, end_Col);
60037
+ const endRow = Math.max(start_Row, end_Row);
60038
+ const firstCellBound = scene.highPerformanceGetCell(startCol, startRow).globalAABBBounds;
60039
+ const rect = createRect({
60040
+ pickable: false,
60041
+ fill: style.cellBgColor ?? false,
60042
+ lineWidth: style.cellBorderLineWidth ?? 0,
60043
+ lineDash: style.cellBorderLineDash ?? [],
60044
+ stroke: strokes.map(stroke => {
60045
+ if (stroke) {
60046
+ return style.cellBorderColor;
60047
+ }
60048
+ return false;
60049
+ }),
60050
+ x: firstCellBound.x1 - scene.tableGroup.attribute.x,
60051
+ y: firstCellBound.y1 - scene.tableGroup.attribute.y,
60052
+ width: 0,
60053
+ height: 0,
60054
+ visible: true,
60055
+ cornerRadius: getCornerRadius(selectRangeType, scene.table.theme.frameStyle?.cornerRadius, start_Col, start_Row, end_Col, end_Row, scene.table)
60056
+ });
60057
+ scene.customSelectedRangeComponents.set(`${startCol}-${startRow}-${endCol}-${endRow}-${selectId}`, {
60058
+ rect,
60059
+ role: selectRangeType
60060
+ });
60061
+ scene.tableGroup.insertAfter(rect, selectRangeType === 'body'
60062
+ ? scene.bodyGroup
60063
+ : selectRangeType === 'columnHeader'
60064
+ ? scene.colHeaderGroup
60065
+ : selectRangeType === 'rowHeader'
60066
+ ? scene.rowHeaderGroup
60067
+ : selectRangeType === 'cornerHeader'
60068
+ ? scene.cornerHeaderGroup
60069
+ : selectRangeType === 'rightTopCorner'
60070
+ ? scene.rightTopCornerGroup
60071
+ : selectRangeType === 'rightFrozen'
60072
+ ? scene.rightFrozenGroup
60073
+ : selectRangeType === 'leftBottomCorner'
60074
+ ? scene.leftBottomCornerGroup
60075
+ : selectRangeType === 'bottomFrozen'
60076
+ ? scene.bottomFrozenGroup
60077
+ : scene.rightBottomCornerGroup);
60078
+ }
60079
+
58454
60080
  function deletaCustomSelectRanges(state) {
58455
60081
  const { customSelectedRangeComponents } = state.table.scenegraph;
58456
60082
  customSelectedRangeComponents.forEach((selectComp, key) => {
@@ -58460,20 +60086,8 @@
58460
60086
  state.select.customSelectRanges = [];
58461
60087
  }
58462
60088
  function addCustomSelectRanges(customSelectRanges, state) {
58463
- const { customSelectedRangeComponents } = state.table.scenegraph;
58464
60089
  customSelectRanges.forEach((customRange) => {
58465
- const { range, style } = customRange;
58466
- const rect = createRect({
58467
- fill: style.cellBgColor ?? false,
58468
- stroke: style.cellBorderColor ?? false,
58469
- lineWidth: style.cellBorderLineWidth ?? 0,
58470
- lineDash: style.cellBorderLineDash ?? [],
58471
- pickable: false
58472
- });
58473
- customSelectedRangeComponents.set(`${range.start.col}-${range.start.row}-${range.end.col}-${range.end.row}`, {
58474
- rect,
58475
- role: 'body'
58476
- });
60090
+ updateCustomSelectBorder(state.table.scenegraph, customRange.range, customRange.style);
58477
60091
  });
58478
60092
  state.select.customSelectRanges = customSelectRanges;
58479
60093
  updateAllSelectComponent(state.table.scenegraph);
@@ -58838,7 +60452,17 @@
58838
60452
  if (row > this.table.rowCount - 1) {
58839
60453
  row = this.table.rowCount - 1;
58840
60454
  }
60455
+ const oldCellPosCol = this.select.cellPos.col;
60456
+ const oldCellPosRow = this.select.cellPos.row;
58841
60457
  updateSelectPosition(this, col, row, isShift, isCtrl, isSelectAll, makeSelectCellVisible, skipBodyMerge);
60458
+ if (this.table.hasListeners(TABLE_EVENT_TYPE.SELECTED_CHANGED) &&
60459
+ (oldCellPosCol !== col || oldCellPosRow !== row)) {
60460
+ this.table.fireListeners(TABLE_EVENT_TYPE.SELECTED_CHANGED, {
60461
+ ranges: this.select.ranges,
60462
+ col: col,
60463
+ row: row
60464
+ });
60465
+ }
58842
60466
  }
58843
60467
  checkCellRangeInSelect(cellPosStart, cellPosEnd) {
58844
60468
  return checkMultiCellInSelect(cellPosStart, cellPosEnd, this.select.ranges, this.select.highlightScope);
@@ -59331,6 +60955,28 @@
59331
60955
  }
59332
60956
  this.table.scenegraph.setX(-left);
59333
60957
  this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio);
60958
+ if (this.table.frozenColCount) {
60959
+ this.table.scenegraph.component.frozenShadowLine.setAttributes({
60960
+ visible: this.table.scrollLeft !== 0
60961
+ });
60962
+ }
60963
+ else {
60964
+ this.table.scenegraph.component.frozenShadowLine.setAttributes({
60965
+ visible: false
60966
+ });
60967
+ }
60968
+ if (this.table.rightFrozenColCount) {
60969
+ const scrollLeft = this.table.scrollLeft;
60970
+ const viewWidth = this.table.tableNoFrameWidth;
60971
+ this.table.scenegraph.component.rightFrozenShadowLine.setAttributes({
60972
+ visible: scrollLeft + viewWidth < totalWidth
60973
+ });
60974
+ }
60975
+ else {
60976
+ this.table.scenegraph.component.rightFrozenShadowLine.setAttributes({
60977
+ visible: false
60978
+ });
60979
+ }
59334
60980
  const dx = this.scroll.horizontalBarPos - oldHorizontalBarPos;
59335
60981
  this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
59336
60982
  event: event?.nativeEvent,
@@ -59574,6 +61220,9 @@
59574
61220
  event
59575
61221
  });
59576
61222
  }
61223
+ setSelectInline(selectInline) {
61224
+ this.select.selectInline = selectInline;
61225
+ }
59577
61226
  updateSortState(sortState) {
59578
61227
  sortState = Array.isArray(sortState) ? sortState : [sortState];
59579
61228
  for (let index = 0; index < sortState.length; index++) {
@@ -59646,7 +61295,10 @@
59646
61295
  }
59647
61296
  this.frozen.icon = iconMark;
59648
61297
  }
59649
- updateCursor(mode = 'default') {
61298
+ updateCursor(mode) {
61299
+ if (!mode) {
61300
+ mode = this.table.options.defaultCursor ?? 'default';
61301
+ }
59650
61302
  this.table.getElement().style.cursor = mode;
59651
61303
  }
59652
61304
  updateDrillState(dimensionKey, title, drillDown, drillUp, col, row) {
@@ -59932,6 +61584,10 @@
59932
61584
 
59933
61585
  function handleWhell(event, state, isWheelEvent = true) {
59934
61586
  let { deltaX, deltaY } = event;
61587
+ const absY = Math.abs(deltaY);
61588
+ if (absY !== 0 && Math.abs(absY) > 10) {
61589
+ deltaY = deltaY / (absY > 100 ? 3 : 2);
61590
+ }
59935
61591
  if (event.shiftKey && event.deltaY) {
59936
61592
  deltaX = deltaY;
59937
61593
  deltaY = 0;
@@ -60119,8 +61775,7 @@
60119
61775
  mergeCellInfo: eventArgsSet.eventArgs?.mergeInfo
60120
61776
  });
60121
61777
  }
60122
- if (stateManager.interactionState === InteractionState.grabing &&
60123
- !table.editorManager?.editingEditor) {
61778
+ if (stateManager.interactionState === InteractionState.grabing) {
60124
61779
  if (Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1) {
60125
61780
  if (stateManager.isResizeCol() || stateManager.isResizeRow()) ;
60126
61781
  else if (stateManager.isMoveCol()) {
@@ -60334,7 +61989,7 @@
60334
61989
  }
60335
61990
  const isCompleteEdit = table.editorManager?.completeEdit(e.nativeEvent);
60336
61991
  getPromiseValue(isCompleteEdit, isCompleteEdit => {
60337
- if (isCompleteEdit === false) {
61992
+ if (!table.options.customConfig?.selectCellWhenCellEditorNotExists && isCompleteEdit === false) {
60338
61993
  return;
60339
61994
  }
60340
61995
  const hitIcon = eventArgsSet?.eventArgs?.target?.role?.startsWith('icon')
@@ -60549,7 +62204,8 @@
60549
62204
  }
60550
62205
  }
60551
62206
  }
60552
- if (!cellInRange) {
62207
+ const disableSelectOnContextMenu = table.options.select?.disableSelectOnContextMenu;
62208
+ if (!cellInRange && !disableSelectOnContextMenu) {
60553
62209
  table.selectCell(col, row);
60554
62210
  }
60555
62211
  if (table.hasListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CELL)) {
@@ -60621,9 +62277,13 @@
60621
62277
  eventArgsSet.eventArgs?.target !== stateManager.residentHoverIcon?.icon) {
60622
62278
  stateManager.hideMenu();
60623
62279
  }
60624
- const isCompleteEdit = table.editorManager?.completeEdit(e.nativeEvent);
62280
+ let isCompleteEdit = false;
62281
+ const target = e.target;
62282
+ if (target !== table.scenegraph.tableGroup && !target.isDescendantsOf(table.scenegraph.tableGroup)) {
62283
+ isCompleteEdit = table.editorManager?.completeEdit(e.nativeEvent);
62284
+ }
60625
62285
  getPromiseValue(isCompleteEdit, isCompleteEdit => {
60626
- if (isCompleteEdit === false) {
62286
+ if (!table.options.customConfig?.selectCellWhenCellEditorNotExists && isCompleteEdit === false) {
60627
62287
  return;
60628
62288
  }
60629
62289
  const hitIcon = e.target.role?.startsWith('icon') ? e.target : undefined;
@@ -60670,7 +62330,12 @@
60670
62330
  stateManager.updateInteractionState(InteractionState.default);
60671
62331
  eventManager.dealTableHover();
60672
62332
  const isHasSelected = !!stateManager.select.ranges?.length;
60673
- if (table.options.select?.blankAreaClickDeselect ?? true) {
62333
+ if (table.options.customConfig?.cancelSelectCellHook) {
62334
+ if (table.options.customConfig?.cancelSelectCellHook(e)) {
62335
+ eventManager.dealTableSelect();
62336
+ }
62337
+ }
62338
+ else if (table.options.select?.blankAreaClickDeselect ?? true) {
60674
62339
  eventManager.dealTableSelect();
60675
62340
  }
60676
62341
  stateManager.endSelectCells(true, isHasSelected);
@@ -61004,7 +62669,7 @@
61004
62669
  scenegraph.table.eventManager.isDraging = false;
61005
62670
  });
61006
62671
  scenegraph.component.hScrollBar.addEventListener('pointermove', (e) => {
61007
- scenegraph.table.stateManager.updateCursor('default');
62672
+ scenegraph.table.stateManager.updateCursor();
61008
62673
  e.stopPropagation();
61009
62674
  });
61010
62675
  scenegraph.component.hScrollBar.addEventListener('pointerdown', (e) => {
@@ -61286,121 +62951,17 @@
61286
62951
  }
61287
62952
  handler.on(table.getElement(), 'copy', async (e) => {
61288
62953
  if (table.keyboardOptions?.copySelected) {
61289
- const data = table.getCopyValue();
61290
- if (isValid$3(data)) {
61291
- e.preventDefault();
61292
- const permissionState = await navigator.permissions.query({ name: 'clipboard-write' });
61293
- if (navigator.clipboard?.write && permissionState.state === 'granted') {
61294
- const setDataToHTML = (data) => {
61295
- const result = ['<table>'];
61296
- const META_HEAD = [
61297
- '<meta name="author" content="Visactor"/>',
61298
- '<style type="text/css">td{white-space:normal}br{mso-data-placement:same-cell}</style>'
61299
- ].join('');
61300
- const rows = data.split('\r\n');
61301
- rows.forEach(function (rowCells, rowIndex) {
61302
- const cells = rowCells.split('\t');
61303
- const rowValues = [];
61304
- if (rowIndex === 0) {
61305
- result.push('<tbody>');
61306
- }
61307
- cells.forEach(function (cell, cellIndex) {
61308
- const parsedCellData = !cell
61309
- ? ' '
61310
- : cell
61311
- .toString()
61312
- .replace(/&/g, '&amp;')
61313
- .replace(/'/g, '&#39;')
61314
- .replace(/</g, '&lt;')
61315
- .replace(/>/g, '&gt;')
61316
- .replace(/\n/g, '<br>')
61317
- .replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g, '<br>\r\n')
61318
- .replace(/\x20{2,}/gi, (substring) => {
61319
- return `<span style="mso-spacerun: yes">${'&nbsp;'.repeat(substring.length - 1)} </span>`;
61320
- })
61321
- .replace(/\t/gi, '&#9;');
61322
- rowValues.push(`<td>${parsedCellData}</td>`);
61323
- });
61324
- result.push('<tr>', ...rowValues, '</tr>');
61325
- if (rowIndex === rows.length - 1) {
61326
- result.push('</tbody>');
61327
- }
61328
- });
61329
- result.push('</table>');
61330
- return [META_HEAD, result.join('')].join('');
61331
- };
61332
- const dataHTML = setDataToHTML(data);
61333
- navigator.clipboard.write([
61334
- new ClipboardItem({
61335
- 'text/html': new Blob([dataHTML], { type: 'text/html' }),
61336
- 'text/plain': new Blob([data], { type: 'text/plain' })
61337
- })
61338
- ]);
61339
- }
61340
- else {
61341
- if (browser.IE) {
61342
- window.clipboardData.setData('Text', data);
61343
- }
61344
- else {
61345
- e.clipboardData.setData('text/plain', data);
61346
- }
61347
- }
61348
- table.fireListeners(TABLE_EVENT_TYPE.COPY_DATA, {
61349
- cellRange: table.stateManager.select.ranges,
61350
- copyData: data
61351
- });
61352
- }
62954
+ eventManager.handleCopy(e);
62955
+ }
62956
+ });
62957
+ handler.on(table.getElement(), 'cut', async (e) => {
62958
+ if (table.keyboardOptions?.cutSelected) {
62959
+ eventManager.handleCut(e);
61353
62960
  }
61354
62961
  });
61355
62962
  handler.on(table.getElement(), 'paste', async (e) => {
61356
- if (table.keyboardOptions?.pasteValueToCell && table.changeCellValues) {
61357
- if (table.editorManager?.editingEditor) {
61358
- return;
61359
- }
61360
- if (table.stateManager.select.ranges?.length > 0) {
61361
- if (navigator.clipboard?.read) {
61362
- navigator.clipboard.read().then(clipboardItems => {
61363
- for (const item of clipboardItems) {
61364
- if (item.types.includes('text/html')) {
61365
- pasteHtmlToTable(item);
61366
- }
61367
- else if (item.types.length === 1 && item.types[0] === 'text/plain') {
61368
- pasteTextToTable(item);
61369
- }
61370
- else ;
61371
- }
61372
- });
61373
- }
61374
- else {
61375
- const ranges = table.stateManager.select.ranges;
61376
- const col = Math.min(ranges[0].start.col, ranges[0].end.col);
61377
- const row = Math.min(ranges[0].start.row, ranges[0].end.row);
61378
- const clipboardData = e.clipboardData || window.Clipboard;
61379
- const pastedData = clipboardData.getData('text');
61380
- const rows = pastedData.split('\n');
61381
- const values = [];
61382
- rows.forEach(function (rowCells, rowIndex) {
61383
- const cells = rowCells.split('\t');
61384
- const rowValues = [];
61385
- values.push(rowValues);
61386
- cells.forEach(function (cell, cellIndex) {
61387
- if (cellIndex === cells.length - 1) {
61388
- cell = cell.trim();
61389
- }
61390
- rowValues.push(cell);
61391
- });
61392
- });
61393
- const changedCellResults = await table.changeCellValues(col, row, values);
61394
- if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
61395
- table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
61396
- col,
61397
- row,
61398
- pasteData: values,
61399
- changedCellResults
61400
- });
61401
- }
61402
- }
61403
- }
62963
+ if (table.keyboardOptions?.pasteValueToCell) {
62964
+ eventManager.handlePaste(e);
61404
62965
  }
61405
62966
  });
61406
62967
  handler.on(table.getElement(), 'contextmenu', (e) => {
@@ -61430,162 +62991,6 @@
61430
62991
  }
61431
62992
  });
61432
62993
  }
61433
- const regex = /<tr[^>]*>([\s\S]*?)<\/tr>/g;
61434
- const cellRegex = /<td[^>]*>([\s\S]*?)<\/td>/g;
61435
- function pasteHtmlToTable(item) {
61436
- const ranges = table.stateManager.select.ranges;
61437
- const selectRangeLength = ranges.length;
61438
- const col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
61439
- const row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
61440
- const maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
61441
- const maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
61442
- let pasteValuesColCount = 0;
61443
- let pasteValuesRowCount = 0;
61444
- let values = [];
61445
- item.getType('text/html').then((blob) => {
61446
- blob.text().then(async (pastedData) => {
61447
- if (pastedData && /(<table)|(<TABLE)/g.test(pastedData)) {
61448
- const matches = Array.from(pastedData.matchAll(regex));
61449
- for (const match of matches) {
61450
- const rowContent = match[1];
61451
- const cellMatches = Array.from(rowContent.matchAll(cellRegex));
61452
- const rowValues = cellMatches.map(cellMatch => {
61453
- return (cellMatch[1]
61454
- .replace(/(<(?!br)([^>]+)>)/gi, '')
61455
- .replace(/<br(\s*|\/)>[\r\n]?/gim, '\n')
61456
- .replace(/&amp;/g, '&')
61457
- .replace(/&lt;/g, '<')
61458
- .replace(/&gt;/g, '>')
61459
- .replace(/&#9;/gi, '\t')
61460
- .replace(/&nbsp;/g, ' '));
61461
- });
61462
- values.push(rowValues);
61463
- pasteValuesColCount = Math.max(pasteValuesColCount, rowValues?.length ?? 0);
61464
- }
61465
- pasteValuesRowCount = values.length ?? 0;
61466
- values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
61467
- const changedCellResults = await table.changeCellValues(col, row, values, true);
61468
- if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
61469
- table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
61470
- col,
61471
- row,
61472
- pasteData: values,
61473
- changedCellResults
61474
- });
61475
- }
61476
- }
61477
- else {
61478
- navigator.clipboard.read().then(clipboardItems => {
61479
- for (const item of clipboardItems) {
61480
- if (item.types.includes('text/plain')) {
61481
- item.getType('text/plain').then((blob) => {
61482
- blob.text().then(_pasteValue);
61483
- });
61484
- }
61485
- }
61486
- });
61487
- }
61488
- });
61489
- });
61490
- }
61491
- async function _pasteValue(pastedData) {
61492
- const ranges = table.stateManager.select.ranges;
61493
- const selectRangeLength = ranges.length;
61494
- const col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
61495
- const row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
61496
- const maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
61497
- const maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
61498
- let pasteValuesColCount = 0;
61499
- let pasteValuesRowCount = 0;
61500
- let values = [];
61501
- const rows = pastedData.split('\n');
61502
- rows.forEach(function (rowCells, rowIndex) {
61503
- const cells = rowCells.split('\t');
61504
- const rowValues = [];
61505
- values.push(rowValues);
61506
- cells.forEach(function (cell, cellIndex) {
61507
- if (cellIndex === cells.length - 1) {
61508
- cell = cell.trim();
61509
- }
61510
- rowValues.push(cell);
61511
- });
61512
- pasteValuesColCount = Math.max(pasteValuesColCount, rowValues?.length ?? 0);
61513
- });
61514
- pasteValuesRowCount = values.length ?? 0;
61515
- values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
61516
- const changedCellResults = await table.changeCellValues(col, row, values, true);
61517
- if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
61518
- table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
61519
- col,
61520
- row,
61521
- pasteData: values,
61522
- changedCellResults
61523
- });
61524
- }
61525
- }
61526
- function pasteTextToTable(item) {
61527
- const ranges = table.stateManager.select.ranges;
61528
- const selectRangeLength = ranges.length;
61529
- const col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
61530
- const row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
61531
- const maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
61532
- const maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
61533
- let pasteValuesColCount = 0;
61534
- let pasteValuesRowCount = 0;
61535
- item.getType('text/plain').then((blob) => {
61536
- blob.text().then(async (pastedData) => {
61537
- const rows = pastedData.replace(/\r(?!\n)/g, '\r\n').split('\r\n');
61538
- let values = [];
61539
- if (rows.length > 1 && rows[rows.length - 1] === '') {
61540
- rows.pop();
61541
- }
61542
- rows.forEach(function (rowCells, rowIndex) {
61543
- const cells = rowCells.split('\t');
61544
- const rowValues = [];
61545
- values.push(rowValues);
61546
- cells.forEach(function (cell, cellIndex) {
61547
- if (cell.includes('\n')) {
61548
- cell = cell
61549
- .replace(/^"(.*)"$/, '$1')
61550
- .replace(/["]*/g, match => new Array(Math.floor(match.length / 2)).fill('"').join(''));
61551
- }
61552
- rowValues.push(cell);
61553
- });
61554
- pasteValuesColCount = Math.max(pasteValuesColCount, rowValues?.length ?? 0);
61555
- });
61556
- pasteValuesRowCount = values.length ?? 0;
61557
- values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
61558
- const changedCellResults = await table.changeCellValues(col, row, values, true);
61559
- if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
61560
- table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
61561
- col,
61562
- row,
61563
- pasteData: values,
61564
- changedCellResults
61565
- });
61566
- }
61567
- });
61568
- });
61569
- }
61570
- function handlePasteValues(values, rowCount, colCount, selectedRowCount, selectedColCount) {
61571
- if (selectedColCount > colCount || selectedRowCount > rowCount) {
61572
- if (selectedColCount % colCount === 0 && selectedRowCount % rowCount === 0) {
61573
- const toPasteValues = [];
61574
- for (let i = 0; i < selectedRowCount; i++) {
61575
- const rowPasteValue = [];
61576
- toPasteValues.push(rowPasteValue);
61577
- for (let j = 0; j < selectedColCount; j++) {
61578
- const copiedRow = i % rowCount;
61579
- const copiedCol = j % colCount;
61580
- rowPasteValue.push(values[copiedRow][copiedCol]);
61581
- }
61582
- }
61583
- return toPasteValues;
61584
- }
61585
- return values;
61586
- }
61587
- return values;
61588
- }
61589
62994
  const globalPointerdownCallback = (e) => {
61590
62995
  if (table.isReleased) {
61591
62996
  return;
@@ -61817,7 +63222,7 @@
61817
63222
  (!table.options.select?.disableSelect ||
61818
63223
  !(typeof table.options.select?.disableSelect === 'function' &&
61819
63224
  table.options.select?.disableSelect?.(targetCol.col, targetRow.row, table)))) {
61820
- table.stateManager.updateSelectPos(targetCol.col, targetRow.row, false, false, false, false);
63225
+ table.stateManager.updateSelectPos(table.stateManager.select.selectInline === 'row' ? table.colCount - 1 : targetCol.col, table.stateManager.select.selectInline === 'col' ? table.rowCount - 1 : targetRow.row, false, false, false, false);
61821
63226
  }
61822
63227
  });
61823
63228
  }
@@ -62437,6 +63842,11 @@
62437
63842
  inertiaScroll;
62438
63843
  bindSparklineHoverEvent;
62439
63844
  _enableTableScroll = true;
63845
+ cutWaitPaste = false;
63846
+ clipboardCheckTimer = null;
63847
+ cutOperationTime = 0;
63848
+ lastClipboardContent = '';
63849
+ cutCellRange = null;
62440
63850
  constructor(table) {
62441
63851
  this.table = table;
62442
63852
  this.handleTextStickBindId = [];
@@ -62561,7 +63971,7 @@
62561
63971
  this.table.stateManager.updateSelectPos(-1, -1);
62562
63972
  return false;
62563
63973
  }
62564
- this.table.stateManager.updateSelectPos(eventArgs.col, eventArgs.row, eventArgs.event.shiftKey, eventArgs.event.ctrlKey || eventArgs.event.metaKey, false, isSelectMoving ? false : this.table.options.select?.makeSelectCellVisible ?? true);
63974
+ this.table.stateManager.updateSelectPos(this.table.stateManager.select.selectInline === 'row' ? this.table.colCount - 1 : eventArgs.col, this.table.stateManager.select.selectInline === 'col' ? this.table.rowCount - 1 : eventArgs.row, eventArgs.event.shiftKey, eventArgs.event.ctrlKey || eventArgs.event.metaKey, false, isSelectMoving ? false : this.table.options.select?.makeSelectCellVisible ?? true);
62565
63975
  return true;
62566
63976
  }
62567
63977
  return false;
@@ -62689,21 +64099,32 @@
62689
64099
  const lastRow = Math.max(this.table.stateManager.select.ranges[this.table.stateManager.select.ranges.length - 1].start.row, this.table.stateManager.select.ranges[this.table.stateManager.select.ranges.length - 1].end.row);
62690
64100
  const startCol = Math.min(this.table.stateManager.select.ranges[this.table.stateManager.select.ranges.length - 1].start.col, this.table.stateManager.select.ranges[this.table.stateManager.select.ranges.length - 1].end.col);
62691
64101
  const startRow = Math.min(this.table.stateManager.select.ranges[this.table.stateManager.select.ranges.length - 1].start.row, this.table.stateManager.select.ranges[this.table.stateManager.select.ranges.length - 1].end.row);
62692
- let lastCellBound;
64102
+ let lastCellBoundTargetX;
62693
64103
  if (lastCol < this.table.colCount - 1) {
62694
- lastCellBound = this.table.scenegraph.highPerformanceGetCell(lastCol, lastRow).globalAABBBounds;
64104
+ const lastCellBound = this.table.scenegraph.highPerformanceGetCell(lastCol, lastRow).globalAABBBounds;
64105
+ lastCellBoundTargetX = lastCellBound.x2;
62695
64106
  }
62696
64107
  else {
62697
- lastCellBound = this.table.scenegraph.highPerformanceGetCell(startCol - 1, lastRow).globalAABBBounds;
64108
+ if (startCol === 0) {
64109
+ const lastCellBound = this.table.scenegraph.highPerformanceGetCell(0, lastRow).globalAABBBounds;
64110
+ lastCellBoundTargetX = lastCellBound.x1;
64111
+ }
64112
+ else {
64113
+ const lastCellBound = this.table.scenegraph.highPerformanceGetCell(startCol - 1, lastRow).globalAABBBounds;
64114
+ lastCellBoundTargetX = lastCellBound.x2;
64115
+ }
62698
64116
  }
62699
- const distanceX = Math.abs(eventArgsSet.abstractPos.x - lastCellBound.x2);
64117
+ const distanceX = Math.abs(eventArgsSet.abstractPos.x - lastCellBoundTargetX);
64118
+ let lastCellBoundTargetY;
62700
64119
  if (lastRow < this.table.rowCount - 1) {
62701
- lastCellBound = this.table.scenegraph.highPerformanceGetCell(lastCol, lastRow).globalAABBBounds;
64120
+ const lastCellBound = this.table.scenegraph.highPerformanceGetCell(lastCol, lastRow).globalAABBBounds;
64121
+ lastCellBoundTargetY = lastCellBound.y2;
62702
64122
  }
62703
64123
  else {
62704
- lastCellBound = this.table.scenegraph.highPerformanceGetCell(lastCol, startRow - 1).globalAABBBounds;
64124
+ const lastCellBound = this.table.scenegraph.highPerformanceGetCell(lastCol, startRow - 1).globalAABBBounds;
64125
+ lastCellBoundTargetY = lastCellBound.y2;
62705
64126
  }
62706
- const distanceY = Math.abs(eventArgsSet.abstractPos.y - lastCellBound.y2);
64127
+ const distanceY = Math.abs(eventArgsSet.abstractPos.y - lastCellBoundTargetY);
62707
64128
  const squareSize = 6 * 3;
62708
64129
  if (this.table.stateManager.fillHandle?.isFilling ||
62709
64130
  (distanceX <= squareSize / 2 && distanceY <= squareSize / 2)) {
@@ -62804,6 +64225,383 @@
62804
64225
  disableScroll() {
62805
64226
  this._enableTableScroll = false;
62806
64227
  }
64228
+ async handleCopy(e, isCut = false) {
64229
+ const table = this.table;
64230
+ !isCut && (this.cutWaitPaste = false);
64231
+ const data = this.table.getCopyValue();
64232
+ if (isValid$3(data)) {
64233
+ e.preventDefault();
64234
+ const permissionState = await navigator.permissions.query({ name: 'clipboard-write' });
64235
+ if (navigator.clipboard?.write && permissionState.state === 'granted') {
64236
+ const setDataToHTML = (data) => {
64237
+ const result = ['<table>'];
64238
+ const META_HEAD = [
64239
+ '<meta name="author" content="Visactor"/>',
64240
+ '<style type="text/css">td{white-space:normal}br{mso-data-placement:same-cell}</style>'
64241
+ ].join('');
64242
+ const rows = data.split('\r\n');
64243
+ rows.forEach(function (rowCells, rowIndex) {
64244
+ const cells = rowCells.split('\t');
64245
+ const rowValues = [];
64246
+ if (rowIndex === 0) {
64247
+ result.push('<tbody>');
64248
+ }
64249
+ cells.forEach(function (cell, cellIndex) {
64250
+ const parsedCellData = !cell
64251
+ ? ' '
64252
+ : cell
64253
+ .toString()
64254
+ .replace(/&/g, '&amp;')
64255
+ .replace(/'/g, '&#39;')
64256
+ .replace(/</g, '&lt;')
64257
+ .replace(/>/g, '&gt;')
64258
+ .replace(/\n/g, '<br>')
64259
+ .replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g, '<br>\r\n')
64260
+ .replace(/\x20{2,}/gi, (substring) => {
64261
+ return `<span style="mso-spacerun: yes">${'&nbsp;'.repeat(substring.length - 1)} </span>`;
64262
+ })
64263
+ .replace(/\t/gi, '&#9;');
64264
+ rowValues.push(`<td>${parsedCellData}</td>`);
64265
+ });
64266
+ result.push('<tr>', ...rowValues, '</tr>');
64267
+ if (rowIndex === rows.length - 1) {
64268
+ result.push('</tbody>');
64269
+ }
64270
+ });
64271
+ result.push('</table>');
64272
+ return [META_HEAD, result.join('')].join('');
64273
+ };
64274
+ const dataHTML = setDataToHTML(data);
64275
+ navigator.clipboard.write([
64276
+ new ClipboardItem({
64277
+ 'text/html': new Blob([dataHTML], { type: 'text/html' }),
64278
+ 'text/plain': new Blob([data], { type: 'text/plain' })
64279
+ })
64280
+ ]);
64281
+ }
64282
+ else {
64283
+ if (browser.IE) {
64284
+ window.clipboardData.setData('Text', data);
64285
+ }
64286
+ else {
64287
+ e.clipboardData.setData('text/plain', data);
64288
+ }
64289
+ }
64290
+ table.fireListeners(TABLE_EVENT_TYPE.COPY_DATA, {
64291
+ cellRange: table.stateManager.select.ranges,
64292
+ copyData: data,
64293
+ isCut
64294
+ });
64295
+ }
64296
+ if (table.keyboardOptions?.showCopyCellBorder) {
64297
+ setActiveCellRangeState(table);
64298
+ table.clearSelected();
64299
+ }
64300
+ }
64301
+ async handleCut(e) {
64302
+ this.handleCopy(e, true);
64303
+ this.cutWaitPaste = true;
64304
+ this.cutCellRange = this.table.getSelectedCellInfos();
64305
+ if (this.clipboardCheckTimer) {
64306
+ clearTimeout(this.clipboardCheckTimer);
64307
+ }
64308
+ this.clipboardCheckTimer = window.setTimeout(() => {
64309
+ if (this.cutWaitPaste) {
64310
+ this.cutWaitPaste = false;
64311
+ this.cutCellRange = null;
64312
+ this.clipboardCheckTimer = null;
64313
+ }
64314
+ }, 30000);
64315
+ this.saveClipboardContent();
64316
+ }
64317
+ handlePaste(e) {
64318
+ if (!this.cutWaitPaste) {
64319
+ this.executePaste(e);
64320
+ return;
64321
+ }
64322
+ this.checkClipboardChanged()
64323
+ .then(changed => {
64324
+ this.executePaste(e);
64325
+ if (!changed) {
64326
+ this.clearCutArea(this.table);
64327
+ }
64328
+ if (this.cutWaitPaste) {
64329
+ this.cutWaitPaste = false;
64330
+ this.cutCellRange = null;
64331
+ if (this.clipboardCheckTimer) {
64332
+ clearTimeout(this.clipboardCheckTimer);
64333
+ this.clipboardCheckTimer = null;
64334
+ }
64335
+ }
64336
+ })
64337
+ .catch(() => {
64338
+ this.executePaste(e);
64339
+ if (this.cutWaitPaste) {
64340
+ this.cutWaitPaste = false;
64341
+ this.cutCellRange = null;
64342
+ if (this.clipboardCheckTimer) {
64343
+ clearTimeout(this.clipboardCheckTimer);
64344
+ this.clipboardCheckTimer = null;
64345
+ }
64346
+ }
64347
+ });
64348
+ }
64349
+ async executePaste(e) {
64350
+ const table = this.table;
64351
+ if (table.changeCellValues) {
64352
+ if (table.editorManager?.editingEditor) {
64353
+ return;
64354
+ }
64355
+ if (table.stateManager.select.ranges?.length > 0) {
64356
+ if (navigator.clipboard?.read) {
64357
+ navigator.clipboard.read().then(clipboardItems => {
64358
+ for (const item of clipboardItems) {
64359
+ if (item.types.includes('text/html')) {
64360
+ this.pasteHtmlToTable(item);
64361
+ }
64362
+ else if (item.types.length === 1 && item.types[0] === 'text/plain') {
64363
+ this.pasteTextToTable(item);
64364
+ }
64365
+ else ;
64366
+ }
64367
+ });
64368
+ }
64369
+ else {
64370
+ const ranges = table.stateManager.select.ranges;
64371
+ const col = Math.min(ranges[0].start.col, ranges[0].end.col);
64372
+ const row = Math.min(ranges[0].start.row, ranges[0].end.row);
64373
+ const clipboardData = e.clipboardData || window.Clipboard;
64374
+ const pastedData = clipboardData.getData('text');
64375
+ const rows = pastedData.split('\n');
64376
+ const values = [];
64377
+ rows.forEach(function (rowCells, rowIndex) {
64378
+ const cells = rowCells.split('\t');
64379
+ const rowValues = [];
64380
+ values.push(rowValues);
64381
+ cells.forEach(function (cell, cellIndex) {
64382
+ if (cellIndex === cells.length - 1) {
64383
+ cell = cell.trim();
64384
+ }
64385
+ rowValues.push(cell);
64386
+ });
64387
+ });
64388
+ const changedCellResults = await table.changeCellValues(col, row, values);
64389
+ if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
64390
+ table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
64391
+ col,
64392
+ row,
64393
+ pasteData: values,
64394
+ changedCellResults
64395
+ });
64396
+ }
64397
+ }
64398
+ }
64399
+ }
64400
+ if (table.keyboardOptions?.showCopyCellBorder) {
64401
+ clearActiveCellRangeState(table);
64402
+ }
64403
+ }
64404
+ clearCutArea(table) {
64405
+ try {
64406
+ const selectCells = this.cutCellRange;
64407
+ if (!selectCells || selectCells.length === 0) {
64408
+ return;
64409
+ }
64410
+ for (let i = 0; i < selectCells.length; i++) {
64411
+ for (let j = 0; j < selectCells[i].length; j++) {
64412
+ if (selectCells[i][j]) {
64413
+ table.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, undefined);
64414
+ }
64415
+ }
64416
+ }
64417
+ }
64418
+ catch (error) {
64419
+ }
64420
+ }
64421
+ async checkClipboardChanged() {
64422
+ if (!navigator.clipboard || !navigator.clipboard.readText) {
64423
+ return false;
64424
+ }
64425
+ try {
64426
+ const currentContent = await navigator.clipboard.readText();
64427
+ return currentContent !== this.lastClipboardContent;
64428
+ }
64429
+ catch (err) {
64430
+ return false;
64431
+ }
64432
+ }
64433
+ saveClipboardContent() {
64434
+ if (navigator.clipboard && navigator.clipboard.readText) {
64435
+ setTimeout(() => {
64436
+ navigator.clipboard
64437
+ .readText()
64438
+ .then(text => {
64439
+ this.lastClipboardContent = text;
64440
+ })
64441
+ .catch(err => {
64442
+ });
64443
+ }, 50);
64444
+ }
64445
+ }
64446
+ pasteHtmlToTable(item) {
64447
+ const regex = /<tr[^>]*>([\s\S]*?)<\/tr>/g;
64448
+ const cellRegex = /<td[^>]*>([\s\S]*?)<\/td>/g;
64449
+ const table = this.table;
64450
+ const ranges = table.stateManager.select.ranges;
64451
+ const selectRangeLength = ranges.length;
64452
+ const col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
64453
+ const row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
64454
+ const maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
64455
+ const maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
64456
+ let pasteValuesColCount = 0;
64457
+ let pasteValuesRowCount = 0;
64458
+ let values = [];
64459
+ item.getType('text/html').then((blob) => {
64460
+ blob.text().then(async (pastedData) => {
64461
+ if (pastedData && /(<table)|(<TABLE)/g.test(pastedData)) {
64462
+ const matches = Array.from(pastedData.matchAll(regex));
64463
+ for (const match of matches) {
64464
+ const rowContent = match[1];
64465
+ const cellMatches = Array.from(rowContent.matchAll(cellRegex));
64466
+ const rowValues = cellMatches.map(cellMatch => {
64467
+ return (cellMatch[1]
64468
+ .replace(/(<(?!br)([^>]+)>)/gi, '')
64469
+ .replace(/<br(\s*|\/)>[\r\n]?/gim, '\n')
64470
+ .replace(/&amp;/g, '&')
64471
+ .replace(/&lt;/g, '<')
64472
+ .replace(/&gt;/g, '>')
64473
+ .replace(/&#9;/gi, '\t')
64474
+ .replace(/&nbsp;/g, ' '));
64475
+ });
64476
+ values.push(rowValues);
64477
+ pasteValuesColCount = Math.max(pasteValuesColCount, rowValues?.length ?? 0);
64478
+ }
64479
+ pasteValuesRowCount = values.length ?? 0;
64480
+ values = this.handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
64481
+ const changedCellResults = await table.changeCellValues(col, row, values, true);
64482
+ if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
64483
+ table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
64484
+ col,
64485
+ row,
64486
+ pasteData: values,
64487
+ changedCellResults
64488
+ });
64489
+ }
64490
+ }
64491
+ else {
64492
+ navigator.clipboard.read().then(clipboardItems => {
64493
+ for (const item of clipboardItems) {
64494
+ if (item.types.includes('text/plain')) {
64495
+ item.getType('text/plain').then((blob) => {
64496
+ blob.text().then(this._pasteValue);
64497
+ });
64498
+ }
64499
+ }
64500
+ });
64501
+ }
64502
+ });
64503
+ });
64504
+ }
64505
+ async _pasteValue(pastedData) {
64506
+ const table = this.table;
64507
+ const ranges = table.stateManager.select.ranges;
64508
+ const selectRangeLength = ranges.length;
64509
+ const col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
64510
+ const row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
64511
+ const maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
64512
+ const maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
64513
+ let pasteValuesColCount = 0;
64514
+ let pasteValuesRowCount = 0;
64515
+ let values = [];
64516
+ const rows = pastedData.split('\n');
64517
+ rows.forEach(function (rowCells, rowIndex) {
64518
+ const cells = rowCells.split('\t');
64519
+ const rowValues = [];
64520
+ values.push(rowValues);
64521
+ cells.forEach(function (cell, cellIndex) {
64522
+ if (cellIndex === cells.length - 1) {
64523
+ cell = cell.trim();
64524
+ }
64525
+ rowValues.push(cell);
64526
+ });
64527
+ pasteValuesColCount = Math.max(pasteValuesColCount, rowValues?.length ?? 0);
64528
+ });
64529
+ pasteValuesRowCount = values.length ?? 0;
64530
+ values = this.handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
64531
+ const changedCellResults = await table.changeCellValues(col, row, values, true);
64532
+ if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
64533
+ table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
64534
+ col,
64535
+ row,
64536
+ pasteData: values,
64537
+ changedCellResults
64538
+ });
64539
+ }
64540
+ }
64541
+ pasteTextToTable(item) {
64542
+ const table = this.table;
64543
+ const ranges = table.stateManager.select.ranges;
64544
+ const selectRangeLength = ranges.length;
64545
+ const col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
64546
+ const row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
64547
+ const maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
64548
+ const maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
64549
+ let pasteValuesColCount = 0;
64550
+ let pasteValuesRowCount = 0;
64551
+ item.getType('text/plain').then((blob) => {
64552
+ blob.text().then(async (pastedData) => {
64553
+ const rows = pastedData.replace(/\r(?!\n)/g, '\r\n').split('\r\n');
64554
+ let values = [];
64555
+ if (rows.length > 1 && rows[rows.length - 1] === '') {
64556
+ rows.pop();
64557
+ }
64558
+ rows.forEach(function (rowCells, rowIndex) {
64559
+ const cells = rowCells.split('\t');
64560
+ const rowValues = [];
64561
+ values.push(rowValues);
64562
+ cells.forEach(function (cell, cellIndex) {
64563
+ if (cell.includes('\n')) {
64564
+ cell = cell
64565
+ .replace(/^"(.*)"$/, '$1')
64566
+ .replace(/["]*/g, match => new Array(Math.floor(match.length / 2)).fill('"').join(''));
64567
+ }
64568
+ rowValues.push(cell);
64569
+ });
64570
+ pasteValuesColCount = Math.max(pasteValuesColCount, rowValues?.length ?? 0);
64571
+ });
64572
+ pasteValuesRowCount = values.length ?? 0;
64573
+ values = this.handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
64574
+ const changedCellResults = await table.changeCellValues(col, row, values, true);
64575
+ if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
64576
+ table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
64577
+ col,
64578
+ row,
64579
+ pasteData: values,
64580
+ changedCellResults
64581
+ });
64582
+ }
64583
+ });
64584
+ });
64585
+ }
64586
+ handlePasteValues(values, rowCount, colCount, selectedRowCount, selectedColCount) {
64587
+ if (selectedColCount > colCount || selectedRowCount > rowCount) {
64588
+ if (selectedColCount % colCount === 0 && selectedRowCount % rowCount === 0) {
64589
+ const toPasteValues = [];
64590
+ for (let i = 0; i < selectedRowCount; i++) {
64591
+ const rowPasteValue = [];
64592
+ toPasteValues.push(rowPasteValue);
64593
+ for (let j = 0; j < selectedColCount; j++) {
64594
+ const copiedRow = i % rowCount;
64595
+ const copiedCol = j % colCount;
64596
+ rowPasteValue.push(values[copiedRow][copiedCol]);
64597
+ }
64598
+ }
64599
+ return toPasteValues;
64600
+ }
64601
+ return values;
64602
+ }
64603
+ return values;
64604
+ }
62807
64605
  }
62808
64606
 
62809
64607
  let defaultStyle$4;
@@ -65900,7 +67698,7 @@
65900
67698
  for (let col = startCol; col >= 0; col--) {
65901
67699
  const width = _this.getColWidth(col);
65902
67700
  const left = right - width;
65903
- if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) {
67701
+ if (Math.round(left) <= absoluteX && absoluteX < Math.round(right)) {
65904
67702
  return {
65905
67703
  left,
65906
67704
  col,
@@ -65918,7 +67716,7 @@
65918
67716
  for (let col = startCol; col < colCount; col++) {
65919
67717
  const width = _this.getColWidth(col);
65920
67718
  const right = left + width;
65921
- if (Math.round(left) <= Math.round(absoluteX) && Math.round(absoluteX) < Math.round(right)) {
67719
+ if (Math.round(left) <= absoluteX && absoluteX < Math.round(right)) {
65922
67720
  return {
65923
67721
  left,
65924
67722
  col,
@@ -67454,6 +69252,8 @@
67454
69252
  customRender;
67455
69253
  canvasWidth;
67456
69254
  canvasHeight;
69255
+ contentOffsetX;
69256
+ contentOffsetY;
67457
69257
  _vDataSet;
67458
69258
  scenegraph;
67459
69259
  stateManager;
@@ -67466,7 +69266,7 @@
67466
69266
  return TABLE_EVENT_TYPE;
67467
69267
  }
67468
69268
  options;
67469
- version = "1.0.14";
69269
+ version = "1.0.16";
67470
69270
  pagination;
67471
69271
  id = `VTable${Date.now()}`;
67472
69272
  headerStyleCache;
@@ -67506,7 +69306,7 @@
67506
69306
  if (options.customConfig?.imageAnonymous === false) {
67507
69307
  vglobal.isImageAnonymous = false;
67508
69308
  }
67509
- const { frozenColCount = 0, unfreezeAllOnExceedsMaxWidth, frozenRowCount, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth, widthMode = 'standard', heightMode = 'standard', autoFillWidth = false, autoFillHeight = false, containerFit = { width: false, height: false }, widthAdaptiveMode = 'only-body', heightAdaptiveMode = 'only-body', keyboardOptions, eventOptions, rowSeriesNumber, enableCheckboxCascade, enableHeaderCheckboxCascade, columnResizeMode, rowResizeMode = 'none', resize, dragHeaderMode, dragOrder, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, customRender, pixelRatio = defaultPixelRatio, renderChartAsync, renderChartAsyncBatchCount, mode, modeParams, canvasWidth, canvasHeight, overscrollBehavior, limitMinWidth, limitMinHeight, clearDOM = true } = options;
69309
+ const { frozenColCount = 0, unfreezeAllOnExceedsMaxWidth, frozenRowCount, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth, widthMode = 'standard', heightMode = 'standard', autoFillWidth = false, autoFillHeight = false, containerFit = { width: false, height: false }, widthAdaptiveMode = 'only-body', heightAdaptiveMode = 'only-body', keyboardOptions, eventOptions, rowSeriesNumber, enableCheckboxCascade, enableHeaderCheckboxCascade, columnResizeMode, rowResizeMode = 'none', resize, dragHeaderMode, dragOrder, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, customRender, pixelRatio = defaultPixelRatio, renderChartAsync, renderChartAsyncBatchCount, mode, modeParams, canvasWidth, canvasHeight, contentOffsetX: translateX, contentOffsetY: translateY, overscrollBehavior, limitMinWidth, limitMinHeight, clearDOM = true } = options;
67510
69310
  const { groupConfig, groupBy, groupTitleFieldFormat, groupTitleCustomLayout, enableTreeStickCell } = options;
67511
69311
  this.container = container;
67512
69312
  this.options = options;
@@ -67551,6 +69351,8 @@
67551
69351
  }
67552
69352
  this.tableNoFrameWidth = 0;
67553
69353
  this.tableNoFrameHeight = 0;
69354
+ this.contentOffsetX = translateX ?? 0;
69355
+ this.contentOffsetY = translateY ?? 0;
67554
69356
  this.canvasWidth = isNumber$4(canvasWidth) ? canvasWidth : undefined;
67555
69357
  this.canvasHeight = isNumber$4(canvasHeight) ? canvasHeight : undefined;
67556
69358
  this.columnWidthComputeMode = options.columnWidthComputeMode ?? 'normal';
@@ -67788,6 +69590,13 @@
67788
69590
  this.options.canvasWidth = canvasWidth;
67789
69591
  this.resize();
67790
69592
  }
69593
+ setContentInsetXY(contentOffsetX, contentOffsetY) {
69594
+ this.contentOffsetX = contentOffsetX;
69595
+ this.contentOffsetY = contentOffsetY;
69596
+ this.options.contentOffsetX = contentOffsetX;
69597
+ this.options.contentOffsetY = contentOffsetY;
69598
+ this.resize();
69599
+ }
67791
69600
  resize() {
67792
69601
  this._updateSize();
67793
69602
  this.internalProps.legends?.forEach(legend => {
@@ -67872,6 +69681,11 @@
67872
69681
  return this.internalProps?.layoutMap?.frozenRowCount ?? this.internalProps?.frozenRowCount ?? 0;
67873
69682
  }
67874
69683
  set frozenRowCount(frozenRowCount) {
69684
+ this.internalProps.frozenRowCount = frozenRowCount;
69685
+ this.options.frozenRowCount = frozenRowCount;
69686
+ this.stateManager.setFrozenRow(this.internalProps.frozenRowCount);
69687
+ }
69688
+ _setFrozenRowCount(frozenRowCount) {
67875
69689
  this.internalProps.frozenRowCount = frozenRowCount;
67876
69690
  this.stateManager.setFrozenRow(this.internalProps.frozenRowCount);
67877
69691
  }
@@ -68080,8 +69894,8 @@
68080
69894
  const { padding } = this;
68081
69895
  let widthP = 0;
68082
69896
  let heightP = 0;
68083
- this.tableX = 0;
68084
- this.tableY = 0;
69897
+ this.tableX = this.contentOffsetX;
69898
+ this.tableY = this.contentOffsetY;
68085
69899
  if (this.options.canvas && this.options.viewBox) {
68086
69900
  widthP = this.options.viewBox.x2 - this.options.viewBox.x1;
68087
69901
  heightP = this.options.viewBox.y2 - this.options.viewBox.y1;
@@ -68175,24 +69989,26 @@
68175
69989
  const lineWidths = toBoxArray(this.internalProps.theme.frameStyle?.borderLineWidth ?? [null]);
68176
69990
  const shadowWidths = toBoxArray(this.internalProps.theme.frameStyle?.shadowBlur ?? [0]);
68177
69991
  if (this.theme.frameStyle?.innerBorder) {
68178
- this.tableX = 0;
68179
- this.tableY = 0;
68180
- this.tableNoFrameWidth = width - (shadowWidths[1] ?? 0);
68181
- this.tableNoFrameHeight = height - (shadowWidths[2] ?? 0);
69992
+ this.tableX += this.contentOffsetX;
69993
+ this.tableY += this.contentOffsetY;
69994
+ this.tableNoFrameWidth = width - (shadowWidths[1] ?? 0) - this.contentOffsetX;
69995
+ this.tableNoFrameHeight = height - (shadowWidths[2] ?? 0) - this.contentOffsetY;
68182
69996
  }
68183
69997
  else {
68184
- this.tableX = (lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0);
68185
- this.tableY = (lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0);
69998
+ this.tableX += (lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0);
69999
+ this.tableY += (lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0);
68186
70000
  const rightBorder = (lineWidths[1] ?? 0) + (shadowWidths[1] ?? 0);
68187
70001
  this.tableNoFrameWidth =
68188
70002
  width -
68189
70003
  (rightBorder > vScrollBarWidth ? rightBorder - vScrollBarWidth : 0) -
68190
- ((lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0));
70004
+ ((lineWidths[3] ?? 0) + (shadowWidths[3] ?? 0)) -
70005
+ this.contentOffsetX;
68191
70006
  const bottomBorder = (lineWidths[2] ?? 0) + (shadowWidths[2] ?? 0);
68192
70007
  this.tableNoFrameHeight =
68193
70008
  height -
68194
70009
  (bottomBorder > hScrollBarWidth ? bottomBorder - hScrollBarWidth : 0) -
68195
- ((lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0));
70010
+ ((lineWidths[0] ?? 0) + (shadowWidths[0] ?? 0)) -
70011
+ this.contentOffsetY;
68196
70012
  }
68197
70013
  }
68198
70014
  this._clearColRangeWidthsMap();
@@ -69006,6 +70822,7 @@
69006
70822
  internalProps.tooltipHandler?.release?.();
69007
70823
  internalProps.menuHandler?.release?.();
69008
70824
  super.release?.();
70825
+ this.pluginManager.release();
69009
70826
  internalProps.handler?.release?.();
69010
70827
  this.eventManager.release();
69011
70828
  internalProps.focusControl?.release?.();
@@ -69033,17 +70850,20 @@
69033
70850
  this.scenegraph = null;
69034
70851
  this.internalProps = null;
69035
70852
  this.reactCustomLayout?.clearCache();
69036
- this.pluginManager.release();
69037
70853
  clearChartRenderQueue();
69038
70854
  }
69039
70855
  fireListeners(type, event) {
69040
70856
  return super.fireListeners(type, event);
69041
70857
  }
69042
- updateOption(options) {
70858
+ updateOption(options, updateConfig = {
70859
+ clearColWidthCache: true,
70860
+ clearRowHeightCache: true
70861
+ }) {
70862
+ this.fireListeners(TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION, { options, container: this.container });
69043
70863
  this.editorManager?.cancelEdit();
69044
70864
  this.options = options;
69045
70865
  this._hasAutoImageColumn = undefined;
69046
- const { frozenColCount = 0, unfreezeAllOnExceedsMaxWidth, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth = 80, keyboardOptions, eventOptions, rowSeriesNumber, enableCheckboxCascade, enableHeaderCheckboxCascade, columnResizeMode, rowResizeMode = 'none', resize, dragHeaderMode, dragOrder, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, pixelRatio, widthMode, heightMode, autoFillWidth, autoFillHeight, containerFit, widthAdaptiveMode, heightAdaptiveMode, customRender, renderChartAsync, renderChartAsyncBatchCount, canvasWidth, canvasHeight, overscrollBehavior, limitMinWidth, limitMinHeight } = options;
70866
+ const { frozenColCount = 0, unfreezeAllOnExceedsMaxWidth, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth = 80, keyboardOptions, eventOptions, rowSeriesNumber, enableCheckboxCascade, enableHeaderCheckboxCascade, columnResizeMode, rowResizeMode = 'none', resize, dragHeaderMode, dragOrder, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, pixelRatio, widthMode, heightMode, autoFillWidth, autoFillHeight, containerFit, widthAdaptiveMode, heightAdaptiveMode, customRender, renderChartAsync, renderChartAsyncBatchCount, canvasWidth, canvasHeight, contentOffsetX: translateX = 0, contentOffsetY: translateY = 0, overscrollBehavior, limitMinWidth, limitMinHeight } = options;
69047
70867
  const { groupConfig, groupBy, groupTitleFieldFormat, groupTitleCustomLayout, enableTreeStickCell } = options;
69048
70868
  if (pixelRatio && pixelRatio !== this.internalProps.pixelRatio) {
69049
70869
  this.internalProps.pixelRatio = pixelRatio;
@@ -69087,6 +70907,8 @@
69087
70907
  }
69088
70908
  }
69089
70909
  this.customRender = customRender;
70910
+ this.contentOffsetX = translateX ?? 0;
70911
+ this.contentOffsetY = translateY ?? 0;
69090
70912
  this.canvasWidth = isNumber$4(canvasWidth) ? canvasWidth : undefined;
69091
70913
  this.canvasHeight = isNumber$4(canvasHeight) ? canvasHeight : undefined;
69092
70914
  const internalProps = this.internalProps;
@@ -69119,14 +70941,18 @@
69119
70941
  internalProps.groupTitleCustomLayout =
69120
70942
  groupConfig?.titleCustomLayout ?? groupTitleCustomLayout;
69121
70943
  internalProps.enableTreeStickCell = groupConfig?.enableTreeStickCell ?? enableTreeStickCell;
69122
- internalProps._rowHeightsMap = new NumberRangeMap(this);
69123
- internalProps._rowRangeHeightsMap = new Map();
69124
- internalProps._colRangeWidthsMap = new Map();
69125
- internalProps._widthResizedColMap = new Set();
69126
- internalProps._heightResizedRowMap = new Set();
69127
- this.colWidthsMap = new NumberMap();
69128
- this.colContentWidthsMap = new NumberMap();
69129
- this.colWidthsLimit = {};
70944
+ if (updateConfig?.clearColWidthCache) {
70945
+ internalProps._widthResizedColMap.clear();
70946
+ this.colWidthsMap = new NumberMap();
70947
+ this.colContentWidthsMap = new NumberMap();
70948
+ this.colWidthsLimit = {};
70949
+ }
70950
+ if (updateConfig?.clearRowHeightCache) {
70951
+ internalProps._heightResizedRowMap.clear();
70952
+ internalProps._rowHeightsMap = new NumberRangeMap(this);
70953
+ internalProps._rowRangeHeightsMap = new Map();
70954
+ internalProps._colRangeWidthsMap = new Map();
70955
+ }
69130
70956
  internalProps.stick.changedCells.clear();
69131
70957
  internalProps.theme = themes.of(options.theme ?? themes.DEFAULT);
69132
70958
  internalProps.theme.isPivot = this.isPivotTable();
@@ -69210,8 +71036,12 @@
69210
71036
  internalProps.menuHandler = new MenuHandler(this);
69211
71037
  }
69212
71038
  this.clearCellStyleCache();
69213
- this.clearColWidthCache();
69214
- this.clearRowHeightCache();
71039
+ if (updateConfig?.clearColWidthCache) {
71040
+ this.clearColWidthCache();
71041
+ }
71042
+ if (updateConfig?.clearRowHeightCache) {
71043
+ this.clearRowHeightCache();
71044
+ }
69215
71045
  internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell);
69216
71046
  this.customCellStylePlugin?.updateCustomCell(options.customCellStyle ?? [], options.customCellStyleArrangement ?? []);
69217
71047
  this._adjustCanvasSizeByOption();
@@ -69341,13 +71171,17 @@
69341
71171
  selectCells(cellRanges) {
69342
71172
  const { scrollLeft, scrollTop } = this;
69343
71173
  cellRanges.forEach((cellRange, index) => {
69344
- if (cellRange.start.col === cellRange.end.col && cellRange.start.row === cellRange.end.row) {
69345
- this.stateManager.updateSelectPos(cellRange.start.col, cellRange.start.row, false, index >= 1, false, this.options.select?.makeSelectCellVisible ?? true, true);
71174
+ const startRow = cellRange.start.row;
71175
+ const startCol = cellRange.start.col;
71176
+ const endRow = cellRange.end.row;
71177
+ const endCol = cellRange.end.col;
71178
+ if (startCol === endCol && startRow === endRow) {
71179
+ this.stateManager.updateSelectPos(startCol, startRow, false, index >= 1, false, this.options.select?.makeSelectCellVisible ?? true, true);
69346
71180
  }
69347
71181
  else {
69348
- this.stateManager.updateSelectPos(cellRange.start.col, cellRange.start.row, false, index >= 1, false, this.options.select?.makeSelectCellVisible ?? true, true);
71182
+ this.stateManager.updateSelectPos(startCol, startRow, false, index >= 1, false, this.options.select?.makeSelectCellVisible ?? true, true);
69349
71183
  this.stateManager.updateInteractionState(InteractionState.grabing);
69350
- this.stateManager.updateSelectPos(cellRange.end.col, cellRange.end.row, false, index >= 1, false, this.options.select?.makeSelectCellVisible ?? true, true);
71184
+ this.stateManager.updateSelectPos(endCol, endRow, false, index >= 1, false, this.options.select?.makeSelectCellVisible ?? true, true);
69351
71185
  }
69352
71186
  this.stateManager.endSelectCells(false, false);
69353
71187
  this.stateManager.updateInteractionState(InteractionState.default);
@@ -69355,6 +71189,96 @@
69355
71189
  this.setScrollTop(scrollTop);
69356
71190
  this.setScrollLeft(scrollLeft);
69357
71191
  }
71192
+ selectRow(rowIndex, isCtrl, isShift) {
71193
+ const currentSelectRanges = this.stateManager.select.ranges;
71194
+ if (isCtrl) {
71195
+ currentSelectRanges.push({
71196
+ start: { col: 0, row: rowIndex },
71197
+ end: { col: this.colCount - 1, row: rowIndex }
71198
+ });
71199
+ this.selectCells(currentSelectRanges);
71200
+ }
71201
+ else if (isShift) {
71202
+ const lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
71203
+ if (lastSelectRange) {
71204
+ lastSelectRange.end.row = rowIndex;
71205
+ }
71206
+ this.selectCells(currentSelectRanges);
71207
+ }
71208
+ else {
71209
+ this.selectCells([
71210
+ {
71211
+ start: { col: 0, row: rowIndex },
71212
+ end: { col: this.colCount - 1, row: rowIndex }
71213
+ }
71214
+ ]);
71215
+ }
71216
+ }
71217
+ selectCol(colIndex, isCtrl, isShift) {
71218
+ const currentSelectRanges = this.stateManager.select.ranges;
71219
+ if (isCtrl) {
71220
+ currentSelectRanges.push({
71221
+ start: { col: colIndex, row: 0 },
71222
+ end: { col: colIndex, row: this.rowCount - 1 }
71223
+ });
71224
+ this.selectCells(currentSelectRanges);
71225
+ }
71226
+ else if (isShift) {
71227
+ const lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
71228
+ if (lastSelectRange) {
71229
+ lastSelectRange.end.col = colIndex;
71230
+ }
71231
+ this.selectCells(currentSelectRanges);
71232
+ }
71233
+ else {
71234
+ this.selectCells([
71235
+ {
71236
+ start: { col: colIndex, row: 0 },
71237
+ end: { col: colIndex, row: this.rowCount - 1 }
71238
+ }
71239
+ ]);
71240
+ }
71241
+ }
71242
+ startDragSelectCol(colIndex, isCtrl, isShift) {
71243
+ const lastSelectRange = this.stateManager.select.ranges[this.stateManager.select.ranges.length - 1];
71244
+ const startCol = isShift && lastSelectRange?.start?.col ? lastSelectRange?.start?.col : colIndex;
71245
+ const startRow = 0;
71246
+ const endCol = colIndex;
71247
+ const endRow = this.rowCount - 1;
71248
+ this.stateManager.updateSelectPos(startCol, startRow, isShift, isCtrl, false, this.options.select?.makeSelectCellVisible ?? true, true);
71249
+ this.stateManager.updateInteractionState(InteractionState.grabing);
71250
+ this.stateManager.updateSelectPos(endCol, endRow, isShift, isCtrl, false, this.options.select?.makeSelectCellVisible ?? true, true);
71251
+ }
71252
+ dragSelectCol(colIndex, isCtrl) {
71253
+ const currentSelectRanges = this.stateManager.select.ranges;
71254
+ const lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
71255
+ if (lastSelectRange) {
71256
+ lastSelectRange.end.col = colIndex;
71257
+ }
71258
+ this.stateManager.updateSelectPos(colIndex, this.rowCount - 1, false, isCtrl, false, this.options.select?.makeSelectCellVisible ?? true, true);
71259
+ }
71260
+ endDragSelect() {
71261
+ this.stateManager.updateInteractionState(InteractionState.default);
71262
+ this.stateManager.endSelectCells(false, false);
71263
+ }
71264
+ startDragSelectRow(rowIndex, isCtrl, isShift) {
71265
+ const lastSelectRange = this.stateManager.select.ranges[this.stateManager.select.ranges.length - 1];
71266
+ const startCol = 0;
71267
+ const startRow = isShift && lastSelectRange?.start?.row ? lastSelectRange?.start?.row : rowIndex;
71268
+ const endCol = this.colCount - 1;
71269
+ const endRow = rowIndex;
71270
+ this.stateManager.updateSelectPos(startCol, startRow, isShift, isCtrl, false, this.options.select?.makeSelectCellVisible ?? true, true);
71271
+ this.stateManager.updateInteractionState(InteractionState.grabing);
71272
+ this.stateManager.updateSelectPos(endCol, endRow, isShift, isCtrl, false, this.options.select?.makeSelectCellVisible ?? true, true);
71273
+ }
71274
+ dragSelectRow(rowIndex, isCtrl) {
71275
+ const currentSelectRanges = this.stateManager.select.ranges;
71276
+ const lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
71277
+ if (lastSelectRange) {
71278
+ lastSelectRange.end.row = rowIndex;
71279
+ }
71280
+ this.stateManager.updateSelectPos(this.colCount - 1, rowIndex, false, isCtrl, false, this.options.select?.makeSelectCellVisible ?? true, true);
71281
+ }
69358
71282
  get recordsCount() {
69359
71283
  return this.records?.length;
69360
71284
  }
@@ -73861,7 +75785,8 @@
73861
75785
  this.isValidatingValue = true;
73862
75786
  const newValue = this.editingEditor.getValue();
73863
75787
  const oldValue = this.table.getCellOriginValue(this.editCell.col, this.editCell.row);
73864
- const maybePromiseOrValue = this.editingEditor.validateValue?.(newValue, oldValue, this.editCell, this.table);
75788
+ const target = e?.target;
75789
+ const maybePromiseOrValue = this.editingEditor.validateValue?.(newValue, oldValue, this.editCell, this.table, !!this.table.getElement().contains(target));
73865
75790
  if (isPromise(maybePromiseOrValue)) {
73866
75791
  this.isValidatingValue = true;
73867
75792
  return new Promise((resolve, reject) => {
@@ -73891,6 +75816,7 @@
73891
75816
  }
73892
75817
  changedValues.push(rowChangedValues);
73893
75818
  }
75819
+ this.editingEditor.beforeEnd?.();
73894
75820
  this.table.changeCellValues(range.start.col, range.start.row, changedValues);
73895
75821
  this.editingEditor.exit && (void 0);
73896
75822
  this.editingEditor.exit?.();
@@ -73942,9 +75868,9 @@
73942
75868
  return false;
73943
75869
  }
73944
75870
 
73945
- function getGroupByDataConfig(groupByOption, customDealGroupData) {
75871
+ function getGroupByDataConfig(groupByOption, addRecordRule, customDealGroupData) {
73946
75872
  if (isString$4(groupByOption)) {
73947
- return { groupByRules: [groupByOption], customDealGroupData };
75873
+ return { groupByRules: [groupByOption], addRecordRule, customDealGroupData };
73948
75874
  }
73949
75875
  if (isArray$7(groupByOption)) {
73950
75876
  const groupByRules = groupByOption.map(item => {
@@ -73953,9 +75879,9 @@
73953
75879
  }
73954
75880
  return item.key;
73955
75881
  });
73956
- return { groupByRules, customDealGroupData };
75882
+ return { groupByRules, addRecordRule, customDealGroupData };
73957
75883
  }
73958
- return {};
75884
+ return { addRecordRule, customDealGroupData };
73959
75885
  }
73960
75886
 
73961
75887
  function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
@@ -74926,8 +76852,8 @@
74926
76852
  internalProps.sortState = options.sortState;
74927
76853
  internalProps.multipleSort = !!options.multipleSort;
74928
76854
  internalProps.dataConfig = this.internalProps.groupBy
74929
- ? getGroupByDataConfig(this.internalProps.groupBy, this.internalProps.customDealGroupData)
74930
- : {};
76855
+ ? getGroupByDataConfig(this.internalProps.groupBy, options.addRecordRule, this.internalProps.customDealGroupData)
76856
+ : { addRecordRule: options.addRecordRule, customDealGroupData: this.internalProps.customDealGroupData };
74931
76857
  internalProps.columns = options.columns
74932
76858
  ? cloneDeepSpec(options.columns, ['children'])
74933
76859
  : options.header
@@ -75041,9 +76967,36 @@
75041
76967
  this.renderAsync();
75042
76968
  this.eventManager.updateEventBinder();
75043
76969
  }
75044
- addColumn(column) {
76970
+ addColumn(column, colIndex, isMaintainArrayData = true) {
75045
76971
  const columns = this.options.columns;
75046
- columns.push(column);
76972
+ if (colIndex === undefined) {
76973
+ columns.push(column);
76974
+ }
76975
+ else {
76976
+ if (isMaintainArrayData) {
76977
+ for (let i = 0; i < columns.length; i++) {
76978
+ if (typeof columns[i].field === 'number') {
76979
+ if (columns[i].field >= colIndex) {
76980
+ columns[i].field = columns[i].field + 1;
76981
+ }
76982
+ }
76983
+ }
76984
+ }
76985
+ columns.splice(colIndex, 0, column);
76986
+ }
76987
+ if (isMaintainArrayData) {
76988
+ for (let i = 0; i < this.records.length; i++) {
76989
+ const record = this.records[i];
76990
+ if (Array.isArray(record)) {
76991
+ record.splice(colIndex, 0, undefined);
76992
+ }
76993
+ }
76994
+ }
76995
+ this.updateColumns(columns);
76996
+ }
76997
+ deleteColumn(colIndex) {
76998
+ const columns = this.options.columns;
76999
+ columns.splice(colIndex, 1);
75047
77000
  this.updateColumns(columns);
75048
77001
  }
75049
77002
  get columns() {
@@ -75104,7 +77057,7 @@
75104
77057
  else {
75105
77058
  const define = table.getBodyColumnDefine(col, row);
75106
77059
  const checkboxSeriesNumberStyle = table.getFieldData(define.field, col, row);
75107
- if (typeof checkboxSeriesNumberStyle === 'string') {
77060
+ if (['number', 'string'].includes(typeof checkboxSeriesNumberStyle)) {
75108
77061
  value = checkboxSeriesNumberStyle;
75109
77062
  }
75110
77063
  else if (checkboxSeriesNumberStyle?.text) {
@@ -75240,16 +77193,19 @@
75240
77193
  }
75241
77194
  return ifCan;
75242
77195
  }
75243
- updateOption(options) {
77196
+ updateOption(options, updateConfig = {
77197
+ clearColWidthCache: true,
77198
+ clearRowHeightCache: true
77199
+ }) {
75244
77200
  const internalProps = this.internalProps;
75245
- super.updateOption(options);
77201
+ super.updateOption(options, updateConfig);
75246
77202
  internalProps.frozenColDragHeaderMode =
75247
77203
  options.dragOrder?.frozenColDragHeaderMode ?? options.frozenColDragHeaderMode;
75248
77204
  this.pagination = options.pagination;
75249
77205
  internalProps.sortState = options.sortState;
75250
77206
  internalProps.dataConfig = this.internalProps.groupBy
75251
- ? getGroupByDataConfig(this.internalProps.groupBy, this.internalProps.customDealGroupData)
75252
- : {};
77207
+ ? getGroupByDataConfig(this.internalProps.groupBy, options.addRecordRule, this.internalProps.customDealGroupData)
77208
+ : { addRecordRule: options.addRecordRule };
75253
77209
  this.showHeader = options.showHeader ?? true;
75254
77210
  internalProps.columns = options.columns
75255
77211
  ? cloneDeepSpec(options.columns, ['children'])
@@ -75306,6 +77262,9 @@
75306
77262
  }
75307
77263
  }
75308
77264
  this.pluginManager.updatePlugins(options.plugins);
77265
+ setTimeout(() => {
77266
+ this.fireListeners(TABLE_EVENT_TYPE.UPDATED, null);
77267
+ }, 0);
75309
77268
  return new Promise(resolve => {
75310
77269
  setTimeout(resolve, 0);
75311
77270
  });
@@ -75370,7 +77329,7 @@
75370
77329
  if (this.options.frozenColCount >= this.colCount) {
75371
77330
  this.internalProps.frozenColCount = 0;
75372
77331
  }
75373
- table.frozenRowCount = Math.max(layoutMap.headerLevelCount, this.options.frozenRowCount ?? 0);
77332
+ table._setFrozenRowCount(Math.max(layoutMap.headerLevelCount, this.options.frozenRowCount ?? 0));
75374
77333
  if (table.bottomFrozenRowCount !== (this.options.bottomFrozenRowCount ?? 0)) {
75375
77334
  table.bottomFrozenRowCount = this.options.bottomFrozenRowCount ?? 0;
75376
77335
  }
@@ -76028,6 +77987,61 @@
76028
77987
  });
76029
77988
  }
76030
77989
  }
77990
+ mergeCells(startCol, startRow, endCol, endRow) {
77991
+ for (let i = startCol; i <= endCol; i++) {
77992
+ for (let j = startRow; j <= endRow; j++) {
77993
+ const cellRange = this.getCellRange(i, j);
77994
+ if (cellRange.start.col !== cellRange.end.col || cellRange.start.row !== cellRange.end.row) {
77995
+ return;
77996
+ }
77997
+ }
77998
+ }
77999
+ if (!this.options.customMergeCell) {
78000
+ this.options.customMergeCell = [];
78001
+ }
78002
+ else if (typeof this.options.customMergeCell === 'function') {
78003
+ this.options.customMergeCell = [];
78004
+ }
78005
+ this.options.customMergeCell.push({
78006
+ text: this.getCellValue(startCol, startRow),
78007
+ range: {
78008
+ start: {
78009
+ col: startCol,
78010
+ row: startRow
78011
+ },
78012
+ end: {
78013
+ col: endCol,
78014
+ row: endRow
78015
+ }
78016
+ }
78017
+ });
78018
+ this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
78019
+ for (let i = startCol; i <= endCol; i++) {
78020
+ for (let j = startRow; j <= endRow; j++) {
78021
+ this.scenegraph.updateCellContent(i, j);
78022
+ }
78023
+ }
78024
+ this.scenegraph.updateNextFrame();
78025
+ }
78026
+ unmergeCells(startCol, startRow, endCol, endRow) {
78027
+ if (!this.options.customMergeCell) {
78028
+ this.options.customMergeCell = [];
78029
+ }
78030
+ else if (typeof this.options.customMergeCell === 'function') {
78031
+ this.options.customMergeCell = [];
78032
+ }
78033
+ this.options.customMergeCell = this.options.customMergeCell.filter(item => {
78034
+ const { start, end } = item.range;
78035
+ return !(start.col === startCol && start.row === startRow && end.col === endCol && end.row === endRow);
78036
+ });
78037
+ this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
78038
+ for (let i = startCol; i <= endCol; i++) {
78039
+ for (let j = startRow; j <= endRow; j++) {
78040
+ this.scenegraph.updateCellContent(i, j);
78041
+ }
78042
+ }
78043
+ this.scenegraph.updateNextFrame();
78044
+ }
76031
78045
  }
76032
78046
 
76033
78047
  function isXAxis(orient) {
@@ -88188,9 +90202,12 @@
88188
90202
  }
88189
90203
  return ifCan;
88190
90204
  }
88191
- updateOption(options) {
90205
+ updateOption(options, updateConfig = {
90206
+ clearColWidthCache: true,
90207
+ clearRowHeightCache: true
90208
+ }) {
88192
90209
  const internalProps = this.internalProps;
88193
- super.updateOption(options);
90210
+ super.updateOption(options, updateConfig);
88194
90211
  if (!options.rowHierarchyType) {
88195
90212
  options.rowHierarchyType = 'grid';
88196
90213
  }
@@ -88323,6 +90340,9 @@
88323
90340
  this.internalProps.emptyTip?.resetVisible();
88324
90341
  }
88325
90342
  }
90343
+ setTimeout(() => {
90344
+ this.fireListeners(TABLE_EVENT_TYPE.UPDATED, null);
90345
+ }, 0);
88326
90346
  return new Promise(resolve => {
88327
90347
  setTimeout(resolve, 0);
88328
90348
  });
@@ -88368,7 +90388,7 @@
88368
90388
  this.internalProps.frozenColCount = this.options.frozenColCount
88369
90389
  ? this.options.frozenColCount
88370
90390
  : (layoutMap.rowHeaderLevelCount ?? 0) + layoutMap.leftRowSeriesNumberColumnCount;
88371
- table.frozenRowCount = Math.max(layoutMap.headerLevelCount, this.options.frozenRowCount ?? 0);
90391
+ table._setFrozenRowCount(Math.max(layoutMap.headerLevelCount, this.options.frozenRowCount ?? 0));
88372
90392
  if (table.bottomFrozenRowCount !== (this.options.bottomFrozenRowCount ?? 0)) {
88373
90393
  table.bottomFrozenRowCount = this.options.bottomFrozenRowCount ?? 0;
88374
90394
  }
@@ -89879,9 +91899,12 @@
89879
91899
  }
89880
91900
  return ifCan;
89881
91901
  }
89882
- updateOption(options) {
91902
+ updateOption(options, updateConfig = {
91903
+ clearColWidthCache: true,
91904
+ clearRowHeightCache: true
91905
+ }) {
89883
91906
  const internalProps = this.internalProps;
89884
- super.updateOption(options);
91907
+ super.updateOption(options, updateConfig);
89885
91908
  this.layoutNodeId = { seqId: 0 };
89886
91909
  this.internalProps.columns = cloneDeep$1(options.columns);
89887
91910
  this.internalProps.rows = cloneDeep$1(options.rows);
@@ -90012,6 +92035,9 @@
90012
92035
  this.internalProps.emptyTip?.resetVisible();
90013
92036
  }
90014
92037
  }
92038
+ setTimeout(() => {
92039
+ this.fireListeners(TABLE_EVENT_TYPE.UPDATED, null);
92040
+ }, 0);
90015
92041
  return new Promise(resolve => {
90016
92042
  setTimeout(resolve, 0);
90017
92043
  });
@@ -90031,7 +92057,7 @@
90031
92057
  table.colCount = layoutMap.colCount ?? 0;
90032
92058
  table.rowCount = layoutMap.rowCount ?? 0;
90033
92059
  table.internalProps.frozenColCount = layoutMap.rowHeaderLevelCount ?? 0;
90034
- table.frozenRowCount = Math.max(layoutMap.headerLevelCount, this.options.frozenRowCount ?? 0);
92060
+ table._setFrozenRowCount(Math.max(layoutMap.headerLevelCount, this.options.frozenRowCount ?? 0));
90035
92061
  if (table.bottomFrozenRowCount !== (layoutMap?.bottomFrozenRowCount ?? 0)) {
90036
92062
  table.bottomFrozenRowCount = layoutMap?.bottomFrozenRowCount ?? 0;
90037
92063
  }
@@ -91404,7 +93430,7 @@
91404
93430
  }
91405
93431
 
91406
93432
  registerForVrender();
91407
- const version = "1.0.14";
93433
+ const version = "1.0.16";
91408
93434
  function getIcons() {
91409
93435
  return get$2();
91410
93436
  }