@visactor/vrender-components 0.16.14-alpha.6 → 0.16.14
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 +11 -22
- package/cjs/axis/base.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 +3 -6
- package/cjs/axis/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 +6 -50
- package/cjs/indicator/indicator.js.map +1 -1
- package/cjs/indicator/type.d.ts +2 -5
- 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 +3 -4
- 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 +17 -14
- package/cjs/label/base.js +38 -61
- 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/line.d.ts +1 -1
- package/cjs/label/line.js +2 -9
- package/cjs/label/line.js.map +1 -1
- package/cjs/label/type.d.ts +26 -10
- 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/link-path/type.js +1 -1
- package/cjs/marker/point.d.ts +1 -1
- package/cjs/marker/type.js.map +1 -1
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/tag/tag.js +40 -90
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/tag/type.d.ts +3 -4
- package/cjs/tag/type.js.map +1 -1
- package/cjs/title/title.js +47 -111
- package/cjs/title/title.js.map +1 -1
- package/cjs/title/type.d.ts +5 -10
- package/cjs/title/type.js.map +1 -1
- package/cjs/tooltip/tooltip.js +2 -27
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/cjs/tooltip/type.d.ts +1 -3
- package/cjs/tooltip/type.js.map +1 -1
- package/dist/index.js +453 -342
- package/dist/index.min.js +1 -1
- package/es/axis/base.js +11 -23
- package/es/axis/base.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 +3 -6
- package/es/axis/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 +6 -50
- package/es/indicator/indicator.js.map +1 -1
- package/es/indicator/type.d.ts +2 -5
- 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 +3 -4
- 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 +17 -14
- package/es/label/base.js +40 -63
- 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/line.d.ts +1 -1
- package/es/label/line.js +3 -8
- package/es/label/line.js.map +1 -1
- package/es/label/type.d.ts +26 -10
- 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/link-path/type.js +1 -1
- package/es/marker/point.d.ts +1 -1
- package/es/marker/type.js.map +1 -1
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/tag/tag.js +38 -88
- package/es/tag/tag.js.map +1 -1
- package/es/tag/type.d.ts +3 -4
- package/es/tag/type.js.map +1 -1
- package/es/title/title.js +45 -111
- package/es/title/title.js.map +1 -1
- package/es/title/type.d.ts +5 -10
- package/es/title/type.js.map +1 -1
- package/es/tooltip/tooltip.js +3 -28
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/tooltip/type.d.ts +1 -3
- package/es/tooltip/type.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -4470,7 +4470,10 @@
|
|
|
4470
4470
|
direction: "horizontal",
|
|
4471
4471
|
wordBreak: "break-all",
|
|
4472
4472
|
ignoreBuf: !1,
|
|
4473
|
-
verticalMode: 0
|
|
4473
|
+
verticalMode: 0,
|
|
4474
|
+
whiteSpace: "no-wrap",
|
|
4475
|
+
heightLimit: 1 / 0,
|
|
4476
|
+
lineClamp: 1 / 0
|
|
4474
4477
|
};
|
|
4475
4478
|
var DefaultStyle = Object.assign(Object.assign(Object.assign({
|
|
4476
4479
|
opacity: 1,
|
|
@@ -7460,6 +7463,12 @@
|
|
|
7460
7463
|
}();
|
|
7461
7464
|
RafBasedSTO.TimeOut = 1e3 / 60;
|
|
7462
7465
|
new RafBasedSTO();
|
|
7466
|
+
var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
|
|
7467
|
+
if (vutils.isString(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
7468
|
+
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
7469
|
+
}
|
|
7470
|
+
return lineHeight;
|
|
7471
|
+
};
|
|
7463
7472
|
|
|
7464
7473
|
var IncreaseCount = /*#__PURE__*/function (_ACustomAnimate) {
|
|
7465
7474
|
_inherits(IncreaseCount, _ACustomAnimate);
|
|
@@ -9963,7 +9972,7 @@
|
|
|
9963
9972
|
return CanvasTextLayout;
|
|
9964
9973
|
}();
|
|
9965
9974
|
|
|
9966
|
-
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
9975
|
+
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
9967
9976
|
var Text = /*#__PURE__*/function (_Graphic) {
|
|
9968
9977
|
_inherits(Text, _Graphic);
|
|
9969
9978
|
var _super = _createSuper(Text);
|
|
@@ -10037,6 +10046,117 @@
|
|
|
10037
10046
|
paddingArray = parsePadding(boundsPadding);
|
|
10038
10047
|
return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
|
|
10039
10048
|
}
|
|
10049
|
+
}, {
|
|
10050
|
+
key: "updateWrapAABBBounds",
|
|
10051
|
+
value: function updateWrapAABBBounds(text) {
|
|
10052
|
+
var _a, _b, _c, _d;
|
|
10053
|
+
var textTheme = getTheme(this).text,
|
|
10054
|
+
_this$attribute = this.attribute,
|
|
10055
|
+
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
10056
|
+
fontFamily = _this$attribute$fontF === void 0 ? textTheme.fontFamily : _this$attribute$fontF,
|
|
10057
|
+
_this$attribute$textA = _this$attribute.textAlign,
|
|
10058
|
+
textAlign = _this$attribute$textA === void 0 ? textTheme.textAlign : _this$attribute$textA,
|
|
10059
|
+
_this$attribute$textB = _this$attribute.textBaseline,
|
|
10060
|
+
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
10061
|
+
_this$attribute$fontS = _this$attribute.fontSize,
|
|
10062
|
+
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
10063
|
+
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
10064
|
+
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
10065
|
+
maxLineWidth = _this$attribute.maxLineWidth,
|
|
10066
|
+
_this$attribute$strok = _this$attribute.stroke,
|
|
10067
|
+
stroke = _this$attribute$strok === void 0 ? textTheme.stroke : _this$attribute$strok,
|
|
10068
|
+
_this$attribute$lineW = _this$attribute.lineWidth,
|
|
10069
|
+
lineWidth = _this$attribute$lineW === void 0 ? textTheme.lineWidth : _this$attribute$lineW,
|
|
10070
|
+
_this$attribute$wordB = _this$attribute.wordBreak,
|
|
10071
|
+
wordBreak = _this$attribute$wordB === void 0 ? textTheme.wordBreak : _this$attribute$wordB,
|
|
10072
|
+
_this$attribute$fontW = _this$attribute.fontWeight,
|
|
10073
|
+
fontWeight = _this$attribute$fontW === void 0 ? textTheme.fontWeight : _this$attribute$fontW,
|
|
10074
|
+
_this$attribute$ignor = _this$attribute.ignoreBuf,
|
|
10075
|
+
ignoreBuf = _this$attribute$ignor === void 0 ? textTheme.ignoreBuf : _this$attribute$ignor,
|
|
10076
|
+
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
10077
|
+
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
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,
|
|
10080
|
+
buf = ignoreBuf ? 0 : 2;
|
|
10081
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10082
|
+
var _bbox = this.cache.layoutData.bbox;
|
|
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;
|
|
10084
|
+
}
|
|
10085
|
+
var textMeasure = application.graphicUtil.textMeasure,
|
|
10086
|
+
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
10087
|
+
fontSize: fontSize,
|
|
10088
|
+
fontWeight: fontWeight,
|
|
10089
|
+
fontFamily: fontFamily
|
|
10090
|
+
}, textMeasure),
|
|
10091
|
+
lines = vutils.isArray(text) ? text.map(function (l) {
|
|
10092
|
+
return l.toString();
|
|
10093
|
+
}) : [text.toString()],
|
|
10094
|
+
linesLayout = [],
|
|
10095
|
+
bboxWH = [0, 0];
|
|
10096
|
+
var lineCountLimit = 1 / 0;
|
|
10097
|
+
if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)), lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
|
|
10098
|
+
if (maxLineWidth > 0) for (var i = 0; i < lines.length; i++) {
|
|
10099
|
+
var str = lines[i];
|
|
10100
|
+
var needCut = !0;
|
|
10101
|
+
if (i === lineCountLimit - 1) {
|
|
10102
|
+
var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10103
|
+
linesLayout.push({
|
|
10104
|
+
str: _clip.str,
|
|
10105
|
+
width: _clip.width
|
|
10106
|
+
});
|
|
10107
|
+
break;
|
|
10108
|
+
}
|
|
10109
|
+
var clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-word" === wordBreak);
|
|
10110
|
+
if ("" !== str && "" === clip.str) {
|
|
10111
|
+
if (ellipsis) {
|
|
10112
|
+
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10113
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
10114
|
+
} else clip.str = "", clip.width = 0;
|
|
10115
|
+
needCut = !1;
|
|
10116
|
+
}
|
|
10117
|
+
if (linesLayout.push({
|
|
10118
|
+
str: clip.str,
|
|
10119
|
+
width: clip.width
|
|
10120
|
+
}), clip.str.length === str.length) ;else if (needCut) {
|
|
10121
|
+
var newStr = str.substring(clip.str.length);
|
|
10122
|
+
lines.splice(i + 1, 0, newStr);
|
|
10123
|
+
}
|
|
10124
|
+
}
|
|
10125
|
+
var maxWidth = 0;
|
|
10126
|
+
linesLayout.forEach(function (layout) {
|
|
10127
|
+
maxWidth = Math.max(maxWidth, layout.width);
|
|
10128
|
+
}), bboxWH[0] = maxWidth;
|
|
10129
|
+
} else {
|
|
10130
|
+
var width,
|
|
10131
|
+
_text,
|
|
10132
|
+
_lineWidth = 0;
|
|
10133
|
+
for (var _i = 0, len = lines.length; _i < len; _i++) {
|
|
10134
|
+
if (_i === lineCountLimit - 1) {
|
|
10135
|
+
var _clip2 = layoutObj.textMeasure.clipTextWithSuffix(lines[_i], layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10136
|
+
linesLayout.push({
|
|
10137
|
+
str: _clip2.str,
|
|
10138
|
+
width: _clip2.width
|
|
10139
|
+
}), _lineWidth = Math.max(_lineWidth, _clip2.width);
|
|
10140
|
+
break;
|
|
10141
|
+
}
|
|
10142
|
+
_text = lines[_i], width = layoutObj.textMeasure.measureTextWidth(_text, layoutObj.textOptions, "break-word" === wordBreak), _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
|
|
10143
|
+
str: _text,
|
|
10144
|
+
width: width
|
|
10145
|
+
});
|
|
10146
|
+
}
|
|
10147
|
+
bboxWH[0] = _lineWidth;
|
|
10148
|
+
}
|
|
10149
|
+
bboxWH[1] = linesLayout.length * (lineHeight + buf);
|
|
10150
|
+
var bbox = {
|
|
10151
|
+
xOffset: 0,
|
|
10152
|
+
yOffset: 0,
|
|
10153
|
+
width: bboxWH[0],
|
|
10154
|
+
height: bboxWH[1]
|
|
10155
|
+
};
|
|
10156
|
+
layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
|
|
10157
|
+
var layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
10158
|
+
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10159
|
+
}
|
|
10040
10160
|
}, {
|
|
10041
10161
|
key: "updateSingallineAABBBounds",
|
|
10042
10162
|
value: function updateSingallineAABBBounds(text) {
|
|
@@ -10083,9 +10203,12 @@
|
|
|
10083
10203
|
_attribute$wordBreak === void 0 ? textTheme.wordBreak : _attribute$wordBreak;
|
|
10084
10204
|
var _attribute$ignoreBuf = attribute.ignoreBuf,
|
|
10085
10205
|
ignoreBuf = _attribute$ignoreBuf === void 0 ? textTheme.ignoreBuf : _attribute$ignoreBuf,
|
|
10086
|
-
|
|
10087
|
-
_attribute$
|
|
10088
|
-
|
|
10206
|
+
_attribute$whiteSpace = attribute.whiteSpace,
|
|
10207
|
+
whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace;
|
|
10208
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
10209
|
+
var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
|
|
10210
|
+
textFontSize = attribute.fontSize || textTheme.fontSize,
|
|
10211
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
|
|
10089
10212
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
10090
10213
|
width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
|
|
10091
10214
|
var _dx = textDrawOffsetX(textAlign, width),
|
|
@@ -10155,12 +10278,11 @@
|
|
|
10155
10278
|
fontFamily = _attribute$fontFamily2 === void 0 ? textTheme.fontFamily : _attribute$fontFamily2,
|
|
10156
10279
|
_attribute$stroke2 = attribute.stroke,
|
|
10157
10280
|
stroke = _attribute$stroke2 === void 0 ? textTheme.stroke : _attribute$stroke2,
|
|
10158
|
-
_attribute$lineHeight2 = attribute.lineHeight,
|
|
10159
|
-
lineHeight = _attribute$lineHeight2 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight2,
|
|
10160
10281
|
_attribute$lineWidth2 = attribute.lineWidth,
|
|
10161
10282
|
lineWidth = _attribute$lineWidth2 === void 0 ? textTheme.lineWidth : _attribute$lineWidth2,
|
|
10162
10283
|
_attribute$verticalMo = attribute.verticalMode,
|
|
10163
|
-
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;
|
|
10164
10286
|
var _attribute$textAlign2 = attribute.textAlign,
|
|
10165
10287
|
textAlign = _attribute$textAlign2 === void 0 ? textTheme.textAlign : _attribute$textAlign2,
|
|
10166
10288
|
_attribute$textBaseli2 = attribute.textBaseline,
|
|
@@ -10210,7 +10332,7 @@
|
|
|
10210
10332
|
}, {
|
|
10211
10333
|
key: "updateHorizontalMultilineAABBBounds",
|
|
10212
10334
|
value: function updateHorizontalMultilineAABBBounds(text) {
|
|
10213
|
-
var _a;
|
|
10335
|
+
var _a, _b;
|
|
10214
10336
|
var textTheme = getTheme(this).text,
|
|
10215
10337
|
attribute = this.attribute,
|
|
10216
10338
|
_attribute$fontFamily3 = attribute.fontFamily,
|
|
@@ -10223,8 +10345,6 @@
|
|
|
10223
10345
|
fontSize = _attribute$fontSize3 === void 0 ? textTheme.fontSize : _attribute$fontSize3,
|
|
10224
10346
|
_attribute$fontWeight3 = attribute.fontWeight,
|
|
10225
10347
|
fontWeight = _attribute$fontWeight3 === void 0 ? textTheme.fontWeight : _attribute$fontWeight3,
|
|
10226
|
-
_attribute$lineHeight3 = attribute.lineHeight,
|
|
10227
|
-
lineHeight = _attribute$lineHeight3 === void 0 ? attribute.lineHeight || attribute.fontSize || textTheme.fontSize : _attribute$lineHeight3,
|
|
10228
10348
|
_attribute$ellipsis3 = attribute.ellipsis,
|
|
10229
10349
|
ellipsis = _attribute$ellipsis3 === void 0 ? textTheme.ellipsis : _attribute$ellipsis3,
|
|
10230
10350
|
maxLineWidth = attribute.maxLineWidth,
|
|
@@ -10232,11 +10352,13 @@
|
|
|
10232
10352
|
stroke = _attribute$stroke3 === void 0 ? textTheme.stroke : _attribute$stroke3,
|
|
10233
10353
|
_attribute$lineWidth3 = attribute.lineWidth,
|
|
10234
10354
|
lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
|
|
10235
|
-
_attribute$
|
|
10236
|
-
_attribute$
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10355
|
+
_attribute$whiteSpace2 = attribute.whiteSpace,
|
|
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;
|
|
10358
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
10359
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10360
|
+
var _bbox2 = this.cache.layoutData.bbox;
|
|
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;
|
|
10240
10362
|
}
|
|
10241
10363
|
var textMeasure = application.graphicUtil.textMeasure,
|
|
10242
10364
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
@@ -10270,12 +10392,11 @@
|
|
|
10270
10392
|
fontWeight = _attribute$fontWeight4 === void 0 ? textTheme.fontWeight : _attribute$fontWeight4,
|
|
10271
10393
|
_attribute$stroke4 = attribute.stroke,
|
|
10272
10394
|
stroke = _attribute$stroke4 === void 0 ? textTheme.stroke : _attribute$stroke4,
|
|
10273
|
-
_attribute$lineHeight4 = attribute.lineHeight,
|
|
10274
|
-
lineHeight = _attribute$lineHeight4 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight4,
|
|
10275
10395
|
_attribute$lineWidth4 = attribute.lineWidth,
|
|
10276
10396
|
lineWidth = _attribute$lineWidth4 === void 0 ? textTheme.lineWidth : _attribute$lineWidth4,
|
|
10277
10397
|
_attribute$verticalMo2 = attribute.verticalMode,
|
|
10278
|
-
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;
|
|
10279
10400
|
var _attribute$textAlign4 = attribute.textAlign,
|
|
10280
10401
|
textAlign = _attribute$textAlign4 === void 0 ? textTheme.textAlign : _attribute$textAlign4,
|
|
10281
10402
|
_attribute$textBaseli4 = attribute.textBaseline,
|
|
@@ -10408,7 +10529,7 @@
|
|
|
10408
10529
|
}, {
|
|
10409
10530
|
key: "updateMultilineAABBBounds",
|
|
10410
10531
|
value: function updateMultilineAABBBounds(text) {
|
|
10411
|
-
var _a, _b, _c;
|
|
10532
|
+
var _a, _b, _c, _d;
|
|
10412
10533
|
var textTheme = getTheme(this).text,
|
|
10413
10534
|
_this$attribute = this.attribute,
|
|
10414
10535
|
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
@@ -10419,8 +10540,6 @@
|
|
|
10419
10540
|
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
10420
10541
|
_this$attribute$fontS = _this$attribute.fontSize,
|
|
10421
10542
|
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
10422
|
-
_this$attribute$lineH = _this$attribute.lineHeight,
|
|
10423
|
-
lineHeight = _this$attribute$lineH === void 0 ? this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize : _this$attribute$lineH,
|
|
10424
10543
|
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
10425
10544
|
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
10426
10545
|
maxLineWidth = _this$attribute.maxLineWidth,
|
|
@@ -10437,8 +10556,9 @@
|
|
|
10437
10556
|
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
10438
10557
|
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
10439
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,
|
|
10440
10560
|
buf = ignoreBuf ? 0 : 2;
|
|
10441
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
10561
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10442
10562
|
var _bbox = this.cache.layoutData.bbox;
|
|
10443
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;
|
|
10444
10564
|
}
|
|
@@ -10470,7 +10590,7 @@
|
|
|
10470
10590
|
if ("" !== str && "" === clip.str) {
|
|
10471
10591
|
if (ellipsis) {
|
|
10472
10592
|
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10473
|
-
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;
|
|
10474
10594
|
} else clip.str = "", clip.width = 0;
|
|
10475
10595
|
needCut = !1;
|
|
10476
10596
|
}
|
|
@@ -11286,6 +11406,13 @@
|
|
|
11286
11406
|
builtinSymbols.forEach(function (symbol) {
|
|
11287
11407
|
builtinSymbolsMap[symbol.type] = symbol;
|
|
11288
11408
|
});
|
|
11409
|
+
var builtInSymbolStrMap = {
|
|
11410
|
+
arrowLeft: "M 0.25 -0.5 L -0.25 0 l 0.5 0.5",
|
|
11411
|
+
arrowRight: "M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",
|
|
11412
|
+
rect: "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",
|
|
11413
|
+
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",
|
|
11414
|
+
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"
|
|
11415
|
+
};
|
|
11289
11416
|
|
|
11290
11417
|
var SYMBOL_UPDATE_TAG_KEY = ["symbolType", "size"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
11291
11418
|
var _Symbol = /*#__PURE__*/function (_Graphic) {
|
|
@@ -11319,12 +11446,13 @@
|
|
|
11319
11446
|
}, {
|
|
11320
11447
|
key: "doUpdateParsedPath",
|
|
11321
11448
|
value: function doUpdateParsedPath() {
|
|
11322
|
-
var symbolTheme = getTheme(this).symbol
|
|
11323
|
-
|
|
11324
|
-
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo
|
|
11325
|
-
|
|
11449
|
+
var symbolTheme = getTheme(this).symbol;
|
|
11450
|
+
var _this$attribute$symbo = this.attribute.symbolType,
|
|
11451
|
+
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo,
|
|
11452
|
+
path = builtinSymbolsMap[symbolType];
|
|
11326
11453
|
if (path) return this._parsedPath = path, path;
|
|
11327
11454
|
if (path = _Symbol.userSymbolMap[symbolType], path) return this._parsedPath = path, path;
|
|
11455
|
+
symbolType = builtInSymbolStrMap[symbolType] || symbolType;
|
|
11328
11456
|
if (!0 === isSvg(symbolType)) {
|
|
11329
11457
|
var parser = new XMLParser(),
|
|
11330
11458
|
_parser$parse = parser.parse(symbolType),
|
|
@@ -11810,7 +11938,9 @@
|
|
|
11810
11938
|
var Paragraph = /*#__PURE__*/function () {
|
|
11811
11939
|
function Paragraph(text, newLine, character) {
|
|
11812
11940
|
_classCallCheck(this, Paragraph);
|
|
11813
|
-
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic"
|
|
11941
|
+
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
|
|
11942
|
+
var lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
11943
|
+
this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
|
|
11814
11944
|
var _measureTextCanvas = measureTextCanvas(text, character),
|
|
11815
11945
|
ascent = _measureTextCanvas.ascent,
|
|
11816
11946
|
height = _measureTextCanvas.height,
|
|
@@ -15341,7 +15471,7 @@
|
|
|
15341
15471
|
var t = textAlign;
|
|
15342
15472
|
textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
|
|
15343
15473
|
}
|
|
15344
|
-
var lineHeight = null !== (_c = text.attribute.lineHeight) && void 0 !== _c ? _c : fontSize,
|
|
15474
|
+
var lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
|
|
15345
15475
|
data = this.valid(text, textAttribute, fillCb, strokeCb);
|
|
15346
15476
|
if (!data) return;
|
|
15347
15477
|
var fVisible = data.fVisible,
|
|
@@ -20852,8 +20982,8 @@
|
|
|
20852
20982
|
this.name = 'tag';
|
|
20853
20983
|
}
|
|
20854
20984
|
render() {
|
|
20855
|
-
var _a
|
|
20856
|
-
const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state
|
|
20985
|
+
var _a;
|
|
20986
|
+
const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state } = this.attribute;
|
|
20857
20987
|
const parsedPadding = vutils.normalizePadding(padding);
|
|
20858
20988
|
const group = this.createOrUpdateChild('tag-content', { x: 0, y: 0, zIndex: 1 }, 'group');
|
|
20859
20989
|
let symbol;
|
|
@@ -20875,100 +21005,75 @@
|
|
|
20875
21005
|
}
|
|
20876
21006
|
tagWidth += symbolPlaceWidth;
|
|
20877
21007
|
textX += symbolPlaceWidth;
|
|
20878
|
-
|
|
20879
|
-
if (
|
|
20880
|
-
|
|
20881
|
-
|
|
20882
|
-
|
|
20883
|
-
|
|
20884
|
-
|
|
20885
|
-
|
|
20886
|
-
|
|
20887
|
-
|
|
21008
|
+
const textAttrs = Object.assign(Object.assign({ text, visible: vutils.isValid(text) && visible !== false, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize }, textStyle), { x: textX, y: 0 });
|
|
21009
|
+
if (vutils.isNil(textAttrs.lineHeight)) {
|
|
21010
|
+
textAttrs.lineHeight = textAttrs.fontSize;
|
|
21011
|
+
}
|
|
21012
|
+
const textShape = group.createOrUpdateChild('tag-text', textAttrs, 'text');
|
|
21013
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.text)) {
|
|
21014
|
+
textShape.states = state.text;
|
|
21015
|
+
}
|
|
21016
|
+
const textBounds = measureTextSize(textAttrs.text, textStyle);
|
|
21017
|
+
const textWidth = textBounds.width;
|
|
21018
|
+
const textHeight = textBounds.height;
|
|
21019
|
+
tagWidth += textWidth;
|
|
21020
|
+
const size = (_a = shape.size) !== null && _a !== void 0 ? _a : 10;
|
|
21021
|
+
const maxSize = vutils.isNumber(size) ? size : Math.max(size[0], size[1]);
|
|
21022
|
+
tagHeight += Math.max(textHeight, (shape === null || shape === void 0 ? void 0 : shape.visible) ? maxSize : 0);
|
|
21023
|
+
const { textAlign, textBaseline } = textStyle;
|
|
21024
|
+
if (vutils.isValid(minWidth) || vutils.isValid(maxWidth)) {
|
|
21025
|
+
if (vutils.isValid(minWidth) && tagWidth < minWidth) {
|
|
21026
|
+
tagWidth = minWidth;
|
|
21027
|
+
}
|
|
21028
|
+
if (vutils.isValid(maxWidth) && tagWidth > maxWidth) {
|
|
21029
|
+
tagWidth = maxWidth;
|
|
21030
|
+
textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
|
|
21031
|
+
}
|
|
21032
|
+
}
|
|
21033
|
+
let x = 0;
|
|
21034
|
+
let y = 0;
|
|
21035
|
+
if (textAlign === 'center') {
|
|
21036
|
+
x -= tagWidth / 2;
|
|
21037
|
+
if (symbol) {
|
|
21038
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
|
|
20888
21039
|
}
|
|
21040
|
+
group.setAttribute('x', -symbolPlaceWidth / 2);
|
|
20889
21041
|
}
|
|
20890
|
-
else if (
|
|
20891
|
-
|
|
20892
|
-
|
|
20893
|
-
|
|
20894
|
-
if (visible && vutils.isBoolean(bgVisible)) {
|
|
20895
|
-
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');
|
|
20896
|
-
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
20897
|
-
bgRect.states = state.panel;
|
|
20898
|
-
}
|
|
21042
|
+
else if (textAlign === 'right' || textAlign === 'end') {
|
|
21043
|
+
x -= tagWidth;
|
|
21044
|
+
if (symbol) {
|
|
21045
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
|
|
20899
21046
|
}
|
|
21047
|
+
group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
|
|
20900
21048
|
}
|
|
20901
|
-
else {
|
|
20902
|
-
|
|
20903
|
-
|
|
20904
|
-
|
|
20905
|
-
|
|
20906
|
-
|
|
20907
|
-
|
|
20908
|
-
textShape.states = state.text;
|
|
20909
|
-
}
|
|
20910
|
-
const textBounds = measureTextSize(textAttrs.text, textStyle);
|
|
20911
|
-
const textWidth = textBounds.width;
|
|
20912
|
-
const textHeight = textBounds.height;
|
|
20913
|
-
tagWidth += textWidth;
|
|
20914
|
-
const size = (_c = shape.size) !== null && _c !== void 0 ? _c : 10;
|
|
20915
|
-
const maxSize = vutils.isNumber(size) ? size : Math.max(size[0], size[1]);
|
|
20916
|
-
tagHeight += Math.max(textHeight, (shape === null || shape === void 0 ? void 0 : shape.visible) ? maxSize : 0);
|
|
20917
|
-
const { textAlign, textBaseline } = textStyle;
|
|
20918
|
-
if (vutils.isValid(minWidth) || vutils.isValid(maxWidth)) {
|
|
20919
|
-
if (vutils.isValid(minWidth) && tagWidth < minWidth) {
|
|
20920
|
-
tagWidth = minWidth;
|
|
20921
|
-
}
|
|
20922
|
-
if (vutils.isValid(maxWidth) && tagWidth > maxWidth) {
|
|
20923
|
-
tagWidth = maxWidth;
|
|
20924
|
-
textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
|
|
20925
|
-
}
|
|
20926
|
-
}
|
|
20927
|
-
let x = 0;
|
|
20928
|
-
let y = 0;
|
|
20929
|
-
if (textAlign === 'center') {
|
|
20930
|
-
x -= tagWidth / 2;
|
|
20931
|
-
if (symbol) {
|
|
20932
|
-
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
|
|
20933
|
-
}
|
|
20934
|
-
group.setAttribute('x', -symbolPlaceWidth / 2);
|
|
20935
|
-
}
|
|
20936
|
-
else if (textAlign === 'right' || textAlign === 'end') {
|
|
20937
|
-
x -= tagWidth;
|
|
20938
|
-
if (symbol) {
|
|
20939
|
-
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
|
|
20940
|
-
}
|
|
20941
|
-
group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
|
|
20942
|
-
}
|
|
20943
|
-
else if (textAlign === 'left' || textAlign === 'start') {
|
|
20944
|
-
group.setAttribute('x', parsedPadding[3]);
|
|
20945
|
-
}
|
|
20946
|
-
if (textBaseline === 'middle') {
|
|
20947
|
-
y -= tagHeight / 2;
|
|
20948
|
-
if (symbol) {
|
|
20949
|
-
symbol.setAttribute('y', 0);
|
|
20950
|
-
}
|
|
21049
|
+
else if (textAlign === 'left' || textAlign === 'start') {
|
|
21050
|
+
group.setAttribute('x', parsedPadding[3]);
|
|
21051
|
+
}
|
|
21052
|
+
if (textBaseline === 'middle') {
|
|
21053
|
+
y -= tagHeight / 2;
|
|
21054
|
+
if (symbol) {
|
|
21055
|
+
symbol.setAttribute('y', 0);
|
|
20951
21056
|
}
|
|
20952
|
-
|
|
20953
|
-
|
|
20954
|
-
|
|
20955
|
-
|
|
20956
|
-
|
|
20957
|
-
group.setAttribute('y', -parsedPadding[2]);
|
|
21057
|
+
}
|
|
21058
|
+
else if (textBaseline === 'bottom') {
|
|
21059
|
+
y -= tagHeight;
|
|
21060
|
+
if (symbol) {
|
|
21061
|
+
symbol.setAttribute('y', -textHeight / 2);
|
|
20958
21062
|
}
|
|
20959
|
-
|
|
20960
|
-
|
|
20961
|
-
|
|
20962
|
-
|
|
20963
|
-
|
|
21063
|
+
group.setAttribute('y', -parsedPadding[2]);
|
|
21064
|
+
}
|
|
21065
|
+
else if (textBaseline === 'top') {
|
|
21066
|
+
group.setAttribute('y', parsedPadding[0]);
|
|
21067
|
+
if (symbol) {
|
|
21068
|
+
symbol.setAttribute('y', textHeight / 2);
|
|
20964
21069
|
}
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
|
|
20971
|
-
|
|
21070
|
+
}
|
|
21071
|
+
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
21072
|
+
if (visible && vutils.isBoolean(bgVisible)) {
|
|
21073
|
+
const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x,
|
|
21074
|
+
y, width: tagWidth, height: tagHeight }), 'rect');
|
|
21075
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
21076
|
+
bgRect.states = state.panel;
|
|
20972
21077
|
}
|
|
20973
21078
|
}
|
|
20974
21079
|
}
|
|
@@ -21840,6 +21945,45 @@
|
|
|
21840
21945
|
var _a, _b;
|
|
21841
21946
|
return (_b = (_a = animationEffects[type]) === null || _a === void 0 ? void 0 : _a.call(animationEffects, textAttribute)) !== null && _b !== void 0 ? _b : { from: {}, to: {} };
|
|
21842
21947
|
}
|
|
21948
|
+
function updateAnimation(prev, next, animationConfig) {
|
|
21949
|
+
if (!vutils.isArray(animationConfig)) {
|
|
21950
|
+
const { duration, easing, increaseEffect = true } = animationConfig;
|
|
21951
|
+
prev.animate().to(next.attribute, duration, easing);
|
|
21952
|
+
increaseEffect && playIncreaseCount(prev, next, duration, easing);
|
|
21953
|
+
return;
|
|
21954
|
+
}
|
|
21955
|
+
animationConfig.forEach((cfg, i) => {
|
|
21956
|
+
const { duration, easing, increaseEffect = true, channel } = cfg;
|
|
21957
|
+
const { from, to } = update(prev, next, channel, cfg.options);
|
|
21958
|
+
if (!vutils.isEmpty(to)) {
|
|
21959
|
+
prev.animate().to(to, duration, easing);
|
|
21960
|
+
}
|
|
21961
|
+
if ('text' in from && 'text' in to && increaseEffect) {
|
|
21962
|
+
playIncreaseCount(prev, next, duration, easing);
|
|
21963
|
+
}
|
|
21964
|
+
});
|
|
21965
|
+
}
|
|
21966
|
+
const update = (prev, next, channel, options) => {
|
|
21967
|
+
const from = Object.assign({}, prev.attribute);
|
|
21968
|
+
const to = Object.assign({}, next.attribute);
|
|
21969
|
+
vutils.array(options === null || options === void 0 ? void 0 : options.excludeChannels).forEach(key => {
|
|
21970
|
+
delete to[key];
|
|
21971
|
+
});
|
|
21972
|
+
Object.keys(to).forEach(key => {
|
|
21973
|
+
if (channel && !channel.includes(key)) {
|
|
21974
|
+
delete to[key];
|
|
21975
|
+
}
|
|
21976
|
+
});
|
|
21977
|
+
return { from, to };
|
|
21978
|
+
};
|
|
21979
|
+
function playIncreaseCount(prev, next, duration, easing) {
|
|
21980
|
+
if (prev.attribute.text !== next.attribute.text &&
|
|
21981
|
+
vutils.isValidNumber(Number(prev.attribute.text) * Number(next.attribute.text))) {
|
|
21982
|
+
prev
|
|
21983
|
+
.animate()
|
|
21984
|
+
.play(new IncreaseCount({ text: prev.attribute.text }, { text: next.attribute.text }, duration, easing));
|
|
21985
|
+
}
|
|
21986
|
+
}
|
|
21843
21987
|
const DefaultLabelAnimation = {
|
|
21844
21988
|
mode: 'same-time',
|
|
21845
21989
|
duration: 300,
|
|
@@ -22033,6 +22177,24 @@
|
|
|
22033
22177
|
}
|
|
22034
22178
|
return points;
|
|
22035
22179
|
};
|
|
22180
|
+
function labelingLineOrArea(textBounds, graphicBounds, position = 'end', offset = 0) {
|
|
22181
|
+
if (!textBounds || !graphicBounds) {
|
|
22182
|
+
return;
|
|
22183
|
+
}
|
|
22184
|
+
const { x1, x2 } = textBounds;
|
|
22185
|
+
const width = Math.abs(x2 - x1);
|
|
22186
|
+
const anchorX = graphicBounds.x1;
|
|
22187
|
+
const anchorY = graphicBounds.y1;
|
|
22188
|
+
let x = anchorX;
|
|
22189
|
+
const y = anchorY;
|
|
22190
|
+
if (position === 'end') {
|
|
22191
|
+
x = anchorX + width / 2 + offset;
|
|
22192
|
+
}
|
|
22193
|
+
else if (position === 'start') {
|
|
22194
|
+
x = anchorX - width / 2 - offset;
|
|
22195
|
+
}
|
|
22196
|
+
return { x, y };
|
|
22197
|
+
}
|
|
22036
22198
|
|
|
22037
22199
|
class LabelBase extends AbstractComponent {
|
|
22038
22200
|
setBitmap(bitmap) {
|
|
@@ -22180,31 +22342,13 @@
|
|
|
22180
22342
|
target.states = state;
|
|
22181
22343
|
}
|
|
22182
22344
|
_createLabelText(attributes) {
|
|
22183
|
-
var _a, _b;
|
|
22184
|
-
if (attributes.type === 'rich') {
|
|
22185
|
-
attributes.textConfig = attributes.text;
|
|
22186
|
-
attributes.width = (_a = attributes.width) !== null && _a !== void 0 ? _a : 0;
|
|
22187
|
-
attributes.height = (_b = attributes.height) !== null && _b !== void 0 ? _b : 0;
|
|
22188
|
-
const text = createRichText(attributes);
|
|
22189
|
-
this._bindEvent(text);
|
|
22190
|
-
this._setStatesOfText(text);
|
|
22191
|
-
return text;
|
|
22192
|
-
}
|
|
22193
|
-
else if (attributes.type === 'html') {
|
|
22194
|
-
attributes.textConfig = [];
|
|
22195
|
-
attributes.html = Object.assign({ dom: attributes.text, container: '', width: 30, height: 30, style: {} }, attributes);
|
|
22196
|
-
const text = createRichText(attributes);
|
|
22197
|
-
this._bindEvent(text);
|
|
22198
|
-
this._setStatesOfText(text);
|
|
22199
|
-
return text;
|
|
22200
|
-
}
|
|
22201
22345
|
const text = createText(attributes);
|
|
22202
22346
|
this._bindEvent(text);
|
|
22203
22347
|
this._setStatesOfText(text);
|
|
22204
22348
|
return text;
|
|
22205
22349
|
}
|
|
22206
22350
|
_prepare() {
|
|
22207
|
-
var _a, _b, _c, _d;
|
|
22351
|
+
var _a, _b, _c, _d, _e;
|
|
22208
22352
|
const currentBaseMarks = [];
|
|
22209
22353
|
let baseMarks;
|
|
22210
22354
|
if (vutils.isFunction(this.attribute.getBaseMarks)) {
|
|
@@ -22221,7 +22365,7 @@
|
|
|
22221
22365
|
(_a = this._idToGraphic) === null || _a === void 0 ? void 0 : _a.clear();
|
|
22222
22366
|
(_b = this._idToPoint) === null || _b === void 0 ? void 0 : _b.clear();
|
|
22223
22367
|
this._baseMarks = currentBaseMarks;
|
|
22224
|
-
this._isCollectionBase =
|
|
22368
|
+
this._isCollectionBase = this.attribute.type === 'line-data';
|
|
22225
22369
|
if (!currentBaseMarks || currentBaseMarks.length === 0) {
|
|
22226
22370
|
return;
|
|
22227
22371
|
}
|
|
@@ -22267,6 +22411,15 @@
|
|
|
22267
22411
|
}
|
|
22268
22412
|
}
|
|
22269
22413
|
}
|
|
22414
|
+
if (this.attribute.animation !== false) {
|
|
22415
|
+
this._animationConfig = {
|
|
22416
|
+
enter: vutils.merge({}, DefaultLabelAnimation, this.attribute.animation, (_c = this.attribute.animationEnter) !== null && _c !== void 0 ? _c : {}),
|
|
22417
|
+
exit: vutils.merge({}, DefaultLabelAnimation, this.attribute.animation, (_d = this.attribute.animationExit) !== null && _d !== void 0 ? _d : {}),
|
|
22418
|
+
update: vutils.isArray(this.attribute.animationUpdate)
|
|
22419
|
+
? this.attribute.animationUpdate
|
|
22420
|
+
: vutils.merge({}, DefaultLabelAnimation, this.attribute.animation, (_e = this.attribute.animationUpdate) !== null && _e !== void 0 ? _e : {})
|
|
22421
|
+
};
|
|
22422
|
+
}
|
|
22270
22423
|
}
|
|
22271
22424
|
getRelatedGrphic(item) {
|
|
22272
22425
|
return this._idToGraphic.get(item.id);
|
|
@@ -22414,17 +22567,11 @@
|
|
|
22414
22567
|
}
|
|
22415
22568
|
}
|
|
22416
22569
|
_renderWithAnimation(labels) {
|
|
22417
|
-
var _a, _b, _c, _d, _e;
|
|
22418
|
-
const animationConfig = ((_a = this.attribute.animation) !== null && _a !== void 0 ? _a : {});
|
|
22419
|
-
const mode = (_b = animationConfig.mode) !== null && _b !== void 0 ? _b : DefaultLabelAnimation.mode;
|
|
22420
|
-
const duration = (_c = animationConfig.duration) !== null && _c !== void 0 ? _c : DefaultLabelAnimation.duration;
|
|
22421
|
-
const easing = (_d = animationConfig.easing) !== null && _d !== void 0 ? _d : DefaultLabelAnimation.easing;
|
|
22422
|
-
const delay = (_e = animationConfig.delay) !== null && _e !== void 0 ? _e : 0;
|
|
22423
22570
|
const currentTextMap = new Map();
|
|
22424
22571
|
const prevTextMap = this._graphicToText || new Map();
|
|
22425
22572
|
const texts = [];
|
|
22426
22573
|
labels.forEach((text, index) => {
|
|
22427
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
22574
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
22428
22575
|
const labelLine = this._labelLine(text);
|
|
22429
22576
|
const relatedGraphic = this.getRelatedGrphic(text.attribute);
|
|
22430
22577
|
const textId = text.attribute.id;
|
|
@@ -22443,13 +22590,7 @@
|
|
|
22443
22590
|
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
22444
22591
|
relatedGraphic.once('animate-bind', a => {
|
|
22445
22592
|
text.setAttributes(from);
|
|
22446
|
-
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic,
|
|
22447
|
-
mode,
|
|
22448
|
-
duration,
|
|
22449
|
-
easing,
|
|
22450
|
-
to,
|
|
22451
|
-
delay
|
|
22452
|
-
});
|
|
22593
|
+
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, this._animationConfig.enter);
|
|
22453
22594
|
relatedGraphic.on('afterAttributeUpdate', listener);
|
|
22454
22595
|
});
|
|
22455
22596
|
}
|
|
@@ -22459,25 +22600,19 @@
|
|
|
22459
22600
|
prevTextMap.delete(textKey);
|
|
22460
22601
|
currentTextMap.set(textKey, prevLabel);
|
|
22461
22602
|
const prevText = prevLabel.text;
|
|
22462
|
-
|
|
22603
|
+
const { duration, easing } = this._animationConfig.update;
|
|
22604
|
+
updateAnimation(prevText, text, this._animationConfig.update);
|
|
22463
22605
|
if (prevLabel.labelLine) {
|
|
22464
22606
|
prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
|
|
22465
22607
|
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,
|
|
22466
22608
|
points: (_g = text.attribute) === null || _g === void 0 ? void 0 : _g.points
|
|
22467
22609
|
}), duration, easing);
|
|
22468
22610
|
}
|
|
22469
|
-
if (animationConfig.increaseEffect !== false &&
|
|
22470
|
-
((_h = prevText.attribute) === null || _h === void 0 ? void 0 : _h.text) !== ((_j = text.attribute) === null || _j === void 0 ? void 0 : _j.text) &&
|
|
22471
|
-
vutils.isValidNumber(Number((_k = prevText.attribute) === null || _k === void 0 ? void 0 : _k.text) * Number((_l = text.attribute) === null || _l === void 0 ? void 0 : _l.text))) {
|
|
22472
|
-
prevText
|
|
22473
|
-
.animate()
|
|
22474
|
-
.play(new IncreaseCount({ text: (_m = prevText.attribute) === null || _m === void 0 ? void 0 : _m.text }, { text: (_o = text.attribute) === null || _o === void 0 ? void 0 : _o.text }, duration, easing));
|
|
22475
|
-
}
|
|
22476
22611
|
}
|
|
22477
22612
|
});
|
|
22478
22613
|
prevTextMap.forEach(label => {
|
|
22479
22614
|
var _a;
|
|
22480
|
-
(_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing).onEnd(() => {
|
|
22615
|
+
(_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(() => {
|
|
22481
22616
|
this.removeChild(label.text);
|
|
22482
22617
|
if (label === null || label === void 0 ? void 0 : label.labelLine) {
|
|
22483
22618
|
this.removeChild(label.labelLine);
|
|
@@ -22526,7 +22661,7 @@
|
|
|
22526
22661
|
relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);
|
|
22527
22662
|
}
|
|
22528
22663
|
}
|
|
22529
|
-
_afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, { mode, duration, easing,
|
|
22664
|
+
_afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, { mode, duration, easing, delay }) {
|
|
22530
22665
|
const listener = (event) => {
|
|
22531
22666
|
var _a, _b;
|
|
22532
22667
|
const { detail } = event;
|
|
@@ -22544,7 +22679,7 @@
|
|
|
22544
22679
|
text.setAttributes(to);
|
|
22545
22680
|
return;
|
|
22546
22681
|
}
|
|
22547
|
-
const
|
|
22682
|
+
const onStart = () => {
|
|
22548
22683
|
if (relatedGraphic) {
|
|
22549
22684
|
relatedGraphic.onAnimateBind = undefined;
|
|
22550
22685
|
relatedGraphic.removeEventListener('afterAttributeUpdate', listener);
|
|
@@ -22553,14 +22688,14 @@
|
|
|
22553
22688
|
switch (mode) {
|
|
22554
22689
|
case 'after':
|
|
22555
22690
|
if (detail.animationState.end) {
|
|
22556
|
-
text.animate({
|
|
22691
|
+
text.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
22557
22692
|
}
|
|
22558
22693
|
break;
|
|
22559
22694
|
case 'after-all':
|
|
22560
22695
|
if (index === texts.length - 1) {
|
|
22561
22696
|
if (detail.animationState.end) {
|
|
22562
22697
|
texts.forEach(t => {
|
|
22563
|
-
t.animate({
|
|
22698
|
+
t.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
22564
22699
|
});
|
|
22565
22700
|
}
|
|
22566
22701
|
}
|
|
@@ -22571,12 +22706,12 @@
|
|
|
22571
22706
|
const point = this._idToPoint.get(text.attribute.id);
|
|
22572
22707
|
if (point &&
|
|
22573
22708
|
(!text.animates || !text.animates.has('label-animate')) &&
|
|
22574
|
-
|
|
22575
|
-
text.animate({
|
|
22709
|
+
relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, (_b = this.stage) === null || _b === void 0 ? void 0 : _b.pickerService)) {
|
|
22710
|
+
text.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
22576
22711
|
}
|
|
22577
22712
|
}
|
|
22578
22713
|
else if (detail.animationState.isFirstFrameOfStep) {
|
|
22579
|
-
text.animate({
|
|
22714
|
+
text.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
22580
22715
|
}
|
|
22581
22716
|
break;
|
|
22582
22717
|
}
|
|
@@ -22810,22 +22945,7 @@
|
|
|
22810
22945
|
};
|
|
22811
22946
|
}
|
|
22812
22947
|
labeling(textBounds, graphicBounds, position = 'end', offset = 0) {
|
|
22813
|
-
|
|
22814
|
-
return;
|
|
22815
|
-
}
|
|
22816
|
-
const { x1, x2 } = textBounds;
|
|
22817
|
-
const width = Math.abs(x2 - x1);
|
|
22818
|
-
const anchorX = graphicBounds.x1;
|
|
22819
|
-
const anchorY = graphicBounds.y1;
|
|
22820
|
-
let x = anchorX;
|
|
22821
|
-
const y = anchorY;
|
|
22822
|
-
if (position === 'end') {
|
|
22823
|
-
x = anchorX + width / 2 + offset;
|
|
22824
|
-
}
|
|
22825
|
-
else if (position === 'start') {
|
|
22826
|
-
x = anchorX - width / 2 - offset;
|
|
22827
|
-
}
|
|
22828
|
-
return { x, y };
|
|
22948
|
+
return labelingLineOrArea(textBounds, graphicBounds, position, offset);
|
|
22829
22949
|
}
|
|
22830
22950
|
}
|
|
22831
22951
|
LineLabel.defaultAttributes = {
|
|
@@ -23587,10 +23707,49 @@
|
|
|
23587
23707
|
pickable: false
|
|
23588
23708
|
};
|
|
23589
23709
|
|
|
23710
|
+
class AreaLabel extends LabelBase {
|
|
23711
|
+
constructor(attributes) {
|
|
23712
|
+
super(vutils.merge({}, AreaLabel.defaultAttributes, attributes));
|
|
23713
|
+
this.name = 'line-label';
|
|
23714
|
+
}
|
|
23715
|
+
getGraphicBounds(graphic, point = {}) {
|
|
23716
|
+
var _a;
|
|
23717
|
+
if (graphic.type !== 'area') {
|
|
23718
|
+
return super.getGraphicBounds(graphic, point);
|
|
23719
|
+
}
|
|
23720
|
+
const { position = 'end' } = this.attribute;
|
|
23721
|
+
const points = ((_a = graphic === null || graphic === void 0 ? void 0 : graphic.attribute) === null || _a === void 0 ? void 0 : _a.points) || [point];
|
|
23722
|
+
const index = position === 'start' ? 0 : points.length - 1;
|
|
23723
|
+
return {
|
|
23724
|
+
x1: points[index].x,
|
|
23725
|
+
x2: points[index].x,
|
|
23726
|
+
y1: points[index].y,
|
|
23727
|
+
y2: points[index].y
|
|
23728
|
+
};
|
|
23729
|
+
}
|
|
23730
|
+
labeling(textBounds, graphicBounds, position = 'end', offset = 0) {
|
|
23731
|
+
return labelingLineOrArea(textBounds, graphicBounds, position, offset);
|
|
23732
|
+
}
|
|
23733
|
+
}
|
|
23734
|
+
AreaLabel.defaultAttributes = {
|
|
23735
|
+
textStyle: {
|
|
23736
|
+
fontSize: 12,
|
|
23737
|
+
fill: '#000',
|
|
23738
|
+
textAlign: 'center',
|
|
23739
|
+
textBaseline: 'middle',
|
|
23740
|
+
boundsPadding: [-1, 0, -1, 0]
|
|
23741
|
+
},
|
|
23742
|
+
position: 'end',
|
|
23743
|
+
offset: 6,
|
|
23744
|
+
pickable: false
|
|
23745
|
+
};
|
|
23746
|
+
|
|
23590
23747
|
const labelComponentMap = {
|
|
23591
23748
|
rect: RectLabel,
|
|
23592
23749
|
symbol: SymbolLabel,
|
|
23593
23750
|
arc: ArcLabel,
|
|
23751
|
+
line: LineLabel,
|
|
23752
|
+
area: AreaLabel,
|
|
23594
23753
|
'line-data': LineDataLabel
|
|
23595
23754
|
};
|
|
23596
23755
|
class DataLabel extends AbstractComponent {
|
|
@@ -23599,6 +23758,7 @@
|
|
|
23599
23758
|
this.name = 'data-label';
|
|
23600
23759
|
}
|
|
23601
23760
|
render() {
|
|
23761
|
+
var _a;
|
|
23602
23762
|
const { dataLabels, size } = this.attribute;
|
|
23603
23763
|
if (!dataLabels || dataLabels.length === 0) {
|
|
23604
23764
|
return;
|
|
@@ -23618,20 +23778,21 @@
|
|
|
23618
23778
|
const dataLabel = dataLabels[i];
|
|
23619
23779
|
const labelComponent = labelComponentMap[dataLabel.type] || LabelBase;
|
|
23620
23780
|
if (labelComponent) {
|
|
23621
|
-
const { baseMarkGroupName } = dataLabel;
|
|
23622
|
-
|
|
23781
|
+
const { baseMarkGroupName, type } = dataLabel;
|
|
23782
|
+
const id = (_a = dataLabel.id) !== null && _a !== void 0 ? _a : `${baseMarkGroupName}-${type}-${i}`;
|
|
23783
|
+
let component = this._componentMap.get(id);
|
|
23623
23784
|
if (component) {
|
|
23624
23785
|
component.setBitmapTool(tool);
|
|
23625
23786
|
component.setBitmap(bitmap);
|
|
23626
23787
|
component.setAttributes(dataLabel);
|
|
23627
|
-
currentComponentMap.set(
|
|
23788
|
+
currentComponentMap.set(id, component);
|
|
23628
23789
|
}
|
|
23629
23790
|
else {
|
|
23630
23791
|
component = new labelComponent(dataLabel);
|
|
23631
23792
|
component.setBitmap(bitmap);
|
|
23632
23793
|
component.setBitmapTool(tool);
|
|
23633
23794
|
this.add(component);
|
|
23634
|
-
currentComponentMap.set(
|
|
23795
|
+
currentComponentMap.set(id, component);
|
|
23635
23796
|
}
|
|
23636
23797
|
}
|
|
23637
23798
|
}
|
|
@@ -24143,26 +24304,12 @@
|
|
|
24143
24304
|
let textAlign = 'center';
|
|
24144
24305
|
let textBaseline = 'middle';
|
|
24145
24306
|
data.forEach((item, index) => {
|
|
24146
|
-
var _a, _b
|
|
24307
|
+
var _a, _b;
|
|
24147
24308
|
const labelStyle = this._getLabelAttribute(item, index, data, layer);
|
|
24148
|
-
|
|
24149
|
-
if ((labelStyle === null || labelStyle === void 0 ? void 0 : labelStyle.type) === 'rich') {
|
|
24150
|
-
labelStyle.textConfig = labelStyle.text;
|
|
24151
|
-
labelStyle.width = (_a = labelStyle.width) !== null && _a !== void 0 ? _a : 0;
|
|
24152
|
-
labelStyle.height = (_b = labelStyle.height) !== null && _b !== void 0 ? _b : 0;
|
|
24153
|
-
text = createRichText(labelStyle);
|
|
24154
|
-
}
|
|
24155
|
-
else if ((labelStyle === null || labelStyle === void 0 ? void 0 : labelStyle.type) === 'html') {
|
|
24156
|
-
labelStyle.textConfig = [];
|
|
24157
|
-
labelStyle.html = Object.assign({ dom: labelStyle.text, container: '', width: 30, height: 30, style: {} }, labelStyle);
|
|
24158
|
-
text = createRichText(labelStyle);
|
|
24159
|
-
}
|
|
24160
|
-
else {
|
|
24161
|
-
text = createText(labelStyle);
|
|
24162
|
-
}
|
|
24309
|
+
const text = createText(labelStyle);
|
|
24163
24310
|
text.name = exports.AXIS_ELEMENT_NAME.label;
|
|
24164
24311
|
text.id = this._getNodeId(`layer${layer}-label-${item.id}`);
|
|
24165
|
-
if (vutils.isEmpty((
|
|
24312
|
+
if (vutils.isEmpty((_a = this.attribute.label) === null || _a === void 0 ? void 0 : _a.state)) {
|
|
24166
24313
|
text.states = DEFAULT_STATES$2;
|
|
24167
24314
|
}
|
|
24168
24315
|
else {
|
|
@@ -24175,7 +24322,7 @@
|
|
|
24175
24322
|
text.states = labelState;
|
|
24176
24323
|
}
|
|
24177
24324
|
labelGroup.add(text);
|
|
24178
|
-
const angle = (
|
|
24325
|
+
const angle = (_b = labelStyle.angle) !== null && _b !== void 0 ? _b : 0;
|
|
24179
24326
|
maxTextWidth = Math.max(maxTextWidth, text.AABBBounds.width());
|
|
24180
24327
|
maxTextHeight = Math.max(maxTextHeight, text.AABBBounds.height());
|
|
24181
24328
|
if (angle) {
|
|
@@ -24324,7 +24471,7 @@
|
|
|
24324
24471
|
}
|
|
24325
24472
|
_getLabelAttribute(tickDatum, index, tickData, layer) {
|
|
24326
24473
|
var _a, _b, _c, _d, _e, _f;
|
|
24327
|
-
const _g = this.attribute.label, { space = 4, inside = false, formatMethod
|
|
24474
|
+
const _g = this.attribute.label, { space = 4, inside = false, formatMethod } = _g, tagAttributes = __rest(_g, ["space", "inside", "formatMethod"]);
|
|
24328
24475
|
let offset = space;
|
|
24329
24476
|
let tickLength = 0;
|
|
24330
24477
|
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) {
|
|
@@ -24345,9 +24492,7 @@
|
|
|
24345
24492
|
}
|
|
24346
24493
|
const point = this.getVerticalCoord(tickDatum.point, offset, inside);
|
|
24347
24494
|
const vector = this.getVerticalVector(offset, inside, point);
|
|
24348
|
-
const
|
|
24349
|
-
? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer)
|
|
24350
|
-
: tickDatum.label;
|
|
24495
|
+
const text = formatMethod ? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer) : tickDatum.label;
|
|
24351
24496
|
let { style: textStyle } = tagAttributes;
|
|
24352
24497
|
textStyle = vutils.isFunction(textStyle)
|
|
24353
24498
|
? vutils.merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer))
|
|
@@ -24362,7 +24507,7 @@
|
|
|
24362
24507
|
layer
|
|
24363
24508
|
});
|
|
24364
24509
|
}
|
|
24365
|
-
return Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector,
|
|
24510
|
+
return Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, text, textStyle)), { text, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize }), textStyle);
|
|
24366
24511
|
}
|
|
24367
24512
|
getLabelPosition(point, vector, text, style) {
|
|
24368
24513
|
return point;
|
|
@@ -25100,7 +25245,7 @@
|
|
|
25100
25245
|
let titleSpacing = 0;
|
|
25101
25246
|
const axisLineWidth = (line === null || line === void 0 ? void 0 : line.visible) ? (_b = line.style.lineWidth) !== null && _b !== void 0 ? _b : 1 : 0;
|
|
25102
25247
|
const tickLength = (tick === null || tick === void 0 ? void 0 : tick.visible) ? (_c = tick.length) !== null && _c !== void 0 ? _c : 4 : 0;
|
|
25103
|
-
if (
|
|
25248
|
+
if (title === null || title === void 0 ? void 0 : title.visible) {
|
|
25104
25249
|
titleHeight = measureTextSize(title.text, title.textStyle).height;
|
|
25105
25250
|
const padding = vutils.normalizePadding(title.padding);
|
|
25106
25251
|
titleSpacing = title.space + padding[0] + padding[2];
|
|
@@ -25895,13 +26040,6 @@
|
|
|
25895
26040
|
}
|
|
25896
26041
|
vutils.mixin(CircleAxisGrid, CircleAxisMixin);
|
|
25897
26042
|
|
|
25898
|
-
var DataZoomActiveTag;
|
|
25899
|
-
(function (DataZoomActiveTag) {
|
|
25900
|
-
DataZoomActiveTag["startHandler"] = "startHandler";
|
|
25901
|
-
DataZoomActiveTag["endHandler"] = "endHandler";
|
|
25902
|
-
DataZoomActiveTag["middleHandler"] = "middleHandler";
|
|
25903
|
-
DataZoomActiveTag["background"] = "background";
|
|
25904
|
-
})(DataZoomActiveTag || (DataZoomActiveTag = {}));
|
|
25905
26043
|
const DEFAULT_DATA_ZOOM_ATTRIBUTES = {
|
|
25906
26044
|
orient: 'bottom',
|
|
25907
26045
|
showDetail: 'auto',
|
|
@@ -26000,6 +26138,14 @@
|
|
|
26000
26138
|
}
|
|
26001
26139
|
};
|
|
26002
26140
|
|
|
26141
|
+
exports.DataZoomActiveTag = void 0;
|
|
26142
|
+
(function (DataZoomActiveTag) {
|
|
26143
|
+
DataZoomActiveTag["startHandler"] = "startHandler";
|
|
26144
|
+
DataZoomActiveTag["endHandler"] = "endHandler";
|
|
26145
|
+
DataZoomActiveTag["middleHandler"] = "middleHandler";
|
|
26146
|
+
DataZoomActiveTag["background"] = "background";
|
|
26147
|
+
})(exports.DataZoomActiveTag || (exports.DataZoomActiveTag = {}));
|
|
26148
|
+
|
|
26003
26149
|
const delayMap$1 = {
|
|
26004
26150
|
debounce: vutils.debounce,
|
|
26005
26151
|
throttle: vutils.throttle
|
|
@@ -26027,23 +26173,23 @@
|
|
|
26027
26173
|
this._onHandlerPointerDown = (e, tag) => {
|
|
26028
26174
|
e.stopPropagation();
|
|
26029
26175
|
if (tag === 'start') {
|
|
26030
|
-
this._activeTag = DataZoomActiveTag.startHandler;
|
|
26176
|
+
this._activeTag = exports.DataZoomActiveTag.startHandler;
|
|
26031
26177
|
this._activeItem = this._startHandler;
|
|
26032
26178
|
}
|
|
26033
26179
|
else if (tag === 'end') {
|
|
26034
|
-
this._activeTag = DataZoomActiveTag.endHandler;
|
|
26180
|
+
this._activeTag = exports.DataZoomActiveTag.endHandler;
|
|
26035
26181
|
this._activeItem = this._endHandler;
|
|
26036
26182
|
}
|
|
26037
26183
|
else if (tag === 'middleRect') {
|
|
26038
|
-
this._activeTag = DataZoomActiveTag.middleHandler;
|
|
26184
|
+
this._activeTag = exports.DataZoomActiveTag.middleHandler;
|
|
26039
26185
|
this._activeItem = this._middleHandlerRect;
|
|
26040
26186
|
}
|
|
26041
26187
|
else if (tag === 'middleSymbol') {
|
|
26042
|
-
this._activeTag = DataZoomActiveTag.middleHandler;
|
|
26188
|
+
this._activeTag = exports.DataZoomActiveTag.middleHandler;
|
|
26043
26189
|
this._activeItem = this._middleHandlerSymbol;
|
|
26044
26190
|
}
|
|
26045
26191
|
else if (tag === 'background') {
|
|
26046
|
-
this._activeTag = DataZoomActiveTag.background;
|
|
26192
|
+
this._activeTag = exports.DataZoomActiveTag.background;
|
|
26047
26193
|
this._activeItem = this._background;
|
|
26048
26194
|
}
|
|
26049
26195
|
this._activeState = true;
|
|
@@ -26051,6 +26197,7 @@
|
|
|
26051
26197
|
this._activeCache.lastPos = this.eventPosToStagePos(e);
|
|
26052
26198
|
};
|
|
26053
26199
|
this._onHandlerPointerMove = (e) => {
|
|
26200
|
+
var _a;
|
|
26054
26201
|
e.stopPropagation();
|
|
26055
26202
|
const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
|
|
26056
26203
|
const pos = this.eventPosToStagePos(e);
|
|
@@ -26058,24 +26205,24 @@
|
|
|
26058
26205
|
const dis = (pos[attPos] - this._activeCache.lastPos[attPos]) / max;
|
|
26059
26206
|
let { start, end } = this.state;
|
|
26060
26207
|
if (this._activeState) {
|
|
26061
|
-
if (this._activeTag === DataZoomActiveTag.middleHandler) {
|
|
26208
|
+
if (this._activeTag === exports.DataZoomActiveTag.middleHandler) {
|
|
26062
26209
|
this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis);
|
|
26063
26210
|
}
|
|
26064
|
-
else if (this._activeTag === DataZoomActiveTag.startHandler) {
|
|
26211
|
+
else if (this._activeTag === exports.DataZoomActiveTag.startHandler) {
|
|
26065
26212
|
if (start + dis > end) {
|
|
26066
26213
|
start = end;
|
|
26067
26214
|
end = start + dis;
|
|
26068
|
-
this._activeTag = DataZoomActiveTag.endHandler;
|
|
26215
|
+
this._activeTag = exports.DataZoomActiveTag.endHandler;
|
|
26069
26216
|
}
|
|
26070
26217
|
else {
|
|
26071
26218
|
start = start + dis;
|
|
26072
26219
|
}
|
|
26073
26220
|
}
|
|
26074
|
-
else if (this._activeTag === DataZoomActiveTag.endHandler) {
|
|
26221
|
+
else if (this._activeTag === exports.DataZoomActiveTag.endHandler) {
|
|
26075
26222
|
if (end + dis < start) {
|
|
26076
26223
|
end = start;
|
|
26077
26224
|
start = end + dis;
|
|
26078
|
-
this._activeTag = DataZoomActiveTag.startHandler;
|
|
26225
|
+
this._activeTag = exports.DataZoomActiveTag.startHandler;
|
|
26079
26226
|
}
|
|
26080
26227
|
else {
|
|
26081
26228
|
end = end + dis;
|
|
@@ -26088,7 +26235,7 @@
|
|
|
26088
26235
|
end = Math.min(Math.max(end, 0), 1);
|
|
26089
26236
|
if (startAttr !== start || endAttr !== end) {
|
|
26090
26237
|
this.setStateAttr(start, end, true);
|
|
26091
|
-
realTime && this._updateStateCallback
|
|
26238
|
+
realTime && ((_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, start, end, this._activeTag));
|
|
26092
26239
|
this._dispatchChangeEvent(start, end);
|
|
26093
26240
|
}
|
|
26094
26241
|
};
|
|
@@ -26193,10 +26340,11 @@
|
|
|
26193
26340
|
};
|
|
26194
26341
|
}
|
|
26195
26342
|
_onHandlerPointerUp(e) {
|
|
26343
|
+
var _a;
|
|
26196
26344
|
e.preventDefault();
|
|
26197
26345
|
const { start, end, brushSelect, realTime = true } = this.attribute;
|
|
26198
26346
|
if (this._activeState) {
|
|
26199
|
-
if (this._activeTag === DataZoomActiveTag.background) {
|
|
26347
|
+
if (this._activeTag === exports.DataZoomActiveTag.background) {
|
|
26200
26348
|
const pos = this.eventPosToStagePos(e);
|
|
26201
26349
|
this.backgroundDragZoom(this._activeCache.startPos, pos);
|
|
26202
26350
|
}
|
|
@@ -26205,7 +26353,7 @@
|
|
|
26205
26353
|
brushSelect && this.renderDragMask();
|
|
26206
26354
|
if (!realTime || start !== this.state.start || end !== this.state.end) {
|
|
26207
26355
|
this.setStateAttr(this.state.start, this.state.end, true);
|
|
26208
|
-
this._updateStateCallback
|
|
26356
|
+
(_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, this.state.start, this.state.end, this._activeTag);
|
|
26209
26357
|
this._dispatchChangeEvent(this.state.start, this.state.end);
|
|
26210
26358
|
}
|
|
26211
26359
|
}
|
|
@@ -26255,11 +26403,11 @@
|
|
|
26255
26403
|
const { dragMaskStyle } = this.attribute;
|
|
26256
26404
|
const { position, width, height } = this.getLayoutAttrFromConfig();
|
|
26257
26405
|
if (this._isHorizontal) {
|
|
26258
|
-
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())) ||
|
|
26406
|
+
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())) ||
|
|
26259
26407
|
0, height }, dragMaskStyle), 'rect');
|
|
26260
26408
|
}
|
|
26261
26409
|
else {
|
|
26262
|
-
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())) ||
|
|
26410
|
+
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())) ||
|
|
26263
26411
|
0 }, dragMaskStyle), 'rect');
|
|
26264
26412
|
}
|
|
26265
26413
|
}
|
|
@@ -26578,13 +26726,14 @@
|
|
|
26578
26726
|
this.dispatchEvent(changeEvent);
|
|
26579
26727
|
}
|
|
26580
26728
|
setStartAndEnd(start, end) {
|
|
26729
|
+
var _a;
|
|
26581
26730
|
const { start: startAttr, end: endAttr } = this.attribute;
|
|
26582
26731
|
if (vutils.isValid(start) && vutils.isValid(end) && (start !== this.state.start || end !== this.state.end)) {
|
|
26583
26732
|
this.state.start = start;
|
|
26584
26733
|
this.state.end = end;
|
|
26585
26734
|
if (startAttr !== this.state.start || endAttr !== this.state.end) {
|
|
26586
26735
|
this.setStateAttr(start, end, true);
|
|
26587
|
-
this._updateStateCallback
|
|
26736
|
+
(_a = this._updateStateCallback) === null || _a === void 0 ? void 0 : _a.call(this, start, end, this._activeTag);
|
|
26588
26737
|
this._dispatchChangeEvent(start, end);
|
|
26589
26738
|
}
|
|
26590
26739
|
}
|
|
@@ -29308,27 +29457,19 @@
|
|
|
29308
29457
|
this.name = 'title';
|
|
29309
29458
|
}
|
|
29310
29459
|
render() {
|
|
29311
|
-
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
|
|
29312
|
-
const {
|
|
29460
|
+
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;
|
|
29461
|
+
const { text, textStyle, subtext, subtextStyle, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
|
|
29313
29462
|
const parsedPadding = vutils.normalizePadding(padding);
|
|
29314
29463
|
const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
|
|
29315
29464
|
if (((_a = this.attribute) === null || _a === void 0 ? void 0 : _a.visible) !== false && (textStyle === null || textStyle === void 0 ? void 0 : textStyle.visible) !== false) {
|
|
29316
|
-
if (
|
|
29317
|
-
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: text }, textStyle);
|
|
29318
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
29319
|
-
}
|
|
29320
|
-
else if (textType === 'html') {
|
|
29321
|
-
const attr = Object.assign({ html: Object.assign({ dom: text, container: '', width: 30, height: 30, style: '' }, textStyle), x: (_k = textStyle.x) !== null && _k !== void 0 ? _k : 0, y: (_l = textStyle.y) !== null && _l !== void 0 ? _l : 0, width: (_o = (_m = textStyle.width) !== null && _m !== void 0 ? _m : width) !== null && _o !== void 0 ? _o : 0, height: (_q = (_p = textStyle.height) !== null && _p !== void 0 ? _p : height) !== null && _q !== void 0 ? _q : 0, ellipsis: (_r = textStyle.ellipsis) !== null && _r !== void 0 ? _r : true, wordBreak: (_s = textStyle.wordBreak) !== null && _s !== void 0 ? _s : 'break-word', maxHeight: textStyle.maxHeight, maxWidth: textStyle.maxWidth, textConfig: [] }, textStyle);
|
|
29322
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
29323
|
-
}
|
|
29324
|
-
else if (textStyle && vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.character)) {
|
|
29465
|
+
if (textStyle && vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.character)) {
|
|
29325
29466
|
const attr = {
|
|
29326
|
-
x: (
|
|
29327
|
-
y: (
|
|
29328
|
-
width: (
|
|
29329
|
-
height: (
|
|
29330
|
-
ellipsis: (
|
|
29331
|
-
wordBreak: (
|
|
29467
|
+
x: (_b = textStyle.x) !== null && _b !== void 0 ? _b : 0,
|
|
29468
|
+
y: (_c = textStyle.y) !== null && _c !== void 0 ? _c : 0,
|
|
29469
|
+
width: (_e = (_d = textStyle.width) !== null && _d !== void 0 ? _d : width) !== null && _e !== void 0 ? _e : 0,
|
|
29470
|
+
height: (_g = (_f = textStyle.height) !== null && _f !== void 0 ? _f : height) !== null && _g !== void 0 ? _g : 0,
|
|
29471
|
+
ellipsis: (_h = textStyle.ellipsis) !== null && _h !== void 0 ? _h : true,
|
|
29472
|
+
wordBreak: (_j = textStyle.wordBreak) !== null && _j !== void 0 ? _j : 'break-word',
|
|
29332
29473
|
maxHeight: textStyle.maxHeight,
|
|
29333
29474
|
maxWidth: textStyle.maxWidth,
|
|
29334
29475
|
textConfig: textStyle.character
|
|
@@ -29336,28 +29477,20 @@
|
|
|
29336
29477
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
29337
29478
|
}
|
|
29338
29479
|
else if (vutils.isValid(text)) {
|
|
29339
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: [text] }, textStyle), { maxLineWidth: (
|
|
29480
|
+
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: [text] }, textStyle), { maxLineWidth: (_k = textStyle === null || textStyle === void 0 ? void 0 : textStyle.maxLineWidth) !== null && _k !== void 0 ? _k : width, heightLimit: textStyle === null || textStyle === void 0 ? void 0 : textStyle.heightLimit, lineClamp: textStyle === null || textStyle === void 0 ? void 0 : textStyle.lineClamp, ellipsis: (_l = textStyle === null || textStyle === void 0 ? void 0 : textStyle.ellipsis) !== null && _l !== void 0 ? _l : true, x: 0, y: 0 }), 'wrapText');
|
|
29340
29481
|
}
|
|
29341
29482
|
}
|
|
29342
|
-
const maintextHeight = this._mainTitle ? (
|
|
29343
|
-
const maintextWidth = this._mainTitle ? (
|
|
29344
|
-
if (((
|
|
29345
|
-
if (
|
|
29346
|
-
const attr = Object.assign({ x: (_6 = subtextStyle.x) !== null && _6 !== void 0 ? _6 : 0, y: (_7 = subtextStyle.y) !== null && _7 !== void 0 ? _7 : 0, width: (_9 = (_8 = subtextStyle.width) !== null && _8 !== void 0 ? _8 : width) !== null && _9 !== void 0 ? _9 : 0, height: (_11 = (_10 = subtextStyle.height) !== null && _10 !== void 0 ? _10 : height) !== null && _11 !== void 0 ? _11 : 0, ellipsis: (_12 = subtextStyle.ellipsis) !== null && _12 !== void 0 ? _12 : true, wordBreak: (_13 = subtextStyle.wordBreak) !== null && _13 !== void 0 ? _13 : 'break-word', maxHeight: subtextStyle.maxHeight, maxWidth: subtextStyle.maxWidth, textConfig: subtext }, subtextStyle);
|
|
29347
|
-
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
29348
|
-
}
|
|
29349
|
-
else if (textType === 'html') {
|
|
29350
|
-
const attr = Object.assign({ html: Object.assign({ dom: subtext, container: '', width: 30, height: 30, style: {} }, subtextStyle), x: (_14 = subtextStyle.x) !== null && _14 !== void 0 ? _14 : 0, y: (_15 = subtextStyle.y) !== null && _15 !== void 0 ? _15 : 0, width: (_17 = (_16 = subtextStyle.width) !== null && _16 !== void 0 ? _16 : width) !== null && _17 !== void 0 ? _17 : 0, height: (_19 = (_18 = subtextStyle.height) !== null && _18 !== void 0 ? _18 : height) !== null && _19 !== void 0 ? _19 : 0, ellipsis: (_20 = subtextStyle.ellipsis) !== null && _20 !== void 0 ? _20 : true, wordBreak: (_21 = subtextStyle.wordBreak) !== null && _21 !== void 0 ? _21 : 'break-word', maxHeight: subtextStyle.maxHeight, maxWidth: subtextStyle.maxWidth, textConfig: [] }, subtextStyle);
|
|
29351
|
-
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
29352
|
-
}
|
|
29353
|
-
else if (subtextStyle && vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.character)) {
|
|
29483
|
+
const maintextHeight = this._mainTitle ? (_m = this._mainTitle) === null || _m === void 0 ? void 0 : _m.AABBBounds.height() : 0;
|
|
29484
|
+
const maintextWidth = this._mainTitle ? (_o = this._mainTitle) === null || _o === void 0 ? void 0 : _o.AABBBounds.width() : 0;
|
|
29485
|
+
if (((_p = this.attribute) === null || _p === void 0 ? void 0 : _p.visible) !== false && (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.visible) !== false) {
|
|
29486
|
+
if (subtextStyle && vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.character)) {
|
|
29354
29487
|
const attr = {
|
|
29355
|
-
x: (
|
|
29356
|
-
y: (
|
|
29357
|
-
width: (
|
|
29358
|
-
height: (
|
|
29359
|
-
ellipsis: (
|
|
29360
|
-
wordBreak: (
|
|
29488
|
+
x: (_q = subtextStyle.x) !== null && _q !== void 0 ? _q : 0,
|
|
29489
|
+
y: (_r = subtextStyle.y) !== null && _r !== void 0 ? _r : maintextHeight,
|
|
29490
|
+
width: (_t = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : width) !== null && _t !== void 0 ? _t : 0,
|
|
29491
|
+
height: (_v = (_u = subtextStyle.height) !== null && _u !== void 0 ? _u : height) !== null && _v !== void 0 ? _v : 0,
|
|
29492
|
+
ellipsis: (_w = subtextStyle.ellipsis) !== null && _w !== void 0 ? _w : true,
|
|
29493
|
+
wordBreak: (_x = subtextStyle.wordBreak) !== null && _x !== void 0 ? _x : 'break-word',
|
|
29361
29494
|
maxHeight: subtextStyle.maxHeight,
|
|
29362
29495
|
maxWidth: subtextStyle.maxWidth,
|
|
29363
29496
|
textConfig: subtextStyle.character
|
|
@@ -29365,17 +29498,17 @@
|
|
|
29365
29498
|
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
29366
29499
|
}
|
|
29367
29500
|
else if (vutils.isValid(subtext)) {
|
|
29368
|
-
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: [subtext] }, subtextStyle), { maxLineWidth: (
|
|
29501
|
+
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: [subtext] }, subtextStyle), { maxLineWidth: (_y = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.maxLineWidth) !== null && _y !== void 0 ? _y : width, heightLimit: subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.heightLimit, lineClamp: subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.lineClamp, ellipsis: (_z = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.ellipsis) !== null && _z !== void 0 ? _z : true, x: 0, y: maintextHeight }), 'wrapText');
|
|
29369
29502
|
}
|
|
29370
29503
|
}
|
|
29371
|
-
const subtextHeight = this._subTitle ? (
|
|
29372
|
-
const subtextWidth = this._subTitle ? (
|
|
29504
|
+
const subtextHeight = this._subTitle ? (_0 = this._subTitle) === null || _0 === void 0 ? void 0 : _0.AABBBounds.height() : 0;
|
|
29505
|
+
const subtextWidth = this._subTitle ? (_1 = this._subTitle) === null || _1 === void 0 ? void 0 : _1.AABBBounds.width() : 0;
|
|
29373
29506
|
let titleWidth = Math.max(maintextWidth, subtextWidth);
|
|
29374
|
-
let titleHeight = maintextHeight + ((
|
|
29507
|
+
let titleHeight = maintextHeight + ((_2 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _2 !== void 0 ? _2 : subtextHeight);
|
|
29375
29508
|
if (vutils.isValid(width)) {
|
|
29376
29509
|
titleWidth = width;
|
|
29377
|
-
(
|
|
29378
|
-
(
|
|
29510
|
+
(_3 = this._mainTitle) === null || _3 === void 0 ? void 0 : _3.setAttribute('maxLineWidth', width);
|
|
29511
|
+
(_4 = this._subTitle) === null || _4 === void 0 ? void 0 : _4.setAttribute('maxLineWidth', width);
|
|
29379
29512
|
}
|
|
29380
29513
|
if (vutils.isValid(height)) {
|
|
29381
29514
|
titleHeight = height;
|
|
@@ -29384,10 +29517,10 @@
|
|
|
29384
29517
|
titleWidth = minWidth;
|
|
29385
29518
|
}
|
|
29386
29519
|
if (vutils.isValid(maxWidth)) {
|
|
29387
|
-
(
|
|
29388
|
-
(
|
|
29389
|
-
(
|
|
29390
|
-
(
|
|
29520
|
+
(_5 = this._mainTitle) === null || _5 === void 0 ? void 0 : _5.setAttribute('maxLineWidth', maxWidth);
|
|
29521
|
+
(_6 = this._subTitle) === null || _6 === void 0 ? void 0 : _6.setAttribute('maxLineWidth', maxWidth);
|
|
29522
|
+
(_7 = this._mainTitle) === null || _7 === void 0 ? void 0 : _7.setAttribute('maxWidth', maxWidth);
|
|
29523
|
+
(_8 = this._subTitle) === null || _8 === void 0 ? void 0 : _8.setAttribute('maxWidth', maxWidth);
|
|
29391
29524
|
if (titleWidth > maxWidth) {
|
|
29392
29525
|
titleWidth = maxWidth;
|
|
29393
29526
|
}
|
|
@@ -29396,8 +29529,8 @@
|
|
|
29396
29529
|
titleHeight = minHeight;
|
|
29397
29530
|
}
|
|
29398
29531
|
if (vutils.isValid(maxHeight)) {
|
|
29399
|
-
(
|
|
29400
|
-
(
|
|
29532
|
+
(_9 = this._mainTitle) === null || _9 === void 0 ? void 0 : _9.setAttribute('maxHeight', maxHeight);
|
|
29533
|
+
(_10 = this._subTitle) === null || _10 === void 0 ? void 0 : _10.setAttribute('maxHeight', maxHeight - maintextHeight);
|
|
29401
29534
|
if (titleHeight > maxHeight) {
|
|
29402
29535
|
titleHeight = maxHeight;
|
|
29403
29536
|
}
|
|
@@ -29407,67 +29540,67 @@
|
|
|
29407
29540
|
group.attribute.boundsPadding = parsedPadding;
|
|
29408
29541
|
if (vutils.isValid(align) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.align)) {
|
|
29409
29542
|
const mainTitleAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.align) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.align : align;
|
|
29410
|
-
const mainTitleWidth = (
|
|
29543
|
+
const mainTitleWidth = (_11 = textStyle === null || textStyle === void 0 ? void 0 : textStyle.width) !== null && _11 !== void 0 ? _11 : maintextWidth;
|
|
29411
29544
|
if (mainTitleAlign === 'left') {
|
|
29412
|
-
(
|
|
29413
|
-
(
|
|
29545
|
+
(_12 = this._mainTitle) === null || _12 === void 0 ? void 0 : _12.setAttribute('x', 0);
|
|
29546
|
+
(_13 = this._mainTitle) === null || _13 === void 0 ? void 0 : _13.setAttribute('textAlign', 'left');
|
|
29414
29547
|
}
|
|
29415
29548
|
else if (mainTitleAlign === 'center') {
|
|
29416
|
-
(
|
|
29417
|
-
(
|
|
29549
|
+
(_14 = this._mainTitle) === null || _14 === void 0 ? void 0 : _14.setAttribute('x', mainTitleWidth / 2);
|
|
29550
|
+
(_15 = this._mainTitle) === null || _15 === void 0 ? void 0 : _15.setAttribute('textAlign', 'center');
|
|
29418
29551
|
}
|
|
29419
29552
|
else if (mainTitleAlign === 'right') {
|
|
29420
|
-
(
|
|
29421
|
-
(
|
|
29553
|
+
(_16 = this._mainTitle) === null || _16 === void 0 ? void 0 : _16.setAttribute('x', mainTitleWidth);
|
|
29554
|
+
(_17 = this._mainTitle) === null || _17 === void 0 ? void 0 : _17.setAttribute('textAlign', 'right');
|
|
29422
29555
|
}
|
|
29423
29556
|
}
|
|
29424
29557
|
if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
|
|
29425
29558
|
const mainTitleVerticalAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign : verticalAlign;
|
|
29426
29559
|
const mainTitleHeight = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.height) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.height : titleHeight;
|
|
29427
29560
|
if (mainTitleVerticalAlign === 'top') {
|
|
29428
|
-
(
|
|
29429
|
-
(
|
|
29561
|
+
(_18 = this._mainTitle) === null || _18 === void 0 ? void 0 : _18.setAttribute('y', 0);
|
|
29562
|
+
(_19 = this._mainTitle) === null || _19 === void 0 ? void 0 : _19.setAttribute('textBaseline', 'top');
|
|
29430
29563
|
}
|
|
29431
29564
|
else if (mainTitleVerticalAlign === 'middle') {
|
|
29432
|
-
(
|
|
29433
|
-
(
|
|
29565
|
+
(_20 = this._mainTitle) === null || _20 === void 0 ? void 0 : _20.setAttribute('y', mainTitleHeight / 2);
|
|
29566
|
+
(_21 = this._mainTitle) === null || _21 === void 0 ? void 0 : _21.setAttribute('textBaseline', 'middle');
|
|
29434
29567
|
}
|
|
29435
29568
|
else if (mainTitleVerticalAlign === 'bottom') {
|
|
29436
|
-
(
|
|
29437
|
-
(
|
|
29569
|
+
(_22 = this._mainTitle) === null || _22 === void 0 ? void 0 : _22.setAttribute('y', mainTitleHeight);
|
|
29570
|
+
(_23 = this._mainTitle) === null || _23 === void 0 ? void 0 : _23.setAttribute('textBaseline', 'bottom');
|
|
29438
29571
|
}
|
|
29439
29572
|
}
|
|
29440
29573
|
if (vutils.isValid(align) || vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align)) {
|
|
29441
29574
|
const subTitleAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align : align;
|
|
29442
|
-
const subTitleWidth = (
|
|
29575
|
+
const subTitleWidth = (_24 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.width) !== null && _24 !== void 0 ? _24 : subtextWidth;
|
|
29443
29576
|
if (subTitleAlign === 'left') {
|
|
29444
|
-
(
|
|
29445
|
-
(
|
|
29577
|
+
(_25 = this._subTitle) === null || _25 === void 0 ? void 0 : _25.setAttribute('x', 0);
|
|
29578
|
+
(_26 = this._subTitle) === null || _26 === void 0 ? void 0 : _26.setAttribute('textAlign', 'left');
|
|
29446
29579
|
}
|
|
29447
29580
|
else if (subTitleAlign === 'center') {
|
|
29448
|
-
(
|
|
29449
|
-
(
|
|
29581
|
+
(_27 = this._subTitle) === null || _27 === void 0 ? void 0 : _27.setAttribute('x', subTitleWidth / 2);
|
|
29582
|
+
(_28 = this._subTitle) === null || _28 === void 0 ? void 0 : _28.setAttribute('textAlign', 'center');
|
|
29450
29583
|
}
|
|
29451
29584
|
else if (subTitleAlign === 'right') {
|
|
29452
|
-
(
|
|
29453
|
-
(
|
|
29585
|
+
(_29 = this._subTitle) === null || _29 === void 0 ? void 0 : _29.setAttribute('x', subTitleWidth);
|
|
29586
|
+
(_30 = this._subTitle) === null || _30 === void 0 ? void 0 : _30.setAttribute('textAlign', 'right');
|
|
29454
29587
|
}
|
|
29455
29588
|
}
|
|
29456
29589
|
if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
|
|
29457
29590
|
const subTitleVerticalAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign : verticalAlign;
|
|
29458
29591
|
const subTitleYStart = maintextHeight;
|
|
29459
|
-
const subTitleHeight = (
|
|
29592
|
+
const subTitleHeight = (_31 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _31 !== void 0 ? _31 : 0;
|
|
29460
29593
|
if (subTitleVerticalAlign === 'top') {
|
|
29461
|
-
(
|
|
29462
|
-
(
|
|
29594
|
+
(_32 = this._subTitle) === null || _32 === void 0 ? void 0 : _32.setAttribute('y', subTitleYStart);
|
|
29595
|
+
(_33 = this._subTitle) === null || _33 === void 0 ? void 0 : _33.setAttribute('textBaseline', 'top');
|
|
29463
29596
|
}
|
|
29464
29597
|
else if (subTitleVerticalAlign === 'middle') {
|
|
29465
|
-
(
|
|
29466
|
-
(
|
|
29598
|
+
(_34 = this._subTitle) === null || _34 === void 0 ? void 0 : _34.setAttribute('y', subTitleYStart + subTitleHeight / 2);
|
|
29599
|
+
(_35 = this._subTitle) === null || _35 === void 0 ? void 0 : _35.setAttribute('textBaseline', 'middle');
|
|
29467
29600
|
}
|
|
29468
29601
|
else if (subTitleVerticalAlign === 'bottom') {
|
|
29469
|
-
(
|
|
29470
|
-
(
|
|
29602
|
+
(_36 = this._subTitle) === null || _36 === void 0 ? void 0 : _36.setAttribute('y', subTitleYStart + subTitleHeight);
|
|
29603
|
+
(_37 = this._subTitle) === null || _37 === void 0 ? void 0 : _37.setAttribute('textBaseline', 'bottom');
|
|
29471
29604
|
}
|
|
29472
29605
|
}
|
|
29473
29606
|
}
|
|
@@ -29522,7 +29655,7 @@
|
|
|
29522
29655
|
this.name = 'indicator';
|
|
29523
29656
|
}
|
|
29524
29657
|
render() {
|
|
29525
|
-
var _a
|
|
29658
|
+
var _a;
|
|
29526
29659
|
const { visible, title, content, size, limitRatio = Infinity } = this.attribute;
|
|
29527
29660
|
const limit = Math.min(size.width, size.height) * limitRatio;
|
|
29528
29661
|
const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group');
|
|
@@ -29533,15 +29666,7 @@
|
|
|
29533
29666
|
if (vutils.isValid(title)) {
|
|
29534
29667
|
if (title.visible !== false) {
|
|
29535
29668
|
const titleStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);
|
|
29536
|
-
|
|
29537
|
-
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');
|
|
29538
|
-
}
|
|
29539
|
-
else if (titleStyle.type === 'html') {
|
|
29540
|
-
this._title = group.createOrUpdateChild('indicator-title', Object.assign(Object.assign({ textConfig: [], html: Object.assign({ dom: titleStyle.text, container: '', width: 30, height: 30, style: {} }, titleStyle) }, titleStyle), { visible: title.visible, x: 0, y: 0 }), 'richtext');
|
|
29541
|
-
}
|
|
29542
|
-
else {
|
|
29543
|
-
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');
|
|
29544
|
-
}
|
|
29669
|
+
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');
|
|
29545
29670
|
if (title.autoFit && vutils.isValidNumber(limit)) {
|
|
29546
29671
|
this._setAutoFit(limit, this._title, title);
|
|
29547
29672
|
}
|
|
@@ -29562,19 +29687,9 @@
|
|
|
29562
29687
|
const contentComponents = [];
|
|
29563
29688
|
let lastContentHeight = 0;
|
|
29564
29689
|
contents.forEach((contentItem, i) => {
|
|
29565
|
-
var _a, _b;
|
|
29566
29690
|
if (contentItem.visible !== false) {
|
|
29567
29691
|
const contentStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);
|
|
29568
|
-
|
|
29569
|
-
if (contentStyle.type === 'rich') {
|
|
29570
|
-
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');
|
|
29571
|
-
}
|
|
29572
|
-
else if (contentStyle.type === 'html') {
|
|
29573
|
-
contentComponent = group.createOrUpdateChild('indicator-content-' + i, Object.assign(Object.assign({ textConfig: [], html: Object.assign({ dom: contentStyle.text, container: '', width: 30, height: 30, style: {} }, contentStyle) }, contentStyle), { visible: title.visible, x: 0, y: titleHeight + titleSpace + lastContentHeight }), 'richtext');
|
|
29574
|
-
}
|
|
29575
|
-
else {
|
|
29576
|
-
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');
|
|
29577
|
-
}
|
|
29692
|
+
const 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');
|
|
29578
29693
|
if (contentItem.autoFit && vutils.isValidNumber(limit)) {
|
|
29579
29694
|
this._setAutoFit(limit, contentComponent, contentItem);
|
|
29580
29695
|
}
|
|
@@ -29592,7 +29707,7 @@
|
|
|
29592
29707
|
});
|
|
29593
29708
|
this._content = contentComponents;
|
|
29594
29709
|
}
|
|
29595
|
-
const totalHeight = (
|
|
29710
|
+
const totalHeight = (_a = group === null || group === void 0 ? void 0 : group.AABBBounds.height()) !== null && _a !== void 0 ? _a : 0;
|
|
29596
29711
|
group.setAttribute('y', size.height / 2 - totalHeight / 2);
|
|
29597
29712
|
group.setAttribute('x', size.width / 2);
|
|
29598
29713
|
}
|
|
@@ -30951,13 +31066,7 @@
|
|
|
30951
31066
|
this._tooltipTitleSymbol = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, vutils.merge({ symbolType: 'circle' }, titleAttr.shape, {
|
|
30952
31067
|
visible: isVisible(titleAttr) && isVisible(titleAttr.shape)
|
|
30953
31068
|
}), 'symbol');
|
|
30954
|
-
if (titleAttr.value.
|
|
30955
|
-
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ 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.text }, titleAttr.value), 'richtext');
|
|
30956
|
-
}
|
|
30957
|
-
else if (titleAttr.value.type === 'html') {
|
|
30958
|
-
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ html: Object.assign({ dom: titleAttr.value.text, container: '', width: 30, height: 30, style: {} }, 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');
|
|
30959
|
-
}
|
|
30960
|
-
else if (titleAttr.value.multiLine) {
|
|
31069
|
+
if (titleAttr.value.multiLine) {
|
|
30961
31070
|
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, getRichTextAttribute(titleAttr.value)), 'richtext');
|
|
30962
31071
|
}
|
|
30963
31072
|
else {
|
|
@@ -31002,7 +31111,9 @@
|
|
|
31002
31111
|
let x = 0;
|
|
31003
31112
|
if (isVisible(itemAttr.shape)) {
|
|
31004
31113
|
itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, Object.assign({ visible: true, x: itemAttr.shape.size / 2, y: itemAttr.shape.size / 2 +
|
|
31005
|
-
(((_a = itemAttr.key.lineHeight) !== null && _a !== void 0 ? _a : itemAttr.key.fontSize) -
|
|
31114
|
+
(((_a = calculateLineHeight(itemAttr.key.lineHeight, itemAttr.key.fontSize)) !== null && _a !== void 0 ? _a : itemAttr.key.fontSize) -
|
|
31115
|
+
itemAttr.shape.size) /
|
|
31116
|
+
2 }, itemAttr.shape), 'symbol');
|
|
31006
31117
|
}
|
|
31007
31118
|
if (hasContentShape) {
|
|
31008
31119
|
x += itemAttr.shape.size + itemAttr.shape.spacing;
|
|
@@ -31383,7 +31494,7 @@
|
|
|
31383
31494
|
}
|
|
31384
31495
|
};
|
|
31385
31496
|
|
|
31386
|
-
const version = "0.16.14
|
|
31497
|
+
const version = "0.16.14";
|
|
31387
31498
|
|
|
31388
31499
|
exports.AbstractComponent = AbstractComponent;
|
|
31389
31500
|
exports.ArcInfo = ArcInfo;
|