@visactor/vrender-components 0.16.13 → 0.16.14-alpha.11
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/axis/base.js +19 -12
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/circle.d.ts +1 -2
- package/cjs/axis/circle.js.map +1 -1
- package/cjs/axis/line.js +1 -1
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/type.d.ts +5 -6
- package/cjs/axis/type.js.map +1 -1
- package/cjs/constant.d.ts +6 -0
- package/cjs/constant.js +6 -1
- package/cjs/constant.js.map +1 -1
- package/cjs/core/type.d.ts +15 -0
- package/cjs/core/type.js.map +1 -1
- package/cjs/data-zoom/config.d.ts +0 -6
- package/cjs/data-zoom/config.js +1 -7
- package/cjs/data-zoom/config.js.map +1 -1
- package/cjs/data-zoom/data-zoom.d.ts +3 -2
- package/cjs/data-zoom/data-zoom.js +19 -15
- package/cjs/data-zoom/data-zoom.js.map +1 -1
- package/cjs/data-zoom/type.d.ts +6 -0
- package/cjs/data-zoom/type.js +6 -1
- package/cjs/data-zoom/type.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/indicator.js +43 -7
- package/cjs/indicator/indicator.js.map +1 -1
- package/cjs/indicator/type.d.ts +2 -1
- package/cjs/indicator/type.js.map +1 -1
- package/cjs/label/animate/animate.d.ts +8 -2
- package/cjs/label/animate/animate.js +37 -3
- package/cjs/label/animate/animate.js.map +1 -1
- package/cjs/label/arc.d.ts +4 -3
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/area.d.ts +15 -0
- package/cjs/label/area.js +41 -0
- package/cjs/label/area.js.map +1 -0
- package/cjs/label/base.d.ts +18 -15
- package/cjs/label/base.js +64 -49
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.js +8 -5
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/label/index.d.ts +1 -0
- package/cjs/label/index.js +2 -1
- package/cjs/label/index.js.map +1 -1
- package/cjs/label/line.d.ts +2 -2
- package/cjs/label/line.js +4 -11
- package/cjs/label/line.js.map +1 -1
- package/cjs/label/type.d.ts +31 -6
- package/cjs/label/type.js +1 -2
- package/cjs/label/type.js.map +1 -1
- package/cjs/label/util.d.ts +4 -0
- package/cjs/label/util.js +14 -2
- package/cjs/label/util.js.map +1 -1
- package/cjs/legend/discrete/discrete.d.ts +3 -0
- package/cjs/legend/discrete/discrete.js +45 -38
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/legend/discrete/type.d.ts +1 -0
- package/cjs/legend/discrete/type.js.map +1 -1
- package/cjs/link-path/type.js +1 -1
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +1 -1
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +14 -14
- package/cjs/marker/type.js.map +1 -1
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/tag/tag.js +87 -41
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/tag/type.d.ts +4 -5
- package/cjs/tag/type.js.map +1 -1
- package/cjs/title/title.js +85 -53
- package/cjs/title/title.js.map +1 -1
- package/cjs/title/type.d.ts +10 -5
- package/cjs/title/type.js.map +1 -1
- package/cjs/tooltip/tooltip.js +50 -13
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/cjs/tooltip/type.d.ts +7 -2
- package/cjs/tooltip/type.js.map +1 -1
- package/cjs/tooltip/util.js +9 -1
- package/cjs/tooltip/util.js.map +1 -1
- package/cjs/util/label-smartInvert.d.ts +2 -2
- package/cjs/util/label-smartInvert.js +9 -5
- package/cjs/util/label-smartInvert.js.map +1 -1
- package/dist/index.js +602 -348
- package/dist/index.min.js +1 -1
- package/es/axis/base.js +21 -11
- package/es/axis/base.js.map +1 -1
- package/es/axis/circle.d.ts +1 -2
- package/es/axis/circle.js.map +1 -1
- package/es/axis/line.js +1 -1
- package/es/axis/line.js.map +1 -1
- package/es/axis/type.d.ts +5 -6
- package/es/axis/type.js.map +1 -1
- package/es/constant.d.ts +6 -0
- package/es/constant.js +7 -0
- package/es/constant.js.map +1 -1
- package/es/core/type.d.ts +15 -0
- package/es/core/type.js.map +1 -1
- package/es/data-zoom/config.d.ts +0 -6
- package/es/data-zoom/config.js +0 -7
- package/es/data-zoom/config.js.map +1 -1
- package/es/data-zoom/data-zoom.d.ts +3 -2
- package/es/data-zoom/data-zoom.js +10 -4
- package/es/data-zoom/data-zoom.js.map +1 -1
- package/es/data-zoom/type.d.ts +6 -0
- package/es/data-zoom/type.js +6 -1
- package/es/data-zoom/type.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/indicator/indicator.js +44 -6
- package/es/indicator/indicator.js.map +1 -1
- package/es/indicator/type.d.ts +2 -1
- package/es/indicator/type.js.map +1 -1
- package/es/label/animate/animate.d.ts +8 -2
- package/es/label/animate/animate.js +35 -0
- package/es/label/animate/animate.js.map +1 -1
- package/es/label/arc.d.ts +4 -3
- package/es/label/arc.js.map +1 -1
- package/es/label/area.d.ts +15 -0
- package/es/label/area.js +39 -0
- package/es/label/area.js.map +1 -0
- package/es/label/base.d.ts +18 -15
- package/es/label/base.js +66 -50
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.js +11 -4
- package/es/label/dataLabel.js.map +1 -1
- package/es/label/index.d.ts +1 -0
- package/es/label/index.js +2 -0
- package/es/label/index.js.map +1 -1
- package/es/label/line.d.ts +2 -2
- package/es/label/line.js +5 -10
- package/es/label/line.js.map +1 -1
- package/es/label/type.d.ts +31 -6
- package/es/label/type.js +1 -2
- package/es/label/type.js.map +1 -1
- package/es/label/util.d.ts +4 -0
- package/es/label/util.js +13 -1
- package/es/label/util.js.map +1 -1
- package/es/legend/discrete/discrete.d.ts +3 -0
- package/es/legend/discrete/discrete.js +44 -36
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/legend/discrete/type.d.ts +1 -0
- package/es/legend/discrete/type.js.map +1 -1
- package/es/link-path/type.js +1 -1
- package/es/marker/area.js.map +1 -1
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +1 -1
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +14 -14
- package/es/marker/type.js.map +1 -1
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/tag/tag.js +86 -38
- package/es/tag/tag.js.map +1 -1
- package/es/tag/type.d.ts +4 -5
- package/es/tag/type.js.map +1 -1
- package/es/title/title.js +84 -50
- package/es/title/title.js.map +1 -1
- package/es/title/type.d.ts +10 -5
- package/es/title/type.js.map +1 -1
- package/es/tooltip/tooltip.js +52 -13
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/tooltip/type.d.ts +7 -2
- package/es/tooltip/type.js.map +1 -1
- package/es/tooltip/util.js +9 -1
- package/es/tooltip/util.js.map +1 -1
- package/es/util/label-smartInvert.d.ts +2 -2
- package/es/util/label-smartInvert.js +9 -5
- package/es/util/label-smartInvert.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -7463,6 +7463,12 @@
|
|
|
7463
7463
|
}();
|
|
7464
7464
|
RafBasedSTO.TimeOut = 1e3 / 60;
|
|
7465
7465
|
new RafBasedSTO();
|
|
7466
|
+
var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
|
|
7467
|
+
if (vutils.isString(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
7468
|
+
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
7469
|
+
}
|
|
7470
|
+
return lineHeight;
|
|
7471
|
+
};
|
|
7466
7472
|
|
|
7467
7473
|
var IncreaseCount = /*#__PURE__*/function (_ACustomAnimate) {
|
|
7468
7474
|
_inherits(IncreaseCount, _ACustomAnimate);
|
|
@@ -8580,8 +8586,7 @@
|
|
|
8580
8586
|
}, {
|
|
8581
8587
|
key: "addChild",
|
|
8582
8588
|
value: function addChild(node) {
|
|
8583
|
-
|
|
8584
|
-
"__proto__" === node.tagname && (node.tagname = "#__proto__"), node[":@"] && Object.keys(node[":@"]).length > 0 ? this.child.push((_this$child$push2 = {}, _defineProperty(_this$child$push2, node.tagname, node.child), _defineProperty(_this$child$push2, ":@", node[":@"]), _this$child$push2)) : this.child.push(_defineProperty({}, node.tagname, node.child));
|
|
8589
|
+
"__proto__" === node.tagname && (node.tagname = "#__proto__"), node[":@"] && Object.keys(node[":@"]).length > 0 ? this.child.push(_defineProperty(_defineProperty({}, node.tagname, node.child), ":@", node[":@"])) : this.child.push(_defineProperty({}, node.tagname, node.child));
|
|
8585
8590
|
}
|
|
8586
8591
|
}]);
|
|
8587
8592
|
return XmlNode;
|
|
@@ -10044,7 +10049,7 @@
|
|
|
10044
10049
|
}, {
|
|
10045
10050
|
key: "updateWrapAABBBounds",
|
|
10046
10051
|
value: function updateWrapAABBBounds(text) {
|
|
10047
|
-
var _a, _b, _c;
|
|
10052
|
+
var _a, _b, _c, _d;
|
|
10048
10053
|
var textTheme = getTheme(this).text,
|
|
10049
10054
|
_this$attribute = this.attribute,
|
|
10050
10055
|
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
@@ -10055,8 +10060,6 @@
|
|
|
10055
10060
|
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
10056
10061
|
_this$attribute$fontS = _this$attribute.fontSize,
|
|
10057
10062
|
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
10058
|
-
_this$attribute$lineH = _this$attribute.lineHeight,
|
|
10059
|
-
lineHeight = _this$attribute$lineH === void 0 ? this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize : _this$attribute$lineH,
|
|
10060
10063
|
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
10061
10064
|
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
10062
10065
|
maxLineWidth = _this$attribute.maxLineWidth,
|
|
@@ -10073,8 +10076,9 @@
|
|
|
10073
10076
|
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
10074
10077
|
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
10075
10078
|
lineClamp = _this$attribute.lineClamp,
|
|
10079
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
10076
10080
|
buf = ignoreBuf ? 0 : 2;
|
|
10077
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
10081
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10078
10082
|
var _bbox = this.cache.layoutData.bbox;
|
|
10079
10083
|
return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10080
10084
|
}
|
|
@@ -10106,7 +10110,7 @@
|
|
|
10106
10110
|
if ("" !== str && "" === clip.str) {
|
|
10107
10111
|
if (ellipsis) {
|
|
10108
10112
|
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10109
|
-
clip.str = null !== (
|
|
10113
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
10110
10114
|
} else clip.str = "", clip.width = 0;
|
|
10111
10115
|
needCut = !1;
|
|
10112
10116
|
}
|
|
@@ -10203,8 +10207,8 @@
|
|
|
10203
10207
|
whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace;
|
|
10204
10208
|
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
10205
10209
|
var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
|
|
10206
|
-
|
|
10207
|
-
lineHeight =
|
|
10210
|
+
textFontSize = attribute.fontSize || textTheme.fontSize,
|
|
10211
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
|
|
10208
10212
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
10209
10213
|
width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
|
|
10210
10214
|
var _dx = textDrawOffsetX(textAlign, width),
|
|
@@ -10274,12 +10278,11 @@
|
|
|
10274
10278
|
fontFamily = _attribute$fontFamily2 === void 0 ? textTheme.fontFamily : _attribute$fontFamily2,
|
|
10275
10279
|
_attribute$stroke2 = attribute.stroke,
|
|
10276
10280
|
stroke = _attribute$stroke2 === void 0 ? textTheme.stroke : _attribute$stroke2,
|
|
10277
|
-
_attribute$lineHeight2 = attribute.lineHeight,
|
|
10278
|
-
lineHeight = _attribute$lineHeight2 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight2,
|
|
10279
10281
|
_attribute$lineWidth2 = attribute.lineWidth,
|
|
10280
10282
|
lineWidth = _attribute$lineWidth2 === void 0 ? textTheme.lineWidth : _attribute$lineWidth2,
|
|
10281
10283
|
_attribute$verticalMo = attribute.verticalMode,
|
|
10282
|
-
verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo
|
|
10284
|
+
verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo,
|
|
10285
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
10283
10286
|
var _attribute$textAlign2 = attribute.textAlign,
|
|
10284
10287
|
textAlign = _attribute$textAlign2 === void 0 ? textTheme.textAlign : _attribute$textAlign2,
|
|
10285
10288
|
_attribute$textBaseli2 = attribute.textBaseline,
|
|
@@ -10329,7 +10332,7 @@
|
|
|
10329
10332
|
}, {
|
|
10330
10333
|
key: "updateHorizontalMultilineAABBBounds",
|
|
10331
10334
|
value: function updateHorizontalMultilineAABBBounds(text) {
|
|
10332
|
-
var _a;
|
|
10335
|
+
var _a, _b;
|
|
10333
10336
|
var textTheme = getTheme(this).text,
|
|
10334
10337
|
attribute = this.attribute,
|
|
10335
10338
|
_attribute$fontFamily3 = attribute.fontFamily,
|
|
@@ -10342,8 +10345,6 @@
|
|
|
10342
10345
|
fontSize = _attribute$fontSize3 === void 0 ? textTheme.fontSize : _attribute$fontSize3,
|
|
10343
10346
|
_attribute$fontWeight3 = attribute.fontWeight,
|
|
10344
10347
|
fontWeight = _attribute$fontWeight3 === void 0 ? textTheme.fontWeight : _attribute$fontWeight3,
|
|
10345
|
-
_attribute$lineHeight3 = attribute.lineHeight,
|
|
10346
|
-
lineHeight = _attribute$lineHeight3 === void 0 ? attribute.lineHeight || attribute.fontSize || textTheme.fontSize : _attribute$lineHeight3,
|
|
10347
10348
|
_attribute$ellipsis3 = attribute.ellipsis,
|
|
10348
10349
|
ellipsis = _attribute$ellipsis3 === void 0 ? textTheme.ellipsis : _attribute$ellipsis3,
|
|
10349
10350
|
maxLineWidth = attribute.maxLineWidth,
|
|
@@ -10352,9 +10353,10 @@
|
|
|
10352
10353
|
_attribute$lineWidth3 = attribute.lineWidth,
|
|
10353
10354
|
lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
|
|
10354
10355
|
_attribute$whiteSpace2 = attribute.whiteSpace,
|
|
10355
|
-
whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2
|
|
10356
|
+
whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2,
|
|
10357
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
|
|
10356
10358
|
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
10357
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
10359
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10358
10360
|
var _bbox2 = this.cache.layoutData.bbox;
|
|
10359
10361
|
return this._AABBBounds.set(_bbox2.xOffset, _bbox2.yOffset, _bbox2.xOffset + _bbox2.width, _bbox2.yOffset + _bbox2.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10360
10362
|
}
|
|
@@ -10390,12 +10392,11 @@
|
|
|
10390
10392
|
fontWeight = _attribute$fontWeight4 === void 0 ? textTheme.fontWeight : _attribute$fontWeight4,
|
|
10391
10393
|
_attribute$stroke4 = attribute.stroke,
|
|
10392
10394
|
stroke = _attribute$stroke4 === void 0 ? textTheme.stroke : _attribute$stroke4,
|
|
10393
|
-
_attribute$lineHeight4 = attribute.lineHeight,
|
|
10394
|
-
lineHeight = _attribute$lineHeight4 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight4,
|
|
10395
10395
|
_attribute$lineWidth4 = attribute.lineWidth,
|
|
10396
10396
|
lineWidth = _attribute$lineWidth4 === void 0 ? textTheme.lineWidth : _attribute$lineWidth4,
|
|
10397
10397
|
_attribute$verticalMo2 = attribute.verticalMode,
|
|
10398
|
-
verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2
|
|
10398
|
+
verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2,
|
|
10399
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
10399
10400
|
var _attribute$textAlign4 = attribute.textAlign,
|
|
10400
10401
|
textAlign = _attribute$textAlign4 === void 0 ? textTheme.textAlign : _attribute$textAlign4,
|
|
10401
10402
|
_attribute$textBaseli4 = attribute.textBaseline,
|
|
@@ -10528,7 +10529,7 @@
|
|
|
10528
10529
|
}, {
|
|
10529
10530
|
key: "updateMultilineAABBBounds",
|
|
10530
10531
|
value: function updateMultilineAABBBounds(text) {
|
|
10531
|
-
var _a, _b, _c;
|
|
10532
|
+
var _a, _b, _c, _d;
|
|
10532
10533
|
var textTheme = getTheme(this).text,
|
|
10533
10534
|
_this$attribute = this.attribute,
|
|
10534
10535
|
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
@@ -10539,8 +10540,6 @@
|
|
|
10539
10540
|
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
10540
10541
|
_this$attribute$fontS = _this$attribute.fontSize,
|
|
10541
10542
|
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
10542
|
-
_this$attribute$lineH = _this$attribute.lineHeight,
|
|
10543
|
-
lineHeight = _this$attribute$lineH === void 0 ? this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize : _this$attribute$lineH,
|
|
10544
10543
|
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
10545
10544
|
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
10546
10545
|
maxLineWidth = _this$attribute.maxLineWidth,
|
|
@@ -10557,8 +10556,9 @@
|
|
|
10557
10556
|
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
10558
10557
|
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
10559
10558
|
lineClamp = _this$attribute.lineClamp,
|
|
10559
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
10560
10560
|
buf = ignoreBuf ? 0 : 2;
|
|
10561
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
10561
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10562
10562
|
var _bbox = this.cache.layoutData.bbox;
|
|
10563
10563
|
return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10564
10564
|
}
|
|
@@ -10590,7 +10590,7 @@
|
|
|
10590
10590
|
if ("" !== str && "" === clip.str) {
|
|
10591
10591
|
if (ellipsis) {
|
|
10592
10592
|
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10593
|
-
clip.str = null !== (
|
|
10593
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
10594
10594
|
} else clip.str = "", clip.width = 0;
|
|
10595
10595
|
needCut = !1;
|
|
10596
10596
|
}
|
|
@@ -11337,32 +11337,37 @@
|
|
|
11337
11337
|
}(BaseSymbol);
|
|
11338
11338
|
var close$1 = new CloseSymbol();
|
|
11339
11339
|
|
|
11340
|
-
function
|
|
11340
|
+
function rectSizeArray(ctx, size, x, y) {
|
|
11341
11341
|
return ctx.rect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]), !1;
|
|
11342
11342
|
}
|
|
11343
|
+
function rectSize(ctx, size, x, y) {
|
|
11344
|
+
var w = size,
|
|
11345
|
+
h = size / 2;
|
|
11346
|
+
return ctx.rect(x - w / 2, y - h / 2, w, h), !1;
|
|
11347
|
+
}
|
|
11343
11348
|
var RectSymbol = /*#__PURE__*/function (_BaseSymbol) {
|
|
11344
11349
|
_inherits(RectSymbol, _BaseSymbol);
|
|
11345
11350
|
var _super = _createSuper(RectSymbol);
|
|
11346
11351
|
function RectSymbol() {
|
|
11347
11352
|
var _this;
|
|
11348
11353
|
_classCallCheck(this, RectSymbol);
|
|
11349
|
-
_this = _super.apply(this, arguments), _this.type = "rect", _this.pathStr = "M-0.5,-0.
|
|
11354
|
+
_this = _super.apply(this, arguments), _this.type = "rect", _this.pathStr = "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z";
|
|
11350
11355
|
return _this;
|
|
11351
11356
|
}
|
|
11352
11357
|
_createClass(RectSymbol, [{
|
|
11353
11358
|
key: "draw",
|
|
11354
11359
|
value: function draw(ctx, size, x, y) {
|
|
11355
|
-
return
|
|
11360
|
+
return vutils.isNumber(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
|
|
11356
11361
|
}
|
|
11357
11362
|
}, {
|
|
11358
11363
|
key: "drawOffset",
|
|
11359
11364
|
value: function drawOffset(ctx, size, x, y, offset) {
|
|
11360
|
-
return
|
|
11365
|
+
return vutils.isNumber(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
|
|
11361
11366
|
}
|
|
11362
11367
|
}]);
|
|
11363
11368
|
return RectSymbol;
|
|
11364
11369
|
}(BaseSymbol);
|
|
11365
|
-
var rect
|
|
11370
|
+
var rect = new RectSymbol();
|
|
11366
11371
|
|
|
11367
11372
|
var tempBounds = new vutils.AABBBounds();
|
|
11368
11373
|
var CustomSymbolClass = /*#__PURE__*/function () {
|
|
@@ -11401,11 +11406,17 @@
|
|
|
11401
11406
|
return CustomSymbolClass;
|
|
11402
11407
|
}();
|
|
11403
11408
|
|
|
11404
|
-
var builtinSymbols = [circle$1, cross$1, diamond$1, square$1, thinTriangle$1, triangle, star$1, arrow$1, wedge$1, stroke$1, wye$1, triangleLeft, triangleRight, triangleUp, triangleDown, arrow2Left$1, arrow2Right$1, arrow2Up$1, arrow2Down$1, rect
|
|
11409
|
+
var builtinSymbols = [circle$1, cross$1, diamond$1, square$1, thinTriangle$1, triangle, star$1, arrow$1, wedge$1, stroke$1, wye$1, triangleLeft, triangleRight, triangleUp, triangleDown, arrow2Left$1, arrow2Right$1, arrow2Up$1, arrow2Down$1, rect, lineV$1, lineH$1, close$1];
|
|
11405
11410
|
var builtinSymbolsMap = {};
|
|
11406
11411
|
builtinSymbols.forEach(function (symbol) {
|
|
11407
11412
|
builtinSymbolsMap[symbol.type] = symbol;
|
|
11408
11413
|
});
|
|
11414
|
+
var builtInSymbolStrMap = {
|
|
11415
|
+
arrowLeft: "M 0.25 -0.5 L -0.25 0 l 0.5 0.5",
|
|
11416
|
+
arrowRight: "M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",
|
|
11417
|
+
rectRound: "M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",
|
|
11418
|
+
roundLine: "M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"
|
|
11419
|
+
};
|
|
11409
11420
|
|
|
11410
11421
|
var SYMBOL_UPDATE_TAG_KEY = ["symbolType", "size"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
11411
11422
|
var _Symbol = /*#__PURE__*/function (_Graphic) {
|
|
@@ -11439,12 +11450,13 @@
|
|
|
11439
11450
|
}, {
|
|
11440
11451
|
key: "doUpdateParsedPath",
|
|
11441
11452
|
value: function doUpdateParsedPath() {
|
|
11442
|
-
var symbolTheme = getTheme(this).symbol
|
|
11443
|
-
|
|
11444
|
-
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo
|
|
11445
|
-
|
|
11453
|
+
var symbolTheme = getTheme(this).symbol;
|
|
11454
|
+
var _this$attribute$symbo = this.attribute.symbolType,
|
|
11455
|
+
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo,
|
|
11456
|
+
path = builtinSymbolsMap[symbolType];
|
|
11446
11457
|
if (path) return this._parsedPath = path, path;
|
|
11447
11458
|
if (path = _Symbol.userSymbolMap[symbolType], path) return this._parsedPath = path, path;
|
|
11459
|
+
symbolType = builtInSymbolStrMap[symbolType] || symbolType;
|
|
11448
11460
|
if (!0 === isSvg(symbolType)) {
|
|
11449
11461
|
var parser = new XMLParser(),
|
|
11450
11462
|
_parser$parse = parser.parse(symbolType),
|
|
@@ -11930,7 +11942,9 @@
|
|
|
11930
11942
|
var Paragraph = /*#__PURE__*/function () {
|
|
11931
11943
|
function Paragraph(text, newLine, character) {
|
|
11932
11944
|
_classCallCheck(this, Paragraph);
|
|
11933
|
-
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic"
|
|
11945
|
+
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
|
|
11946
|
+
var lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
11947
|
+
this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
|
|
11934
11948
|
var _measureTextCanvas = measureTextCanvas(text, character),
|
|
11935
11949
|
ascent = _measureTextCanvas.ascent,
|
|
11936
11950
|
height = _measureTextCanvas.height,
|
|
@@ -12469,7 +12483,8 @@
|
|
|
12469
12483
|
var _this2 = this;
|
|
12470
12484
|
var _a;
|
|
12471
12485
|
var _this$attribute = this.attribute,
|
|
12472
|
-
|
|
12486
|
+
_this$attribute$textC = _this$attribute.textConfig,
|
|
12487
|
+
textConfig = _this$attribute$textC === void 0 ? [] : _this$attribute$textC,
|
|
12473
12488
|
maxWidth = _this$attribute.maxWidth,
|
|
12474
12489
|
maxHeight = _this$attribute.maxHeight,
|
|
12475
12490
|
width = _this$attribute.width,
|
|
@@ -15461,7 +15476,7 @@
|
|
|
15461
15476
|
var t = textAlign;
|
|
15462
15477
|
textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
|
|
15463
15478
|
}
|
|
15464
|
-
var lineHeight = null !== (_c = text.attribute.lineHeight) && void 0 !== _c ? _c : fontSize,
|
|
15479
|
+
var lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
|
|
15465
15480
|
data = this.valid(text, textAttribute, fillCb, strokeCb);
|
|
15466
15481
|
if (!data) return;
|
|
15467
15482
|
var fVisible = data.fVisible,
|
|
@@ -20781,18 +20796,18 @@
|
|
|
20781
20796
|
|
|
20782
20797
|
const defaultAlternativeColors = ['#ffffff', '#000000'];
|
|
20783
20798
|
const { Color } = vutils.ColorUtil;
|
|
20784
|
-
function labelSmartInvert(foregroundColorOrigin, backgroundColorOrogin, textType, contrastRatiosThreshold, alternativeColors) {
|
|
20799
|
+
function labelSmartInvert(foregroundColorOrigin, backgroundColorOrogin, textType, contrastRatiosThreshold, alternativeColors, mode) {
|
|
20785
20800
|
if (typeof foregroundColorOrigin !== 'string' || typeof backgroundColorOrogin !== 'string') {
|
|
20786
20801
|
return foregroundColorOrigin;
|
|
20787
20802
|
}
|
|
20788
20803
|
const foregroundColor = new Color(foregroundColorOrigin).toHex();
|
|
20789
20804
|
const backgroundColor = new Color(backgroundColorOrogin).toHex();
|
|
20790
|
-
if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold)) {
|
|
20791
|
-
return improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
|
|
20805
|
+
if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, mode)) {
|
|
20806
|
+
return improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode);
|
|
20792
20807
|
}
|
|
20793
20808
|
return foregroundColor;
|
|
20794
20809
|
}
|
|
20795
|
-
function improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors) {
|
|
20810
|
+
function improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode) {
|
|
20796
20811
|
const alternativeColorPalletes = [];
|
|
20797
20812
|
if (alternativeColors) {
|
|
20798
20813
|
if (alternativeColors instanceof Array) {
|
|
@@ -20807,13 +20822,27 @@
|
|
|
20807
20822
|
if (foregroundColor === alternativeColor) {
|
|
20808
20823
|
continue;
|
|
20809
20824
|
}
|
|
20810
|
-
if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold)) {
|
|
20825
|
+
if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold, mode)) {
|
|
20811
20826
|
return alternativeColor;
|
|
20812
20827
|
}
|
|
20813
20828
|
}
|
|
20814
20829
|
return undefined;
|
|
20815
20830
|
}
|
|
20816
|
-
function contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold) {
|
|
20831
|
+
function contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, mode) {
|
|
20832
|
+
if (mode === 'lightness') {
|
|
20833
|
+
const backgroundColorLightness = Color.getColorBrightness(new Color(backgroundColor));
|
|
20834
|
+
const foregroundColorLightness = Color.getColorBrightness(new Color(foregroundColor));
|
|
20835
|
+
if (foregroundColorLightness < 0.5) {
|
|
20836
|
+
if (backgroundColorLightness >= 0.5) {
|
|
20837
|
+
return true;
|
|
20838
|
+
}
|
|
20839
|
+
return false;
|
|
20840
|
+
}
|
|
20841
|
+
if (backgroundColorLightness < 0.5) {
|
|
20842
|
+
return true;
|
|
20843
|
+
}
|
|
20844
|
+
return false;
|
|
20845
|
+
}
|
|
20817
20846
|
if (contrastRatiosThreshold) {
|
|
20818
20847
|
if (contrastRatios(foregroundColor, backgroundColor) > contrastRatiosThreshold) {
|
|
20819
20848
|
return true;
|
|
@@ -20940,6 +20969,12 @@
|
|
|
20940
20969
|
[StateValue.hover]: {},
|
|
20941
20970
|
[StateValue.hoverReverse]: {}
|
|
20942
20971
|
};
|
|
20972
|
+
const DEFAULT_HTML_TEXT_SPEC = {
|
|
20973
|
+
container: '',
|
|
20974
|
+
width: 30,
|
|
20975
|
+
height: 30,
|
|
20976
|
+
style: {}
|
|
20977
|
+
};
|
|
20943
20978
|
|
|
20944
20979
|
const initTextMeasure = (textSpec, option, useNaiveCanvas) => {
|
|
20945
20980
|
return new vutils.TextMeasure(Object.assign({ defaultFontParams: {
|
|
@@ -20972,8 +21007,8 @@
|
|
|
20972
21007
|
this.name = 'tag';
|
|
20973
21008
|
}
|
|
20974
21009
|
render() {
|
|
20975
|
-
var _a;
|
|
20976
|
-
const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state } = this.attribute;
|
|
21010
|
+
var _a, _b, _c;
|
|
21011
|
+
const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type } = this.attribute;
|
|
20977
21012
|
const parsedPadding = vutils.normalizePadding(padding);
|
|
20978
21013
|
const group = this.createOrUpdateChild('tag-content', { x: 0, y: 0, zIndex: 1 }, 'group');
|
|
20979
21014
|
let symbol;
|
|
@@ -20995,75 +21030,100 @@
|
|
|
20995
21030
|
}
|
|
20996
21031
|
tagWidth += symbolPlaceWidth;
|
|
20997
21032
|
textX += symbolPlaceWidth;
|
|
20998
|
-
|
|
20999
|
-
if (
|
|
21000
|
-
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
|
|
21004
|
-
|
|
21005
|
-
|
|
21006
|
-
|
|
21007
|
-
|
|
21008
|
-
const textHeight = textBounds.height;
|
|
21009
|
-
tagWidth += textWidth;
|
|
21010
|
-
const size = (_a = shape.size) !== null && _a !== void 0 ? _a : 10;
|
|
21011
|
-
const maxSize = vutils.isNumber(size) ? size : Math.max(size[0], size[1]);
|
|
21012
|
-
tagHeight += Math.max(textHeight, (shape === null || shape === void 0 ? void 0 : shape.visible) ? maxSize : 0);
|
|
21013
|
-
const { textAlign, textBaseline } = textStyle;
|
|
21014
|
-
if (vutils.isValid(minWidth) || vutils.isValid(maxWidth)) {
|
|
21015
|
-
if (vutils.isValid(minWidth) && tagWidth < minWidth) {
|
|
21016
|
-
tagWidth = minWidth;
|
|
21017
|
-
}
|
|
21018
|
-
if (vutils.isValid(maxWidth) && tagWidth > maxWidth) {
|
|
21019
|
-
tagWidth = maxWidth;
|
|
21020
|
-
textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
|
|
21021
|
-
}
|
|
21022
|
-
}
|
|
21023
|
-
let x = 0;
|
|
21024
|
-
let y = 0;
|
|
21025
|
-
if (textAlign === 'center') {
|
|
21026
|
-
x -= tagWidth / 2;
|
|
21027
|
-
if (symbol) {
|
|
21028
|
-
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
|
|
21033
|
+
let textShape;
|
|
21034
|
+
if (type === 'rich') {
|
|
21035
|
+
const richTextAttrs = Object.assign(Object.assign({ textConfig: text, visible: vutils.isValid(text) && visible !== false }, textStyle), { x: textX, y: 0, width: (_a = textStyle.width) !== null && _a !== void 0 ? _a : 0, height: (_b = textStyle.height) !== null && _b !== void 0 ? _b : 0 });
|
|
21036
|
+
textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext');
|
|
21037
|
+
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
21038
|
+
if (visible && vutils.isBoolean(bgVisible)) {
|
|
21039
|
+
const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x: textShape.AABBBounds.x1, y: textShape.AABBBounds.y1, width: textShape.AABBBounds.width(), height: textShape.AABBBounds.height() }), 'rect');
|
|
21040
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
21041
|
+
bgRect.states = state.panel;
|
|
21042
|
+
}
|
|
21029
21043
|
}
|
|
21030
|
-
group.setAttribute('x', -symbolPlaceWidth / 2);
|
|
21031
21044
|
}
|
|
21032
|
-
else if (
|
|
21033
|
-
x
|
|
21034
|
-
|
|
21035
|
-
|
|
21045
|
+
else if (type === 'html') {
|
|
21046
|
+
const richTextAttrs = Object.assign(Object.assign({ textConfig: [], visible: vutils.isValid(text) && visible !== false, html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle) }, textStyle), { x: textX, y: 0 });
|
|
21047
|
+
textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext');
|
|
21048
|
+
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
21049
|
+
if (visible && vutils.isBoolean(bgVisible)) {
|
|
21050
|
+
const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x: textShape.AABBBounds.x1, y: textShape.AABBBounds.y1, width: textShape.AABBBounds.width(), height: textShape.AABBBounds.height() }), 'rect');
|
|
21051
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
21052
|
+
bgRect.states = state.panel;
|
|
21053
|
+
}
|
|
21036
21054
|
}
|
|
21037
|
-
group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
|
|
21038
21055
|
}
|
|
21039
|
-
else
|
|
21040
|
-
|
|
21041
|
-
|
|
21042
|
-
|
|
21043
|
-
|
|
21044
|
-
|
|
21045
|
-
|
|
21056
|
+
else {
|
|
21057
|
+
const textAttrs = Object.assign(Object.assign({ text: text, visible: vutils.isValid(text) && visible !== false, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize }, textStyle), { x: textX, y: 0 });
|
|
21058
|
+
if (vutils.isNil(textAttrs.lineHeight)) {
|
|
21059
|
+
textAttrs.lineHeight = textStyle.fontSize;
|
|
21060
|
+
}
|
|
21061
|
+
textShape = group.createOrUpdateChild('tag-text', textAttrs, 'text');
|
|
21062
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.text)) {
|
|
21063
|
+
textShape.states = state.text;
|
|
21064
|
+
}
|
|
21065
|
+
const textBounds = measureTextSize(textAttrs.text, textStyle);
|
|
21066
|
+
const textWidth = textBounds.width;
|
|
21067
|
+
const textHeight = textBounds.height;
|
|
21068
|
+
tagWidth += textWidth;
|
|
21069
|
+
const size = (_c = shape.size) !== null && _c !== void 0 ? _c : 10;
|
|
21070
|
+
const maxSize = vutils.isNumber(size) ? size : Math.max(size[0], size[1]);
|
|
21071
|
+
tagHeight += Math.max(textHeight, (shape === null || shape === void 0 ? void 0 : shape.visible) ? maxSize : 0);
|
|
21072
|
+
const { textAlign, textBaseline } = textStyle;
|
|
21073
|
+
if (vutils.isValid(minWidth) || vutils.isValid(maxWidth)) {
|
|
21074
|
+
if (vutils.isValid(minWidth) && tagWidth < minWidth) {
|
|
21075
|
+
tagWidth = minWidth;
|
|
21076
|
+
}
|
|
21077
|
+
if (vutils.isValid(maxWidth) && tagWidth > maxWidth) {
|
|
21078
|
+
tagWidth = maxWidth;
|
|
21079
|
+
textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
|
|
21080
|
+
}
|
|
21046
21081
|
}
|
|
21047
|
-
|
|
21048
|
-
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
symbol
|
|
21082
|
+
let x = 0;
|
|
21083
|
+
let y = 0;
|
|
21084
|
+
if (textAlign === 'center') {
|
|
21085
|
+
x -= tagWidth / 2;
|
|
21086
|
+
if (symbol) {
|
|
21087
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
|
|
21088
|
+
}
|
|
21089
|
+
group.setAttribute('x', -symbolPlaceWidth / 2);
|
|
21052
21090
|
}
|
|
21053
|
-
|
|
21054
|
-
|
|
21055
|
-
|
|
21056
|
-
|
|
21057
|
-
|
|
21058
|
-
|
|
21091
|
+
else if (textAlign === 'right' || textAlign === 'end') {
|
|
21092
|
+
x -= tagWidth;
|
|
21093
|
+
if (symbol) {
|
|
21094
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
|
|
21095
|
+
}
|
|
21096
|
+
group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
|
|
21059
21097
|
}
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
y
|
|
21065
|
-
|
|
21066
|
-
|
|
21098
|
+
else if (textAlign === 'left' || textAlign === 'start') {
|
|
21099
|
+
group.setAttribute('x', parsedPadding[3]);
|
|
21100
|
+
}
|
|
21101
|
+
if (textBaseline === 'middle') {
|
|
21102
|
+
y -= tagHeight / 2;
|
|
21103
|
+
if (symbol) {
|
|
21104
|
+
symbol.setAttribute('y', 0);
|
|
21105
|
+
}
|
|
21106
|
+
}
|
|
21107
|
+
else if (textBaseline === 'bottom') {
|
|
21108
|
+
y -= tagHeight;
|
|
21109
|
+
if (symbol) {
|
|
21110
|
+
symbol.setAttribute('y', -textHeight / 2);
|
|
21111
|
+
}
|
|
21112
|
+
group.setAttribute('y', -parsedPadding[2]);
|
|
21113
|
+
}
|
|
21114
|
+
else if (textBaseline === 'top') {
|
|
21115
|
+
group.setAttribute('y', parsedPadding[0]);
|
|
21116
|
+
if (symbol) {
|
|
21117
|
+
symbol.setAttribute('y', textHeight / 2);
|
|
21118
|
+
}
|
|
21119
|
+
}
|
|
21120
|
+
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
21121
|
+
if (visible && vutils.isBoolean(bgVisible)) {
|
|
21122
|
+
const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x,
|
|
21123
|
+
y, width: tagWidth, height: tagHeight }), 'rect');
|
|
21124
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
21125
|
+
bgRect.states = state.panel;
|
|
21126
|
+
}
|
|
21067
21127
|
}
|
|
21068
21128
|
}
|
|
21069
21129
|
}
|
|
@@ -21935,6 +21995,45 @@
|
|
|
21935
21995
|
var _a, _b;
|
|
21936
21996
|
return (_b = (_a = animationEffects[type]) === null || _a === void 0 ? void 0 : _a.call(animationEffects, textAttribute)) !== null && _b !== void 0 ? _b : { from: {}, to: {} };
|
|
21937
21997
|
}
|
|
21998
|
+
function updateAnimation(prev, next, animationConfig) {
|
|
21999
|
+
if (!vutils.isArray(animationConfig)) {
|
|
22000
|
+
const { duration, easing, increaseEffect = true } = animationConfig;
|
|
22001
|
+
prev.animate().to(next.attribute, duration, easing);
|
|
22002
|
+
increaseEffect && playIncreaseCount(prev, next, duration, easing);
|
|
22003
|
+
return;
|
|
22004
|
+
}
|
|
22005
|
+
animationConfig.forEach((cfg, i) => {
|
|
22006
|
+
const { duration, easing, increaseEffect = true, channel } = cfg;
|
|
22007
|
+
const { from, to } = update(prev, next, channel, cfg.options);
|
|
22008
|
+
if (!vutils.isEmpty(to)) {
|
|
22009
|
+
prev.animate().to(to, duration, easing);
|
|
22010
|
+
}
|
|
22011
|
+
if ('text' in from && 'text' in to && increaseEffect) {
|
|
22012
|
+
playIncreaseCount(prev, next, duration, easing);
|
|
22013
|
+
}
|
|
22014
|
+
});
|
|
22015
|
+
}
|
|
22016
|
+
const update = (prev, next, channel, options) => {
|
|
22017
|
+
const from = Object.assign({}, prev.attribute);
|
|
22018
|
+
const to = Object.assign({}, next.attribute);
|
|
22019
|
+
vutils.array(options === null || options === void 0 ? void 0 : options.excludeChannels).forEach(key => {
|
|
22020
|
+
delete to[key];
|
|
22021
|
+
});
|
|
22022
|
+
Object.keys(to).forEach(key => {
|
|
22023
|
+
if (channel && !channel.includes(key)) {
|
|
22024
|
+
delete to[key];
|
|
22025
|
+
}
|
|
22026
|
+
});
|
|
22027
|
+
return { from, to };
|
|
22028
|
+
};
|
|
22029
|
+
function playIncreaseCount(prev, next, duration, easing) {
|
|
22030
|
+
if (prev.attribute.text !== next.attribute.text &&
|
|
22031
|
+
vutils.isValidNumber(Number(prev.attribute.text) * Number(next.attribute.text))) {
|
|
22032
|
+
prev
|
|
22033
|
+
.animate()
|
|
22034
|
+
.play(new IncreaseCount({ text: prev.attribute.text }, { text: next.attribute.text }, duration, easing));
|
|
22035
|
+
}
|
|
22036
|
+
}
|
|
21938
22037
|
const DefaultLabelAnimation = {
|
|
21939
22038
|
mode: 'same-time',
|
|
21940
22039
|
duration: 300,
|
|
@@ -22128,6 +22227,24 @@
|
|
|
22128
22227
|
}
|
|
22129
22228
|
return points;
|
|
22130
22229
|
};
|
|
22230
|
+
function labelingLineOrArea(textBounds, graphicBounds, position = 'end', offset = 0) {
|
|
22231
|
+
if (!textBounds || !graphicBounds) {
|
|
22232
|
+
return;
|
|
22233
|
+
}
|
|
22234
|
+
const { x1, x2 } = textBounds;
|
|
22235
|
+
const width = Math.abs(x2 - x1);
|
|
22236
|
+
const anchorX = graphicBounds.x1;
|
|
22237
|
+
const anchorY = graphicBounds.y1;
|
|
22238
|
+
let x = anchorX;
|
|
22239
|
+
const y = anchorY;
|
|
22240
|
+
if (position === 'end') {
|
|
22241
|
+
x = anchorX + width / 2 + offset;
|
|
22242
|
+
}
|
|
22243
|
+
else if (position === 'start') {
|
|
22244
|
+
x = anchorX - width / 2 - offset;
|
|
22245
|
+
}
|
|
22246
|
+
return { x, y };
|
|
22247
|
+
}
|
|
22131
22248
|
|
|
22132
22249
|
class LabelBase extends AbstractComponent {
|
|
22133
22250
|
setBitmap(bitmap) {
|
|
@@ -22275,13 +22392,31 @@
|
|
|
22275
22392
|
target.states = state;
|
|
22276
22393
|
}
|
|
22277
22394
|
_createLabelText(attributes) {
|
|
22395
|
+
var _a, _b;
|
|
22396
|
+
if (attributes.textType === 'rich') {
|
|
22397
|
+
attributes.textConfig = attributes.text;
|
|
22398
|
+
attributes.width = (_a = attributes.width) !== null && _a !== void 0 ? _a : 0;
|
|
22399
|
+
attributes.height = (_b = attributes.height) !== null && _b !== void 0 ? _b : 0;
|
|
22400
|
+
const text = createRichText(attributes);
|
|
22401
|
+
this._bindEvent(text);
|
|
22402
|
+
this._setStatesOfText(text);
|
|
22403
|
+
return text;
|
|
22404
|
+
}
|
|
22405
|
+
else if (attributes.textType === 'html') {
|
|
22406
|
+
attributes.textConfig = [];
|
|
22407
|
+
attributes.html = Object.assign(Object.assign({ dom: attributes.text }, DEFAULT_HTML_TEXT_SPEC), attributes);
|
|
22408
|
+
const text = createRichText(attributes);
|
|
22409
|
+
this._bindEvent(text);
|
|
22410
|
+
this._setStatesOfText(text);
|
|
22411
|
+
return text;
|
|
22412
|
+
}
|
|
22278
22413
|
const text = createText(attributes);
|
|
22279
22414
|
this._bindEvent(text);
|
|
22280
22415
|
this._setStatesOfText(text);
|
|
22281
22416
|
return text;
|
|
22282
22417
|
}
|
|
22283
22418
|
_prepare() {
|
|
22284
|
-
var _a, _b, _c, _d;
|
|
22419
|
+
var _a, _b, _c, _d, _e;
|
|
22285
22420
|
const currentBaseMarks = [];
|
|
22286
22421
|
let baseMarks;
|
|
22287
22422
|
if (vutils.isFunction(this.attribute.getBaseMarks)) {
|
|
@@ -22298,7 +22433,7 @@
|
|
|
22298
22433
|
(_a = this._idToGraphic) === null || _a === void 0 ? void 0 : _a.clear();
|
|
22299
22434
|
(_b = this._idToPoint) === null || _b === void 0 ? void 0 : _b.clear();
|
|
22300
22435
|
this._baseMarks = currentBaseMarks;
|
|
22301
|
-
this._isCollectionBase =
|
|
22436
|
+
this._isCollectionBase = this.attribute.type === 'line-data';
|
|
22302
22437
|
if (!currentBaseMarks || currentBaseMarks.length === 0) {
|
|
22303
22438
|
return;
|
|
22304
22439
|
}
|
|
@@ -22344,6 +22479,15 @@
|
|
|
22344
22479
|
}
|
|
22345
22480
|
}
|
|
22346
22481
|
}
|
|
22482
|
+
if (this.attribute.animation !== false) {
|
|
22483
|
+
this._animationConfig = {
|
|
22484
|
+
enter: vutils.merge({}, DefaultLabelAnimation, this.attribute.animation, (_c = this.attribute.animationEnter) !== null && _c !== void 0 ? _c : {}),
|
|
22485
|
+
exit: vutils.merge({}, DefaultLabelAnimation, this.attribute.animation, (_d = this.attribute.animationExit) !== null && _d !== void 0 ? _d : {}),
|
|
22486
|
+
update: vutils.isArray(this.attribute.animationUpdate)
|
|
22487
|
+
? this.attribute.animationUpdate
|
|
22488
|
+
: vutils.merge({}, DefaultLabelAnimation, this.attribute.animation, (_e = this.attribute.animationUpdate) !== null && _e !== void 0 ? _e : {})
|
|
22489
|
+
};
|
|
22490
|
+
}
|
|
22347
22491
|
}
|
|
22348
22492
|
getRelatedGrphic(item) {
|
|
22349
22493
|
return this._idToGraphic.get(item.id);
|
|
@@ -22361,10 +22505,11 @@
|
|
|
22361
22505
|
: baseMark.attribute.fill }, textStyle), textData);
|
|
22362
22506
|
const text = this._createLabelText(labelAttribute);
|
|
22363
22507
|
const textBounds = this.getGraphicBounds(text);
|
|
22508
|
+
const actualPosition = vutils.isFunction(position) ? position(textData) : position;
|
|
22364
22509
|
const graphicBounds = this._isCollectionBase
|
|
22365
|
-
? this.getGraphicBounds(null, this._idToPoint.get(textData.id))
|
|
22366
|
-
: this.getGraphicBounds(baseMark, { x: textData.x, y: textData.y });
|
|
22367
|
-
const textLocation = this.labeling(textBounds, graphicBounds,
|
|
22510
|
+
? this.getGraphicBounds(null, this._idToPoint.get(textData.id), actualPosition)
|
|
22511
|
+
: this.getGraphicBounds(baseMark, { x: textData.x, y: textData.y }, actualPosition);
|
|
22512
|
+
const textLocation = this.labeling(textBounds, graphicBounds, actualPosition, offset);
|
|
22368
22513
|
if (textLocation) {
|
|
22369
22514
|
labelAttribute.x = textLocation.x;
|
|
22370
22515
|
labelAttribute.y = textLocation.y;
|
|
@@ -22445,13 +22590,19 @@
|
|
|
22445
22590
|
}
|
|
22446
22591
|
if (!hasPlace && clampForce) {
|
|
22447
22592
|
const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);
|
|
22448
|
-
if (
|
|
22449
|
-
canPlace(bmpTool, bitmap, {
|
|
22450
|
-
|
|
22451
|
-
|
|
22452
|
-
|
|
22453
|
-
|
|
22454
|
-
|
|
22593
|
+
if (dx === 0 && dy === 0) {
|
|
22594
|
+
if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
|
|
22595
|
+
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
22596
|
+
result.push(text);
|
|
22597
|
+
continue;
|
|
22598
|
+
}
|
|
22599
|
+
}
|
|
22600
|
+
else if (canPlace(bmpTool, bitmap, {
|
|
22601
|
+
x1: text.AABBBounds.x1 + dx,
|
|
22602
|
+
x2: text.AABBBounds.x2 + dx,
|
|
22603
|
+
y1: text.AABBBounds.y1 + dy,
|
|
22604
|
+
y2: text.AABBBounds.y2 + dy
|
|
22605
|
+
})) {
|
|
22455
22606
|
text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
|
|
22456
22607
|
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
22457
22608
|
result.push(text);
|
|
@@ -22491,12 +22642,6 @@
|
|
|
22491
22642
|
}
|
|
22492
22643
|
}
|
|
22493
22644
|
_renderWithAnimation(labels) {
|
|
22494
|
-
var _a, _b, _c, _d, _e;
|
|
22495
|
-
const animationConfig = ((_a = this.attribute.animation) !== null && _a !== void 0 ? _a : {});
|
|
22496
|
-
const mode = (_b = animationConfig.mode) !== null && _b !== void 0 ? _b : DefaultLabelAnimation.mode;
|
|
22497
|
-
const duration = (_c = animationConfig.duration) !== null && _c !== void 0 ? _c : DefaultLabelAnimation.duration;
|
|
22498
|
-
const easing = (_d = animationConfig.easing) !== null && _d !== void 0 ? _d : DefaultLabelAnimation.easing;
|
|
22499
|
-
const delay = (_e = animationConfig.delay) !== null && _e !== void 0 ? _e : 0;
|
|
22500
22645
|
const currentTextMap = new Map();
|
|
22501
22646
|
const prevTextMap = this._graphicToText || new Map();
|
|
22502
22647
|
const texts = [];
|
|
@@ -22520,13 +22665,7 @@
|
|
|
22520
22665
|
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
22521
22666
|
relatedGraphic.once('animate-bind', a => {
|
|
22522
22667
|
text.setAttributes(from);
|
|
22523
|
-
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic,
|
|
22524
|
-
mode,
|
|
22525
|
-
duration,
|
|
22526
|
-
easing,
|
|
22527
|
-
to,
|
|
22528
|
-
delay
|
|
22529
|
-
});
|
|
22668
|
+
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, this._animationConfig.enter);
|
|
22530
22669
|
relatedGraphic.on('afterAttributeUpdate', listener);
|
|
22531
22670
|
});
|
|
22532
22671
|
}
|
|
@@ -22536,25 +22675,19 @@
|
|
|
22536
22675
|
prevTextMap.delete(textKey);
|
|
22537
22676
|
currentTextMap.set(textKey, prevLabel);
|
|
22538
22677
|
const prevText = prevLabel.text;
|
|
22539
|
-
|
|
22678
|
+
const { duration, easing } = this._animationConfig.update;
|
|
22679
|
+
updateAnimation(prevText, text, this._animationConfig.update);
|
|
22540
22680
|
if (prevLabel.labelLine) {
|
|
22541
22681
|
prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
|
|
22542
22682
|
visible: (_f = (_d = (((_b = (_a = text.attribute) === null || _a === void 0 ? void 0 : _a.line) === null || _b === void 0 ? void 0 : _b.visible) && ((_c = text.attribute) === null || _c === void 0 ? void 0 : _c.visible))) !== null && _d !== void 0 ? _d : (_e = text.attribute) === null || _e === void 0 ? void 0 : _e.visible) !== null && _f !== void 0 ? _f : true,
|
|
22543
22683
|
points: (_g = text.attribute) === null || _g === void 0 ? void 0 : _g.points
|
|
22544
22684
|
}), duration, easing);
|
|
22545
22685
|
}
|
|
22546
|
-
if (animationConfig.increaseEffect !== false &&
|
|
22547
|
-
prevText.attribute.text !== text.attribute.text &&
|
|
22548
|
-
vutils.isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))) {
|
|
22549
|
-
prevText
|
|
22550
|
-
.animate()
|
|
22551
|
-
.play(new IncreaseCount({ text: prevText.attribute.text }, { text: text.attribute.text }, duration, easing));
|
|
22552
|
-
}
|
|
22553
22686
|
}
|
|
22554
22687
|
});
|
|
22555
22688
|
prevTextMap.forEach(label => {
|
|
22556
22689
|
var _a;
|
|
22557
|
-
(_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing).onEnd(() => {
|
|
22690
|
+
(_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, this._animationConfig.exit.duration, this._animationConfig.exit.easing).onEnd(() => {
|
|
22558
22691
|
this.removeChild(label.text);
|
|
22559
22692
|
if (label === null || label === void 0 ? void 0 : label.labelLine) {
|
|
22560
22693
|
this.removeChild(label.labelLine);
|
|
@@ -22603,7 +22736,7 @@
|
|
|
22603
22736
|
relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);
|
|
22604
22737
|
}
|
|
22605
22738
|
}
|
|
22606
|
-
_afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, { mode, duration, easing,
|
|
22739
|
+
_afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, { mode, duration, easing, delay }) {
|
|
22607
22740
|
const listener = (event) => {
|
|
22608
22741
|
var _a, _b;
|
|
22609
22742
|
const { detail } = event;
|
|
@@ -22621,7 +22754,7 @@
|
|
|
22621
22754
|
text.setAttributes(to);
|
|
22622
22755
|
return;
|
|
22623
22756
|
}
|
|
22624
|
-
const
|
|
22757
|
+
const onStart = () => {
|
|
22625
22758
|
if (relatedGraphic) {
|
|
22626
22759
|
relatedGraphic.onAnimateBind = undefined;
|
|
22627
22760
|
relatedGraphic.removeEventListener('afterAttributeUpdate', listener);
|
|
@@ -22630,14 +22763,14 @@
|
|
|
22630
22763
|
switch (mode) {
|
|
22631
22764
|
case 'after':
|
|
22632
22765
|
if (detail.animationState.end) {
|
|
22633
|
-
text.animate({
|
|
22766
|
+
text.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
22634
22767
|
}
|
|
22635
22768
|
break;
|
|
22636
22769
|
case 'after-all':
|
|
22637
22770
|
if (index === texts.length - 1) {
|
|
22638
22771
|
if (detail.animationState.end) {
|
|
22639
22772
|
texts.forEach(t => {
|
|
22640
|
-
t.animate({
|
|
22773
|
+
t.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
22641
22774
|
});
|
|
22642
22775
|
}
|
|
22643
22776
|
}
|
|
@@ -22648,12 +22781,12 @@
|
|
|
22648
22781
|
const point = this._idToPoint.get(text.attribute.id);
|
|
22649
22782
|
if (point &&
|
|
22650
22783
|
(!text.animates || !text.animates.has('label-animate')) &&
|
|
22651
|
-
|
|
22652
|
-
text.animate({
|
|
22784
|
+
relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, (_b = this.stage) === null || _b === void 0 ? void 0 : _b.pickerService)) {
|
|
22785
|
+
text.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
22653
22786
|
}
|
|
22654
22787
|
}
|
|
22655
22788
|
else if (detail.animationState.isFirstFrameOfStep) {
|
|
22656
|
-
text.animate({
|
|
22789
|
+
text.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
22657
22790
|
}
|
|
22658
22791
|
break;
|
|
22659
22792
|
}
|
|
@@ -22663,7 +22796,7 @@
|
|
|
22663
22796
|
_smartInvert(labels) {
|
|
22664
22797
|
var _a, _b, _c, _d, _e;
|
|
22665
22798
|
const option = (this.attribute.smartInvert || {});
|
|
22666
|
-
const { textType, contrastRatiosThreshold, alternativeColors } = option;
|
|
22799
|
+
const { textType, contrastRatiosThreshold, alternativeColors, mode } = option;
|
|
22667
22800
|
const fillStrategy = (_a = option.fillStrategy) !== null && _a !== void 0 ? _a : 'invertBase';
|
|
22668
22801
|
const strokeStrategy = (_b = option.strokeStrategy) !== null && _b !== void 0 ? _b : 'base';
|
|
22669
22802
|
const brightColor = (_c = option.brightColor) !== null && _c !== void 0 ? _c : '#ffffff';
|
|
@@ -22681,7 +22814,7 @@
|
|
|
22681
22814
|
const backgroundColor = baseMark.attribute.fill;
|
|
22682
22815
|
const foregroundColor = label.attribute.fill;
|
|
22683
22816
|
const baseColor = backgroundColor;
|
|
22684
|
-
const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
|
|
22817
|
+
const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode);
|
|
22685
22818
|
const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
|
|
22686
22819
|
if (outsideEnable) {
|
|
22687
22820
|
const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
|
|
@@ -22709,7 +22842,7 @@
|
|
|
22709
22842
|
}
|
|
22710
22843
|
if (label.attribute.stroke) {
|
|
22711
22844
|
label.setAttributes({
|
|
22712
|
-
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
|
|
22845
|
+
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors, mode)
|
|
22713
22846
|
});
|
|
22714
22847
|
continue;
|
|
22715
22848
|
}
|
|
@@ -22871,12 +23004,11 @@
|
|
|
22871
23004
|
super(vutils.merge({}, LineLabel.defaultAttributes, attributes));
|
|
22872
23005
|
this.name = 'line-label';
|
|
22873
23006
|
}
|
|
22874
|
-
getGraphicBounds(graphic, point = {}) {
|
|
23007
|
+
getGraphicBounds(graphic, point = {}, position = 'end') {
|
|
22875
23008
|
var _a;
|
|
22876
23009
|
if (graphic.type !== 'line') {
|
|
22877
23010
|
return super.getGraphicBounds(graphic, point);
|
|
22878
23011
|
}
|
|
22879
|
-
const { position = 'end' } = this.attribute;
|
|
22880
23012
|
const points = ((_a = graphic === null || graphic === void 0 ? void 0 : graphic.attribute) === null || _a === void 0 ? void 0 : _a.points) || [point];
|
|
22881
23013
|
const index = position === 'start' ? 0 : points.length - 1;
|
|
22882
23014
|
return {
|
|
@@ -22887,22 +23019,7 @@
|
|
|
22887
23019
|
};
|
|
22888
23020
|
}
|
|
22889
23021
|
labeling(textBounds, graphicBounds, position = 'end', offset = 0) {
|
|
22890
|
-
|
|
22891
|
-
return;
|
|
22892
|
-
}
|
|
22893
|
-
const { x1, x2 } = textBounds;
|
|
22894
|
-
const width = Math.abs(x2 - x1);
|
|
22895
|
-
const anchorX = graphicBounds.x1;
|
|
22896
|
-
const anchorY = graphicBounds.y1;
|
|
22897
|
-
let x = anchorX;
|
|
22898
|
-
const y = anchorY;
|
|
22899
|
-
if (position === 'end') {
|
|
22900
|
-
x = anchorX + width / 2 + offset;
|
|
22901
|
-
}
|
|
22902
|
-
else if (position === 'start') {
|
|
22903
|
-
x = anchorX - width / 2 - offset;
|
|
22904
|
-
}
|
|
22905
|
-
return { x, y };
|
|
23022
|
+
return labelingLineOrArea(textBounds, graphicBounds, position, offset);
|
|
22906
23023
|
}
|
|
22907
23024
|
}
|
|
22908
23025
|
LineLabel.defaultAttributes = {
|
|
@@ -23642,6 +23759,42 @@
|
|
|
23642
23759
|
pickable: false
|
|
23643
23760
|
};
|
|
23644
23761
|
|
|
23762
|
+
class AreaLabel extends LabelBase {
|
|
23763
|
+
constructor(attributes) {
|
|
23764
|
+
super(vutils.merge({}, AreaLabel.defaultAttributes, attributes));
|
|
23765
|
+
this.name = 'line-label';
|
|
23766
|
+
}
|
|
23767
|
+
getGraphicBounds(graphic, point = {}, position = 'end') {
|
|
23768
|
+
var _a;
|
|
23769
|
+
if (graphic.type !== 'area') {
|
|
23770
|
+
return super.getGraphicBounds(graphic, point);
|
|
23771
|
+
}
|
|
23772
|
+
const points = ((_a = graphic === null || graphic === void 0 ? void 0 : graphic.attribute) === null || _a === void 0 ? void 0 : _a.points) || [point];
|
|
23773
|
+
const index = position === 'start' ? 0 : points.length - 1;
|
|
23774
|
+
return {
|
|
23775
|
+
x1: points[index].x,
|
|
23776
|
+
x2: points[index].x,
|
|
23777
|
+
y1: points[index].y,
|
|
23778
|
+
y2: points[index].y
|
|
23779
|
+
};
|
|
23780
|
+
}
|
|
23781
|
+
labeling(textBounds, graphicBounds, position = 'end', offset = 0) {
|
|
23782
|
+
return labelingLineOrArea(textBounds, graphicBounds, position, offset);
|
|
23783
|
+
}
|
|
23784
|
+
}
|
|
23785
|
+
AreaLabel.defaultAttributes = {
|
|
23786
|
+
textStyle: {
|
|
23787
|
+
fontSize: 12,
|
|
23788
|
+
fill: '#000',
|
|
23789
|
+
textAlign: 'center',
|
|
23790
|
+
textBaseline: 'middle',
|
|
23791
|
+
boundsPadding: [-1, 0, -1, 0]
|
|
23792
|
+
},
|
|
23793
|
+
position: 'end',
|
|
23794
|
+
offset: 6,
|
|
23795
|
+
pickable: false
|
|
23796
|
+
};
|
|
23797
|
+
|
|
23645
23798
|
class LineDataLabel extends LabelBase {
|
|
23646
23799
|
constructor(attributes) {
|
|
23647
23800
|
super(vutils.merge({}, LineDataLabel.defaultAttributes, attributes));
|
|
@@ -23668,6 +23821,8 @@
|
|
|
23668
23821
|
rect: RectLabel,
|
|
23669
23822
|
symbol: SymbolLabel,
|
|
23670
23823
|
arc: ArcLabel,
|
|
23824
|
+
line: LineLabel,
|
|
23825
|
+
area: AreaLabel,
|
|
23671
23826
|
'line-data': LineDataLabel
|
|
23672
23827
|
};
|
|
23673
23828
|
class DataLabel extends AbstractComponent {
|
|
@@ -23676,6 +23831,7 @@
|
|
|
23676
23831
|
this.name = 'data-label';
|
|
23677
23832
|
}
|
|
23678
23833
|
render() {
|
|
23834
|
+
var _a;
|
|
23679
23835
|
const { dataLabels, size } = this.attribute;
|
|
23680
23836
|
if (!dataLabels || dataLabels.length === 0) {
|
|
23681
23837
|
return;
|
|
@@ -23695,20 +23851,21 @@
|
|
|
23695
23851
|
const dataLabel = dataLabels[i];
|
|
23696
23852
|
const labelComponent = labelComponentMap[dataLabel.type] || LabelBase;
|
|
23697
23853
|
if (labelComponent) {
|
|
23698
|
-
const { baseMarkGroupName } = dataLabel;
|
|
23699
|
-
|
|
23854
|
+
const { baseMarkGroupName, type } = dataLabel;
|
|
23855
|
+
const id = (_a = dataLabel.id) !== null && _a !== void 0 ? _a : `${baseMarkGroupName}-${type}-${i}`;
|
|
23856
|
+
let component = this._componentMap.get(id);
|
|
23700
23857
|
if (component) {
|
|
23701
23858
|
component.setBitmapTool(tool);
|
|
23702
23859
|
component.setBitmap(bitmap);
|
|
23703
23860
|
component.setAttributes(dataLabel);
|
|
23704
|
-
currentComponentMap.set(
|
|
23861
|
+
currentComponentMap.set(id, component);
|
|
23705
23862
|
}
|
|
23706
23863
|
else {
|
|
23707
23864
|
component = new labelComponent(dataLabel);
|
|
23708
23865
|
component.setBitmap(bitmap);
|
|
23709
23866
|
component.setBitmapTool(tool);
|
|
23710
23867
|
this.add(component);
|
|
23711
|
-
currentComponentMap.set(
|
|
23868
|
+
currentComponentMap.set(id, component);
|
|
23712
23869
|
}
|
|
23713
23870
|
}
|
|
23714
23871
|
}
|
|
@@ -24220,12 +24377,26 @@
|
|
|
24220
24377
|
let textAlign = 'center';
|
|
24221
24378
|
let textBaseline = 'middle';
|
|
24222
24379
|
data.forEach((item, index) => {
|
|
24223
|
-
var _a, _b;
|
|
24380
|
+
var _a, _b, _c, _d;
|
|
24224
24381
|
const labelStyle = this._getLabelAttribute(item, index, data, layer);
|
|
24225
|
-
|
|
24382
|
+
let text;
|
|
24383
|
+
if (labelStyle.type === 'rich') {
|
|
24384
|
+
labelStyle.textConfig = labelStyle.text;
|
|
24385
|
+
labelStyle.width = (_a = labelStyle.width) !== null && _a !== void 0 ? _a : 0;
|
|
24386
|
+
labelStyle.height = (_b = labelStyle.height) !== null && _b !== void 0 ? _b : 0;
|
|
24387
|
+
text = createRichText(labelStyle);
|
|
24388
|
+
}
|
|
24389
|
+
else if (labelStyle.type === 'html') {
|
|
24390
|
+
labelStyle.textConfig = [];
|
|
24391
|
+
labelStyle.html = Object.assign(Object.assign({ dom: labelStyle.text }, DEFAULT_HTML_TEXT_SPEC), labelStyle);
|
|
24392
|
+
text = createRichText(labelStyle);
|
|
24393
|
+
}
|
|
24394
|
+
else {
|
|
24395
|
+
text = createText(labelStyle);
|
|
24396
|
+
}
|
|
24226
24397
|
text.name = exports.AXIS_ELEMENT_NAME.label;
|
|
24227
24398
|
text.id = this._getNodeId(`layer${layer}-label-${item.id}`);
|
|
24228
|
-
if (vutils.isEmpty((
|
|
24399
|
+
if (vutils.isEmpty((_c = this.attribute.label) === null || _c === void 0 ? void 0 : _c.state)) {
|
|
24229
24400
|
text.states = DEFAULT_STATES$2;
|
|
24230
24401
|
}
|
|
24231
24402
|
else {
|
|
@@ -24238,7 +24409,7 @@
|
|
|
24238
24409
|
text.states = labelState;
|
|
24239
24410
|
}
|
|
24240
24411
|
labelGroup.add(text);
|
|
24241
|
-
const angle = (
|
|
24412
|
+
const angle = (_d = labelStyle.angle) !== null && _d !== void 0 ? _d : 0;
|
|
24242
24413
|
maxTextWidth = Math.max(maxTextWidth, text.AABBBounds.width());
|
|
24243
24414
|
maxTextHeight = Math.max(maxTextHeight, text.AABBBounds.height());
|
|
24244
24415
|
if (angle) {
|
|
@@ -24387,7 +24558,7 @@
|
|
|
24387
24558
|
}
|
|
24388
24559
|
_getLabelAttribute(tickDatum, index, tickData, layer) {
|
|
24389
24560
|
var _a, _b, _c, _d, _e, _f;
|
|
24390
|
-
const _g = this.attribute.label, { space = 4, inside = false, formatMethod } = _g, tagAttributes = __rest(_g, ["space", "inside", "formatMethod"]);
|
|
24561
|
+
const _g = this.attribute.label, { space = 4, inside = false, formatMethod, type = 'text', text } = _g, tagAttributes = __rest(_g, ["space", "inside", "formatMethod", "type", "text"]);
|
|
24391
24562
|
let offset = space;
|
|
24392
24563
|
let tickLength = 0;
|
|
24393
24564
|
if (((_a = this.attribute.tick) === null || _a === void 0 ? void 0 : _a.visible) && ((_b = this.attribute.tick) === null || _b === void 0 ? void 0 : _b.inside) === inside) {
|
|
@@ -24408,7 +24579,9 @@
|
|
|
24408
24579
|
}
|
|
24409
24580
|
const point = this.getVerticalCoord(tickDatum.point, offset, inside);
|
|
24410
24581
|
const vector = this.getVerticalVector(offset, inside, point);
|
|
24411
|
-
const
|
|
24582
|
+
const textContent = formatMethod
|
|
24583
|
+
? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer)
|
|
24584
|
+
: tickDatum.label;
|
|
24412
24585
|
let { style: textStyle } = tagAttributes;
|
|
24413
24586
|
textStyle = vutils.isFunction(textStyle)
|
|
24414
24587
|
? vutils.merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer))
|
|
@@ -24423,7 +24596,7 @@
|
|
|
24423
24596
|
layer
|
|
24424
24597
|
});
|
|
24425
24598
|
}
|
|
24426
|
-
return Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector,
|
|
24599
|
+
return Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), { text: text !== null && text !== void 0 ? text : textContent, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize, type }), textStyle);
|
|
24427
24600
|
}
|
|
24428
24601
|
getLabelPosition(point, vector, text, style) {
|
|
24429
24602
|
return point;
|
|
@@ -25161,7 +25334,7 @@
|
|
|
25161
25334
|
let titleSpacing = 0;
|
|
25162
25335
|
const axisLineWidth = (line === null || line === void 0 ? void 0 : line.visible) ? (_b = line.style.lineWidth) !== null && _b !== void 0 ? _b : 1 : 0;
|
|
25163
25336
|
const tickLength = (tick === null || tick === void 0 ? void 0 : tick.visible) ? (_c = tick.length) !== null && _c !== void 0 ? _c : 4 : 0;
|
|
25164
|
-
if (title === null || title === void 0 ? void 0 : title.visible) {
|
|
25337
|
+
if ((title === null || title === void 0 ? void 0 : title.visible) && typeof title.text === 'string') {
|
|
25165
25338
|
titleHeight = measureTextSize(title.text, title.textStyle).height;
|
|
25166
25339
|
const padding = vutils.normalizePadding(title.padding);
|
|
25167
25340
|
titleSpacing = title.space + padding[0] + padding[2];
|
|
@@ -25956,13 +26129,6 @@
|
|
|
25956
26129
|
}
|
|
25957
26130
|
vutils.mixin(CircleAxisGrid, CircleAxisMixin);
|
|
25958
26131
|
|
|
25959
|
-
var DataZoomActiveTag;
|
|
25960
|
-
(function (DataZoomActiveTag) {
|
|
25961
|
-
DataZoomActiveTag["startHandler"] = "startHandler";
|
|
25962
|
-
DataZoomActiveTag["endHandler"] = "endHandler";
|
|
25963
|
-
DataZoomActiveTag["middleHandler"] = "middleHandler";
|
|
25964
|
-
DataZoomActiveTag["background"] = "background";
|
|
25965
|
-
})(DataZoomActiveTag || (DataZoomActiveTag = {}));
|
|
25966
26132
|
const DEFAULT_DATA_ZOOM_ATTRIBUTES = {
|
|
25967
26133
|
orient: 'bottom',
|
|
25968
26134
|
showDetail: 'auto',
|
|
@@ -26061,6 +26227,14 @@
|
|
|
26061
26227
|
}
|
|
26062
26228
|
};
|
|
26063
26229
|
|
|
26230
|
+
exports.DataZoomActiveTag = void 0;
|
|
26231
|
+
(function (DataZoomActiveTag) {
|
|
26232
|
+
DataZoomActiveTag["startHandler"] = "startHandler";
|
|
26233
|
+
DataZoomActiveTag["endHandler"] = "endHandler";
|
|
26234
|
+
DataZoomActiveTag["middleHandler"] = "middleHandler";
|
|
26235
|
+
DataZoomActiveTag["background"] = "background";
|
|
26236
|
+
})(exports.DataZoomActiveTag || (exports.DataZoomActiveTag = {}));
|
|
26237
|
+
|
|
26064
26238
|
const delayMap$1 = {
|
|
26065
26239
|
debounce: vutils.debounce,
|
|
26066
26240
|
throttle: vutils.throttle
|
|
@@ -26088,23 +26262,23 @@
|
|
|
26088
26262
|
this._onHandlerPointerDown = (e, tag) => {
|
|
26089
26263
|
e.stopPropagation();
|
|
26090
26264
|
if (tag === 'start') {
|
|
26091
|
-
this._activeTag = DataZoomActiveTag.startHandler;
|
|
26265
|
+
this._activeTag = exports.DataZoomActiveTag.startHandler;
|
|
26092
26266
|
this._activeItem = this._startHandler;
|
|
26093
26267
|
}
|
|
26094
26268
|
else if (tag === 'end') {
|
|
26095
|
-
this._activeTag = DataZoomActiveTag.endHandler;
|
|
26269
|
+
this._activeTag = exports.DataZoomActiveTag.endHandler;
|
|
26096
26270
|
this._activeItem = this._endHandler;
|
|
26097
26271
|
}
|
|
26098
26272
|
else if (tag === 'middleRect') {
|
|
26099
|
-
this._activeTag = DataZoomActiveTag.middleHandler;
|
|
26273
|
+
this._activeTag = exports.DataZoomActiveTag.middleHandler;
|
|
26100
26274
|
this._activeItem = this._middleHandlerRect;
|
|
26101
26275
|
}
|
|
26102
26276
|
else if (tag === 'middleSymbol') {
|
|
26103
|
-
this._activeTag = DataZoomActiveTag.middleHandler;
|
|
26277
|
+
this._activeTag = exports.DataZoomActiveTag.middleHandler;
|
|
26104
26278
|
this._activeItem = this._middleHandlerSymbol;
|
|
26105
26279
|
}
|
|
26106
26280
|
else if (tag === 'background') {
|
|
26107
|
-
this._activeTag = DataZoomActiveTag.background;
|
|
26281
|
+
this._activeTag = exports.DataZoomActiveTag.background;
|
|
26108
26282
|
this._activeItem = this._background;
|
|
26109
26283
|
}
|
|
26110
26284
|
this._activeState = true;
|
|
@@ -26112,6 +26286,7 @@
|
|
|
26112
26286
|
this._activeCache.lastPos = this.eventPosToStagePos(e);
|
|
26113
26287
|
};
|
|
26114
26288
|
this._onHandlerPointerMove = (e) => {
|
|
26289
|
+
var _a;
|
|
26115
26290
|
e.stopPropagation();
|
|
26116
26291
|
const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
|
|
26117
26292
|
const pos = this.eventPosToStagePos(e);
|
|
@@ -26119,24 +26294,24 @@
|
|
|
26119
26294
|
const dis = (pos[attPos] - this._activeCache.lastPos[attPos]) / max;
|
|
26120
26295
|
let { start, end } = this.state;
|
|
26121
26296
|
if (this._activeState) {
|
|
26122
|
-
if (this._activeTag === DataZoomActiveTag.middleHandler) {
|
|
26297
|
+
if (this._activeTag === exports.DataZoomActiveTag.middleHandler) {
|
|
26123
26298
|
this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis);
|
|
26124
26299
|
}
|
|
26125
|
-
else if (this._activeTag === DataZoomActiveTag.startHandler) {
|
|
26300
|
+
else if (this._activeTag === exports.DataZoomActiveTag.startHandler) {
|
|
26126
26301
|
if (start + dis > end) {
|
|
26127
26302
|
start = end;
|
|
26128
26303
|
end = start + dis;
|
|
26129
|
-
this._activeTag = DataZoomActiveTag.endHandler;
|
|
26304
|
+
this._activeTag = exports.DataZoomActiveTag.endHandler;
|
|
26130
26305
|
}
|
|
26131
26306
|
else {
|
|
26132
26307
|
start = start + dis;
|
|
26133
26308
|
}
|
|
26134
26309
|
}
|
|
26135
|
-
else if (this._activeTag === DataZoomActiveTag.endHandler) {
|
|
26310
|
+
else if (this._activeTag === exports.DataZoomActiveTag.endHandler) {
|
|
26136
26311
|
if (end + dis < start) {
|
|
26137
26312
|
end = start;
|
|
26138
26313
|
start = end + dis;
|
|
26139
|
-
this._activeTag = DataZoomActiveTag.startHandler;
|
|
26314
|
+
this._activeTag = exports.DataZoomActiveTag.startHandler;
|
|
26140
26315
|
}
|
|
26141
26316
|
else {
|
|
26142
26317
|
end = end + dis;
|
|
@@ -26149,7 +26324,7 @@
|
|
|
26149
26324
|
end = Math.min(Math.max(end, 0), 1);
|
|
26150
26325
|
if (startAttr !== start || endAttr !== end) {
|
|
26151
26326
|
this.setStateAttr(start, end, true);
|
|
26152
|
-
realTime && this._updateStateCallback
|
|
26327
|
+
realTime && ((_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, start, end, this._activeTag));
|
|
26153
26328
|
this._dispatchChangeEvent(start, end);
|
|
26154
26329
|
}
|
|
26155
26330
|
};
|
|
@@ -26254,10 +26429,11 @@
|
|
|
26254
26429
|
};
|
|
26255
26430
|
}
|
|
26256
26431
|
_onHandlerPointerUp(e) {
|
|
26432
|
+
var _a;
|
|
26257
26433
|
e.preventDefault();
|
|
26258
26434
|
const { start, end, brushSelect, realTime = true } = this.attribute;
|
|
26259
26435
|
if (this._activeState) {
|
|
26260
|
-
if (this._activeTag === DataZoomActiveTag.background) {
|
|
26436
|
+
if (this._activeTag === exports.DataZoomActiveTag.background) {
|
|
26261
26437
|
const pos = this.eventPosToStagePos(e);
|
|
26262
26438
|
this.backgroundDragZoom(this._activeCache.startPos, pos);
|
|
26263
26439
|
}
|
|
@@ -26266,7 +26442,7 @@
|
|
|
26266
26442
|
brushSelect && this.renderDragMask();
|
|
26267
26443
|
if (!realTime || start !== this.state.start || end !== this.state.end) {
|
|
26268
26444
|
this.setStateAttr(this.state.start, this.state.end, true);
|
|
26269
|
-
this._updateStateCallback
|
|
26445
|
+
(_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, this.state.start, this.state.end, this._activeTag);
|
|
26270
26446
|
this._dispatchChangeEvent(this.state.start, this.state.end);
|
|
26271
26447
|
}
|
|
26272
26448
|
}
|
|
@@ -26316,11 +26492,11 @@
|
|
|
26316
26492
|
const { dragMaskStyle } = this.attribute;
|
|
26317
26493
|
const { position, width, height } = this.getLayoutAttrFromConfig();
|
|
26318
26494
|
if (this._isHorizontal) {
|
|
26319
|
-
this._dragMask = this._container.createOrUpdateChild('dragMask', Object.assign({ x: vutils.clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.x : this._activeCache.startPos.x, position.x, position.x + width), y: position.y, width: (this._activeState && this._activeTag === DataZoomActiveTag.background && Math.abs(this.dragMaskSize())) ||
|
|
26495
|
+
this._dragMask = this._container.createOrUpdateChild('dragMask', Object.assign({ x: vutils.clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.x : this._activeCache.startPos.x, position.x, position.x + width), y: position.y, width: (this._activeState && this._activeTag === exports.DataZoomActiveTag.background && Math.abs(this.dragMaskSize())) ||
|
|
26320
26496
|
0, height }, dragMaskStyle), 'rect');
|
|
26321
26497
|
}
|
|
26322
26498
|
else {
|
|
26323
|
-
this._dragMask = this._container.createOrUpdateChild('dragMask', Object.assign({ x: position.x, y: vutils.clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.y : this._activeCache.startPos.y, position.y, position.y + height), width, height: (this._activeState && this._activeTag === DataZoomActiveTag.background && Math.abs(this.dragMaskSize())) ||
|
|
26499
|
+
this._dragMask = this._container.createOrUpdateChild('dragMask', Object.assign({ x: position.x, y: vutils.clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.y : this._activeCache.startPos.y, position.y, position.y + height), width, height: (this._activeState && this._activeTag === exports.DataZoomActiveTag.background && Math.abs(this.dragMaskSize())) ||
|
|
26324
26500
|
0 }, dragMaskStyle), 'rect');
|
|
26325
26501
|
}
|
|
26326
26502
|
}
|
|
@@ -26639,13 +26815,14 @@
|
|
|
26639
26815
|
this.dispatchEvent(changeEvent);
|
|
26640
26816
|
}
|
|
26641
26817
|
setStartAndEnd(start, end) {
|
|
26818
|
+
var _a;
|
|
26642
26819
|
const { start: startAttr, end: endAttr } = this.attribute;
|
|
26643
26820
|
if (vutils.isValid(start) && vutils.isValid(end) && (start !== this.state.start || end !== this.state.end)) {
|
|
26644
26821
|
this.state.start = start;
|
|
26645
26822
|
this.state.end = end;
|
|
26646
26823
|
if (startAttr !== this.state.start || endAttr !== this.state.end) {
|
|
26647
26824
|
this.setStateAttr(start, end, true);
|
|
26648
|
-
this._updateStateCallback
|
|
26825
|
+
(_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, start, end, this._activeTag);
|
|
26649
26826
|
this._dispatchChangeEvent(start, end);
|
|
26650
26827
|
}
|
|
26651
26828
|
}
|
|
@@ -27732,51 +27909,23 @@
|
|
|
27732
27909
|
const target = e.target;
|
|
27733
27910
|
if ((_a = target === null || target === void 0 ? void 0 : target.name) === null || _a === void 0 ? void 0 : _a.startsWith(exports.LEGEND_ELEMENT_NAME.item)) {
|
|
27734
27911
|
const legendItem = target.delegate;
|
|
27735
|
-
|
|
27736
|
-
|
|
27737
|
-
|
|
27738
|
-
|
|
27739
|
-
|
|
27740
|
-
this._setLegendItemState(legendItem, exports.LegendStateValue.unSelectedHover, e);
|
|
27741
|
-
}
|
|
27742
|
-
const focusButton = legendItem.getChildren()[0].find(node => node.name === exports.LEGEND_ELEMENT_NAME.focus, false);
|
|
27743
|
-
if (focusButton) {
|
|
27744
|
-
focusButton.setAttribute('visible', true);
|
|
27912
|
+
if (this._lastActiveItem) {
|
|
27913
|
+
if (this._lastActiveItem.id === legendItem.id) {
|
|
27914
|
+
return;
|
|
27915
|
+
}
|
|
27916
|
+
this._unHover(this._lastActiveItem, e);
|
|
27745
27917
|
}
|
|
27746
|
-
this.
|
|
27918
|
+
this._hover(legendItem, e);
|
|
27919
|
+
}
|
|
27920
|
+
else if (this._lastActiveItem) {
|
|
27921
|
+
this._unHover(this._lastActiveItem, e);
|
|
27922
|
+
this._lastActiveItem = null;
|
|
27747
27923
|
}
|
|
27748
27924
|
};
|
|
27749
27925
|
this._onUnHover = (e) => {
|
|
27750
|
-
|
|
27751
|
-
|
|
27752
|
-
|
|
27753
|
-
const legendItem = target.delegate;
|
|
27754
|
-
let attributeUpdate = false;
|
|
27755
|
-
if (legendItem.hasState(exports.LegendStateValue.unSelectedHover) ||
|
|
27756
|
-
legendItem.hasState(exports.LegendStateValue.selectedHover)) {
|
|
27757
|
-
attributeUpdate = true;
|
|
27758
|
-
}
|
|
27759
|
-
legendItem.removeState(exports.LegendStateValue.unSelectedHover);
|
|
27760
|
-
legendItem.removeState(exports.LegendStateValue.selectedHover);
|
|
27761
|
-
legendItem
|
|
27762
|
-
.getChildren()[0]
|
|
27763
|
-
.getChildren()
|
|
27764
|
-
.forEach((child) => {
|
|
27765
|
-
if (!attributeUpdate &&
|
|
27766
|
-
(child.hasState(exports.LegendStateValue.unSelectedHover) || child.hasState(exports.LegendStateValue.selectedHover))) {
|
|
27767
|
-
attributeUpdate = true;
|
|
27768
|
-
}
|
|
27769
|
-
child.removeState(exports.LegendStateValue.unSelectedHover);
|
|
27770
|
-
child.removeState(exports.LegendStateValue.selectedHover);
|
|
27771
|
-
});
|
|
27772
|
-
const focusButton = legendItem.getChildren()[0].find(node => node.name === exports.LEGEND_ELEMENT_NAME.focus, false);
|
|
27773
|
-
if (focusButton) {
|
|
27774
|
-
focusButton.setAttribute('visible', false);
|
|
27775
|
-
}
|
|
27776
|
-
if (attributeUpdate) {
|
|
27777
|
-
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
|
|
27778
|
-
}
|
|
27779
|
-
this._dispatchEvent(exports.LegendEvent.legendItemUnHover, legendItem, e);
|
|
27926
|
+
if (this._lastActiveItem) {
|
|
27927
|
+
this._unHover(this._lastActiveItem, e);
|
|
27928
|
+
this._lastActiveItem = null;
|
|
27780
27929
|
}
|
|
27781
27930
|
};
|
|
27782
27931
|
this._onClick = (e) => {
|
|
@@ -27966,7 +28115,7 @@
|
|
|
27966
28115
|
const { hover = true, select = true } = this.attribute;
|
|
27967
28116
|
if (hover) {
|
|
27968
28117
|
this._itemsContainer.addEventListener('pointermove', this._onHover);
|
|
27969
|
-
this._itemsContainer.addEventListener('
|
|
28118
|
+
this._itemsContainer.addEventListener('pointerleave', this._onUnHover);
|
|
27970
28119
|
}
|
|
27971
28120
|
if (select) {
|
|
27972
28121
|
this._itemsContainer.addEventListener('pointerdown', this._onClick);
|
|
@@ -27994,6 +28143,7 @@
|
|
|
27994
28143
|
itemGroup = createGroup(Object.assign({ x: 0, y: 0 }, background === null || background === void 0 ? void 0 : background.style));
|
|
27995
28144
|
this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup, background === null || background === void 0 ? void 0 : background.state);
|
|
27996
28145
|
}
|
|
28146
|
+
itemGroup.id = `${id !== null && id !== void 0 ? id : label}-${index}`;
|
|
27997
28147
|
itemGroup.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
|
|
27998
28148
|
const innerGroup = createGroup({
|
|
27999
28149
|
x: 0,
|
|
@@ -28002,22 +28152,26 @@
|
|
|
28002
28152
|
});
|
|
28003
28153
|
itemGroup.add(innerGroup);
|
|
28004
28154
|
let focusStartX = 0;
|
|
28005
|
-
|
|
28006
|
-
|
|
28007
|
-
|
|
28008
|
-
|
|
28009
|
-
|
|
28010
|
-
|
|
28011
|
-
|
|
28012
|
-
shapeAttr.state[key].fill
|
|
28013
|
-
|
|
28014
|
-
|
|
28015
|
-
|
|
28016
|
-
|
|
28017
|
-
|
|
28018
|
-
|
|
28019
|
-
|
|
28020
|
-
|
|
28155
|
+
let shapeSize = 0;
|
|
28156
|
+
let shapeSpace = 0;
|
|
28157
|
+
if ((shapeAttr === null || shapeAttr === void 0 ? void 0 : shapeAttr.visible) !== false) {
|
|
28158
|
+
shapeSize = vutils.get(shapeAttr, 'style.size', DEFAULT_SHAPE_SIZE);
|
|
28159
|
+
shapeSpace = vutils.get(shapeAttr, 'space', DEFAULT_SHAPE_SPACE);
|
|
28160
|
+
const itemShape = createSymbol(Object.assign(Object.assign({ x: 0, y: 0, symbolType: 'circle', strokeBoundsBuffer: 0 }, shape), shapeAttr.style));
|
|
28161
|
+
Object.keys(shapeAttr.state || {}).forEach(key => {
|
|
28162
|
+
const color = shapeAttr.state[key].fill ||
|
|
28163
|
+
shapeAttr.state[key].stroke;
|
|
28164
|
+
if (shape.fill && vutils.isNil(shapeAttr.state[key].fill) && color) {
|
|
28165
|
+
shapeAttr.state[key].fill = color;
|
|
28166
|
+
}
|
|
28167
|
+
if (shape.stroke && vutils.isNil(shapeAttr.state[key].stroke) && color) {
|
|
28168
|
+
shapeAttr.state[key].stroke = color;
|
|
28169
|
+
}
|
|
28170
|
+
});
|
|
28171
|
+
this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeAttr === null || shapeAttr === void 0 ? void 0 : shapeAttr.state);
|
|
28172
|
+
itemShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
|
|
28173
|
+
innerGroup.add(itemShape);
|
|
28174
|
+
}
|
|
28021
28175
|
let focusShape;
|
|
28022
28176
|
let focusSpace = 0;
|
|
28023
28177
|
if (focus) {
|
|
@@ -28219,6 +28373,48 @@
|
|
|
28219
28373
|
this._pager.addEventListener('toNext', onPaging);
|
|
28220
28374
|
return true;
|
|
28221
28375
|
}
|
|
28376
|
+
_hover(legendItem, e) {
|
|
28377
|
+
this._lastActiveItem = legendItem;
|
|
28378
|
+
const selected = legendItem.hasState(exports.LegendStateValue.selected);
|
|
28379
|
+
if (selected) {
|
|
28380
|
+
this._setLegendItemState(legendItem, exports.LegendStateValue.selectedHover, e);
|
|
28381
|
+
}
|
|
28382
|
+
else {
|
|
28383
|
+
this._setLegendItemState(legendItem, exports.LegendStateValue.unSelectedHover, e);
|
|
28384
|
+
}
|
|
28385
|
+
const focusButton = legendItem.getChildren()[0].find(node => node.name === exports.LEGEND_ELEMENT_NAME.focus, false);
|
|
28386
|
+
if (focusButton) {
|
|
28387
|
+
focusButton.setAttribute('visible', true);
|
|
28388
|
+
}
|
|
28389
|
+
this._dispatchEvent(exports.LegendEvent.legendItemHover, legendItem, e);
|
|
28390
|
+
}
|
|
28391
|
+
_unHover(legendItem, e) {
|
|
28392
|
+
let attributeUpdate = false;
|
|
28393
|
+
if (legendItem.hasState(exports.LegendStateValue.unSelectedHover) || legendItem.hasState(exports.LegendStateValue.selectedHover)) {
|
|
28394
|
+
attributeUpdate = true;
|
|
28395
|
+
}
|
|
28396
|
+
legendItem.removeState(exports.LegendStateValue.unSelectedHover);
|
|
28397
|
+
legendItem.removeState(exports.LegendStateValue.selectedHover);
|
|
28398
|
+
legendItem
|
|
28399
|
+
.getChildren()[0]
|
|
28400
|
+
.getChildren()
|
|
28401
|
+
.forEach((child) => {
|
|
28402
|
+
if (!attributeUpdate &&
|
|
28403
|
+
(child.hasState(exports.LegendStateValue.unSelectedHover) || child.hasState(exports.LegendStateValue.selectedHover))) {
|
|
28404
|
+
attributeUpdate = true;
|
|
28405
|
+
}
|
|
28406
|
+
child.removeState(exports.LegendStateValue.unSelectedHover);
|
|
28407
|
+
child.removeState(exports.LegendStateValue.selectedHover);
|
|
28408
|
+
});
|
|
28409
|
+
const focusButton = legendItem.getChildren()[0].find(node => node.name === exports.LEGEND_ELEMENT_NAME.focus, false);
|
|
28410
|
+
if (focusButton) {
|
|
28411
|
+
focusButton.setAttribute('visible', false);
|
|
28412
|
+
}
|
|
28413
|
+
if (attributeUpdate) {
|
|
28414
|
+
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
|
|
28415
|
+
}
|
|
28416
|
+
this._dispatchEvent(exports.LegendEvent.legendItemUnHover, legendItem, e);
|
|
28417
|
+
}
|
|
28222
28418
|
_setLegendItemState(legendItem, stateName, e) {
|
|
28223
28419
|
const keepCurrentStates = true;
|
|
28224
28420
|
let attributeUpdate = false;
|
|
@@ -29369,58 +29565,46 @@
|
|
|
29369
29565
|
this.name = 'title';
|
|
29370
29566
|
}
|
|
29371
29567
|
render() {
|
|
29372
|
-
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;
|
|
29373
|
-
const { text, textStyle, subtext, subtextStyle, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
|
|
29568
|
+
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;
|
|
29569
|
+
const { textType, text, subtextType, textStyle, subtext, subtextStyle, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
|
|
29374
29570
|
const parsedPadding = vutils.normalizePadding(padding);
|
|
29375
29571
|
const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
|
|
29376
29572
|
if (((_a = this.attribute) === null || _a === void 0 ? void 0 : _a.visible) !== false && (textStyle === null || textStyle === void 0 ? void 0 : textStyle.visible) !== false) {
|
|
29377
|
-
if (
|
|
29378
|
-
const attr = {
|
|
29379
|
-
|
|
29380
|
-
|
|
29381
|
-
|
|
29382
|
-
|
|
29383
|
-
ellipsis: (_h = textStyle.ellipsis) !== null && _h !== void 0 ? _h : true,
|
|
29384
|
-
wordBreak: (_j = textStyle.wordBreak) !== null && _j !== void 0 ? _j : 'break-word',
|
|
29385
|
-
maxHeight: textStyle.maxHeight,
|
|
29386
|
-
maxWidth: textStyle.maxWidth,
|
|
29387
|
-
textConfig: textStyle.character
|
|
29388
|
-
};
|
|
29573
|
+
if (textType === 'rich' || vutils.isValid(textStyle.character)) {
|
|
29574
|
+
const attr = Object.assign({ x: (_b = textStyle.x) !== null && _b !== void 0 ? _b : 0, y: (_c = textStyle.y) !== null && _c !== void 0 ? _c : 0, width: (_e = (_d = textStyle.width) !== null && _d !== void 0 ? _d : width) !== null && _e !== void 0 ? _e : 0, height: (_g = (_f = textStyle.height) !== null && _f !== void 0 ? _f : height) !== null && _g !== void 0 ? _g : 0, ellipsis: (_h = textStyle.ellipsis) !== null && _h !== void 0 ? _h : true, wordBreak: (_j = textStyle.wordBreak) !== null && _j !== void 0 ? _j : 'break-word', maxHeight: textStyle.maxHeight, maxWidth: textStyle.maxWidth, textConfig: (_k = text) !== null && _k !== void 0 ? _k : textStyle.character }, textStyle);
|
|
29575
|
+
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
29576
|
+
}
|
|
29577
|
+
else if (textType === 'html') {
|
|
29578
|
+
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle), x: (_l = textStyle.x) !== null && _l !== void 0 ? _l : 0, y: (_m = textStyle.y) !== null && _m !== void 0 ? _m : 0, width: (_p = (_o = textStyle.width) !== null && _o !== void 0 ? _o : width) !== null && _p !== void 0 ? _p : 0, height: (_r = (_q = textStyle.height) !== null && _q !== void 0 ? _q : height) !== null && _r !== void 0 ? _r : 0, ellipsis: (_s = textStyle.ellipsis) !== null && _s !== void 0 ? _s : true, wordBreak: (_t = textStyle.wordBreak) !== null && _t !== void 0 ? _t : 'break-word', maxHeight: textStyle.maxHeight, maxWidth: textStyle.maxWidth, textConfig: [] }, textStyle);
|
|
29389
29579
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
29390
29580
|
}
|
|
29391
29581
|
else if (vutils.isValid(text)) {
|
|
29392
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: [text] }, textStyle), { maxLineWidth: (
|
|
29393
|
-
}
|
|
29394
|
-
}
|
|
29395
|
-
const maintextHeight = this._mainTitle ? (
|
|
29396
|
-
const maintextWidth = this._mainTitle ? (
|
|
29397
|
-
if (((
|
|
29398
|
-
if (
|
|
29399
|
-
const attr = {
|
|
29400
|
-
|
|
29401
|
-
|
|
29402
|
-
|
|
29403
|
-
|
|
29404
|
-
ellipsis: (_w = subtextStyle.ellipsis) !== null && _w !== void 0 ? _w : true,
|
|
29405
|
-
wordBreak: (_x = subtextStyle.wordBreak) !== null && _x !== void 0 ? _x : 'break-word',
|
|
29406
|
-
maxHeight: subtextStyle.maxHeight,
|
|
29407
|
-
maxWidth: subtextStyle.maxWidth,
|
|
29408
|
-
textConfig: subtextStyle.character
|
|
29409
|
-
};
|
|
29582
|
+
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: [text] }, textStyle), { maxLineWidth: (_u = textStyle === null || textStyle === void 0 ? void 0 : textStyle.maxLineWidth) !== null && _u !== void 0 ? _u : width, heightLimit: textStyle === null || textStyle === void 0 ? void 0 : textStyle.heightLimit, lineClamp: textStyle === null || textStyle === void 0 ? void 0 : textStyle.lineClamp, ellipsis: (_v = textStyle === null || textStyle === void 0 ? void 0 : textStyle.ellipsis) !== null && _v !== void 0 ? _v : true, x: 0, y: 0 }), 'wrapText');
|
|
29583
|
+
}
|
|
29584
|
+
}
|
|
29585
|
+
const maintextHeight = this._mainTitle ? (_w = this._mainTitle) === null || _w === void 0 ? void 0 : _w.AABBBounds.height() : 0;
|
|
29586
|
+
const maintextWidth = this._mainTitle ? (_x = this._mainTitle) === null || _x === void 0 ? void 0 : _x.AABBBounds.width() : 0;
|
|
29587
|
+
if (((_y = this.attribute) === null || _y === void 0 ? void 0 : _y.visible) !== false && (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.visible) !== false) {
|
|
29588
|
+
if (subtextType === 'rich' || vutils.isValid(subtextStyle.character)) {
|
|
29589
|
+
const attr = Object.assign({ x: (_z = subtextStyle.x) !== null && _z !== void 0 ? _z : 0, y: (_0 = subtextStyle.y) !== null && _0 !== void 0 ? _0 : 0, width: (_2 = (_1 = subtextStyle.width) !== null && _1 !== void 0 ? _1 : width) !== null && _2 !== void 0 ? _2 : 0, height: (_4 = (_3 = subtextStyle.height) !== null && _3 !== void 0 ? _3 : height) !== null && _4 !== void 0 ? _4 : 0, ellipsis: (_5 = subtextStyle.ellipsis) !== null && _5 !== void 0 ? _5 : true, wordBreak: (_6 = subtextStyle.wordBreak) !== null && _6 !== void 0 ? _6 : 'break-word', maxHeight: subtextStyle.maxHeight, maxWidth: subtextStyle.maxWidth, textConfig: (_7 = subtext) !== null && _7 !== void 0 ? _7 : subtextStyle.character }, subtextStyle);
|
|
29590
|
+
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
29591
|
+
}
|
|
29592
|
+
else if (subtextType === 'html') {
|
|
29593
|
+
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: subtext }, DEFAULT_HTML_TEXT_SPEC), subtextStyle), x: (_8 = subtextStyle.x) !== null && _8 !== void 0 ? _8 : 0, y: (_9 = subtextStyle.y) !== null && _9 !== void 0 ? _9 : 0, width: (_11 = (_10 = subtextStyle.width) !== null && _10 !== void 0 ? _10 : width) !== null && _11 !== void 0 ? _11 : 0, height: (_13 = (_12 = subtextStyle.height) !== null && _12 !== void 0 ? _12 : height) !== null && _13 !== void 0 ? _13 : 0, ellipsis: (_14 = subtextStyle.ellipsis) !== null && _14 !== void 0 ? _14 : true, wordBreak: (_15 = subtextStyle.wordBreak) !== null && _15 !== void 0 ? _15 : 'break-word', maxHeight: subtextStyle.maxHeight, maxWidth: subtextStyle.maxWidth, textConfig: [] }, subtextStyle);
|
|
29410
29594
|
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
29411
29595
|
}
|
|
29412
29596
|
else if (vutils.isValid(subtext)) {
|
|
29413
|
-
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: [subtext] }, subtextStyle), { maxLineWidth: (
|
|
29597
|
+
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: [subtext] }, subtextStyle), { maxLineWidth: (_16 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.maxLineWidth) !== null && _16 !== void 0 ? _16 : width, heightLimit: subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.heightLimit, lineClamp: subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.lineClamp, ellipsis: (_17 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.ellipsis) !== null && _17 !== void 0 ? _17 : true, x: 0, y: maintextHeight }), 'wrapText');
|
|
29414
29598
|
}
|
|
29415
29599
|
}
|
|
29416
|
-
const subtextHeight = this._subTitle ? (
|
|
29417
|
-
const subtextWidth = this._subTitle ? (
|
|
29600
|
+
const subtextHeight = this._subTitle ? (_18 = this._subTitle) === null || _18 === void 0 ? void 0 : _18.AABBBounds.height() : 0;
|
|
29601
|
+
const subtextWidth = this._subTitle ? (_19 = this._subTitle) === null || _19 === void 0 ? void 0 : _19.AABBBounds.width() : 0;
|
|
29418
29602
|
let titleWidth = Math.max(maintextWidth, subtextWidth);
|
|
29419
|
-
let titleHeight = maintextHeight + ((
|
|
29603
|
+
let titleHeight = maintextHeight + ((_20 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _20 !== void 0 ? _20 : subtextHeight);
|
|
29420
29604
|
if (vutils.isValid(width)) {
|
|
29421
29605
|
titleWidth = width;
|
|
29422
|
-
(
|
|
29423
|
-
(
|
|
29606
|
+
(_21 = this._mainTitle) === null || _21 === void 0 ? void 0 : _21.setAttribute('maxLineWidth', width);
|
|
29607
|
+
(_22 = this._subTitle) === null || _22 === void 0 ? void 0 : _22.setAttribute('maxLineWidth', width);
|
|
29424
29608
|
}
|
|
29425
29609
|
if (vutils.isValid(height)) {
|
|
29426
29610
|
titleHeight = height;
|
|
@@ -29429,10 +29613,10 @@
|
|
|
29429
29613
|
titleWidth = minWidth;
|
|
29430
29614
|
}
|
|
29431
29615
|
if (vutils.isValid(maxWidth)) {
|
|
29432
|
-
(
|
|
29433
|
-
(
|
|
29434
|
-
(
|
|
29435
|
-
(
|
|
29616
|
+
(_23 = this._mainTitle) === null || _23 === void 0 ? void 0 : _23.setAttribute('maxLineWidth', maxWidth);
|
|
29617
|
+
(_24 = this._subTitle) === null || _24 === void 0 ? void 0 : _24.setAttribute('maxLineWidth', maxWidth);
|
|
29618
|
+
(_25 = this._mainTitle) === null || _25 === void 0 ? void 0 : _25.setAttribute('maxWidth', maxWidth);
|
|
29619
|
+
(_26 = this._subTitle) === null || _26 === void 0 ? void 0 : _26.setAttribute('maxWidth', maxWidth);
|
|
29436
29620
|
if (titleWidth > maxWidth) {
|
|
29437
29621
|
titleWidth = maxWidth;
|
|
29438
29622
|
}
|
|
@@ -29441,8 +29625,8 @@
|
|
|
29441
29625
|
titleHeight = minHeight;
|
|
29442
29626
|
}
|
|
29443
29627
|
if (vutils.isValid(maxHeight)) {
|
|
29444
|
-
(
|
|
29445
|
-
(
|
|
29628
|
+
(_27 = this._mainTitle) === null || _27 === void 0 ? void 0 : _27.setAttribute('maxHeight', maxHeight);
|
|
29629
|
+
(_28 = this._subTitle) === null || _28 === void 0 ? void 0 : _28.setAttribute('maxHeight', maxHeight - maintextHeight);
|
|
29446
29630
|
if (titleHeight > maxHeight) {
|
|
29447
29631
|
titleHeight = maxHeight;
|
|
29448
29632
|
}
|
|
@@ -29452,67 +29636,67 @@
|
|
|
29452
29636
|
group.attribute.boundsPadding = parsedPadding;
|
|
29453
29637
|
if (vutils.isValid(align) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.align)) {
|
|
29454
29638
|
const mainTitleAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.align) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.align : align;
|
|
29455
|
-
const mainTitleWidth = (
|
|
29639
|
+
const mainTitleWidth = (_29 = textStyle === null || textStyle === void 0 ? void 0 : textStyle.width) !== null && _29 !== void 0 ? _29 : maintextWidth;
|
|
29456
29640
|
if (mainTitleAlign === 'left') {
|
|
29457
|
-
(
|
|
29458
|
-
(
|
|
29641
|
+
(_30 = this._mainTitle) === null || _30 === void 0 ? void 0 : _30.setAttribute('x', 0);
|
|
29642
|
+
(_31 = this._mainTitle) === null || _31 === void 0 ? void 0 : _31.setAttribute('textAlign', 'left');
|
|
29459
29643
|
}
|
|
29460
29644
|
else if (mainTitleAlign === 'center') {
|
|
29461
|
-
(
|
|
29462
|
-
(
|
|
29645
|
+
(_32 = this._mainTitle) === null || _32 === void 0 ? void 0 : _32.setAttribute('x', mainTitleWidth / 2);
|
|
29646
|
+
(_33 = this._mainTitle) === null || _33 === void 0 ? void 0 : _33.setAttribute('textAlign', 'center');
|
|
29463
29647
|
}
|
|
29464
29648
|
else if (mainTitleAlign === 'right') {
|
|
29465
|
-
(
|
|
29466
|
-
(
|
|
29649
|
+
(_34 = this._mainTitle) === null || _34 === void 0 ? void 0 : _34.setAttribute('x', mainTitleWidth);
|
|
29650
|
+
(_35 = this._mainTitle) === null || _35 === void 0 ? void 0 : _35.setAttribute('textAlign', 'right');
|
|
29467
29651
|
}
|
|
29468
29652
|
}
|
|
29469
29653
|
if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
|
|
29470
29654
|
const mainTitleVerticalAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign : verticalAlign;
|
|
29471
29655
|
const mainTitleHeight = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.height) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.height : titleHeight;
|
|
29472
29656
|
if (mainTitleVerticalAlign === 'top') {
|
|
29473
|
-
(
|
|
29474
|
-
(
|
|
29657
|
+
(_36 = this._mainTitle) === null || _36 === void 0 ? void 0 : _36.setAttribute('y', 0);
|
|
29658
|
+
(_37 = this._mainTitle) === null || _37 === void 0 ? void 0 : _37.setAttribute('textBaseline', 'top');
|
|
29475
29659
|
}
|
|
29476
29660
|
else if (mainTitleVerticalAlign === 'middle') {
|
|
29477
|
-
(
|
|
29478
|
-
(
|
|
29661
|
+
(_38 = this._mainTitle) === null || _38 === void 0 ? void 0 : _38.setAttribute('y', mainTitleHeight / 2);
|
|
29662
|
+
(_39 = this._mainTitle) === null || _39 === void 0 ? void 0 : _39.setAttribute('textBaseline', 'middle');
|
|
29479
29663
|
}
|
|
29480
29664
|
else if (mainTitleVerticalAlign === 'bottom') {
|
|
29481
|
-
(
|
|
29482
|
-
(
|
|
29665
|
+
(_40 = this._mainTitle) === null || _40 === void 0 ? void 0 : _40.setAttribute('y', mainTitleHeight);
|
|
29666
|
+
(_41 = this._mainTitle) === null || _41 === void 0 ? void 0 : _41.setAttribute('textBaseline', 'bottom');
|
|
29483
29667
|
}
|
|
29484
29668
|
}
|
|
29485
29669
|
if (vutils.isValid(align) || vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align)) {
|
|
29486
29670
|
const subTitleAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align : align;
|
|
29487
|
-
const subTitleWidth = (
|
|
29671
|
+
const subTitleWidth = (_42 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.width) !== null && _42 !== void 0 ? _42 : subtextWidth;
|
|
29488
29672
|
if (subTitleAlign === 'left') {
|
|
29489
|
-
(
|
|
29490
|
-
(
|
|
29673
|
+
(_43 = this._subTitle) === null || _43 === void 0 ? void 0 : _43.setAttribute('x', 0);
|
|
29674
|
+
(_44 = this._subTitle) === null || _44 === void 0 ? void 0 : _44.setAttribute('textAlign', 'left');
|
|
29491
29675
|
}
|
|
29492
29676
|
else if (subTitleAlign === 'center') {
|
|
29493
|
-
(
|
|
29494
|
-
(
|
|
29677
|
+
(_45 = this._subTitle) === null || _45 === void 0 ? void 0 : _45.setAttribute('x', subTitleWidth / 2);
|
|
29678
|
+
(_46 = this._subTitle) === null || _46 === void 0 ? void 0 : _46.setAttribute('textAlign', 'center');
|
|
29495
29679
|
}
|
|
29496
29680
|
else if (subTitleAlign === 'right') {
|
|
29497
|
-
(
|
|
29498
|
-
(
|
|
29681
|
+
(_47 = this._subTitle) === null || _47 === void 0 ? void 0 : _47.setAttribute('x', subTitleWidth);
|
|
29682
|
+
(_48 = this._subTitle) === null || _48 === void 0 ? void 0 : _48.setAttribute('textAlign', 'right');
|
|
29499
29683
|
}
|
|
29500
29684
|
}
|
|
29501
29685
|
if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
|
|
29502
29686
|
const subTitleVerticalAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign : verticalAlign;
|
|
29503
29687
|
const subTitleYStart = maintextHeight;
|
|
29504
|
-
const subTitleHeight = (
|
|
29688
|
+
const subTitleHeight = (_49 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _49 !== void 0 ? _49 : 0;
|
|
29505
29689
|
if (subTitleVerticalAlign === 'top') {
|
|
29506
|
-
(
|
|
29507
|
-
(
|
|
29690
|
+
(_50 = this._subTitle) === null || _50 === void 0 ? void 0 : _50.setAttribute('y', subTitleYStart);
|
|
29691
|
+
(_51 = this._subTitle) === null || _51 === void 0 ? void 0 : _51.setAttribute('textBaseline', 'top');
|
|
29508
29692
|
}
|
|
29509
29693
|
else if (subTitleVerticalAlign === 'middle') {
|
|
29510
|
-
(
|
|
29511
|
-
(
|
|
29694
|
+
(_52 = this._subTitle) === null || _52 === void 0 ? void 0 : _52.setAttribute('y', subTitleYStart + subTitleHeight / 2);
|
|
29695
|
+
(_53 = this._subTitle) === null || _53 === void 0 ? void 0 : _53.setAttribute('textBaseline', 'middle');
|
|
29512
29696
|
}
|
|
29513
29697
|
else if (subTitleVerticalAlign === 'bottom') {
|
|
29514
|
-
(
|
|
29515
|
-
(
|
|
29698
|
+
(_54 = this._subTitle) === null || _54 === void 0 ? void 0 : _54.setAttribute('y', subTitleYStart + subTitleHeight);
|
|
29699
|
+
(_55 = this._subTitle) === null || _55 === void 0 ? void 0 : _55.setAttribute('textBaseline', 'bottom');
|
|
29516
29700
|
}
|
|
29517
29701
|
}
|
|
29518
29702
|
}
|
|
@@ -29567,7 +29751,7 @@
|
|
|
29567
29751
|
this.name = 'indicator';
|
|
29568
29752
|
}
|
|
29569
29753
|
render() {
|
|
29570
|
-
var _a;
|
|
29754
|
+
var _a, _b, _c;
|
|
29571
29755
|
const { visible, title, content, size, limitRatio = Infinity } = this.attribute;
|
|
29572
29756
|
const limit = Math.min(size.width, size.height) * limitRatio;
|
|
29573
29757
|
const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group');
|
|
@@ -29578,7 +29762,15 @@
|
|
|
29578
29762
|
if (vutils.isValid(title)) {
|
|
29579
29763
|
if (title.visible !== false) {
|
|
29580
29764
|
const titleStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);
|
|
29581
|
-
|
|
29765
|
+
if (titleStyle.type === 'rich') {
|
|
29766
|
+
this._title = group.createOrUpdateChild('indicator-title', Object.assign(Object.assign({ textConfig: titleStyle.text }, titleStyle), { visible: title.visible, x: 0, y: 0, width: (_a = titleStyle.width) !== null && _a !== void 0 ? _a : 0, height: (_b = titleStyle.height) !== null && _b !== void 0 ? _b : 0 }), 'richtext');
|
|
29767
|
+
}
|
|
29768
|
+
else if (titleStyle.type === 'html') {
|
|
29769
|
+
this._title = group.createOrUpdateChild('indicator-title', Object.assign(Object.assign({ textConfig: [], html: Object.assign(Object.assign({ dom: titleStyle.text }, DEFAULT_HTML_TEXT_SPEC), titleStyle) }, titleStyle), { visible: title.visible, x: 0, y: 0 }), 'richtext');
|
|
29770
|
+
}
|
|
29771
|
+
else {
|
|
29772
|
+
this._title = group.createOrUpdateChild('indicator-title', Object.assign(Object.assign({}, titleStyle), { lineHeight: vutils.isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize, visible: title.visible, x: 0, y: 0 }), 'text');
|
|
29773
|
+
}
|
|
29582
29774
|
if (title.autoFit && vutils.isValidNumber(limit)) {
|
|
29583
29775
|
this._setAutoFit(limit, this._title, title);
|
|
29584
29776
|
}
|
|
@@ -29599,9 +29791,19 @@
|
|
|
29599
29791
|
const contentComponents = [];
|
|
29600
29792
|
let lastContentHeight = 0;
|
|
29601
29793
|
contents.forEach((contentItem, i) => {
|
|
29794
|
+
var _a, _b;
|
|
29602
29795
|
if (contentItem.visible !== false) {
|
|
29603
29796
|
const contentStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);
|
|
29604
|
-
|
|
29797
|
+
let contentComponent;
|
|
29798
|
+
if (contentStyle.type === 'rich') {
|
|
29799
|
+
contentComponent = group.createOrUpdateChild('indicator-content-' + i, Object.assign(Object.assign({ textConfig: contentStyle.text }, contentStyle), { visible: title.visible, x: 0, y: titleHeight + titleSpace + lastContentHeight, width: (_a = contentStyle.width) !== null && _a !== void 0 ? _a : 0, height: (_b = contentStyle.height) !== null && _b !== void 0 ? _b : 0 }), 'richtext');
|
|
29800
|
+
}
|
|
29801
|
+
else if (contentStyle.type === 'html') {
|
|
29802
|
+
contentComponent = group.createOrUpdateChild('indicator-content-' + i, Object.assign(Object.assign({ textConfig: [], html: Object.assign(Object.assign({ dom: contentStyle.text }, DEFAULT_HTML_TEXT_SPEC), contentStyle) }, contentStyle), { visible: title.visible, x: 0, y: titleHeight + titleSpace + lastContentHeight }), 'richtext');
|
|
29803
|
+
}
|
|
29804
|
+
else {
|
|
29805
|
+
contentComponent = group.createOrUpdateChild('indicator-content-' + i, Object.assign(Object.assign({}, contentStyle), { lineHeight: vutils.isValid(contentStyle.lineHeight) ? contentStyle.lineHeight : contentStyle.fontSize, visible: contentItem.visible, x: 0, y: titleHeight + titleSpace + lastContentHeight }), 'text');
|
|
29806
|
+
}
|
|
29605
29807
|
if (contentItem.autoFit && vutils.isValidNumber(limit)) {
|
|
29606
29808
|
this._setAutoFit(limit, contentComponent, contentItem);
|
|
29607
29809
|
}
|
|
@@ -29619,13 +29821,13 @@
|
|
|
29619
29821
|
});
|
|
29620
29822
|
this._content = contentComponents;
|
|
29621
29823
|
}
|
|
29622
|
-
const totalHeight = (
|
|
29824
|
+
const totalHeight = (_c = group === null || group === void 0 ? void 0 : group.AABBBounds.height()) !== null && _c !== void 0 ? _c : 0;
|
|
29623
29825
|
group.setAttribute('y', size.height / 2 - totalHeight / 2);
|
|
29624
29826
|
group.setAttribute('x', size.width / 2);
|
|
29625
29827
|
}
|
|
29626
29828
|
_setAutoFit(limit, indicatorItem, indicatorItemSpec) {
|
|
29627
29829
|
var _a, _b, _c, _d, _e, _f;
|
|
29628
|
-
const originWidth = measureTextSize((_b = (_a = indicatorItemSpec.style) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : '', (_c = indicatorItemSpec.style) !== null && _c !== void 0 ? _c : {}).width;
|
|
29830
|
+
const originWidth = measureTextSize(((_b = (_a = indicatorItemSpec.style) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : ''), ((_c = indicatorItemSpec.style) !== null && _c !== void 0 ? _c : {})).width;
|
|
29629
29831
|
if (originWidth > 0) {
|
|
29630
29832
|
const ratio = (limit * ((_d = indicatorItemSpec.fitPercent) !== null && _d !== void 0 ? _d : 0.5)) / originWidth;
|
|
29631
29833
|
const fontSize = Math.floor(((_f = (_e = indicatorItemSpec.style) === null || _e === void 0 ? void 0 : _e.fontSize) !== null && _f !== void 0 ? _f : 20) * ratio);
|
|
@@ -30864,6 +31066,17 @@
|
|
|
30864
31066
|
};
|
|
30865
31067
|
const getRichTextAttribute = (attr) => {
|
|
30866
31068
|
const { width, height, wordBreak = 'break-word', textAlign, textBaseline, text } = attr;
|
|
31069
|
+
if (Array.isArray(text)) {
|
|
31070
|
+
return {
|
|
31071
|
+
width,
|
|
31072
|
+
height,
|
|
31073
|
+
wordBreak: wordBreak,
|
|
31074
|
+
textAlign: textAlign,
|
|
31075
|
+
textBaseline: textBaseline,
|
|
31076
|
+
singleLine: false,
|
|
31077
|
+
textConfig: vutils.array(text).map(text => (Object.assign(Object.assign({}, attr), { text })))
|
|
31078
|
+
};
|
|
31079
|
+
}
|
|
30867
31080
|
return {
|
|
30868
31081
|
width,
|
|
30869
31082
|
height,
|
|
@@ -30871,7 +31084,7 @@
|
|
|
30871
31084
|
textAlign: textAlign,
|
|
30872
31085
|
textBaseline: textBaseline,
|
|
30873
31086
|
singleLine: false,
|
|
30874
|
-
textConfig:
|
|
31087
|
+
textConfig: text.text
|
|
30875
31088
|
};
|
|
30876
31089
|
};
|
|
30877
31090
|
|
|
@@ -30960,6 +31173,7 @@
|
|
|
30960
31173
|
this.name = 'tooltip';
|
|
30961
31174
|
}
|
|
30962
31175
|
render() {
|
|
31176
|
+
var _a;
|
|
30963
31177
|
const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure } = this.attribute;
|
|
30964
31178
|
if (!visible) {
|
|
30965
31179
|
this.hideAll();
|
|
@@ -30978,11 +31192,22 @@
|
|
|
30978
31192
|
this._tooltipTitleSymbol = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, vutils.merge({ symbolType: 'circle' }, titleAttr.shape, {
|
|
30979
31193
|
visible: isVisible(titleAttr) && isVisible(titleAttr.shape)
|
|
30980
31194
|
}), 'symbol');
|
|
30981
|
-
if (titleAttr.value.
|
|
31195
|
+
if (typeof titleAttr.value.text === 'object' &&
|
|
31196
|
+
titleAttr.value.text !== null &&
|
|
31197
|
+
(titleAttr.value.text.type === 'rich' ||
|
|
31198
|
+
titleAttr.value.text.type === 'html')) {
|
|
31199
|
+
if (titleAttr.value.text.type === 'rich') {
|
|
31200
|
+
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, getRichTextAttribute(titleAttr.value)), 'richtext');
|
|
31201
|
+
}
|
|
31202
|
+
else if (titleAttr.value.text.type === 'html') {
|
|
31203
|
+
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ html: Object.assign(Object.assign({ dom: titleAttr.value.text.text }, DEFAULT_HTML_TEXT_SPEC), titleAttr.value), visible: isVisible(titleAttr) && isVisible(titleAttr.value), width: titleAttr.value.width, height: titleAttr.value.height, wordBreak: titleAttr.value.wordBreak, textAlign: titleAttr.value.textAlign, textBaseline: titleAttr.value.textBaseline, singleLine: false, textConfig: [] }, titleAttr.value), 'richtext');
|
|
31204
|
+
}
|
|
31205
|
+
}
|
|
31206
|
+
else if (titleAttr.value.multiLine) {
|
|
30982
31207
|
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, getRichTextAttribute(titleAttr.value)), 'richtext');
|
|
30983
31208
|
}
|
|
30984
31209
|
else {
|
|
30985
|
-
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ text: '', visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, titleAttr.value), 'text');
|
|
31210
|
+
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ text: ((_a = titleAttr.value.text) !== null && _a !== void 0 ? _a : ''), visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, titleAttr.value), 'text');
|
|
30986
31211
|
}
|
|
30987
31212
|
const titlePaddingLeft = isVisible(titleAttr.shape) ? titleAttr.shape.size + titleAttr.shape.spacing : 0;
|
|
30988
31213
|
const { textAlign, textBaseline } = titleAttr.value;
|
|
@@ -31013,7 +31238,7 @@
|
|
|
31013
31238
|
this._tooltipContent.setAttribute('y', padding[0] + titleHeight);
|
|
31014
31239
|
let lastYPos = 0;
|
|
31015
31240
|
content.forEach((item, i) => {
|
|
31016
|
-
var _a;
|
|
31241
|
+
var _a, _b, _c;
|
|
31017
31242
|
const itemAttr = Tooltip.getContentAttr(this.attribute, i);
|
|
31018
31243
|
if (!isVisible(itemAttr)) {
|
|
31019
31244
|
return;
|
|
@@ -31023,7 +31248,9 @@
|
|
|
31023
31248
|
let x = 0;
|
|
31024
31249
|
if (isVisible(itemAttr.shape)) {
|
|
31025
31250
|
itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, Object.assign({ visible: true, x: itemAttr.shape.size / 2, y: itemAttr.shape.size / 2 +
|
|
31026
|
-
(((_a = itemAttr.key.lineHeight) !== null && _a !== void 0 ? _a : itemAttr.key.fontSize) -
|
|
31251
|
+
(((_a = calculateLineHeight(itemAttr.key.lineHeight, itemAttr.key.fontSize)) !== null && _a !== void 0 ? _a : itemAttr.key.fontSize) -
|
|
31252
|
+
itemAttr.shape.size) /
|
|
31253
|
+
2 }, itemAttr.shape), 'symbol');
|
|
31027
31254
|
}
|
|
31028
31255
|
if (hasContentShape) {
|
|
31029
31256
|
x += itemAttr.shape.size + itemAttr.shape.spacing;
|
|
@@ -31033,8 +31260,21 @@
|
|
|
31033
31260
|
if (itemAttr.key.multiLine) {
|
|
31034
31261
|
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.key)), { textBaseline: 'top' }), 'richtext');
|
|
31035
31262
|
}
|
|
31263
|
+
else if (typeof itemAttr.key.text === 'object' &&
|
|
31264
|
+
itemAttr.key.text !== null &&
|
|
31265
|
+
(itemAttr.key.text.type === 'rich' ||
|
|
31266
|
+
itemAttr.key.text.type === 'html')) {
|
|
31267
|
+
if (itemAttr.key.text.type === 'rich') {
|
|
31268
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.key)), { textBaseline: 'top' }), 'richtext');
|
|
31269
|
+
}
|
|
31270
|
+
else {
|
|
31271
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, {
|
|
31272
|
+
html: Object.assign(Object.assign({ dom: itemAttr.key.text.text }, DEFAULT_HTML_TEXT_SPEC), itemAttr.key)
|
|
31273
|
+
}, 'richtext');
|
|
31274
|
+
}
|
|
31275
|
+
}
|
|
31036
31276
|
else {
|
|
31037
|
-
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, itemAttr.key), { textBaseline: 'top' }), 'text');
|
|
31277
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true, text: ((_b = itemAttr.key.text) !== null && _b !== void 0 ? _b : '') }, itemAttr.key), { textBaseline: 'top' }), 'text');
|
|
31038
31278
|
}
|
|
31039
31279
|
const { textAlign } = itemAttr.key;
|
|
31040
31280
|
if (textAlign === 'center') {
|
|
@@ -31054,8 +31294,21 @@
|
|
|
31054
31294
|
if (itemAttr.value.multiLine) {
|
|
31055
31295
|
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.value)), { textBaseline: 'top' }), 'richtext');
|
|
31056
31296
|
}
|
|
31297
|
+
else if (typeof itemAttr.value.text === 'object' &&
|
|
31298
|
+
itemAttr.value.text !== null &&
|
|
31299
|
+
(itemAttr.value.text.type === 'rich' ||
|
|
31300
|
+
itemAttr.value.text.type === 'html')) {
|
|
31301
|
+
if (itemAttr.value.text.type === 'rich') {
|
|
31302
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.value)), { textBaseline: 'top' }), 'richtext');
|
|
31303
|
+
}
|
|
31304
|
+
else {
|
|
31305
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, {
|
|
31306
|
+
html: Object.assign({ dom: itemAttr.value.text.text, container: '', width: 30, height: 30, style: {} }, itemAttr.value)
|
|
31307
|
+
}, 'richtext');
|
|
31308
|
+
}
|
|
31309
|
+
}
|
|
31057
31310
|
else {
|
|
31058
|
-
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, itemAttr.value), { textBaseline: 'top' }), 'text');
|
|
31311
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true, text: ((_c = itemAttr.value.text) !== null && _c !== void 0 ? _c : '') }, itemAttr.value), { textBaseline: 'top' }), 'text');
|
|
31059
31312
|
}
|
|
31060
31313
|
let textAlign = 'right';
|
|
31061
31314
|
if (vutils.isValid(itemAttr.value.textAlign)) {
|
|
@@ -31147,7 +31400,7 @@
|
|
|
31147
31400
|
let titleMaxHeight = 0;
|
|
31148
31401
|
const { value: titleValue, shape: titleShape } = titleAttr;
|
|
31149
31402
|
const { visible: titleHasShape = false, symbolType: titleShapeType = '' } = titleShape !== null && titleShape !== void 0 ? titleShape : {};
|
|
31150
|
-
if (vutils.isValid(titleValue)) {
|
|
31403
|
+
if (vutils.isValid(titleValue) && typeof titleAttr.value.text !== 'object') {
|
|
31151
31404
|
const { width, height } = initTextMeasure(titleValue).quickMeasure(titleValue.text);
|
|
31152
31405
|
maxWidth = width;
|
|
31153
31406
|
titleMaxHeight = height;
|
|
@@ -31404,11 +31657,12 @@
|
|
|
31404
31657
|
}
|
|
31405
31658
|
};
|
|
31406
31659
|
|
|
31407
|
-
const version = "0.16.
|
|
31660
|
+
const version = "0.16.14-alpha.11";
|
|
31408
31661
|
|
|
31409
31662
|
exports.AbstractComponent = AbstractComponent;
|
|
31410
31663
|
exports.ArcInfo = ArcInfo;
|
|
31411
31664
|
exports.ArcLabel = ArcLabel;
|
|
31665
|
+
exports.AreaLabel = AreaLabel;
|
|
31412
31666
|
exports.BasePlayer = BasePlayer;
|
|
31413
31667
|
exports.Brush = Brush;
|
|
31414
31668
|
exports.CheckBox = CheckBox;
|