k-react-vtable 1.0.17 → 1.0.18
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.
- package/cjs/components/radio/radio.js +2 -1
- package/cjs/components/vrender-components/checkbox.js +1 -2
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/react-vtable.js +2210 -428
- package/dist/react-vtable.min.js +2 -2
- package/es/components/radio/radio.js +2 -1
- package/es/components/vrender-components/checkbox.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +2 -2
package/dist/react-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
|
-
|
|
591
|
+
const container = new Container$1();
|
|
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;
|
|
@@ -667,7 +675,7 @@
|
|
|
667
675
|
decorator(target, key, paramIndex);
|
|
668
676
|
};
|
|
669
677
|
},
|
|
670
|
-
__awaiter$
|
|
678
|
+
__awaiter$d = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
671
679
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
672
680
|
function fulfilled(value) {
|
|
673
681
|
try {
|
|
@@ -833,7 +841,7 @@
|
|
|
833
841
|
return this._env || this.setEnv("browser"), this.envContribution.loadBlob(url);
|
|
834
842
|
}
|
|
835
843
|
loadFont(name, source, descriptors) {
|
|
836
|
-
return __awaiter$
|
|
844
|
+
return __awaiter$d(this, void 0, void 0, function* () {
|
|
837
845
|
return this._env || this.setEnv("browser"), this.envContribution.loadFont(name, source, descriptors);
|
|
838
846
|
});
|
|
839
847
|
}
|
|
@@ -4697,7 +4705,8 @@
|
|
|
4697
4705
|
y1: 0,
|
|
4698
4706
|
strokeBoundsBuffer: 0,
|
|
4699
4707
|
cornerRadius: 0,
|
|
4700
|
-
cornerType: "round"
|
|
4708
|
+
cornerType: "round",
|
|
4709
|
+
drawStrokeWhenZeroWH: !1
|
|
4701
4710
|
});
|
|
4702
4711
|
Object.assign(Object.assign({}, DefaultAttribute), {
|
|
4703
4712
|
width: 0,
|
|
@@ -4706,7 +4715,8 @@
|
|
|
4706
4715
|
y1: 0,
|
|
4707
4716
|
cornerRadius: 0,
|
|
4708
4717
|
length: 0,
|
|
4709
|
-
cornerType: "round"
|
|
4718
|
+
cornerType: "round",
|
|
4719
|
+
drawStrokeWhenZeroWH: !1
|
|
4710
4720
|
});
|
|
4711
4721
|
const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
4712
4722
|
symbolType: "circle",
|
|
@@ -4933,6 +4943,34 @@
|
|
|
4933
4943
|
}
|
|
4934
4944
|
return c;
|
|
4935
4945
|
}
|
|
4946
|
+
static processColorStops(colorStops) {
|
|
4947
|
+
if (!colorStops || 0 === colorStops.length) return [];
|
|
4948
|
+
if (colorStops.some(item => item.length)) {
|
|
4949
|
+
const stops = colorStops.map(item => ({
|
|
4950
|
+
color: item.value,
|
|
4951
|
+
offset: item.length ? parseFloat(item.length.value) / 100 : -1
|
|
4952
|
+
}));
|
|
4953
|
+
stops[0].offset < 0 && (stops[0].offset = 0), stops[stops.length - 1].offset < 0 && (stops[stops.length - 1].offset = 1);
|
|
4954
|
+
for (let i = 1; i < stops.length - 1; i++) if (stops[i].offset < 0) {
|
|
4955
|
+
const prevWithOffsetIdx = i - 1;
|
|
4956
|
+
let nextWithOffsetIdx = i + 1;
|
|
4957
|
+
for (; nextWithOffsetIdx < stops.length && stops[nextWithOffsetIdx].offset < 0;) nextWithOffsetIdx++;
|
|
4958
|
+
const startOffset = stops[prevWithOffsetIdx].offset,
|
|
4959
|
+
endOffset = stops[nextWithOffsetIdx].offset,
|
|
4960
|
+
unspecCount = nextWithOffsetIdx - prevWithOffsetIdx;
|
|
4961
|
+
for (let j = 1; j < unspecCount; j++) stops[prevWithOffsetIdx + j].offset = startOffset + (endOffset - startOffset) * j / unspecCount;
|
|
4962
|
+
i = nextWithOffsetIdx - 1;
|
|
4963
|
+
}
|
|
4964
|
+
return stops;
|
|
4965
|
+
}
|
|
4966
|
+
return colorStops.map((item, index) => {
|
|
4967
|
+
const offset = colorStops.length > 1 ? index / (colorStops.length - 1) : 0;
|
|
4968
|
+
return {
|
|
4969
|
+
color: item.value,
|
|
4970
|
+
offset: offset
|
|
4971
|
+
};
|
|
4972
|
+
});
|
|
4973
|
+
}
|
|
4936
4974
|
static ParseConic(datum) {
|
|
4937
4975
|
const {
|
|
4938
4976
|
orientation: orientation,
|
|
@@ -4946,10 +4984,7 @@
|
|
|
4946
4984
|
y: .5,
|
|
4947
4985
|
startAngle: sa,
|
|
4948
4986
|
endAngle: sa + pi2,
|
|
4949
|
-
stops:
|
|
4950
|
-
color: item.value,
|
|
4951
|
-
offset: parseFloat(item.length.value) / 100
|
|
4952
|
-
}))
|
|
4987
|
+
stops: GradientParser.processColorStops(colorStops)
|
|
4953
4988
|
};
|
|
4954
4989
|
}
|
|
4955
4990
|
static ParseRadial(datum) {
|
|
@@ -4964,10 +4999,7 @@
|
|
|
4964
4999
|
y1: .5,
|
|
4965
5000
|
r0: 0,
|
|
4966
5001
|
r1: 1,
|
|
4967
|
-
stops:
|
|
4968
|
-
color: item.value,
|
|
4969
|
-
offset: parseFloat(item.length.value) / 100
|
|
4970
|
-
}))
|
|
5002
|
+
stops: GradientParser.processColorStops(colorStops)
|
|
4971
5003
|
};
|
|
4972
5004
|
}
|
|
4973
5005
|
static ParseLinear(datum) {
|
|
@@ -4989,10 +5021,7 @@
|
|
|
4989
5021
|
y0: y0,
|
|
4990
5022
|
x1: x1,
|
|
4991
5023
|
y1: y1,
|
|
4992
|
-
stops:
|
|
4993
|
-
color: item.value,
|
|
4994
|
-
offset: parseFloat(item.length.value) / 100
|
|
4995
|
-
}))
|
|
5024
|
+
stops: GradientParser.processColorStops(colorStops)
|
|
4996
5025
|
};
|
|
4997
5026
|
}
|
|
4998
5027
|
}
|
|
@@ -5188,6 +5217,9 @@
|
|
|
5188
5217
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5189
5218
|
};
|
|
5190
5219
|
let ATextMeasure = class {
|
|
5220
|
+
constructor() {
|
|
5221
|
+
this.id = "ATextMeasure";
|
|
5222
|
+
}
|
|
5191
5223
|
configure(service, env) {
|
|
5192
5224
|
this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
|
|
5193
5225
|
}
|
|
@@ -5580,11 +5612,13 @@
|
|
|
5580
5612
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5581
5613
|
};
|
|
5582
5614
|
const TextMeasureContribution = Symbol.for("TextMeasureContribution");
|
|
5583
|
-
let DefaultTextMeasureContribution = class extends ATextMeasure {
|
|
5615
|
+
let DefaultTextMeasureContribution = class extends ATextMeasure {
|
|
5616
|
+
constructor() {
|
|
5617
|
+
super(...arguments), this.id = "DefaultTextMeasureContribution";
|
|
5618
|
+
}
|
|
5619
|
+
};
|
|
5584
5620
|
DefaultTextMeasureContribution = __decorate$15([injectable()], DefaultTextMeasureContribution);
|
|
5585
5621
|
|
|
5586
|
-
const container = new Container$1();
|
|
5587
|
-
|
|
5588
5622
|
const CanvasFactory = Symbol.for("CanvasFactory");
|
|
5589
5623
|
const Context2dFactory = Symbol.for("Context2dFactory");
|
|
5590
5624
|
|
|
@@ -6161,13 +6195,17 @@
|
|
|
6161
6195
|
return this.tryInitCanvas(), this._context;
|
|
6162
6196
|
}
|
|
6163
6197
|
constructor(contributions) {
|
|
6164
|
-
this.contributions = contributions, this.configured = !1, this.global = application.global, this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
|
|
6198
|
+
this.contributions = contributions, this.configured = !1, this.global = application.global, this._textMeasureMap = new Map(), this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
|
|
6165
6199
|
this.configured = !1, this.configure(global, env);
|
|
6166
6200
|
});
|
|
6167
6201
|
}
|
|
6168
6202
|
get textMeasure() {
|
|
6169
6203
|
return this._textMeasure || this.configure(this.global, this.global.env), this._textMeasure;
|
|
6170
6204
|
}
|
|
6205
|
+
getTextMeasureInstance(textMeasureId) {
|
|
6206
|
+
if (!textMeasureId) return this.textMeasure;
|
|
6207
|
+
return this._textMeasureMap.get(textMeasureId) || this.textMeasure;
|
|
6208
|
+
}
|
|
6171
6209
|
configure(global, env) {
|
|
6172
6210
|
this.configured || (this.contributions.getContributions().forEach(contribution => {
|
|
6173
6211
|
contribution.configure(this, env);
|
|
@@ -6180,7 +6218,7 @@
|
|
|
6180
6218
|
}
|
|
6181
6219
|
}
|
|
6182
6220
|
bindTextMeasure(tm) {
|
|
6183
|
-
this._textMeasure = tm;
|
|
6221
|
+
this._textMeasure && "DefaultTextMeasureContribution" !== tm.id || (this._textMeasure = tm), this._textMeasureMap.has(tm.id) || this._textMeasureMap.set(tm.id, tm);
|
|
6184
6222
|
}
|
|
6185
6223
|
measureText(text, tc, method = "native") {
|
|
6186
6224
|
var _a;
|
|
@@ -6414,7 +6452,7 @@
|
|
|
6414
6452
|
return null;
|
|
6415
6453
|
}
|
|
6416
6454
|
|
|
6417
|
-
var __awaiter$
|
|
6455
|
+
var __awaiter$c = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
6418
6456
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6419
6457
|
function fulfilled(value) {
|
|
6420
6458
|
try {
|
|
@@ -6482,7 +6520,7 @@
|
|
|
6482
6520
|
}
|
|
6483
6521
|
}
|
|
6484
6522
|
forEachChildrenAsync(cb, reverse = !1) {
|
|
6485
|
-
return __awaiter$
|
|
6523
|
+
return __awaiter$c(this, void 0, void 0, function* () {
|
|
6486
6524
|
if (reverse) {
|
|
6487
6525
|
let child = this._lastChild,
|
|
6488
6526
|
i = 0;
|
|
@@ -9360,7 +9398,7 @@
|
|
|
9360
9398
|
});
|
|
9361
9399
|
}
|
|
9362
9400
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
9363
|
-
(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);
|
|
9401
|
+
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));
|
|
9364
9402
|
}
|
|
9365
9403
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
9366
9404
|
const keys = Object.keys(params);
|
|
@@ -10185,8 +10223,8 @@
|
|
|
10185
10223
|
function strokeVisible(opacity, strokeOpacity) {
|
|
10186
10224
|
return opacity * strokeOpacity > 0;
|
|
10187
10225
|
}
|
|
10188
|
-
function rectStrokeVisible(opacity, strokeOpacity, width, height) {
|
|
10189
|
-
return opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
|
|
10226
|
+
function rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH) {
|
|
10227
|
+
return drawStrokeWhenZeroWH ? opacity * strokeOpacity > 0 : opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
|
|
10190
10228
|
}
|
|
10191
10229
|
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
10192
10230
|
const x10 = x1 - x0,
|
|
@@ -10787,7 +10825,7 @@
|
|
|
10787
10825
|
this.cache.layoutData.lines.forEach(item => {
|
|
10788
10826
|
mergedText += item.str;
|
|
10789
10827
|
});
|
|
10790
|
-
return (Array.isArray(text) ? text.join("") : text) !== mergedText;
|
|
10828
|
+
return (Array.isArray(text) ? text.join("") : text).toString() !== mergedText;
|
|
10791
10829
|
}
|
|
10792
10830
|
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();
|
|
10793
10831
|
}
|
|
@@ -10886,7 +10924,7 @@
|
|
|
10886
10924
|
return fontSize ? .1 * fontSize : 0;
|
|
10887
10925
|
}
|
|
10888
10926
|
updateHorizontalMultilineAABBBounds(text) {
|
|
10889
|
-
var _a;
|
|
10927
|
+
var _a, _b;
|
|
10890
10928
|
const textTheme = this.getGraphicTheme(),
|
|
10891
10929
|
attribute = this.attribute,
|
|
10892
10930
|
{
|
|
@@ -10913,7 +10951,7 @@
|
|
|
10913
10951
|
const bbox = this.cache.layoutData.bbox;
|
|
10914
10952
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10915
10953
|
}
|
|
10916
|
-
const textMeasure = application.graphicUtil.
|
|
10954
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
|
|
10917
10955
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
10918
10956
|
fontSize: fontSize,
|
|
10919
10957
|
fontWeight: fontWeight,
|
|
@@ -10931,7 +10969,7 @@
|
|
|
10931
10969
|
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;
|
|
10932
10970
|
}
|
|
10933
10971
|
updateWrapAABBBounds(text) {
|
|
10934
|
-
var _a, _b, _c;
|
|
10972
|
+
var _a, _b, _c, _d;
|
|
10935
10973
|
const textTheme = this.getGraphicTheme(),
|
|
10936
10974
|
{
|
|
10937
10975
|
fontFamily = textTheme.fontFamily,
|
|
@@ -10957,7 +10995,7 @@
|
|
|
10957
10995
|
const bbox = this.cache.layoutData.bbox;
|
|
10958
10996
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10959
10997
|
}
|
|
10960
|
-
const textMeasure = application.graphicUtil.
|
|
10998
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
|
|
10961
10999
|
textOptions = {
|
|
10962
11000
|
fontSize: fontSize,
|
|
10963
11001
|
fontWeight: fontWeight,
|
|
@@ -10989,7 +11027,7 @@
|
|
|
10989
11027
|
if ("" !== str && "" === clip.str || clip.wordBreaked) {
|
|
10990
11028
|
if (ellipsis) {
|
|
10991
11029
|
const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
10992
|
-
clip.str = null !== (
|
|
11030
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
10993
11031
|
} else clip.str = "", clip.width = 0;
|
|
10994
11032
|
needCut = !1;
|
|
10995
11033
|
}
|
|
@@ -11052,9 +11090,9 @@
|
|
|
11052
11090
|
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;
|
|
11053
11091
|
}
|
|
11054
11092
|
updateVerticalMultilineAABBBounds(text) {
|
|
11055
|
-
var _a, _b;
|
|
11093
|
+
var _a, _b, _c;
|
|
11056
11094
|
const textTheme = this.getGraphicTheme(),
|
|
11057
|
-
textMeasure = application.graphicUtil.
|
|
11095
|
+
textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.textMeasureId));
|
|
11058
11096
|
let width;
|
|
11059
11097
|
const attribute = this.attribute,
|
|
11060
11098
|
{
|
|
@@ -11075,7 +11113,7 @@
|
|
|
11075
11113
|
} = attribute;
|
|
11076
11114
|
if (!verticalMode) {
|
|
11077
11115
|
const t = textAlign;
|
|
11078
|
-
textAlign = null !== (
|
|
11116
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
11079
11117
|
}
|
|
11080
11118
|
if (width = 0, !this.shouldUpdateShape() && this.cache) {
|
|
11081
11119
|
this.cache.verticalList.forEach(item => {
|
|
@@ -11189,7 +11227,7 @@
|
|
|
11189
11227
|
return isArray$b(text) ? !text.every(t => null == t || "" === t) : null != text && "" !== text;
|
|
11190
11228
|
}
|
|
11191
11229
|
updateMultilineAABBBounds(text) {
|
|
11192
|
-
var _a, _b, _c, _d;
|
|
11230
|
+
var _a, _b, _c, _d, _e;
|
|
11193
11231
|
const textTheme = this.getGraphicTheme(),
|
|
11194
11232
|
{
|
|
11195
11233
|
fontFamily = textTheme.fontFamily,
|
|
@@ -11213,7 +11251,7 @@
|
|
|
11213
11251
|
const bbox = this.cache.layoutData.bbox;
|
|
11214
11252
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
11215
11253
|
}
|
|
11216
|
-
const textMeasure = application.graphicUtil.
|
|
11254
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_c = this.stage) || void 0 === _c ? void 0 : _c.textMeasureId)),
|
|
11217
11255
|
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
11218
11256
|
fontSize: fontSize,
|
|
11219
11257
|
fontWeight: fontWeight,
|
|
@@ -11242,7 +11280,7 @@
|
|
|
11242
11280
|
if ("" !== str && "" === clip.str) {
|
|
11243
11281
|
if (ellipsis) {
|
|
11244
11282
|
const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
11245
|
-
clip.str = null !== (
|
|
11283
|
+
clip.str = null !== (_d = clipEllipsis.str) && void 0 !== _d ? _d : "", clip.width = null !== (_e = clipEllipsis.width) && void 0 !== _e ? _e : 0;
|
|
11246
11284
|
} else clip.str = "", clip.width = 0;
|
|
11247
11285
|
needCut = !1;
|
|
11248
11286
|
}
|
|
@@ -12346,7 +12384,7 @@
|
|
|
12346
12384
|
case "right":
|
|
12347
12385
|
deltaX = -aabbBounds.width();
|
|
12348
12386
|
}
|
|
12349
|
-
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;
|
|
12387
|
+
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;
|
|
12350
12388
|
}
|
|
12351
12389
|
needUpdateTags(keys) {
|
|
12352
12390
|
return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
|
|
@@ -14013,7 +14051,7 @@
|
|
|
14013
14051
|
doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
|
|
14014
14052
|
}
|
|
14015
14053
|
_runStroke(arc, context, x, y, arcAttribute, doStroke, isFullStroke, sVisible, strokeCb) {
|
|
14016
|
-
doStroke && isFullStroke && (strokeCb
|
|
14054
|
+
doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
|
|
14017
14055
|
}
|
|
14018
14056
|
draw(arc, renderService, drawContext, params) {
|
|
14019
14057
|
const arcAttribute = getTheme(arc, null == params ? void 0 : params.theme).arc;
|
|
@@ -14745,7 +14783,8 @@
|
|
|
14745
14783
|
y1: y1,
|
|
14746
14784
|
x: originX = rectAttribute.x,
|
|
14747
14785
|
y: originY = rectAttribute.y,
|
|
14748
|
-
fillStrokeOrder = rectAttribute.fillStrokeOrder
|
|
14786
|
+
fillStrokeOrder = rectAttribute.fillStrokeOrder,
|
|
14787
|
+
drawStrokeWhenZeroWH = rectAttribute.drawStrokeWhenZeroWH
|
|
14749
14788
|
} = rect.attribute;
|
|
14750
14789
|
let {
|
|
14751
14790
|
width: width,
|
|
@@ -14753,7 +14792,7 @@
|
|
|
14753
14792
|
} = rect.attribute;
|
|
14754
14793
|
width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
|
|
14755
14794
|
const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
|
|
14756
|
-
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
|
|
14795
|
+
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
|
|
14757
14796
|
doFill = runFill(fill, background),
|
|
14758
14797
|
doStroke = runStroke(stroke, lineWidth);
|
|
14759
14798
|
if (!rect.valid || !visible) return;
|
|
@@ -15671,7 +15710,6 @@
|
|
|
15671
15710
|
decorator(target, key, paramIndex);
|
|
15672
15711
|
};
|
|
15673
15712
|
};
|
|
15674
|
-
const RenderService = Symbol.for("RenderService");
|
|
15675
15713
|
let DefaultRenderService = class {
|
|
15676
15714
|
constructor(drawContribution) {
|
|
15677
15715
|
this.drawContribution = drawContribution;
|
|
@@ -15973,7 +16011,7 @@
|
|
|
15973
16011
|
container.load(envModules), container.load(textMeasureModules), container.load(layerHandlerModules);
|
|
15974
16012
|
}
|
|
15975
16013
|
|
|
15976
|
-
var __awaiter$
|
|
16014
|
+
var __awaiter$b = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
15977
16015
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15978
16016
|
function fulfilled(value) {
|
|
15979
16017
|
try {
|
|
@@ -16043,7 +16081,7 @@
|
|
|
16043
16081
|
} else graphic.forEachChildren(cb, reverse);
|
|
16044
16082
|
}
|
|
16045
16083
|
function foreachAsync(graphic, defaultZIndex, cb, reverse = !1) {
|
|
16046
|
-
return __awaiter$
|
|
16084
|
+
return __awaiter$b(this, void 0, void 0, function* () {
|
|
16047
16085
|
yield graphic.forEachChildrenAsync(cb, reverse);
|
|
16048
16086
|
});
|
|
16049
16087
|
}
|
|
@@ -16413,7 +16451,7 @@
|
|
|
16413
16451
|
decorator(target, key, paramIndex);
|
|
16414
16452
|
};
|
|
16415
16453
|
},
|
|
16416
|
-
__awaiter$
|
|
16454
|
+
__awaiter$a = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
16417
16455
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16418
16456
|
function fulfilled(value) {
|
|
16419
16457
|
try {
|
|
@@ -16448,7 +16486,7 @@
|
|
|
16448
16486
|
}, this.defaultRenderMap.set(this.lineRender.numberType, this.lineRender), this.defaultRenderMap.set(this.areaRender.numberType, this.areaRender);
|
|
16449
16487
|
}
|
|
16450
16488
|
draw(renderService, drawContext) {
|
|
16451
|
-
return __awaiter$
|
|
16489
|
+
return __awaiter$a(this, void 0, void 0, function* () {
|
|
16452
16490
|
if (this.checkingForDrawPromise) return;
|
|
16453
16491
|
this.lastRenderService = renderService, this.lastDrawContext = drawContext, this.checkingForDrawPromise = this.checkForDraw(drawContext);
|
|
16454
16492
|
const skipDraw = yield this.checkingForDrawPromise;
|
|
@@ -16469,15 +16507,15 @@
|
|
|
16469
16507
|
});
|
|
16470
16508
|
}
|
|
16471
16509
|
_increaseRender(group, drawContext) {
|
|
16472
|
-
return __awaiter$
|
|
16510
|
+
return __awaiter$a(this, void 0, void 0, function* () {
|
|
16473
16511
|
this.rendering = !0, yield this._renderIncrementalGroup(group, drawContext);
|
|
16474
16512
|
});
|
|
16475
16513
|
}
|
|
16476
16514
|
_renderIncrementalGroup(group, drawContext) {
|
|
16477
|
-
return __awaiter$
|
|
16515
|
+
return __awaiter$a(this, void 0, void 0, function* () {
|
|
16478
16516
|
this.count = group.count, yield new Promise(resolve => {
|
|
16479
16517
|
this.renderItem(group, drawContext, {
|
|
16480
|
-
drawingCb: () => __awaiter$
|
|
16518
|
+
drawingCb: () => __awaiter$a(this, void 0, void 0, function* () {
|
|
16481
16519
|
if (2 !== group.count) yield foreachAsync(group, DefaultAttribute.zIndex, (item, i) => {
|
|
16482
16520
|
if (this.status === STATUS.STOP) return !0;
|
|
16483
16521
|
if (item.isContainer) return !1;
|
|
@@ -16498,7 +16536,7 @@
|
|
|
16498
16536
|
});
|
|
16499
16537
|
}
|
|
16500
16538
|
waitToNextFrame() {
|
|
16501
|
-
return __awaiter$
|
|
16539
|
+
return __awaiter$a(this, void 0, void 0, function* () {
|
|
16502
16540
|
return new Promise(resolve => {
|
|
16503
16541
|
this.global.getRequestAnimationFrame()(() => {
|
|
16504
16542
|
resolve(!1);
|
|
@@ -16507,13 +16545,13 @@
|
|
|
16507
16545
|
});
|
|
16508
16546
|
}
|
|
16509
16547
|
checkForDraw(drawContext) {
|
|
16510
|
-
return __awaiter$
|
|
16548
|
+
return __awaiter$a(this, void 0, void 0, function* () {
|
|
16511
16549
|
let skip = this.rendering;
|
|
16512
16550
|
return drawContext.restartIncremental && (skip = !1, yield this.forceStop(), this.resetToInit()), skip;
|
|
16513
16551
|
});
|
|
16514
16552
|
}
|
|
16515
16553
|
forceStop() {
|
|
16516
|
-
return __awaiter$
|
|
16554
|
+
return __awaiter$a(this, void 0, void 0, function* () {
|
|
16517
16555
|
this.rendering && (this.status = STATUS.STOP, yield new Promise(resolve => {
|
|
16518
16556
|
this.hooks.completeDraw.tap("stopCb", () => {
|
|
16519
16557
|
this.status = STATUS.NORMAL, this.hooks.completeDraw.taps = this.hooks.completeDraw.taps.filter(item => "stopCb" !== item.name), resolve(!1);
|
|
@@ -16525,11 +16563,11 @@
|
|
|
16525
16563
|
this.currFrameStartAt = 0, this.currentIdx = 0;
|
|
16526
16564
|
}
|
|
16527
16565
|
renderGroup(group, drawContext) {
|
|
16528
|
-
return __awaiter$
|
|
16566
|
+
return __awaiter$a(this, void 0, void 0, function* () {
|
|
16529
16567
|
if (!drawContext.break && !1 !== group.attribute.visibleAll) return group.incremental && drawContext.startAtId === group._uid ? (yield this._increaseRender(group, drawContext), void (drawContext.break = !0)) : void (yield new Promise(resolve => {
|
|
16530
16568
|
this.renderItem(group, drawContext, {
|
|
16531
|
-
drawingCb: () => __awaiter$
|
|
16532
|
-
yield foreachAsync(group, DefaultAttribute.zIndex, item => __awaiter$
|
|
16569
|
+
drawingCb: () => __awaiter$a(this, void 0, void 0, function* () {
|
|
16570
|
+
yield foreachAsync(group, DefaultAttribute.zIndex, item => __awaiter$a(this, void 0, void 0, function* () {
|
|
16533
16571
|
drawContext.break || item.isContainer && (yield this.renderGroup(item, drawContext));
|
|
16534
16572
|
})), resolve(!1);
|
|
16535
16573
|
})
|
|
@@ -16560,8 +16598,6 @@
|
|
|
16560
16598
|
application.transformUtil = transformUtil;
|
|
16561
16599
|
const graphicService = container.get(GraphicService);
|
|
16562
16600
|
application.graphicService = graphicService;
|
|
16563
|
-
const renderService = container.get(RenderService);
|
|
16564
|
-
application.renderService = renderService;
|
|
16565
16601
|
const layerService = container.get(LayerService);
|
|
16566
16602
|
application.layerService = layerService;
|
|
16567
16603
|
|
|
@@ -16814,13 +16850,13 @@
|
|
|
16814
16850
|
this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
|
|
16815
16851
|
} else this._skipRender = 1;
|
|
16816
16852
|
}, this.beforeRender = stage => {
|
|
16817
|
-
this.
|
|
16853
|
+
this._beforeRenderList.forEach(cb => cb(stage));
|
|
16818
16854
|
}, this.afterClearScreen = drawParams => {
|
|
16819
16855
|
this._afterClearScreen && this._afterClearScreen(drawParams);
|
|
16820
16856
|
}, this.afterClearRect = drawParams => {
|
|
16821
16857
|
this._afterClearRect && this._afterClearRect(drawParams);
|
|
16822
16858
|
}, this.afterRender = stage => {
|
|
16823
|
-
this.renderCount++, this.
|
|
16859
|
+
this.renderCount++, this._afterRenderList.forEach(cb => cb(stage)), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
|
|
16824
16860
|
}, this.afterTickCb = () => {
|
|
16825
16861
|
this.tickedBeforeRender = !0, "rendering" !== this.state && this.renderNextFrame();
|
|
16826
16862
|
}, this.params = params, this.theme = new Theme(), this.hooks = {
|
|
@@ -16828,7 +16864,7 @@
|
|
|
16828
16864
|
afterRender: new SyncHook(["stage"]),
|
|
16829
16865
|
afterClearScreen: new SyncHook(["stage"]),
|
|
16830
16866
|
afterClearRect: new SyncHook(["stage"])
|
|
16831
|
-
}, 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({
|
|
16867
|
+
}, 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({
|
|
16832
16868
|
width: params.width,
|
|
16833
16869
|
height: params.height,
|
|
16834
16870
|
viewBox: params.viewBox,
|
|
@@ -16839,7 +16875,7 @@
|
|
|
16839
16875
|
canvas: params.canvas
|
|
16840
16876
|
}), 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, {
|
|
16841
16877
|
main: !0
|
|
16842
|
-
})), 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.
|
|
16878
|
+
})), 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 = {
|
|
16843
16879
|
tickRenderMode: "effect"
|
|
16844
16880
|
}), this.optmize(params.optimize), params.background && isString$8(this._background) && this._background.includes("/") && this.setAttributes({
|
|
16845
16881
|
background: this._background
|
|
@@ -16954,10 +16990,16 @@
|
|
|
16954
16990
|
options.enableView3dTransform && this.enableView3dTransform();
|
|
16955
16991
|
}
|
|
16956
16992
|
setBeforeRender(cb) {
|
|
16957
|
-
this.
|
|
16993
|
+
this._beforeRenderList.push(cb);
|
|
16994
|
+
}
|
|
16995
|
+
removeBeforeRender(cb) {
|
|
16996
|
+
this._beforeRenderList = this._beforeRenderList.filter(c => c !== cb);
|
|
16958
16997
|
}
|
|
16959
16998
|
setAfterRender(cb) {
|
|
16960
|
-
this.
|
|
16999
|
+
this._afterRenderList.push(cb);
|
|
17000
|
+
}
|
|
17001
|
+
removeAfterRender(cb) {
|
|
17002
|
+
this._afterRenderList = this._afterRenderList.filter(c => c !== cb);
|
|
16961
17003
|
}
|
|
16962
17004
|
afterNextRender(cb) {
|
|
16963
17005
|
this._afterNextRenderCbs || (this._afterNextRenderCbs = []), this._afterNextRenderCbs.push(cb);
|
|
@@ -17262,7 +17304,7 @@
|
|
|
17262
17304
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
17263
17305
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17264
17306
|
},
|
|
17265
|
-
__awaiter$
|
|
17307
|
+
__awaiter$9 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
17266
17308
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17267
17309
|
function fulfilled(value) {
|
|
17268
17310
|
try {
|
|
@@ -17356,7 +17398,7 @@
|
|
|
17356
17398
|
};
|
|
17357
17399
|
}
|
|
17358
17400
|
loadFont(font, source, descriptors) {
|
|
17359
|
-
return __awaiter$
|
|
17401
|
+
return __awaiter$9(this, void 0, void 0, function* () {
|
|
17360
17402
|
return {
|
|
17361
17403
|
loadState: "fail"
|
|
17362
17404
|
};
|
|
@@ -19442,7 +19484,7 @@
|
|
|
19442
19484
|
__metadata$k = undefined && undefined.__metadata || function (k, v) {
|
|
19443
19485
|
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
19444
19486
|
},
|
|
19445
|
-
__awaiter$
|
|
19487
|
+
__awaiter$8 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
19446
19488
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19447
19489
|
function fulfilled(value) {
|
|
19448
19490
|
try {
|
|
@@ -19661,7 +19703,7 @@
|
|
|
19661
19703
|
};
|
|
19662
19704
|
}
|
|
19663
19705
|
loadFont(font, source, descriptors) {
|
|
19664
|
-
return __awaiter$
|
|
19706
|
+
return __awaiter$8(this, void 0, void 0, function* () {
|
|
19665
19707
|
return new FontFace(font, isString$8(source) ? `url(${source})` : source, descriptors).load().then(function (loadedFont) {
|
|
19666
19708
|
return document.fonts.add(loadedFont), {
|
|
19667
19709
|
loadState: "success"
|
|
@@ -23905,6 +23947,7 @@
|
|
|
23905
23947
|
return this.getEndProps();
|
|
23906
23948
|
}
|
|
23907
23949
|
stop() {}
|
|
23950
|
+
release() {}
|
|
23908
23951
|
}
|
|
23909
23952
|
class WaitStep extends Step {
|
|
23910
23953
|
constructor(type, props, duration, easing) {
|
|
@@ -23912,8 +23955,6 @@
|
|
|
23912
23955
|
}
|
|
23913
23956
|
onStart() {
|
|
23914
23957
|
super.onStart();
|
|
23915
|
-
}
|
|
23916
|
-
onFirstRun() {
|
|
23917
23958
|
const fromProps = this.getFromProps();
|
|
23918
23959
|
this.target.setAttributes(fromProps);
|
|
23919
23960
|
}
|
|
@@ -24122,7 +24163,9 @@
|
|
|
24122
24163
|
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));
|
|
24123
24164
|
}
|
|
24124
24165
|
release() {
|
|
24125
|
-
this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = []
|
|
24166
|
+
this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [], this.forEachStep(step => {
|
|
24167
|
+
step.release();
|
|
24168
|
+
});
|
|
24126
24169
|
}
|
|
24127
24170
|
getDuration() {
|
|
24128
24171
|
return this._duration;
|
|
@@ -24196,6 +24239,10 @@
|
|
|
24196
24239
|
getLoop() {
|
|
24197
24240
|
return this._loopCount;
|
|
24198
24241
|
}
|
|
24242
|
+
forEachStep(cb) {
|
|
24243
|
+
let step = this._firstStep;
|
|
24244
|
+
for (; step;) cb(step), step = step.next;
|
|
24245
|
+
}
|
|
24199
24246
|
}
|
|
24200
24247
|
|
|
24201
24248
|
const performanceRAF = new PerformanceRAF();
|
|
@@ -24428,6 +24475,9 @@
|
|
|
24428
24475
|
constructor(target) {
|
|
24429
24476
|
this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._target = target;
|
|
24430
24477
|
}
|
|
24478
|
+
get started() {
|
|
24479
|
+
return this._started;
|
|
24480
|
+
}
|
|
24431
24481
|
onStart(cb) {
|
|
24432
24482
|
cb ? (this._startCallbacks.push(cb), this._started && this._activeCount > 0 && cb()) : this._startCallbacks.forEach(cb => {
|
|
24433
24483
|
cb();
|
|
@@ -24568,14 +24618,14 @@
|
|
|
24568
24618
|
return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
|
|
24569
24619
|
}
|
|
24570
24620
|
_handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
|
|
24571
|
-
var _a, _b, _c, _d;
|
|
24621
|
+
var _a, _b, _c, _d, _e, _f;
|
|
24572
24622
|
if (custom && customType) {
|
|
24573
24623
|
const customParams = Object.assign({
|
|
24574
|
-
width: graphic.stage.width,
|
|
24575
|
-
height: graphic.stage.height,
|
|
24624
|
+
width: (null === (_a = graphic.stage) || void 0 === _a ? void 0 : _a.width) || 0,
|
|
24625
|
+
height: (null === (_b = graphic.stage) || void 0 === _b ? void 0 : _b.height) || 0,
|
|
24576
24626
|
group: this._target.parent
|
|
24577
24627
|
}, this.resolveValue(customParameters, graphic)),
|
|
24578
|
-
objOptions = isFunction$9(options) ? options.call(null, null !== (
|
|
24628
|
+
objOptions = isFunction$9(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;
|
|
24579
24629
|
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);
|
|
24580
24630
|
} else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
|
|
24581
24631
|
}
|
|
@@ -24795,7 +24845,7 @@
|
|
|
24795
24845
|
reApplyState(state) {
|
|
24796
24846
|
var _a;
|
|
24797
24847
|
const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
|
|
24798
|
-
if (stateInfo) {
|
|
24848
|
+
if (stateInfo && stateInfo.executor.started) {
|
|
24799
24849
|
const stateList = this.stateList.slice();
|
|
24800
24850
|
stateInfo.executor.stop(), this.stateList = stateList, stateInfo.executor.execute(stateInfo.animationConfig);
|
|
24801
24851
|
}
|
|
@@ -24938,6 +24988,45 @@
|
|
|
24938
24988
|
this._animator && this._animator.stop();
|
|
24939
24989
|
}
|
|
24940
24990
|
}
|
|
24991
|
+
class AStageAnimate extends ACustomAnimate {
|
|
24992
|
+
constructor(customFrom, customTo, duration, easing, params) {
|
|
24993
|
+
super(customFrom, customTo, duration, easing, params), this.willCallBeforeStageRender = !0, this.willCallAfterStageRender = !0, this._beforeStageRender = () => {
|
|
24994
|
+
if (!this.willCallBeforeStageRender) return;
|
|
24995
|
+
this.willCallBeforeStageRender = !1;
|
|
24996
|
+
const stage = this.target.stage,
|
|
24997
|
+
canvas = stage.window.getContext().canvas.nativeCanvas,
|
|
24998
|
+
outputCanvas = this.beforeStageRender(stage, canvas);
|
|
24999
|
+
outputCanvas && this.renderToStage(stage, outputCanvas);
|
|
25000
|
+
}, this._afterStageRender = () => {
|
|
25001
|
+
if (!this.willCallAfterStageRender) return;
|
|
25002
|
+
this.willCallAfterStageRender = !1;
|
|
25003
|
+
const stage = this.target.stage,
|
|
25004
|
+
canvas = stage.window.getContext().canvas.nativeCanvas,
|
|
25005
|
+
outputCanvas = this.afterStageRender(stage, canvas);
|
|
25006
|
+
outputCanvas && this.renderToStage(stage, outputCanvas);
|
|
25007
|
+
}, this.props = {};
|
|
25008
|
+
}
|
|
25009
|
+
beforeStageRender(stage, canvas) {
|
|
25010
|
+
return !1;
|
|
25011
|
+
}
|
|
25012
|
+
afterStageRender(stage, canvas) {
|
|
25013
|
+
return !1;
|
|
25014
|
+
}
|
|
25015
|
+
onFirstRun() {
|
|
25016
|
+
super.onFirstRun(), this.target.stage.setBeforeRender(this._beforeStageRender), this.target.stage.setAfterRender(this._afterStageRender), this.target.stage.disableDirtyBounds();
|
|
25017
|
+
}
|
|
25018
|
+
stop() {
|
|
25019
|
+
super.stop(), this.target.stage.removeBeforeRender(this._beforeStageRender), this.target.stage.removeAfterRender(this._afterStageRender);
|
|
25020
|
+
}
|
|
25021
|
+
onUpdate(end, ratio, out) {
|
|
25022
|
+
super.onUpdate(end, ratio, out), this.willCallBeforeStageRender = !0, this.willCallAfterStageRender = !0;
|
|
25023
|
+
}
|
|
25024
|
+
renderToStage(stage, canvas) {
|
|
25025
|
+
const stageCanvas = stage.window.getContext().canvas.nativeCanvas,
|
|
25026
|
+
ctx = stageCanvas.getContext("2d");
|
|
25027
|
+
return !!ctx && (ctx.clearRect(0, 0, stageCanvas.width, stageCanvas.height), ctx.drawImage(canvas, 0, 0), stageCanvas);
|
|
25028
|
+
}
|
|
25029
|
+
}
|
|
24941
25030
|
|
|
24942
25031
|
class ComponentAnimator {
|
|
24943
25032
|
constructor(component) {
|
|
@@ -25320,7 +25409,7 @@
|
|
|
25320
25409
|
}
|
|
25321
25410
|
class GrowAngleIn extends GrowAngleBase {
|
|
25322
25411
|
onBind() {
|
|
25323
|
-
var _a, _b;
|
|
25412
|
+
var _a, _b, _c;
|
|
25324
25413
|
super.onBind();
|
|
25325
25414
|
const {
|
|
25326
25415
|
from: from,
|
|
@@ -25329,7 +25418,7 @@
|
|
|
25329
25418
|
fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
25330
25419
|
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
|
|
25331
25420
|
const finalAttribute = this.target.getFinalAttribute();
|
|
25332
|
-
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs), this.determineUpdateFunction();
|
|
25421
|
+
finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(fromAttrs), this.determineUpdateFunction();
|
|
25333
25422
|
}
|
|
25334
25423
|
}
|
|
25335
25424
|
class GrowAngleOut extends GrowAngleBase {
|
|
@@ -25937,7 +26026,7 @@
|
|
|
25937
26026
|
}
|
|
25938
26027
|
class GrowRadiusIn extends GrowPointsBase {
|
|
25939
26028
|
onBind() {
|
|
25940
|
-
var _a, _b;
|
|
26029
|
+
var _a, _b, _c;
|
|
25941
26030
|
super.onBind();
|
|
25942
26031
|
const {
|
|
25943
26032
|
from: from,
|
|
@@ -25946,7 +26035,7 @@
|
|
|
25946
26035
|
fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
25947
26036
|
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
|
|
25948
26037
|
const finalAttribute = this.target.getFinalAttribute();
|
|
25949
|
-
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
|
|
26038
|
+
finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(fromAttrs);
|
|
25950
26039
|
}
|
|
25951
26040
|
}
|
|
25952
26041
|
class GrowRadiusOut extends GrowPointsBase {
|
|
@@ -26061,7 +26150,7 @@
|
|
|
26061
26150
|
super(from, to, duration, easing, params);
|
|
26062
26151
|
}
|
|
26063
26152
|
onBind() {
|
|
26064
|
-
var _a, _b;
|
|
26153
|
+
var _a, _b, _c;
|
|
26065
26154
|
super.onBind();
|
|
26066
26155
|
const {
|
|
26067
26156
|
from: from,
|
|
@@ -26070,7 +26159,7 @@
|
|
|
26070
26159
|
fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
26071
26160
|
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
|
|
26072
26161
|
const finalAttribute = this.target.getFinalAttribute();
|
|
26073
|
-
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
|
|
26162
|
+
finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(fromAttrs);
|
|
26074
26163
|
}
|
|
26075
26164
|
onEnd(cb) {
|
|
26076
26165
|
super.onEnd(cb);
|
|
@@ -27854,8 +27943,1271 @@
|
|
|
27854
27943
|
}
|
|
27855
27944
|
}
|
|
27856
27945
|
|
|
27946
|
+
class DisappearAnimateBase extends AStageAnimate {
|
|
27947
|
+
constructor(from, to, duration, easing, params) {
|
|
27948
|
+
super(from, to, duration, easing, params), this.webglCanvas = null, this.gl = null, this.program = null, this.currentAnimationRatio = 0, this.animationTime = 0;
|
|
27949
|
+
}
|
|
27950
|
+
onUpdate(end, ratio, out) {
|
|
27951
|
+
super.onUpdate(end, ratio, out), this.currentAnimationRatio = ratio, this.animationTime = ratio * Math.PI * 2;
|
|
27952
|
+
}
|
|
27953
|
+
getAnimationTime() {
|
|
27954
|
+
return this.currentAnimationRatio > 0 ? this.animationTime : Date.now() / 1e3;
|
|
27955
|
+
}
|
|
27956
|
+
getDurationFromParent() {
|
|
27957
|
+
return this.duration || 1e3;
|
|
27958
|
+
}
|
|
27959
|
+
initWebGL(canvas) {
|
|
27960
|
+
try {
|
|
27961
|
+
if (this.webglCanvas = vglobal.createCanvas({
|
|
27962
|
+
width: canvas.width,
|
|
27963
|
+
height: canvas.height,
|
|
27964
|
+
dpr: vglobal.devicePixelRatio
|
|
27965
|
+
}), !this.webglCanvas) return (void 0), !1;
|
|
27966
|
+
this.webglCanvas.style.width = canvas.style.width || `${canvas.width}px`, this.webglCanvas.style.height = canvas.style.height || `${canvas.height}px`;
|
|
27967
|
+
let glContext = null;
|
|
27968
|
+
try {
|
|
27969
|
+
glContext = this.webglCanvas.getContext("webgl"), glContext || (glContext = this.webglCanvas.getContext("experimental-webgl"));
|
|
27970
|
+
} catch (e) {
|
|
27971
|
+
}
|
|
27972
|
+
if (this.gl = glContext, !this.gl) return (void 0), !1;
|
|
27973
|
+
const shaders = this.getShaderSources();
|
|
27974
|
+
return this.program = this.createShaderProgram(shaders.vertex, shaders.fragment), null !== this.program;
|
|
27975
|
+
} catch (error) {
|
|
27976
|
+
return !1;
|
|
27977
|
+
}
|
|
27978
|
+
}
|
|
27979
|
+
createShaderProgram(vertexSource, fragmentSource) {
|
|
27980
|
+
if (!this.gl) return null;
|
|
27981
|
+
const vertexShader = this.createShader(this.gl.VERTEX_SHADER, vertexSource),
|
|
27982
|
+
fragmentShader = this.createShader(this.gl.FRAGMENT_SHADER, fragmentSource);
|
|
27983
|
+
if (!vertexShader || !fragmentShader) return null;
|
|
27984
|
+
const program = this.gl.createProgram();
|
|
27985
|
+
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;
|
|
27986
|
+
}
|
|
27987
|
+
createShader(type, source) {
|
|
27988
|
+
if (!this.gl) return null;
|
|
27989
|
+
const shader = this.gl.createShader(type);
|
|
27990
|
+
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;
|
|
27991
|
+
}
|
|
27992
|
+
setupWebGLState(canvas) {
|
|
27993
|
+
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));
|
|
27994
|
+
}
|
|
27995
|
+
createFullScreenQuad() {
|
|
27996
|
+
if (!this.gl) return null;
|
|
27997
|
+
const vertices = new Float32Array([-1, -1, 0, 1, 1, -1, 1, 1, -1, 1, 0, 0, 1, 1, 1, 0]),
|
|
27998
|
+
vertexBuffer = this.gl.createBuffer();
|
|
27999
|
+
return this.gl.bindBuffer(this.gl.ARRAY_BUFFER, vertexBuffer), this.gl.bufferData(this.gl.ARRAY_BUFFER, vertices, this.gl.STATIC_DRAW), vertexBuffer;
|
|
28000
|
+
}
|
|
28001
|
+
createTextureFromCanvas(canvas) {
|
|
28002
|
+
if (!this.gl) return null;
|
|
28003
|
+
const texture = this.gl.createTexture();
|
|
28004
|
+
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;
|
|
28005
|
+
}
|
|
28006
|
+
setupVertexAttributes() {
|
|
28007
|
+
if (!this.gl || !this.program) return;
|
|
28008
|
+
const positionLocation = this.gl.getAttribLocation(this.program, "a_position"),
|
|
28009
|
+
texCoordLocation = this.gl.getAttribLocation(this.program, "a_texCoord");
|
|
28010
|
+
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);
|
|
28011
|
+
}
|
|
28012
|
+
createOutputCanvas(canvas) {
|
|
28013
|
+
const outputCanvas = vglobal.createCanvas({
|
|
28014
|
+
width: canvas.width,
|
|
28015
|
+
height: canvas.height,
|
|
28016
|
+
dpr: vglobal.devicePixelRatio
|
|
28017
|
+
}),
|
|
28018
|
+
ctx = outputCanvas.getContext("2d");
|
|
28019
|
+
return ctx ? (ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.drawImage(canvas, 0, 0), {
|
|
28020
|
+
canvas: outputCanvas,
|
|
28021
|
+
ctx: ctx
|
|
28022
|
+
}) : null;
|
|
28023
|
+
}
|
|
28024
|
+
getShaderSources() {
|
|
28025
|
+
return null;
|
|
28026
|
+
}
|
|
28027
|
+
applyWebGLEffect(canvas) {
|
|
28028
|
+
return null;
|
|
28029
|
+
}
|
|
28030
|
+
applyCanvas2DEffect(canvas) {
|
|
28031
|
+
return null;
|
|
28032
|
+
}
|
|
28033
|
+
supportsWebGL() {
|
|
28034
|
+
return null !== this.getShaderSources();
|
|
28035
|
+
}
|
|
28036
|
+
supportsCanvas2D() {
|
|
28037
|
+
return this.applyCanvas2DEffect !== DisappearAnimateBase.prototype.applyCanvas2DEffect;
|
|
28038
|
+
}
|
|
28039
|
+
release() {
|
|
28040
|
+
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;
|
|
28041
|
+
}
|
|
28042
|
+
afterStageRender(stage, canvas) {
|
|
28043
|
+
let result = null;
|
|
28044
|
+
if (this.supportsWebGL() && (this.gl || this.initWebGL(canvas) || (void 0), this.gl)) {
|
|
28045
|
+
if (result = this.applyWebGLEffect(canvas), result) return result;
|
|
28046
|
+
}
|
|
28047
|
+
if (this.supportsCanvas2D()) {
|
|
28048
|
+
if (result = this.applyCanvas2DEffect(canvas), result) return result;
|
|
28049
|
+
}
|
|
28050
|
+
return this.supportsWebGL() || this.supportsCanvas2D() || (void 0), canvas;
|
|
28051
|
+
}
|
|
28052
|
+
}
|
|
28053
|
+
|
|
28054
|
+
class Canvas2DEffectBase extends DisappearAnimateBase {
|
|
28055
|
+
constructor(from, to, duration, easing, params) {
|
|
28056
|
+
super(from, to, duration, easing, params);
|
|
28057
|
+
}
|
|
28058
|
+
getShaderSources() {
|
|
28059
|
+
return null;
|
|
28060
|
+
}
|
|
28061
|
+
applyWebGLEffect(canvas) {
|
|
28062
|
+
return null;
|
|
28063
|
+
}
|
|
28064
|
+
}
|
|
28065
|
+
class HybridEffectBase extends DisappearAnimateBase {
|
|
28066
|
+
constructor(from, to, duration, easing, params) {
|
|
28067
|
+
super(from, to, duration, easing, params);
|
|
28068
|
+
}
|
|
28069
|
+
getShaderSources() {
|
|
28070
|
+
return null;
|
|
28071
|
+
}
|
|
28072
|
+
applyWebGLEffect(canvas) {
|
|
28073
|
+
return null;
|
|
28074
|
+
}
|
|
28075
|
+
applyCanvas2DEffect(canvas) {
|
|
28076
|
+
return null;
|
|
28077
|
+
}
|
|
28078
|
+
supportsWebGL() {
|
|
28079
|
+
return this.getShaderSources !== HybridEffectBase.prototype.getShaderSources && null !== this.getShaderSources();
|
|
28080
|
+
}
|
|
28081
|
+
supportsCanvas2D() {
|
|
28082
|
+
return this.applyCanvas2DEffect !== HybridEffectBase.prototype.applyCanvas2DEffect;
|
|
28083
|
+
}
|
|
28084
|
+
afterStageRender(stage, canvas) {
|
|
28085
|
+
var _a, _b;
|
|
28086
|
+
let result = null;
|
|
28087
|
+
if (!1 !== (null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.options) || void 0 === _b ? void 0 : _b.useWebGL)) {
|
|
28088
|
+
if (this.supportsWebGL() && (this.gl || this.initWebGL(canvas) || (void 0), this.gl)) {
|
|
28089
|
+
if (result = this.applyWebGLEffect(canvas), result) return result;
|
|
28090
|
+
}
|
|
28091
|
+
if (this.supportsCanvas2D()) {
|
|
28092
|
+
if (result = this.applyCanvas2DEffect(canvas), result) return result;
|
|
28093
|
+
}
|
|
28094
|
+
} else if (this.supportsCanvas2D()) {
|
|
28095
|
+
if (result = this.applyCanvas2DEffect(canvas), result) return result;
|
|
28096
|
+
} else ;
|
|
28097
|
+
return this.supportsWebGL() || this.supportsCanvas2D() || (void 0), canvas;
|
|
28098
|
+
}
|
|
28099
|
+
}
|
|
28100
|
+
|
|
28101
|
+
class ImageProcessUtils {
|
|
28102
|
+
static createTempCanvas(width, height, dpr) {
|
|
28103
|
+
return vglobal.createCanvas({
|
|
28104
|
+
width: width,
|
|
28105
|
+
height: height,
|
|
28106
|
+
dpr: dpr || vglobal.devicePixelRatio
|
|
28107
|
+
});
|
|
28108
|
+
}
|
|
28109
|
+
static cloneImageData(imageData) {
|
|
28110
|
+
const clonedData = new Uint8ClampedArray(imageData.data);
|
|
28111
|
+
return new ImageData(clonedData, imageData.width, imageData.height);
|
|
28112
|
+
}
|
|
28113
|
+
static lerp(start, end, t) {
|
|
28114
|
+
return start * (1 - t) + end * t;
|
|
28115
|
+
}
|
|
28116
|
+
static smoothstep(edge0, edge1, x) {
|
|
28117
|
+
const t = Math.max(0, Math.min(1, (x - edge0) / (edge1 - edge0)));
|
|
28118
|
+
return t * t * (3 - 2 * t);
|
|
28119
|
+
}
|
|
28120
|
+
static distance(x1, y1, x2, y2) {
|
|
28121
|
+
const dx = x2 - x1,
|
|
28122
|
+
dy = y2 - y1;
|
|
28123
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
28124
|
+
}
|
|
28125
|
+
static normalizeAngle(angle) {
|
|
28126
|
+
return (angle + Math.PI) / (2 * Math.PI);
|
|
28127
|
+
}
|
|
28128
|
+
static pixelNoise(x, y, pixelSize) {
|
|
28129
|
+
if (pixelSize <= 0) return 0;
|
|
28130
|
+
const gridX = Math.floor(x / pixelSize) * pixelSize,
|
|
28131
|
+
gridY = Math.floor(y / pixelSize) * pixelSize,
|
|
28132
|
+
n = 43758.5453 * Math.sin(12.9898 * gridX + 78.233 * gridY);
|
|
28133
|
+
return n - Math.floor(n);
|
|
28134
|
+
}
|
|
28135
|
+
static generateNoiseTexture(width, height) {
|
|
28136
|
+
const data = new Uint8Array(width * height);
|
|
28137
|
+
for (let i = 0; i < data.length; i++) data[i] = Math.floor(256 * Math.random());
|
|
28138
|
+
return data;
|
|
28139
|
+
}
|
|
28140
|
+
static applyCSSFilter(canvas, filter) {
|
|
28141
|
+
const outputCanvas = this.createTempCanvas(canvas.width, canvas.height),
|
|
28142
|
+
ctx = outputCanvas.getContext("2d");
|
|
28143
|
+
return ctx ? (ctx.filter = filter, ctx.drawImage(canvas, 0, 0), ctx.filter = "none", outputCanvas) : canvas;
|
|
28144
|
+
}
|
|
28145
|
+
static extractChannel(imageData, channelIndex) {
|
|
28146
|
+
const {
|
|
28147
|
+
data: data,
|
|
28148
|
+
width: width,
|
|
28149
|
+
height: height
|
|
28150
|
+
} = imageData,
|
|
28151
|
+
channelData = new Uint8ClampedArray(data.length);
|
|
28152
|
+
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]);
|
|
28153
|
+
return new ImageData(channelData, width, height);
|
|
28154
|
+
}
|
|
28155
|
+
static blendImageData(imageData1, imageData2, ratio) {
|
|
28156
|
+
const {
|
|
28157
|
+
data: data1,
|
|
28158
|
+
width: width,
|
|
28159
|
+
height: height
|
|
28160
|
+
} = imageData1,
|
|
28161
|
+
{
|
|
28162
|
+
data: data2
|
|
28163
|
+
} = imageData2,
|
|
28164
|
+
result = new Uint8ClampedArray(data1.length);
|
|
28165
|
+
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));
|
|
28166
|
+
return new ImageData(result, width, height);
|
|
28167
|
+
}
|
|
28168
|
+
static getLuminance(r, g, b) {
|
|
28169
|
+
return .299 * r + .587 * g + .114 * b;
|
|
28170
|
+
}
|
|
28171
|
+
static applySepiaToPixel(r, g, b) {
|
|
28172
|
+
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)];
|
|
28173
|
+
}
|
|
28174
|
+
static calculateDynamicStrength(baseStrength, animationTime) {
|
|
28175
|
+
return baseStrength * (animationTime / (2 * Math.PI));
|
|
28176
|
+
}
|
|
28177
|
+
}
|
|
28178
|
+
class ShaderLibrary {}
|
|
28179
|
+
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 ";
|
|
28180
|
+
|
|
28181
|
+
class Dissolve extends HybridEffectBase {
|
|
28182
|
+
constructor(from, to, duration, easing, params) {
|
|
28183
|
+
var _a, _b, _c, _d;
|
|
28184
|
+
super(from, to, duration, easing, params), this.noiseData = null;
|
|
28185
|
+
const rawNoiseScale = null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.noiseScale,
|
|
28186
|
+
clampedNoiseScale = void 0 !== rawNoiseScale ? Math.max(0, Math.floor(rawNoiseScale)) : 8;
|
|
28187
|
+
this.dissolveConfig = {
|
|
28188
|
+
dissolveType: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.dissolveType) || "outward",
|
|
28189
|
+
useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL,
|
|
28190
|
+
noiseScale: clampedNoiseScale,
|
|
28191
|
+
fadeEdge: void 0 === (null === (_d = null == params ? void 0 : params.options) || void 0 === _d ? void 0 : _d.fadeEdge) || params.options.fadeEdge
|
|
28192
|
+
};
|
|
28193
|
+
}
|
|
28194
|
+
getShaderSources() {
|
|
28195
|
+
return {
|
|
28196
|
+
vertex: ShaderLibrary.STANDARD_VERTEX_SHADER,
|
|
28197
|
+
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 `
|
|
28198
|
+
};
|
|
28199
|
+
}
|
|
28200
|
+
applyWebGLEffect(canvas) {
|
|
28201
|
+
if (!this.gl || !this.program || !this.webglCanvas) return canvas;
|
|
28202
|
+
this.setupWebGLState(canvas);
|
|
28203
|
+
const texture = this.createTextureFromCanvas(canvas);
|
|
28204
|
+
if (!texture) return canvas;
|
|
28205
|
+
this.noiseData || (this.noiseData = ImageProcessUtils.generateNoiseTexture(256, 256));
|
|
28206
|
+
const noiseTexture = this.gl.createTexture();
|
|
28207
|
+
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);
|
|
28208
|
+
const vertexBuffer = this.createFullScreenQuad();
|
|
28209
|
+
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;
|
|
28210
|
+
}
|
|
28211
|
+
setUniforms() {
|
|
28212
|
+
if (!this.gl || !this.program || !this.webglCanvas) return;
|
|
28213
|
+
const textureLocation = this.gl.getUniformLocation(this.program, "u_texture"),
|
|
28214
|
+
noiseTextureLocation = this.gl.getUniformLocation(this.program, "u_noiseTexture"),
|
|
28215
|
+
timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
|
|
28216
|
+
dissolveTypeLocation = this.gl.getUniformLocation(this.program, "u_dissolveType"),
|
|
28217
|
+
resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution"),
|
|
28218
|
+
noiseScaleLocation = this.gl.getUniformLocation(this.program, "u_noiseScale"),
|
|
28219
|
+
fadeEdgeLocation = this.gl.getUniformLocation(this.program, "u_fadeEdge");
|
|
28220
|
+
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);
|
|
28221
|
+
this.gl.uniform1i(dissolveTypeLocation, {
|
|
28222
|
+
outward: 0,
|
|
28223
|
+
inward: 1,
|
|
28224
|
+
radial: 2,
|
|
28225
|
+
leftToRight: 3,
|
|
28226
|
+
rightToLeft: 4,
|
|
28227
|
+
topToBottom: 5,
|
|
28228
|
+
bottomToTop: 6
|
|
28229
|
+
}[this.dissolveConfig.dissolveType] || 0);
|
|
28230
|
+
}
|
|
28231
|
+
applyCanvas2DEffect(canvas) {
|
|
28232
|
+
const outputCanvas = this.createOutputCanvas(canvas);
|
|
28233
|
+
if (!outputCanvas) return canvas;
|
|
28234
|
+
const {
|
|
28235
|
+
canvas: outputCanvasElement,
|
|
28236
|
+
ctx: ctx
|
|
28237
|
+
} = outputCanvas,
|
|
28238
|
+
imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
28239
|
+
progress = this.currentAnimationRatio;
|
|
28240
|
+
let dissolvedImageData;
|
|
28241
|
+
switch (this.dissolveConfig.dissolveType) {
|
|
28242
|
+
case "outward":
|
|
28243
|
+
dissolvedImageData = this.applyOutwardDissolve(imageData, progress);
|
|
28244
|
+
break;
|
|
28245
|
+
case "inward":
|
|
28246
|
+
dissolvedImageData = this.applyInwardDissolve(imageData, progress);
|
|
28247
|
+
break;
|
|
28248
|
+
case "radial":
|
|
28249
|
+
dissolvedImageData = this.applyRadialDissolve(imageData, progress);
|
|
28250
|
+
break;
|
|
28251
|
+
case "leftToRight":
|
|
28252
|
+
dissolvedImageData = this.applyLeftToRightDissolve(imageData, progress);
|
|
28253
|
+
break;
|
|
28254
|
+
case "rightToLeft":
|
|
28255
|
+
dissolvedImageData = this.applyRightToLeftDissolve(imageData, progress);
|
|
28256
|
+
break;
|
|
28257
|
+
case "topToBottom":
|
|
28258
|
+
dissolvedImageData = this.applyTopToBottomDissolve(imageData, progress);
|
|
28259
|
+
break;
|
|
28260
|
+
case "bottomToTop":
|
|
28261
|
+
dissolvedImageData = this.applyBottomToTopDissolve(imageData, progress);
|
|
28262
|
+
break;
|
|
28263
|
+
default:
|
|
28264
|
+
dissolvedImageData = imageData;
|
|
28265
|
+
}
|
|
28266
|
+
return ctx.putImageData(dissolvedImageData, 0, 0), outputCanvasElement;
|
|
28267
|
+
}
|
|
28268
|
+
applyOutwardDissolve(imageData, progress) {
|
|
28269
|
+
const {
|
|
28270
|
+
data: data,
|
|
28271
|
+
width: width,
|
|
28272
|
+
height: height
|
|
28273
|
+
} = imageData,
|
|
28274
|
+
result = new Uint8ClampedArray(data.length);
|
|
28275
|
+
result.set(data);
|
|
28276
|
+
const centerX = width / 2,
|
|
28277
|
+
centerY = height / 2,
|
|
28278
|
+
maxDist = Math.sqrt(centerX * centerX + centerY * centerY),
|
|
28279
|
+
pixelSize = this.dissolveConfig.noiseScale;
|
|
28280
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
28281
|
+
const dx = x - centerX,
|
|
28282
|
+
dy = y - centerY,
|
|
28283
|
+
normalizedDist = Math.sqrt(dx * dx + dy * dy) / maxDist;
|
|
28284
|
+
let dissolveThreshold = 1.2 - 1.4 * progress,
|
|
28285
|
+
alpha = 1;
|
|
28286
|
+
if (pixelSize > 0) {
|
|
28287
|
+
dissolveThreshold += .4 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedDist > dissolveThreshold ? 0 : 1;
|
|
28288
|
+
} else if (this.dissolveConfig.fadeEdge) {
|
|
28289
|
+
const fadeStart = dissolveThreshold - .15;
|
|
28290
|
+
alpha = normalizedDist < fadeStart ? 1 : normalizedDist > dissolveThreshold ? 0 : 1 - (normalizedDist - fadeStart) / (dissolveThreshold - fadeStart);
|
|
28291
|
+
} else alpha = normalizedDist > dissolveThreshold ? 0 : 1;
|
|
28292
|
+
const index = 4 * (y * width + x);
|
|
28293
|
+
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
28294
|
+
}
|
|
28295
|
+
return new ImageData(result, width, height);
|
|
28296
|
+
}
|
|
28297
|
+
applyInwardDissolve(imageData, progress) {
|
|
28298
|
+
const {
|
|
28299
|
+
data: data,
|
|
28300
|
+
width: width,
|
|
28301
|
+
height: height
|
|
28302
|
+
} = imageData,
|
|
28303
|
+
result = new Uint8ClampedArray(data.length);
|
|
28304
|
+
result.set(data);
|
|
28305
|
+
const centerX = width / 2,
|
|
28306
|
+
centerY = height / 2,
|
|
28307
|
+
maxDist = Math.sqrt(centerX * centerX + centerY * centerY),
|
|
28308
|
+
pixelSize = this.dissolveConfig.noiseScale;
|
|
28309
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
28310
|
+
const dx = x - centerX,
|
|
28311
|
+
dy = y - centerY,
|
|
28312
|
+
normalizedDist = Math.sqrt(dx * dx + dy * dy) / maxDist;
|
|
28313
|
+
let dissolveThreshold = 1.4 * progress,
|
|
28314
|
+
alpha = 1;
|
|
28315
|
+
if (pixelSize > 0) {
|
|
28316
|
+
dissolveThreshold += .4 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedDist < dissolveThreshold ? 0 : 1;
|
|
28317
|
+
} else if (this.dissolveConfig.fadeEdge) {
|
|
28318
|
+
const fadeEnd = dissolveThreshold + .15;
|
|
28319
|
+
alpha = normalizedDist < dissolveThreshold ? 0 : normalizedDist > fadeEnd ? 1 : (normalizedDist - dissolveThreshold) / (fadeEnd - dissolveThreshold);
|
|
28320
|
+
} else alpha = normalizedDist < dissolveThreshold ? 0 : 1;
|
|
28321
|
+
const index = 4 * (y * width + x);
|
|
28322
|
+
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
28323
|
+
}
|
|
28324
|
+
return new ImageData(result, width, height);
|
|
28325
|
+
}
|
|
28326
|
+
applyRadialDissolve(imageData, progress) {
|
|
28327
|
+
const {
|
|
28328
|
+
data: data,
|
|
28329
|
+
width: width,
|
|
28330
|
+
height: height
|
|
28331
|
+
} = imageData,
|
|
28332
|
+
result = new Uint8ClampedArray(data.length);
|
|
28333
|
+
result.set(data);
|
|
28334
|
+
const centerX = width / 2,
|
|
28335
|
+
centerY = height / 2,
|
|
28336
|
+
pixelSize = this.dissolveConfig.noiseScale;
|
|
28337
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
28338
|
+
const dx = x - centerX,
|
|
28339
|
+
dy = y - centerY,
|
|
28340
|
+
normalizedAngle = (Math.atan2(dy, dx) + Math.PI) / (2 * Math.PI);
|
|
28341
|
+
let dissolveThreshold = 1.2 * progress,
|
|
28342
|
+
alpha = 1;
|
|
28343
|
+
if (pixelSize > 0) {
|
|
28344
|
+
dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedAngle < dissolveThreshold ? 0 : 1;
|
|
28345
|
+
} else if (this.dissolveConfig.fadeEdge) {
|
|
28346
|
+
const fadeEnd = dissolveThreshold + .08;
|
|
28347
|
+
alpha = normalizedAngle < dissolveThreshold ? 0 : normalizedAngle > fadeEnd ? 1 : (normalizedAngle - dissolveThreshold) / (fadeEnd - dissolveThreshold);
|
|
28348
|
+
} else alpha = normalizedAngle < dissolveThreshold ? 0 : 1;
|
|
28349
|
+
const index = 4 * (y * width + x);
|
|
28350
|
+
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
28351
|
+
}
|
|
28352
|
+
return new ImageData(result, width, height);
|
|
28353
|
+
}
|
|
28354
|
+
applyLeftToRightDissolve(imageData, progress) {
|
|
28355
|
+
const {
|
|
28356
|
+
data: data,
|
|
28357
|
+
width: width,
|
|
28358
|
+
height: height
|
|
28359
|
+
} = imageData,
|
|
28360
|
+
result = new Uint8ClampedArray(data.length);
|
|
28361
|
+
result.set(data);
|
|
28362
|
+
const pixelSize = this.dissolveConfig.noiseScale;
|
|
28363
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
28364
|
+
const normalizedX = x / width;
|
|
28365
|
+
let dissolveThreshold = 1.2 * progress,
|
|
28366
|
+
alpha = 1;
|
|
28367
|
+
if (pixelSize > 0) {
|
|
28368
|
+
dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedX < dissolveThreshold ? 0 : 1;
|
|
28369
|
+
} else if (this.dissolveConfig.fadeEdge) {
|
|
28370
|
+
const fadeEnd = dissolveThreshold + .08;
|
|
28371
|
+
alpha = normalizedX < dissolveThreshold ? 0 : normalizedX > fadeEnd ? 1 : (normalizedX - dissolveThreshold) / (fadeEnd - dissolveThreshold);
|
|
28372
|
+
} else alpha = normalizedX < dissolveThreshold ? 0 : 1;
|
|
28373
|
+
const index = 4 * (y * width + x);
|
|
28374
|
+
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
28375
|
+
}
|
|
28376
|
+
return new ImageData(result, width, height);
|
|
28377
|
+
}
|
|
28378
|
+
applyRightToLeftDissolve(imageData, progress) {
|
|
28379
|
+
const {
|
|
28380
|
+
data: data,
|
|
28381
|
+
width: width,
|
|
28382
|
+
height: height
|
|
28383
|
+
} = imageData,
|
|
28384
|
+
result = new Uint8ClampedArray(data.length);
|
|
28385
|
+
result.set(data);
|
|
28386
|
+
const pixelSize = this.dissolveConfig.noiseScale;
|
|
28387
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
28388
|
+
const normalizedX = x / width;
|
|
28389
|
+
let dissolveThreshold = 1 - 1.2 * progress,
|
|
28390
|
+
alpha = 1;
|
|
28391
|
+
if (pixelSize > 0) {
|
|
28392
|
+
dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedX > dissolveThreshold ? 0 : 1;
|
|
28393
|
+
} else if (this.dissolveConfig.fadeEdge) {
|
|
28394
|
+
const fadeStart = dissolveThreshold - .08;
|
|
28395
|
+
alpha = normalizedX < fadeStart ? 1 : normalizedX > dissolveThreshold ? 0 : 1 - (normalizedX - fadeStart) / (dissolveThreshold - fadeStart);
|
|
28396
|
+
} else alpha = normalizedX > dissolveThreshold ? 0 : 1;
|
|
28397
|
+
const index = 4 * (y * width + x);
|
|
28398
|
+
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
28399
|
+
}
|
|
28400
|
+
return new ImageData(result, width, height);
|
|
28401
|
+
}
|
|
28402
|
+
applyTopToBottomDissolve(imageData, progress) {
|
|
28403
|
+
const {
|
|
28404
|
+
data: data,
|
|
28405
|
+
width: width,
|
|
28406
|
+
height: height
|
|
28407
|
+
} = imageData,
|
|
28408
|
+
result = new Uint8ClampedArray(data.length);
|
|
28409
|
+
result.set(data);
|
|
28410
|
+
const pixelSize = this.dissolveConfig.noiseScale;
|
|
28411
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
28412
|
+
const normalizedY = y / height;
|
|
28413
|
+
let dissolveThreshold = 1.2 * progress,
|
|
28414
|
+
alpha = 1;
|
|
28415
|
+
if (pixelSize > 0) {
|
|
28416
|
+
dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedY < dissolveThreshold ? 0 : 1;
|
|
28417
|
+
} else if (this.dissolveConfig.fadeEdge) {
|
|
28418
|
+
const fadeEnd = dissolveThreshold + .08;
|
|
28419
|
+
alpha = normalizedY < dissolveThreshold ? 0 : normalizedY > fadeEnd ? 1 : (normalizedY - dissolveThreshold) / (fadeEnd - dissolveThreshold);
|
|
28420
|
+
} else alpha = normalizedY < dissolveThreshold ? 0 : 1;
|
|
28421
|
+
const index = 4 * (y * width + x);
|
|
28422
|
+
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
28423
|
+
}
|
|
28424
|
+
return new ImageData(result, width, height);
|
|
28425
|
+
}
|
|
28426
|
+
applyBottomToTopDissolve(imageData, progress) {
|
|
28427
|
+
const {
|
|
28428
|
+
data: data,
|
|
28429
|
+
width: width,
|
|
28430
|
+
height: height
|
|
28431
|
+
} = imageData,
|
|
28432
|
+
result = new Uint8ClampedArray(data.length);
|
|
28433
|
+
result.set(data);
|
|
28434
|
+
const pixelSize = this.dissolveConfig.noiseScale;
|
|
28435
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
28436
|
+
const normalizedY = y / height;
|
|
28437
|
+
let dissolveThreshold = 1 - 1.2 * progress,
|
|
28438
|
+
alpha = 1;
|
|
28439
|
+
if (pixelSize > 0) {
|
|
28440
|
+
dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedY > dissolveThreshold ? 0 : 1;
|
|
28441
|
+
} else if (this.dissolveConfig.fadeEdge) {
|
|
28442
|
+
const fadeStart = dissolveThreshold - .08;
|
|
28443
|
+
alpha = normalizedY < fadeStart ? 1 : normalizedY > dissolveThreshold ? 0 : 1 - (normalizedY - fadeStart) / (dissolveThreshold - fadeStart);
|
|
28444
|
+
} else alpha = normalizedY > dissolveThreshold ? 0 : 1;
|
|
28445
|
+
const index = 4 * (y * width + x);
|
|
28446
|
+
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
28447
|
+
}
|
|
28448
|
+
return new ImageData(result, width, height);
|
|
28449
|
+
}
|
|
28450
|
+
}
|
|
28451
|
+
|
|
28452
|
+
class Grayscale extends HybridEffectBase {
|
|
28453
|
+
constructor(from, to, duration, easing, params) {
|
|
28454
|
+
var _a, _b, _c;
|
|
28455
|
+
super(from, to, duration, easing, params);
|
|
28456
|
+
const rawStrength = void 0 !== (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.strength) ? params.options.strength : 1,
|
|
28457
|
+
clampedStrength = Math.max(0, Math.min(1, rawStrength));
|
|
28458
|
+
this.colorConfig = {
|
|
28459
|
+
effectType: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.effectType) || "grayscale",
|
|
28460
|
+
strength: clampedStrength,
|
|
28461
|
+
useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL
|
|
28462
|
+
};
|
|
28463
|
+
}
|
|
28464
|
+
getShaderSources() {
|
|
28465
|
+
return {
|
|
28466
|
+
vertex: ShaderLibrary.STANDARD_VERTEX_SHADER,
|
|
28467
|
+
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 `
|
|
28468
|
+
};
|
|
28469
|
+
}
|
|
28470
|
+
applyWebGLEffect(canvas) {
|
|
28471
|
+
if (!this.gl || !this.program || !this.webglCanvas) return null;
|
|
28472
|
+
this.setupWebGLState(canvas);
|
|
28473
|
+
const texture = this.createTextureFromCanvas(canvas);
|
|
28474
|
+
if (!texture) return null;
|
|
28475
|
+
const vertexBuffer = this.createFullScreenQuad();
|
|
28476
|
+
if (!vertexBuffer) return this.gl.deleteTexture(texture), null;
|
|
28477
|
+
try {
|
|
28478
|
+
return this.gl.useProgram(this.program), this.setupVertexAttributes(), this.setColorUniforms(), this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4), this.webglCanvas;
|
|
28479
|
+
} finally {
|
|
28480
|
+
this.gl.deleteTexture(texture), this.gl.deleteBuffer(vertexBuffer);
|
|
28481
|
+
}
|
|
28482
|
+
}
|
|
28483
|
+
setColorUniforms() {
|
|
28484
|
+
if (!this.gl || !this.program) return;
|
|
28485
|
+
const currentTime = this.getAnimationTime(),
|
|
28486
|
+
timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
|
|
28487
|
+
strengthLocation = this.gl.getUniformLocation(this.program, "u_strength"),
|
|
28488
|
+
effectTypeLocation = this.gl.getUniformLocation(this.program, "u_effectType"),
|
|
28489
|
+
resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution");
|
|
28490
|
+
this.gl.uniform1f(timeLocation, currentTime), this.gl.uniform1f(strengthLocation, this.colorConfig.strength), this.gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height);
|
|
28491
|
+
this.gl.uniform1i(effectTypeLocation, {
|
|
28492
|
+
grayscale: 0,
|
|
28493
|
+
sepia: 1
|
|
28494
|
+
}[this.colorConfig.effectType] || 0);
|
|
28495
|
+
}
|
|
28496
|
+
applyCanvas2DEffect(canvas) {
|
|
28497
|
+
if (this.colorConfig.strength <= 0) {
|
|
28498
|
+
const outputCanvas = this.createOutputCanvas(canvas);
|
|
28499
|
+
return outputCanvas ? outputCanvas.canvas : null;
|
|
28500
|
+
}
|
|
28501
|
+
if (this.canUseCSSFilter()) return this.applyCSSFilter(canvas);
|
|
28502
|
+
const outputCanvas = this.createOutputCanvas(canvas);
|
|
28503
|
+
if (!outputCanvas) return null;
|
|
28504
|
+
const {
|
|
28505
|
+
ctx: ctx
|
|
28506
|
+
} = outputCanvas;
|
|
28507
|
+
try {
|
|
28508
|
+
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
28509
|
+
currentTime = this.getAnimationTime();
|
|
28510
|
+
let processedImageData;
|
|
28511
|
+
switch (this.colorConfig.effectType) {
|
|
28512
|
+
case "grayscale":
|
|
28513
|
+
default:
|
|
28514
|
+
processedImageData = this.applyGrayscaleEffect(imageData, this.colorConfig.strength, currentTime);
|
|
28515
|
+
break;
|
|
28516
|
+
case "sepia":
|
|
28517
|
+
processedImageData = this.applySepiaEffect(imageData, this.colorConfig.strength, currentTime);
|
|
28518
|
+
}
|
|
28519
|
+
return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(processedImageData, 0, 0), outputCanvas.canvas;
|
|
28520
|
+
} catch (error) {
|
|
28521
|
+
return null;
|
|
28522
|
+
}
|
|
28523
|
+
}
|
|
28524
|
+
canUseCSSFilter() {
|
|
28525
|
+
var _a;
|
|
28526
|
+
return !!window.useFilterAPI && "undefined" != typeof CSS && (null === (_a = CSS.supports) || void 0 === _a ? void 0 : _a.call(CSS, "filter", "grayscale(1)"));
|
|
28527
|
+
}
|
|
28528
|
+
applyCSSFilter(canvas) {
|
|
28529
|
+
try {
|
|
28530
|
+
const outputCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height),
|
|
28531
|
+
ctx = outputCanvas.getContext("2d");
|
|
28532
|
+
if (!ctx) return null;
|
|
28533
|
+
const currentTime = this.getAnimationTime(),
|
|
28534
|
+
dynamicStrength = ImageProcessUtils.calculateDynamicStrength(this.colorConfig.strength, currentTime);
|
|
28535
|
+
let filterValue = "";
|
|
28536
|
+
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;
|
|
28537
|
+
} catch (error) {
|
|
28538
|
+
return null;
|
|
28539
|
+
}
|
|
28540
|
+
}
|
|
28541
|
+
applyGrayscaleEffect(imageData, strength, time) {
|
|
28542
|
+
const {
|
|
28543
|
+
data: data,
|
|
28544
|
+
width: width,
|
|
28545
|
+
height: height
|
|
28546
|
+
} = imageData,
|
|
28547
|
+
result = new Uint8ClampedArray(data.length),
|
|
28548
|
+
dynamicStrength = ImageProcessUtils.calculateDynamicStrength(strength, time);
|
|
28549
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
28550
|
+
const r = data[i],
|
|
28551
|
+
g = data[i + 1],
|
|
28552
|
+
b = data[i + 2],
|
|
28553
|
+
a = data[i + 3],
|
|
28554
|
+
gray = ImageProcessUtils.getLuminance(r, g, b);
|
|
28555
|
+
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;
|
|
28556
|
+
}
|
|
28557
|
+
return new ImageData(result, width, height);
|
|
28558
|
+
}
|
|
28559
|
+
applySepiaEffect(imageData, strength, time) {
|
|
28560
|
+
const {
|
|
28561
|
+
data: data,
|
|
28562
|
+
width: width,
|
|
28563
|
+
height: height
|
|
28564
|
+
} = imageData,
|
|
28565
|
+
result = new Uint8ClampedArray(data.length),
|
|
28566
|
+
dynamicStrength = ImageProcessUtils.calculateDynamicStrength(strength, time);
|
|
28567
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
28568
|
+
const r = data[i],
|
|
28569
|
+
g = data[i + 1],
|
|
28570
|
+
b = data[i + 2],
|
|
28571
|
+
a = data[i + 3],
|
|
28572
|
+
[sepiaR, sepiaG, sepiaB] = ImageProcessUtils.applySepiaToPixel(r, g, b);
|
|
28573
|
+
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;
|
|
28574
|
+
}
|
|
28575
|
+
return new ImageData(result, width, height);
|
|
28576
|
+
}
|
|
28577
|
+
afterStageRender(stage, canvas) {
|
|
28578
|
+
if (this.canUseCSSFilter() && this.colorConfig.strength > 0) {
|
|
28579
|
+
const cssResult = this.applyCSSFilter(canvas);
|
|
28580
|
+
if (cssResult) return cssResult;
|
|
28581
|
+
}
|
|
28582
|
+
return super.afterStageRender(stage, canvas);
|
|
28583
|
+
}
|
|
28584
|
+
}
|
|
28585
|
+
|
|
28586
|
+
class Distortion extends HybridEffectBase {
|
|
28587
|
+
constructor(from, to, duration, easing, params) {
|
|
28588
|
+
var _a, _b, _c;
|
|
28589
|
+
super(from, to, duration, easing, params), this.distortionConfig = {
|
|
28590
|
+
distortionType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.distortionType) || "wave",
|
|
28591
|
+
strength: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.strength) || .3,
|
|
28592
|
+
useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL
|
|
28593
|
+
};
|
|
28594
|
+
}
|
|
28595
|
+
getShaderSources() {
|
|
28596
|
+
return {
|
|
28597
|
+
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 ",
|
|
28598
|
+
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 "
|
|
28599
|
+
};
|
|
28600
|
+
}
|
|
28601
|
+
applyWebGLEffect(canvas) {
|
|
28602
|
+
if (!this.gl || !this.program || !this.webglCanvas) return null;
|
|
28603
|
+
this.setupWebGLState(canvas);
|
|
28604
|
+
const texture = this.createTextureFromCanvas(canvas);
|
|
28605
|
+
if (!texture) return null;
|
|
28606
|
+
const vertexBuffer = this.createFullScreenQuad();
|
|
28607
|
+
if (!vertexBuffer) return this.gl.deleteTexture(texture), null;
|
|
28608
|
+
try {
|
|
28609
|
+
return this.gl.useProgram(this.program), this.setupVertexAttributes(), this.setDistortionUniforms(), this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4), this.webglCanvas;
|
|
28610
|
+
} finally {
|
|
28611
|
+
this.gl.deleteTexture(texture), this.gl.deleteBuffer(vertexBuffer);
|
|
28612
|
+
}
|
|
28613
|
+
}
|
|
28614
|
+
setDistortionUniforms() {
|
|
28615
|
+
if (!this.gl || !this.program) return;
|
|
28616
|
+
const currentTime = this.getAnimationTime(),
|
|
28617
|
+
timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
|
|
28618
|
+
strengthLocation = this.gl.getUniformLocation(this.program, "u_strength"),
|
|
28619
|
+
distortionTypeLocation = this.gl.getUniformLocation(this.program, "u_distortionType"),
|
|
28620
|
+
resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution");
|
|
28621
|
+
this.gl.uniform1f(timeLocation, currentTime), this.gl.uniform1f(strengthLocation, this.distortionConfig.strength), this.gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height);
|
|
28622
|
+
this.gl.uniform1i(distortionTypeLocation, {
|
|
28623
|
+
wave: 0,
|
|
28624
|
+
ripple: 1,
|
|
28625
|
+
swirl: 2
|
|
28626
|
+
}[this.distortionConfig.distortionType] || 0);
|
|
28627
|
+
}
|
|
28628
|
+
applyCanvas2DEffect(canvas) {
|
|
28629
|
+
const outputCanvas = this.createOutputCanvas(canvas);
|
|
28630
|
+
if (!outputCanvas) return null;
|
|
28631
|
+
const {
|
|
28632
|
+
ctx: ctx
|
|
28633
|
+
} = outputCanvas;
|
|
28634
|
+
try {
|
|
28635
|
+
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
28636
|
+
currentTime = this.getAnimationTime();
|
|
28637
|
+
let distortedImageData;
|
|
28638
|
+
switch (this.distortionConfig.distortionType) {
|
|
28639
|
+
case "wave":
|
|
28640
|
+
distortedImageData = this.applyWaveDistortion(imageData, this.distortionConfig.strength, currentTime);
|
|
28641
|
+
break;
|
|
28642
|
+
case "ripple":
|
|
28643
|
+
distortedImageData = this.applyRippleDistortion(imageData, this.distortionConfig.strength, currentTime);
|
|
28644
|
+
break;
|
|
28645
|
+
case "swirl":
|
|
28646
|
+
distortedImageData = this.applySwirlDistortion(imageData, this.distortionConfig.strength, currentTime);
|
|
28647
|
+
break;
|
|
28648
|
+
default:
|
|
28649
|
+
distortedImageData = imageData;
|
|
28650
|
+
}
|
|
28651
|
+
return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(distortedImageData, 0, 0), outputCanvas.canvas;
|
|
28652
|
+
} catch (error) {
|
|
28653
|
+
return null;
|
|
28654
|
+
}
|
|
28655
|
+
}
|
|
28656
|
+
applyWaveDistortion(imageData, strength, time) {
|
|
28657
|
+
const {
|
|
28658
|
+
data: data,
|
|
28659
|
+
width: width,
|
|
28660
|
+
height: height
|
|
28661
|
+
} = imageData,
|
|
28662
|
+
result = new Uint8ClampedArray(data.length);
|
|
28663
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
28664
|
+
const waveX = Math.sin(.1 * y + 3 * time) * strength * 20,
|
|
28665
|
+
waveY = Math.sin(.1 * x + 2 * time) * strength * 20,
|
|
28666
|
+
sourceX = Math.round(x - waveX),
|
|
28667
|
+
sourceY = Math.round(y - waveY),
|
|
28668
|
+
targetIndex = 4 * (y * width + x);
|
|
28669
|
+
if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
|
|
28670
|
+
const sourceIndex = 4 * (sourceY * width + sourceX);
|
|
28671
|
+
result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
|
|
28672
|
+
} else result[targetIndex + 3] = 0;
|
|
28673
|
+
}
|
|
28674
|
+
return new ImageData(result, width, height);
|
|
28675
|
+
}
|
|
28676
|
+
applyRippleDistortion(imageData, strength, time) {
|
|
28677
|
+
const {
|
|
28678
|
+
data: data,
|
|
28679
|
+
width: width,
|
|
28680
|
+
height: height
|
|
28681
|
+
} = imageData,
|
|
28682
|
+
result = new Uint8ClampedArray(data.length),
|
|
28683
|
+
centerX = width / 2,
|
|
28684
|
+
centerY = height / 2;
|
|
28685
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
28686
|
+
const dx = x - centerX,
|
|
28687
|
+
dy = y - centerY,
|
|
28688
|
+
distance = Math.sqrt(dx * dx + dy * dy),
|
|
28689
|
+
ripple = Math.sin(.2 * distance - 5 * time) * strength * 10,
|
|
28690
|
+
angle = Math.atan2(dy, dx),
|
|
28691
|
+
sourceX = Math.round(x - Math.cos(angle) * ripple),
|
|
28692
|
+
sourceY = Math.round(y - Math.sin(angle) * ripple),
|
|
28693
|
+
targetIndex = 4 * (y * width + x);
|
|
28694
|
+
if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
|
|
28695
|
+
const sourceIndex = 4 * (sourceY * width + sourceX);
|
|
28696
|
+
result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
|
|
28697
|
+
} else result[targetIndex + 3] = 0;
|
|
28698
|
+
}
|
|
28699
|
+
return new ImageData(result, width, height);
|
|
28700
|
+
}
|
|
28701
|
+
applySwirlDistortion(imageData, strength, time) {
|
|
28702
|
+
const {
|
|
28703
|
+
data: data,
|
|
28704
|
+
width: width,
|
|
28705
|
+
height: height
|
|
28706
|
+
} = imageData,
|
|
28707
|
+
result = new Uint8ClampedArray(data.length),
|
|
28708
|
+
centerX = width / 2,
|
|
28709
|
+
centerY = height / 2;
|
|
28710
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
28711
|
+
const dx = x - centerX,
|
|
28712
|
+
dy = y - centerY,
|
|
28713
|
+
distance = Math.sqrt(dx * dx + dy * dy),
|
|
28714
|
+
finalAngle = Math.atan2(dy, dx) + distance * strength * time * .02,
|
|
28715
|
+
sourceX = Math.round(centerX + distance * Math.cos(finalAngle)),
|
|
28716
|
+
sourceY = Math.round(centerY + distance * Math.sin(finalAngle)),
|
|
28717
|
+
targetIndex = 4 * (y * width + x);
|
|
28718
|
+
if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
|
|
28719
|
+
const sourceIndex = 4 * (sourceY * width + sourceX);
|
|
28720
|
+
result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
|
|
28721
|
+
} else result[targetIndex + 3] = 0;
|
|
28722
|
+
}
|
|
28723
|
+
return new ImageData(result, width, height);
|
|
28724
|
+
}
|
|
28725
|
+
afterStageRender(stage, canvas) {
|
|
28726
|
+
return this.distortionConfig.strength <= 0 ? canvas : super.afterStageRender(stage, canvas);
|
|
28727
|
+
}
|
|
28728
|
+
}
|
|
28729
|
+
|
|
28730
|
+
class Particle extends HybridEffectBase {
|
|
28731
|
+
constructor(from, to, duration, easing, params) {
|
|
28732
|
+
var _a, _b, _c, _d, _e;
|
|
28733
|
+
super(from, to, duration, easing, params), this.particles = [], this.positionBuffer = null, this.colorBuffer = null, this.particleConfig = {
|
|
28734
|
+
effectType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.effectType) || "gravity",
|
|
28735
|
+
count: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.count) || 4e3,
|
|
28736
|
+
size: (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.size) || 20,
|
|
28737
|
+
strength: (null === (_d = null == params ? void 0 : params.options) || void 0 === _d ? void 0 : _d.strength) || 1.5,
|
|
28738
|
+
useWebGL: void 0 === (null === (_e = null == params ? void 0 : params.options) || void 0 === _e ? void 0 : _e.useWebGL) || params.options.useWebGL
|
|
28739
|
+
};
|
|
28740
|
+
}
|
|
28741
|
+
getShaderSources() {
|
|
28742
|
+
return {
|
|
28743
|
+
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 ",
|
|
28744
|
+
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 "
|
|
28745
|
+
};
|
|
28746
|
+
}
|
|
28747
|
+
applyWebGLEffect(canvas) {
|
|
28748
|
+
if (!this.gl || !this.program || !this.webglCanvas) return null;
|
|
28749
|
+
this.setupWebGLState(canvas), 0 === this.particles.length && this.extractParticles(canvas), this.updateParticles(canvas);
|
|
28750
|
+
const gl = this.gl;
|
|
28751
|
+
return gl.enable(gl.BLEND), gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA), gl.useProgram(this.program), this.prepareAndDrawParticles(gl), this.webglCanvas;
|
|
28752
|
+
}
|
|
28753
|
+
applyCanvas2DEffect(canvas) {
|
|
28754
|
+
const output = this.createOutputCanvas(canvas);
|
|
28755
|
+
if (!output) return null;
|
|
28756
|
+
const {
|
|
28757
|
+
canvas: outputCanvas,
|
|
28758
|
+
ctx: ctx
|
|
28759
|
+
} = output,
|
|
28760
|
+
progress = this.currentAnimationRatio;
|
|
28761
|
+
switch (this.particleConfig.effectType) {
|
|
28762
|
+
case "explode":
|
|
28763
|
+
this.applyCanvas2DExplode(ctx, canvas, progress);
|
|
28764
|
+
break;
|
|
28765
|
+
case "gravity":
|
|
28766
|
+
this.applyCanvas2DGravity(ctx, canvas, progress);
|
|
28767
|
+
break;
|
|
28768
|
+
case "vortex":
|
|
28769
|
+
this.applyCanvas2DVortex(ctx, canvas, progress);
|
|
28770
|
+
break;
|
|
28771
|
+
default:
|
|
28772
|
+
ctx.globalAlpha = Math.max(0, 1 - progress), ctx.drawImage(canvas, 0, 0);
|
|
28773
|
+
}
|
|
28774
|
+
return outputCanvas;
|
|
28775
|
+
}
|
|
28776
|
+
extractParticles(canvas) {
|
|
28777
|
+
const tempCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height, 1),
|
|
28778
|
+
tempCtx = tempCanvas.getContext("2d");
|
|
28779
|
+
if (!tempCtx) return;
|
|
28780
|
+
tempCtx.drawImage(canvas, 0, 0, tempCanvas.width, tempCanvas.height);
|
|
28781
|
+
const data = tempCtx.getImageData(0, 0, tempCanvas.width, tempCanvas.height).data;
|
|
28782
|
+
this.particles = [];
|
|
28783
|
+
const step = Math.max(1, Math.floor(Math.sqrt(tempCanvas.width * tempCanvas.height / (1.5 * this.particleConfig.count))));
|
|
28784
|
+
for (let y = 0; y < tempCanvas.height; y += step) for (let x = 0; x < tempCanvas.width; x += step) {
|
|
28785
|
+
const index = 4 * (y * tempCanvas.width + x),
|
|
28786
|
+
r = data[index],
|
|
28787
|
+
g = data[index + 1],
|
|
28788
|
+
b = data[index + 2],
|
|
28789
|
+
a = data[index + 3];
|
|
28790
|
+
if (a > 5) {
|
|
28791
|
+
const realX = x / tempCanvas.width * canvas.width,
|
|
28792
|
+
realY = y / tempCanvas.height * canvas.height,
|
|
28793
|
+
particle = {
|
|
28794
|
+
x: realX,
|
|
28795
|
+
y: realY,
|
|
28796
|
+
originX: realX,
|
|
28797
|
+
originY: realY,
|
|
28798
|
+
vx: 0,
|
|
28799
|
+
vy: 0,
|
|
28800
|
+
r: r / 255,
|
|
28801
|
+
g: g / 255,
|
|
28802
|
+
b: b / 255,
|
|
28803
|
+
a: Math.max(.6, a / 255),
|
|
28804
|
+
life: 1,
|
|
28805
|
+
size: this.particleConfig.size * (1 + .5 * Math.random())
|
|
28806
|
+
};
|
|
28807
|
+
this.particles.push(particle);
|
|
28808
|
+
}
|
|
28809
|
+
}
|
|
28810
|
+
}
|
|
28811
|
+
updateParticles(canvas) {
|
|
28812
|
+
const centerX = canvas.width / 2,
|
|
28813
|
+
centerY = canvas.height / 2,
|
|
28814
|
+
progress = this.currentAnimationRatio,
|
|
28815
|
+
duration = this.getDurationFromParent(),
|
|
28816
|
+
isShortAnimation = duration < 2e3,
|
|
28817
|
+
timeMultiplier = isShortAnimation ? Math.max(1.5, 3e3 / duration) : 1,
|
|
28818
|
+
intensityBoost = isShortAnimation ? Math.min(2, 2e3 / duration) : 1;
|
|
28819
|
+
this.particles.forEach(particle => {
|
|
28820
|
+
const dx = particle.x - centerX,
|
|
28821
|
+
dy = particle.y - centerY,
|
|
28822
|
+
distance = Math.sqrt(dx * dx + dy * dy),
|
|
28823
|
+
angle = Math.atan2(dy, dx);
|
|
28824
|
+
this.applyParticleForces(particle, angle, distance, progress, intensityBoost, canvas), this.updateParticleProperties(particle, progress, isShortAnimation, timeMultiplier, intensityBoost);
|
|
28825
|
+
});
|
|
28826
|
+
}
|
|
28827
|
+
applyParticleForces(particle, angle, distance, progress, intensityBoost, canvas) {
|
|
28828
|
+
const time = this.getAnimationTime();
|
|
28829
|
+
switch (this.particleConfig.effectType) {
|
|
28830
|
+
case "explode":
|
|
28831
|
+
const explodeIntensity = progress * this.particleConfig.strength * intensityBoost * 5;
|
|
28832
|
+
particle.vx += Math.cos(angle) * explodeIntensity, particle.vy += Math.sin(angle) * explodeIntensity;
|
|
28833
|
+
break;
|
|
28834
|
+
case "gravity":
|
|
28835
|
+
this.applyGravityEffect(particle, progress, intensityBoost, canvas, time);
|
|
28836
|
+
break;
|
|
28837
|
+
case "vortex":
|
|
28838
|
+
this.applyVortexEffect(particle, progress, intensityBoost, canvas, angle, distance);
|
|
28839
|
+
}
|
|
28840
|
+
}
|
|
28841
|
+
applyGravityEffect(particle, progress, intensityBoost, canvas, time) {
|
|
28842
|
+
const gravityThreshold = (particle.originX + .7 * particle.originY) / (canvas.width + canvas.height) * .8;
|
|
28843
|
+
if (progress > gravityThreshold) {
|
|
28844
|
+
const gravityProgress = (progress - gravityThreshold) / (1 - gravityThreshold),
|
|
28845
|
+
gravityForce = this.particleConfig.strength * gravityProgress * gravityProgress * 12 * intensityBoost;
|
|
28846
|
+
particle.vy += gravityForce;
|
|
28847
|
+
const turbulence = Math.sin(3 * time + .02 * particle.originX) * Math.cos(2 * time + .015 * particle.originY);
|
|
28848
|
+
particle.vx += turbulence * this.particleConfig.strength * 2 * intensityBoost;
|
|
28849
|
+
}
|
|
28850
|
+
}
|
|
28851
|
+
applyVortexEffect(particle, progress, intensityBoost, canvas, angle, distance) {
|
|
28852
|
+
const centerX = canvas.width / 2,
|
|
28853
|
+
centerY = canvas.height / 2,
|
|
28854
|
+
spiralAngle = angle + progress * Math.PI * .8,
|
|
28855
|
+
targetRadius = distance + progress * Math.max(canvas.width, canvas.height) * .7 * 1.8,
|
|
28856
|
+
targetX = centerX + Math.cos(spiralAngle) * targetRadius,
|
|
28857
|
+
targetY = centerY + Math.sin(spiralAngle) * targetRadius,
|
|
28858
|
+
baseForce = progress * this.particleConfig.strength * .08 * intensityBoost;
|
|
28859
|
+
particle.vx += (targetX - particle.x) * baseForce, particle.vy += (targetY - particle.y) * baseForce;
|
|
28860
|
+
}
|
|
28861
|
+
updateParticleProperties(particle, progress, isShortAnimation, timeMultiplier, intensityBoost) {
|
|
28862
|
+
const dragCoeff = isShortAnimation ? .99 : .98;
|
|
28863
|
+
if (particle.vx *= dragCoeff, particle.vy *= dragCoeff, particle.x += particle.vx, particle.y += particle.vy, isShortAnimation) {
|
|
28864
|
+
const lifeDecayRate = Math.max(.1, .5 / timeMultiplier);
|
|
28865
|
+
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));
|
|
28866
|
+
} 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));
|
|
28867
|
+
}
|
|
28868
|
+
prepareAndDrawParticles(gl) {
|
|
28869
|
+
const positions = new Float32Array(2 * this.particles.length),
|
|
28870
|
+
colors = new Float32Array(4 * this.particles.length),
|
|
28871
|
+
sizes = new Float32Array(this.particles.length);
|
|
28872
|
+
this.particles.forEach((particle, i) => {
|
|
28873
|
+
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);
|
|
28874
|
+
}), this.updateParticleBuffers(gl, positions, colors, sizes), this.setParticleUniforms(gl), gl.drawArrays(gl.POINTS, 0, this.particles.length), this.cleanupTempBuffers(gl);
|
|
28875
|
+
}
|
|
28876
|
+
updateParticleBuffers(gl, positions, colors, sizes) {
|
|
28877
|
+
this.positionBuffer || (this.positionBuffer = gl.createBuffer()), gl.bindBuffer(gl.ARRAY_BUFFER, this.positionBuffer), gl.bufferData(gl.ARRAY_BUFFER, positions, gl.DYNAMIC_DRAW);
|
|
28878
|
+
const positionLocation = gl.getAttribLocation(this.program, "a_position");
|
|
28879
|
+
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);
|
|
28880
|
+
const colorLocation = gl.getAttribLocation(this.program, "a_color");
|
|
28881
|
+
gl.enableVertexAttribArray(colorLocation), gl.vertexAttribPointer(colorLocation, 4, gl.FLOAT, !1, 0, 0);
|
|
28882
|
+
const sizeBuffer = gl.createBuffer();
|
|
28883
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, sizeBuffer), gl.bufferData(gl.ARRAY_BUFFER, sizes, gl.DYNAMIC_DRAW);
|
|
28884
|
+
const sizeLocation = gl.getAttribLocation(this.program, "a_size");
|
|
28885
|
+
gl.enableVertexAttribArray(sizeLocation), gl.vertexAttribPointer(sizeLocation, 1, gl.FLOAT, !1, 0, 0), this._tempSizeBuffer = sizeBuffer;
|
|
28886
|
+
}
|
|
28887
|
+
setParticleUniforms(gl) {
|
|
28888
|
+
const resolutionLocation = gl.getUniformLocation(this.program, "u_resolution"),
|
|
28889
|
+
timeLocation = gl.getUniformLocation(this.program, "u_time"),
|
|
28890
|
+
forceStrengthLocation = gl.getUniformLocation(this.program, "u_forceStrength"),
|
|
28891
|
+
effectTypeLocation = gl.getUniformLocation(this.program, "u_effectType");
|
|
28892
|
+
gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height), gl.uniform1f(timeLocation, this.getAnimationTime()), gl.uniform1f(forceStrengthLocation, this.particleConfig.strength);
|
|
28893
|
+
gl.uniform1i(effectTypeLocation, {
|
|
28894
|
+
explode: 0,
|
|
28895
|
+
vortex: 1,
|
|
28896
|
+
gravity: 2
|
|
28897
|
+
}[this.particleConfig.effectType] || 0);
|
|
28898
|
+
}
|
|
28899
|
+
cleanupTempBuffers(gl) {
|
|
28900
|
+
const tempSizeBuffer = this._tempSizeBuffer;
|
|
28901
|
+
tempSizeBuffer && (gl.deleteBuffer(tempSizeBuffer), delete this._tempSizeBuffer);
|
|
28902
|
+
}
|
|
28903
|
+
applyCanvas2DExplode(ctx, canvas, progress) {
|
|
28904
|
+
const centerX = canvas.width / 2,
|
|
28905
|
+
centerY = canvas.height / 2;
|
|
28906
|
+
ctx.save(), ctx.globalAlpha = Math.max(0, 1 - progress), ctx.translate(centerX, centerY);
|
|
28907
|
+
const scale = 1 + .5 * progress;
|
|
28908
|
+
ctx.scale(scale, scale), ctx.translate(-centerX, -centerY), ctx.drawImage(canvas, 0, 0), ctx.restore();
|
|
28909
|
+
}
|
|
28910
|
+
applyCanvas2DGravity(ctx, canvas, progress) {
|
|
28911
|
+
ctx.save(), ctx.globalAlpha = Math.max(0, 1 - progress);
|
|
28912
|
+
const offsetY = progress * canvas.height * .3;
|
|
28913
|
+
ctx.drawImage(canvas, 0, offsetY), ctx.restore();
|
|
28914
|
+
}
|
|
28915
|
+
applyCanvas2DVortex(ctx, canvas, progress) {
|
|
28916
|
+
const centerX = canvas.width / 2,
|
|
28917
|
+
centerY = canvas.height / 2;
|
|
28918
|
+
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();
|
|
28919
|
+
}
|
|
28920
|
+
}
|
|
28921
|
+
|
|
28922
|
+
class Glitch extends Canvas2DEffectBase {
|
|
28923
|
+
constructor(from, to, duration, easing, params) {
|
|
28924
|
+
var _a, _b;
|
|
28925
|
+
super(from, to, duration, easing, params), this.glitchConfig = {
|
|
28926
|
+
effectType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.effectType) || "rgb-shift",
|
|
28927
|
+
intensity: void 0 !== (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.intensity) ? params.options.intensity : .5
|
|
28928
|
+
};
|
|
28929
|
+
}
|
|
28930
|
+
applyCanvas2DEffect(canvas) {
|
|
28931
|
+
if (this.glitchConfig.intensity <= 0) {
|
|
28932
|
+
const outputCanvas = this.createOutputCanvas(canvas);
|
|
28933
|
+
return outputCanvas ? outputCanvas.canvas : null;
|
|
28934
|
+
}
|
|
28935
|
+
try {
|
|
28936
|
+
switch (this.glitchConfig.effectType) {
|
|
28937
|
+
case "rgb-shift":
|
|
28938
|
+
default:
|
|
28939
|
+
return this.applyRGBShiftGlitch(canvas);
|
|
28940
|
+
case "digital-distortion":
|
|
28941
|
+
return this.applyDigitalDistortionGlitch(canvas);
|
|
28942
|
+
case "scan-lines":
|
|
28943
|
+
return this.applyScanLineGlitch(canvas);
|
|
28944
|
+
case "data-corruption":
|
|
28945
|
+
return this.applyDataCorruptionGlitch(canvas);
|
|
28946
|
+
}
|
|
28947
|
+
} catch (error) {
|
|
28948
|
+
return null;
|
|
28949
|
+
}
|
|
28950
|
+
}
|
|
28951
|
+
applyRGBShiftGlitch(canvas) {
|
|
28952
|
+
const outputCanvas = this.createOutputCanvas(canvas);
|
|
28953
|
+
if (!outputCanvas) return null;
|
|
28954
|
+
const {
|
|
28955
|
+
ctx: ctx
|
|
28956
|
+
} = outputCanvas;
|
|
28957
|
+
try {
|
|
28958
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
28959
|
+
const dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
|
|
28960
|
+
maxOffset = Math.floor(20 * dynamicIntensity),
|
|
28961
|
+
redOffset = this.generateRandomOffset(maxOffset),
|
|
28962
|
+
greenOffset = this.generateRandomOffset(maxOffset, .3),
|
|
28963
|
+
blueOffset = this.generateRandomOffset(-maxOffset),
|
|
28964
|
+
tempCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height),
|
|
28965
|
+
tempCtx = tempCanvas.getContext("2d");
|
|
28966
|
+
tempCtx.drawImage(canvas, 0, 0);
|
|
28967
|
+
const originalImageData = tempCtx.getImageData(0, 0, canvas.width, canvas.height),
|
|
28968
|
+
redChannelData = ImageProcessUtils.extractChannel(originalImageData, 0),
|
|
28969
|
+
greenChannelData = ImageProcessUtils.extractChannel(originalImageData, 1),
|
|
28970
|
+
blueChannelData = ImageProcessUtils.extractChannel(originalImageData, 2);
|
|
28971
|
+
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;
|
|
28972
|
+
} catch (error) {
|
|
28973
|
+
return null;
|
|
28974
|
+
}
|
|
28975
|
+
}
|
|
28976
|
+
applyDigitalDistortionGlitch(canvas) {
|
|
28977
|
+
const outputCanvas = this.createOutputCanvas(canvas);
|
|
28978
|
+
if (!outputCanvas) return null;
|
|
28979
|
+
const {
|
|
28980
|
+
ctx: ctx
|
|
28981
|
+
} = outputCanvas;
|
|
28982
|
+
try {
|
|
28983
|
+
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
28984
|
+
dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
|
|
28985
|
+
distortedImageData = this.processDigitalDistortion(imageData, dynamicIntensity);
|
|
28986
|
+
return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(distortedImageData, 0, 0), outputCanvas.canvas;
|
|
28987
|
+
} catch (error) {
|
|
28988
|
+
return null;
|
|
28989
|
+
}
|
|
28990
|
+
}
|
|
28991
|
+
applyScanLineGlitch(canvas) {
|
|
28992
|
+
const outputCanvas = this.createOutputCanvas(canvas);
|
|
28993
|
+
if (!outputCanvas) return null;
|
|
28994
|
+
const {
|
|
28995
|
+
ctx: ctx
|
|
28996
|
+
} = outputCanvas;
|
|
28997
|
+
try {
|
|
28998
|
+
const dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
|
|
28999
|
+
lineSpacing = Math.max(2, Math.floor(10 - 8 * dynamicIntensity));
|
|
29000
|
+
ctx.globalCompositeOperation = "multiply";
|
|
29001
|
+
for (let y = 0; y < canvas.height; y += lineSpacing) if (Math.random() < dynamicIntensity) {
|
|
29002
|
+
const opacity = .1 + .4 * dynamicIntensity;
|
|
29003
|
+
ctx.fillStyle = `rgba(0, 0, 0, ${opacity})`, ctx.fillRect(0, y, canvas.width, 1);
|
|
29004
|
+
}
|
|
29005
|
+
ctx.globalCompositeOperation = "screen";
|
|
29006
|
+
const brightLineCount = Math.floor(20 * dynamicIntensity);
|
|
29007
|
+
for (let i = 0; i < brightLineCount; i++) {
|
|
29008
|
+
const y = Math.random() * canvas.height,
|
|
29009
|
+
opacity = .3 * dynamicIntensity;
|
|
29010
|
+
ctx.fillStyle = `rgba(255, 255, 255, ${opacity})`, ctx.fillRect(0, Math.floor(y), canvas.width, 1);
|
|
29011
|
+
}
|
|
29012
|
+
return ctx.globalCompositeOperation = "source-over", outputCanvas.canvas;
|
|
29013
|
+
} catch (error) {
|
|
29014
|
+
return null;
|
|
29015
|
+
}
|
|
29016
|
+
}
|
|
29017
|
+
applyDataCorruptionGlitch(canvas) {
|
|
29018
|
+
const outputCanvas = this.createOutputCanvas(canvas);
|
|
29019
|
+
if (!outputCanvas) return null;
|
|
29020
|
+
const {
|
|
29021
|
+
ctx: ctx
|
|
29022
|
+
} = outputCanvas;
|
|
29023
|
+
try {
|
|
29024
|
+
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
29025
|
+
dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
|
|
29026
|
+
corruptedImageData = this.processDataCorruption(imageData, dynamicIntensity);
|
|
29027
|
+
return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(corruptedImageData, 0, 0), outputCanvas.canvas;
|
|
29028
|
+
} catch (error) {
|
|
29029
|
+
return null;
|
|
29030
|
+
}
|
|
29031
|
+
}
|
|
29032
|
+
generateRandomOffset(maxOffset, scale = 1) {
|
|
29033
|
+
return {
|
|
29034
|
+
x: (Math.random() - .5) * maxOffset,
|
|
29035
|
+
y: (Math.random() - .5) * maxOffset * scale
|
|
29036
|
+
};
|
|
29037
|
+
}
|
|
29038
|
+
processDigitalDistortion(imageData, intensity) {
|
|
29039
|
+
const {
|
|
29040
|
+
data: data,
|
|
29041
|
+
width: width,
|
|
29042
|
+
height: height
|
|
29043
|
+
} = imageData,
|
|
29044
|
+
result = new Uint8ClampedArray(data),
|
|
29045
|
+
sliceCount = Math.floor(20 * intensity) + 5,
|
|
29046
|
+
sliceHeight = Math.floor(height / sliceCount);
|
|
29047
|
+
for (let i = 0; i < sliceCount; i++) if (Math.random() < intensity) {
|
|
29048
|
+
const y = i * sliceHeight,
|
|
29049
|
+
sliceEnd = Math.min(y + sliceHeight, height),
|
|
29050
|
+
offset = Math.floor((Math.random() - .5) * width * intensity * .1);
|
|
29051
|
+
this.shiftSliceHorizontal(result, width, height, y, sliceEnd, offset);
|
|
29052
|
+
}
|
|
29053
|
+
const noiseIntensity = .3 * intensity;
|
|
29054
|
+
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());
|
|
29055
|
+
return new ImageData(result, width, height);
|
|
29056
|
+
}
|
|
29057
|
+
shiftSliceHorizontal(data, width, height, startY, endY, offset) {
|
|
29058
|
+
const tempRow = new Uint8ClampedArray(4 * width);
|
|
29059
|
+
for (let y = startY; y < endY; y++) {
|
|
29060
|
+
const rowStart = y * width * 4;
|
|
29061
|
+
for (let x = 0; x < 4 * width; x++) tempRow[x] = data[rowStart + x];
|
|
29062
|
+
for (let x = 0; x < width; x++) {
|
|
29063
|
+
const targetIndex = rowStart + 4 * x,
|
|
29064
|
+
sourceIndex = 4 * ((x - offset + width) % width);
|
|
29065
|
+
data[targetIndex] = tempRow[sourceIndex], data[targetIndex + 1] = tempRow[sourceIndex + 1], data[targetIndex + 2] = tempRow[sourceIndex + 2], data[targetIndex + 3] = tempRow[sourceIndex + 3];
|
|
29066
|
+
}
|
|
29067
|
+
}
|
|
29068
|
+
}
|
|
29069
|
+
processDataCorruption(imageData, intensity) {
|
|
29070
|
+
const {
|
|
29071
|
+
data: data,
|
|
29072
|
+
width: width,
|
|
29073
|
+
height: height
|
|
29074
|
+
} = imageData,
|
|
29075
|
+
result = new Uint8ClampedArray(data),
|
|
29076
|
+
stripeCount = Math.floor(15 * intensity) + 5;
|
|
29077
|
+
for (let i = 0; i < stripeCount; i++) if (Math.random() < intensity) {
|
|
29078
|
+
const x = Math.floor(Math.random() * width),
|
|
29079
|
+
stripeWidth = Math.floor(5 * Math.random()) + 1,
|
|
29080
|
+
color = Math.random() < .5 ? 0 : 255;
|
|
29081
|
+
for (let y = 0; y < height; y++) for (let dx = 0; dx < stripeWidth && x + dx < width; dx++) {
|
|
29082
|
+
const index = 4 * (y * width + x + dx);
|
|
29083
|
+
result[index] = color, result[index + 1] = color, result[index + 2] = color;
|
|
29084
|
+
}
|
|
29085
|
+
}
|
|
29086
|
+
const corruptionCount = Math.floor(20 * intensity);
|
|
29087
|
+
for (let i = 0; i < corruptionCount; i++) {
|
|
29088
|
+
const blockX = Math.floor(Math.random() * width),
|
|
29089
|
+
blockY = Math.floor(Math.random() * height),
|
|
29090
|
+
blockW = Math.floor(20 * Math.random()) + 5,
|
|
29091
|
+
blockH = Math.floor(10 * Math.random()) + 2;
|
|
29092
|
+
this.corruptBlock(result, width, height, blockX, blockY, blockW, blockH);
|
|
29093
|
+
}
|
|
29094
|
+
return new ImageData(result, width, height);
|
|
29095
|
+
}
|
|
29096
|
+
corruptBlock(data, width, height, x, y, w, h) {
|
|
29097
|
+
for (let dy = 0; dy < h && y + dy < height; dy++) for (let dx = 0; dx < w && x + dx < width; dx++) {
|
|
29098
|
+
const index = 4 * ((y + dy) * width + (x + dx));
|
|
29099
|
+
Math.random() < .7 && (data[index] = 255 * Math.random(), data[index + 1] = 255 * Math.random(), data[index + 2] = 255 * Math.random());
|
|
29100
|
+
}
|
|
29101
|
+
}
|
|
29102
|
+
}
|
|
29103
|
+
|
|
29104
|
+
class GaussianBlur extends AStageAnimate {
|
|
29105
|
+
constructor(from, to, duration, easing, params) {
|
|
29106
|
+
var _a, _b;
|
|
29107
|
+
super(from, to, duration, easing, params), this.blurConfig = {
|
|
29108
|
+
blurRadius: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.blurRadius) || 8,
|
|
29109
|
+
useOptimizedBlur: void 0 === (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.useOptimizedBlur) || params.options.useOptimizedBlur
|
|
29110
|
+
};
|
|
29111
|
+
}
|
|
29112
|
+
applyCSSBlur(canvas, radius) {
|
|
29113
|
+
const c = vglobal.createCanvas({
|
|
29114
|
+
width: canvas.width,
|
|
29115
|
+
height: canvas.height,
|
|
29116
|
+
dpr: vglobal.devicePixelRatio
|
|
29117
|
+
}),
|
|
29118
|
+
ctx = c.getContext("2d");
|
|
29119
|
+
return ctx ? (ctx.filter = `blur(${radius}px)`, ctx.drawImage(canvas, 0, 0), ctx.filter = "none", c) : canvas;
|
|
29120
|
+
}
|
|
29121
|
+
applyDownsampleBlur(imageData, radius) {
|
|
29122
|
+
const {
|
|
29123
|
+
width: width,
|
|
29124
|
+
height: height
|
|
29125
|
+
} = imageData,
|
|
29126
|
+
downsample = Math.max(1, Math.floor(radius / 2)),
|
|
29127
|
+
smallWidth = Math.floor(width / downsample),
|
|
29128
|
+
smallHeight = Math.floor(height / downsample),
|
|
29129
|
+
tempCanvas = vglobal.createCanvas({
|
|
29130
|
+
width: smallWidth,
|
|
29131
|
+
height: smallHeight,
|
|
29132
|
+
dpr: 1
|
|
29133
|
+
}),
|
|
29134
|
+
tempCtx = tempCanvas.getContext("2d");
|
|
29135
|
+
if (!tempCtx) return imageData;
|
|
29136
|
+
const originalCanvas = vglobal.createCanvas({
|
|
29137
|
+
width: width,
|
|
29138
|
+
height: height,
|
|
29139
|
+
dpr: 1
|
|
29140
|
+
}),
|
|
29141
|
+
originalCtx = originalCanvas.getContext("2d");
|
|
29142
|
+
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;
|
|
29143
|
+
}
|
|
29144
|
+
afterStageRender(stage, canvas) {
|
|
29145
|
+
if (this.blurConfig.blurRadius <= 0) return canvas;
|
|
29146
|
+
let result;
|
|
29147
|
+
if (this.blurConfig.useOptimizedBlur) result = this.applyCSSBlur(canvas, this.blurConfig.blurRadius);else {
|
|
29148
|
+
const c = vglobal.createCanvas({
|
|
29149
|
+
width: canvas.width,
|
|
29150
|
+
height: canvas.height,
|
|
29151
|
+
dpr: vglobal.devicePixelRatio
|
|
29152
|
+
}),
|
|
29153
|
+
ctx = c.getContext("2d");
|
|
29154
|
+
if (!ctx) return !1;
|
|
29155
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.drawImage(canvas, 0, 0);
|
|
29156
|
+
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
29157
|
+
blurredImageData = this.applyDownsampleBlur(imageData, this.blurConfig.blurRadius);
|
|
29158
|
+
ctx.putImageData(blurredImageData, 0, 0), result = c;
|
|
29159
|
+
}
|
|
29160
|
+
const ctx = result.getContext("2d");
|
|
29161
|
+
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;
|
|
29162
|
+
}
|
|
29163
|
+
}
|
|
29164
|
+
|
|
29165
|
+
class Pixelation extends DisappearAnimateBase {
|
|
29166
|
+
constructor(from, to, duration, easing, params) {
|
|
29167
|
+
var _a, _b;
|
|
29168
|
+
super(from, to, duration, easing, params), this.pixelationConfig = {
|
|
29169
|
+
maxPixelSize: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.maxPixelSize) || 20,
|
|
29170
|
+
method: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.method) || "out"
|
|
29171
|
+
};
|
|
29172
|
+
}
|
|
29173
|
+
applyDownsamplePixelation(canvas, pixelSize) {
|
|
29174
|
+
if (pixelSize <= 1) return canvas;
|
|
29175
|
+
const {
|
|
29176
|
+
width: width,
|
|
29177
|
+
height: height
|
|
29178
|
+
} = canvas,
|
|
29179
|
+
smallWidth = Math.ceil(width / pixelSize),
|
|
29180
|
+
smallHeight = Math.ceil(height / pixelSize),
|
|
29181
|
+
smallCanvas = vglobal.createCanvas({
|
|
29182
|
+
width: smallWidth,
|
|
29183
|
+
height: smallHeight,
|
|
29184
|
+
dpr: 1
|
|
29185
|
+
}),
|
|
29186
|
+
smallCtx = smallCanvas.getContext("2d");
|
|
29187
|
+
if (!smallCtx) return canvas;
|
|
29188
|
+
const outputCanvas = vglobal.createCanvas({
|
|
29189
|
+
width: width,
|
|
29190
|
+
height: height,
|
|
29191
|
+
dpr: vglobal.devicePixelRatio
|
|
29192
|
+
}),
|
|
29193
|
+
outputCtx = outputCanvas.getContext("2d");
|
|
29194
|
+
return outputCtx ? (smallCtx.imageSmoothingEnabled = !1, outputCtx.imageSmoothingEnabled = !1, smallCtx.drawImage(canvas, 0, 0, smallWidth, smallHeight), outputCtx.drawImage(smallCanvas, 0, 0, width, height), outputCanvas) : canvas;
|
|
29195
|
+
}
|
|
29196
|
+
updateAnimationProgress() {
|
|
29197
|
+
if ("in" === this.pixelationConfig.method) {
|
|
29198
|
+
return this.pixelationConfig.maxPixelSize - this.currentAnimationRatio * (this.pixelationConfig.maxPixelSize - 1);
|
|
29199
|
+
}
|
|
29200
|
+
return 1 + this.currentAnimationRatio * (this.pixelationConfig.maxPixelSize - 1);
|
|
29201
|
+
}
|
|
29202
|
+
afterStageRender(stage, canvas) {
|
|
29203
|
+
const currentPixelSize = this.updateAnimationProgress();
|
|
29204
|
+
if (currentPixelSize <= 1) return canvas;
|
|
29205
|
+
return this.applyDownsamplePixelation(canvas, currentPixelSize);
|
|
29206
|
+
}
|
|
29207
|
+
}
|
|
29208
|
+
|
|
27857
29209
|
const registerCustomAnimate = () => {
|
|
27858
|
-
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);
|
|
29210
|
+
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);
|
|
27859
29211
|
};
|
|
27860
29212
|
|
|
27861
29213
|
class AxisEnter extends AComponentAnimate {
|
|
@@ -33479,6 +34831,25 @@
|
|
|
33479
34831
|
function isZeroStyle(style) {
|
|
33480
34832
|
return 0 === style || isArray$9(style) && style.every(s => 0 === s);
|
|
33481
34833
|
}
|
|
34834
|
+
function setActiveCellRangeState(table) {
|
|
34835
|
+
const selectRanges = table.stateManager.select.ranges,
|
|
34836
|
+
setRanges = [];
|
|
34837
|
+
for (let i = 0; i < selectRanges.length; i++) {
|
|
34838
|
+
const range = selectRanges[i];
|
|
34839
|
+
setRanges.push({
|
|
34840
|
+
range: range,
|
|
34841
|
+
style: {
|
|
34842
|
+
cellBorderColor: "blue",
|
|
34843
|
+
cellBorderLineWidth: 2,
|
|
34844
|
+
cellBorderLineDash: [5, 5]
|
|
34845
|
+
}
|
|
34846
|
+
});
|
|
34847
|
+
}
|
|
34848
|
+
table.stateManager.setCustomSelectRanges(setRanges);
|
|
34849
|
+
}
|
|
34850
|
+
function clearActiveCellRangeState(table) {
|
|
34851
|
+
table.stateManager.setCustomSelectRanges([]);
|
|
34852
|
+
}
|
|
33482
34853
|
|
|
33483
34854
|
const judgeType$1 = value => {
|
|
33484
34855
|
switch (Object.prototype.toString.call(value)) {
|
|
@@ -33809,6 +35180,7 @@
|
|
|
33809
35180
|
DROPDOWN_MENU_CLICK: "dropdown_menu_click",
|
|
33810
35181
|
MOUSEOVER_CHART_SYMBOL: "mouseover_chart_symbol",
|
|
33811
35182
|
DRAG_SELECT_END: "drag_select_end",
|
|
35183
|
+
SELECTED_CHANGED: "selected_changed",
|
|
33812
35184
|
COPY_DATA: "copy_data",
|
|
33813
35185
|
DROPDOWN_ICON_CLICK: "dropdown_icon_click",
|
|
33814
35186
|
DROPDOWN_MENU_CLEAR: "dropdown_menu_clear",
|
|
@@ -33827,8 +35199,10 @@
|
|
|
33827
35199
|
SWITCH_STATE_CHANGE: "switch_state_change",
|
|
33828
35200
|
BEFORE_SET_SIZE: "before_set_size",
|
|
33829
35201
|
BEFORE_INIT: "before_init",
|
|
35202
|
+
BEFORE_UPDATE_OPTION: "before_update_option",
|
|
33830
35203
|
AFTER_RENDER: "after_render",
|
|
33831
35204
|
INITIALIZED: "initialized",
|
|
35205
|
+
UPDATED: "updated",
|
|
33832
35206
|
CHANGE_CELL_VALUE: "change_cell_value",
|
|
33833
35207
|
DRAG_FILL_HANDLE_END: "drag_fill_handle_end",
|
|
33834
35208
|
MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
|
|
@@ -33837,7 +35211,8 @@
|
|
|
33837
35211
|
EMPTY_TIP_DBLCLICK: "empty_tip_dblclick",
|
|
33838
35212
|
BUTTON_CLICK: "button_click",
|
|
33839
35213
|
BEFORE_CACHE_CHART_IMAGE: "before_cache_chart_image",
|
|
33840
|
-
PASTED_DATA: "pasted_data"
|
|
35214
|
+
PASTED_DATA: "pasted_data",
|
|
35215
|
+
PLUGIN_EVENT: "plugin_event"
|
|
33841
35216
|
};
|
|
33842
35217
|
|
|
33843
35218
|
const judgeType = value => {
|
|
@@ -35409,7 +36784,7 @@
|
|
|
35409
36784
|
return hasThemeProperty(obj, names) || hasThemeProperty(superTheme, names);
|
|
35410
36785
|
}
|
|
35411
36786
|
extends(obj) {
|
|
35412
|
-
return new TableTheme(ingoreNoneValueMerge({}, obj), ingoreNoneValueMerge(this.internalTheme.superTheme, this.internalTheme.obj));
|
|
36787
|
+
return new TableTheme(ingoreNoneValueMerge({}, obj), ingoreNoneValueMerge({}, this.internalTheme.superTheme, this.internalTheme.obj));
|
|
35413
36788
|
}
|
|
35414
36789
|
getStyle(style) {
|
|
35415
36790
|
const that = this;
|
|
@@ -35697,7 +37072,7 @@
|
|
|
35697
37072
|
}
|
|
35698
37073
|
constructor(dataSourceObj, dataConfig, pagination, columns, rowHierarchyType, hierarchyExpandLevel) {
|
|
35699
37074
|
var _a;
|
|
35700
|
-
super(), this.currentIndexedData = [], this.hierarchyExpandLevel = 0, this.hasHierarchyStateExpand = !1, this.beforeChangedRecordsMap = new Map(), this.registedAggregators = {}, this.rowHierarchyType = "grid", this.fieldAggregators = [], this.registerAggregators(), this.dataSourceObj = dataSourceObj, this.dataConfig = dataConfig, this._get = null == dataSourceObj ? void 0 : dataSourceObj.get, this.columns = columns, this._source = (null == dataSourceObj ? void 0 : dataSourceObj.records) ? this.processRecords(null == dataSourceObj ? void 0 : dataSourceObj.records) : dataSourceObj, this._sourceLength = (null === (_a = this._source) || void 0 === _a ? void 0 : _a.length) || 0, this.sortedIndexMap = new Map(), this._currentPagerIndexedData = [], this.userPagination = pagination, this.pagination = pagination || {
|
|
37075
|
+
super(), this.addRecordRule = "Object", this.currentIndexedData = [], this.hierarchyExpandLevel = 0, this.hasHierarchyStateExpand = !1, this.beforeChangedRecordsMap = new Map(), this.registedAggregators = {}, this.rowHierarchyType = "grid", this.fieldAggregators = [], this.addRecordRule = (null == dataConfig ? void 0 : dataConfig.addRecordRule) || "Object", this.registerAggregators(), this.dataSourceObj = dataSourceObj, this.dataConfig = dataConfig, this._get = null == dataSourceObj ? void 0 : dataSourceObj.get, this.columns = columns, this._source = (null == dataSourceObj ? void 0 : dataSourceObj.records) ? this.processRecords(null == dataSourceObj ? void 0 : dataSourceObj.records) : dataSourceObj, this._sourceLength = (null === (_a = this._source) || void 0 === _a ? void 0 : _a.length) || 0, this.sortedIndexMap = new Map(), this._currentPagerIndexedData = [], this.userPagination = pagination, this.pagination = pagination || {
|
|
35701
37076
|
totalCount: this._sourceLength,
|
|
35702
37077
|
perPageCount: this._sourceLength,
|
|
35703
37078
|
currentPage: 0
|
|
@@ -35777,7 +37152,7 @@
|
|
|
35777
37152
|
if ((null === (_b = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules) || void 0 === _b ? void 0 : _b.length) >= 1 || (null === (_c = this.lastFilterRules) || void 0 === _c ? void 0 : _c.length) >= 1 || isHasAggregation) {
|
|
35778
37153
|
for (let i = 0, len = records.length; i < len; i++) {
|
|
35779
37154
|
const record = records[i];
|
|
35780
|
-
(null === (_e = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.filterRules) || void 0 === _e ? void 0 : _e.length) >= 1 ? this.filterRecord(record) && (filteredRecords.push(record), "tree" === this.rowHierarchyType && record.children && (record.filteredChildren = this.filteredChildren(record.children)), isHasAggregation && this.processRecord(record)) : (null === (_f = this.lastFilterRules) || void 0 === _f ? void 0 : _f.length) >= 1 ? (this.clearFilteredChildren(record), isHasAggregation && this.processRecord(record)) : isHasAggregation && this.processRecord(record);
|
|
37155
|
+
null != record && ((null === (_e = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.filterRules) || void 0 === _e ? void 0 : _e.length) >= 1 ? this.filterRecord(record) && (filteredRecords.push(record), "tree" === this.rowHierarchyType && record.children && (record.filteredChildren = this.filteredChildren(record.children)), isHasAggregation && this.processRecord(record)) : (null === (_f = this.lastFilterRules) || void 0 === _f ? void 0 : _f.length) >= 1 ? (this.clearFilteredChildren(record), isHasAggregation && this.processRecord(record)) : isHasAggregation && this.processRecord(record));
|
|
35781
37156
|
}
|
|
35782
37157
|
if ((null === (_h = null === (_g = this.dataConfig) || void 0 === _g ? void 0 : _g.filterRules) || void 0 === _h ? void 0 : _h.length) >= 1) return filteredRecords;
|
|
35783
37158
|
}
|
|
@@ -35928,7 +37303,7 @@
|
|
|
35928
37303
|
let formatValue = value;
|
|
35929
37304
|
"number" == typeof beforeChangedValue && isAllDigits(value) && (formatValue = parseFloat(value)), isPromise(record) ? record.then(record => {
|
|
35930
37305
|
record[field] = formatValue;
|
|
35931
|
-
}).catch(err => {}) : record ? record[field] = formatValue : (this.records[dataIndex] = {}, this.records[dataIndex][field] = formatValue);
|
|
37306
|
+
}).catch(err => {}) : record ? record[field] = formatValue : (this.records[dataIndex] = "Array" === this.addRecordRule ? [] : {}, this.records[dataIndex][field] = formatValue);
|
|
35932
37307
|
}
|
|
35933
37308
|
}
|
|
35934
37309
|
}
|
|
@@ -36073,10 +37448,21 @@
|
|
|
36073
37448
|
const sortedIndexArray = Array.from({
|
|
36074
37449
|
length: this._sourceLength
|
|
36075
37450
|
}, (_, i) => i);
|
|
36076
|
-
if (sortedIndexArray.sort((indexA, indexB) =>
|
|
36077
|
-
|
|
36078
|
-
|
|
36079
|
-
|
|
37451
|
+
if (sortedIndexArray.sort((indexA, indexB) => {
|
|
37452
|
+
const recordA = this.getOriginalRecord(indexA),
|
|
37453
|
+
recordB = this.getOriginalRecord(indexB),
|
|
37454
|
+
isEmptyA = null == recordA || "object" == typeof recordA && 0 === Object.keys(recordA).length,
|
|
37455
|
+
isEmptyB = null == recordB || "object" == typeof recordB && 0 === Object.keys(recordB).length;
|
|
37456
|
+
return states.reduce((result, state) => {
|
|
37457
|
+
if (0 !== result) return result;
|
|
37458
|
+
if ("asc" === state.order || "desc" === state.order) {
|
|
37459
|
+
if (isEmptyA && !isEmptyB) return 1;
|
|
37460
|
+
if (!isEmptyA && isEmptyB) return -1;
|
|
37461
|
+
if (isEmptyA && isEmptyB) return indexA - indexB;
|
|
37462
|
+
} else if (isEmptyA || isEmptyB) return indexA - indexB;
|
|
37463
|
+
return (state.orderFn || ("desc" !== state.order ? (v1, v2) => v1 === v2 ? 0 : v1 > v2 ? 1 : -1 : (v1, v2) => v1 === v2 ? 0 : v1 < v2 ? 1 : -1))(this.getOriginalField(indexA, state.field), this.getOriginalField(indexB, state.field), state.order);
|
|
37464
|
+
}, 0);
|
|
37465
|
+
}), this.currentIndexedData = sortedIndexArray, this.hierarchyExpandLevel) {
|
|
36080
37466
|
let nodeLength = sortedIndexArray.length;
|
|
36081
37467
|
for (let i = 0; i < nodeLength; i++) {
|
|
36082
37468
|
const record = this.getOriginalRecord(sortedIndexArray[i]),
|
|
@@ -39377,6 +40763,28 @@
|
|
|
39377
40763
|
y: y
|
|
39378
40764
|
};
|
|
39379
40765
|
}
|
|
40766
|
+
function calculateCellRangeDistribution(startCol, startRow, endCol, endRow, table) {
|
|
40767
|
+
let needRowHeader = !1,
|
|
40768
|
+
needRightRowHeader = !1,
|
|
40769
|
+
needColumnHeader = !1,
|
|
40770
|
+
needBottomColumnHeader = !1,
|
|
40771
|
+
needBody = !1,
|
|
40772
|
+
needCornerHeader = !1,
|
|
40773
|
+
needRightTopCornerHeader = !1,
|
|
40774
|
+
needRightBottomCornerHeader = !1,
|
|
40775
|
+
needLeftBottomCornerHeader = !1;
|
|
40776
|
+
return startCol <= table.frozenColCount - 1 && startRow <= table.frozenRowCount - 1 && (needCornerHeader = !0), endCol >= table.colCount - table.rightFrozenColCount && startRow <= table.frozenRowCount - 1 && (needRightTopCornerHeader = !0), startCol <= table.frozenColCount - 1 && endRow >= table.rowCount - table.bottomFrozenRowCount && (needLeftBottomCornerHeader = !0), endCol >= table.colCount - table.rightFrozenColCount && endRow >= table.rowCount - table.bottomFrozenRowCount && (needRightBottomCornerHeader = !0), startCol <= table.frozenColCount - 1 && endRow >= table.frozenRowCount && startRow <= table.rowCount - table.bottomFrozenRowCount - 1 && (needRowHeader = !0), endCol >= table.colCount - table.rightFrozenColCount && endRow >= table.frozenRowCount && startRow <= table.rowCount - table.bottomFrozenRowCount - 1 && (needRightRowHeader = !0), startRow <= table.frozenRowCount - 1 && endCol >= table.frozenColCount && startCol <= table.colCount - table.rightFrozenColCount - 1 && (needColumnHeader = !0), endRow >= table.rowCount - table.bottomFrozenRowCount && endCol >= table.frozenColCount && startCol <= table.colCount - table.rightFrozenColCount - 1 && (needBottomColumnHeader = !0), startCol <= table.colCount - table.rightFrozenColCount - 1 && endCol >= table.frozenColCount && startRow <= table.rowCount - table.bottomFrozenRowCount - 1 && endRow >= table.frozenRowCount && (needBody = !0), {
|
|
40777
|
+
needRowHeader: needRowHeader,
|
|
40778
|
+
needRightRowHeader: needRightRowHeader,
|
|
40779
|
+
needColumnHeader: needColumnHeader,
|
|
40780
|
+
needBottomColumnHeader: needBottomColumnHeader,
|
|
40781
|
+
needBody: needBody,
|
|
40782
|
+
needCornerHeader: needCornerHeader,
|
|
40783
|
+
needRightTopCornerHeader: needRightTopCornerHeader,
|
|
40784
|
+
needLeftBottomCornerHeader: needLeftBottomCornerHeader,
|
|
40785
|
+
needRightBottomCornerHeader: needRightBottomCornerHeader
|
|
40786
|
+
};
|
|
40787
|
+
}
|
|
39380
40788
|
|
|
39381
40789
|
function getProp(name, cellStyle, col, row, _table) {
|
|
39382
40790
|
const prop = cellStyle && isValid$5(cellStyle[name]) ? cellStyle[name] : void 0;
|
|
@@ -40228,7 +41636,7 @@
|
|
|
40228
41636
|
cornerRadius: null !== (_o = null === (_m = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _m ? void 0 : _m.cornerRadius) && void 0 !== _o ? _o : 0,
|
|
40229
41637
|
lineDash: null !== (_q = null === (_p = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _p ? void 0 : _p.lineDash) && void 0 !== _q ? _q : void 0,
|
|
40230
41638
|
y: table.scenegraph.getCellGroupY(row)
|
|
40231
|
-
}), oldCellGroup.forEachChildren(child => {
|
|
41639
|
+
}), oldCellGroup.mergeStartCol = void 0, oldCellGroup.mergeStartRow = void 0, oldCellGroup.mergeEndCol = void 0, oldCellGroup.mergeEndRow = void 0, oldCellGroup.forEachChildren(child => {
|
|
40232
41640
|
child.setAttributes({
|
|
40233
41641
|
dx: 0,
|
|
40234
41642
|
dy: 0
|
|
@@ -42337,7 +43745,7 @@
|
|
|
42337
43745
|
height: this.table.getDrawRange().height
|
|
42338
43746
|
});
|
|
42339
43747
|
}
|
|
42340
|
-
|
|
43748
|
+
setBottomFrozenColumnShadow() {
|
|
42341
43749
|
var _a, _b, _c, _d, _e;
|
|
42342
43750
|
const rowY = getRowBottomY(this.table);
|
|
42343
43751
|
0 === this.table.bottomFrozenRowCount || "always" !== (null === (_b = null === (_a = this.table.theme.frozenColumnLine) || void 0 === _a ? void 0 : _a.shadow) || void 0 === _b ? void 0 : _b.visible) ? this.bottonFrozenShadowLine.setAttributes({
|
|
@@ -43929,7 +45337,9 @@
|
|
|
43929
45337
|
const newColWidth = table.getColWidth(col);
|
|
43930
45338
|
newColWidth !== oldColWidths[col] && table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col], !0, !0);
|
|
43931
45339
|
}
|
|
43932
|
-
table.scenegraph.updateContainer(
|
|
45340
|
+
table.scenegraph.updateContainer({
|
|
45341
|
+
async: !0
|
|
45342
|
+
});
|
|
43933
45343
|
}
|
|
43934
45344
|
table.isPivotTable() && (layoutMap.disableUseGetBodyCache(), layoutMap.disableUseHeaderPathCache());
|
|
43935
45345
|
}
|
|
@@ -44484,7 +45894,7 @@
|
|
|
44484
45894
|
}
|
|
44485
45895
|
}
|
|
44486
45896
|
|
|
44487
|
-
var __awaiter$
|
|
45897
|
+
var __awaiter$7 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
44488
45898
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
44489
45899
|
function fulfilled(value) {
|
|
44490
45900
|
try {
|
|
@@ -44510,7 +45920,7 @@
|
|
|
44510
45920
|
});
|
|
44511
45921
|
};
|
|
44512
45922
|
function dynamicSetX(x, screenLeft, isEnd, proxy) {
|
|
44513
|
-
return __awaiter$
|
|
45923
|
+
return __awaiter$7(this, void 0, void 0, function* () {
|
|
44514
45924
|
if (!screenLeft) return;
|
|
44515
45925
|
const screenLeftCol = screenLeft.col,
|
|
44516
45926
|
screenLeftX = screenLeft.left;
|
|
@@ -44529,7 +45939,7 @@
|
|
|
44529
45939
|
deltaCol > 0 ? (moveColumn(deltaCol, "left", proxy.screenLeftCol, screenLeftX, x, proxy), proxy.updateDeltaX(x, screenLeftX, screenLeftCol), proxy.table.scenegraph.setBodyAndColHeaderX(-x + proxy.deltaX)) : deltaCol < 0 ? (moveColumn(-deltaCol, "right", proxy.screenLeftCol, screenLeftX, x, proxy), proxy.updateDeltaX(x, screenLeftX, screenLeftCol), proxy.table.scenegraph.setBodyAndColHeaderX(-x + proxy.deltaX)) : (proxy.updateDeltaX(x, screenLeftX, screenLeftCol), proxy.table.scenegraph.setBodyAndColHeaderX(-x + proxy.deltaX));
|
|
44530
45940
|
}
|
|
44531
45941
|
function moveColumn(count, direction, screenLeftCol, screenLeftX, x, proxy) {
|
|
44532
|
-
return __awaiter$
|
|
45942
|
+
return __awaiter$7(this, void 0, void 0, function* () {
|
|
44533
45943
|
if ("left" === direction && proxy.colEnd + count > proxy.bodyRightCol ? count = proxy.bodyRightCol - proxy.colEnd : "right" === direction && proxy.colStart - count < proxy.bodyLeftCol && (count = proxy.colStart - proxy.bodyLeftCol), 0 !== count) if (count < 0 && (direction = "left" === direction ? "right" : "left", count = -count), count < proxy.colEnd - proxy.colStart) {
|
|
44534
45944
|
const startCol = "left" === direction ? proxy.colStart : proxy.colEnd - count + 1,
|
|
44535
45945
|
endCol = "left" === direction ? proxy.colStart + count - 1 : proxy.colEnd,
|
|
@@ -44660,7 +46070,7 @@
|
|
|
44660
46070
|
return y = row < table.frozenRowCount ? table.getRowsHeight(0, row - 1) : row >= table.rowCount - table.bottomFrozenRowCount ? table.getRowsHeight(table.rowCount - table.bottomFrozenRowCount, row - 1) : table.getRowsHeight(table.frozenRowCount, row - 1), y;
|
|
44661
46071
|
}
|
|
44662
46072
|
|
|
44663
|
-
var __awaiter$
|
|
46073
|
+
var __awaiter$6 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
44664
46074
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
44665
46075
|
function fulfilled(value) {
|
|
44666
46076
|
try {
|
|
@@ -44686,7 +46096,7 @@
|
|
|
44686
46096
|
});
|
|
44687
46097
|
};
|
|
44688
46098
|
function dynamicSetY(y, screenTop, isEnd, proxy) {
|
|
44689
|
-
return __awaiter$
|
|
46099
|
+
return __awaiter$6(this, void 0, void 0, function* () {
|
|
44690
46100
|
if (!screenTop) return;
|
|
44691
46101
|
const screenTopRow = screenTop.row,
|
|
44692
46102
|
screenTopY = screenTop.top;
|
|
@@ -44704,7 +46114,7 @@
|
|
|
44704
46114
|
deltaRow > 0 ? (moveCell(deltaRow, "up", screenTopRow, screenTopY, y, proxy), proxy.updateDeltaY(y, screenTopY, screenTopRow), proxy.updateBody(y - proxy.deltaY)) : deltaRow < 0 ? (moveCell(-deltaRow, "down", screenTopRow, screenTopY, y, proxy), proxy.updateDeltaY(y, screenTopY, screenTopRow), proxy.updateBody(y - proxy.deltaY)) : (proxy.updateDeltaY(y, screenTopY, screenTopRow), proxy.updateBody(y - proxy.deltaY));
|
|
44705
46115
|
}
|
|
44706
46116
|
function moveCell(count, direction, screenTopRow, screenTopY, y, proxy) {
|
|
44707
|
-
return __awaiter$
|
|
46117
|
+
return __awaiter$6(this, void 0, void 0, function* () {
|
|
44708
46118
|
if ("up" === direction && proxy.rowEnd + count > proxy.bodyBottomRow ? count = proxy.bodyBottomRow - proxy.rowEnd : "down" === direction && proxy.rowStart - count < proxy.bodyTopRow && (count = proxy.rowStart - proxy.bodyTopRow), 0 !== count) if (count < 0 && (direction = "up" === direction ? "down" : "up", count = -count), count < proxy.rowEnd - proxy.rowStart) {
|
|
44709
46119
|
const startRow = "up" === direction ? proxy.rowStart : proxy.rowEnd - count + 1,
|
|
44710
46120
|
endRow = "up" === direction ? proxy.rowStart + count - 1 : proxy.rowEnd,
|
|
@@ -44804,7 +46214,7 @@
|
|
|
44804
46214
|
}
|
|
44805
46215
|
}
|
|
44806
46216
|
|
|
44807
|
-
var __awaiter$
|
|
46217
|
+
var __awaiter$5 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
44808
46218
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
44809
46219
|
function fulfilled(value) {
|
|
44810
46220
|
try {
|
|
@@ -44831,7 +46241,7 @@
|
|
|
44831
46241
|
};
|
|
44832
46242
|
function sortVertical(proxy) {
|
|
44833
46243
|
var _a;
|
|
44834
|
-
return __awaiter$
|
|
46244
|
+
return __awaiter$5(this, void 0, void 0, function* () {
|
|
44835
46245
|
let syncTopRow, syncBottomRow;
|
|
44836
46246
|
proxy.table.scenegraph.bodyGroup.forEachChildren((colGroup, index) => {
|
|
44837
46247
|
"group" === colGroup.type && (colGroup.needUpdate = !0, null == colGroup || colGroup.forEachChildren(cellGroup => {
|
|
@@ -44863,7 +46273,7 @@
|
|
|
44863
46273
|
});
|
|
44864
46274
|
}
|
|
44865
46275
|
|
|
44866
|
-
var __awaiter$
|
|
46276
|
+
var __awaiter$4 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
44867
46277
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
44868
46278
|
function fulfilled(value) {
|
|
44869
46279
|
try {
|
|
@@ -44889,7 +46299,7 @@
|
|
|
44889
46299
|
});
|
|
44890
46300
|
};
|
|
44891
46301
|
function sortHorizontal(proxy) {
|
|
44892
|
-
return __awaiter$
|
|
46302
|
+
return __awaiter$4(this, void 0, void 0, function* () {
|
|
44893
46303
|
proxy.table.scenegraph.bodyGroup.forEachChildren((colGroup, index) => {
|
|
44894
46304
|
"group" === colGroup.type && (colGroup.needUpdate = !0, null == colGroup || colGroup.forEachChildren(cellGroup => {
|
|
44895
46305
|
cellGroup.needUpdate = !0;
|
|
@@ -45128,7 +46538,7 @@
|
|
|
45128
46538
|
return !!(table.theme.headerStyle.textStick || table.theme.rowHeaderStyle.textStick || table.theme.bodyStyle.textStick);
|
|
45129
46539
|
}
|
|
45130
46540
|
|
|
45131
|
-
var __awaiter$
|
|
46541
|
+
var __awaiter$3 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
45132
46542
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
45133
46543
|
function fulfilled(value) {
|
|
45134
46544
|
try {
|
|
@@ -45211,21 +46621,21 @@
|
|
|
45211
46621
|
createGroupForFirstScreen(cornerHeaderGroup, colHeaderGroup, rowHeaderGroup, rightFrozenGroup, bottomFrozenGroup, bodyGroup, xOrigin, yOrigin, this);
|
|
45212
46622
|
}
|
|
45213
46623
|
progress() {
|
|
45214
|
-
return __awaiter$
|
|
46624
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
45215
46625
|
if (!this.isProgressing) return this.isProgressing = !0, new Promise((resolve, reject) => {
|
|
45216
|
-
setTimeout(() => __awaiter$
|
|
46626
|
+
setTimeout(() => __awaiter$3(this, void 0, void 0, function* () {
|
|
45217
46627
|
this.isProgressing = !1, this.isRelease || (this.colUpdatePos <= this.colEnd ? (yield this.updateColCellGroupsAsync(), yield this.progress()) : this.rowUpdatePos <= this.rowEnd ? (yield this.updateRowCellGroupsAsync(), yield this.progress()) : this.currentCol < this.totalCol ? (yield this.createCol(), yield this.progress()) : this.currentRow < this.totalRow && (yield this.createRow(), yield this.progress()), handleTextStick(this.table), this.table.scenegraph.updateNextFrame(), resolve());
|
|
45218
46628
|
}), 16);
|
|
45219
46629
|
});
|
|
45220
46630
|
});
|
|
45221
46631
|
}
|
|
45222
46632
|
createRow() {
|
|
45223
|
-
return __awaiter$
|
|
46633
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
45224
46634
|
this.taskRowCount && this.createRowCellGroup(this.taskRowCount);
|
|
45225
46635
|
});
|
|
45226
46636
|
}
|
|
45227
46637
|
createCol() {
|
|
45228
|
-
return __awaiter$
|
|
46638
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
45229
46639
|
this.taskColCount && this.createColGroup(this.taskRowCount);
|
|
45230
46640
|
});
|
|
45231
46641
|
}
|
|
@@ -45289,7 +46699,7 @@
|
|
|
45289
46699
|
createColGroup(this.table.scenegraph.bodyGroup, xOrigin, yOrigin, this.currentCol + 1, endCol, this.rowStart, this.rowEnd, "body", this.table), this.currentCol = endCol, this.colUpdatePos = this.colEnd, this.table.scenegraph.updateContainer(), this.table.scenegraph.updateBorderSizeAndPosition();
|
|
45290
46700
|
}
|
|
45291
46701
|
setY(y, isEnd = !1) {
|
|
45292
|
-
return __awaiter$
|
|
46702
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
45293
46703
|
const yLimitTop = this.table.getRowsHeight(this.bodyTopRow, this.bodyTopRow + (this.rowEnd - this.rowStart + 1)) / 2,
|
|
45294
46704
|
yLimitBottom = this.table.getAllRowsHeight() - yLimitTop,
|
|
45295
46705
|
screenTop = this.table.getTargetRowAt(y + this.table.scenegraph.colHeaderGroup.attribute.height);
|
|
@@ -45297,7 +46707,7 @@
|
|
|
45297
46707
|
});
|
|
45298
46708
|
}
|
|
45299
46709
|
setX(x, isEnd = !1) {
|
|
45300
|
-
return __awaiter$
|
|
46710
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
45301
46711
|
const xLimitLeft = this.table.getColsWidth(this.bodyLeftCol, this.bodyLeftCol + (this.colEnd - this.colStart + 1)) / 2,
|
|
45302
46712
|
xLimitRight = this.table.getAllColsWidth() - xLimitLeft,
|
|
45303
46713
|
screenLeft = this.table.getTargetColAt(x + this.table.scenegraph.rowHeaderGroup.attribute.width);
|
|
@@ -45305,12 +46715,12 @@
|
|
|
45305
46715
|
});
|
|
45306
46716
|
}
|
|
45307
46717
|
dynamicSetY(y, screenTop, isEnd = !1) {
|
|
45308
|
-
return __awaiter$
|
|
46718
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
45309
46719
|
dynamicSetY(y, screenTop, isEnd, this);
|
|
45310
46720
|
});
|
|
45311
46721
|
}
|
|
45312
46722
|
dynamicSetX(x, screenLeft, isEnd = !1) {
|
|
45313
|
-
return __awaiter$
|
|
46723
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
45314
46724
|
dynamicSetX(x, screenLeft, isEnd, this);
|
|
45315
46725
|
});
|
|
45316
46726
|
}
|
|
@@ -45318,7 +46728,7 @@
|
|
|
45318
46728
|
this.table.scenegraph.setBodyAndRowHeaderY(-y);
|
|
45319
46729
|
}
|
|
45320
46730
|
updateRowCellGroupsAsync() {
|
|
45321
|
-
return __awaiter$
|
|
46731
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
45322
46732
|
this.updateCellGroups(this.taskRowCount);
|
|
45323
46733
|
});
|
|
45324
46734
|
}
|
|
@@ -45337,7 +46747,7 @@
|
|
|
45337
46747
|
"autoWidth" === this.table.widthMode && computeColsWidth(this.table, startCol, endCol, !1), updateColContent(startCol, endCol, this), this.table.isAutoRowHeight(this.rowStart) && updateAutoColumn(startCol, endCol, this.table, this.colUpdateDirection);
|
|
45338
46748
|
}
|
|
45339
46749
|
updateColCellGroupsAsync() {
|
|
45340
|
-
return __awaiter$
|
|
46750
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
45341
46751
|
this.updateColGroups(this.taskRowCount);
|
|
45342
46752
|
});
|
|
45343
46753
|
}
|
|
@@ -45354,12 +46764,12 @@
|
|
|
45354
46764
|
return cellGroup.needUpdate = !1, newCellGroup || cellGroup;
|
|
45355
46765
|
}
|
|
45356
46766
|
sortCellVertical() {
|
|
45357
|
-
return __awaiter$
|
|
46767
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
45358
46768
|
yield sortVertical(this);
|
|
45359
46769
|
});
|
|
45360
46770
|
}
|
|
45361
46771
|
sortCellHorizontal() {
|
|
45362
|
-
return __awaiter$
|
|
46772
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
45363
46773
|
yield sortHorizontal(this);
|
|
45364
46774
|
});
|
|
45365
46775
|
}
|
|
@@ -45704,16 +47114,18 @@
|
|
|
45704
47114
|
var _a;
|
|
45705
47115
|
selectComp.rect.delete(), null === (_a = selectComp.fillhandle) || void 0 === _a || _a.delete();
|
|
45706
47116
|
}), scene.selectingRangeComponents = new Map();
|
|
45707
|
-
|
|
45708
|
-
|
|
45709
|
-
|
|
45710
|
-
|
|
45711
|
-
|
|
45712
|
-
|
|
45713
|
-
|
|
45714
|
-
|
|
45715
|
-
needLeftBottomCornerHeader
|
|
45716
|
-
|
|
47117
|
+
const {
|
|
47118
|
+
needRowHeader: needRowHeader,
|
|
47119
|
+
needRightRowHeader: needRightRowHeader,
|
|
47120
|
+
needColumnHeader: needColumnHeader,
|
|
47121
|
+
needBottomColumnHeader: needBottomColumnHeader,
|
|
47122
|
+
needBody: needBody,
|
|
47123
|
+
needCornerHeader: needCornerHeader,
|
|
47124
|
+
needRightTopCornerHeader: needRightTopCornerHeader,
|
|
47125
|
+
needLeftBottomCornerHeader: needLeftBottomCornerHeader,
|
|
47126
|
+
needRightBottomCornerHeader: needRightBottomCornerHeader
|
|
47127
|
+
} = calculateCellRangeDistribution(startCol, startRow, endCol, endRow, table);
|
|
47128
|
+
if (needCornerHeader) {
|
|
45717
47129
|
const cornerEndCol = Math.min(endCol, table.frozenColCount - 1),
|
|
45718
47130
|
cornerEndRow = Math.min(endRow, table.frozenRowCount - 1),
|
|
45719
47131
|
strokeArray = [!0, !needColumnHeader, !needRowHeader, !0];
|
|
@@ -46225,7 +47637,7 @@
|
|
|
46225
47637
|
scene.bodyGroup.setAttribute("height", scene.rowHeaderGroup.attribute.height), scene.bodyGroup.setAttribute("y", scene.rowHeaderGroup.attribute.y), scene.colHeaderGroup.setAttribute("height", scene.cornerHeaderGroup.attribute.height);
|
|
46226
47638
|
for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.table.frozenColCount; i++) moveColumnFromRowHeaderToBody(scene), moveColumnFromCornerHeaderToColHeader(scene), moveColumnFromLeftBottomCornerToBottom(scene);
|
|
46227
47639
|
}
|
|
46228
|
-
scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width), scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.table.transpose ? scene.table.options.frozenColCount ? scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1) : scene.table.options.frozenColCount && scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount) : (scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1), scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount)), scene.component.
|
|
47640
|
+
scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width), scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.table.transpose ? scene.table.options.frozenColCount ? scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1) : scene.table.options.frozenColCount && scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount) : (scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1), scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount)), scene.component.setBottomFrozenColumnShadow(), scene.component.setTopFrozenColumnShadow(), scene.hasFrozen = !0, scene.frozenColCount = scene.table.frozenColCount, scene.frozenRowCount = null !== (_d = null !== (_b = null === (_a = scene.colHeaderGroup.firstChild) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : null === (_c = scene.cornerHeaderGroup.firstChild) || void 0 === _c ? void 0 : _c.childrenCount) && void 0 !== _d ? _d : scene.table.frozenRowCount;
|
|
46229
47641
|
}
|
|
46230
47642
|
function resetFrozen(scene) {
|
|
46231
47643
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -46236,7 +47648,7 @@
|
|
|
46236
47648
|
scene.rowHeaderGroup.setAttribute("height", scene.bodyGroup.attribute.height), scene.rowHeaderGroup.setAttribute("y", scene.bodyGroup.attribute.y), scene.cornerHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height);
|
|
46237
47649
|
for (let i = 0; i < scene.table.frozenColCount - scene.frozenColCount; i++) moveColumnFromBodyToRowHeader(scene), moveColumnFromColHeaderToCornerHeader(scene), moveColumnFromBottomToLeftBottomCorner(scene);
|
|
46238
47650
|
}
|
|
46239
|
-
updateReactComponentContainer(scene), scene.recreateAllSelectRangeComponents(), scene.frozenColCount = scene.table.frozenColCount, scene.frozenRowCount = null !== (_d = null !== (_b = null === (_a = scene.colHeaderGroup.firstChild) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : null === (_c = scene.cornerHeaderGroup.firstChild) || void 0 === _c ? void 0 : _c.childrenCount) && void 0 !== _d ? _d : scene.table.frozenRowCount, scene.proxy.colStart = null !== (_f = null === (_e = scene.bodyGroup.firstChild) || void 0 === _e ? void 0 : _e.col) && void 0 !== _f ? _f : scene.table.frozenColCount, scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width), scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.table.transpose ? scene.table.options.frozenColCount ? scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1) : scene.table.options.rightFrozenColCount && scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount) : (scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1), scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount)), scene.component.
|
|
47651
|
+
updateReactComponentContainer(scene), scene.recreateAllSelectRangeComponents(), scene.frozenColCount = scene.table.frozenColCount, scene.frozenRowCount = null !== (_d = null !== (_b = null === (_a = scene.colHeaderGroup.firstChild) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : null === (_c = scene.cornerHeaderGroup.firstChild) || void 0 === _c ? void 0 : _c.childrenCount) && void 0 !== _d ? _d : scene.table.frozenRowCount, scene.proxy.colStart = null !== (_f = null === (_e = scene.bodyGroup.firstChild) || void 0 === _e ? void 0 : _e.col) && void 0 !== _f ? _f : scene.table.frozenColCount, scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width), scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.table.transpose ? scene.table.options.frozenColCount ? scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1) : scene.table.options.rightFrozenColCount && scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount) : (scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1), scene.component.setRightFrozenColumnShadow(scene.table.colCount - scene.table.rightFrozenColCount)), scene.component.setBottomFrozenColumnShadow(), scene.component.setTopFrozenColumnShadow(), scene.hasFrozen = !0;
|
|
46240
47652
|
}
|
|
46241
47653
|
function moveColumnFromBodyToRowHeader(scene) {
|
|
46242
47654
|
const column = scene.bodyGroup.firstChild instanceof Group$1 ? scene.bodyGroup.firstChild : null;
|
|
@@ -46418,7 +47830,9 @@
|
|
|
46418
47830
|
scene.colHeaderGroup.setAttribute("width", scene.bodyGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.bodyGroup.attribute.x), scene.cornerHeaderGroup.setAttribute("width", scene.rowHeaderGroup.attribute.width);
|
|
46419
47831
|
for (let i = 0; i < scene.table.frozenRowCount - scene.frozenRowCount; i++) moveRowFromBodyToColHeader(scene), moveRowFromRowHeaderToCornerHeader(scene), moveRowFromRightToTopRightCorner(scene);
|
|
46420
47832
|
}
|
|
46421
|
-
updateReactComponentContainer(scene), scene.recreateAllSelectRangeComponents(), scene.frozenRowCount = scene.table.frozenRowCount, scene.frozenColCount = null !== (_b = null === (_a = scene.rowHeaderGroup) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : 0, scene.proxy.rowStart = null !== (_e = null === (_d = null === (_c = scene.bodyGroup.firstChild) || void 0 === _c ? void 0 : _c.firstChild) || void 0 === _d ? void 0 : _d.row) && void 0 !== _e ? _e : scene.table.frozenRowCount, scene.bodyGroup.setAttribute("y", scene.colHeaderGroup.attribute.height), scene.rowHeaderGroup.setAttribute("y", scene.cornerHeaderGroup.attribute.height), scene.updateContainer(
|
|
47833
|
+
updateReactComponentContainer(scene), scene.recreateAllSelectRangeComponents(), scene.frozenRowCount = scene.table.frozenRowCount, scene.frozenColCount = null !== (_b = null === (_a = scene.rowHeaderGroup) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : 0, scene.proxy.rowStart = null !== (_e = null === (_d = null === (_c = scene.bodyGroup.firstChild) || void 0 === _c ? void 0 : _c.firstChild) || void 0 === _d ? void 0 : _d.row) && void 0 !== _e ? _e : scene.table.frozenRowCount, scene.bodyGroup.setAttribute("y", scene.colHeaderGroup.attribute.height), scene.rowHeaderGroup.setAttribute("y", scene.cornerHeaderGroup.attribute.height), scene.updateContainer({
|
|
47834
|
+
needUpdateCellY: !0
|
|
47835
|
+
}), scene.updateBorderSizeAndPosition(), scene.hasFrozen = !0;
|
|
46422
47836
|
}
|
|
46423
47837
|
function moveRowFromBodyToColHeader(scene) {
|
|
46424
47838
|
var _a;
|
|
@@ -46427,7 +47841,7 @@
|
|
|
46427
47841
|
const child = scene.bodyGroup.children[i];
|
|
46428
47842
|
if (!checkBeforeMove(child)) continue;
|
|
46429
47843
|
const rowCell = child.firstChild;
|
|
46430
|
-
null === (_a = scene.colHeaderGroup.children[i]) || void 0 === _a || _a.appendChild(rowCell), hasSetedHeight || (scene.colHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height + rowCell.attribute.height), scene.bodyGroup.setAttribute("height", scene.bodyGroup.attribute.height - rowCell.attribute.height), hasSetedHeight = !0);
|
|
47844
|
+
scene.colHeaderGroup.children[i] || createColGroup(scene.colHeaderGroup, 0, 0, rowCell.col, rowCell.col, 0, 0, "columnHeader", scene.table), null === (_a = scene.colHeaderGroup.children[i]) || void 0 === _a || _a.appendChild(rowCell), hasSetedHeight || (scene.colHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height + rowCell.attribute.height), scene.bodyGroup.setAttribute("height", scene.bodyGroup.attribute.height - rowCell.attribute.height), hasSetedHeight = !0);
|
|
46431
47845
|
}
|
|
46432
47846
|
}
|
|
46433
47847
|
function moveRowFromRowHeaderToCornerHeader(scene) {
|
|
@@ -46437,17 +47851,16 @@
|
|
|
46437
47851
|
const child = scene.rowHeaderGroup.children[i];
|
|
46438
47852
|
if (!checkBeforeMove(child)) continue;
|
|
46439
47853
|
const rowCell = child.firstChild;
|
|
46440
|
-
null === (_a = scene.cornerHeaderGroup.children[i]) || void 0 === _a || _a.appendChild(rowCell), hasSetedHeight || (scene.cornerHeaderGroup.setAttribute("height", scene.cornerHeaderGroup.attribute.height + rowCell.attribute.height), scene.rowHeaderGroup.setAttribute("height", scene.rowHeaderGroup.attribute.height - rowCell.attribute.height), hasSetedHeight = !0);
|
|
47854
|
+
scene.cornerHeaderGroup.children[i] || createColGroup(scene.cornerHeaderGroup, 0, 0, rowCell.col, rowCell.col, 0, 0, scene.table.isListTable() ? "columnHeader" : "cornerHeader", scene.table), null === (_a = scene.cornerHeaderGroup.children[i]) || void 0 === _a || _a.appendChild(rowCell), hasSetedHeight || (scene.cornerHeaderGroup.setAttribute("height", scene.cornerHeaderGroup.attribute.height + rowCell.attribute.height), scene.rowHeaderGroup.setAttribute("height", scene.rowHeaderGroup.attribute.height - rowCell.attribute.height), hasSetedHeight = !0);
|
|
46441
47855
|
}
|
|
46442
47856
|
}
|
|
46443
47857
|
function moveRowFromRightToTopRightCorner(scene) {
|
|
46444
|
-
var _a;
|
|
46445
47858
|
let hasSetedHeight = !1;
|
|
46446
47859
|
for (let i = 0; i < scene.rightFrozenGroup.childrenCount; i++) {
|
|
46447
47860
|
const child = scene.rightFrozenGroup.children[i];
|
|
46448
47861
|
if (!checkBeforeMove(child)) continue;
|
|
46449
47862
|
const rowCell = child.firstChild;
|
|
46450
|
-
|
|
47863
|
+
scene.rightTopCornerGroup.children[i] || createColGroup(scene.rightTopCornerGroup, 0, 0, rowCell.col, rowCell.col, 0, 0, "columnHeader", scene.table), scene.rightTopCornerGroup.children[i].appendChild(rowCell), hasSetedHeight || (scene.rightTopCornerGroup.setAttribute("height", scene.rightTopCornerGroup.attribute.height + rowCell.attribute.height), scene.rightFrozenGroup.setAttribute("height", scene.rightFrozenGroup.attribute.height - rowCell.attribute.height), hasSetedHeight = !0);
|
|
46451
47864
|
}
|
|
46452
47865
|
}
|
|
46453
47866
|
function moveRowFromColHeaderToBody(scene) {
|
|
@@ -46754,6 +48167,11 @@
|
|
|
46754
48167
|
column.setAttribute("x", x), x += column.attribute.width;
|
|
46755
48168
|
}), x;
|
|
46756
48169
|
}
|
|
48170
|
+
function updateContainerChildrenY(containerGroup, y) {
|
|
48171
|
+
return containerGroup.forEachChildrenSkipChild((row, index) => {
|
|
48172
|
+
row.setAttribute("y", y), y += row.attribute.height;
|
|
48173
|
+
}), y;
|
|
48174
|
+
}
|
|
46757
48175
|
|
|
46758
48176
|
function hideHoverIcon(col, row, scene) {
|
|
46759
48177
|
-1 !== col && -1 !== row && (updateCellRangeIcon(col, row, icon => "mouseenter_cell" === icon.attribute.visibleTime, icon => {
|
|
@@ -47462,7 +48880,9 @@
|
|
|
47462
48880
|
});
|
|
47463
48881
|
}
|
|
47464
48882
|
updateColWidth(col, detaX, skipUpdateContainer, skipTableWidthMap) {
|
|
47465
|
-
updateColWidth(this, col, Math.round(detaX), skipTableWidthMap), skipUpdateContainer || this.updateContainer(
|
|
48883
|
+
updateColWidth(this, col, Math.round(detaX), skipTableWidthMap), skipUpdateContainer || this.updateContainer({
|
|
48884
|
+
async: !0
|
|
48885
|
+
});
|
|
47466
48886
|
}
|
|
47467
48887
|
updateChartSizeForResizeColWidth(col) {
|
|
47468
48888
|
updateChartSizeForResizeColWidth(this, col);
|
|
@@ -47636,7 +49056,7 @@
|
|
|
47636
49056
|
}
|
|
47637
49057
|
afterScenegraphCreated() {
|
|
47638
49058
|
var _a;
|
|
47639
|
-
this.isPivot || this.table.transpose ? this.table.options.frozenColCount ? this.component.setFrozenColumnShadow(this.table.frozenColCount - 1) : this.table.options.rightFrozenColCount ? this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount) : this.component.setFrozenColumnShadow(-1) : (this.component.setFrozenColumnShadow(this.table.frozenColCount - 1), this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount), this.component.
|
|
49059
|
+
this.isPivot || this.table.transpose ? this.table.options.frozenColCount ? this.component.setFrozenColumnShadow(this.table.frozenColCount - 1) : this.table.options.rightFrozenColCount ? this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount) : this.component.setFrozenColumnShadow(-1) : (this.component.setFrozenColumnShadow(this.table.frozenColCount - 1), this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount), this.component.setBottomFrozenColumnShadow(), this.component.setTopFrozenColumnShadow()), this.table.stateManager.checkFrozen(), this.updateContainer(), this.createFrameBorder(), this.updateBorderSizeAndPosition(), this.component.updateScrollBar(), handleTextStick(this.table), this.table.options.animationAppear && dealWithAnimationAppear(this.table), !1 === (null === (_a = this.table.options.menu) || void 0 === _a ? void 0 : _a.contextMenuWorkOnlyCell) && this.canvasShowMenu(), this.updateNextFrame();
|
|
47640
49060
|
}
|
|
47641
49061
|
dealWidthMode() {
|
|
47642
49062
|
const table = this.table;
|
|
@@ -47766,13 +49186,30 @@
|
|
|
47766
49186
|
rightX = updateContainerChildrenX(this.rightFrozenGroup.childrenCount > 0 ? this.rightFrozenGroup : this.rightTopCornerGroup, 0);
|
|
47767
49187
|
this.bottomFrozenGroup.hasChildNodes() && this.bottomFrozenGroup.firstChild && updateContainerChildrenX(this.bottomFrozenGroup, this.bottomFrozenGroup.firstChild.col > 0 ? this.table.getColsWidth(null !== (_c = this.table.frozenColCount) && void 0 !== _c ? _c : 0, this.bottomFrozenGroup.firstChild.col - 1) : 0), updateContainerChildrenX(this.leftBottomCornerGroup, 0), updateContainerChildrenX(this.rightTopCornerGroup, 0), updateContainerChildrenX(this.rightBottomCornerGroup, 0), this.cornerHeaderGroup.setDeltaWidth(cornerX - this.cornerHeaderGroup.attribute.width), this.leftBottomCornerGroup.setDeltaWidth(cornerX - this.leftBottomCornerGroup.attribute.width), this.colHeaderGroup.setDeltaWidth(colHeaderX - this.colHeaderGroup.attribute.width), this.rowHeaderGroup.setDeltaWidth(rowHeaderX - this.rowHeaderGroup.attribute.width), this.bottomFrozenGroup.setDeltaWidth(colHeaderX - this.bottomFrozenGroup.attribute.width), this.rightFrozenGroup.setDeltaWidth(rightX - this.rightFrozenGroup.attribute.width), this.rightTopCornerGroup.setDeltaWidth(rightX - this.rightTopCornerGroup.attribute.width), this.rightBottomCornerGroup.setDeltaWidth(rightX - this.rightBottomCornerGroup.attribute.width), this.bodyGroup.setDeltaWidth(bodyX - this.bodyGroup.attribute.width), this.colHeaderGroup.setAttribute("x", this.cornerHeaderGroup.attribute.width), this.bottomFrozenGroup.setAttribute("x", this.table.getFrozenColsWidth()), this.bodyGroup.setAttribute("x", this.rowHeaderGroup.attribute.width);
|
|
47768
49188
|
}
|
|
47769
|
-
|
|
47770
|
-
|
|
47771
|
-
|
|
47772
|
-
|
|
49189
|
+
updateContainerAttrHeightAndY() {
|
|
49190
|
+
var _a, _b, _c;
|
|
49191
|
+
for (let i = 0; i < this.cornerHeaderGroup.children.length; i++) updateContainerChildrenY(this.cornerHeaderGroup.children[i], 0);
|
|
49192
|
+
for (let i = 0; i < this.colHeaderGroup.children.length; i++) updateContainerChildrenY(this.colHeaderGroup.children[i], 0);
|
|
49193
|
+
for (let i = 0; i < this.rightTopCornerGroup.children.length; i++) updateContainerChildrenY(this.rightTopCornerGroup.children[i], 0);
|
|
49194
|
+
for (let i = 0; i < this.rowHeaderGroup.children.length; i++) this.rowHeaderGroup.children[i].firstChild && updateContainerChildrenY(this.rowHeaderGroup.children[i], this.rowHeaderGroup.children[i].firstChild.row > 0 ? this.table.getRowsHeight(null !== (_a = this.table.frozenRowCount) && void 0 !== _a ? _a : 0, this.rowHeaderGroup.children[i].firstChild.row - 1) : 0);
|
|
49195
|
+
for (let i = 0; i < this.bodyGroup.children.length; i++) this.bodyGroup.children[i].firstChild && updateContainerChildrenY(this.bodyGroup.children[i], this.bodyGroup.children[i].firstChild.row > 0 ? this.table.getRowsHeight(null !== (_b = this.table.frozenRowCount) && void 0 !== _b ? _b : 0, this.bodyGroup.children[i].firstChild.row - 1) : 0);
|
|
49196
|
+
for (let i = 0; i < this.rightFrozenGroup.children.length; i++) this.rightFrozenGroup.children[i].firstChild && updateContainerChildrenY(this.rightFrozenGroup.children[i], this.rightFrozenGroup.children[i].firstChild.row > 0 ? this.table.getRowsHeight(null !== (_c = this.table.frozenRowCount) && void 0 !== _c ? _c : 0, this.rightFrozenGroup.children[i].firstChild.row - 1) : 0);
|
|
49197
|
+
for (let i = 0; i < this.leftBottomCornerGroup.children.length; i++) updateContainerChildrenY(this.leftBottomCornerGroup.children[i], 0);
|
|
49198
|
+
for (let i = 0; i < this.bottomFrozenGroup.children.length; i++) updateContainerChildrenY(this.bottomFrozenGroup.children[i], 0);
|
|
49199
|
+
for (let i = 0; i < this.rightBottomCornerGroup.children.length; i++) updateContainerChildrenY(this.rightBottomCornerGroup.children[i], 0);
|
|
49200
|
+
}
|
|
49201
|
+
updateContainer(updateConfig = {
|
|
49202
|
+
async: !1,
|
|
49203
|
+
needUpdateCellY: !1
|
|
49204
|
+
}) {
|
|
49205
|
+
var _a;
|
|
49206
|
+
updateConfig.async ? this._needUpdateContainer || (this._needUpdateContainer = !0, setTimeout(() => {
|
|
49207
|
+
var _a;
|
|
49208
|
+
this.updateContainerSync(null !== (_a = updateConfig.needUpdateCellY) && void 0 !== _a && _a);
|
|
49209
|
+
}, 0)) : (this._needUpdateContainer = !0, this.updateContainerSync(null !== (_a = updateConfig.needUpdateCellY) && void 0 !== _a && _a));
|
|
47773
49210
|
}
|
|
47774
|
-
updateContainerSync() {
|
|
47775
|
-
this._needUpdateContainer && (this._needUpdateContainer = !1, this.updateContainerAttrWidthAndX(), this.updateTableSize(), this.component.updateScrollBar(), this.updateNextFrame());
|
|
49211
|
+
updateContainerSync(needUpdateCellY = !1) {
|
|
49212
|
+
this._needUpdateContainer && (this._needUpdateContainer = !1, this.updateContainerAttrWidthAndX(), needUpdateCellY && this.updateContainerAttrHeightAndY(), this.updateTableSize(), this.component.updateScrollBar(), this.updateNextFrame());
|
|
47776
49213
|
}
|
|
47777
49214
|
updateCellContentWhileResize(col, row) {
|
|
47778
49215
|
var _a;
|
|
@@ -47883,10 +49320,10 @@
|
|
|
47883
49320
|
newHeight = computeRowHeight(row, 0, this.table.colCount - 1, this.table);
|
|
47884
49321
|
(row >= this.proxy.rowStart && row <= this.proxy.rowEnd || row >= this.table.rowCount - this.table.bottomFrozenRowCount && row <= this.table.rowCount - 1) && this.table.scenegraph.updateRowHeight(row, newHeight - oldHeight);
|
|
47885
49322
|
}
|
|
47886
|
-
this.table.stateManager.checkFrozen(), this.isPivot || this.table.transpose ? this.table.options.frozenColCount ? this.component.setFrozenColumnShadow(this.table.frozenColCount - 1) : this.table.options.rightFrozenColCount && this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount) : (this.component.setFrozenColumnShadow(this.table.frozenColCount - 1), this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount), this.component.
|
|
49323
|
+
this.table.stateManager.checkFrozen(), this.isPivot || this.table.transpose ? this.table.options.frozenColCount ? this.component.setFrozenColumnShadow(this.table.frozenColCount - 1) : this.table.options.rightFrozenColCount && this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount) : (this.component.setFrozenColumnShadow(this.table.frozenColCount - 1), this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount), this.component.setBottomFrozenColumnShadow(), this.component.setTopFrozenColumnShadow()), this.component.updateScrollBar(), this.updateNextFrame();
|
|
47887
49324
|
}
|
|
47888
49325
|
updateCol(removeCells, addCells, updateCells = [], recalculateColWidths = !0) {
|
|
47889
|
-
updateCol(removeCells, addCells, updateCells, this.table), recalculateColWidths && this.recalculateColWidths(), this.recalculateRowHeights(), this.table.stateManager.checkFrozen(), this.isPivot || this.table.transpose ? this.table.options.frozenColCount ? this.component.setFrozenColumnShadow(this.table.frozenColCount - 1) : this.table.options.rightFrozenColCount && this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount) : (this.component.setFrozenColumnShadow(this.table.frozenColCount - 1), this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount), this.component.
|
|
49326
|
+
updateCol(removeCells, addCells, updateCells, this.table), recalculateColWidths && this.recalculateColWidths(), this.recalculateRowHeights(), this.table.stateManager.checkFrozen(), this.isPivot || this.table.transpose ? this.table.options.frozenColCount ? this.component.setFrozenColumnShadow(this.table.frozenColCount - 1) : this.table.options.rightFrozenColCount && this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount) : (this.component.setFrozenColumnShadow(this.table.frozenColCount - 1), this.component.setRightFrozenColumnShadow(this.table.colCount - this.table.rightFrozenColCount), this.component.setBottomFrozenColumnShadow(), this.component.setTopFrozenColumnShadow()), this.component.updateScrollBar(), this.updateNextFrame();
|
|
47890
49327
|
}
|
|
47891
49328
|
updateCornerHeaderCells() {
|
|
47892
49329
|
for (let col = 0; col < this.table.frozenColCount; col++) for (let row = 0; row < this.table.frozenRowCount; row++) updateCell$1(col, row, this.table, !1);
|
|
@@ -48086,7 +49523,7 @@
|
|
|
48086
49523
|
cellPos: cellPos,
|
|
48087
49524
|
disableCtrlMultiSelect: disableCtrlMultiSelect
|
|
48088
49525
|
} = state.select;
|
|
48089
|
-
if (-1 !== col && -1 !== row && makeSelectCellVisible && table._makeVisibleCell(col, row), -1 !== col && -1 !== row && makeSelectCellVisible) if (interactionState === InteractionState.grabing && state.select.ranges.length > 0) {
|
|
49526
|
+
if (state.select.isSelectAll = isSelectAll, -1 !== col && -1 !== row && makeSelectCellVisible && table._makeVisibleCell(col, row), -1 !== col && -1 !== row && makeSelectCellVisible) if (interactionState === InteractionState.grabing && state.select.ranges.length > 0) {
|
|
48090
49527
|
const currentRange = state.select.ranges[state.select.ranges.length - 1];
|
|
48091
49528
|
col > currentRange.start.col && col > currentRange.end.col && table._makeVisibleCell(col + 1, row), row > currentRange.start.row && row > currentRange.end.row && table._makeVisibleCell(col, row + 1), col < currentRange.start.col && col < currentRange.end.col && table._makeVisibleCell(col - 1, row), row < currentRange.start.row && row < currentRange.end.row && table._makeVisibleCell(col, row - 1);
|
|
48092
49529
|
} else table._makeVisibleCell(col, row);
|
|
@@ -48713,7 +50150,7 @@
|
|
|
48713
50150
|
}
|
|
48714
50151
|
return state.columnMove.moving = !1, setTimeout(() => {
|
|
48715
50152
|
delete state.columnMove.colSource, delete state.columnMove.rowSource, delete state.columnMove.colTarget, delete state.columnMove.rowTarget;
|
|
48716
|
-
}, 0), state.table.scenegraph.component.hideMoveCol(), state.columnResize.col < state.table.frozenColCount && !state.table.isPivotTable() && !state.table.transpose ? (state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen), state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount)) : state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount && !state.table.isPivotTable() && !state.table.transpose ? state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount) : state.table.options.frozenColCount ? state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1) : state.table.options.rightFrozenColCount && state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount), state.table.scenegraph.component.
|
|
50153
|
+
}, 0), state.table.scenegraph.component.hideMoveCol(), state.columnResize.col < state.table.frozenColCount && !state.table.isPivotTable() && !state.table.transpose ? (state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen), state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount)) : state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount && !state.table.isPivotTable() && !state.table.transpose ? state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount) : state.table.options.frozenColCount ? state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1) : state.table.options.rightFrozenColCount && state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount), state.table.scenegraph.component.setBottomFrozenColumnShadow(), state.table.scenegraph.component.setTopFrozenColumnShadow(), state.table.scenegraph.updateNextFrame(), !0 === (null === (_b = state.table.options.customConfig) || void 0 === _b ? void 0 : _b.notUpdateInColumnRowMove) || moveColResult;
|
|
48717
50154
|
}
|
|
48718
50155
|
function clearWidthsAndHeightsCache(colMin, colMax, rowMin, rowMax, table) {
|
|
48719
50156
|
for (let col = colMin; col <= colMax; col++) table._clearColRangeWidthsMap(col);
|
|
@@ -48774,7 +50211,7 @@
|
|
|
48774
50211
|
}
|
|
48775
50212
|
rightColWidth - detaX < state.table.internalProps.limitMinWidth && (detaX = rightColWidth - state.table.internalProps.limitMinWidth);
|
|
48776
50213
|
}
|
|
48777
|
-
detaX = Math.ceil(detaX), state.columnResize.col < state.table.rowHeaderLevelCount || state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount ? updateResizeColForColumn(detaX, state) : "indicator" === state.table.internalProps.columnResizeType ? updateResizeColForIndicator$1(detaX, state) : "indicatorGroup" === state.table.internalProps.columnResizeType ? updateResizeColForIndicatorGroup$1(detaX, state) : "all" === state.table.internalProps.columnResizeType ? updateResizeColForAll$1(detaX, state) : updateResizeColForColumn(detaX, state), state.columnResize.x = xInTable, state.table.scenegraph.component.updateResizeCol(state.columnResize.col, yInTable, state.columnResize.isRightFrozen), state.table._updateSize(), state.columnResize.col < state.table.frozenColCount && !state.table.isPivotTable() && !state.table.transpose ? state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen) : state.table.options.frozenColCount && state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1), (state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount && !state.table.isPivotTable() && !state.table.transpose || state.table.options.rightFrozenColCount) && state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount), state.table.scenegraph.component.
|
|
50214
|
+
detaX = Math.ceil(detaX), state.columnResize.col < state.table.rowHeaderLevelCount || state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount ? updateResizeColForColumn(detaX, state) : "indicator" === state.table.internalProps.columnResizeType ? updateResizeColForIndicator$1(detaX, state) : "indicatorGroup" === state.table.internalProps.columnResizeType ? updateResizeColForIndicatorGroup$1(detaX, state) : "all" === state.table.internalProps.columnResizeType ? updateResizeColForAll$1(detaX, state) : updateResizeColForColumn(detaX, state), state.columnResize.x = xInTable, state.table.scenegraph.component.updateResizeCol(state.columnResize.col, yInTable, state.columnResize.isRightFrozen), state.table._updateSize(), state.columnResize.col < state.table.frozenColCount && !state.table.isPivotTable() && !state.table.transpose ? state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen) : state.table.options.frozenColCount && state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1), (state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount && !state.table.isPivotTable() && !state.table.transpose || state.table.options.rightFrozenColCount) && state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount), state.table.scenegraph.component.setBottomFrozenColumnShadow(), state.table.scenegraph.component.setTopFrozenColumnShadow(), state.table.scenegraph.updateNextFrame();
|
|
48778
50215
|
}
|
|
48779
50216
|
function updateResizeColForColumn(detaX, state) {
|
|
48780
50217
|
"adaptive" === state.table.widthMode && state.columnResize.col < state.table.colCount - 1 ? (state.table.scenegraph.updateColWidth(state.columnResize.col, detaX), state.table.scenegraph.updateColWidth(state.columnResize.col + 1, -detaX), state.table.internalProps._widthResizedColMap.add(state.columnResize.col), state.table.internalProps._widthResizedColMap.add(state.columnResize.col + 1)) : (state.table.scenegraph.updateColWidth(state.columnResize.col, detaX), state.table.internalProps._widthResizedColMap.add(state.columnResize.col));
|
|
@@ -49139,6 +50576,88 @@
|
|
|
49139
50576
|
}
|
|
49140
50577
|
}
|
|
49141
50578
|
|
|
50579
|
+
function updateCustomSelectBorder(scene, selectRange, style) {
|
|
50580
|
+
const table = scene.table,
|
|
50581
|
+
newStartCol = selectRange.start.col,
|
|
50582
|
+
newStartRow = selectRange.start.row,
|
|
50583
|
+
newEndCol = selectRange.end.col,
|
|
50584
|
+
newEndRow = selectRange.end.row,
|
|
50585
|
+
startCol = (selectRange.skipBodyMerge, Math.max(Math.min(newEndCol, newStartCol), 0)),
|
|
50586
|
+
startRow = Math.max(Math.min(newEndRow, newStartRow), 0),
|
|
50587
|
+
endCol = Math.min(Math.max(newEndCol, newStartCol), table.colCount - 1),
|
|
50588
|
+
endRow = Math.min(Math.max(newEndRow, newStartRow), table.rowCount - 1),
|
|
50589
|
+
{
|
|
50590
|
+
needRowHeader: needRowHeader,
|
|
50591
|
+
needRightRowHeader: needRightRowHeader,
|
|
50592
|
+
needColumnHeader: needColumnHeader,
|
|
50593
|
+
needBottomColumnHeader: needBottomColumnHeader,
|
|
50594
|
+
needBody: needBody,
|
|
50595
|
+
needCornerHeader: needCornerHeader,
|
|
50596
|
+
needRightTopCornerHeader: needRightTopCornerHeader,
|
|
50597
|
+
needLeftBottomCornerHeader: needLeftBottomCornerHeader,
|
|
50598
|
+
needRightBottomCornerHeader: needRightBottomCornerHeader
|
|
50599
|
+
} = calculateCellRangeDistribution(startCol, startRow, endCol, endRow, table);
|
|
50600
|
+
if (needCornerHeader) {
|
|
50601
|
+
createCustomCellSelectBorder(scene, startCol, startRow, Math.min(endCol, table.frozenColCount - 1), Math.min(endRow, table.frozenRowCount - 1), "cornerHeader", `${startCol}${startRow}${endCol}${endRow}`, [!0, !needColumnHeader, !needRowHeader, !0], style);
|
|
50602
|
+
}
|
|
50603
|
+
if (needRightTopCornerHeader) {
|
|
50604
|
+
createCustomCellSelectBorder(scene, Math.max(startCol, table.colCount - table.rightFrozenColCount), startRow, endCol, Math.min(endRow, table.frozenRowCount - 1), "rightTopCorner", `${startCol}${startRow}${endCol}${endRow}`, [!0, !0, !needRightRowHeader, !needColumnHeader], style);
|
|
50605
|
+
}
|
|
50606
|
+
if (needLeftBottomCornerHeader) {
|
|
50607
|
+
const cornerEndCol = Math.min(endCol, table.frozenColCount - 1);
|
|
50608
|
+
createCustomCellSelectBorder(scene, startCol, Math.max(startRow, table.rowCount - table.bottomFrozenRowCount), cornerEndCol, endRow, "leftBottomCorner", `${startCol}${startRow}${endCol}${endRow}`, [!needRowHeader, !needBottomColumnHeader, !0, !0], style);
|
|
50609
|
+
}
|
|
50610
|
+
if (needRightBottomCornerHeader) {
|
|
50611
|
+
createCustomCellSelectBorder(scene, Math.max(startCol, table.colCount - table.rightFrozenColCount), Math.max(startRow, table.rowCount - table.bottomFrozenRowCount), endCol, endRow, "rightBottomCorner", `${startCol}${startRow}${endCol}${endRow}`, [!needRightRowHeader, !0, !0, !needBottomColumnHeader], style);
|
|
50612
|
+
}
|
|
50613
|
+
if (needColumnHeader) {
|
|
50614
|
+
createCustomCellSelectBorder(scene, Math.max(startCol, table.frozenColCount), startRow, Math.min(endCol, table.colCount - table.rightFrozenColCount - 1), Math.min(endRow, table.frozenRowCount - 1), "columnHeader", `${startCol}${startRow}${endCol}${endRow}`, [!0, !needRightTopCornerHeader, !needBody, !needCornerHeader], style);
|
|
50615
|
+
}
|
|
50616
|
+
if (needBottomColumnHeader) {
|
|
50617
|
+
const columnHeaderStartCol = Math.max(startCol, table.frozenColCount),
|
|
50618
|
+
columnHeaderEndCol = Math.min(endCol, table.colCount - table.rightFrozenColCount - 1);
|
|
50619
|
+
createCustomCellSelectBorder(scene, columnHeaderStartCol, Math.max(startRow, table.rowCount - table.bottomFrozenRowCount), columnHeaderEndCol, endRow, "bottomFrozen", `${startCol}${startRow}${endCol}${endRow}`, [!needBody, !needRightBottomCornerHeader, !0, !needLeftBottomCornerHeader], style);
|
|
50620
|
+
}
|
|
50621
|
+
if (needRowHeader) {
|
|
50622
|
+
const columnHeaderStartRow = Math.max(startRow, table.frozenRowCount),
|
|
50623
|
+
columnHeaderEndRow = Math.min(endRow, table.rowCount - table.bottomFrozenRowCount - 1);
|
|
50624
|
+
createCustomCellSelectBorder(scene, startCol, columnHeaderStartRow, Math.min(endCol, table.frozenColCount - 1), columnHeaderEndRow, "rowHeader", `${startCol}${startRow}${endCol}${endRow}`, [!needCornerHeader, !needBody, !needLeftBottomCornerHeader, !0], style);
|
|
50625
|
+
}
|
|
50626
|
+
if (needRightRowHeader) {
|
|
50627
|
+
const columnHeaderStartRow = Math.max(startRow, table.frozenRowCount),
|
|
50628
|
+
columnHeaderEndRow = Math.min(endRow, table.rowCount - table.bottomFrozenRowCount - 1);
|
|
50629
|
+
createCustomCellSelectBorder(scene, Math.max(startCol, table.colCount - table.rightFrozenColCount), columnHeaderStartRow, endCol, columnHeaderEndRow, "rightFrozen", `${startCol}${startRow}${endCol}${endRow}`, [!needRightTopCornerHeader, !0, !needRightBottomCornerHeader, !needBody], style);
|
|
50630
|
+
}
|
|
50631
|
+
if (needBody) {
|
|
50632
|
+
createCustomCellSelectBorder(scene, Math.max(startCol, table.frozenColCount), Math.max(startRow, table.frozenRowCount), Math.min(endCol, table.colCount - table.rightFrozenColCount - 1), Math.min(endRow, table.rowCount - table.bottomFrozenRowCount - 1), "body", `${startCol}${startRow}${endCol}${endRow}`, [!needColumnHeader, !needRightRowHeader, !needBottomColumnHeader, !needRowHeader], style);
|
|
50633
|
+
}
|
|
50634
|
+
}
|
|
50635
|
+
function createCustomCellSelectBorder(scene, start_Col, start_Row, end_Col, end_Row, selectRangeType, selectId, strokes, style) {
|
|
50636
|
+
var _a, _b, _c, _d;
|
|
50637
|
+
const startCol = Math.min(start_Col, end_Col),
|
|
50638
|
+
startRow = Math.min(start_Row, end_Row),
|
|
50639
|
+
endCol = Math.max(start_Col, end_Col),
|
|
50640
|
+
endRow = Math.max(start_Row, end_Row),
|
|
50641
|
+
firstCellBound = scene.highPerformanceGetCell(startCol, startRow).globalAABBBounds,
|
|
50642
|
+
rect = createRect({
|
|
50643
|
+
pickable: !1,
|
|
50644
|
+
fill: null !== (_a = style.cellBgColor) && void 0 !== _a && _a,
|
|
50645
|
+
lineWidth: null !== (_b = style.cellBorderLineWidth) && void 0 !== _b ? _b : 0,
|
|
50646
|
+
lineDash: null !== (_c = style.cellBorderLineDash) && void 0 !== _c ? _c : [],
|
|
50647
|
+
stroke: strokes.map(stroke => !!stroke && style.cellBorderColor),
|
|
50648
|
+
x: firstCellBound.x1 - scene.tableGroup.attribute.x,
|
|
50649
|
+
y: firstCellBound.y1 - scene.tableGroup.attribute.y,
|
|
50650
|
+
width: 0,
|
|
50651
|
+
height: 0,
|
|
50652
|
+
visible: !0,
|
|
50653
|
+
cornerRadius: getCornerRadius(selectRangeType, null === (_d = scene.table.theme.frameStyle) || void 0 === _d ? void 0 : _d.cornerRadius, start_Col, start_Row, end_Col, end_Row, scene.table)
|
|
50654
|
+
});
|
|
50655
|
+
scene.customSelectedRangeComponents.set(`${startCol}-${startRow}-${endCol}-${endRow}-${selectId}`, {
|
|
50656
|
+
rect: rect,
|
|
50657
|
+
role: selectRangeType
|
|
50658
|
+
}), scene.tableGroup.insertAfter(rect, "body" === selectRangeType ? scene.bodyGroup : "columnHeader" === selectRangeType ? scene.colHeaderGroup : "rowHeader" === selectRangeType ? scene.rowHeaderGroup : "cornerHeader" === selectRangeType ? scene.cornerHeaderGroup : "rightTopCorner" === selectRangeType ? scene.rightTopCornerGroup : "rightFrozen" === selectRangeType ? scene.rightFrozenGroup : "leftBottomCorner" === selectRangeType ? scene.leftBottomCornerGroup : "bottomFrozen" === selectRangeType ? scene.bottomFrozenGroup : scene.rightBottomCornerGroup);
|
|
50659
|
+
}
|
|
50660
|
+
|
|
49142
50661
|
function deletaCustomSelectRanges(state) {
|
|
49143
50662
|
const {
|
|
49144
50663
|
customSelectedRangeComponents: customSelectedRangeComponents
|
|
@@ -49148,26 +50667,8 @@
|
|
|
49148
50667
|
}), customSelectedRangeComponents.clear(), state.select.customSelectRanges = [];
|
|
49149
50668
|
}
|
|
49150
50669
|
function addCustomSelectRanges(customSelectRanges, state) {
|
|
49151
|
-
const {
|
|
49152
|
-
customSelectedRangeComponents: customSelectedRangeComponents
|
|
49153
|
-
} = state.table.scenegraph;
|
|
49154
50670
|
customSelectRanges.forEach(customRange => {
|
|
49155
|
-
|
|
49156
|
-
const {
|
|
49157
|
-
range: range,
|
|
49158
|
-
style: style
|
|
49159
|
-
} = customRange,
|
|
49160
|
-
rect = createRect({
|
|
49161
|
-
fill: null !== (_a = style.cellBgColor) && void 0 !== _a && _a,
|
|
49162
|
-
stroke: null !== (_b = style.cellBorderColor) && void 0 !== _b && _b,
|
|
49163
|
-
lineWidth: null !== (_c = style.cellBorderLineWidth) && void 0 !== _c ? _c : 0,
|
|
49164
|
-
lineDash: null !== (_d = style.cellBorderLineDash) && void 0 !== _d ? _d : [],
|
|
49165
|
-
pickable: !1
|
|
49166
|
-
});
|
|
49167
|
-
customSelectedRangeComponents.set(`${range.start.col}-${range.start.row}-${range.end.col}-${range.end.row}`, {
|
|
49168
|
-
rect: rect,
|
|
49169
|
-
role: "body"
|
|
49170
|
-
});
|
|
50671
|
+
updateCustomSelectBorder(state.table.scenegraph, customRange.range, customRange.style);
|
|
49171
50672
|
}), state.select.customSelectRanges = customSelectRanges, updateAllSelectComponent(state.table.scenegraph), state.table.scenegraph.updateNextFrame();
|
|
49172
50673
|
}
|
|
49173
50674
|
|
|
@@ -49386,7 +50887,14 @@
|
|
|
49386
50887
|
updateHoverPosition(this, col, row);
|
|
49387
50888
|
}
|
|
49388
50889
|
updateSelectPos(col, row, isShift = !1, isCtrl = !1, isSelectAll = !1, makeSelectCellVisible = !0, skipBodyMerge = !1) {
|
|
49389
|
-
-1 !== row && -1 !== row && (this.select.selecting = !0), col < 0 && (col = -1), row < 0 && (row = -1), col > this.table.colCount - 1 && (col = this.table.colCount - 1), row > this.table.rowCount - 1 && (row = this.table.rowCount - 1)
|
|
50890
|
+
-1 !== row && -1 !== row && (this.select.selecting = !0), col < 0 && (col = -1), row < 0 && (row = -1), col > this.table.colCount - 1 && (col = this.table.colCount - 1), row > this.table.rowCount - 1 && (row = this.table.rowCount - 1);
|
|
50891
|
+
const oldCellPosCol = this.select.cellPos.col,
|
|
50892
|
+
oldCellPosRow = this.select.cellPos.row;
|
|
50893
|
+
updateSelectPosition(this, col, row, isShift, isCtrl, isSelectAll, makeSelectCellVisible, skipBodyMerge), !this.table.hasListeners(TABLE_EVENT_TYPE.SELECTED_CHANGED) || oldCellPosCol === col && oldCellPosRow === row || this.table.fireListeners(TABLE_EVENT_TYPE.SELECTED_CHANGED, {
|
|
50894
|
+
ranges: this.select.ranges,
|
|
50895
|
+
col: col,
|
|
50896
|
+
row: row
|
|
50897
|
+
});
|
|
49390
50898
|
}
|
|
49391
50899
|
checkCellRangeInSelect(cellPosStart, cellPosEnd) {
|
|
49392
50900
|
return checkMultiCellInSelect(cellPosStart, cellPosEnd, this.select.ranges, this.select.highlightScope);
|
|
@@ -49697,7 +51205,19 @@
|
|
|
49697
51205
|
return void this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio);
|
|
49698
51206
|
}
|
|
49699
51207
|
}
|
|
49700
|
-
left !== this.scroll.horizontalBarPos && this.updateHoverPos(-1, -1), this.scroll.horizontalBarPos = left, isValid$5(this.scroll.horizontalBarPos) && !isNaN(this.scroll.horizontalBarPos) || (this.scroll.horizontalBarPos = 0), this.table.scenegraph.setX(-left), this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio)
|
|
51208
|
+
if (left !== this.scroll.horizontalBarPos && this.updateHoverPos(-1, -1), this.scroll.horizontalBarPos = left, isValid$5(this.scroll.horizontalBarPos) && !isNaN(this.scroll.horizontalBarPos) || (this.scroll.horizontalBarPos = 0), this.table.scenegraph.setX(-left), this.table.scenegraph.component.updateHorizontalScrollBarPos(xRatio), this.table.frozenColCount ? this.table.scenegraph.component.frozenShadowLine.setAttributes({
|
|
51209
|
+
visible: 0 !== this.table.scrollLeft
|
|
51210
|
+
}) : this.table.scenegraph.component.frozenShadowLine.setAttributes({
|
|
51211
|
+
visible: !1
|
|
51212
|
+
}), this.table.rightFrozenColCount) {
|
|
51213
|
+
const scrollLeft = this.table.scrollLeft,
|
|
51214
|
+
viewWidth = this.table.tableNoFrameWidth;
|
|
51215
|
+
this.table.scenegraph.component.rightFrozenShadowLine.setAttributes({
|
|
51216
|
+
visible: scrollLeft + viewWidth < totalWidth
|
|
51217
|
+
});
|
|
51218
|
+
} else this.table.scenegraph.component.rightFrozenShadowLine.setAttributes({
|
|
51219
|
+
visible: !1
|
|
51220
|
+
});
|
|
49701
51221
|
const dx = this.scroll.horizontalBarPos - oldHorizontalBarPos;
|
|
49702
51222
|
this.table.fireListeners(TABLE_EVENT_TYPE.SCROLL, {
|
|
49703
51223
|
event: null == event ? void 0 : event.nativeEvent,
|
|
@@ -49863,6 +51383,9 @@
|
|
|
49863
51383
|
event: event
|
|
49864
51384
|
});
|
|
49865
51385
|
}
|
|
51386
|
+
setSelectInline(selectInline) {
|
|
51387
|
+
this.select.selectInline = selectInline;
|
|
51388
|
+
}
|
|
49866
51389
|
updateSortState(sortState) {
|
|
49867
51390
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
49868
51391
|
sortState = Array.isArray(sortState) ? sortState : [sortState];
|
|
@@ -49917,8 +51440,9 @@
|
|
|
49917
51440
|
this.frozen.icon = iconMark;
|
|
49918
51441
|
}
|
|
49919
51442
|
}
|
|
49920
|
-
updateCursor(mode
|
|
49921
|
-
|
|
51443
|
+
updateCursor(mode) {
|
|
51444
|
+
var _a;
|
|
51445
|
+
mode || (mode = null !== (_a = this.table.options.defaultCursor) && void 0 !== _a ? _a : "default"), this.table.getElement().style.cursor = mode;
|
|
49922
51446
|
}
|
|
49923
51447
|
updateDrillState(dimensionKey, title, drillDown, drillUp, col, row) {
|
|
49924
51448
|
this.drill.dimensionKey = dimensionKey, this.drill.title = title, this.drill.drillDown = drillDown, this.drill.drillUp = drillUp, this.drill.col = col, this.drill.row = row, updateDrill(col, row, drillDown, drillUp, this.table);
|
|
@@ -50094,7 +51618,8 @@
|
|
|
50094
51618
|
deltaX: deltaX,
|
|
50095
51619
|
deltaY: deltaY
|
|
50096
51620
|
} = event;
|
|
50097
|
-
|
|
51621
|
+
const absY = Math.abs(deltaY);
|
|
51622
|
+
0 !== absY && Math.abs(absY) > 10 && (deltaY /= absY > 100 ? 3 : 2), event.shiftKey && event.deltaY && (deltaX = deltaY, deltaY = 0);
|
|
50098
51623
|
const [optimizedDeltaX, optimizedDeltaY] = optimizeScrollXY(deltaX, deltaY, {
|
|
50099
51624
|
horizontal: 1,
|
|
50100
51625
|
vertical: 1
|
|
@@ -50209,7 +51734,7 @@
|
|
|
50209
51734
|
const table = eventManager.table,
|
|
50210
51735
|
stateManager = table.stateManager;
|
|
50211
51736
|
table.scenegraph.tableGroup.addEventListener("pointermove", e => {
|
|
50212
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t
|
|
51737
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
50213
51738
|
const lastX = null !== (_b = null === (_a = table.eventManager.LastPointerXY) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : e.x,
|
|
50214
51739
|
lastY = null !== (_d = null === (_c = table.eventManager.LastPointerXY) || void 0 === _c ? void 0 : _c.y) && void 0 !== _d ? _d : e.y;
|
|
50215
51740
|
table.eventManager.LastPointerXY = {
|
|
@@ -50225,8 +51750,8 @@
|
|
|
50225
51750
|
event: e.nativeEvent,
|
|
50226
51751
|
target: null === (_e = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _e ? void 0 : _e.target,
|
|
50227
51752
|
mergeCellInfo: null === (_f = eventArgsSet.eventArgs) || void 0 === _f ? void 0 : _f.mergeInfo
|
|
50228
|
-
}), stateManager.interactionState === InteractionState.grabing
|
|
50229
|
-
!(null === (
|
|
51753
|
+
}), stateManager.interactionState === InteractionState.grabing) return void (Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1 && (stateManager.isResizeCol() || stateManager.isResizeRow() || (stateManager.isMoveCol() ? eventManager.dealColumnMover(eventArgsSet) : stateManager.isFillHandle() ? eventManager.dealFillSelect(eventArgsSet, !0) : (null === (_g = table.options.select) || void 0 === _g ? void 0 : _g.disableDragSelect) || eventManager.dealTableSelect(eventArgsSet, !0))));
|
|
51754
|
+
!(null === (_h = table.options.select) || void 0 === _h ? void 0 : _h.disableDragSelect) && table.eventManager.isDraging && stateManager.isSelecting() && !(null === (_j = table.editorManager) || void 0 === _j ? void 0 : _j.editingEditor) && eventManager.dealTableSelect(eventArgsSet, !0);
|
|
50230
51755
|
const cellGoup = e.path.find(node => "cell" === node.role);
|
|
50231
51756
|
if (table.hasListeners(TABLE_EVENT_TYPE.MOUSELEAVE_CELL) && (-1 === table.stateManager.hover.cellPos.col || -1 === table.stateManager.hover.cellPos.row || (null == cellGoup ? void 0 : cellGoup.col) === table.stateManager.hover.cellPos.col && (null == cellGoup ? void 0 : cellGoup.row) === table.stateManager.hover.cellPos.row || table.fireListeners(TABLE_EVENT_TYPE.MOUSELEAVE_CELL, {
|
|
50232
51757
|
col: table.stateManager.hover.cellPos.col,
|
|
@@ -50237,8 +51762,8 @@
|
|
|
50237
51762
|
}),
|
|
50238
51763
|
scaleRatio: table.canvas.getBoundingClientRect().width / table.canvas.offsetWidth,
|
|
50239
51764
|
event: e.nativeEvent,
|
|
50240
|
-
target: null === (
|
|
50241
|
-
})), table.hasListeners(TABLE_EVENT_TYPE.MOUSEENTER_CELL) && ("cell" !== (null == cellGoup ? void 0 : cellGoup.role) || !isValid$5(cellGoup.col) || !isValid$5(cellGoup.row) || cellGoup.col === table.stateManager.hover.cellPos.col && cellGoup.row === table.stateManager.hover.cellPos.row || cellGoup.col === (null === (
|
|
51765
|
+
target: null === (_k = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _k ? void 0 : _k.target
|
|
51766
|
+
})), table.hasListeners(TABLE_EVENT_TYPE.MOUSEENTER_CELL) && ("cell" !== (null == cellGoup ? void 0 : cellGoup.role) || !isValid$5(cellGoup.col) || !isValid$5(cellGoup.row) || cellGoup.col === table.stateManager.hover.cellPos.col && cellGoup.row === table.stateManager.hover.cellPos.row || cellGoup.col === (null === (_l = table.stateManager.hover.cellPosContainHeader) || void 0 === _l ? void 0 : _l.col) && cellGoup.row === (null === (_m = table.stateManager.hover.cellPosContainHeader) || void 0 === _m ? void 0 : _m.row) || table.fireListeners(TABLE_EVENT_TYPE.MOUSEENTER_CELL, {
|
|
50242
51767
|
col: cellGoup.col,
|
|
50243
51768
|
row: cellGoup.row,
|
|
50244
51769
|
cellRange: table.getCellRangeRelativeRect({
|
|
@@ -50247,12 +51772,12 @@
|
|
|
50247
51772
|
}),
|
|
50248
51773
|
scaleRatio: table.canvas.getBoundingClientRect().width / table.canvas.offsetWidth,
|
|
50249
51774
|
event: e.nativeEvent,
|
|
50250
|
-
target: null === (
|
|
50251
|
-
mergeCellInfo: null === (
|
|
51775
|
+
target: null === (_o = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _o ? void 0 : _o.target,
|
|
51776
|
+
mergeCellInfo: null === (_p = eventArgsSet.eventArgs) || void 0 === _p ? void 0 : _p.mergeInfo
|
|
50252
51777
|
})), eventManager.dealIconHover(eventArgsSet), eventManager.dealTableHover(eventArgsSet), table.theme.columnResize.visibleOnHover && eventManager.checkColumnResize(eventArgsSet, !0), eventArgsSet.eventArgs && table.hasListeners(TABLE_EVENT_TYPE.MOUSEMOVE_CELL)) {
|
|
50253
51778
|
let icon, position;
|
|
50254
|
-
if (null === (
|
|
50255
|
-
const iconInfo = getIconAndPositionFromTarget(null === (
|
|
51779
|
+
if (null === (_q = eventArgsSet.eventArgs) || void 0 === _q ? void 0 : _q.target) {
|
|
51780
|
+
const iconInfo = getIconAndPositionFromTarget(null === (_r = eventArgsSet.eventArgs) || void 0 === _r ? void 0 : _r.target);
|
|
50256
51781
|
iconInfo && (icon = iconInfo.icon, position = iconInfo.position);
|
|
50257
51782
|
}
|
|
50258
51783
|
table.fireListeners(TABLE_EVENT_TYPE.MOUSEMOVE_CELL, {
|
|
@@ -50266,8 +51791,8 @@
|
|
|
50266
51791
|
position: position,
|
|
50267
51792
|
funcType: icon.attribute.funcType
|
|
50268
51793
|
} : void 0,
|
|
50269
|
-
target: null === (
|
|
50270
|
-
mergeCellInfo: null === (
|
|
51794
|
+
target: null === (_s = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _s ? void 0 : _s.target,
|
|
51795
|
+
mergeCellInfo: null === (_t = eventArgsSet.eventArgs) || void 0 === _t ? void 0 : _t.mergeInfo
|
|
50271
51796
|
});
|
|
50272
51797
|
}
|
|
50273
51798
|
}), table.scenegraph.tableGroup.addEventListener("pointerout", e => {
|
|
@@ -50341,17 +51866,17 @@
|
|
|
50341
51866
|
if (table.isPivotChart() && "chart" !== (null === (_a = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.target.type) && table.scenegraph.updateChartState(null), (null === (_b = eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.target) !== (null === (_c = stateManager.residentHoverIcon) || void 0 === _c ? void 0 : _c.icon) && stateManager.hideMenu(), "chart" === (null === (_d = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.target.type)) return;
|
|
50342
51867
|
const isCompleteEdit = null === (_e = table.editorManager) || void 0 === _e ? void 0 : _e.completeEdit(e.nativeEvent);
|
|
50343
51868
|
getPromiseValue(isCompleteEdit, isCompleteEdit => {
|
|
50344
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
50345
|
-
if (!1 === isCompleteEdit) return;
|
|
50346
|
-
const hitIcon = (null === (
|
|
50347
|
-
if (eventManager.downIcon = hitIcon, hitIcon && !1 !== hitIcon.attribute.interactive) hitIcon.attribute.funcType === IconFuncTypeEnum.dragReorder && (stateManager.startMoveCol(eventArgsSet.eventArgs.col, eventArgsSet.eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, null === (
|
|
51869
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
51870
|
+
if (!(null === (_a = table.options.customConfig) || void 0 === _a ? void 0 : _a.selectCellWhenCellEditorNotExists) && !1 === isCompleteEdit) return;
|
|
51871
|
+
const hitIcon = (null === (_d = null === (_c = null === (_b = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.target) || void 0 === _c ? void 0 : _c.role) || void 0 === _d ? void 0 : _d.startsWith("icon")) ? eventArgsSet.eventArgs.target : (null === (_e = e.target.role) || void 0 === _e ? void 0 : _e.startsWith("icon")) ? e.target : void 0;
|
|
51872
|
+
if (eventManager.downIcon = hitIcon, hitIcon && !1 !== hitIcon.attribute.interactive) hitIcon.attribute.funcType === IconFuncTypeEnum.dragReorder && (stateManager.startMoveCol(eventArgsSet.eventArgs.col, eventArgsSet.eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, null === (_l = null === (_k = eventArgsSet.eventArgs) || void 0 === _k ? void 0 : _k.event) || void 0 === _l ? void 0 : _l.nativeEvent), stateManager.updateInteractionState(InteractionState.grabing));else {
|
|
50348
51873
|
if (eventManager.cellIsHeaderCheck(eventArgsSet)) return;
|
|
50349
51874
|
if ("touch" === e.pointerType) {
|
|
50350
51875
|
if (eventManager.touchEnd = !1, eventManager.touchSetTimeout = setTimeout(() => {
|
|
50351
51876
|
eventManager.isTouchdown = !1, eventManager.isLongTouch = !0, (eventManager.touchEnd || !eventManager.checkColumnResize(eventArgsSet, !0) && !eventManager.checkRowResize(eventArgsSet, !0)) && (eventManager.touchEnd || !eventManager.checkColumnMover(eventArgsSet)) ? eventManager.dealTableSelect(eventArgsSet) && !eventManager.touchEnd && stateManager.updateInteractionState(InteractionState.grabing) : stateManager.updateInteractionState(InteractionState.grabing);
|
|
50352
51877
|
}, 500), table.hasListeners(TABLE_EVENT_TYPE.MOUSEENTER_CELL)) {
|
|
50353
51878
|
const cellGoup = e.path.find(node => "cell" === node.role);
|
|
50354
|
-
"cell" !== (null == cellGoup ? void 0 : cellGoup.role) || !isValid$5(cellGoup.col) || !isValid$5(cellGoup.row) || cellGoup.col === table.stateManager.hover.cellPos.col && cellGoup.row === table.stateManager.hover.cellPos.row || cellGoup.col === (null === (
|
|
51879
|
+
"cell" !== (null == cellGoup ? void 0 : cellGoup.role) || !isValid$5(cellGoup.col) || !isValid$5(cellGoup.row) || cellGoup.col === table.stateManager.hover.cellPos.col && cellGoup.row === table.stateManager.hover.cellPos.row || cellGoup.col === (null === (_f = table.stateManager.hover.cellPosContainHeader) || void 0 === _f ? void 0 : _f.col) && cellGoup.row === (null === (_g = table.stateManager.hover.cellPosContainHeader) || void 0 === _g ? void 0 : _g.row) || table.fireListeners(TABLE_EVENT_TYPE.MOUSEENTER_CELL, {
|
|
50355
51880
|
col: cellGoup.col,
|
|
50356
51881
|
row: cellGoup.row,
|
|
50357
51882
|
cellRange: table.getCellRangeRelativeRect({
|
|
@@ -50360,8 +51885,8 @@
|
|
|
50360
51885
|
}),
|
|
50361
51886
|
scaleRatio: table.canvas.getBoundingClientRect().width / table.canvas.offsetWidth,
|
|
50362
51887
|
event: e.nativeEvent,
|
|
50363
|
-
target: null === (
|
|
50364
|
-
mergeCellInfo: null === (
|
|
51888
|
+
target: null === (_h = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _h ? void 0 : _h.target,
|
|
51889
|
+
mergeCellInfo: null === (_j = eventArgsSet.eventArgs) || void 0 === _j ? void 0 : _j.mergeInfo
|
|
50365
51890
|
});
|
|
50366
51891
|
}
|
|
50367
51892
|
eventManager.dealTableHover(eventArgsSet);
|
|
@@ -50378,7 +51903,7 @@
|
|
|
50378
51903
|
col: eventArgsSet.eventArgs.col,
|
|
50379
51904
|
row: eventArgsSet.eventArgs.row,
|
|
50380
51905
|
event: e.nativeEvent,
|
|
50381
|
-
target: null === (
|
|
51906
|
+
target: null === (_m = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _m ? void 0 : _m.target,
|
|
50382
51907
|
mergeCellInfo: eventArgsSet.eventArgs.mergeInfo
|
|
50383
51908
|
});
|
|
50384
51909
|
}
|
|
@@ -50511,11 +52036,12 @@
|
|
|
50511
52036
|
var _a, _b, _c, _d;
|
|
50512
52037
|
const eventArgsSet = getCellEventArgsSet(e);
|
|
50513
52038
|
(null === (_a = eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.target) && (null === (_b = eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.target) === (null === (_c = stateManager.residentHoverIcon) || void 0 === _c ? void 0 : _c.icon) || stateManager.hideMenu();
|
|
50514
|
-
|
|
50515
|
-
|
|
50516
|
-
|
|
50517
|
-
|
|
50518
|
-
|
|
52039
|
+
let isCompleteEdit = !1;
|
|
52040
|
+
const target = e.target;
|
|
52041
|
+
target === table.scenegraph.tableGroup || target.isDescendantsOf(table.scenegraph.tableGroup) || (isCompleteEdit = null === (_d = table.editorManager) || void 0 === _d ? void 0 : _d.completeEdit(e.nativeEvent)), getPromiseValue(isCompleteEdit, isCompleteEdit => {
|
|
52042
|
+
var _a, _b;
|
|
52043
|
+
if (!(null === (_a = table.options.customConfig) || void 0 === _a ? void 0 : _a.selectCellWhenCellEditorNotExists) && !1 === isCompleteEdit) return;
|
|
52044
|
+
const hitIcon = (null === (_b = e.target.role) || void 0 === _b ? void 0 : _b.startsWith("icon")) ? e.target : void 0;
|
|
50519
52045
|
if (eventManager.downIcon = hitIcon, "touch" === e.pointerType || hitIcon || eventManager.checkCellFillhandle(eventArgsSet) || stateManager.columnResize.resizing || !eventManager.checkColumnResize(eventArgsSet, !0)) ;else {
|
|
50520
52046
|
table.scenegraph.updateChartState(null), stateManager.updateInteractionState(InteractionState.grabing);
|
|
50521
52047
|
const {
|
|
@@ -50531,12 +52057,12 @@
|
|
|
50531
52057
|
}), table.scenegraph.stage.addEventListener("pointerup", e => {
|
|
50532
52058
|
"grabing" === stateManager.interactionState && (stateManager.updateInteractionState(InteractionState.default), stateManager.isResizeCol() ? endResizeCol(table) : stateManager.isResizeRow() && endResizeRow(table));
|
|
50533
52059
|
}), table.scenegraph.stage.addEventListener("pointertap", e => {
|
|
50534
|
-
var _a, _b, _c;
|
|
52060
|
+
var _a, _b, _c, _d, _e;
|
|
50535
52061
|
const target = e.target;
|
|
50536
52062
|
if (table.eventManager.isDraging || !target || !target.isDescendantsOf(table.scenegraph.stage) && target.stage !== target || target.isDescendantsOf(table.scenegraph.tableGroup)) table.eventManager.isDraging && stateManager.isSelecting() && stateManager.endSelectCells();else {
|
|
50537
52063
|
stateManager.updateInteractionState(InteractionState.default), eventManager.dealTableHover();
|
|
50538
52064
|
const isHasSelected = !!(null === (_a = stateManager.select.ranges) || void 0 === _a ? void 0 : _a.length);
|
|
50539
|
-
(null === (_c = null === (
|
|
52065
|
+
(null === (_b = table.options.customConfig) || void 0 === _b ? void 0 : _b.cancelSelectCellHook) ? (null === (_c = table.options.customConfig) || void 0 === _c ? void 0 : _c.cancelSelectCellHook(e)) && eventManager.dealTableSelect() : (null === (_e = null === (_d = table.options.select) || void 0 === _d ? void 0 : _d.blankAreaClickDeselect) || void 0 === _e || _e) && eventManager.dealTableSelect(), stateManager.endSelectCells(!0, isHasSelected), stateManager.updateCursor(), table.scenegraph.updateChartState(null);
|
|
50540
52066
|
}
|
|
50541
52067
|
}), table.scenegraph.stage.addEventListener("pointermove", e => {
|
|
50542
52068
|
const eventArgsSet = getCellEventArgsSet(e);
|
|
@@ -50745,7 +52271,7 @@
|
|
|
50745
52271
|
}), scenegraph.component.vScrollBar.addEventListener("scrollUp", e => {
|
|
50746
52272
|
scenegraph.table.eventManager.isDraging = !1;
|
|
50747
52273
|
}), scenegraph.component.hScrollBar.addEventListener("pointermove", e => {
|
|
50748
|
-
scenegraph.table.stateManager.updateCursor(
|
|
52274
|
+
scenegraph.table.stateManager.updateCursor(), e.stopPropagation();
|
|
50749
52275
|
}), scenegraph.component.hScrollBar.addEventListener("pointerdown", e => {
|
|
50750
52276
|
e.stopPropagation(), scenegraph.table.hasListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE) && scenegraph.table.fireListeners(TABLE_EVENT_TYPE.MOUSEDOWN_TABLE, {
|
|
50751
52277
|
event: e.nativeEvent
|
|
@@ -50784,7 +52310,7 @@
|
|
|
50784
52310
|
}
|
|
50785
52311
|
getPixelRatio();
|
|
50786
52312
|
|
|
50787
|
-
var __awaiter$
|
|
52313
|
+
var __awaiter$2 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
50788
52314
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
50789
52315
|
function fulfilled(value) {
|
|
50790
52316
|
try {
|
|
@@ -50876,73 +52402,15 @@
|
|
|
50876
52402
|
}
|
|
50877
52403
|
}
|
|
50878
52404
|
handleKeydownListener(e);
|
|
50879
|
-
}), handler.on(table.getElement(), "copy", e => __awaiter$
|
|
50880
|
-
var _a
|
|
50881
|
-
|
|
50882
|
-
|
|
50883
|
-
|
|
50884
|
-
|
|
50885
|
-
|
|
50886
|
-
|
|
50887
|
-
|
|
50888
|
-
if ((null === (_b = navigator.clipboard) || void 0 === _b ? void 0 : _b.write) && "granted" === permissionState.state) {
|
|
50889
|
-
const setDataToHTML = data => {
|
|
50890
|
-
const result = ["<table>"],
|
|
50891
|
-
META_HEAD = ['<meta name="author" content="Visactor"/>', '<style type="text/css">td{white-space:normal}br{mso-data-placement:same-cell}</style>'].join(""),
|
|
50892
|
-
rows = data.split("\r\n");
|
|
50893
|
-
return rows.forEach(function (rowCells, rowIndex) {
|
|
50894
|
-
const cells = rowCells.split("\t"),
|
|
50895
|
-
rowValues = [];
|
|
50896
|
-
0 === rowIndex && result.push("<tbody>"), cells.forEach(function (cell, cellIndex) {
|
|
50897
|
-
const parsedCellData = cell ? cell.toString().replace(/&/g, "&").replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br>").replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g, "<br>\r\n").replace(/\x20{2,}/gi, substring => `<span style="mso-spacerun: yes">${" ".repeat(substring.length - 1)} </span>`).replace(/\t/gi, "	") : " ";
|
|
50898
|
-
rowValues.push(`<td>${parsedCellData}</td>`);
|
|
50899
|
-
}), result.push("<tr>", ...rowValues, "</tr>"), rowIndex === rows.length - 1 && result.push("</tbody>");
|
|
50900
|
-
}), result.push("</table>"), [META_HEAD, result.join("")].join("");
|
|
50901
|
-
},
|
|
50902
|
-
dataHTML = setDataToHTML(data);
|
|
50903
|
-
navigator.clipboard.write([new ClipboardItem({
|
|
50904
|
-
"text/html": new Blob([dataHTML], {
|
|
50905
|
-
type: "text/html"
|
|
50906
|
-
}),
|
|
50907
|
-
"text/plain": new Blob([data], {
|
|
50908
|
-
type: "text/plain"
|
|
50909
|
-
})
|
|
50910
|
-
})]);
|
|
50911
|
-
} else browser.IE ? window.clipboardData.setData("Text", data) : e.clipboardData.setData("text/plain", data);
|
|
50912
|
-
table.fireListeners(TABLE_EVENT_TYPE.COPY_DATA, {
|
|
50913
|
-
cellRange: table.stateManager.select.ranges,
|
|
50914
|
-
copyData: data
|
|
50915
|
-
});
|
|
50916
|
-
}
|
|
50917
|
-
}
|
|
50918
|
-
})), handler.on(table.getElement(), "paste", e => __awaiter$1(this, void 0, void 0, function* () {
|
|
50919
|
-
var _c, _d, _e, _f;
|
|
50920
|
-
if ((null === (_c = table.keyboardOptions) || void 0 === _c ? void 0 : _c.pasteValueToCell) && table.changeCellValues) {
|
|
50921
|
-
if (null === (_d = table.editorManager) || void 0 === _d ? void 0 : _d.editingEditor) return;
|
|
50922
|
-
if ((null === (_e = table.stateManager.select.ranges) || void 0 === _e ? void 0 : _e.length) > 0) if (null === (_f = navigator.clipboard) || void 0 === _f ? void 0 : _f.read) navigator.clipboard.read().then(clipboardItems => {
|
|
50923
|
-
for (const item of clipboardItems) item.types.includes("text/html") ? pasteHtmlToTable(item) : 1 === item.types.length && "text/plain" === item.types[0] && pasteTextToTable(item);
|
|
50924
|
-
});else {
|
|
50925
|
-
const ranges = table.stateManager.select.ranges,
|
|
50926
|
-
col = Math.min(ranges[0].start.col, ranges[0].end.col),
|
|
50927
|
-
row = Math.min(ranges[0].start.row, ranges[0].end.row),
|
|
50928
|
-
rows = (e.clipboardData || window.Clipboard).getData("text").split("\n"),
|
|
50929
|
-
values = [];
|
|
50930
|
-
rows.forEach(function (rowCells, rowIndex) {
|
|
50931
|
-
const cells = rowCells.split("\t"),
|
|
50932
|
-
rowValues = [];
|
|
50933
|
-
values.push(rowValues), cells.forEach(function (cell, cellIndex) {
|
|
50934
|
-
cellIndex === cells.length - 1 && (cell = cell.trim()), rowValues.push(cell);
|
|
50935
|
-
});
|
|
50936
|
-
});
|
|
50937
|
-
const changedCellResults = yield table.changeCellValues(col, row, values);
|
|
50938
|
-
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
50939
|
-
col: col,
|
|
50940
|
-
row: row,
|
|
50941
|
-
pasteData: values,
|
|
50942
|
-
changedCellResults: changedCellResults
|
|
50943
|
-
});
|
|
50944
|
-
}
|
|
50945
|
-
}
|
|
52405
|
+
}), handler.on(table.getElement(), "copy", e => __awaiter$2(this, void 0, void 0, function* () {
|
|
52406
|
+
var _a;
|
|
52407
|
+
(null === (_a = table.keyboardOptions) || void 0 === _a ? void 0 : _a.copySelected) && eventManager.handleCopy(e);
|
|
52408
|
+
})), handler.on(table.getElement(), "cut", e => __awaiter$2(this, void 0, void 0, function* () {
|
|
52409
|
+
var _b;
|
|
52410
|
+
(null === (_b = table.keyboardOptions) || void 0 === _b ? void 0 : _b.cutSelected) && eventManager.handleCut(e);
|
|
52411
|
+
})), handler.on(table.getElement(), "paste", e => __awaiter$2(this, void 0, void 0, function* () {
|
|
52412
|
+
var _c;
|
|
52413
|
+
(null === (_c = table.keyboardOptions) || void 0 === _c ? void 0 : _c.pasteValueToCell) && eventManager.handlePaste(e);
|
|
50946
52414
|
})), handler.on(table.getElement(), "contextmenu", e => {
|
|
50947
52415
|
var _a;
|
|
50948
52416
|
!1 !== (null === (_a = table.eventOptions) || void 0 === _a ? void 0 : _a.preventDefaultContextMenu) ? e.preventDefault() : globalPointerupCallback(e);
|
|
@@ -50950,124 +52418,6 @@
|
|
|
50950
52418
|
var _a;
|
|
50951
52419
|
table.isReleased || 0 === e.width && 0 === e.height || ((table.autoFillWidth || table.autoFillHeight) && (null === (_a = table.editorManager) || void 0 === _a || _a.completeEdit()), isValid$5(table.options.pixelRatio) || table.setPixelRatio(getPixelRatio()), e.windowSizeNotChange || table.resize());
|
|
50952
52420
|
});
|
|
50953
|
-
const regex = /<tr[^>]*>([\s\S]*?)<\/tr>/g,
|
|
50954
|
-
cellRegex = /<td[^>]*>([\s\S]*?)<\/td>/g;
|
|
50955
|
-
function pasteHtmlToTable(item) {
|
|
50956
|
-
const ranges = table.stateManager.select.ranges,
|
|
50957
|
-
selectRangeLength = ranges.length,
|
|
50958
|
-
col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
50959
|
-
row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row),
|
|
50960
|
-
maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
50961
|
-
maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
50962
|
-
let pasteValuesColCount = 0,
|
|
50963
|
-
pasteValuesRowCount = 0,
|
|
50964
|
-
values = [];
|
|
50965
|
-
item.getType("text/html").then(blob => {
|
|
50966
|
-
blob.text().then(pastedData => __awaiter$1(this, void 0, void 0, function* () {
|
|
50967
|
-
var _a, _b;
|
|
50968
|
-
if (pastedData && /(<table)|(<TABLE)/g.test(pastedData)) {
|
|
50969
|
-
const matches = Array.from(pastedData.matchAll(regex));
|
|
50970
|
-
for (const match of matches) {
|
|
50971
|
-
const rowContent = match[1],
|
|
50972
|
-
rowValues = Array.from(rowContent.matchAll(cellRegex)).map(cellMatch => cellMatch[1].replace(/(<(?!br)([^>]+)>)/gi, "").replace(/<br(\s*|\/)>[\r\n]?/gim, "\n").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/	/gi, "\t").replace(/ /g, " "));
|
|
50973
|
-
values.push(rowValues), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
|
|
50974
|
-
}
|
|
50975
|
-
pasteValuesRowCount = null !== (_b = values.length) && void 0 !== _b ? _b : 0, values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
50976
|
-
const changedCellResults = yield table.changeCellValues(col, row, values, !0);
|
|
50977
|
-
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
50978
|
-
col: col,
|
|
50979
|
-
row: row,
|
|
50980
|
-
pasteData: values,
|
|
50981
|
-
changedCellResults: changedCellResults
|
|
50982
|
-
});
|
|
50983
|
-
} else navigator.clipboard.read().then(clipboardItems => {
|
|
50984
|
-
for (const item of clipboardItems) item.types.includes("text/plain") && item.getType("text/plain").then(blob => {
|
|
50985
|
-
blob.text().then(_pasteValue);
|
|
50986
|
-
});
|
|
50987
|
-
});
|
|
50988
|
-
}));
|
|
50989
|
-
});
|
|
50990
|
-
}
|
|
50991
|
-
function _pasteValue(pastedData) {
|
|
50992
|
-
var _a;
|
|
50993
|
-
return __awaiter$1(this, void 0, void 0, function* () {
|
|
50994
|
-
const ranges = table.stateManager.select.ranges,
|
|
50995
|
-
selectRangeLength = ranges.length,
|
|
50996
|
-
col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
50997
|
-
row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row),
|
|
50998
|
-
maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
50999
|
-
maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
51000
|
-
let pasteValuesColCount = 0,
|
|
51001
|
-
pasteValuesRowCount = 0,
|
|
51002
|
-
values = [];
|
|
51003
|
-
pastedData.split("\n").forEach(function (rowCells, rowIndex) {
|
|
51004
|
-
var _a;
|
|
51005
|
-
const cells = rowCells.split("\t"),
|
|
51006
|
-
rowValues = [];
|
|
51007
|
-
values.push(rowValues), cells.forEach(function (cell, cellIndex) {
|
|
51008
|
-
cellIndex === cells.length - 1 && (cell = cell.trim()), rowValues.push(cell);
|
|
51009
|
-
}), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
|
|
51010
|
-
}), pasteValuesRowCount = null !== (_a = values.length) && void 0 !== _a ? _a : 0, values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
51011
|
-
const changedCellResults = yield table.changeCellValues(col, row, values, !0);
|
|
51012
|
-
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
51013
|
-
col: col,
|
|
51014
|
-
row: row,
|
|
51015
|
-
pasteData: values,
|
|
51016
|
-
changedCellResults: changedCellResults
|
|
51017
|
-
});
|
|
51018
|
-
});
|
|
51019
|
-
}
|
|
51020
|
-
function pasteTextToTable(item) {
|
|
51021
|
-
const ranges = table.stateManager.select.ranges,
|
|
51022
|
-
selectRangeLength = ranges.length,
|
|
51023
|
-
col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
51024
|
-
row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row),
|
|
51025
|
-
maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
51026
|
-
maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
51027
|
-
let pasteValuesColCount = 0,
|
|
51028
|
-
pasteValuesRowCount = 0;
|
|
51029
|
-
item.getType("text/plain").then(blob => {
|
|
51030
|
-
blob.text().then(pastedData => __awaiter$1(this, void 0, void 0, function* () {
|
|
51031
|
-
var _a;
|
|
51032
|
-
const rows = pastedData.replace(/\r(?!\n)/g, "\r\n").split("\r\n");
|
|
51033
|
-
let values = [];
|
|
51034
|
-
rows.length > 1 && "" === rows[rows.length - 1] && rows.pop(), rows.forEach(function (rowCells, rowIndex) {
|
|
51035
|
-
var _a;
|
|
51036
|
-
const cells = rowCells.split("\t"),
|
|
51037
|
-
rowValues = [];
|
|
51038
|
-
values.push(rowValues), cells.forEach(function (cell, cellIndex) {
|
|
51039
|
-
cell.includes("\n") && (cell = cell.replace(/^"(.*)"$/, "$1").replace(/["]*/g, match => new Array(Math.floor(match.length / 2)).fill('"').join(""))), rowValues.push(cell);
|
|
51040
|
-
}), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
|
|
51041
|
-
}), pasteValuesRowCount = null !== (_a = values.length) && void 0 !== _a ? _a : 0, values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
51042
|
-
const changedCellResults = yield table.changeCellValues(col, row, values, !0);
|
|
51043
|
-
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
51044
|
-
col: col,
|
|
51045
|
-
row: row,
|
|
51046
|
-
pasteData: values,
|
|
51047
|
-
changedCellResults: changedCellResults
|
|
51048
|
-
});
|
|
51049
|
-
}));
|
|
51050
|
-
});
|
|
51051
|
-
}
|
|
51052
|
-
function handlePasteValues(values, rowCount, colCount, selectedRowCount, selectedColCount) {
|
|
51053
|
-
if (selectedColCount > colCount || selectedRowCount > rowCount) {
|
|
51054
|
-
if (selectedColCount % colCount == 0 && selectedRowCount % rowCount == 0) {
|
|
51055
|
-
const toPasteValues = [];
|
|
51056
|
-
for (let i = 0; i < selectedRowCount; i++) {
|
|
51057
|
-
const rowPasteValue = [];
|
|
51058
|
-
toPasteValues.push(rowPasteValue);
|
|
51059
|
-
for (let j = 0; j < selectedColCount; j++) {
|
|
51060
|
-
const copiedRow = i % rowCount,
|
|
51061
|
-
copiedCol = j % colCount;
|
|
51062
|
-
rowPasteValue.push(values[copiedRow][copiedCol]);
|
|
51063
|
-
}
|
|
51064
|
-
}
|
|
51065
|
-
return toPasteValues;
|
|
51066
|
-
}
|
|
51067
|
-
return values;
|
|
51068
|
-
}
|
|
51069
|
-
return values;
|
|
51070
|
-
}
|
|
51071
52421
|
const globalPointerdownCallback = e => {
|
|
51072
52422
|
var _a;
|
|
51073
52423
|
if (table.isReleased) return;
|
|
@@ -51182,7 +52532,7 @@
|
|
|
51182
52532
|
right || left || (x > table.tableNoFrameWidth - table.getRightFrozenColsWidth() && x < table.tableNoFrameWidth || x > 0 && x < table.getFrozenColsWidth() ? (selectX = x, considerFrozenX = !0) : selectX = table.scrollLeft + x), bottom || top || (y > table.tableNoFrameHeight - table.getBottomFrozenRowsHeight() && y < table.tableNoFrameHeight || y > 0 && y < table.getFrozenRowsHeight() ? (selectY = y, considerFrozenY = !0) : selectY = table.scrollTop + y), table.stateManager.updateInteractionState(InteractionState.grabing);
|
|
51183
52533
|
const targetCol = table.getTargetColAtConsiderRightFrozen(selectX, considerFrozenX),
|
|
51184
52534
|
targetRow = table.getTargetRowAtConsiderBottomFrozen(selectY, considerFrozenY);
|
|
51185
|
-
(null === (_a = table.options.select) || void 0 === _a ? void 0 : _a.disableDragSelect) || !isValid$5(targetCol) || !isValid$5(targetRow) || (null === (_b = table.options.select) || void 0 === _b ? void 0 : _b.disableSelect) && "function" == typeof (null === (_c = table.options.select) || void 0 === _c ? void 0 : _c.disableSelect) && (null === (_e = null === (_d = table.options.select) || void 0 === _d ? void 0 : _d.disableSelect) || void 0 === _e ? void 0 : _e.call(_d, targetCol.col, targetRow.row, table)) || table.stateManager.updateSelectPos(targetCol.col, targetRow.row, !1, !1, !1, !1);
|
|
52535
|
+
(null === (_a = table.options.select) || void 0 === _a ? void 0 : _a.disableDragSelect) || !isValid$5(targetCol) || !isValid$5(targetRow) || (null === (_b = table.options.select) || void 0 === _b ? void 0 : _b.disableSelect) && "function" == typeof (null === (_c = table.options.select) || void 0 === _c ? void 0 : _c.disableSelect) && (null === (_e = null === (_d = table.options.select) || void 0 === _d ? void 0 : _d.disableSelect) || void 0 === _e ? void 0 : _e.call(_d, targetCol.col, targetRow.row, table)) || table.stateManager.updateSelectPos("row" === table.stateManager.select.selectInline ? table.colCount - 1 : targetCol.col, "col" === table.stateManager.select.selectInline ? table.rowCount - 1 : targetRow.row, !1, !1, !1, !1);
|
|
51186
52536
|
});
|
|
51187
52537
|
} else table.eventManager.inertiaScroll.isInertiaScrolling() ? table.eventManager.inertiaScroll.endInertia() : table.eventManager.scrollYSpeed = 0;
|
|
51188
52538
|
}
|
|
@@ -51566,9 +52916,34 @@
|
|
|
51566
52916
|
});
|
|
51567
52917
|
}
|
|
51568
52918
|
|
|
52919
|
+
var __awaiter$1 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
52920
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
52921
|
+
function fulfilled(value) {
|
|
52922
|
+
try {
|
|
52923
|
+
step(generator.next(value));
|
|
52924
|
+
} catch (e) {
|
|
52925
|
+
reject(e);
|
|
52926
|
+
}
|
|
52927
|
+
}
|
|
52928
|
+
function rejected(value) {
|
|
52929
|
+
try {
|
|
52930
|
+
step(generator.throw(value));
|
|
52931
|
+
} catch (e) {
|
|
52932
|
+
reject(e);
|
|
52933
|
+
}
|
|
52934
|
+
}
|
|
52935
|
+
function step(result) {
|
|
52936
|
+
var value;
|
|
52937
|
+
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
|
|
52938
|
+
resolve(value);
|
|
52939
|
+
})).then(fulfilled, rejected);
|
|
52940
|
+
}
|
|
52941
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
52942
|
+
});
|
|
52943
|
+
};
|
|
51569
52944
|
class EventManager {
|
|
51570
52945
|
constructor(table) {
|
|
51571
|
-
this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
|
|
52946
|
+
this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.cutWaitPaste = !1, this.clipboardCheckTimer = null, this.cutOperationTime = 0, this.lastClipboardContent = "", this.cutCellRange = null, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
|
|
51572
52947
|
this.bindSelfEvent();
|
|
51573
52948
|
}, 0));
|
|
51574
52949
|
}
|
|
@@ -51622,7 +52997,7 @@
|
|
|
51622
52997
|
}
|
|
51623
52998
|
return !1;
|
|
51624
52999
|
}
|
|
51625
|
-
return !this.table.isPivotChart() || "axis-label" !== (null === (_b = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.target.name) && "chart" !== (null === (_c = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target.type) ? (this.table.stateManager.updateSelectPos(eventArgs.col, eventArgs.row, eventArgs.event.shiftKey, eventArgs.event.ctrlKey || eventArgs.event.metaKey, !1, !isSelectMoving && (null === (_e = null === (_d = this.table.options.select) || void 0 === _d ? void 0 : _d.makeSelectCellVisible) || void 0 === _e || _e)), !0) : (this.table.stateManager.updateSelectPos(-1, -1), !1);
|
|
53000
|
+
return !this.table.isPivotChart() || "axis-label" !== (null === (_b = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.target.name) && "chart" !== (null === (_c = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target.type) ? (this.table.stateManager.updateSelectPos("row" === this.table.stateManager.select.selectInline ? this.table.colCount - 1 : eventArgs.col, "col" === this.table.stateManager.select.selectInline ? this.table.rowCount - 1 : eventArgs.row, eventArgs.event.shiftKey, eventArgs.event.ctrlKey || eventArgs.event.metaKey, !1, !isSelectMoving && (null === (_e = null === (_d = this.table.options.select) || void 0 === _d ? void 0 : _d.makeSelectCellVisible) || void 0 === _e || _e)), !0) : (this.table.stateManager.updateSelectPos(-1, -1), !1);
|
|
51626
53001
|
}
|
|
51627
53002
|
return !1;
|
|
51628
53003
|
}
|
|
@@ -51789,6 +53164,242 @@
|
|
|
51789
53164
|
disableScroll() {
|
|
51790
53165
|
this._enableTableScroll = !1;
|
|
51791
53166
|
}
|
|
53167
|
+
handleCopy(e, isCut = !1) {
|
|
53168
|
+
var _a, _b;
|
|
53169
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
53170
|
+
const table = this.table;
|
|
53171
|
+
!isCut && (this.cutWaitPaste = !1);
|
|
53172
|
+
const data = this.table.getCopyValue();
|
|
53173
|
+
if (isValid$5(data)) {
|
|
53174
|
+
e.preventDefault();
|
|
53175
|
+
const permissionState = yield navigator.permissions.query({
|
|
53176
|
+
name: "clipboard-write"
|
|
53177
|
+
});
|
|
53178
|
+
if ((null === (_a = navigator.clipboard) || void 0 === _a ? void 0 : _a.write) && "granted" === permissionState.state) {
|
|
53179
|
+
const setDataToHTML = data => {
|
|
53180
|
+
const result = ["<table>"],
|
|
53181
|
+
META_HEAD = ['<meta name="author" content="Visactor"/>', '<style type="text/css">td{white-space:normal}br{mso-data-placement:same-cell}</style>'].join(""),
|
|
53182
|
+
rows = data.split("\r\n");
|
|
53183
|
+
return rows.forEach(function (rowCells, rowIndex) {
|
|
53184
|
+
const cells = rowCells.split("\t"),
|
|
53185
|
+
rowValues = [];
|
|
53186
|
+
0 === rowIndex && result.push("<tbody>"), cells.forEach(function (cell, cellIndex) {
|
|
53187
|
+
const parsedCellData = cell ? cell.toString().replace(/&/g, "&").replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br>").replace(/(<br(\s*|\/)>(\r\n|\n)?|\r\n|\n)/g, "<br>\r\n").replace(/\x20{2,}/gi, substring => `<span style="mso-spacerun: yes">${" ".repeat(substring.length - 1)} </span>`).replace(/\t/gi, "	") : " ";
|
|
53188
|
+
rowValues.push(`<td>${parsedCellData}</td>`);
|
|
53189
|
+
}), result.push("<tr>", ...rowValues, "</tr>"), rowIndex === rows.length - 1 && result.push("</tbody>");
|
|
53190
|
+
}), result.push("</table>"), [META_HEAD, result.join("")].join("");
|
|
53191
|
+
},
|
|
53192
|
+
dataHTML = setDataToHTML(data);
|
|
53193
|
+
navigator.clipboard.write([new ClipboardItem({
|
|
53194
|
+
"text/html": new Blob([dataHTML], {
|
|
53195
|
+
type: "text/html"
|
|
53196
|
+
}),
|
|
53197
|
+
"text/plain": new Blob([data], {
|
|
53198
|
+
type: "text/plain"
|
|
53199
|
+
})
|
|
53200
|
+
})]);
|
|
53201
|
+
} else browser.IE ? window.clipboardData.setData("Text", data) : e.clipboardData.setData("text/plain", data);
|
|
53202
|
+
table.fireListeners(TABLE_EVENT_TYPE.COPY_DATA, {
|
|
53203
|
+
cellRange: table.stateManager.select.ranges,
|
|
53204
|
+
copyData: data,
|
|
53205
|
+
isCut: isCut
|
|
53206
|
+
});
|
|
53207
|
+
}
|
|
53208
|
+
(null === (_b = table.keyboardOptions) || void 0 === _b ? void 0 : _b.showCopyCellBorder) && (setActiveCellRangeState(table), table.clearSelected());
|
|
53209
|
+
});
|
|
53210
|
+
}
|
|
53211
|
+
handleCut(e) {
|
|
53212
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
53213
|
+
this.handleCopy(e, !0), this.cutWaitPaste = !0, this.cutCellRange = this.table.getSelectedCellInfos(), this.clipboardCheckTimer && clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = window.setTimeout(() => {
|
|
53214
|
+
this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer = null);
|
|
53215
|
+
}, 3e4), this.saveClipboardContent();
|
|
53216
|
+
});
|
|
53217
|
+
}
|
|
53218
|
+
handlePaste(e) {
|
|
53219
|
+
this.cutWaitPaste ? this.checkClipboardChanged().then(changed => {
|
|
53220
|
+
this.executePaste(e), changed || this.clearCutArea(this.table), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
|
|
53221
|
+
}).catch(() => {
|
|
53222
|
+
this.executePaste(e), this.cutWaitPaste && (this.cutWaitPaste = !1, this.cutCellRange = null, this.clipboardCheckTimer && (clearTimeout(this.clipboardCheckTimer), this.clipboardCheckTimer = null));
|
|
53223
|
+
}) : this.executePaste(e);
|
|
53224
|
+
}
|
|
53225
|
+
executePaste(e) {
|
|
53226
|
+
var _a, _b, _c, _d;
|
|
53227
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
53228
|
+
const table = this.table;
|
|
53229
|
+
if (table.changeCellValues) {
|
|
53230
|
+
if (null === (_a = table.editorManager) || void 0 === _a ? void 0 : _a.editingEditor) return;
|
|
53231
|
+
if ((null === (_b = table.stateManager.select.ranges) || void 0 === _b ? void 0 : _b.length) > 0) if (null === (_c = navigator.clipboard) || void 0 === _c ? void 0 : _c.read) navigator.clipboard.read().then(clipboardItems => {
|
|
53232
|
+
for (const item of clipboardItems) item.types.includes("text/html") ? this.pasteHtmlToTable(item) : 1 === item.types.length && "text/plain" === item.types[0] && this.pasteTextToTable(item);
|
|
53233
|
+
});else {
|
|
53234
|
+
const ranges = table.stateManager.select.ranges,
|
|
53235
|
+
col = Math.min(ranges[0].start.col, ranges[0].end.col),
|
|
53236
|
+
row = Math.min(ranges[0].start.row, ranges[0].end.row),
|
|
53237
|
+
rows = (e.clipboardData || window.Clipboard).getData("text").split("\n"),
|
|
53238
|
+
values = [];
|
|
53239
|
+
rows.forEach(function (rowCells, rowIndex) {
|
|
53240
|
+
const cells = rowCells.split("\t"),
|
|
53241
|
+
rowValues = [];
|
|
53242
|
+
values.push(rowValues), cells.forEach(function (cell, cellIndex) {
|
|
53243
|
+
cellIndex === cells.length - 1 && (cell = cell.trim()), rowValues.push(cell);
|
|
53244
|
+
});
|
|
53245
|
+
});
|
|
53246
|
+
const changedCellResults = yield table.changeCellValues(col, row, values);
|
|
53247
|
+
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
53248
|
+
col: col,
|
|
53249
|
+
row: row,
|
|
53250
|
+
pasteData: values,
|
|
53251
|
+
changedCellResults: changedCellResults
|
|
53252
|
+
});
|
|
53253
|
+
}
|
|
53254
|
+
}
|
|
53255
|
+
(null === (_d = table.keyboardOptions) || void 0 === _d ? void 0 : _d.showCopyCellBorder) && clearActiveCellRangeState(table);
|
|
53256
|
+
});
|
|
53257
|
+
}
|
|
53258
|
+
clearCutArea(table) {
|
|
53259
|
+
try {
|
|
53260
|
+
const selectCells = this.cutCellRange;
|
|
53261
|
+
if (!selectCells || 0 === selectCells.length) return;
|
|
53262
|
+
for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) selectCells[i][j] && table.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, void 0);
|
|
53263
|
+
} catch (error) {}
|
|
53264
|
+
}
|
|
53265
|
+
checkClipboardChanged() {
|
|
53266
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
53267
|
+
if (!navigator.clipboard || !navigator.clipboard.readText) return !1;
|
|
53268
|
+
try {
|
|
53269
|
+
return (yield navigator.clipboard.readText()) !== this.lastClipboardContent;
|
|
53270
|
+
} catch (err) {
|
|
53271
|
+
return !1;
|
|
53272
|
+
}
|
|
53273
|
+
});
|
|
53274
|
+
}
|
|
53275
|
+
saveClipboardContent() {
|
|
53276
|
+
navigator.clipboard && navigator.clipboard.readText && setTimeout(() => {
|
|
53277
|
+
navigator.clipboard.readText().then(text => {
|
|
53278
|
+
this.lastClipboardContent = text;
|
|
53279
|
+
}).catch(err => {});
|
|
53280
|
+
}, 50);
|
|
53281
|
+
}
|
|
53282
|
+
pasteHtmlToTable(item) {
|
|
53283
|
+
const regex = /<tr[^>]*>([\s\S]*?)<\/tr>/g,
|
|
53284
|
+
cellRegex = /<td[^>]*>([\s\S]*?)<\/td>/g,
|
|
53285
|
+
table = this.table,
|
|
53286
|
+
ranges = table.stateManager.select.ranges,
|
|
53287
|
+
selectRangeLength = ranges.length,
|
|
53288
|
+
col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
53289
|
+
row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row),
|
|
53290
|
+
maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
53291
|
+
maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
53292
|
+
let pasteValuesColCount = 0,
|
|
53293
|
+
pasteValuesRowCount = 0,
|
|
53294
|
+
values = [];
|
|
53295
|
+
item.getType("text/html").then(blob => {
|
|
53296
|
+
blob.text().then(pastedData => __awaiter$1(this, void 0, void 0, function* () {
|
|
53297
|
+
var _a, _b;
|
|
53298
|
+
if (pastedData && /(<table)|(<TABLE)/g.test(pastedData)) {
|
|
53299
|
+
const matches = Array.from(pastedData.matchAll(regex));
|
|
53300
|
+
for (const match of matches) {
|
|
53301
|
+
const rowContent = match[1],
|
|
53302
|
+
rowValues = Array.from(rowContent.matchAll(cellRegex)).map(cellMatch => cellMatch[1].replace(/(<(?!br)([^>]+)>)/gi, "").replace(/<br(\s*|\/)>[\r\n]?/gim, "\n").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/	/gi, "\t").replace(/ /g, " "));
|
|
53303
|
+
values.push(rowValues), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
|
|
53304
|
+
}
|
|
53305
|
+
pasteValuesRowCount = null !== (_b = values.length) && void 0 !== _b ? _b : 0, values = this.handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
53306
|
+
const changedCellResults = yield table.changeCellValues(col, row, values, !0);
|
|
53307
|
+
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
53308
|
+
col: col,
|
|
53309
|
+
row: row,
|
|
53310
|
+
pasteData: values,
|
|
53311
|
+
changedCellResults: changedCellResults
|
|
53312
|
+
});
|
|
53313
|
+
} else navigator.clipboard.read().then(clipboardItems => {
|
|
53314
|
+
for (const item of clipboardItems) item.types.includes("text/plain") && item.getType("text/plain").then(blob => {
|
|
53315
|
+
blob.text().then(this._pasteValue);
|
|
53316
|
+
});
|
|
53317
|
+
});
|
|
53318
|
+
}));
|
|
53319
|
+
});
|
|
53320
|
+
}
|
|
53321
|
+
_pasteValue(pastedData) {
|
|
53322
|
+
var _a;
|
|
53323
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
53324
|
+
const table = this.table,
|
|
53325
|
+
ranges = table.stateManager.select.ranges,
|
|
53326
|
+
selectRangeLength = ranges.length,
|
|
53327
|
+
col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
53328
|
+
row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row),
|
|
53329
|
+
maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
53330
|
+
maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
53331
|
+
let pasteValuesColCount = 0,
|
|
53332
|
+
pasteValuesRowCount = 0,
|
|
53333
|
+
values = [];
|
|
53334
|
+
pastedData.split("\n").forEach(function (rowCells, rowIndex) {
|
|
53335
|
+
var _a;
|
|
53336
|
+
const cells = rowCells.split("\t"),
|
|
53337
|
+
rowValues = [];
|
|
53338
|
+
values.push(rowValues), cells.forEach(function (cell, cellIndex) {
|
|
53339
|
+
cellIndex === cells.length - 1 && (cell = cell.trim()), rowValues.push(cell);
|
|
53340
|
+
}), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
|
|
53341
|
+
}), pasteValuesRowCount = null !== (_a = values.length) && void 0 !== _a ? _a : 0, values = this.handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
53342
|
+
const changedCellResults = yield table.changeCellValues(col, row, values, !0);
|
|
53343
|
+
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
53344
|
+
col: col,
|
|
53345
|
+
row: row,
|
|
53346
|
+
pasteData: values,
|
|
53347
|
+
changedCellResults: changedCellResults
|
|
53348
|
+
});
|
|
53349
|
+
});
|
|
53350
|
+
}
|
|
53351
|
+
pasteTextToTable(item) {
|
|
53352
|
+
const table = this.table,
|
|
53353
|
+
ranges = table.stateManager.select.ranges,
|
|
53354
|
+
selectRangeLength = ranges.length,
|
|
53355
|
+
col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
53356
|
+
row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row),
|
|
53357
|
+
maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
53358
|
+
maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
53359
|
+
let pasteValuesColCount = 0,
|
|
53360
|
+
pasteValuesRowCount = 0;
|
|
53361
|
+
item.getType("text/plain").then(blob => {
|
|
53362
|
+
blob.text().then(pastedData => __awaiter$1(this, void 0, void 0, function* () {
|
|
53363
|
+
var _a;
|
|
53364
|
+
const rows = pastedData.replace(/\r(?!\n)/g, "\r\n").split("\r\n");
|
|
53365
|
+
let values = [];
|
|
53366
|
+
rows.length > 1 && "" === rows[rows.length - 1] && rows.pop(), rows.forEach(function (rowCells, rowIndex) {
|
|
53367
|
+
var _a;
|
|
53368
|
+
const cells = rowCells.split("\t"),
|
|
53369
|
+
rowValues = [];
|
|
53370
|
+
values.push(rowValues), cells.forEach(function (cell, cellIndex) {
|
|
53371
|
+
cell.includes("\n") && (cell = cell.replace(/^"(.*)"$/, "$1").replace(/["]*/g, match => new Array(Math.floor(match.length / 2)).fill('"').join(""))), rowValues.push(cell);
|
|
53372
|
+
}), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
|
|
53373
|
+
}), pasteValuesRowCount = null !== (_a = values.length) && void 0 !== _a ? _a : 0, values = this.handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
53374
|
+
const changedCellResults = yield table.changeCellValues(col, row, values, !0);
|
|
53375
|
+
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
53376
|
+
col: col,
|
|
53377
|
+
row: row,
|
|
53378
|
+
pasteData: values,
|
|
53379
|
+
changedCellResults: changedCellResults
|
|
53380
|
+
});
|
|
53381
|
+
}));
|
|
53382
|
+
});
|
|
53383
|
+
}
|
|
53384
|
+
handlePasteValues(values, rowCount, colCount, selectedRowCount, selectedColCount) {
|
|
53385
|
+
if (selectedColCount > colCount || selectedRowCount > rowCount) {
|
|
53386
|
+
if (selectedColCount % colCount == 0 && selectedRowCount % rowCount == 0) {
|
|
53387
|
+
const toPasteValues = [];
|
|
53388
|
+
for (let i = 0; i < selectedRowCount; i++) {
|
|
53389
|
+
const rowPasteValue = [];
|
|
53390
|
+
toPasteValues.push(rowPasteValue);
|
|
53391
|
+
for (let j = 0; j < selectedColCount; j++) {
|
|
53392
|
+
const copiedRow = i % rowCount,
|
|
53393
|
+
copiedCol = j % colCount;
|
|
53394
|
+
rowPasteValue.push(values[copiedRow][copiedCol]);
|
|
53395
|
+
}
|
|
53396
|
+
}
|
|
53397
|
+
return toPasteValues;
|
|
53398
|
+
}
|
|
53399
|
+
return values;
|
|
53400
|
+
}
|
|
53401
|
+
return values;
|
|
53402
|
+
}
|
|
51792
53403
|
}
|
|
51793
53404
|
|
|
51794
53405
|
let defaultStyle$4;
|
|
@@ -53723,7 +55334,7 @@
|
|
|
53723
55334
|
for (let col = startCol; col < colCount; col++) {
|
|
53724
55335
|
const width = _this.getColWidth(col),
|
|
53725
55336
|
right = left + width;
|
|
53726
|
-
if (Math.round(left) <=
|
|
55337
|
+
if (Math.round(left) <= absoluteX && absoluteX < Math.round(right)) return {
|
|
53727
55338
|
left: left,
|
|
53728
55339
|
col: col,
|
|
53729
55340
|
right: right,
|
|
@@ -53737,7 +55348,7 @@
|
|
|
53737
55348
|
for (let col = startCol; col >= 0; col--) {
|
|
53738
55349
|
const width = _this.getColWidth(col),
|
|
53739
55350
|
left = right - width;
|
|
53740
|
-
if (Math.round(left) <=
|
|
55351
|
+
if (Math.round(left) <= absoluteX && absoluteX < Math.round(right)) return {
|
|
53741
55352
|
left: left,
|
|
53742
55353
|
col: col,
|
|
53743
55354
|
right: right,
|
|
@@ -54818,7 +56429,7 @@
|
|
|
54818
56429
|
}
|
|
54819
56430
|
constructor(container, options = {}) {
|
|
54820
56431
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
54821
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.0.
|
|
56432
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.0.18", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
54822
56433
|
this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
54823
56434
|
options: options,
|
|
54824
56435
|
container: container
|
|
@@ -54865,6 +56476,8 @@
|
|
|
54865
56476
|
modeParams: modeParams,
|
|
54866
56477
|
canvasWidth: canvasWidth,
|
|
54867
56478
|
canvasHeight: canvasHeight,
|
|
56479
|
+
contentOffsetX: translateX,
|
|
56480
|
+
contentOffsetY: translateY,
|
|
54868
56481
|
overscrollBehavior: overscrollBehavior,
|
|
54869
56482
|
limitMinWidth: limitMinWidth,
|
|
54870
56483
|
limitMinHeight: limitMinHeight,
|
|
@@ -54891,7 +56504,7 @@
|
|
|
54891
56504
|
right: 0,
|
|
54892
56505
|
left: 0,
|
|
54893
56506
|
bottom: 0
|
|
54894
|
-
}, padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding, this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top), padding.bottom && (this.padding.bottom = padding.bottom), padding.left && (this.padding.left = padding.left), padding.right && (this.padding.right = padding.right))), (isValid$5(canvasHeight) || isValid$5(canvasWidth)) && (this.canvasSizeSeted = !0), this.tableNoFrameWidth = 0, this.tableNoFrameHeight = 0, this.canvasWidth = isNumber$6(canvasWidth) ? canvasWidth : void 0, this.canvasHeight = isNumber$6(canvasHeight) ? canvasHeight : void 0, this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal";
|
|
56507
|
+
}, padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding, this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top), padding.bottom && (this.padding.bottom = padding.bottom), padding.left && (this.padding.left = padding.left), padding.right && (this.padding.right = padding.right))), (isValid$5(canvasHeight) || isValid$5(canvasWidth)) && (this.canvasSizeSeted = !0), this.tableNoFrameWidth = 0, this.tableNoFrameHeight = 0, this.contentOffsetX = null != translateX ? translateX : 0, this.contentOffsetY = null != translateY ? translateY : 0, this.canvasWidth = isNumber$6(canvasWidth) ? canvasWidth : void 0, this.canvasHeight = isNumber$6(canvasHeight) ? canvasHeight : void 0, this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal";
|
|
54895
56508
|
const internalProps = this.internalProps = {};
|
|
54896
56509
|
void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1), this.options.canvas ? ("node" !== Env.mode && (internalProps.element = this.options.canvas.parentElement, internalProps.element.style.position = "relative"), internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== Env.mode && (internalProps.element = createRootElement(this.padding), internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d"), (null === (_e = options.customConfig) || void 0 === _e ? void 0 : _e.createReactContainer) && createReactContainer(this)), internalProps.handler = new EventHandler(), isNumber$6(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime), internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount, internalProps.frozenRowCount = frozenRowCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth, internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight, internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth, internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions, internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = null === (_f = null != enableCheckboxCascade ? enableCheckboxCascade : null == rowSeriesNumber ? void 0 : rowSeriesNumber.enableTreeCheckbox) || void 0 === _f || _f, internalProps.enableHeaderCheckboxCascade = enableCheckboxCascade || null == enableHeaderCheckboxCascade || enableHeaderCheckboxCascade, internalProps.columnResizeMode = null !== (_g = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _g ? _g : columnResizeMode, internalProps.rowResizeMode = null !== (_h = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _h ? _h : rowResizeMode, internalProps.dragHeaderMode = null !== (_k = null !== (_j = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _j ? _j : dragHeaderMode) && void 0 !== _k ? _k : "none", internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto", internalProps.groupBy = null !== (_l = null == groupConfig ? void 0 : groupConfig.groupBy) && void 0 !== _l ? _l : groupBy, internalProps.groupTitleCheckbox = null !== (_m = null == groupConfig ? void 0 : groupConfig.titleCheckbox) && void 0 !== _m ? _m : !!(null == rowSeriesNumber ? void 0 : rowSeriesNumber.enableTreeCheckbox), internalProps.groupCellMerge = null == groupConfig ? void 0 : groupConfig.groupCellMerge, internalProps.customDealGroupData = null == groupConfig ? void 0 : groupConfig.customDealGroupData, internalProps.groupTitleFieldFormat = null !== (_o = null == groupConfig ? void 0 : groupConfig.titleFieldFormat) && void 0 !== _o ? _o : groupTitleFieldFormat, internalProps.groupTitleCustomLayout = null !== (_p = null == groupConfig ? void 0 : groupConfig.titleCustomLayout) && void 0 !== _p ? _p : groupTitleCustomLayout, internalProps.enableTreeStickCell = null !== (_q = null == groupConfig ? void 0 : groupConfig.enableTreeStickCell) && void 0 !== _q ? _q : enableTreeStickCell, internalProps._rowHeightsMap = new NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map(), internalProps._colRangeWidthsMap = new Map(), internalProps._widthResizedColMap = new Set(), internalProps._heightResizedRowMap = new Set(), this.colWidthsMap = new NumberMap(), this.colContentWidthsMap = new NumberMap(), this.colWidthsLimit = {};
|
|
54897
56510
|
const that = this;
|
|
@@ -54978,6 +56591,9 @@
|
|
|
54978
56591
|
setCanvasSize(canvasWidth, canvasHeight) {
|
|
54979
56592
|
this.canvasWidth = canvasWidth, this.canvasHeight = canvasHeight, this.options.canvasHeight = canvasHeight, this.options.canvasWidth = canvasWidth, this.resize();
|
|
54980
56593
|
}
|
|
56594
|
+
setContentInsetXY(contentOffsetX, contentOffsetY) {
|
|
56595
|
+
this.contentOffsetX = contentOffsetX, this.contentOffsetY = contentOffsetY, this.options.contentOffsetX = contentOffsetX, this.options.contentOffsetY = contentOffsetY, this.resize();
|
|
56596
|
+
}
|
|
54981
56597
|
resize() {
|
|
54982
56598
|
var _a;
|
|
54983
56599
|
this._updateSize(), null === (_a = this.internalProps.legends) || void 0 === _a || _a.forEach(legend => {
|
|
@@ -55030,6 +56646,9 @@
|
|
|
55030
56646
|
return null !== (_e = null !== (_c = null === (_b = null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.layoutMap) || void 0 === _b ? void 0 : _b.frozenRowCount) && void 0 !== _c ? _c : null === (_d = this.internalProps) || void 0 === _d ? void 0 : _d.frozenRowCount) && void 0 !== _e ? _e : 0;
|
|
55031
56647
|
}
|
|
55032
56648
|
set frozenRowCount(frozenRowCount) {
|
|
56649
|
+
this.internalProps.frozenRowCount = frozenRowCount, this.options.frozenRowCount = frozenRowCount, this.stateManager.setFrozenRow(this.internalProps.frozenRowCount);
|
|
56650
|
+
}
|
|
56651
|
+
_setFrozenRowCount(frozenRowCount) {
|
|
55033
56652
|
this.internalProps.frozenRowCount = frozenRowCount, this.stateManager.setFrozenRow(this.internalProps.frozenRowCount);
|
|
55034
56653
|
}
|
|
55035
56654
|
get rightFrozenColCount() {
|
|
@@ -55204,7 +56823,7 @@
|
|
|
55204
56823
|
} = this;
|
|
55205
56824
|
let widthP = 0,
|
|
55206
56825
|
heightP = 0;
|
|
55207
|
-
if (this.tableX =
|
|
56826
|
+
if (this.tableX = this.contentOffsetX, this.tableY = this.contentOffsetY, this.options.canvas && this.options.viewBox) widthP = this.options.viewBox.x2 - this.options.viewBox.x1, heightP = this.options.viewBox.y2 - this.options.viewBox.y1, (null === (_a = null == this ? void 0 : this.scenegraph) || void 0 === _a ? void 0 : _a.stage) && (this.options.viewBox ? this.scenegraph.stage.setViewBox(this.options.viewBox, !1) : this.scenegraph.stage.resize(widthP, heightP));else if ("browser" === Env.mode) {
|
|
55208
56827
|
const element = this.getElement();
|
|
55209
56828
|
let widthWithoutPadding = 0,
|
|
55210
56829
|
heightWithoutPadding = 0;
|
|
@@ -55230,12 +56849,12 @@
|
|
|
55230
56849
|
if (null === (_l = this.internalProps.theme) || void 0 === _l ? void 0 : _l.frameStyle) {
|
|
55231
56850
|
const lineWidths = toBoxArray(null !== (_o = null === (_m = this.internalProps.theme.frameStyle) || void 0 === _m ? void 0 : _m.borderLineWidth) && void 0 !== _o ? _o : [null]),
|
|
55232
56851
|
shadowWidths = toBoxArray(null !== (_q = null === (_p = this.internalProps.theme.frameStyle) || void 0 === _p ? void 0 : _p.shadowBlur) && void 0 !== _q ? _q : [0]);
|
|
55233
|
-
if (null === (_r = this.theme.frameStyle) || void 0 === _r ? void 0 : _r.innerBorder) this.tableX
|
|
55234
|
-
this.tableX
|
|
56852
|
+
if (null === (_r = this.theme.frameStyle) || void 0 === _r ? void 0 : _r.innerBorder) this.tableX += this.contentOffsetX, this.tableY += this.contentOffsetY, this.tableNoFrameWidth = width - (null !== (_s = shadowWidths[1]) && void 0 !== _s ? _s : 0) - this.contentOffsetX, this.tableNoFrameHeight = height - (null !== (_t = shadowWidths[2]) && void 0 !== _t ? _t : 0) - this.contentOffsetY;else {
|
|
56853
|
+
this.tableX += (null !== (_u = lineWidths[3]) && void 0 !== _u ? _u : 0) + (null !== (_v = shadowWidths[3]) && void 0 !== _v ? _v : 0), this.tableY += (null !== (_w = lineWidths[0]) && void 0 !== _w ? _w : 0) + (null !== (_x = shadowWidths[0]) && void 0 !== _x ? _x : 0);
|
|
55235
56854
|
const rightBorder = (null !== (_y = lineWidths[1]) && void 0 !== _y ? _y : 0) + (null !== (_z = shadowWidths[1]) && void 0 !== _z ? _z : 0);
|
|
55236
|
-
this.tableNoFrameWidth = width - (rightBorder > vScrollBarWidth ? rightBorder - vScrollBarWidth : 0) - ((null !== (_0 = lineWidths[3]) && void 0 !== _0 ? _0 : 0) + (null !== (_1 = shadowWidths[3]) && void 0 !== _1 ? _1 : 0));
|
|
56855
|
+
this.tableNoFrameWidth = width - (rightBorder > vScrollBarWidth ? rightBorder - vScrollBarWidth : 0) - ((null !== (_0 = lineWidths[3]) && void 0 !== _0 ? _0 : 0) + (null !== (_1 = shadowWidths[3]) && void 0 !== _1 ? _1 : 0)) - this.contentOffsetX;
|
|
55237
56856
|
const bottomBorder = (null !== (_2 = lineWidths[2]) && void 0 !== _2 ? _2 : 0) + (null !== (_3 = shadowWidths[2]) && void 0 !== _3 ? _3 : 0);
|
|
55238
|
-
this.tableNoFrameHeight = height - (bottomBorder > hScrollBarWidth ? bottomBorder - hScrollBarWidth : 0) - ((null !== (_4 = lineWidths[0]) && void 0 !== _4 ? _4 : 0) + (null !== (_5 = shadowWidths[0]) && void 0 !== _5 ? _5 : 0));
|
|
56857
|
+
this.tableNoFrameHeight = height - (bottomBorder > hScrollBarWidth ? bottomBorder - hScrollBarWidth : 0) - ((null !== (_4 = lineWidths[0]) && void 0 !== _4 ? _4 : 0) + (null !== (_5 = shadowWidths[0]) && void 0 !== _5 ? _5 : 0)) - this.contentOffsetY;
|
|
55239
56858
|
}
|
|
55240
56859
|
}
|
|
55241
56860
|
this._clearColRangeWidthsMap(), this._clearRowRangeHeightsMap();
|
|
@@ -55733,7 +57352,7 @@
|
|
|
55733
57352
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
55734
57353
|
const internalProps = this.internalProps;
|
|
55735
57354
|
if (this.isReleased) return;
|
|
55736
|
-
null === (_b = null === (_a = internalProps.tooltipHandler) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a), null === (_d = null === (_c = internalProps.menuHandler) || void 0 === _c ? void 0 : _c.release) || void 0 === _d || _d.call(_c), null === (_e = super.release) || void 0 === _e || _e.call(this), null === (_g = null === (_f = internalProps.handler) || void 0 === _f ? void 0 : _f.release) || void 0 === _g || _g.call(_f), this.eventManager.release(), null === (_j = null === (_h = internalProps.focusControl) || void 0 === _h ? void 0 : _h.release) || void 0 === _j || _j.call(_h), null === (_k = internalProps.legends) || void 0 === _k || _k.forEach(legend => {
|
|
57355
|
+
null === (_b = null === (_a = internalProps.tooltipHandler) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a), null === (_d = null === (_c = internalProps.menuHandler) || void 0 === _c ? void 0 : _c.release) || void 0 === _d || _d.call(_c), null === (_e = super.release) || void 0 === _e || _e.call(this), this.pluginManager.release(), null === (_g = null === (_f = internalProps.handler) || void 0 === _f ? void 0 : _f.release) || void 0 === _g || _g.call(_f), this.eventManager.release(), null === (_j = null === (_h = internalProps.focusControl) || void 0 === _h ? void 0 : _h.release) || void 0 === _j || _j.call(_h), null === (_k = internalProps.legends) || void 0 === _k || _k.forEach(legend => {
|
|
55737
57356
|
null == legend || legend.release();
|
|
55738
57357
|
}), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.title = null, null === (_m = internalProps.emptyTip) || void 0 === _m || _m.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), internalProps.releaseList && (internalProps.releaseList.forEach(releaseObj => {
|
|
55739
57358
|
var _a;
|
|
@@ -55742,14 +57361,20 @@
|
|
|
55742
57361
|
const {
|
|
55743
57362
|
parentElement: parentElement
|
|
55744
57363
|
} = internalProps.element;
|
|
55745
|
-
parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element), null === (_q = null === (_p = null === (_o = this.editorManager) || void 0 === _o ? void 0 : _o.editingEditor) || void 0 === _p ? void 0 : _p.onEnd) || void 0 === _q || _q.call(_p), this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_r = this.reactCustomLayout) || void 0 === _r || _r.clearCache(),
|
|
57364
|
+
parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element), null === (_q = null === (_p = null === (_o = this.editorManager) || void 0 === _o ? void 0 : _o.editingEditor) || void 0 === _p ? void 0 : _p.onEnd) || void 0 === _q || _q.call(_p), this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_r = this.reactCustomLayout) || void 0 === _r || _r.clearCache(), clearChartRenderQueue();
|
|
55746
57365
|
}
|
|
55747
57366
|
fireListeners(type, event) {
|
|
55748
57367
|
return super.fireListeners(type, event);
|
|
55749
57368
|
}
|
|
55750
|
-
updateOption(options
|
|
57369
|
+
updateOption(options, updateConfig = {
|
|
57370
|
+
clearColWidthCache: !0,
|
|
57371
|
+
clearRowHeightCache: !0
|
|
57372
|
+
}) {
|
|
55751
57373
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
55752
|
-
|
|
57374
|
+
this.fireListeners(TABLE_EVENT_TYPE.BEFORE_UPDATE_OPTION, {
|
|
57375
|
+
options: options,
|
|
57376
|
+
container: this.container
|
|
57377
|
+
}), null === (_a = this.editorManager) || void 0 === _a || _a.cancelEdit(), this.options = options, this._hasAutoImageColumn = void 0;
|
|
55753
57378
|
const {
|
|
55754
57379
|
frozenColCount = 0,
|
|
55755
57380
|
unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth,
|
|
@@ -55786,6 +57411,8 @@
|
|
|
55786
57411
|
renderChartAsyncBatchCount: renderChartAsyncBatchCount,
|
|
55787
57412
|
canvasWidth: canvasWidth,
|
|
55788
57413
|
canvasHeight: canvasHeight,
|
|
57414
|
+
contentOffsetX: translateX = 0,
|
|
57415
|
+
contentOffsetY: translateY = 0,
|
|
55789
57416
|
overscrollBehavior: overscrollBehavior,
|
|
55790
57417
|
limitMinWidth: limitMinWidth,
|
|
55791
57418
|
limitMinHeight: limitMinHeight
|
|
@@ -55806,9 +57433,9 @@
|
|
|
55806
57433
|
} : {
|
|
55807
57434
|
width: !1,
|
|
55808
57435
|
height: !1
|
|
55809
|
-
}), this.customRender = customRender, this.canvasWidth = isNumber$6(canvasWidth) ? canvasWidth : void 0, this.canvasHeight = isNumber$6(canvasHeight) ? canvasHeight : void 0;
|
|
57436
|
+
}), this.customRender = customRender, this.contentOffsetX = null != translateX ? translateX : 0, this.contentOffsetY = null != translateY ? translateY : 0, this.canvasWidth = isNumber$6(canvasWidth) ? canvasWidth : void 0, this.canvasHeight = isNumber$6(canvasHeight) ? canvasHeight : void 0;
|
|
55810
57437
|
const internalProps = this.internalProps;
|
|
55811
|
-
if ("node" === Env.mode || options.canvas || updateRootElementPadding(internalProps.element, this.padding), this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal", internalProps.frozenColCount = frozenColCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth, internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight, internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth, internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions, internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = null === (_e = null != enableCheckboxCascade ? enableCheckboxCascade : null == rowSeriesNumber ? void 0 : rowSeriesNumber.enableTreeCheckbox) || void 0 === _e || _e, internalProps.enableHeaderCheckboxCascade = enableCheckboxCascade || null == enableHeaderCheckboxCascade || enableHeaderCheckboxCascade, internalProps.columnResizeMode = null !== (_f = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _f ? _f : columnResizeMode, internalProps.rowResizeMode = null !== (_g = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _g ? _g : rowResizeMode, internalProps.dragHeaderMode = null !== (_j = null !== (_h = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _h ? _h : dragHeaderMode) && void 0 !== _j ? _j : "none", internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto", internalProps.cellTextOverflows = {}, internalProps.groupBy = null !== (_k = null == groupConfig ? void 0 : groupConfig.groupBy) && void 0 !== _k ? _k : groupBy, internalProps.groupTitleCheckbox = null == groupConfig ? void 0 : groupConfig.titleCheckbox, internalProps.groupTitleFieldFormat = null !== (_l = null == groupConfig ? void 0 : groupConfig.titleFieldFormat) && void 0 !== _l ? _l : groupTitleFieldFormat, internalProps.groupTitleCustomLayout = null !== (_m = null == groupConfig ? void 0 : groupConfig.titleCustomLayout) && void 0 !== _m ? _m : groupTitleCustomLayout, internalProps.enableTreeStickCell = null !== (_o = null == groupConfig ? void 0 : groupConfig.enableTreeStickCell) && void 0 !== _o ? _o : enableTreeStickCell,
|
|
57438
|
+
if ("node" === Env.mode || options.canvas || updateRootElementPadding(internalProps.element, this.padding), this.columnWidthComputeMode = null !== (_d = options.columnWidthComputeMode) && void 0 !== _d ? _d : "normal", internalProps.frozenColCount = frozenColCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth, internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight, internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth, internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions, internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = null === (_e = null != enableCheckboxCascade ? enableCheckboxCascade : null == rowSeriesNumber ? void 0 : rowSeriesNumber.enableTreeCheckbox) || void 0 === _e || _e, internalProps.enableHeaderCheckboxCascade = enableCheckboxCascade || null == enableHeaderCheckboxCascade || enableHeaderCheckboxCascade, internalProps.columnResizeMode = null !== (_f = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _f ? _f : columnResizeMode, internalProps.rowResizeMode = null !== (_g = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _g ? _g : rowResizeMode, internalProps.dragHeaderMode = null !== (_j = null !== (_h = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _h ? _h : dragHeaderMode) && void 0 !== _j ? _j : "none", internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto", internalProps.cellTextOverflows = {}, internalProps.groupBy = null !== (_k = null == groupConfig ? void 0 : groupConfig.groupBy) && void 0 !== _k ? _k : groupBy, internalProps.groupTitleCheckbox = null == groupConfig ? void 0 : groupConfig.titleCheckbox, internalProps.groupTitleFieldFormat = null !== (_l = null == groupConfig ? void 0 : groupConfig.titleFieldFormat) && void 0 !== _l ? _l : groupTitleFieldFormat, internalProps.groupTitleCustomLayout = null !== (_m = null == groupConfig ? void 0 : groupConfig.titleCustomLayout) && void 0 !== _m ? _m : groupTitleCustomLayout, internalProps.enableTreeStickCell = null !== (_o = null == groupConfig ? void 0 : groupConfig.enableTreeStickCell) && void 0 !== _o ? _o : enableTreeStickCell, (null == updateConfig ? void 0 : updateConfig.clearColWidthCache) && (internalProps._widthResizedColMap.clear(), this.colWidthsMap = new NumberMap(), this.colContentWidthsMap = new NumberMap(), this.colWidthsLimit = {}), (null == updateConfig ? void 0 : updateConfig.clearRowHeightCache) && (internalProps._heightResizedRowMap.clear(), internalProps._rowHeightsMap = new NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map(), internalProps._colRangeWidthsMap = new Map()), internalProps.stick.changedCells.clear(), internalProps.theme = themes.of(null !== (_p = options.theme) && void 0 !== _p ? _p : themes.DEFAULT), internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle), this.scenegraph.updateStageBackground(), internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_q = options.allowFrozenColCount) && void 0 !== _q ? _q : 0, internalProps.limitMaxAutoWidth = null !== (_r = options.limitMaxAutoWidth) && void 0 !== _r ? _r : 450, internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10, internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10, null === (_s = internalProps.legends) || void 0 === _s || _s.forEach(legend => {
|
|
55812
57439
|
null == legend || legend.release();
|
|
55813
57440
|
}), null === (_t = internalProps.title) || void 0 === _t || _t.release(), internalProps.title = null, null === (_u = internalProps.emptyTip) || void 0 === _u || _u.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), clearChartRenderQueue(), this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(), this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
|
|
55814
57441
|
internalProps.legends = [];
|
|
@@ -55840,7 +57467,7 @@
|
|
|
55840
57467
|
const MenuHandler = Factory.getComponent("menuHandler");
|
|
55841
57468
|
internalProps.menuHandler = new MenuHandler(this);
|
|
55842
57469
|
}
|
|
55843
|
-
this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(), internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell), null === (_z = this.customCellStylePlugin) || void 0 === _z || _z.updateCustomCell(null !== (_0 = options.customCellStyle) && void 0 !== _0 ? _0 : [], null !== (_1 = options.customCellStyleArrangement) && void 0 !== _1 ? _1 : []), this._adjustCanvasSizeByOption();
|
|
57470
|
+
this.clearCellStyleCache(), (null == updateConfig ? void 0 : updateConfig.clearColWidthCache) && this.clearColWidthCache(), (null == updateConfig ? void 0 : updateConfig.clearRowHeightCache) && this.clearRowHeightCache(), internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell), null === (_z = this.customCellStylePlugin) || void 0 === _z || _z.updateCustomCell(null !== (_0 = options.customCellStyle) && void 0 !== _0 ? _0 : [], null !== (_1 = options.customCellStyleArrangement) && void 0 !== _1 ? _1 : []), this._adjustCanvasSizeByOption();
|
|
55844
57471
|
}
|
|
55845
57472
|
renderWithRecreateCells() {
|
|
55846
57473
|
this.internalProps.stick.changedCells.clear();
|
|
@@ -55946,9 +57573,94 @@
|
|
|
55946
57573
|
} = this;
|
|
55947
57574
|
cellRanges.forEach((cellRange, index) => {
|
|
55948
57575
|
var _a, _b, _c, _d, _e, _f;
|
|
55949
|
-
|
|
57576
|
+
const startRow = cellRange.start.row,
|
|
57577
|
+
startCol = cellRange.start.col,
|
|
57578
|
+
endRow = cellRange.end.row,
|
|
57579
|
+
endCol = cellRange.end.col;
|
|
57580
|
+
startCol === endCol && startRow === endRow ? this.stateManager.updateSelectPos(startCol, startRow, !1, index >= 1, !1, null === (_b = null === (_a = this.options.select) || void 0 === _a ? void 0 : _a.makeSelectCellVisible) || void 0 === _b || _b, !0) : (this.stateManager.updateSelectPos(startCol, startRow, !1, index >= 1, !1, null === (_d = null === (_c = this.options.select) || void 0 === _c ? void 0 : _c.makeSelectCellVisible) || void 0 === _d || _d, !0), this.stateManager.updateInteractionState(InteractionState.grabing), this.stateManager.updateSelectPos(endCol, endRow, !1, index >= 1, !1, null === (_f = null === (_e = this.options.select) || void 0 === _e ? void 0 : _e.makeSelectCellVisible) || void 0 === _f || _f, !0)), this.stateManager.endSelectCells(!1, !1), this.stateManager.updateInteractionState(InteractionState.default);
|
|
55950
57581
|
}), this.setScrollTop(scrollTop), this.setScrollLeft(scrollLeft);
|
|
55951
57582
|
}
|
|
57583
|
+
selectRow(rowIndex, isCtrl, isShift) {
|
|
57584
|
+
const currentSelectRanges = this.stateManager.select.ranges;
|
|
57585
|
+
if (isCtrl) currentSelectRanges.push({
|
|
57586
|
+
start: {
|
|
57587
|
+
col: 0,
|
|
57588
|
+
row: rowIndex
|
|
57589
|
+
},
|
|
57590
|
+
end: {
|
|
57591
|
+
col: this.colCount - 1,
|
|
57592
|
+
row: rowIndex
|
|
57593
|
+
}
|
|
57594
|
+
}), this.selectCells(currentSelectRanges);else if (isShift) {
|
|
57595
|
+
const lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
|
|
57596
|
+
lastSelectRange && (lastSelectRange.end.row = rowIndex), this.selectCells(currentSelectRanges);
|
|
57597
|
+
} else this.selectCells([{
|
|
57598
|
+
start: {
|
|
57599
|
+
col: 0,
|
|
57600
|
+
row: rowIndex
|
|
57601
|
+
},
|
|
57602
|
+
end: {
|
|
57603
|
+
col: this.colCount - 1,
|
|
57604
|
+
row: rowIndex
|
|
57605
|
+
}
|
|
57606
|
+
}]);
|
|
57607
|
+
}
|
|
57608
|
+
selectCol(colIndex, isCtrl, isShift) {
|
|
57609
|
+
const currentSelectRanges = this.stateManager.select.ranges;
|
|
57610
|
+
if (isCtrl) currentSelectRanges.push({
|
|
57611
|
+
start: {
|
|
57612
|
+
col: colIndex,
|
|
57613
|
+
row: 0
|
|
57614
|
+
},
|
|
57615
|
+
end: {
|
|
57616
|
+
col: colIndex,
|
|
57617
|
+
row: this.rowCount - 1
|
|
57618
|
+
}
|
|
57619
|
+
}), this.selectCells(currentSelectRanges);else if (isShift) {
|
|
57620
|
+
const lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
|
|
57621
|
+
lastSelectRange && (lastSelectRange.end.col = colIndex), this.selectCells(currentSelectRanges);
|
|
57622
|
+
} else this.selectCells([{
|
|
57623
|
+
start: {
|
|
57624
|
+
col: colIndex,
|
|
57625
|
+
row: 0
|
|
57626
|
+
},
|
|
57627
|
+
end: {
|
|
57628
|
+
col: colIndex,
|
|
57629
|
+
row: this.rowCount - 1
|
|
57630
|
+
}
|
|
57631
|
+
}]);
|
|
57632
|
+
}
|
|
57633
|
+
startDragSelectCol(colIndex, isCtrl, isShift) {
|
|
57634
|
+
var _a, _b, _c, _d, _e, _f;
|
|
57635
|
+
const lastSelectRange = this.stateManager.select.ranges[this.stateManager.select.ranges.length - 1],
|
|
57636
|
+
startCol = isShift && (null === (_a = null == lastSelectRange ? void 0 : lastSelectRange.start) || void 0 === _a ? void 0 : _a.col) ? null === (_b = null == lastSelectRange ? void 0 : lastSelectRange.start) || void 0 === _b ? void 0 : _b.col : colIndex,
|
|
57637
|
+
endCol = colIndex,
|
|
57638
|
+
endRow = this.rowCount - 1;
|
|
57639
|
+
this.stateManager.updateSelectPos(startCol, 0, isShift, isCtrl, !1, null === (_d = null === (_c = this.options.select) || void 0 === _c ? void 0 : _c.makeSelectCellVisible) || void 0 === _d || _d, !0), this.stateManager.updateInteractionState(InteractionState.grabing), this.stateManager.updateSelectPos(endCol, endRow, isShift, isCtrl, !1, null === (_f = null === (_e = this.options.select) || void 0 === _e ? void 0 : _e.makeSelectCellVisible) || void 0 === _f || _f, !0);
|
|
57640
|
+
}
|
|
57641
|
+
dragSelectCol(colIndex, isCtrl) {
|
|
57642
|
+
var _a, _b;
|
|
57643
|
+
const currentSelectRanges = this.stateManager.select.ranges,
|
|
57644
|
+
lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
|
|
57645
|
+
lastSelectRange && (lastSelectRange.end.col = colIndex), this.stateManager.updateSelectPos(colIndex, this.rowCount - 1, !1, isCtrl, !1, null === (_b = null === (_a = this.options.select) || void 0 === _a ? void 0 : _a.makeSelectCellVisible) || void 0 === _b || _b, !0);
|
|
57646
|
+
}
|
|
57647
|
+
endDragSelect() {
|
|
57648
|
+
this.stateManager.updateInteractionState(InteractionState.default), this.stateManager.endSelectCells(!1, !1);
|
|
57649
|
+
}
|
|
57650
|
+
startDragSelectRow(rowIndex, isCtrl, isShift) {
|
|
57651
|
+
var _a, _b, _c, _d, _e, _f;
|
|
57652
|
+
const lastSelectRange = this.stateManager.select.ranges[this.stateManager.select.ranges.length - 1],
|
|
57653
|
+
startRow = isShift && (null === (_a = null == lastSelectRange ? void 0 : lastSelectRange.start) || void 0 === _a ? void 0 : _a.row) ? null === (_b = null == lastSelectRange ? void 0 : lastSelectRange.start) || void 0 === _b ? void 0 : _b.row : rowIndex,
|
|
57654
|
+
endCol = this.colCount - 1,
|
|
57655
|
+
endRow = rowIndex;
|
|
57656
|
+
this.stateManager.updateSelectPos(0, startRow, isShift, isCtrl, !1, null === (_d = null === (_c = this.options.select) || void 0 === _c ? void 0 : _c.makeSelectCellVisible) || void 0 === _d || _d, !0), this.stateManager.updateInteractionState(InteractionState.grabing), this.stateManager.updateSelectPos(endCol, endRow, isShift, isCtrl, !1, null === (_f = null === (_e = this.options.select) || void 0 === _e ? void 0 : _e.makeSelectCellVisible) || void 0 === _f || _f, !0);
|
|
57657
|
+
}
|
|
57658
|
+
dragSelectRow(rowIndex, isCtrl) {
|
|
57659
|
+
var _a, _b;
|
|
57660
|
+
const currentSelectRanges = this.stateManager.select.ranges,
|
|
57661
|
+
lastSelectRange = currentSelectRanges[currentSelectRanges.length - 1];
|
|
57662
|
+
lastSelectRange && (lastSelectRange.end.row = rowIndex), this.stateManager.updateSelectPos(this.colCount - 1, rowIndex, !1, isCtrl, !1, null === (_b = null === (_a = this.options.select) || void 0 === _a ? void 0 : _a.makeSelectCellVisible) || void 0 === _b || _b, !0);
|
|
57663
|
+
}
|
|
55952
57664
|
get recordsCount() {
|
|
55953
57665
|
var _a;
|
|
55954
57666
|
return null === (_a = this.records) || void 0 === _a ? void 0 : _a.length;
|
|
@@ -59392,7 +61104,8 @@
|
|
|
59392
61104
|
this.isValidatingValue = !0;
|
|
59393
61105
|
const newValue = this.editingEditor.getValue(),
|
|
59394
61106
|
oldValue = this.table.getCellOriginValue(this.editCell.col, this.editCell.row),
|
|
59395
|
-
|
|
61107
|
+
target = null == e ? void 0 : e.target,
|
|
61108
|
+
maybePromiseOrValue = null === (_b = (_a = this.editingEditor).validateValue) || void 0 === _b ? void 0 : _b.call(_a, newValue, oldValue, this.editCell, this.table, !!this.table.getElement().contains(target));
|
|
59396
61109
|
return isPromise(maybePromiseOrValue) ? (this.isValidatingValue = !0, new Promise((resolve, reject) => {
|
|
59397
61110
|
maybePromiseOrValue.then(result => {
|
|
59398
61111
|
dealWithValidateValue(result, this, oldValue, resolve);
|
|
@@ -59404,7 +61117,7 @@
|
|
|
59404
61117
|
return this.doExit(), !0;
|
|
59405
61118
|
}
|
|
59406
61119
|
doExit() {
|
|
59407
|
-
var _a, _b, _c, _d, _e, _f;
|
|
61120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
59408
61121
|
const changedValue = null === (_b = (_a = this.editingEditor).getValue) || void 0 === _b ? void 0 : _b.call(_a),
|
|
59409
61122
|
range = this.table.getCellRange(this.editCell.col, this.editCell.row),
|
|
59410
61123
|
changedValues = [];
|
|
@@ -59413,7 +61126,7 @@
|
|
|
59413
61126
|
for (let col = range.start.col; col <= range.end.col; col++) rowChangedValues.push(changedValue);
|
|
59414
61127
|
changedValues.push(rowChangedValues);
|
|
59415
61128
|
}
|
|
59416
|
-
this.table.changeCellValues(range.start.col, range.start.row, changedValues), this.editingEditor.exit, null === (
|
|
61129
|
+
null === (_d = (_c = this.editingEditor).beforeEnd) || void 0 === _d || _d.call(_c), this.table.changeCellValues(range.start.col, range.start.row, changedValues), this.editingEditor.exit, null === (_f = (_e = this.editingEditor).exit) || void 0 === _f || _f.call(_e), null === (_h = (_g = this.editingEditor).onEnd) || void 0 === _h || _h.call(_g), this.editingEditor = null, this.isValidatingValue = !1, this.beginTriggerEditCellMode = null;
|
|
59417
61130
|
}
|
|
59418
61131
|
cancelEdit() {
|
|
59419
61132
|
var _a, _b, _c, _d;
|
|
@@ -59429,18 +61142,23 @@
|
|
|
59429
61142
|
return editManager.isValidatingValue = !1, "validate-exit" === validateValue ? (editManager.doExit(), null == resolve || resolve(!0), !0) : "invalidate-exit" === validateValue ? (editManager.editingEditor.setValue(oldValue), editManager.doExit(), null == resolve || resolve(!0), !0) : "validate-not-exit" === validateValue || "invalidate-not-exit" === validateValue ? (null == resolve || resolve(!1), !1) : !0 === validateValue ? (editManager.doExit(), null == resolve || resolve(!0), !0) : (null == resolve || resolve(!1), !1);
|
|
59430
61143
|
}
|
|
59431
61144
|
|
|
59432
|
-
function getGroupByDataConfig(groupByOption, customDealGroupData) {
|
|
61145
|
+
function getGroupByDataConfig(groupByOption, addRecordRule, customDealGroupData) {
|
|
59433
61146
|
if (isString$6(groupByOption)) return {
|
|
59434
61147
|
groupByRules: [groupByOption],
|
|
61148
|
+
addRecordRule: addRecordRule,
|
|
59435
61149
|
customDealGroupData: customDealGroupData
|
|
59436
61150
|
};
|
|
59437
61151
|
if (isArray$9(groupByOption)) {
|
|
59438
61152
|
return {
|
|
59439
61153
|
groupByRules: groupByOption.map(item => isString$6(item) ? item : item.key),
|
|
61154
|
+
addRecordRule: addRecordRule,
|
|
59440
61155
|
customDealGroupData: customDealGroupData
|
|
59441
61156
|
};
|
|
59442
61157
|
}
|
|
59443
|
-
return {
|
|
61158
|
+
return {
|
|
61159
|
+
addRecordRule: addRecordRule,
|
|
61160
|
+
customDealGroupData: customDealGroupData
|
|
61161
|
+
};
|
|
59444
61162
|
}
|
|
59445
61163
|
|
|
59446
61164
|
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
@@ -60096,7 +61814,10 @@
|
|
|
60096
61814
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
60097
61815
|
super(container, options), this.showHeader = !0, options = this.options;
|
|
60098
61816
|
const internalProps = this.internalProps;
|
|
60099
|
-
if (internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.multipleSort = !!options.multipleSort, internalProps.dataConfig = this.internalProps.groupBy ? getGroupByDataConfig(this.internalProps.groupBy,
|
|
61817
|
+
if (internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.multipleSort = !!options.multipleSort, internalProps.dataConfig = this.internalProps.groupBy ? getGroupByDataConfig(this.internalProps.groupBy, options.addRecordRule, this.internalProps.customDealGroupData) : {
|
|
61818
|
+
addRecordRule: options.addRecordRule,
|
|
61819
|
+
customDealGroupData: this.internalProps.customDealGroupData
|
|
61820
|
+
}, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_d = null !== (_c = options.enableTreeNodeMerge) && void 0 !== _c ? _c : isValid$5(this.internalProps.groupBy)) && void 0 !== _d && _d, this.internalProps.headerHelper.setTableColumnsEditor(), this.showHeader = null === (_e = options.showHeader) || void 0 === _e || _e, this.internalProps.columnWidthConfig = options.columnWidthConfig, this.transpose = null !== (_f = options.transpose) && void 0 !== _f && _f, "node" !== Env.mode && (this.editorManager = new EditManager(this)), this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, options.dataSource ? this.dataSource = options.dataSource : options.records ? this.setRecords(options.records, {
|
|
60100
61821
|
sortState: internalProps.sortState
|
|
60101
61822
|
}) : this.setRecords([]), options.title) {
|
|
60102
61823
|
const Title = Factory.getComponent("title");
|
|
@@ -60151,9 +61872,21 @@
|
|
|
60151
61872
|
};
|
|
60152
61873
|
this._hasAutoImageColumn = void 0, this.refreshHeader(), this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns) && this.dataSource.processRecords(null !== (_b = null === (_a = this.dataSource.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this._updateSize(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
|
|
60153
61874
|
}
|
|
60154
|
-
addColumn(column) {
|
|
61875
|
+
addColumn(column, colIndex, isMaintainArrayData = !0) {
|
|
61876
|
+
const columns = this.options.columns;
|
|
61877
|
+
if (void 0 === colIndex) columns.push(column);else {
|
|
61878
|
+
if (isMaintainArrayData) for (let i = 0; i < columns.length; i++) "number" == typeof columns[i].field && columns[i].field >= colIndex && (columns[i].field = columns[i].field + 1);
|
|
61879
|
+
columns.splice(colIndex, 0, column);
|
|
61880
|
+
}
|
|
61881
|
+
if (isMaintainArrayData) for (let i = 0; i < this.records.length; i++) {
|
|
61882
|
+
const record = this.records[i];
|
|
61883
|
+
Array.isArray(record) && record.splice(colIndex, 0, void 0);
|
|
61884
|
+
}
|
|
61885
|
+
this.updateColumns(columns);
|
|
61886
|
+
}
|
|
61887
|
+
deleteColumn(colIndex) {
|
|
60155
61888
|
const columns = this.options.columns;
|
|
60156
|
-
columns.
|
|
61889
|
+
columns.splice(colIndex, 1), this.updateColumns(columns);
|
|
60157
61890
|
}
|
|
60158
61891
|
get columns() {
|
|
60159
61892
|
return this.internalProps.layoutMap.columnTree.getCopiedTree();
|
|
@@ -60194,7 +61927,7 @@
|
|
|
60194
61927
|
} else {
|
|
60195
61928
|
const define = table.getBodyColumnDefine(col, row),
|
|
60196
61929
|
checkboxSeriesNumberStyle = table.getFieldData(define.field, col, row);
|
|
60197
|
-
value = "string"
|
|
61930
|
+
value = ["number", "string"].includes(typeof checkboxSeriesNumberStyle) ? checkboxSeriesNumberStyle : (null == checkboxSeriesNumberStyle ? void 0 : checkboxSeriesNumberStyle.text) ? null !== (_a = checkboxSeriesNumberStyle.text) && void 0 !== _a ? _a : "" : row - this.columnHeaderLevelCount + 1;
|
|
60198
61931
|
}
|
|
60199
61932
|
const {
|
|
60200
61933
|
format: format
|
|
@@ -60324,10 +62057,15 @@
|
|
|
60324
62057
|
}
|
|
60325
62058
|
return ifCan;
|
|
60326
62059
|
}
|
|
60327
|
-
updateOption(options
|
|
62060
|
+
updateOption(options, updateConfig = {
|
|
62061
|
+
clearColWidthCache: !0,
|
|
62062
|
+
clearRowHeightCache: !0
|
|
62063
|
+
}) {
|
|
60328
62064
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
60329
62065
|
const internalProps = this.internalProps;
|
|
60330
|
-
if (super.updateOption(options), internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.dataConfig = this.internalProps.groupBy ? getGroupByDataConfig(this.internalProps.groupBy,
|
|
62066
|
+
if (super.updateOption(options, updateConfig), internalProps.frozenColDragHeaderMode = null !== (_b = null === (_a = options.dragOrder) || void 0 === _a ? void 0 : _a.frozenColDragHeaderMode) && void 0 !== _b ? _b : options.frozenColDragHeaderMode, this.pagination = options.pagination, internalProps.sortState = options.sortState, internalProps.dataConfig = this.internalProps.groupBy ? getGroupByDataConfig(this.internalProps.groupBy, options.addRecordRule, this.internalProps.customDealGroupData) : {
|
|
62067
|
+
addRecordRule: options.addRecordRule
|
|
62068
|
+
}, this.showHeader = null === (_c = options.showHeader) || void 0 === _c || _c, internalProps.columns = options.columns ? cloneDeepSpec(options.columns, ["children"]) : options.header ? cloneDeepSpec(options.header, ["children"]) : [], generateAggregationForColumn(this), internalProps.enableTreeNodeMerge = null !== (_e = null !== (_d = options.enableTreeNodeMerge) && void 0 !== _d ? _d : isValid$5(this.internalProps.groupBy)) && void 0 !== _e && _e, this.internalProps.headerHelper.setTableColumnsEditor(), this.transpose = null !== (_f = options.transpose) && void 0 !== _f && _f, this.refreshHeader(), this.internalProps.useOneRowHeightFillAll = !1, this.internalProps.columnWidthConfig = options.columnWidthConfig, internalProps.releaseList) for (let i = internalProps.releaseList.length - 1; i >= 0; i--) {
|
|
60331
62069
|
const releaseObj = internalProps.releaseList[i];
|
|
60332
62070
|
releaseObj instanceof DataSource ? releaseObj.updateColumns(this.internalProps.columns) : (null === (_g = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _g || _g.call(releaseObj), internalProps.releaseList.splice(i, 1));
|
|
60333
62071
|
}
|
|
@@ -60341,7 +62079,9 @@
|
|
|
60341
62079
|
const EmptyTip = Factory.getComponent("emptyTip");
|
|
60342
62080
|
this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_j = this.internalProps.emptyTip) || void 0 === _j || _j.resetVisible();
|
|
60343
62081
|
}
|
|
60344
|
-
return this.pluginManager.updatePlugins(options.plugins),
|
|
62082
|
+
return this.pluginManager.updatePlugins(options.plugins), setTimeout(() => {
|
|
62083
|
+
this.fireListeners(TABLE_EVENT_TYPE.UPDATED, null);
|
|
62084
|
+
}, 0), new Promise(resolve => {
|
|
60345
62085
|
setTimeout(resolve, 0);
|
|
60346
62086
|
});
|
|
60347
62087
|
}
|
|
@@ -60363,7 +62103,7 @@
|
|
|
60363
62103
|
} = table.internalProps;
|
|
60364
62104
|
if (!layoutMap) return;
|
|
60365
62105
|
const dataCount = null !== (_b = null === (_a = table.internalProps.dataSource) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
|
|
60366
|
-
layoutMap.recordsCount = dataCount + (dataCount > 0 || this.options.showAggregationWhenEmpty ? layoutMap.hasAggregationOnTopCount + layoutMap.hasAggregationOnBottomCount : 0), table.transpose ? (table.rowCount = null !== (_c = layoutMap.rowCount) && void 0 !== _c ? _c : 0, table.colCount = null !== (_d = layoutMap.colCount) && void 0 !== _d ? _d : 0, this.internalProps.frozenColCount = Math.max((null !== (_e = layoutMap.headerLevelCount) && void 0 !== _e ? _e : 0) + layoutMap.leftRowSeriesNumberColumnCount, null !== (_f = this.options.frozenColCount) && void 0 !== _f ? _f : 0), this.internalProps.frozenRowCount = null !== (_g = this.options.frozenRowCount) && void 0 !== _g ? _g : 0, table.bottomFrozenRowCount !== (null !== (_h = this.options.bottomFrozenRowCount) && void 0 !== _h ? _h : 0) && (table.bottomFrozenRowCount = null !== (_j = this.options.bottomFrozenRowCount) && void 0 !== _j ? _j : 0), table.rightFrozenColCount !== (null !== (_k = this.options.rightFrozenColCount) && void 0 !== _k ? _k : 0) && (table.rightFrozenColCount = null !== (_l = this.options.rightFrozenColCount) && void 0 !== _l ? _l : 0)) : (table.colCount = null !== (_m = layoutMap.colCount) && void 0 !== _m ? _m : 0, table.rowCount = layoutMap.recordsCount * layoutMap.bodyRowSpanCount + layoutMap.headerLevelCount, this.internalProps.frozenColCount = null !== (_o = this.options.frozenColCount) && void 0 !== _o ? _o : 0, this.options.frozenColCount >= this.colCount && (this.internalProps.frozenColCount = 0), table.
|
|
62106
|
+
layoutMap.recordsCount = dataCount + (dataCount > 0 || this.options.showAggregationWhenEmpty ? layoutMap.hasAggregationOnTopCount + layoutMap.hasAggregationOnBottomCount : 0), table.transpose ? (table.rowCount = null !== (_c = layoutMap.rowCount) && void 0 !== _c ? _c : 0, table.colCount = null !== (_d = layoutMap.colCount) && void 0 !== _d ? _d : 0, this.internalProps.frozenColCount = Math.max((null !== (_e = layoutMap.headerLevelCount) && void 0 !== _e ? _e : 0) + layoutMap.leftRowSeriesNumberColumnCount, null !== (_f = this.options.frozenColCount) && void 0 !== _f ? _f : 0), this.internalProps.frozenRowCount = null !== (_g = this.options.frozenRowCount) && void 0 !== _g ? _g : 0, table.bottomFrozenRowCount !== (null !== (_h = this.options.bottomFrozenRowCount) && void 0 !== _h ? _h : 0) && (table.bottomFrozenRowCount = null !== (_j = this.options.bottomFrozenRowCount) && void 0 !== _j ? _j : 0), table.rightFrozenColCount !== (null !== (_k = this.options.rightFrozenColCount) && void 0 !== _k ? _k : 0) && (table.rightFrozenColCount = null !== (_l = this.options.rightFrozenColCount) && void 0 !== _l ? _l : 0)) : (table.colCount = null !== (_m = layoutMap.colCount) && void 0 !== _m ? _m : 0, table.rowCount = layoutMap.recordsCount * layoutMap.bodyRowSpanCount + layoutMap.headerLevelCount, this.internalProps.frozenColCount = null !== (_o = this.options.frozenColCount) && void 0 !== _o ? _o : 0, this.options.frozenColCount >= this.colCount && (this.internalProps.frozenColCount = 0), table._setFrozenRowCount(Math.max(layoutMap.headerLevelCount, null !== (_p = this.options.frozenRowCount) && void 0 !== _p ? _p : 0)), table.bottomFrozenRowCount !== (null !== (_q = this.options.bottomFrozenRowCount) && void 0 !== _q ? _q : 0) && (table.bottomFrozenRowCount = null !== (_r = this.options.bottomFrozenRowCount) && void 0 !== _r ? _r : 0), table.rightFrozenColCount !== (null !== (_s = this.options.rightFrozenColCount) && void 0 !== _s ? _s : 0) && (table.rightFrozenColCount = null !== (_t = this.options.rightFrozenColCount) && void 0 !== _t ? _t : 0)), this.stateManager.setFrozenCol(this.internalProps.frozenColCount);
|
|
60367
62107
|
}
|
|
60368
62108
|
getFieldData(field, col, row) {
|
|
60369
62109
|
if (null === field) return null;
|
|
@@ -60775,6 +62515,38 @@
|
|
|
60775
62515
|
}
|
|
60776
62516
|
}));
|
|
60777
62517
|
}
|
|
62518
|
+
mergeCells(startCol, startRow, endCol, endRow) {
|
|
62519
|
+
for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) {
|
|
62520
|
+
const cellRange = this.getCellRange(i, j);
|
|
62521
|
+
if (cellRange.start.col !== cellRange.end.col || cellRange.start.row !== cellRange.end.row) return;
|
|
62522
|
+
}
|
|
62523
|
+
this.options.customMergeCell ? "function" == typeof this.options.customMergeCell && (this.options.customMergeCell = []) : this.options.customMergeCell = [], this.options.customMergeCell.push({
|
|
62524
|
+
text: this.getCellValue(startCol, startRow),
|
|
62525
|
+
range: {
|
|
62526
|
+
start: {
|
|
62527
|
+
col: startCol,
|
|
62528
|
+
row: startRow
|
|
62529
|
+
},
|
|
62530
|
+
end: {
|
|
62531
|
+
col: endCol,
|
|
62532
|
+
row: endRow
|
|
62533
|
+
}
|
|
62534
|
+
}
|
|
62535
|
+
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
62536
|
+
for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
|
|
62537
|
+
this.scenegraph.updateNextFrame();
|
|
62538
|
+
}
|
|
62539
|
+
unmergeCells(startCol, startRow, endCol, endRow) {
|
|
62540
|
+
this.options.customMergeCell ? "function" == typeof this.options.customMergeCell && (this.options.customMergeCell = []) : this.options.customMergeCell = [], this.options.customMergeCell = this.options.customMergeCell.filter(item => {
|
|
62541
|
+
const {
|
|
62542
|
+
start: start,
|
|
62543
|
+
end: end
|
|
62544
|
+
} = item.range;
|
|
62545
|
+
return !(start.col === startCol && start.row === startRow && end.col === endCol && end.row === endRow);
|
|
62546
|
+
}), this.internalProps.customMergeCell = getCustomMergeCellFunc(this.options.customMergeCell);
|
|
62547
|
+
for (let i = startCol; i <= endCol; i++) for (let j = startRow; j <= endRow; j++) this.scenegraph.updateCellContent(i, j);
|
|
62548
|
+
this.scenegraph.updateNextFrame();
|
|
62549
|
+
}
|
|
60778
62550
|
};
|
|
60779
62551
|
|
|
60780
62552
|
function isXAxis(orient) {
|
|
@@ -68465,10 +70237,13 @@
|
|
|
68465
70237
|
}
|
|
68466
70238
|
return ifCan;
|
|
68467
70239
|
}
|
|
68468
|
-
updateOption(options
|
|
70240
|
+
updateOption(options, updateConfig = {
|
|
70241
|
+
clearColWidthCache: !0,
|
|
70242
|
+
clearRowHeightCache: !0
|
|
70243
|
+
}) {
|
|
68469
70244
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
68470
70245
|
const internalProps = this.internalProps;
|
|
68471
|
-
if (super.updateOption(options), options.rowHierarchyType || (options.rowHierarchyType = "grid"), options.columnHierarchyType || (options.columnHierarchyType = "grid"), this.layoutNodeId = {
|
|
70246
|
+
if (super.updateOption(options, updateConfig), options.rowHierarchyType || (options.rowHierarchyType = "grid"), options.columnHierarchyType || (options.columnHierarchyType = "grid"), this.layoutNodeId = {
|
|
68472
70247
|
seqId: 0
|
|
68473
70248
|
}, this.internalProps.columns = cloneDeep$1(options.columns), this.internalProps.rows = cloneDeep$1(options.rows), this.internalProps.indicators = (null === (_a = options.indicators) || void 0 === _a ? void 0 : _a.length) ? cloneDeepSpec(options.indicators) : [], null === (_b = options.indicators) || void 0 === _b || _b.forEach((indicatorDefine, index) => {
|
|
68474
70249
|
"object" == typeof indicatorDefine && (null == indicatorDefine ? void 0 : indicatorDefine.editor) && (this.internalProps.indicators[index].editor = indicatorDefine.editor);
|
|
@@ -68513,7 +70288,9 @@
|
|
|
68513
70288
|
const EmptyTip = Factory.getComponent("emptyTip");
|
|
68514
70289
|
this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_1 = this.internalProps.emptyTip) || void 0 === _1 || _1.resetVisible();
|
|
68515
70290
|
}
|
|
68516
|
-
return
|
|
70291
|
+
return setTimeout(() => {
|
|
70292
|
+
this.fireListeners(TABLE_EVENT_TYPE.UPDATED, null);
|
|
70293
|
+
}, 0), new Promise(resolve => {
|
|
68517
70294
|
setTimeout(resolve, 0);
|
|
68518
70295
|
});
|
|
68519
70296
|
}
|
|
@@ -68532,7 +70309,7 @@
|
|
|
68532
70309
|
{
|
|
68533
70310
|
layoutMap: layoutMap
|
|
68534
70311
|
} = table.internalProps;
|
|
68535
|
-
layoutMap && (table.colCount = null !== (_a = layoutMap.colCount) && void 0 !== _a ? _a : 0, table.rowCount = null !== (_b = layoutMap.rowCount) && void 0 !== _b ? _b : 0, this.internalProps.frozenColCount = this.options.frozenColCount ? this.options.frozenColCount : (null !== (_c = layoutMap.rowHeaderLevelCount) && void 0 !== _c ? _c : 0) + layoutMap.leftRowSeriesNumberColumnCount, table.
|
|
70312
|
+
layoutMap && (table.colCount = null !== (_a = layoutMap.colCount) && void 0 !== _a ? _a : 0, table.rowCount = null !== (_b = layoutMap.rowCount) && void 0 !== _b ? _b : 0, this.internalProps.frozenColCount = this.options.frozenColCount ? this.options.frozenColCount : (null !== (_c = layoutMap.rowHeaderLevelCount) && void 0 !== _c ? _c : 0) + layoutMap.leftRowSeriesNumberColumnCount, table._setFrozenRowCount(Math.max(layoutMap.headerLevelCount, null !== (_d = this.options.frozenRowCount) && void 0 !== _d ? _d : 0)), table.bottomFrozenRowCount !== (null !== (_e = this.options.bottomFrozenRowCount) && void 0 !== _e ? _e : 0) && (table.bottomFrozenRowCount = null !== (_f = this.options.bottomFrozenRowCount) && void 0 !== _f ? _f : 0), table.rightFrozenColCount !== (null !== (_g = this.options.rightFrozenColCount) && void 0 !== _g ? _g : 0) && (table.rightFrozenColCount = null !== (_h = this.options.rightFrozenColCount) && void 0 !== _h ? _h : 0), this.stateManager.setFrozenCol(this.internalProps.frozenColCount), this.stateManager.setFrozenRow(this.frozenRowCount));
|
|
68536
70313
|
}
|
|
68537
70314
|
_getSortFuncFromHeaderOption(columns, field, fieldKey) {}
|
|
68538
70315
|
get rowHierarchyType() {
|
|
@@ -69441,11 +71218,14 @@
|
|
|
69441
71218
|
}
|
|
69442
71219
|
return ifCan;
|
|
69443
71220
|
}
|
|
69444
|
-
updateOption(options
|
|
71221
|
+
updateOption(options, updateConfig = {
|
|
71222
|
+
clearColWidthCache: !0,
|
|
71223
|
+
clearRowHeightCache: !0
|
|
71224
|
+
}) {
|
|
69445
71225
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
69446
71226
|
const internalProps = this.internalProps;
|
|
69447
71227
|
let columnDimensionTree, rowDimensionTree;
|
|
69448
|
-
super.updateOption(options), this.layoutNodeId = {
|
|
71228
|
+
super.updateOption(options, updateConfig), this.layoutNodeId = {
|
|
69449
71229
|
seqId: 0
|
|
69450
71230
|
}, this.internalProps.columns = cloneDeep$1(options.columns), this.internalProps.rows = cloneDeep$1(options.rows), this.internalProps.indicators = (null === (_a = options.indicators) || void 0 === _a ? void 0 : _a.length) ? cloneDeepSpec(options.indicators) : [], this.internalProps.columnTree = !options.indicatorsAsCol || (null === (_b = options.columns) || void 0 === _b ? void 0 : _b.length) || options.columnTree ? cloneDeep$1(options.columnTree) : [], this.internalProps.rowTree = options.indicatorsAsCol || (null === (_c = options.rows) || void 0 === _c ? void 0 : _c.length) || options.rowTree ? cloneDeep$1(options.rowTree) : [], options.records && (this.internalProps.records = options.records), this.setCustomStateNameToSpec(), this._selectedDataItemsInChart = [], internalProps.columnResizeType = null !== (_f = null !== (_e = null === (_d = options.resize) || void 0 === _d ? void 0 : _d.columnResizeType) && void 0 !== _e ? _e : options.columnResizeType) && void 0 !== _f ? _f : "column", internalProps.rowResizeType = null !== (_j = null !== (_h = null === (_g = options.resize) || void 0 === _g ? void 0 : _g.rowResizeType) && void 0 !== _h ? _h : options.rowResizeType) && void 0 !== _j ? _j : "row", internalProps.dataConfig = {
|
|
69451
71231
|
isPivotChart: !0
|
|
@@ -69479,7 +71259,9 @@
|
|
|
69479
71259
|
const EmptyTip = Factory.getComponent("emptyTip");
|
|
69480
71260
|
this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_1 = this.internalProps.emptyTip) || void 0 === _1 || _1.resetVisible();
|
|
69481
71261
|
}
|
|
69482
|
-
return
|
|
71262
|
+
return setTimeout(() => {
|
|
71263
|
+
this.fireListeners(TABLE_EVENT_TYPE.UPDATED, null);
|
|
71264
|
+
}, 0), new Promise(resolve => {
|
|
69483
71265
|
setTimeout(resolve, 0);
|
|
69484
71266
|
});
|
|
69485
71267
|
}
|
|
@@ -69493,7 +71275,7 @@
|
|
|
69493
71275
|
{
|
|
69494
71276
|
layoutMap: layoutMap
|
|
69495
71277
|
} = table.internalProps;
|
|
69496
|
-
layoutMap && (table.colCount = null !== (_a = layoutMap.colCount) && void 0 !== _a ? _a : 0, table.rowCount = null !== (_b = layoutMap.rowCount) && void 0 !== _b ? _b : 0, table.internalProps.frozenColCount = null !== (_c = layoutMap.rowHeaderLevelCount) && void 0 !== _c ? _c : 0, table.
|
|
71278
|
+
layoutMap && (table.colCount = null !== (_a = layoutMap.colCount) && void 0 !== _a ? _a : 0, table.rowCount = null !== (_b = layoutMap.rowCount) && void 0 !== _b ? _b : 0, table.internalProps.frozenColCount = null !== (_c = layoutMap.rowHeaderLevelCount) && void 0 !== _c ? _c : 0, table._setFrozenRowCount(Math.max(layoutMap.headerLevelCount, null !== (_d = this.options.frozenRowCount) && void 0 !== _d ? _d : 0)), table.bottomFrozenRowCount !== (null !== (_e = null == layoutMap ? void 0 : layoutMap.bottomFrozenRowCount) && void 0 !== _e ? _e : 0) && (table.bottomFrozenRowCount = null !== (_f = null == layoutMap ? void 0 : layoutMap.bottomFrozenRowCount) && void 0 !== _f ? _f : 0), table.rightFrozenColCount !== (null !== (_g = null == layoutMap ? void 0 : layoutMap.rightFrozenColCount) && void 0 !== _g ? _g : 0) && (table.rightFrozenColCount = null !== (_h = null == layoutMap ? void 0 : layoutMap.rightFrozenColCount) && void 0 !== _h ? _h : 0), this.stateManager.setFrozenCol(this.internalProps.frozenColCount));
|
|
69497
71279
|
}
|
|
69498
71280
|
_getSortFuncFromHeaderOption(columns, field, fieldKey) {}
|
|
69499
71281
|
syncHierarchyState(sourceNode, targetNode) {
|
|
@@ -78072,7 +79854,7 @@
|
|
|
78072
79854
|
const Checkbox = React.forwardRef(CheckboxComponent);
|
|
78073
79855
|
Checkbox.displayName = 'Checkbox';
|
|
78074
79856
|
|
|
78075
|
-
const version = "1.0.
|
|
79857
|
+
const version = "1.0.18";
|
|
78076
79858
|
|
|
78077
79859
|
exports.Arc = Arc;
|
|
78078
79860
|
exports.Avatar = Avatar;
|