@visactor/vtable-plugins 1.19.9-alpha.3 → 1.19.10-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vtable-plugins.js +225 -76
- package/dist/vtable-plugins.min.js +9 -9
- package/package.json +11 -8
package/dist/vtable-plugins.js
CHANGED
|
@@ -742,7 +742,15 @@
|
|
|
742
742
|
const EnvContribution = Symbol.for("EnvContribution");
|
|
743
743
|
const VGlobal = Symbol.for("VGlobal");
|
|
744
744
|
|
|
745
|
-
|
|
745
|
+
const container = new Container();
|
|
746
|
+
|
|
747
|
+
const RenderService = Symbol.for("RenderService");
|
|
748
|
+
|
|
749
|
+
class Application {
|
|
750
|
+
get renderService() {
|
|
751
|
+
return this._renderService || (this._renderService = container.get(RenderService)), this._renderService;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
746
754
|
const application = new Application();
|
|
747
755
|
|
|
748
756
|
let idx = 0;
|
|
@@ -4084,7 +4092,8 @@
|
|
|
4084
4092
|
y1: 0,
|
|
4085
4093
|
strokeBoundsBuffer: 0,
|
|
4086
4094
|
cornerRadius: 0,
|
|
4087
|
-
cornerType: "round"
|
|
4095
|
+
cornerType: "round",
|
|
4096
|
+
drawStrokeWhenZeroWH: !1
|
|
4088
4097
|
});
|
|
4089
4098
|
Object.assign(Object.assign({}, DefaultAttribute), {
|
|
4090
4099
|
width: 0,
|
|
@@ -4093,7 +4102,8 @@
|
|
|
4093
4102
|
y1: 0,
|
|
4094
4103
|
cornerRadius: 0,
|
|
4095
4104
|
length: 0,
|
|
4096
|
-
cornerType: "round"
|
|
4105
|
+
cornerType: "round",
|
|
4106
|
+
drawStrokeWhenZeroWH: !1
|
|
4097
4107
|
});
|
|
4098
4108
|
const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
4099
4109
|
symbolType: "circle",
|
|
@@ -4320,6 +4330,34 @@
|
|
|
4320
4330
|
}
|
|
4321
4331
|
return c;
|
|
4322
4332
|
}
|
|
4333
|
+
static processColorStops(colorStops) {
|
|
4334
|
+
if (!colorStops || 0 === colorStops.length) return [];
|
|
4335
|
+
if (colorStops.some(item => item.length)) {
|
|
4336
|
+
const stops = colorStops.map(item => ({
|
|
4337
|
+
color: item.value,
|
|
4338
|
+
offset: item.length ? parseFloat(item.length.value) / 100 : -1
|
|
4339
|
+
}));
|
|
4340
|
+
stops[0].offset < 0 && (stops[0].offset = 0), stops[stops.length - 1].offset < 0 && (stops[stops.length - 1].offset = 1);
|
|
4341
|
+
for (let i = 1; i < stops.length - 1; i++) if (stops[i].offset < 0) {
|
|
4342
|
+
const prevWithOffsetIdx = i - 1;
|
|
4343
|
+
let nextWithOffsetIdx = i + 1;
|
|
4344
|
+
for (; nextWithOffsetIdx < stops.length && stops[nextWithOffsetIdx].offset < 0;) nextWithOffsetIdx++;
|
|
4345
|
+
const startOffset = stops[prevWithOffsetIdx].offset,
|
|
4346
|
+
endOffset = stops[nextWithOffsetIdx].offset,
|
|
4347
|
+
unspecCount = nextWithOffsetIdx - prevWithOffsetIdx;
|
|
4348
|
+
for (let j = 1; j < unspecCount; j++) stops[prevWithOffsetIdx + j].offset = startOffset + (endOffset - startOffset) * j / unspecCount;
|
|
4349
|
+
i = nextWithOffsetIdx - 1;
|
|
4350
|
+
}
|
|
4351
|
+
return stops;
|
|
4352
|
+
}
|
|
4353
|
+
return colorStops.map((item, index) => {
|
|
4354
|
+
const offset = colorStops.length > 1 ? index / (colorStops.length - 1) : 0;
|
|
4355
|
+
return {
|
|
4356
|
+
color: item.value,
|
|
4357
|
+
offset: offset
|
|
4358
|
+
};
|
|
4359
|
+
});
|
|
4360
|
+
}
|
|
4323
4361
|
static ParseConic(datum) {
|
|
4324
4362
|
const {
|
|
4325
4363
|
orientation: orientation,
|
|
@@ -4333,10 +4371,7 @@
|
|
|
4333
4371
|
y: .5,
|
|
4334
4372
|
startAngle: sa,
|
|
4335
4373
|
endAngle: sa + pi2,
|
|
4336
|
-
stops:
|
|
4337
|
-
color: item.value,
|
|
4338
|
-
offset: parseFloat(item.length.value) / 100
|
|
4339
|
-
}))
|
|
4374
|
+
stops: GradientParser.processColorStops(colorStops)
|
|
4340
4375
|
};
|
|
4341
4376
|
}
|
|
4342
4377
|
static ParseRadial(datum) {
|
|
@@ -4351,10 +4386,7 @@
|
|
|
4351
4386
|
y1: .5,
|
|
4352
4387
|
r0: 0,
|
|
4353
4388
|
r1: 1,
|
|
4354
|
-
stops:
|
|
4355
|
-
color: item.value,
|
|
4356
|
-
offset: parseFloat(item.length.value) / 100
|
|
4357
|
-
}))
|
|
4389
|
+
stops: GradientParser.processColorStops(colorStops)
|
|
4358
4390
|
};
|
|
4359
4391
|
}
|
|
4360
4392
|
static ParseLinear(datum) {
|
|
@@ -4376,10 +4408,7 @@
|
|
|
4376
4408
|
y0: y0,
|
|
4377
4409
|
x1: x1,
|
|
4378
4410
|
y1: y1,
|
|
4379
|
-
stops:
|
|
4380
|
-
color: item.value,
|
|
4381
|
-
offset: parseFloat(item.length.value) / 100
|
|
4382
|
-
}))
|
|
4411
|
+
stops: GradientParser.processColorStops(colorStops)
|
|
4383
4412
|
};
|
|
4384
4413
|
}
|
|
4385
4414
|
}
|
|
@@ -4463,6 +4492,9 @@
|
|
|
4463
4492
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4464
4493
|
};
|
|
4465
4494
|
let ATextMeasure = class {
|
|
4495
|
+
constructor() {
|
|
4496
|
+
this.id = "ATextMeasure";
|
|
4497
|
+
}
|
|
4466
4498
|
configure(service, env) {
|
|
4467
4499
|
this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
|
|
4468
4500
|
}
|
|
@@ -4855,11 +4887,13 @@
|
|
|
4855
4887
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4856
4888
|
};
|
|
4857
4889
|
const TextMeasureContribution = Symbol.for("TextMeasureContribution");
|
|
4858
|
-
let DefaultTextMeasureContribution = class extends ATextMeasure {
|
|
4890
|
+
let DefaultTextMeasureContribution = class extends ATextMeasure {
|
|
4891
|
+
constructor() {
|
|
4892
|
+
super(...arguments), this.id = "DefaultTextMeasureContribution";
|
|
4893
|
+
}
|
|
4894
|
+
};
|
|
4859
4895
|
DefaultTextMeasureContribution = __decorate$t([injectable()], DefaultTextMeasureContribution);
|
|
4860
4896
|
|
|
4861
|
-
const container = new Container();
|
|
4862
|
-
|
|
4863
4897
|
const CanvasFactory = Symbol.for("CanvasFactory");
|
|
4864
4898
|
|
|
4865
4899
|
function wrapCanvas(params) {
|
|
@@ -5438,13 +5472,17 @@
|
|
|
5438
5472
|
return this.tryInitCanvas(), this._context;
|
|
5439
5473
|
}
|
|
5440
5474
|
constructor(contributions) {
|
|
5441
|
-
this.contributions = contributions, this.configured = !1, this.global = application.global, this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
|
|
5475
|
+
this.contributions = contributions, this.configured = !1, this.global = application.global, this._textMeasureMap = new Map(), this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
|
|
5442
5476
|
this.configured = !1, this.configure(global, env);
|
|
5443
5477
|
});
|
|
5444
5478
|
}
|
|
5445
5479
|
get textMeasure() {
|
|
5446
5480
|
return this._textMeasure || this.configure(this.global, this.global.env), this._textMeasure;
|
|
5447
5481
|
}
|
|
5482
|
+
getTextMeasureInstance(textMeasureId) {
|
|
5483
|
+
if (!textMeasureId) return this.textMeasure;
|
|
5484
|
+
return this._textMeasureMap.get(textMeasureId) || this.textMeasure;
|
|
5485
|
+
}
|
|
5448
5486
|
configure(global, env) {
|
|
5449
5487
|
this.configured || (this.contributions.getContributions().forEach(contribution => {
|
|
5450
5488
|
contribution.configure(this, env);
|
|
@@ -5457,7 +5495,7 @@
|
|
|
5457
5495
|
}
|
|
5458
5496
|
}
|
|
5459
5497
|
bindTextMeasure(tm) {
|
|
5460
|
-
this._textMeasure = tm;
|
|
5498
|
+
this._textMeasure && "DefaultTextMeasureContribution" !== tm.id || (this._textMeasure = tm), this._textMeasureMap.has(tm.id) || this._textMeasureMap.set(tm.id, tm);
|
|
5461
5499
|
}
|
|
5462
5500
|
measureText(text, tc, method = "native") {
|
|
5463
5501
|
var _a;
|
|
@@ -8241,7 +8279,7 @@
|
|
|
8241
8279
|
});
|
|
8242
8280
|
}
|
|
8243
8281
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
8244
|
-
(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);
|
|
8282
|
+
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));
|
|
8245
8283
|
}
|
|
8246
8284
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
8247
8285
|
const keys = Object.keys(params);
|
|
@@ -9066,8 +9104,8 @@
|
|
|
9066
9104
|
function strokeVisible(opacity, strokeOpacity) {
|
|
9067
9105
|
return opacity * strokeOpacity > 0;
|
|
9068
9106
|
}
|
|
9069
|
-
function rectStrokeVisible(opacity, strokeOpacity, width, height) {
|
|
9070
|
-
return opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
|
|
9107
|
+
function rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH) {
|
|
9108
|
+
return drawStrokeWhenZeroWH ? opacity * strokeOpacity > 0 : opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
|
|
9071
9109
|
}
|
|
9072
9110
|
|
|
9073
9111
|
const AreaRenderContribution = Symbol.for("AreaRenderContribution");
|
|
@@ -9488,7 +9526,7 @@
|
|
|
9488
9526
|
this.cache.layoutData.lines.forEach(item => {
|
|
9489
9527
|
mergedText += item.str;
|
|
9490
9528
|
});
|
|
9491
|
-
return (Array.isArray(text) ? text.join("") : text) !== mergedText;
|
|
9529
|
+
return (Array.isArray(text) ? text.join("") : text).toString() !== mergedText;
|
|
9492
9530
|
}
|
|
9493
9531
|
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();
|
|
9494
9532
|
}
|
|
@@ -9587,7 +9625,7 @@
|
|
|
9587
9625
|
return fontSize ? .1 * fontSize : 0;
|
|
9588
9626
|
}
|
|
9589
9627
|
updateHorizontalMultilineAABBBounds(text) {
|
|
9590
|
-
var _a;
|
|
9628
|
+
var _a, _b;
|
|
9591
9629
|
const textTheme = this.getGraphicTheme(),
|
|
9592
9630
|
attribute = this.attribute,
|
|
9593
9631
|
{
|
|
@@ -9614,7 +9652,7 @@
|
|
|
9614
9652
|
const bbox = this.cache.layoutData.bbox;
|
|
9615
9653
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
9616
9654
|
}
|
|
9617
|
-
const textMeasure = application.graphicUtil.
|
|
9655
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
|
|
9618
9656
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
9619
9657
|
fontSize: fontSize,
|
|
9620
9658
|
fontWeight: fontWeight,
|
|
@@ -9632,7 +9670,7 @@
|
|
|
9632
9670
|
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;
|
|
9633
9671
|
}
|
|
9634
9672
|
updateWrapAABBBounds(text) {
|
|
9635
|
-
var _a, _b, _c;
|
|
9673
|
+
var _a, _b, _c, _d;
|
|
9636
9674
|
const textTheme = this.getGraphicTheme(),
|
|
9637
9675
|
{
|
|
9638
9676
|
fontFamily = textTheme.fontFamily,
|
|
@@ -9658,7 +9696,7 @@
|
|
|
9658
9696
|
const bbox = this.cache.layoutData.bbox;
|
|
9659
9697
|
return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
9660
9698
|
}
|
|
9661
|
-
const textMeasure = application.graphicUtil.
|
|
9699
|
+
const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
|
|
9662
9700
|
textOptions = {
|
|
9663
9701
|
fontSize: fontSize,
|
|
9664
9702
|
fontWeight: fontWeight,
|
|
@@ -9690,7 +9728,7 @@
|
|
|
9690
9728
|
if ("" !== str && "" === clip.str || clip.wordBreaked) {
|
|
9691
9729
|
if (ellipsis) {
|
|
9692
9730
|
const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
9693
|
-
clip.str = null !== (
|
|
9731
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
9694
9732
|
} else clip.str = "", clip.width = 0;
|
|
9695
9733
|
needCut = !1;
|
|
9696
9734
|
}
|
|
@@ -9753,9 +9791,9 @@
|
|
|
9753
9791
|
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;
|
|
9754
9792
|
}
|
|
9755
9793
|
updateVerticalMultilineAABBBounds(text) {
|
|
9756
|
-
var _a, _b;
|
|
9794
|
+
var _a, _b, _c;
|
|
9757
9795
|
const textTheme = this.getGraphicTheme(),
|
|
9758
|
-
textMeasure = application.graphicUtil.
|
|
9796
|
+
textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.textMeasureId));
|
|
9759
9797
|
let width;
|
|
9760
9798
|
const attribute = this.attribute,
|
|
9761
9799
|
{
|
|
@@ -9776,7 +9814,7 @@
|
|
|
9776
9814
|
} = attribute;
|
|
9777
9815
|
if (!verticalMode) {
|
|
9778
9816
|
const t = textAlign;
|
|
9779
|
-
textAlign = null !== (
|
|
9817
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
9780
9818
|
}
|
|
9781
9819
|
if (width = 0, !this.shouldUpdateShape() && this.cache) {
|
|
9782
9820
|
this.cache.verticalList.forEach(item => {
|
|
@@ -11761,7 +11799,8 @@
|
|
|
11761
11799
|
y1: y1,
|
|
11762
11800
|
x: originX = rectAttribute.x,
|
|
11763
11801
|
y: originY = rectAttribute.y,
|
|
11764
|
-
fillStrokeOrder = rectAttribute.fillStrokeOrder
|
|
11802
|
+
fillStrokeOrder = rectAttribute.fillStrokeOrder,
|
|
11803
|
+
drawStrokeWhenZeroWH = rectAttribute.drawStrokeWhenZeroWH
|
|
11765
11804
|
} = rect.attribute;
|
|
11766
11805
|
let {
|
|
11767
11806
|
width: width,
|
|
@@ -11769,7 +11808,7 @@
|
|
|
11769
11808
|
} = rect.attribute;
|
|
11770
11809
|
width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
|
|
11771
11810
|
const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
|
|
11772
|
-
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
|
|
11811
|
+
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
|
|
11773
11812
|
doFill = runFill(fill, background),
|
|
11774
11813
|
doStroke = runStroke(stroke, lineWidth);
|
|
11775
11814
|
if (!rect.valid || !visible) return;
|
|
@@ -12491,7 +12530,6 @@
|
|
|
12491
12530
|
decorator(target, key, paramIndex);
|
|
12492
12531
|
};
|
|
12493
12532
|
};
|
|
12494
|
-
const RenderService = Symbol.for("RenderService");
|
|
12495
12533
|
let DefaultRenderService = class {
|
|
12496
12534
|
constructor(drawContribution) {
|
|
12497
12535
|
this.drawContribution = drawContribution;
|
|
@@ -13380,8 +13418,6 @@
|
|
|
13380
13418
|
application.transformUtil = transformUtil;
|
|
13381
13419
|
const graphicService = container.get(GraphicService);
|
|
13382
13420
|
application.graphicService = graphicService;
|
|
13383
|
-
const renderService = container.get(RenderService);
|
|
13384
|
-
application.renderService = renderService;
|
|
13385
13421
|
const layerService = container.get(LayerService);
|
|
13386
13422
|
application.layerService = layerService;
|
|
13387
13423
|
|
|
@@ -13629,13 +13665,13 @@
|
|
|
13629
13665
|
this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
|
|
13630
13666
|
} else this._skipRender = 1;
|
|
13631
13667
|
}, this.beforeRender = stage => {
|
|
13632
|
-
this.
|
|
13668
|
+
this._beforeRenderList.forEach(cb => cb(stage));
|
|
13633
13669
|
}, this.afterClearScreen = drawParams => {
|
|
13634
13670
|
this._afterClearScreen && this._afterClearScreen(drawParams);
|
|
13635
13671
|
}, this.afterClearRect = drawParams => {
|
|
13636
13672
|
this._afterClearRect && this._afterClearRect(drawParams);
|
|
13637
13673
|
}, this.afterRender = stage => {
|
|
13638
|
-
this.renderCount++, this.
|
|
13674
|
+
this.renderCount++, this._afterRenderList.forEach(cb => cb(stage)), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
|
|
13639
13675
|
}, this.afterTickCb = () => {
|
|
13640
13676
|
this.tickedBeforeRender = !0, "rendering" !== this.state && this.renderNextFrame();
|
|
13641
13677
|
}, this.params = params, this.theme = new Theme(), this.hooks = {
|
|
@@ -13643,7 +13679,7 @@
|
|
|
13643
13679
|
afterRender: new SyncHook(["stage"]),
|
|
13644
13680
|
afterClearScreen: new SyncHook(["stage"]),
|
|
13645
13681
|
afterClearRect: new SyncHook(["stage"])
|
|
13646
|
-
}, 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({
|
|
13682
|
+
}, 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({
|
|
13647
13683
|
width: params.width,
|
|
13648
13684
|
height: params.height,
|
|
13649
13685
|
viewBox: params.viewBox,
|
|
@@ -13654,7 +13690,7 @@
|
|
|
13654
13690
|
canvas: params.canvas
|
|
13655
13691
|
}), 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, {
|
|
13656
13692
|
main: !0
|
|
13657
|
-
})), 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.
|
|
13693
|
+
})), 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 = {
|
|
13658
13694
|
tickRenderMode: "effect"
|
|
13659
13695
|
}), this.optmize(params.optimize), params.background && isString$3(this._background) && this._background.includes("/") && this.setAttributes({
|
|
13660
13696
|
background: this._background
|
|
@@ -13769,10 +13805,16 @@
|
|
|
13769
13805
|
options.enableView3dTransform && this.enableView3dTransform();
|
|
13770
13806
|
}
|
|
13771
13807
|
setBeforeRender(cb) {
|
|
13772
|
-
this.
|
|
13808
|
+
this._beforeRenderList.push(cb);
|
|
13809
|
+
}
|
|
13810
|
+
removeBeforeRender(cb) {
|
|
13811
|
+
this._beforeRenderList = this._beforeRenderList.filter(c => c !== cb);
|
|
13773
13812
|
}
|
|
13774
13813
|
setAfterRender(cb) {
|
|
13775
|
-
this.
|
|
13814
|
+
this._afterRenderList.push(cb);
|
|
13815
|
+
}
|
|
13816
|
+
removeAfterRender(cb) {
|
|
13817
|
+
this._afterRenderList = this._afterRenderList.filter(c => c !== cb);
|
|
13776
13818
|
}
|
|
13777
13819
|
afterNextRender(cb) {
|
|
13778
13820
|
this._afterNextRenderCbs || (this._afterNextRenderCbs = []), this._afterNextRenderCbs.push(cb);
|
|
@@ -16696,7 +16738,8 @@
|
|
|
16696
16738
|
CONTEXTMENU_DEPENDENCY_LINK: "contextmenu_dependency_link",
|
|
16697
16739
|
CLICK_MARKLINE_CREATE: "click_markline_create",
|
|
16698
16740
|
CLICK_MARKLINE_CONTENT: "click_markline_content",
|
|
16699
|
-
MOVE_END_TASK_BAR: "move_end_task_bar"
|
|
16741
|
+
MOVE_END_TASK_BAR: "move_end_task_bar",
|
|
16742
|
+
PROGRESS_UPDATE: "progress_update"
|
|
16700
16743
|
};
|
|
16701
16744
|
|
|
16702
16745
|
function throttle(func, delay) {
|
|
@@ -17581,7 +17624,7 @@
|
|
|
17581
17624
|
return (null == scrollStyle ? void 0 : scrollStyle.hoverOn) || (null == scrollStyle ? void 0 : scrollStyle.verticalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.verticalVisible) || !(null == scrollStyle ? void 0 : scrollStyle.verticalVisible) && "none" === (null == scrollStyle ? void 0 : scrollStyle.visible) ? 0 : null !== (_a = null == scrollStyle ? void 0 : scrollStyle.width) && void 0 !== _a ? _a : 7;
|
|
17582
17625
|
}
|
|
17583
17626
|
function initOptions(gantt) {
|
|
17584
|
-
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, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85;
|
|
17627
|
+
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, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87;
|
|
17585
17628
|
const options = gantt.options;
|
|
17586
17629
|
gantt.parsedOptions.tasksShowMode = null !== (_a = null == options ? void 0 : options.tasksShowMode) && void 0 !== _a ? _a : TasksShowMode.Tasks_Separate, gantt.parsedOptions.pixelRatio = null !== (_b = null == options ? void 0 : options.pixelRatio) && void 0 !== _b ? _b : 1, gantt.parsedOptions.rowHeight = null !== (_c = null == options ? void 0 : options.rowHeight) && void 0 !== _c ? _c : 40, gantt.parsedOptions.timelineColWidth = null !== (_e = null === (_d = null == options ? void 0 : options.timelineHeader) || void 0 === _d ? void 0 : _d.colWidth) && void 0 !== _e ? _e : 60, gantt.parsedOptions.startDateField = null !== (_g = null === (_f = options.taskBar) || void 0 === _f ? void 0 : _f.startDateField) && void 0 !== _g ? _g : "startDate", gantt.parsedOptions.endDateField = null !== (_j = null === (_h = options.taskBar) || void 0 === _h ? void 0 : _h.endDateField) && void 0 !== _j ? _j : "endDate", gantt.parsedOptions.progressField = null !== (_l = null === (_k = options.taskBar) || void 0 === _k ? void 0 : _k.progressField) && void 0 !== _l ? _l : "progress", gantt.parsedOptions.projectSubTasksExpandable = null === (_m = null == options ? void 0 : options.projectSubTasksExpandable) || void 0 === _m || _m;
|
|
17587
17630
|
const {
|
|
@@ -17637,54 +17680,54 @@
|
|
|
17637
17680
|
shadowColor: gantt.parsedOptions.taskBarStyle.barColor,
|
|
17638
17681
|
borderColor: gantt.parsedOptions.taskBarStyle.barColor,
|
|
17639
17682
|
borderLineWidth: 1
|
|
17640
|
-
}, null === (_11 = null == options ? void 0 : options.taskBar) || void 0 === _11 ? void 0 : _11.selectedBarStyle), gantt.parsedOptions.taskBarLabelText = null !== (_13 = null === (_12 = null == options ? void 0 : options.taskBar) || void 0 === _12 ? void 0 : _12.labelText) && void 0 !== _13 ? _13 : "", gantt.parsedOptions.taskBarMoveable = null === (_15 = null === (_14 = null == options ? void 0 : options.taskBar) || void 0 === _14 ? void 0 : _14.moveable) || void 0 === _15 || _15, gantt.parsedOptions.moveTaskBarToExtendDateRange = null === (_17 = null === (_16 = null == options ? void 0 : options.taskBar) || void 0 === _16 ? void 0 : _16.moveToExtendDateRange) || void 0 === _17 || _17, gantt.parsedOptions.taskBarResizable = null === (_19 = null === (_18 = null == options ? void 0 : options.taskBar) || void 0 === _18 ? void 0 : _18.resizable) || void 0 === _19 || _19, gantt.parsedOptions.
|
|
17641
|
-
fontFamily: null !== (
|
|
17642
|
-
fontSize: null !== (
|
|
17643
|
-
color: null !== (
|
|
17644
|
-
outsideColor: null !== (
|
|
17645
|
-
textAlign: null !== (
|
|
17646
|
-
textBaseline: null !== (
|
|
17647
|
-
padding: null !== (
|
|
17648
|
-
textOverflow: null === (
|
|
17649
|
-
orient: null === (
|
|
17650
|
-
orientHandleWithOverflow: null === (
|
|
17651
|
-
}, gantt.parsedOptions.taskBarCustomLayout = null === (
|
|
17683
|
+
}, null === (_11 = null == options ? void 0 : options.taskBar) || void 0 === _11 ? void 0 : _11.selectedBarStyle), gantt.parsedOptions.taskBarLabelText = null !== (_13 = null === (_12 = null == options ? void 0 : options.taskBar) || void 0 === _12 ? void 0 : _12.labelText) && void 0 !== _13 ? _13 : "", gantt.parsedOptions.taskBarMoveable = null === (_15 = null === (_14 = null == options ? void 0 : options.taskBar) || void 0 === _14 ? void 0 : _14.moveable) || void 0 === _15 || _15, gantt.parsedOptions.moveTaskBarToExtendDateRange = null === (_17 = null === (_16 = null == options ? void 0 : options.taskBar) || void 0 === _16 ? void 0 : _16.moveToExtendDateRange) || void 0 === _17 || _17, gantt.parsedOptions.taskBarResizable = null === (_19 = null === (_18 = null == options ? void 0 : options.taskBar) || void 0 === _18 ? void 0 : _18.resizable) || void 0 === _19 || _19, gantt.parsedOptions.taskBarProgressAdjustable = null !== (_21 = null === (_20 = null == options ? void 0 : options.taskBar) || void 0 === _20 ? void 0 : _20.progressAdjustable) && void 0 !== _21 && _21, gantt.parsedOptions.taskBarDragOrder = null === (_23 = null === (_22 = null == options ? void 0 : options.taskBar) || void 0 === _22 ? void 0 : _22.dragOrder) || void 0 === _23 || _23, gantt.parsedOptions.taskBarLabelStyle = {
|
|
17684
|
+
fontFamily: null !== (_26 = null === (_25 = null === (_24 = null == options ? void 0 : options.taskBar) || void 0 === _24 ? void 0 : _24.labelTextStyle) || void 0 === _25 ? void 0 : _25.fontFamily) && void 0 !== _26 ? _26 : "Arial",
|
|
17685
|
+
fontSize: null !== (_29 = null === (_28 = null === (_27 = null == options ? void 0 : options.taskBar) || void 0 === _27 ? void 0 : _27.labelTextStyle) || void 0 === _28 ? void 0 : _28.fontSize) && void 0 !== _29 ? _29 : 20,
|
|
17686
|
+
color: null !== (_32 = null === (_31 = null === (_30 = null == options ? void 0 : options.taskBar) || void 0 === _30 ? void 0 : _30.labelTextStyle) || void 0 === _31 ? void 0 : _31.color) && void 0 !== _32 ? _32 : "#F01",
|
|
17687
|
+
outsideColor: null !== (_35 = null === (_34 = null === (_33 = null == options ? void 0 : options.taskBar) || void 0 === _33 ? void 0 : _33.labelTextStyle) || void 0 === _34 ? void 0 : _34.outsideColor) && void 0 !== _35 ? _35 : "#333333",
|
|
17688
|
+
textAlign: null !== (_38 = null === (_37 = null === (_36 = null == options ? void 0 : options.taskBar) || void 0 === _36 ? void 0 : _36.labelTextStyle) || void 0 === _37 ? void 0 : _37.textAlign) && void 0 !== _38 ? _38 : "left",
|
|
17689
|
+
textBaseline: null !== (_41 = null === (_40 = null === (_39 = null == options ? void 0 : options.taskBar) || void 0 === _39 ? void 0 : _39.labelTextStyle) || void 0 === _40 ? void 0 : _40.textBaseline) && void 0 !== _41 ? _41 : "middle",
|
|
17690
|
+
padding: null !== (_44 = null === (_43 = null === (_42 = null == options ? void 0 : options.taskBar) || void 0 === _42 ? void 0 : _42.labelTextStyle) || void 0 === _43 ? void 0 : _43.padding) && void 0 !== _44 ? _44 : [0, 0, 0, 10],
|
|
17691
|
+
textOverflow: null === (_46 = null === (_45 = null == options ? void 0 : options.taskBar) || void 0 === _45 ? void 0 : _45.labelTextStyle) || void 0 === _46 ? void 0 : _46.textOverflow,
|
|
17692
|
+
orient: null === (_48 = null === (_47 = null == options ? void 0 : options.taskBar) || void 0 === _47 ? void 0 : _47.labelTextStyle) || void 0 === _48 ? void 0 : _48.orient,
|
|
17693
|
+
orientHandleWithOverflow: null === (_50 = null === (_49 = null == options ? void 0 : options.taskBar) || void 0 === _49 ? void 0 : _49.labelTextStyle) || void 0 === _50 ? void 0 : _50.orientHandleWithOverflow
|
|
17694
|
+
}, gantt.parsedOptions.taskBarCustomLayout = null === (_51 = null == options ? void 0 : options.taskBar) || void 0 === _51 ? void 0 : _51.customLayout, gantt.parsedOptions.taskBarCreatable = null !== (_53 = null === (_52 = null == options ? void 0 : options.taskBar) || void 0 === _52 ? void 0 : _52.scheduleCreatable) && void 0 !== _53 ? _53 : !(gantt.parsedOptions.tasksShowMode !== TasksShowMode.Sub_Tasks_Separate && gantt.parsedOptions.tasksShowMode !== TasksShowMode.Tasks_Separate), gantt.parsedOptions.taskBarCreationButtonStyle = Object.assign({
|
|
17652
17695
|
lineColor: "rgb(99, 144, 0)",
|
|
17653
17696
|
lineWidth: 1,
|
|
17654
17697
|
lineDash: [5, 5],
|
|
17655
17698
|
cornerRadius: 4,
|
|
17656
17699
|
backgroundColor: "#FFF"
|
|
17657
|
-
}, null === (
|
|
17700
|
+
}, null === (_55 = null === (_54 = null == options ? void 0 : options.taskBar) || void 0 === _54 ? void 0 : _54.scheduleCreation) || void 0 === _55 ? void 0 : _55.buttonStyle), gantt.parsedOptions.taskBarCreationCustomLayout = null === (_57 = null === (_56 = null == options ? void 0 : options.taskBar) || void 0 === _56 ? void 0 : _56.scheduleCreation) || void 0 === _57 ? void 0 : _57.customLayout, gantt.parsedOptions.taskBarCreationMaxWidth = null === (_59 = null === (_58 = null == options ? void 0 : options.taskBar) || void 0 === _58 ? void 0 : _58.scheduleCreation) || void 0 === _59 ? void 0 : _59.maxWidth, gantt.parsedOptions.taskBarCreationMinWidth = null === (_61 = null === (_60 = null == options ? void 0 : options.taskBar) || void 0 === _60 ? void 0 : _60.scheduleCreation) || void 0 === _61 ? void 0 : _61.minWidth, gantt.parsedOptions.outerFrameStyle = Object.assign({
|
|
17658
17701
|
borderColor: "#e1e4e8",
|
|
17659
17702
|
borderLineWidth: 1,
|
|
17660
17703
|
cornerRadius: 4
|
|
17661
|
-
}, null === (
|
|
17662
|
-
lineColor: null === (
|
|
17663
|
-
lineWidth: null === (
|
|
17664
|
-
}, null === (
|
|
17704
|
+
}, null === (_62 = options.frame) || void 0 === _62 ? void 0 : _62.outerFrameStyle), gantt.parsedOptions.markLine = generateMarkLine(null == options ? void 0 : options.markLine), null !== (_64 = null === (_63 = gantt.parsedOptions.markLine) || void 0 === _63 ? void 0 : _63.length) && void 0 !== _64 && _64 && ((null === (_65 = gantt.parsedOptions.markLine) || void 0 === _65 ? void 0 : _65.every(item => void 0 === item.scrollToMarkLine)) && (gantt.parsedOptions.markLine[0].scrollToMarkLine = !0), (null === (_66 = gantt.parsedOptions.markLine) || void 0 === _66 ? void 0 : _66.find(item => item.scrollToMarkLine)) && (gantt.parsedOptions.scrollToMarkLineDate = getStartDateByTimeUnit(new Date(null === (_67 = gantt.parsedOptions.markLine) || void 0 === _67 ? void 0 : _67.find(item => item.scrollToMarkLine).date), minTimeUnit, startOfWeek))), gantt.parsedOptions.verticalSplitLineHighlight = null === (_68 = options.frame) || void 0 === _68 ? void 0 : _68.verticalSplitLineHighlight, gantt.parsedOptions.verticalSplitLine = Object.assign({
|
|
17705
|
+
lineColor: null === (_69 = gantt.parsedOptions.outerFrameStyle) || void 0 === _69 ? void 0 : _69.borderColor,
|
|
17706
|
+
lineWidth: null === (_70 = gantt.parsedOptions.outerFrameStyle) || void 0 === _70 ? void 0 : _70.borderLineWidth
|
|
17707
|
+
}, null === (_71 = options.frame) || void 0 === _71 ? void 0 : _71.verticalSplitLine), gantt.parsedOptions.horizontalSplitLine = null === (_72 = options.frame) || void 0 === _72 ? void 0 : _72.horizontalSplitLine, gantt.parsedOptions.verticalSplitLineMoveable = null === (_73 = options.frame) || void 0 === _73 ? void 0 : _73.verticalSplitLineMoveable, gantt.parsedOptions.taskKeyField = null !== (_74 = options.taskKeyField) && void 0 !== _74 ? _74 : "id", gantt.parsedOptions.dependencyLinks = null !== (_76 = null === (_75 = options.dependency) || void 0 === _75 ? void 0 : _75.links) && void 0 !== _76 ? _76 : [], gantt.parsedOptions.dependencyLinkCreatable = null !== (_78 = null === (_77 = options.dependency) || void 0 === _77 ? void 0 : _77.linkCreatable) && void 0 !== _78 && _78, gantt.parsedOptions.dependencyLinkSelectable = null === (_80 = null === (_79 = options.dependency) || void 0 === _79 ? void 0 : _79.linkSelectable) || void 0 === _80 || _80, gantt.parsedOptions.dependencyLinkDeletable = null !== (_82 = null === (_81 = options.dependency) || void 0 === _81 ? void 0 : _81.linkDeletable) && void 0 !== _82 && _82, gantt.parsedOptions.dependencyLinkLineStyle = Object.assign({
|
|
17665
17708
|
lineColor: "red",
|
|
17666
17709
|
lineWidth: 1
|
|
17667
|
-
}, null === (
|
|
17710
|
+
}, null === (_83 = options.dependency) || void 0 === _83 ? void 0 : _83.linkLineStyle), gantt.parsedOptions.dependencyLinkSelectedLineStyle = Object.assign({
|
|
17668
17711
|
shadowBlur: 4,
|
|
17669
17712
|
shadowOffset: 0,
|
|
17670
17713
|
shadowColor: gantt.parsedOptions.dependencyLinkLineStyle.lineColor,
|
|
17671
17714
|
lineColor: gantt.parsedOptions.dependencyLinkLineStyle.lineColor,
|
|
17672
17715
|
lineWidth: gantt.parsedOptions.dependencyLinkLineStyle.lineWidth
|
|
17673
|
-
}, null === (
|
|
17716
|
+
}, null === (_84 = null == options ? void 0 : options.dependency) || void 0 === _84 ? void 0 : _84.linkSelectedLineStyle), gantt.parsedOptions.dependencyLinkLineCreatePointStyle = Object.assign({
|
|
17674
17717
|
strokeColor: "red",
|
|
17675
17718
|
fillColor: "white",
|
|
17676
17719
|
radius: 5,
|
|
17677
17720
|
strokeWidth: 1
|
|
17678
|
-
}, null === (
|
|
17721
|
+
}, null === (_85 = null == options ? void 0 : options.dependency) || void 0 === _85 ? void 0 : _85.linkCreatePointStyle), gantt.parsedOptions.dependencyLinkLineCreatingPointStyle = Object.assign({
|
|
17679
17722
|
strokeColor: "red",
|
|
17680
17723
|
fillColor: "red",
|
|
17681
17724
|
radius: 5,
|
|
17682
17725
|
strokeWidth: 1
|
|
17683
|
-
}, null === (
|
|
17726
|
+
}, null === (_86 = null == options ? void 0 : options.dependency) || void 0 === _86 ? void 0 : _86.linkCreatingPointStyle), gantt.parsedOptions.dependencyLinkLineCreatingStyle = Object.assign({
|
|
17684
17727
|
lineColor: "red",
|
|
17685
17728
|
lineWidth: 1,
|
|
17686
17729
|
lineDash: [5, 5]
|
|
17687
|
-
}, null === (
|
|
17730
|
+
}, null === (_87 = null == options ? void 0 : options.dependency) || void 0 === _87 ? void 0 : _87.linkCreatingLineStyle), gantt.parsedOptions.eventOptions = null == options ? void 0 : options.eventOptions, gantt.parsedOptions.keyboardOptions = null == options ? void 0 : options.keyboardOptions, gantt.parsedOptions.markLineCreateOptions = null == options ? void 0 : options.markLineCreateOptions;
|
|
17688
17731
|
}
|
|
17689
17732
|
function updateOptionsWhenScaleChanged(gantt) {
|
|
17690
17733
|
var _a, _b, _c, _d;
|
|
@@ -18663,7 +18706,7 @@
|
|
|
18663
18706
|
y: 0,
|
|
18664
18707
|
width: 100,
|
|
18665
18708
|
height: 100,
|
|
18666
|
-
clip: !
|
|
18709
|
+
clip: !1,
|
|
18667
18710
|
pickable: !1,
|
|
18668
18711
|
cornerRadius: null !== (_b = null !== (_a = this._scene._gantt.parsedOptions.taskBarHoverStyle.cornerRadius) && void 0 !== _a ? _a : defaultTaskBarStyle.cornerRadius) && void 0 !== _b ? _b : 0,
|
|
18669
18712
|
fill: this._scene._gantt.parsedOptions.taskBarHoverStyle.barOverlayColor,
|
|
@@ -18691,6 +18734,32 @@
|
|
|
18691
18734
|
});
|
|
18692
18735
|
rightIcon.name = "task-bar-hover-shadow-right-icon", this.hoverBarRightIcon = rightIcon, hoverBarGroup.appendChild(rightIcon);
|
|
18693
18736
|
}
|
|
18737
|
+
const progressHandle = new Group({
|
|
18738
|
+
x: 0,
|
|
18739
|
+
y: 0,
|
|
18740
|
+
width: 12,
|
|
18741
|
+
height: 12,
|
|
18742
|
+
pickable: !0,
|
|
18743
|
+
cursor: "ew-resize",
|
|
18744
|
+
visible: !1
|
|
18745
|
+
}),
|
|
18746
|
+
triangleHandle = new Polygon({
|
|
18747
|
+
points: [{
|
|
18748
|
+
x: 6,
|
|
18749
|
+
y: 0
|
|
18750
|
+
}, {
|
|
18751
|
+
x: 0,
|
|
18752
|
+
y: 6
|
|
18753
|
+
}, {
|
|
18754
|
+
x: 12,
|
|
18755
|
+
y: 6
|
|
18756
|
+
}],
|
|
18757
|
+
fill: "#0064ff",
|
|
18758
|
+
stroke: "#ffffff",
|
|
18759
|
+
lineWidth: 1,
|
|
18760
|
+
pickable: !1
|
|
18761
|
+
});
|
|
18762
|
+
progressHandle.appendChild(triangleHandle), progressHandle.name = "task-bar-progress-handle", this.hoverBarProgressHandle = progressHandle, hoverBarGroup.appendChild(progressHandle);
|
|
18694
18763
|
}
|
|
18695
18764
|
setX(x) {
|
|
18696
18765
|
this.barContainer.setAttribute("x", x);
|
|
@@ -18712,7 +18781,7 @@
|
|
|
18712
18781
|
this.width = this._scene._gantt.tableNoFrameWidth, this.height = this._scene._gantt.gridHeight, this.group.setAttribute("width", this.width), this.group.setAttribute("height", this.height);
|
|
18713
18782
|
}
|
|
18714
18783
|
showHoverBar(x, y, width, height, target) {
|
|
18715
|
-
var _a, _b, _c, _d;
|
|
18784
|
+
var _a, _b, _c, _d, _e;
|
|
18716
18785
|
const {
|
|
18717
18786
|
startDate: startDate,
|
|
18718
18787
|
endDate: endDate,
|
|
@@ -18724,10 +18793,24 @@
|
|
|
18724
18793
|
const cornerRadius = null !== (_b = null !== (_a = this._scene._gantt.parsedOptions.taskBarHoverStyle.cornerRadius) && void 0 !== _a ? _a : taskBarStyle.cornerRadius) && void 0 !== _b ? _b : 0;
|
|
18725
18794
|
this.hoverBarGroup.setAttribute("cornerRadius", cornerRadius);
|
|
18726
18795
|
}
|
|
18727
|
-
null === (_c = this.hoverBarLeftIcon) || void 0 === _c || _c.setAttribute("visible", !1), null === (_d = this.hoverBarRightIcon) || void 0 === _d || _d.setAttribute("visible", !1);
|
|
18796
|
+
null === (_c = this.hoverBarLeftIcon) || void 0 === _c || _c.setAttribute("visible", !1), null === (_d = this.hoverBarRightIcon) || void 0 === _d || _d.setAttribute("visible", !1), null === (_e = this.hoverBarProgressHandle) || void 0 === _e || _e.setAttribute("visibleAll", !1);
|
|
18728
18797
|
let leftResizable = !0,
|
|
18729
|
-
rightResizable = !0
|
|
18730
|
-
|
|
18798
|
+
rightResizable = !0,
|
|
18799
|
+
progressAdjustable = !0;
|
|
18800
|
+
const progressField = this._scene._gantt.parsedOptions.progressField;
|
|
18801
|
+
if (progressField && void 0 !== taskRecord[progressField] && null !== taskRecord[progressField]) {
|
|
18802
|
+
if ("function" == typeof this._scene._gantt.parsedOptions.taskBarProgressAdjustable) {
|
|
18803
|
+
const arg = {
|
|
18804
|
+
index: target.task_index,
|
|
18805
|
+
startDate: startDate,
|
|
18806
|
+
endDate: endDate,
|
|
18807
|
+
taskRecord: taskRecord,
|
|
18808
|
+
ganttInstance: this._scene._gantt
|
|
18809
|
+
};
|
|
18810
|
+
progressAdjustable = this._scene._gantt.parsedOptions.taskBarProgressAdjustable(arg);
|
|
18811
|
+
} else progressAdjustable = this._scene._gantt.parsedOptions.taskBarProgressAdjustable;
|
|
18812
|
+
} else progressAdjustable = !1;
|
|
18813
|
+
if (taskRecord.type === TaskType.MILESTONE) leftResizable = !1, rightResizable = !1, progressAdjustable = !1;else if ("function" == typeof this._scene._gantt.parsedOptions.taskBarResizable) {
|
|
18731
18814
|
const arg = {
|
|
18732
18815
|
index: target.task_index,
|
|
18733
18816
|
startDate: startDate,
|
|
@@ -18738,7 +18821,13 @@
|
|
|
18738
18821
|
resizableResult = this._scene._gantt.parsedOptions.taskBarResizable(arg);
|
|
18739
18822
|
Array.isArray(resizableResult) ? [leftResizable, rightResizable] = resizableResult : (leftResizable = resizableResult, rightResizable = resizableResult);
|
|
18740
18823
|
} else Array.isArray(this._scene._gantt.parsedOptions.taskBarResizable) ? [leftResizable, rightResizable] = this._scene._gantt.parsedOptions.taskBarResizable : (leftResizable = this._scene._gantt.parsedOptions.taskBarResizable, rightResizable = this._scene._gantt.parsedOptions.taskBarResizable);
|
|
18741
|
-
leftResizable && this.hoverBarLeftIcon.setAttribute("visible", !0), rightResizable && this.hoverBarRightIcon.setAttribute("visible", !0), this.hoverBarLeftIcon && (this.hoverBarLeftIcon.setAttribute("x", 0), this.hoverBarLeftIcon.setAttribute("y", Math.ceil(height / 10)), this.hoverBarLeftIcon.setAttribute("width", 10), this.hoverBarLeftIcon.setAttribute("height", height - 2 * Math.ceil(height / 10)), this.hoverBarRightIcon.setAttribute("x", width - 10), this.hoverBarRightIcon.setAttribute("y", Math.ceil(height / 10)), this.hoverBarRightIcon.setAttribute("width", 10), this.hoverBarRightIcon.setAttribute("height", height - 2 * Math.ceil(height / 10)))
|
|
18824
|
+
if (leftResizable && this.hoverBarLeftIcon.setAttribute("visible", !0), rightResizable && this.hoverBarRightIcon.setAttribute("visible", !0), progressAdjustable && this.hoverBarProgressHandle.setAttribute("visibleAll", !0), this.hoverBarLeftIcon && (this.hoverBarLeftIcon.setAttribute("x", 0), this.hoverBarLeftIcon.setAttribute("y", Math.ceil(height / 10)), this.hoverBarLeftIcon.setAttribute("width", 10), this.hoverBarLeftIcon.setAttribute("height", height - 2 * Math.ceil(height / 10)), this.hoverBarRightIcon.setAttribute("x", width - 10), this.hoverBarRightIcon.setAttribute("y", Math.ceil(height / 10)), this.hoverBarRightIcon.setAttribute("width", 10), this.hoverBarRightIcon.setAttribute("height", height - 2 * Math.ceil(height / 10))), this.hoverBarProgressHandle) {
|
|
18825
|
+
const {
|
|
18826
|
+
progress: progress
|
|
18827
|
+
} = this._scene._gantt.getTaskInfoByTaskListIndex(target.task_index, target.sub_task_index),
|
|
18828
|
+
progressX = width * progress / 100 - 6;
|
|
18829
|
+
this.hoverBarProgressHandle.setAttribute("x", progressX), this.hoverBarProgressHandle.setAttribute("y", height - 3);
|
|
18830
|
+
}
|
|
18742
18831
|
}
|
|
18743
18832
|
hideHoverBar() {
|
|
18744
18833
|
this.hoverBarGroup.setAttribute("visibleAll", !1);
|
|
@@ -20301,7 +20390,7 @@
|
|
|
20301
20390
|
let downBarNode, downLeftLinkPointNode, downRightLinkPointNode;
|
|
20302
20391
|
if (e.detailPath.find(pathNode => "task-bar" === pathNode.name ? (downBarNode = pathNode, !0) : "task-creation-button" === pathNode.name ? (!0) : "task-bar-link-point-left" === pathNode.name ? (downLeftLinkPointNode = pathNode, !0) : "task-bar-link-point-right" === pathNode.name ? (downRightLinkPointNode = pathNode, !0) : !!pathNode.attribute.vtable_link && (pathNode.attribute.vtable_link, !0)), downBarNode) {
|
|
20303
20392
|
const taskRecord = downBarNode.record;
|
|
20304
|
-
if (!((null == taskRecord ? void 0 : taskRecord.type) === TaskType.PROJECT)) if ("task-bar-hover-shadow-left-icon" === e.target.name) stateManager.startResizeTaskBar(downBarNode, e.nativeEvent.x, e.nativeEvent.y, e.offset.y, "left"), stateManager.updateInteractionState(InteractionState.grabing);else if ("task-bar-hover-shadow-right-icon" === e.target.name) stateManager.startResizeTaskBar(downBarNode, e.nativeEvent.x, e.nativeEvent.y, e.offset.y, "right"), stateManager.updateInteractionState(InteractionState.grabing);else if (gantt.parsedOptions.taskBarMoveable) {
|
|
20393
|
+
if (!((null == taskRecord ? void 0 : taskRecord.type) === TaskType.PROJECT)) if ("task-bar-hover-shadow-left-icon" === e.target.name) stateManager.startResizeTaskBar(downBarNode, e.nativeEvent.x, e.nativeEvent.y, e.offset.y, "left"), stateManager.updateInteractionState(InteractionState.grabing);else if ("task-bar-hover-shadow-right-icon" === e.target.name) stateManager.startResizeTaskBar(downBarNode, e.nativeEvent.x, e.nativeEvent.y, e.offset.y, "right"), stateManager.updateInteractionState(InteractionState.grabing);else if ("task-bar-progress-handle" === e.target.name) stateManager.startAdjustProgressBar(downBarNode, e.nativeEvent.x, e.nativeEvent.y), stateManager.updateInteractionState(InteractionState.grabing);else if (gantt.parsedOptions.taskBarMoveable) {
|
|
20305
20394
|
const moveTaskBar = () => {
|
|
20306
20395
|
let moveable = !0;
|
|
20307
20396
|
if ("function" == typeof gantt.parsedOptions.taskBarMoveable) {
|
|
@@ -20586,7 +20675,7 @@
|
|
|
20586
20675
|
if (stateManager.interactionState === InteractionState.grabing && "draging" === gantt.eventManager.poniterState) {
|
|
20587
20676
|
const lastX = null !== (_d = null === (_c = gantt.eventManager.lastDragPointerXYOnWindow) || void 0 === _c ? void 0 : _c.x) && void 0 !== _d ? _d : e.x,
|
|
20588
20677
|
lastY = null !== (_f = null === (_e = gantt.eventManager.lastDragPointerXYOnWindow) || void 0 === _e ? void 0 : _e.y) && void 0 !== _f ? _f : e.y;
|
|
20589
|
-
(Math.abs(lastX - e.x) >= 1 || Math.abs(lastY - e.y) >= 1) && (stateManager.isResizingTableWidth() ? (stateManager.hideDependencyLinkSelectedLine(), stateManager.hideTaskBarSelectedBorder(), stateManager.dealResizeTableWidth(e)) : stateManager.isMoveingTaskBar() ? (stateManager.hideDependencyLinkSelectedLine(), stateManager.hideTaskBarSelectedBorder(), stateManager.dealTaskBarMove(e)) : stateManager.isResizingTaskBar() ? (stateManager.hideDependencyLinkSelectedLine(), stateManager.hideTaskBarSelectedBorder(), stateManager.dealTaskBarResize(e)) : stateManager.isCreatingDependencyLine() && stateManager.dealCreateDependencyLine(e), gantt.eventManager.lastDragPointerXYOnWindow = {
|
|
20678
|
+
(Math.abs(lastX - e.x) >= 1 || Math.abs(lastY - e.y) >= 1) && (stateManager.isResizingTableWidth() ? (stateManager.hideDependencyLinkSelectedLine(), stateManager.hideTaskBarSelectedBorder(), stateManager.dealResizeTableWidth(e)) : stateManager.isMoveingTaskBar() ? (stateManager.hideDependencyLinkSelectedLine(), stateManager.hideTaskBarSelectedBorder(), stateManager.dealTaskBarMove(e)) : stateManager.isResizingTaskBar() ? (stateManager.hideDependencyLinkSelectedLine(), stateManager.hideTaskBarSelectedBorder(), stateManager.dealTaskBarResize(e)) : stateManager.isAdjustingProgressBar() ? stateManager.dealAdjustProgressBar(e) : stateManager.isCreatingDependencyLine() && stateManager.dealCreateDependencyLine(e), gantt.eventManager.lastDragPointerXYOnWindow = {
|
|
20590
20679
|
x: e.x,
|
|
20591
20680
|
y: e.y
|
|
20592
20681
|
});
|
|
@@ -20598,7 +20687,7 @@
|
|
|
20598
20687
|
callback: globalPointermoveCallback
|
|
20599
20688
|
}), vglobal.addEventListener("pointermove", globalPointermoveCallback);
|
|
20600
20689
|
const globalPointerupCallback = e => {
|
|
20601
|
-
"grabing" === stateManager.interactionState && (stateManager.updateInteractionState(InteractionState.default), stateManager.isResizingTableWidth() ? stateManager.endResizeTableWidth() : stateManager.isMoveingTaskBar() ? stateManager.endMoveTaskBar() : stateManager.isResizingTaskBar()
|
|
20690
|
+
"grabing" === stateManager.interactionState && (stateManager.updateInteractionState(InteractionState.default), stateManager.isResizingTableWidth() ? stateManager.endResizeTableWidth() : stateManager.isMoveingTaskBar() ? stateManager.endMoveTaskBar() : stateManager.isResizingTaskBar() ? stateManager.endResizeTaskBar(e.x) : stateManager.isAdjustingProgressBar() && stateManager.endAdjustProgressBar(e.x)), setTimeout(() => {
|
|
20602
20691
|
gantt.eventManager.lastDragPointerXYOnWindow = void 0, gantt.eventManager.poniterState = "up";
|
|
20603
20692
|
}, 0);
|
|
20604
20693
|
};
|
|
@@ -20771,6 +20860,12 @@
|
|
|
20771
20860
|
target: null,
|
|
20772
20861
|
resizing: !1,
|
|
20773
20862
|
onIconName: ""
|
|
20863
|
+
}, this.adjustProgressBar = {
|
|
20864
|
+
startX: null,
|
|
20865
|
+
startY: null,
|
|
20866
|
+
target: null,
|
|
20867
|
+
adjusting: !1,
|
|
20868
|
+
originalProgress: 0
|
|
20774
20869
|
}, this.resizeTableWidth = {
|
|
20775
20870
|
lastX: null,
|
|
20776
20871
|
resizing: !1
|
|
@@ -21042,6 +21137,51 @@
|
|
|
21042
21137
|
const taskBarSize = Math.max(1, taskBarGroup.attribute.width + diffWidth);
|
|
21043
21138
|
diffWidth = taskBarSize - taskBarGroup.attribute.width, resizeTaskBar(taskBarGroup, "left" === this._gantt.stateManager.resizeTaskBar.onIconName ? -diffWidth : 0, taskBarSize, this), this._gantt.scenegraph.updateNextFrame();
|
|
21044
21139
|
}
|
|
21140
|
+
startAdjustProgressBar(target, x, y) {
|
|
21141
|
+
const {
|
|
21142
|
+
progress: progress
|
|
21143
|
+
} = this._gantt.getTaskInfoByTaskListIndex(target.task_index, target.sub_task_index);
|
|
21144
|
+
this.adjustProgressBar.target = target, this.adjustProgressBar.adjusting = !0, this.adjustProgressBar.startX = x, this.adjustProgressBar.startY = y, this.adjustProgressBar.originalProgress = progress;
|
|
21145
|
+
}
|
|
21146
|
+
isAdjustingProgressBar() {
|
|
21147
|
+
return this.adjustProgressBar.adjusting;
|
|
21148
|
+
}
|
|
21149
|
+
endAdjustProgressBar(x) {
|
|
21150
|
+
const target = this.adjustProgressBar.target,
|
|
21151
|
+
taskBarWidth = target.attribute.width,
|
|
21152
|
+
deltaX = x - this.adjustProgressBar.startX,
|
|
21153
|
+
newProgress = Math.max(0, Math.min(100, this.adjustProgressBar.originalProgress + deltaX / taskBarWidth * 100));
|
|
21154
|
+
if (Math.abs(newProgress - this.adjustProgressBar.originalProgress) >= 1) {
|
|
21155
|
+
const taskIndex = target.task_index,
|
|
21156
|
+
subTaskIndex = target.sub_task_index;
|
|
21157
|
+
this._gantt._updateProgressToTaskRecord(Math.round(newProgress), taskIndex, subTaskIndex);
|
|
21158
|
+
const newRecord = this._gantt.getRecordByIndex(taskIndex, subTaskIndex);
|
|
21159
|
+
this._gantt.hasListeners(GANTT_EVENT_TYPE.PROGRESS_UPDATE) && this._gantt.fireListeners(GANTT_EVENT_TYPE.PROGRESS_UPDATE, {
|
|
21160
|
+
federatedEvent: null,
|
|
21161
|
+
event: null,
|
|
21162
|
+
index: taskIndex,
|
|
21163
|
+
sub_task_index: subTaskIndex,
|
|
21164
|
+
progress: Math.round(newProgress),
|
|
21165
|
+
oldProgress: Math.round(this.adjustProgressBar.originalProgress),
|
|
21166
|
+
record: newRecord
|
|
21167
|
+
});
|
|
21168
|
+
}
|
|
21169
|
+
this.adjustProgressBar.adjusting = !1, this.adjustProgressBar.target = null, this.adjustProgressBar.startX = null, this.adjustProgressBar.startY = null, this.adjustProgressBar.originalProgress = 0;
|
|
21170
|
+
}
|
|
21171
|
+
dealAdjustProgressBar(e) {
|
|
21172
|
+
const target = this.adjustProgressBar.target,
|
|
21173
|
+
taskBarWidth = target.attribute.width,
|
|
21174
|
+
deltaX = e.x - this.adjustProgressBar.startX,
|
|
21175
|
+
newProgress = Math.max(0, Math.min(100, this.adjustProgressBar.originalProgress + deltaX / taskBarWidth * 100));
|
|
21176
|
+
if (target.progressRect && target.progressRect.setAttribute("width", taskBarWidth * newProgress / 100), this._gantt.scenegraph.taskBar.hoverBarProgressHandle && this._gantt.scenegraph.taskBar.hoverBarProgressHandle.attribute.visibleAll && this._gantt.scenegraph.taskBar.hoverBarProgressHandle.setAttribute("x", taskBarWidth * newProgress / 100 - 6), target.textLabel && target.record) {
|
|
21177
|
+
const tempRecord = Object.assign(Object.assign({}, target.record), {
|
|
21178
|
+
progress: Math.round(newProgress)
|
|
21179
|
+
}),
|
|
21180
|
+
newText = parseStringTemplate(this._gantt.parsedOptions.taskBarLabelText, tempRecord);
|
|
21181
|
+
target.textLabel.setAttribute("text", newText);
|
|
21182
|
+
}
|
|
21183
|
+
this._gantt.scenegraph && this._gantt.scenegraph.stage && this._gantt.scenegraph.stage.renderNextFrame();
|
|
21184
|
+
}
|
|
21045
21185
|
startCreateDependencyLine(target, x, y, startOffsetY, position) {
|
|
21046
21186
|
this.resizeTaskBar.resizing = !1, this.creatingDenpendencyLink.creating = !0, this.creatingDenpendencyLink.startClickedPoint = target, this.creatingDenpendencyLink.startX = x, this.creatingDenpendencyLink.startY = y, this.creatingDenpendencyLink.startOffsetY = startOffsetY, this.creatingDenpendencyLink.firstTaskBarPosition = position, this.highlightLinkPointNode(target);
|
|
21047
21187
|
}
|
|
@@ -21783,6 +21923,15 @@
|
|
|
21783
21923
|
this._updateRecordToListTable(taskRecord, indexs), Array.isArray(indexs) && this.stateManager.updateProjectTaskTimes(indexs);
|
|
21784
21924
|
}
|
|
21785
21925
|
}
|
|
21926
|
+
_updateProgressToTaskRecord(progress, index, sub_task_index) {
|
|
21927
|
+
const taskRecord = this.getRecordByIndex(index, sub_task_index),
|
|
21928
|
+
progressField = this.parsedOptions.progressField;
|
|
21929
|
+
if (progressField) {
|
|
21930
|
+
taskRecord[progressField] = progress;
|
|
21931
|
+
const indexs = this.getRecordIndexByTaskShowIndex(index);
|
|
21932
|
+
this._updateRecordToListTable(taskRecord, indexs), this._refreshTaskBar(index, sub_task_index);
|
|
21933
|
+
}
|
|
21934
|
+
}
|
|
21786
21935
|
_dragOrderTaskRecord(source_index, source_sub_task_index, target_index, target_sub_task_index) {
|
|
21787
21936
|
this.data.adjustOrder(source_index, source_sub_task_index, target_index, target_sub_task_index);
|
|
21788
21937
|
}
|