@visactor/vrender-components 0.16.14-alpha.1 → 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 +595 -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
|
@@ -8586,8 +8586,7 @@
|
|
|
8586
8586
|
}, {
|
|
8587
8587
|
key: "addChild",
|
|
8588
8588
|
value: function addChild(node) {
|
|
8589
|
-
|
|
8590
|
-
"__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));
|
|
8591
8590
|
}
|
|
8592
8591
|
}]);
|
|
8593
8592
|
return XmlNode;
|
|
@@ -10050,7 +10049,7 @@
|
|
|
10050
10049
|
}, {
|
|
10051
10050
|
key: "updateWrapAABBBounds",
|
|
10052
10051
|
value: function updateWrapAABBBounds(text) {
|
|
10053
|
-
var _a, _b, _c;
|
|
10052
|
+
var _a, _b, _c, _d;
|
|
10054
10053
|
var textTheme = getTheme(this).text,
|
|
10055
10054
|
_this$attribute = this.attribute,
|
|
10056
10055
|
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
@@ -10061,8 +10060,6 @@
|
|
|
10061
10060
|
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
10062
10061
|
_this$attribute$fontS = _this$attribute.fontSize,
|
|
10063
10062
|
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
10064
|
-
_this$attribute$lineH = _this$attribute.lineHeight,
|
|
10065
|
-
lineHeight = _this$attribute$lineH === void 0 ? calculateLineHeight(this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize, this.attribute.fontSize || textTheme.fontSize) : _this$attribute$lineH,
|
|
10066
10063
|
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
10067
10064
|
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
10068
10065
|
maxLineWidth = _this$attribute.maxLineWidth,
|
|
@@ -10079,8 +10076,9 @@
|
|
|
10079
10076
|
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
10080
10077
|
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
10081
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,
|
|
10082
10080
|
buf = ignoreBuf ? 0 : 2;
|
|
10083
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
10081
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10084
10082
|
var _bbox = this.cache.layoutData.bbox;
|
|
10085
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;
|
|
10086
10084
|
}
|
|
@@ -10112,7 +10110,7 @@
|
|
|
10112
10110
|
if ("" !== str && "" === clip.str) {
|
|
10113
10111
|
if (ellipsis) {
|
|
10114
10112
|
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10115
|
-
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;
|
|
10116
10114
|
} else clip.str = "", clip.width = 0;
|
|
10117
10115
|
needCut = !1;
|
|
10118
10116
|
}
|
|
@@ -10210,8 +10208,7 @@
|
|
|
10210
10208
|
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
10211
10209
|
var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
|
|
10212
10210
|
textFontSize = attribute.fontSize || textTheme.fontSize,
|
|
10213
|
-
|
|
10214
|
-
lineHeight = _attribute$lineHeight === void 0 ? calculateLineHeight(null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : textFontSize, textFontSize) + buf : _attribute$lineHeight;
|
|
10211
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
|
|
10215
10212
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
10216
10213
|
width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
|
|
10217
10214
|
var _dx = textDrawOffsetX(textAlign, width),
|
|
@@ -10281,12 +10278,11 @@
|
|
|
10281
10278
|
fontFamily = _attribute$fontFamily2 === void 0 ? textTheme.fontFamily : _attribute$fontFamily2,
|
|
10282
10279
|
_attribute$stroke2 = attribute.stroke,
|
|
10283
10280
|
stroke = _attribute$stroke2 === void 0 ? textTheme.stroke : _attribute$stroke2,
|
|
10284
|
-
_attribute$lineHeight2 = attribute.lineHeight,
|
|
10285
|
-
lineHeight = _attribute$lineHeight2 === void 0 ? calculateLineHeight(null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize, attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight2,
|
|
10286
10281
|
_attribute$lineWidth2 = attribute.lineWidth,
|
|
10287
10282
|
lineWidth = _attribute$lineWidth2 === void 0 ? textTheme.lineWidth : _attribute$lineWidth2,
|
|
10288
10283
|
_attribute$verticalMo = attribute.verticalMode,
|
|
10289
|
-
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;
|
|
10290
10286
|
var _attribute$textAlign2 = attribute.textAlign,
|
|
10291
10287
|
textAlign = _attribute$textAlign2 === void 0 ? textTheme.textAlign : _attribute$textAlign2,
|
|
10292
10288
|
_attribute$textBaseli2 = attribute.textBaseline,
|
|
@@ -10336,7 +10332,7 @@
|
|
|
10336
10332
|
}, {
|
|
10337
10333
|
key: "updateHorizontalMultilineAABBBounds",
|
|
10338
10334
|
value: function updateHorizontalMultilineAABBBounds(text) {
|
|
10339
|
-
var _a;
|
|
10335
|
+
var _a, _b;
|
|
10340
10336
|
var textTheme = getTheme(this).text,
|
|
10341
10337
|
attribute = this.attribute,
|
|
10342
10338
|
_attribute$fontFamily3 = attribute.fontFamily,
|
|
@@ -10349,8 +10345,6 @@
|
|
|
10349
10345
|
fontSize = _attribute$fontSize3 === void 0 ? textTheme.fontSize : _attribute$fontSize3,
|
|
10350
10346
|
_attribute$fontWeight3 = attribute.fontWeight,
|
|
10351
10347
|
fontWeight = _attribute$fontWeight3 === void 0 ? textTheme.fontWeight : _attribute$fontWeight3,
|
|
10352
|
-
_attribute$lineHeight3 = attribute.lineHeight,
|
|
10353
|
-
lineHeight = _attribute$lineHeight3 === void 0 ? calculateLineHeight(attribute.lineHeight || attribute.fontSize || textTheme.fontSize, attribute.fontSize || textTheme.fontSize) : _attribute$lineHeight3,
|
|
10354
10348
|
_attribute$ellipsis3 = attribute.ellipsis,
|
|
10355
10349
|
ellipsis = _attribute$ellipsis3 === void 0 ? textTheme.ellipsis : _attribute$ellipsis3,
|
|
10356
10350
|
maxLineWidth = attribute.maxLineWidth,
|
|
@@ -10359,9 +10353,10 @@
|
|
|
10359
10353
|
_attribute$lineWidth3 = attribute.lineWidth,
|
|
10360
10354
|
lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
|
|
10361
10355
|
_attribute$whiteSpace2 = attribute.whiteSpace,
|
|
10362
|
-
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;
|
|
10363
10358
|
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
10364
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
10359
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10365
10360
|
var _bbox2 = this.cache.layoutData.bbox;
|
|
10366
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;
|
|
10367
10362
|
}
|
|
@@ -10397,12 +10392,11 @@
|
|
|
10397
10392
|
fontWeight = _attribute$fontWeight4 === void 0 ? textTheme.fontWeight : _attribute$fontWeight4,
|
|
10398
10393
|
_attribute$stroke4 = attribute.stroke,
|
|
10399
10394
|
stroke = _attribute$stroke4 === void 0 ? textTheme.stroke : _attribute$stroke4,
|
|
10400
|
-
_attribute$lineHeight4 = attribute.lineHeight,
|
|
10401
|
-
lineHeight = _attribute$lineHeight4 === void 0 ? calculateLineHeight(null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize, attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight4,
|
|
10402
10395
|
_attribute$lineWidth4 = attribute.lineWidth,
|
|
10403
10396
|
lineWidth = _attribute$lineWidth4 === void 0 ? textTheme.lineWidth : _attribute$lineWidth4,
|
|
10404
10397
|
_attribute$verticalMo2 = attribute.verticalMode,
|
|
10405
|
-
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;
|
|
10406
10400
|
var _attribute$textAlign4 = attribute.textAlign,
|
|
10407
10401
|
textAlign = _attribute$textAlign4 === void 0 ? textTheme.textAlign : _attribute$textAlign4,
|
|
10408
10402
|
_attribute$textBaseli4 = attribute.textBaseline,
|
|
@@ -10535,7 +10529,7 @@
|
|
|
10535
10529
|
}, {
|
|
10536
10530
|
key: "updateMultilineAABBBounds",
|
|
10537
10531
|
value: function updateMultilineAABBBounds(text) {
|
|
10538
|
-
var _a, _b, _c;
|
|
10532
|
+
var _a, _b, _c, _d;
|
|
10539
10533
|
var textTheme = getTheme(this).text,
|
|
10540
10534
|
_this$attribute = this.attribute,
|
|
10541
10535
|
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
@@ -10546,8 +10540,6 @@
|
|
|
10546
10540
|
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
10547
10541
|
_this$attribute$fontS = _this$attribute.fontSize,
|
|
10548
10542
|
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
10549
|
-
_this$attribute$lineH = _this$attribute.lineHeight,
|
|
10550
|
-
lineHeight = _this$attribute$lineH === void 0 ? calculateLineHeight(this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize, this.attribute.fontSize || textTheme.fontSize) : _this$attribute$lineH,
|
|
10551
10543
|
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
10552
10544
|
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
10553
10545
|
maxLineWidth = _this$attribute.maxLineWidth,
|
|
@@ -10564,8 +10556,9 @@
|
|
|
10564
10556
|
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
10565
10557
|
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
10566
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,
|
|
10567
10560
|
buf = ignoreBuf ? 0 : 2;
|
|
10568
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
10561
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10569
10562
|
var _bbox = this.cache.layoutData.bbox;
|
|
10570
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;
|
|
10571
10564
|
}
|
|
@@ -10597,7 +10590,7 @@
|
|
|
10597
10590
|
if ("" !== str && "" === clip.str) {
|
|
10598
10591
|
if (ellipsis) {
|
|
10599
10592
|
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10600
|
-
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;
|
|
10601
10594
|
} else clip.str = "", clip.width = 0;
|
|
10602
10595
|
needCut = !1;
|
|
10603
10596
|
}
|
|
@@ -11344,32 +11337,37 @@
|
|
|
11344
11337
|
}(BaseSymbol);
|
|
11345
11338
|
var close$1 = new CloseSymbol();
|
|
11346
11339
|
|
|
11347
|
-
function
|
|
11340
|
+
function rectSizeArray(ctx, size, x, y) {
|
|
11348
11341
|
return ctx.rect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]), !1;
|
|
11349
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
|
+
}
|
|
11350
11348
|
var RectSymbol = /*#__PURE__*/function (_BaseSymbol) {
|
|
11351
11349
|
_inherits(RectSymbol, _BaseSymbol);
|
|
11352
11350
|
var _super = _createSuper(RectSymbol);
|
|
11353
11351
|
function RectSymbol() {
|
|
11354
11352
|
var _this;
|
|
11355
11353
|
_classCallCheck(this, RectSymbol);
|
|
11356
|
-
_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";
|
|
11357
11355
|
return _this;
|
|
11358
11356
|
}
|
|
11359
11357
|
_createClass(RectSymbol, [{
|
|
11360
11358
|
key: "draw",
|
|
11361
11359
|
value: function draw(ctx, size, x, y) {
|
|
11362
|
-
return
|
|
11360
|
+
return vutils.isNumber(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
|
|
11363
11361
|
}
|
|
11364
11362
|
}, {
|
|
11365
11363
|
key: "drawOffset",
|
|
11366
11364
|
value: function drawOffset(ctx, size, x, y, offset) {
|
|
11367
|
-
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);
|
|
11368
11366
|
}
|
|
11369
11367
|
}]);
|
|
11370
11368
|
return RectSymbol;
|
|
11371
11369
|
}(BaseSymbol);
|
|
11372
|
-
var rect
|
|
11370
|
+
var rect = new RectSymbol();
|
|
11373
11371
|
|
|
11374
11372
|
var tempBounds = new vutils.AABBBounds();
|
|
11375
11373
|
var CustomSymbolClass = /*#__PURE__*/function () {
|
|
@@ -11408,11 +11406,17 @@
|
|
|
11408
11406
|
return CustomSymbolClass;
|
|
11409
11407
|
}();
|
|
11410
11408
|
|
|
11411
|
-
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];
|
|
11412
11410
|
var builtinSymbolsMap = {};
|
|
11413
11411
|
builtinSymbols.forEach(function (symbol) {
|
|
11414
11412
|
builtinSymbolsMap[symbol.type] = symbol;
|
|
11415
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
|
+
};
|
|
11416
11420
|
|
|
11417
11421
|
var SYMBOL_UPDATE_TAG_KEY = ["symbolType", "size"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
11418
11422
|
var _Symbol = /*#__PURE__*/function (_Graphic) {
|
|
@@ -11446,12 +11450,13 @@
|
|
|
11446
11450
|
}, {
|
|
11447
11451
|
key: "doUpdateParsedPath",
|
|
11448
11452
|
value: function doUpdateParsedPath() {
|
|
11449
|
-
var symbolTheme = getTheme(this).symbol
|
|
11450
|
-
|
|
11451
|
-
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo
|
|
11452
|
-
|
|
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];
|
|
11453
11457
|
if (path) return this._parsedPath = path, path;
|
|
11454
11458
|
if (path = _Symbol.userSymbolMap[symbolType], path) return this._parsedPath = path, path;
|
|
11459
|
+
symbolType = builtInSymbolStrMap[symbolType] || symbolType;
|
|
11455
11460
|
if (!0 === isSvg(symbolType)) {
|
|
11456
11461
|
var parser = new XMLParser(),
|
|
11457
11462
|
_parser$parse = parser.parse(symbolType),
|
|
@@ -11937,7 +11942,9 @@
|
|
|
11937
11942
|
var Paragraph = /*#__PURE__*/function () {
|
|
11938
11943
|
function Paragraph(text, newLine, character) {
|
|
11939
11944
|
_classCallCheck(this, Paragraph);
|
|
11940
|
-
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;
|
|
11941
11948
|
var _measureTextCanvas = measureTextCanvas(text, character),
|
|
11942
11949
|
ascent = _measureTextCanvas.ascent,
|
|
11943
11950
|
height = _measureTextCanvas.height,
|
|
@@ -12476,7 +12483,8 @@
|
|
|
12476
12483
|
var _this2 = this;
|
|
12477
12484
|
var _a;
|
|
12478
12485
|
var _this$attribute = this.attribute,
|
|
12479
|
-
|
|
12486
|
+
_this$attribute$textC = _this$attribute.textConfig,
|
|
12487
|
+
textConfig = _this$attribute$textC === void 0 ? [] : _this$attribute$textC,
|
|
12480
12488
|
maxWidth = _this$attribute.maxWidth,
|
|
12481
12489
|
maxHeight = _this$attribute.maxHeight,
|
|
12482
12490
|
width = _this$attribute.width,
|
|
@@ -15468,7 +15476,7 @@
|
|
|
15468
15476
|
var t = textAlign;
|
|
15469
15477
|
textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
|
|
15470
15478
|
}
|
|
15471
|
-
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,
|
|
15472
15480
|
data = this.valid(text, textAttribute, fillCb, strokeCb);
|
|
15473
15481
|
if (!data) return;
|
|
15474
15482
|
var fVisible = data.fVisible,
|
|
@@ -20788,18 +20796,18 @@
|
|
|
20788
20796
|
|
|
20789
20797
|
const defaultAlternativeColors = ['#ffffff', '#000000'];
|
|
20790
20798
|
const { Color } = vutils.ColorUtil;
|
|
20791
|
-
function labelSmartInvert(foregroundColorOrigin, backgroundColorOrogin, textType, contrastRatiosThreshold, alternativeColors) {
|
|
20799
|
+
function labelSmartInvert(foregroundColorOrigin, backgroundColorOrogin, textType, contrastRatiosThreshold, alternativeColors, mode) {
|
|
20792
20800
|
if (typeof foregroundColorOrigin !== 'string' || typeof backgroundColorOrogin !== 'string') {
|
|
20793
20801
|
return foregroundColorOrigin;
|
|
20794
20802
|
}
|
|
20795
20803
|
const foregroundColor = new Color(foregroundColorOrigin).toHex();
|
|
20796
20804
|
const backgroundColor = new Color(backgroundColorOrogin).toHex();
|
|
20797
|
-
if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold)) {
|
|
20798
|
-
return improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
|
|
20805
|
+
if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, mode)) {
|
|
20806
|
+
return improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode);
|
|
20799
20807
|
}
|
|
20800
20808
|
return foregroundColor;
|
|
20801
20809
|
}
|
|
20802
|
-
function improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors) {
|
|
20810
|
+
function improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode) {
|
|
20803
20811
|
const alternativeColorPalletes = [];
|
|
20804
20812
|
if (alternativeColors) {
|
|
20805
20813
|
if (alternativeColors instanceof Array) {
|
|
@@ -20814,13 +20822,27 @@
|
|
|
20814
20822
|
if (foregroundColor === alternativeColor) {
|
|
20815
20823
|
continue;
|
|
20816
20824
|
}
|
|
20817
|
-
if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold)) {
|
|
20825
|
+
if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold, mode)) {
|
|
20818
20826
|
return alternativeColor;
|
|
20819
20827
|
}
|
|
20820
20828
|
}
|
|
20821
20829
|
return undefined;
|
|
20822
20830
|
}
|
|
20823
|
-
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
|
+
}
|
|
20824
20846
|
if (contrastRatiosThreshold) {
|
|
20825
20847
|
if (contrastRatios(foregroundColor, backgroundColor) > contrastRatiosThreshold) {
|
|
20826
20848
|
return true;
|
|
@@ -20947,6 +20969,12 @@
|
|
|
20947
20969
|
[StateValue.hover]: {},
|
|
20948
20970
|
[StateValue.hoverReverse]: {}
|
|
20949
20971
|
};
|
|
20972
|
+
const DEFAULT_HTML_TEXT_SPEC = {
|
|
20973
|
+
container: '',
|
|
20974
|
+
width: 30,
|
|
20975
|
+
height: 30,
|
|
20976
|
+
style: {}
|
|
20977
|
+
};
|
|
20950
20978
|
|
|
20951
20979
|
const initTextMeasure = (textSpec, option, useNaiveCanvas) => {
|
|
20952
20980
|
return new vutils.TextMeasure(Object.assign({ defaultFontParams: {
|
|
@@ -20979,8 +21007,8 @@
|
|
|
20979
21007
|
this.name = 'tag';
|
|
20980
21008
|
}
|
|
20981
21009
|
render() {
|
|
20982
|
-
var _a;
|
|
20983
|
-
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;
|
|
20984
21012
|
const parsedPadding = vutils.normalizePadding(padding);
|
|
20985
21013
|
const group = this.createOrUpdateChild('tag-content', { x: 0, y: 0, zIndex: 1 }, 'group');
|
|
20986
21014
|
let symbol;
|
|
@@ -21002,75 +21030,100 @@
|
|
|
21002
21030
|
}
|
|
21003
21031
|
tagWidth += symbolPlaceWidth;
|
|
21004
21032
|
textX += symbolPlaceWidth;
|
|
21005
|
-
|
|
21006
|
-
if (
|
|
21007
|
-
|
|
21008
|
-
|
|
21009
|
-
|
|
21010
|
-
|
|
21011
|
-
|
|
21012
|
-
|
|
21013
|
-
|
|
21014
|
-
|
|
21015
|
-
const textHeight = textBounds.height;
|
|
21016
|
-
tagWidth += textWidth;
|
|
21017
|
-
const size = (_a = shape.size) !== null && _a !== void 0 ? _a : 10;
|
|
21018
|
-
const maxSize = vutils.isNumber(size) ? size : Math.max(size[0], size[1]);
|
|
21019
|
-
tagHeight += Math.max(textHeight, (shape === null || shape === void 0 ? void 0 : shape.visible) ? maxSize : 0);
|
|
21020
|
-
const { textAlign, textBaseline } = textStyle;
|
|
21021
|
-
if (vutils.isValid(minWidth) || vutils.isValid(maxWidth)) {
|
|
21022
|
-
if (vutils.isValid(minWidth) && tagWidth < minWidth) {
|
|
21023
|
-
tagWidth = minWidth;
|
|
21024
|
-
}
|
|
21025
|
-
if (vutils.isValid(maxWidth) && tagWidth > maxWidth) {
|
|
21026
|
-
tagWidth = maxWidth;
|
|
21027
|
-
textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
|
|
21028
|
-
}
|
|
21029
|
-
}
|
|
21030
|
-
let x = 0;
|
|
21031
|
-
let y = 0;
|
|
21032
|
-
if (textAlign === 'center') {
|
|
21033
|
-
x -= tagWidth / 2;
|
|
21034
|
-
if (symbol) {
|
|
21035
|
-
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
|
+
}
|
|
21036
21043
|
}
|
|
21037
|
-
group.setAttribute('x', -symbolPlaceWidth / 2);
|
|
21038
21044
|
}
|
|
21039
|
-
else if (
|
|
21040
|
-
x
|
|
21041
|
-
|
|
21042
|
-
|
|
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
|
+
}
|
|
21043
21054
|
}
|
|
21044
|
-
group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
|
|
21045
21055
|
}
|
|
21046
|
-
else
|
|
21047
|
-
|
|
21048
|
-
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
|
|
21052
|
-
|
|
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
|
+
}
|
|
21053
21081
|
}
|
|
21054
|
-
|
|
21055
|
-
|
|
21056
|
-
|
|
21057
|
-
|
|
21058
|
-
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);
|
|
21059
21090
|
}
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
|
|
21065
|
-
|
|
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);
|
|
21066
21097
|
}
|
|
21067
|
-
|
|
21068
|
-
|
|
21069
|
-
|
|
21070
|
-
|
|
21071
|
-
y
|
|
21072
|
-
|
|
21073
|
-
|
|
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
|
+
}
|
|
21074
21127
|
}
|
|
21075
21128
|
}
|
|
21076
21129
|
}
|
|
@@ -21942,6 +21995,45 @@
|
|
|
21942
21995
|
var _a, _b;
|
|
21943
21996
|
return (_b = (_a = animationEffects[type]) === null || _a === void 0 ? void 0 : _a.call(animationEffects, textAttribute)) !== null && _b !== void 0 ? _b : { from: {}, to: {} };
|
|
21944
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
|
+
}
|
|
21945
22037
|
const DefaultLabelAnimation = {
|
|
21946
22038
|
mode: 'same-time',
|
|
21947
22039
|
duration: 300,
|
|
@@ -22135,6 +22227,24 @@
|
|
|
22135
22227
|
}
|
|
22136
22228
|
return points;
|
|
22137
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
|
+
}
|
|
22138
22248
|
|
|
22139
22249
|
class LabelBase extends AbstractComponent {
|
|
22140
22250
|
setBitmap(bitmap) {
|
|
@@ -22282,13 +22392,31 @@
|
|
|
22282
22392
|
target.states = state;
|
|
22283
22393
|
}
|
|
22284
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
|
+
}
|
|
22285
22413
|
const text = createText(attributes);
|
|
22286
22414
|
this._bindEvent(text);
|
|
22287
22415
|
this._setStatesOfText(text);
|
|
22288
22416
|
return text;
|
|
22289
22417
|
}
|
|
22290
22418
|
_prepare() {
|
|
22291
|
-
var _a, _b, _c, _d;
|
|
22419
|
+
var _a, _b, _c, _d, _e;
|
|
22292
22420
|
const currentBaseMarks = [];
|
|
22293
22421
|
let baseMarks;
|
|
22294
22422
|
if (vutils.isFunction(this.attribute.getBaseMarks)) {
|
|
@@ -22305,7 +22433,7 @@
|
|
|
22305
22433
|
(_a = this._idToGraphic) === null || _a === void 0 ? void 0 : _a.clear();
|
|
22306
22434
|
(_b = this._idToPoint) === null || _b === void 0 ? void 0 : _b.clear();
|
|
22307
22435
|
this._baseMarks = currentBaseMarks;
|
|
22308
|
-
this._isCollectionBase =
|
|
22436
|
+
this._isCollectionBase = this.attribute.type === 'line-data';
|
|
22309
22437
|
if (!currentBaseMarks || currentBaseMarks.length === 0) {
|
|
22310
22438
|
return;
|
|
22311
22439
|
}
|
|
@@ -22351,6 +22479,15 @@
|
|
|
22351
22479
|
}
|
|
22352
22480
|
}
|
|
22353
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
|
+
}
|
|
22354
22491
|
}
|
|
22355
22492
|
getRelatedGrphic(item) {
|
|
22356
22493
|
return this._idToGraphic.get(item.id);
|
|
@@ -22368,10 +22505,11 @@
|
|
|
22368
22505
|
: baseMark.attribute.fill }, textStyle), textData);
|
|
22369
22506
|
const text = this._createLabelText(labelAttribute);
|
|
22370
22507
|
const textBounds = this.getGraphicBounds(text);
|
|
22508
|
+
const actualPosition = vutils.isFunction(position) ? position(textData) : position;
|
|
22371
22509
|
const graphicBounds = this._isCollectionBase
|
|
22372
|
-
? this.getGraphicBounds(null, this._idToPoint.get(textData.id))
|
|
22373
|
-
: this.getGraphicBounds(baseMark, { x: textData.x, y: textData.y });
|
|
22374
|
-
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);
|
|
22375
22513
|
if (textLocation) {
|
|
22376
22514
|
labelAttribute.x = textLocation.x;
|
|
22377
22515
|
labelAttribute.y = textLocation.y;
|
|
@@ -22452,13 +22590,19 @@
|
|
|
22452
22590
|
}
|
|
22453
22591
|
if (!hasPlace && clampForce) {
|
|
22454
22592
|
const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);
|
|
22455
|
-
if (
|
|
22456
|
-
canPlace(bmpTool, bitmap, {
|
|
22457
|
-
|
|
22458
|
-
|
|
22459
|
-
|
|
22460
|
-
|
|
22461
|
-
|
|
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
|
+
})) {
|
|
22462
22606
|
text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
|
|
22463
22607
|
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
22464
22608
|
result.push(text);
|
|
@@ -22498,12 +22642,6 @@
|
|
|
22498
22642
|
}
|
|
22499
22643
|
}
|
|
22500
22644
|
_renderWithAnimation(labels) {
|
|
22501
|
-
var _a, _b, _c, _d, _e;
|
|
22502
|
-
const animationConfig = ((_a = this.attribute.animation) !== null && _a !== void 0 ? _a : {});
|
|
22503
|
-
const mode = (_b = animationConfig.mode) !== null && _b !== void 0 ? _b : DefaultLabelAnimation.mode;
|
|
22504
|
-
const duration = (_c = animationConfig.duration) !== null && _c !== void 0 ? _c : DefaultLabelAnimation.duration;
|
|
22505
|
-
const easing = (_d = animationConfig.easing) !== null && _d !== void 0 ? _d : DefaultLabelAnimation.easing;
|
|
22506
|
-
const delay = (_e = animationConfig.delay) !== null && _e !== void 0 ? _e : 0;
|
|
22507
22645
|
const currentTextMap = new Map();
|
|
22508
22646
|
const prevTextMap = this._graphicToText || new Map();
|
|
22509
22647
|
const texts = [];
|
|
@@ -22527,13 +22665,7 @@
|
|
|
22527
22665
|
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
22528
22666
|
relatedGraphic.once('animate-bind', a => {
|
|
22529
22667
|
text.setAttributes(from);
|
|
22530
|
-
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic,
|
|
22531
|
-
mode,
|
|
22532
|
-
duration,
|
|
22533
|
-
easing,
|
|
22534
|
-
to,
|
|
22535
|
-
delay
|
|
22536
|
-
});
|
|
22668
|
+
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, this._animationConfig.enter);
|
|
22537
22669
|
relatedGraphic.on('afterAttributeUpdate', listener);
|
|
22538
22670
|
});
|
|
22539
22671
|
}
|
|
@@ -22543,25 +22675,19 @@
|
|
|
22543
22675
|
prevTextMap.delete(textKey);
|
|
22544
22676
|
currentTextMap.set(textKey, prevLabel);
|
|
22545
22677
|
const prevText = prevLabel.text;
|
|
22546
|
-
|
|
22678
|
+
const { duration, easing } = this._animationConfig.update;
|
|
22679
|
+
updateAnimation(prevText, text, this._animationConfig.update);
|
|
22547
22680
|
if (prevLabel.labelLine) {
|
|
22548
22681
|
prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
|
|
22549
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,
|
|
22550
22683
|
points: (_g = text.attribute) === null || _g === void 0 ? void 0 : _g.points
|
|
22551
22684
|
}), duration, easing);
|
|
22552
22685
|
}
|
|
22553
|
-
if (animationConfig.increaseEffect !== false &&
|
|
22554
|
-
prevText.attribute.text !== text.attribute.text &&
|
|
22555
|
-
vutils.isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))) {
|
|
22556
|
-
prevText
|
|
22557
|
-
.animate()
|
|
22558
|
-
.play(new IncreaseCount({ text: prevText.attribute.text }, { text: text.attribute.text }, duration, easing));
|
|
22559
|
-
}
|
|
22560
22686
|
}
|
|
22561
22687
|
});
|
|
22562
22688
|
prevTextMap.forEach(label => {
|
|
22563
22689
|
var _a;
|
|
22564
|
-
(_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(() => {
|
|
22565
22691
|
this.removeChild(label.text);
|
|
22566
22692
|
if (label === null || label === void 0 ? void 0 : label.labelLine) {
|
|
22567
22693
|
this.removeChild(label.labelLine);
|
|
@@ -22610,7 +22736,7 @@
|
|
|
22610
22736
|
relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);
|
|
22611
22737
|
}
|
|
22612
22738
|
}
|
|
22613
|
-
_afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, { mode, duration, easing,
|
|
22739
|
+
_afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, { mode, duration, easing, delay }) {
|
|
22614
22740
|
const listener = (event) => {
|
|
22615
22741
|
var _a, _b;
|
|
22616
22742
|
const { detail } = event;
|
|
@@ -22628,7 +22754,7 @@
|
|
|
22628
22754
|
text.setAttributes(to);
|
|
22629
22755
|
return;
|
|
22630
22756
|
}
|
|
22631
|
-
const
|
|
22757
|
+
const onStart = () => {
|
|
22632
22758
|
if (relatedGraphic) {
|
|
22633
22759
|
relatedGraphic.onAnimateBind = undefined;
|
|
22634
22760
|
relatedGraphic.removeEventListener('afterAttributeUpdate', listener);
|
|
@@ -22637,14 +22763,14 @@
|
|
|
22637
22763
|
switch (mode) {
|
|
22638
22764
|
case 'after':
|
|
22639
22765
|
if (detail.animationState.end) {
|
|
22640
|
-
text.animate({
|
|
22766
|
+
text.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
22641
22767
|
}
|
|
22642
22768
|
break;
|
|
22643
22769
|
case 'after-all':
|
|
22644
22770
|
if (index === texts.length - 1) {
|
|
22645
22771
|
if (detail.animationState.end) {
|
|
22646
22772
|
texts.forEach(t => {
|
|
22647
|
-
t.animate({
|
|
22773
|
+
t.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
22648
22774
|
});
|
|
22649
22775
|
}
|
|
22650
22776
|
}
|
|
@@ -22655,12 +22781,12 @@
|
|
|
22655
22781
|
const point = this._idToPoint.get(text.attribute.id);
|
|
22656
22782
|
if (point &&
|
|
22657
22783
|
(!text.animates || !text.animates.has('label-animate')) &&
|
|
22658
|
-
|
|
22659
|
-
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);
|
|
22660
22786
|
}
|
|
22661
22787
|
}
|
|
22662
22788
|
else if (detail.animationState.isFirstFrameOfStep) {
|
|
22663
|
-
text.animate({
|
|
22789
|
+
text.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
22664
22790
|
}
|
|
22665
22791
|
break;
|
|
22666
22792
|
}
|
|
@@ -22670,7 +22796,7 @@
|
|
|
22670
22796
|
_smartInvert(labels) {
|
|
22671
22797
|
var _a, _b, _c, _d, _e;
|
|
22672
22798
|
const option = (this.attribute.smartInvert || {});
|
|
22673
|
-
const { textType, contrastRatiosThreshold, alternativeColors } = option;
|
|
22799
|
+
const { textType, contrastRatiosThreshold, alternativeColors, mode } = option;
|
|
22674
22800
|
const fillStrategy = (_a = option.fillStrategy) !== null && _a !== void 0 ? _a : 'invertBase';
|
|
22675
22801
|
const strokeStrategy = (_b = option.strokeStrategy) !== null && _b !== void 0 ? _b : 'base';
|
|
22676
22802
|
const brightColor = (_c = option.brightColor) !== null && _c !== void 0 ? _c : '#ffffff';
|
|
@@ -22688,7 +22814,7 @@
|
|
|
22688
22814
|
const backgroundColor = baseMark.attribute.fill;
|
|
22689
22815
|
const foregroundColor = label.attribute.fill;
|
|
22690
22816
|
const baseColor = backgroundColor;
|
|
22691
|
-
const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
|
|
22817
|
+
const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode);
|
|
22692
22818
|
const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
|
|
22693
22819
|
if (outsideEnable) {
|
|
22694
22820
|
const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
|
|
@@ -22716,7 +22842,7 @@
|
|
|
22716
22842
|
}
|
|
22717
22843
|
if (label.attribute.stroke) {
|
|
22718
22844
|
label.setAttributes({
|
|
22719
|
-
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
|
|
22845
|
+
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors, mode)
|
|
22720
22846
|
});
|
|
22721
22847
|
continue;
|
|
22722
22848
|
}
|
|
@@ -22878,12 +23004,11 @@
|
|
|
22878
23004
|
super(vutils.merge({}, LineLabel.defaultAttributes, attributes));
|
|
22879
23005
|
this.name = 'line-label';
|
|
22880
23006
|
}
|
|
22881
|
-
getGraphicBounds(graphic, point = {}) {
|
|
23007
|
+
getGraphicBounds(graphic, point = {}, position = 'end') {
|
|
22882
23008
|
var _a;
|
|
22883
23009
|
if (graphic.type !== 'line') {
|
|
22884
23010
|
return super.getGraphicBounds(graphic, point);
|
|
22885
23011
|
}
|
|
22886
|
-
const { position = 'end' } = this.attribute;
|
|
22887
23012
|
const points = ((_a = graphic === null || graphic === void 0 ? void 0 : graphic.attribute) === null || _a === void 0 ? void 0 : _a.points) || [point];
|
|
22888
23013
|
const index = position === 'start' ? 0 : points.length - 1;
|
|
22889
23014
|
return {
|
|
@@ -22894,22 +23019,7 @@
|
|
|
22894
23019
|
};
|
|
22895
23020
|
}
|
|
22896
23021
|
labeling(textBounds, graphicBounds, position = 'end', offset = 0) {
|
|
22897
|
-
|
|
22898
|
-
return;
|
|
22899
|
-
}
|
|
22900
|
-
const { x1, x2 } = textBounds;
|
|
22901
|
-
const width = Math.abs(x2 - x1);
|
|
22902
|
-
const anchorX = graphicBounds.x1;
|
|
22903
|
-
const anchorY = graphicBounds.y1;
|
|
22904
|
-
let x = anchorX;
|
|
22905
|
-
const y = anchorY;
|
|
22906
|
-
if (position === 'end') {
|
|
22907
|
-
x = anchorX + width / 2 + offset;
|
|
22908
|
-
}
|
|
22909
|
-
else if (position === 'start') {
|
|
22910
|
-
x = anchorX - width / 2 - offset;
|
|
22911
|
-
}
|
|
22912
|
-
return { x, y };
|
|
23022
|
+
return labelingLineOrArea(textBounds, graphicBounds, position, offset);
|
|
22913
23023
|
}
|
|
22914
23024
|
}
|
|
22915
23025
|
LineLabel.defaultAttributes = {
|
|
@@ -23649,6 +23759,42 @@
|
|
|
23649
23759
|
pickable: false
|
|
23650
23760
|
};
|
|
23651
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
|
+
|
|
23652
23798
|
class LineDataLabel extends LabelBase {
|
|
23653
23799
|
constructor(attributes) {
|
|
23654
23800
|
super(vutils.merge({}, LineDataLabel.defaultAttributes, attributes));
|
|
@@ -23675,6 +23821,8 @@
|
|
|
23675
23821
|
rect: RectLabel,
|
|
23676
23822
|
symbol: SymbolLabel,
|
|
23677
23823
|
arc: ArcLabel,
|
|
23824
|
+
line: LineLabel,
|
|
23825
|
+
area: AreaLabel,
|
|
23678
23826
|
'line-data': LineDataLabel
|
|
23679
23827
|
};
|
|
23680
23828
|
class DataLabel extends AbstractComponent {
|
|
@@ -23683,6 +23831,7 @@
|
|
|
23683
23831
|
this.name = 'data-label';
|
|
23684
23832
|
}
|
|
23685
23833
|
render() {
|
|
23834
|
+
var _a;
|
|
23686
23835
|
const { dataLabels, size } = this.attribute;
|
|
23687
23836
|
if (!dataLabels || dataLabels.length === 0) {
|
|
23688
23837
|
return;
|
|
@@ -23702,20 +23851,21 @@
|
|
|
23702
23851
|
const dataLabel = dataLabels[i];
|
|
23703
23852
|
const labelComponent = labelComponentMap[dataLabel.type] || LabelBase;
|
|
23704
23853
|
if (labelComponent) {
|
|
23705
|
-
const { baseMarkGroupName } = dataLabel;
|
|
23706
|
-
|
|
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);
|
|
23707
23857
|
if (component) {
|
|
23708
23858
|
component.setBitmapTool(tool);
|
|
23709
23859
|
component.setBitmap(bitmap);
|
|
23710
23860
|
component.setAttributes(dataLabel);
|
|
23711
|
-
currentComponentMap.set(
|
|
23861
|
+
currentComponentMap.set(id, component);
|
|
23712
23862
|
}
|
|
23713
23863
|
else {
|
|
23714
23864
|
component = new labelComponent(dataLabel);
|
|
23715
23865
|
component.setBitmap(bitmap);
|
|
23716
23866
|
component.setBitmapTool(tool);
|
|
23717
23867
|
this.add(component);
|
|
23718
|
-
currentComponentMap.set(
|
|
23868
|
+
currentComponentMap.set(id, component);
|
|
23719
23869
|
}
|
|
23720
23870
|
}
|
|
23721
23871
|
}
|
|
@@ -24227,12 +24377,26 @@
|
|
|
24227
24377
|
let textAlign = 'center';
|
|
24228
24378
|
let textBaseline = 'middle';
|
|
24229
24379
|
data.forEach((item, index) => {
|
|
24230
|
-
var _a, _b;
|
|
24380
|
+
var _a, _b, _c, _d;
|
|
24231
24381
|
const labelStyle = this._getLabelAttribute(item, index, data, layer);
|
|
24232
|
-
|
|
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
|
+
}
|
|
24233
24397
|
text.name = exports.AXIS_ELEMENT_NAME.label;
|
|
24234
24398
|
text.id = this._getNodeId(`layer${layer}-label-${item.id}`);
|
|
24235
|
-
if (vutils.isEmpty((
|
|
24399
|
+
if (vutils.isEmpty((_c = this.attribute.label) === null || _c === void 0 ? void 0 : _c.state)) {
|
|
24236
24400
|
text.states = DEFAULT_STATES$2;
|
|
24237
24401
|
}
|
|
24238
24402
|
else {
|
|
@@ -24245,7 +24409,7 @@
|
|
|
24245
24409
|
text.states = labelState;
|
|
24246
24410
|
}
|
|
24247
24411
|
labelGroup.add(text);
|
|
24248
|
-
const angle = (
|
|
24412
|
+
const angle = (_d = labelStyle.angle) !== null && _d !== void 0 ? _d : 0;
|
|
24249
24413
|
maxTextWidth = Math.max(maxTextWidth, text.AABBBounds.width());
|
|
24250
24414
|
maxTextHeight = Math.max(maxTextHeight, text.AABBBounds.height());
|
|
24251
24415
|
if (angle) {
|
|
@@ -24394,7 +24558,7 @@
|
|
|
24394
24558
|
}
|
|
24395
24559
|
_getLabelAttribute(tickDatum, index, tickData, layer) {
|
|
24396
24560
|
var _a, _b, _c, _d, _e, _f;
|
|
24397
|
-
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"]);
|
|
24398
24562
|
let offset = space;
|
|
24399
24563
|
let tickLength = 0;
|
|
24400
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) {
|
|
@@ -24415,7 +24579,9 @@
|
|
|
24415
24579
|
}
|
|
24416
24580
|
const point = this.getVerticalCoord(tickDatum.point, offset, inside);
|
|
24417
24581
|
const vector = this.getVerticalVector(offset, inside, point);
|
|
24418
|
-
const
|
|
24582
|
+
const textContent = formatMethod
|
|
24583
|
+
? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer)
|
|
24584
|
+
: tickDatum.label;
|
|
24419
24585
|
let { style: textStyle } = tagAttributes;
|
|
24420
24586
|
textStyle = vutils.isFunction(textStyle)
|
|
24421
24587
|
? vutils.merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer))
|
|
@@ -24430,7 +24596,7 @@
|
|
|
24430
24596
|
layer
|
|
24431
24597
|
});
|
|
24432
24598
|
}
|
|
24433
|
-
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);
|
|
24434
24600
|
}
|
|
24435
24601
|
getLabelPosition(point, vector, text, style) {
|
|
24436
24602
|
return point;
|
|
@@ -25168,7 +25334,7 @@
|
|
|
25168
25334
|
let titleSpacing = 0;
|
|
25169
25335
|
const axisLineWidth = (line === null || line === void 0 ? void 0 : line.visible) ? (_b = line.style.lineWidth) !== null && _b !== void 0 ? _b : 1 : 0;
|
|
25170
25336
|
const tickLength = (tick === null || tick === void 0 ? void 0 : tick.visible) ? (_c = tick.length) !== null && _c !== void 0 ? _c : 4 : 0;
|
|
25171
|
-
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') {
|
|
25172
25338
|
titleHeight = measureTextSize(title.text, title.textStyle).height;
|
|
25173
25339
|
const padding = vutils.normalizePadding(title.padding);
|
|
25174
25340
|
titleSpacing = title.space + padding[0] + padding[2];
|
|
@@ -25963,13 +26129,6 @@
|
|
|
25963
26129
|
}
|
|
25964
26130
|
vutils.mixin(CircleAxisGrid, CircleAxisMixin);
|
|
25965
26131
|
|
|
25966
|
-
var DataZoomActiveTag;
|
|
25967
|
-
(function (DataZoomActiveTag) {
|
|
25968
|
-
DataZoomActiveTag["startHandler"] = "startHandler";
|
|
25969
|
-
DataZoomActiveTag["endHandler"] = "endHandler";
|
|
25970
|
-
DataZoomActiveTag["middleHandler"] = "middleHandler";
|
|
25971
|
-
DataZoomActiveTag["background"] = "background";
|
|
25972
|
-
})(DataZoomActiveTag || (DataZoomActiveTag = {}));
|
|
25973
26132
|
const DEFAULT_DATA_ZOOM_ATTRIBUTES = {
|
|
25974
26133
|
orient: 'bottom',
|
|
25975
26134
|
showDetail: 'auto',
|
|
@@ -26068,6 +26227,14 @@
|
|
|
26068
26227
|
}
|
|
26069
26228
|
};
|
|
26070
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
|
+
|
|
26071
26238
|
const delayMap$1 = {
|
|
26072
26239
|
debounce: vutils.debounce,
|
|
26073
26240
|
throttle: vutils.throttle
|
|
@@ -26095,23 +26262,23 @@
|
|
|
26095
26262
|
this._onHandlerPointerDown = (e, tag) => {
|
|
26096
26263
|
e.stopPropagation();
|
|
26097
26264
|
if (tag === 'start') {
|
|
26098
|
-
this._activeTag = DataZoomActiveTag.startHandler;
|
|
26265
|
+
this._activeTag = exports.DataZoomActiveTag.startHandler;
|
|
26099
26266
|
this._activeItem = this._startHandler;
|
|
26100
26267
|
}
|
|
26101
26268
|
else if (tag === 'end') {
|
|
26102
|
-
this._activeTag = DataZoomActiveTag.endHandler;
|
|
26269
|
+
this._activeTag = exports.DataZoomActiveTag.endHandler;
|
|
26103
26270
|
this._activeItem = this._endHandler;
|
|
26104
26271
|
}
|
|
26105
26272
|
else if (tag === 'middleRect') {
|
|
26106
|
-
this._activeTag = DataZoomActiveTag.middleHandler;
|
|
26273
|
+
this._activeTag = exports.DataZoomActiveTag.middleHandler;
|
|
26107
26274
|
this._activeItem = this._middleHandlerRect;
|
|
26108
26275
|
}
|
|
26109
26276
|
else if (tag === 'middleSymbol') {
|
|
26110
|
-
this._activeTag = DataZoomActiveTag.middleHandler;
|
|
26277
|
+
this._activeTag = exports.DataZoomActiveTag.middleHandler;
|
|
26111
26278
|
this._activeItem = this._middleHandlerSymbol;
|
|
26112
26279
|
}
|
|
26113
26280
|
else if (tag === 'background') {
|
|
26114
|
-
this._activeTag = DataZoomActiveTag.background;
|
|
26281
|
+
this._activeTag = exports.DataZoomActiveTag.background;
|
|
26115
26282
|
this._activeItem = this._background;
|
|
26116
26283
|
}
|
|
26117
26284
|
this._activeState = true;
|
|
@@ -26119,6 +26286,7 @@
|
|
|
26119
26286
|
this._activeCache.lastPos = this.eventPosToStagePos(e);
|
|
26120
26287
|
};
|
|
26121
26288
|
this._onHandlerPointerMove = (e) => {
|
|
26289
|
+
var _a;
|
|
26122
26290
|
e.stopPropagation();
|
|
26123
26291
|
const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
|
|
26124
26292
|
const pos = this.eventPosToStagePos(e);
|
|
@@ -26126,24 +26294,24 @@
|
|
|
26126
26294
|
const dis = (pos[attPos] - this._activeCache.lastPos[attPos]) / max;
|
|
26127
26295
|
let { start, end } = this.state;
|
|
26128
26296
|
if (this._activeState) {
|
|
26129
|
-
if (this._activeTag === DataZoomActiveTag.middleHandler) {
|
|
26297
|
+
if (this._activeTag === exports.DataZoomActiveTag.middleHandler) {
|
|
26130
26298
|
this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis);
|
|
26131
26299
|
}
|
|
26132
|
-
else if (this._activeTag === DataZoomActiveTag.startHandler) {
|
|
26300
|
+
else if (this._activeTag === exports.DataZoomActiveTag.startHandler) {
|
|
26133
26301
|
if (start + dis > end) {
|
|
26134
26302
|
start = end;
|
|
26135
26303
|
end = start + dis;
|
|
26136
|
-
this._activeTag = DataZoomActiveTag.endHandler;
|
|
26304
|
+
this._activeTag = exports.DataZoomActiveTag.endHandler;
|
|
26137
26305
|
}
|
|
26138
26306
|
else {
|
|
26139
26307
|
start = start + dis;
|
|
26140
26308
|
}
|
|
26141
26309
|
}
|
|
26142
|
-
else if (this._activeTag === DataZoomActiveTag.endHandler) {
|
|
26310
|
+
else if (this._activeTag === exports.DataZoomActiveTag.endHandler) {
|
|
26143
26311
|
if (end + dis < start) {
|
|
26144
26312
|
end = start;
|
|
26145
26313
|
start = end + dis;
|
|
26146
|
-
this._activeTag = DataZoomActiveTag.startHandler;
|
|
26314
|
+
this._activeTag = exports.DataZoomActiveTag.startHandler;
|
|
26147
26315
|
}
|
|
26148
26316
|
else {
|
|
26149
26317
|
end = end + dis;
|
|
@@ -26156,7 +26324,7 @@
|
|
|
26156
26324
|
end = Math.min(Math.max(end, 0), 1);
|
|
26157
26325
|
if (startAttr !== start || endAttr !== end) {
|
|
26158
26326
|
this.setStateAttr(start, end, true);
|
|
26159
|
-
realTime && this._updateStateCallback
|
|
26327
|
+
realTime && ((_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, start, end, this._activeTag));
|
|
26160
26328
|
this._dispatchChangeEvent(start, end);
|
|
26161
26329
|
}
|
|
26162
26330
|
};
|
|
@@ -26261,10 +26429,11 @@
|
|
|
26261
26429
|
};
|
|
26262
26430
|
}
|
|
26263
26431
|
_onHandlerPointerUp(e) {
|
|
26432
|
+
var _a;
|
|
26264
26433
|
e.preventDefault();
|
|
26265
26434
|
const { start, end, brushSelect, realTime = true } = this.attribute;
|
|
26266
26435
|
if (this._activeState) {
|
|
26267
|
-
if (this._activeTag === DataZoomActiveTag.background) {
|
|
26436
|
+
if (this._activeTag === exports.DataZoomActiveTag.background) {
|
|
26268
26437
|
const pos = this.eventPosToStagePos(e);
|
|
26269
26438
|
this.backgroundDragZoom(this._activeCache.startPos, pos);
|
|
26270
26439
|
}
|
|
@@ -26273,7 +26442,7 @@
|
|
|
26273
26442
|
brushSelect && this.renderDragMask();
|
|
26274
26443
|
if (!realTime || start !== this.state.start || end !== this.state.end) {
|
|
26275
26444
|
this.setStateAttr(this.state.start, this.state.end, true);
|
|
26276
|
-
this._updateStateCallback
|
|
26445
|
+
(_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, this.state.start, this.state.end, this._activeTag);
|
|
26277
26446
|
this._dispatchChangeEvent(this.state.start, this.state.end);
|
|
26278
26447
|
}
|
|
26279
26448
|
}
|
|
@@ -26323,11 +26492,11 @@
|
|
|
26323
26492
|
const { dragMaskStyle } = this.attribute;
|
|
26324
26493
|
const { position, width, height } = this.getLayoutAttrFromConfig();
|
|
26325
26494
|
if (this._isHorizontal) {
|
|
26326
|
-
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())) ||
|
|
26327
26496
|
0, height }, dragMaskStyle), 'rect');
|
|
26328
26497
|
}
|
|
26329
26498
|
else {
|
|
26330
|
-
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())) ||
|
|
26331
26500
|
0 }, dragMaskStyle), 'rect');
|
|
26332
26501
|
}
|
|
26333
26502
|
}
|
|
@@ -26646,13 +26815,14 @@
|
|
|
26646
26815
|
this.dispatchEvent(changeEvent);
|
|
26647
26816
|
}
|
|
26648
26817
|
setStartAndEnd(start, end) {
|
|
26818
|
+
var _a;
|
|
26649
26819
|
const { start: startAttr, end: endAttr } = this.attribute;
|
|
26650
26820
|
if (vutils.isValid(start) && vutils.isValid(end) && (start !== this.state.start || end !== this.state.end)) {
|
|
26651
26821
|
this.state.start = start;
|
|
26652
26822
|
this.state.end = end;
|
|
26653
26823
|
if (startAttr !== this.state.start || endAttr !== this.state.end) {
|
|
26654
26824
|
this.setStateAttr(start, end, true);
|
|
26655
|
-
this._updateStateCallback
|
|
26825
|
+
(_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, start, end, this._activeTag);
|
|
26656
26826
|
this._dispatchChangeEvent(start, end);
|
|
26657
26827
|
}
|
|
26658
26828
|
}
|
|
@@ -27739,51 +27909,23 @@
|
|
|
27739
27909
|
const target = e.target;
|
|
27740
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)) {
|
|
27741
27911
|
const legendItem = target.delegate;
|
|
27742
|
-
|
|
27743
|
-
|
|
27744
|
-
|
|
27745
|
-
|
|
27746
|
-
|
|
27747
|
-
this._setLegendItemState(legendItem, exports.LegendStateValue.unSelectedHover, e);
|
|
27748
|
-
}
|
|
27749
|
-
const focusButton = legendItem.getChildren()[0].find(node => node.name === exports.LEGEND_ELEMENT_NAME.focus, false);
|
|
27750
|
-
if (focusButton) {
|
|
27751
|
-
focusButton.setAttribute('visible', true);
|
|
27912
|
+
if (this._lastActiveItem) {
|
|
27913
|
+
if (this._lastActiveItem.id === legendItem.id) {
|
|
27914
|
+
return;
|
|
27915
|
+
}
|
|
27916
|
+
this._unHover(this._lastActiveItem, e);
|
|
27752
27917
|
}
|
|
27753
|
-
this.
|
|
27918
|
+
this._hover(legendItem, e);
|
|
27919
|
+
}
|
|
27920
|
+
else if (this._lastActiveItem) {
|
|
27921
|
+
this._unHover(this._lastActiveItem, e);
|
|
27922
|
+
this._lastActiveItem = null;
|
|
27754
27923
|
}
|
|
27755
27924
|
};
|
|
27756
27925
|
this._onUnHover = (e) => {
|
|
27757
|
-
|
|
27758
|
-
|
|
27759
|
-
|
|
27760
|
-
const legendItem = target.delegate;
|
|
27761
|
-
let attributeUpdate = false;
|
|
27762
|
-
if (legendItem.hasState(exports.LegendStateValue.unSelectedHover) ||
|
|
27763
|
-
legendItem.hasState(exports.LegendStateValue.selectedHover)) {
|
|
27764
|
-
attributeUpdate = true;
|
|
27765
|
-
}
|
|
27766
|
-
legendItem.removeState(exports.LegendStateValue.unSelectedHover);
|
|
27767
|
-
legendItem.removeState(exports.LegendStateValue.selectedHover);
|
|
27768
|
-
legendItem
|
|
27769
|
-
.getChildren()[0]
|
|
27770
|
-
.getChildren()
|
|
27771
|
-
.forEach((child) => {
|
|
27772
|
-
if (!attributeUpdate &&
|
|
27773
|
-
(child.hasState(exports.LegendStateValue.unSelectedHover) || child.hasState(exports.LegendStateValue.selectedHover))) {
|
|
27774
|
-
attributeUpdate = true;
|
|
27775
|
-
}
|
|
27776
|
-
child.removeState(exports.LegendStateValue.unSelectedHover);
|
|
27777
|
-
child.removeState(exports.LegendStateValue.selectedHover);
|
|
27778
|
-
});
|
|
27779
|
-
const focusButton = legendItem.getChildren()[0].find(node => node.name === exports.LEGEND_ELEMENT_NAME.focus, false);
|
|
27780
|
-
if (focusButton) {
|
|
27781
|
-
focusButton.setAttribute('visible', false);
|
|
27782
|
-
}
|
|
27783
|
-
if (attributeUpdate) {
|
|
27784
|
-
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
|
|
27785
|
-
}
|
|
27786
|
-
this._dispatchEvent(exports.LegendEvent.legendItemUnHover, legendItem, e);
|
|
27926
|
+
if (this._lastActiveItem) {
|
|
27927
|
+
this._unHover(this._lastActiveItem, e);
|
|
27928
|
+
this._lastActiveItem = null;
|
|
27787
27929
|
}
|
|
27788
27930
|
};
|
|
27789
27931
|
this._onClick = (e) => {
|
|
@@ -27973,7 +28115,7 @@
|
|
|
27973
28115
|
const { hover = true, select = true } = this.attribute;
|
|
27974
28116
|
if (hover) {
|
|
27975
28117
|
this._itemsContainer.addEventListener('pointermove', this._onHover);
|
|
27976
|
-
this._itemsContainer.addEventListener('
|
|
28118
|
+
this._itemsContainer.addEventListener('pointerleave', this._onUnHover);
|
|
27977
28119
|
}
|
|
27978
28120
|
if (select) {
|
|
27979
28121
|
this._itemsContainer.addEventListener('pointerdown', this._onClick);
|
|
@@ -28001,6 +28143,7 @@
|
|
|
28001
28143
|
itemGroup = createGroup(Object.assign({ x: 0, y: 0 }, background === null || background === void 0 ? void 0 : background.style));
|
|
28002
28144
|
this._appendDataToShape(itemGroup, exports.LEGEND_ELEMENT_NAME.item, item, itemGroup, background === null || background === void 0 ? void 0 : background.state);
|
|
28003
28145
|
}
|
|
28146
|
+
itemGroup.id = `${id !== null && id !== void 0 ? id : label}-${index}`;
|
|
28004
28147
|
itemGroup.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
|
|
28005
28148
|
const innerGroup = createGroup({
|
|
28006
28149
|
x: 0,
|
|
@@ -28009,22 +28152,26 @@
|
|
|
28009
28152
|
});
|
|
28010
28153
|
itemGroup.add(innerGroup);
|
|
28011
28154
|
let focusStartX = 0;
|
|
28012
|
-
|
|
28013
|
-
|
|
28014
|
-
|
|
28015
|
-
|
|
28016
|
-
|
|
28017
|
-
|
|
28018
|
-
|
|
28019
|
-
shapeAttr.state[key].fill
|
|
28020
|
-
|
|
28021
|
-
|
|
28022
|
-
|
|
28023
|
-
|
|
28024
|
-
|
|
28025
|
-
|
|
28026
|
-
|
|
28027
|
-
|
|
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
|
+
}
|
|
28028
28175
|
let focusShape;
|
|
28029
28176
|
let focusSpace = 0;
|
|
28030
28177
|
if (focus) {
|
|
@@ -28226,6 +28373,48 @@
|
|
|
28226
28373
|
this._pager.addEventListener('toNext', onPaging);
|
|
28227
28374
|
return true;
|
|
28228
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
|
+
}
|
|
28229
28418
|
_setLegendItemState(legendItem, stateName, e) {
|
|
28230
28419
|
const keepCurrentStates = true;
|
|
28231
28420
|
let attributeUpdate = false;
|
|
@@ -29376,58 +29565,46 @@
|
|
|
29376
29565
|
this.name = 'title';
|
|
29377
29566
|
}
|
|
29378
29567
|
render() {
|
|
29379
|
-
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;
|
|
29380
|
-
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;
|
|
29381
29570
|
const parsedPadding = vutils.normalizePadding(padding);
|
|
29382
29571
|
const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
|
|
29383
29572
|
if (((_a = this.attribute) === null || _a === void 0 ? void 0 : _a.visible) !== false && (textStyle === null || textStyle === void 0 ? void 0 : textStyle.visible) !== false) {
|
|
29384
|
-
if (
|
|
29385
|
-
const attr = {
|
|
29386
|
-
|
|
29387
|
-
|
|
29388
|
-
|
|
29389
|
-
|
|
29390
|
-
ellipsis: (_h = textStyle.ellipsis) !== null && _h !== void 0 ? _h : true,
|
|
29391
|
-
wordBreak: (_j = textStyle.wordBreak) !== null && _j !== void 0 ? _j : 'break-word',
|
|
29392
|
-
maxHeight: textStyle.maxHeight,
|
|
29393
|
-
maxWidth: textStyle.maxWidth,
|
|
29394
|
-
textConfig: textStyle.character
|
|
29395
|
-
};
|
|
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);
|
|
29396
29579
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
29397
29580
|
}
|
|
29398
29581
|
else if (vutils.isValid(text)) {
|
|
29399
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: [text] }, textStyle), { maxLineWidth: (
|
|
29400
|
-
}
|
|
29401
|
-
}
|
|
29402
|
-
const maintextHeight = this._mainTitle ? (
|
|
29403
|
-
const maintextWidth = this._mainTitle ? (
|
|
29404
|
-
if (((
|
|
29405
|
-
if (
|
|
29406
|
-
const attr = {
|
|
29407
|
-
|
|
29408
|
-
|
|
29409
|
-
|
|
29410
|
-
|
|
29411
|
-
ellipsis: (_w = subtextStyle.ellipsis) !== null && _w !== void 0 ? _w : true,
|
|
29412
|
-
wordBreak: (_x = subtextStyle.wordBreak) !== null && _x !== void 0 ? _x : 'break-word',
|
|
29413
|
-
maxHeight: subtextStyle.maxHeight,
|
|
29414
|
-
maxWidth: subtextStyle.maxWidth,
|
|
29415
|
-
textConfig: subtextStyle.character
|
|
29416
|
-
};
|
|
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);
|
|
29417
29594
|
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
29418
29595
|
}
|
|
29419
29596
|
else if (vutils.isValid(subtext)) {
|
|
29420
|
-
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');
|
|
29421
29598
|
}
|
|
29422
29599
|
}
|
|
29423
|
-
const subtextHeight = this._subTitle ? (
|
|
29424
|
-
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;
|
|
29425
29602
|
let titleWidth = Math.max(maintextWidth, subtextWidth);
|
|
29426
|
-
let titleHeight = maintextHeight + ((
|
|
29603
|
+
let titleHeight = maintextHeight + ((_20 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _20 !== void 0 ? _20 : subtextHeight);
|
|
29427
29604
|
if (vutils.isValid(width)) {
|
|
29428
29605
|
titleWidth = width;
|
|
29429
|
-
(
|
|
29430
|
-
(
|
|
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);
|
|
29431
29608
|
}
|
|
29432
29609
|
if (vutils.isValid(height)) {
|
|
29433
29610
|
titleHeight = height;
|
|
@@ -29436,10 +29613,10 @@
|
|
|
29436
29613
|
titleWidth = minWidth;
|
|
29437
29614
|
}
|
|
29438
29615
|
if (vutils.isValid(maxWidth)) {
|
|
29439
|
-
(
|
|
29440
|
-
(
|
|
29441
|
-
(
|
|
29442
|
-
(
|
|
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);
|
|
29443
29620
|
if (titleWidth > maxWidth) {
|
|
29444
29621
|
titleWidth = maxWidth;
|
|
29445
29622
|
}
|
|
@@ -29448,8 +29625,8 @@
|
|
|
29448
29625
|
titleHeight = minHeight;
|
|
29449
29626
|
}
|
|
29450
29627
|
if (vutils.isValid(maxHeight)) {
|
|
29451
|
-
(
|
|
29452
|
-
(
|
|
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);
|
|
29453
29630
|
if (titleHeight > maxHeight) {
|
|
29454
29631
|
titleHeight = maxHeight;
|
|
29455
29632
|
}
|
|
@@ -29459,67 +29636,67 @@
|
|
|
29459
29636
|
group.attribute.boundsPadding = parsedPadding;
|
|
29460
29637
|
if (vutils.isValid(align) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.align)) {
|
|
29461
29638
|
const mainTitleAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.align) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.align : align;
|
|
29462
|
-
const mainTitleWidth = (
|
|
29639
|
+
const mainTitleWidth = (_29 = textStyle === null || textStyle === void 0 ? void 0 : textStyle.width) !== null && _29 !== void 0 ? _29 : maintextWidth;
|
|
29463
29640
|
if (mainTitleAlign === 'left') {
|
|
29464
|
-
(
|
|
29465
|
-
(
|
|
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');
|
|
29466
29643
|
}
|
|
29467
29644
|
else if (mainTitleAlign === 'center') {
|
|
29468
|
-
(
|
|
29469
|
-
(
|
|
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');
|
|
29470
29647
|
}
|
|
29471
29648
|
else if (mainTitleAlign === 'right') {
|
|
29472
|
-
(
|
|
29473
|
-
(
|
|
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');
|
|
29474
29651
|
}
|
|
29475
29652
|
}
|
|
29476
29653
|
if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
|
|
29477
29654
|
const mainTitleVerticalAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign : verticalAlign;
|
|
29478
29655
|
const mainTitleHeight = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.height) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.height : titleHeight;
|
|
29479
29656
|
if (mainTitleVerticalAlign === 'top') {
|
|
29480
|
-
(
|
|
29481
|
-
(
|
|
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');
|
|
29482
29659
|
}
|
|
29483
29660
|
else if (mainTitleVerticalAlign === 'middle') {
|
|
29484
|
-
(
|
|
29485
|
-
(
|
|
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');
|
|
29486
29663
|
}
|
|
29487
29664
|
else if (mainTitleVerticalAlign === 'bottom') {
|
|
29488
|
-
(
|
|
29489
|
-
(
|
|
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');
|
|
29490
29667
|
}
|
|
29491
29668
|
}
|
|
29492
29669
|
if (vutils.isValid(align) || vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align)) {
|
|
29493
29670
|
const subTitleAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align : align;
|
|
29494
|
-
const subTitleWidth = (
|
|
29671
|
+
const subTitleWidth = (_42 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.width) !== null && _42 !== void 0 ? _42 : subtextWidth;
|
|
29495
29672
|
if (subTitleAlign === 'left') {
|
|
29496
|
-
(
|
|
29497
|
-
(
|
|
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');
|
|
29498
29675
|
}
|
|
29499
29676
|
else if (subTitleAlign === 'center') {
|
|
29500
|
-
(
|
|
29501
|
-
(
|
|
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');
|
|
29502
29679
|
}
|
|
29503
29680
|
else if (subTitleAlign === 'right') {
|
|
29504
|
-
(
|
|
29505
|
-
(
|
|
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');
|
|
29506
29683
|
}
|
|
29507
29684
|
}
|
|
29508
29685
|
if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
|
|
29509
29686
|
const subTitleVerticalAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign : verticalAlign;
|
|
29510
29687
|
const subTitleYStart = maintextHeight;
|
|
29511
|
-
const subTitleHeight = (
|
|
29688
|
+
const subTitleHeight = (_49 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _49 !== void 0 ? _49 : 0;
|
|
29512
29689
|
if (subTitleVerticalAlign === 'top') {
|
|
29513
|
-
(
|
|
29514
|
-
(
|
|
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');
|
|
29515
29692
|
}
|
|
29516
29693
|
else if (subTitleVerticalAlign === 'middle') {
|
|
29517
|
-
(
|
|
29518
|
-
(
|
|
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');
|
|
29519
29696
|
}
|
|
29520
29697
|
else if (subTitleVerticalAlign === 'bottom') {
|
|
29521
|
-
(
|
|
29522
|
-
(
|
|
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');
|
|
29523
29700
|
}
|
|
29524
29701
|
}
|
|
29525
29702
|
}
|
|
@@ -29574,7 +29751,7 @@
|
|
|
29574
29751
|
this.name = 'indicator';
|
|
29575
29752
|
}
|
|
29576
29753
|
render() {
|
|
29577
|
-
var _a;
|
|
29754
|
+
var _a, _b, _c;
|
|
29578
29755
|
const { visible, title, content, size, limitRatio = Infinity } = this.attribute;
|
|
29579
29756
|
const limit = Math.min(size.width, size.height) * limitRatio;
|
|
29580
29757
|
const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group');
|
|
@@ -29585,7 +29762,15 @@
|
|
|
29585
29762
|
if (vutils.isValid(title)) {
|
|
29586
29763
|
if (title.visible !== false) {
|
|
29587
29764
|
const titleStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);
|
|
29588
|
-
|
|
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
|
+
}
|
|
29589
29774
|
if (title.autoFit && vutils.isValidNumber(limit)) {
|
|
29590
29775
|
this._setAutoFit(limit, this._title, title);
|
|
29591
29776
|
}
|
|
@@ -29606,9 +29791,19 @@
|
|
|
29606
29791
|
const contentComponents = [];
|
|
29607
29792
|
let lastContentHeight = 0;
|
|
29608
29793
|
contents.forEach((contentItem, i) => {
|
|
29794
|
+
var _a, _b;
|
|
29609
29795
|
if (contentItem.visible !== false) {
|
|
29610
29796
|
const contentStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);
|
|
29611
|
-
|
|
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
|
+
}
|
|
29612
29807
|
if (contentItem.autoFit && vutils.isValidNumber(limit)) {
|
|
29613
29808
|
this._setAutoFit(limit, contentComponent, contentItem);
|
|
29614
29809
|
}
|
|
@@ -29626,13 +29821,13 @@
|
|
|
29626
29821
|
});
|
|
29627
29822
|
this._content = contentComponents;
|
|
29628
29823
|
}
|
|
29629
|
-
const totalHeight = (
|
|
29824
|
+
const totalHeight = (_c = group === null || group === void 0 ? void 0 : group.AABBBounds.height()) !== null && _c !== void 0 ? _c : 0;
|
|
29630
29825
|
group.setAttribute('y', size.height / 2 - totalHeight / 2);
|
|
29631
29826
|
group.setAttribute('x', size.width / 2);
|
|
29632
29827
|
}
|
|
29633
29828
|
_setAutoFit(limit, indicatorItem, indicatorItemSpec) {
|
|
29634
29829
|
var _a, _b, _c, _d, _e, _f;
|
|
29635
|
-
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;
|
|
29636
29831
|
if (originWidth > 0) {
|
|
29637
29832
|
const ratio = (limit * ((_d = indicatorItemSpec.fitPercent) !== null && _d !== void 0 ? _d : 0.5)) / originWidth;
|
|
29638
29833
|
const fontSize = Math.floor(((_f = (_e = indicatorItemSpec.style) === null || _e === void 0 ? void 0 : _e.fontSize) !== null && _f !== void 0 ? _f : 20) * ratio);
|
|
@@ -30871,6 +31066,17 @@
|
|
|
30871
31066
|
};
|
|
30872
31067
|
const getRichTextAttribute = (attr) => {
|
|
30873
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
|
+
}
|
|
30874
31080
|
return {
|
|
30875
31081
|
width,
|
|
30876
31082
|
height,
|
|
@@ -30878,7 +31084,7 @@
|
|
|
30878
31084
|
textAlign: textAlign,
|
|
30879
31085
|
textBaseline: textBaseline,
|
|
30880
31086
|
singleLine: false,
|
|
30881
|
-
textConfig:
|
|
31087
|
+
textConfig: text.text
|
|
30882
31088
|
};
|
|
30883
31089
|
};
|
|
30884
31090
|
|
|
@@ -30967,6 +31173,7 @@
|
|
|
30967
31173
|
this.name = 'tooltip';
|
|
30968
31174
|
}
|
|
30969
31175
|
render() {
|
|
31176
|
+
var _a;
|
|
30970
31177
|
const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure } = this.attribute;
|
|
30971
31178
|
if (!visible) {
|
|
30972
31179
|
this.hideAll();
|
|
@@ -30985,11 +31192,22 @@
|
|
|
30985
31192
|
this._tooltipTitleSymbol = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, vutils.merge({ symbolType: 'circle' }, titleAttr.shape, {
|
|
30986
31193
|
visible: isVisible(titleAttr) && isVisible(titleAttr.shape)
|
|
30987
31194
|
}), 'symbol');
|
|
30988
|
-
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) {
|
|
30989
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');
|
|
30990
31208
|
}
|
|
30991
31209
|
else {
|
|
30992
|
-
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');
|
|
30993
31211
|
}
|
|
30994
31212
|
const titlePaddingLeft = isVisible(titleAttr.shape) ? titleAttr.shape.size + titleAttr.shape.spacing : 0;
|
|
30995
31213
|
const { textAlign, textBaseline } = titleAttr.value;
|
|
@@ -31020,7 +31238,7 @@
|
|
|
31020
31238
|
this._tooltipContent.setAttribute('y', padding[0] + titleHeight);
|
|
31021
31239
|
let lastYPos = 0;
|
|
31022
31240
|
content.forEach((item, i) => {
|
|
31023
|
-
var _a;
|
|
31241
|
+
var _a, _b, _c;
|
|
31024
31242
|
const itemAttr = Tooltip.getContentAttr(this.attribute, i);
|
|
31025
31243
|
if (!isVisible(itemAttr)) {
|
|
31026
31244
|
return;
|
|
@@ -31030,7 +31248,9 @@
|
|
|
31030
31248
|
let x = 0;
|
|
31031
31249
|
if (isVisible(itemAttr.shape)) {
|
|
31032
31250
|
itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, Object.assign({ visible: true, x: itemAttr.shape.size / 2, y: itemAttr.shape.size / 2 +
|
|
31033
|
-
(((_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');
|
|
31034
31254
|
}
|
|
31035
31255
|
if (hasContentShape) {
|
|
31036
31256
|
x += itemAttr.shape.size + itemAttr.shape.spacing;
|
|
@@ -31040,8 +31260,21 @@
|
|
|
31040
31260
|
if (itemAttr.key.multiLine) {
|
|
31041
31261
|
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.key)), { textBaseline: 'top' }), 'richtext');
|
|
31042
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
|
+
}
|
|
31043
31276
|
else {
|
|
31044
|
-
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');
|
|
31045
31278
|
}
|
|
31046
31279
|
const { textAlign } = itemAttr.key;
|
|
31047
31280
|
if (textAlign === 'center') {
|
|
@@ -31061,8 +31294,21 @@
|
|
|
31061
31294
|
if (itemAttr.value.multiLine) {
|
|
31062
31295
|
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.value)), { textBaseline: 'top' }), 'richtext');
|
|
31063
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
|
+
}
|
|
31064
31310
|
else {
|
|
31065
|
-
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');
|
|
31066
31312
|
}
|
|
31067
31313
|
let textAlign = 'right';
|
|
31068
31314
|
if (vutils.isValid(itemAttr.value.textAlign)) {
|
|
@@ -31154,7 +31400,7 @@
|
|
|
31154
31400
|
let titleMaxHeight = 0;
|
|
31155
31401
|
const { value: titleValue, shape: titleShape } = titleAttr;
|
|
31156
31402
|
const { visible: titleHasShape = false, symbolType: titleShapeType = '' } = titleShape !== null && titleShape !== void 0 ? titleShape : {};
|
|
31157
|
-
if (vutils.isValid(titleValue)) {
|
|
31403
|
+
if (vutils.isValid(titleValue) && typeof titleAttr.value.text !== 'object') {
|
|
31158
31404
|
const { width, height } = initTextMeasure(titleValue).quickMeasure(titleValue.text);
|
|
31159
31405
|
maxWidth = width;
|
|
31160
31406
|
titleMaxHeight = height;
|
|
@@ -31411,11 +31657,12 @@
|
|
|
31411
31657
|
}
|
|
31412
31658
|
};
|
|
31413
31659
|
|
|
31414
|
-
const version = "0.16.14-alpha.
|
|
31660
|
+
const version = "0.16.14-alpha.11";
|
|
31415
31661
|
|
|
31416
31662
|
exports.AbstractComponent = AbstractComponent;
|
|
31417
31663
|
exports.ArcInfo = ArcInfo;
|
|
31418
31664
|
exports.ArcLabel = ArcLabel;
|
|
31665
|
+
exports.AreaLabel = AreaLabel;
|
|
31419
31666
|
exports.BasePlayer = BasePlayer;
|
|
31420
31667
|
exports.Brush = Brush;
|
|
31421
31668
|
exports.CheckBox = CheckBox;
|