@visactor/vrender-components 0.16.17-alpha.3 → 0.16.17-alpha.4
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/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/arc.d.ts +3 -4
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/area.d.ts +1 -1
- package/cjs/label/area.js +2 -2
- package/cjs/label/area.js.map +1 -1
- package/cjs/label/base.d.ts +12 -12
- package/cjs/label/base.js +12 -24
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/index.d.ts +1 -0
- package/cjs/label/index.js +2 -1
- package/cjs/label/index.js.map +1 -1
- package/cjs/label/line.d.ts +1 -1
- package/cjs/label/line.js +3 -3
- package/cjs/label/line.js.map +1 -1
- package/cjs/label/type.d.ts +5 -8
- package/cjs/label/type.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +2 -2
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/marker/point.d.ts +1 -1
- package/cjs/marker/type.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 +11 -56
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/cjs/tooltip/type.d.ts +2 -7
- package/cjs/tooltip/type.js.map +1 -1
- package/cjs/tooltip/util.js +1 -9
- package/cjs/tooltip/util.js.map +1 -1
- package/cjs/util/label-smartInvert.d.ts +2 -2
- package/cjs/util/label-smartInvert.js +9 -5
- package/cjs/util/label-smartInvert.js.map +1 -1
- package/dist/index.js +235 -335
- 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/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/arc.d.ts +3 -4
- package/es/label/arc.js.map +1 -1
- package/es/label/area.d.ts +1 -1
- package/es/label/area.js +2 -2
- package/es/label/area.js.map +1 -1
- package/es/label/base.d.ts +12 -12
- package/es/label/base.js +12 -25
- package/es/label/base.js.map +1 -1
- package/es/label/index.d.ts +1 -0
- package/es/label/index.js +2 -0
- package/es/label/index.js.map +1 -1
- package/es/label/line.d.ts +1 -1
- package/es/label/line.js +3 -3
- package/es/label/line.js.map +1 -1
- package/es/label/type.d.ts +5 -8
- package/es/label/type.js.map +1 -1
- package/es/legend/discrete/discrete.js +2 -2
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/marker/point.d.ts +1 -1
- package/es/marker/type.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 +11 -56
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/tooltip/type.d.ts +2 -7
- package/es/tooltip/type.js.map +1 -1
- package/es/tooltip/util.js +1 -9
- package/es/tooltip/util.js.map +1 -1
- package/es/util/label-smartInvert.d.ts +2 -2
- package/es/util/label-smartInvert.js +9 -5
- package/es/util/label-smartInvert.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -7715,7 +7715,7 @@
|
|
|
7715
7715
|
|
|
7716
7716
|
var tempMatrix = new vutils.Matrix(),
|
|
7717
7717
|
tempBounds$1 = new vutils.AABBBounds();
|
|
7718
|
-
var GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "
|
|
7718
|
+
var GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "anchor", "visible"];
|
|
7719
7719
|
var tempConstantXYKey = ["x", "y"],
|
|
7720
7720
|
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
7721
7721
|
tempConstantAngleKey = ["angle"],
|
|
@@ -12483,7 +12483,8 @@
|
|
|
12483
12483
|
var _this2 = this;
|
|
12484
12484
|
var _a;
|
|
12485
12485
|
var _this$attribute = this.attribute,
|
|
12486
|
-
|
|
12486
|
+
_this$attribute$textC = _this$attribute.textConfig,
|
|
12487
|
+
textConfig = _this$attribute$textC === void 0 ? [] : _this$attribute$textC,
|
|
12487
12488
|
maxWidth = _this$attribute.maxWidth,
|
|
12488
12489
|
maxHeight = _this$attribute.maxHeight,
|
|
12489
12490
|
width = _this$attribute.width,
|
|
@@ -13526,6 +13527,7 @@
|
|
|
13526
13527
|
}, {
|
|
13527
13528
|
key: "updateRectAABBBounds",
|
|
13528
13529
|
value: function updateRectAABBBounds(attribute, rectTheme, aabbBounds, graphic) {
|
|
13530
|
+
if (!this._validCheck(attribute, rectTheme, aabbBounds, graphic)) return aabbBounds;
|
|
13529
13531
|
if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
|
|
13530
13532
|
var _attribute$width = attribute.width,
|
|
13531
13533
|
width = _attribute$width === void 0 ? rectTheme.width : _attribute$width,
|
|
@@ -13559,13 +13561,14 @@
|
|
|
13559
13561
|
}, {
|
|
13560
13562
|
key: "updateGlyphAABBBounds",
|
|
13561
13563
|
value: function updateGlyphAABBBounds(attribute, theme, aabbBounds, graphic) {
|
|
13562
|
-
return graphic.getSubGraphic().forEach(function (node) {
|
|
13564
|
+
return this._validCheck(attribute, theme, aabbBounds, graphic) ? (graphic.getSubGraphic().forEach(function (node) {
|
|
13563
13565
|
aabbBounds.union(node.AABBBounds);
|
|
13564
|
-
}), aabbBounds;
|
|
13566
|
+
}), aabbBounds) : aabbBounds;
|
|
13565
13567
|
}
|
|
13566
13568
|
}, {
|
|
13567
13569
|
key: "updateRichTextAABBBounds",
|
|
13568
13570
|
value: function updateRichTextAABBBounds(attribute, richtextTheme, aabbBounds, graphic) {
|
|
13571
|
+
if (!this._validCheck(attribute, richtextTheme, aabbBounds, graphic)) return aabbBounds;
|
|
13569
13572
|
if (!graphic) return aabbBounds;
|
|
13570
13573
|
var _attribute$width2 = attribute.width,
|
|
13571
13574
|
width = _attribute$width2 === void 0 ? richtextTheme.width : _attribute$width2,
|
|
@@ -13618,6 +13621,7 @@
|
|
|
13618
13621
|
}, {
|
|
13619
13622
|
key: "updateTextAABBBounds",
|
|
13620
13623
|
value: function updateTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
|
|
13624
|
+
if (!this._validCheck(attribute, textTheme, aabbBounds, graphic)) return aabbBounds;
|
|
13621
13625
|
if (!graphic) return aabbBounds;
|
|
13622
13626
|
var _graphic$attribute$te = graphic.attribute.text,
|
|
13623
13627
|
text = _graphic$attribute$te === void 0 ? textTheme.text : _graphic$attribute$te;
|
|
@@ -13642,6 +13646,7 @@
|
|
|
13642
13646
|
}, {
|
|
13643
13647
|
key: "updatePathAABBBounds",
|
|
13644
13648
|
value: function updatePathAABBBounds(attribute, pathTheme, aabbBounds, graphic) {
|
|
13649
|
+
if (!this._validCheck(attribute, pathTheme, aabbBounds, graphic)) return aabbBounds;
|
|
13645
13650
|
this.updatePathProxyAABBBounds(aabbBounds, graphic) || this.updatePathAABBBoundsImprecise(attribute, pathTheme, aabbBounds, graphic);
|
|
13646
13651
|
var tb1 = this.tempAABBBounds1,
|
|
13647
13652
|
tb2 = this.tempAABBBounds2;
|
|
@@ -13693,6 +13698,7 @@
|
|
|
13693
13698
|
}, {
|
|
13694
13699
|
key: "updatePolygonAABBBounds",
|
|
13695
13700
|
value: function updatePolygonAABBBounds(attribute, polygonTheme, aabbBounds, graphic) {
|
|
13701
|
+
if (!this._validCheck(attribute, polygonTheme, aabbBounds, graphic)) return aabbBounds;
|
|
13696
13702
|
this.updatePathProxyAABBBounds(aabbBounds, graphic) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds, graphic);
|
|
13697
13703
|
var tb1 = this.tempAABBBounds1,
|
|
13698
13704
|
tb2 = this.tempAABBBounds2;
|
|
@@ -13713,6 +13719,7 @@
|
|
|
13713
13719
|
}, {
|
|
13714
13720
|
key: "updateLineAABBBounds",
|
|
13715
13721
|
value: function updateLineAABBBounds(attribute, lineTheme, aabbBounds, graphic) {
|
|
13722
|
+
if (!this._validCheck(attribute, lineTheme, aabbBounds, graphic)) return aabbBounds;
|
|
13716
13723
|
this.updatePathProxyAABBBounds(aabbBounds, graphic) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds, graphic));
|
|
13717
13724
|
var tb1 = this.tempAABBBounds1,
|
|
13718
13725
|
tb2 = this.tempAABBBounds2;
|
|
@@ -13746,6 +13753,7 @@
|
|
|
13746
13753
|
}, {
|
|
13747
13754
|
key: "updateAreaAABBBounds",
|
|
13748
13755
|
value: function updateAreaAABBBounds(attribute, areaTheme, aabbBounds, graphic) {
|
|
13756
|
+
if (!this._validCheck(attribute, areaTheme, aabbBounds, graphic)) return aabbBounds;
|
|
13749
13757
|
this.updatePathProxyAABBBounds(aabbBounds, graphic) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds, graphic) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds, graphic));
|
|
13750
13758
|
var tb1 = this.tempAABBBounds1,
|
|
13751
13759
|
tb2 = this.tempAABBBounds2;
|
|
@@ -13781,6 +13789,7 @@
|
|
|
13781
13789
|
}, {
|
|
13782
13790
|
key: "updateCircleAABBBounds",
|
|
13783
13791
|
value: function updateCircleAABBBounds(attribute, circleTheme, aabbBounds, full, graphic) {
|
|
13792
|
+
if (!this._validCheck(attribute, circleTheme, aabbBounds, graphic)) return aabbBounds;
|
|
13784
13793
|
this.updatePathProxyAABBBounds(aabbBounds, graphic) || (full ? this.updateCircleAABBBoundsImprecise(attribute, circleTheme, aabbBounds, graphic) : this.updateCircleAABBBoundsAccurate(attribute, circleTheme, aabbBounds, graphic));
|
|
13785
13794
|
var tb1 = this.tempAABBBounds1,
|
|
13786
13795
|
tb2 = this.tempAABBBounds2;
|
|
@@ -13809,6 +13818,7 @@
|
|
|
13809
13818
|
}, {
|
|
13810
13819
|
key: "updateArcAABBBounds",
|
|
13811
13820
|
value: function updateArcAABBBounds(attribute, arcTheme, aabbBounds, full, graphic) {
|
|
13821
|
+
if (!this._validCheck(attribute, arcTheme, aabbBounds, graphic)) return aabbBounds;
|
|
13812
13822
|
this.updatePathProxyAABBBounds(aabbBounds, graphic) || (full ? this.updateArcAABBBoundsImprecise(attribute, arcTheme, aabbBounds, graphic) : this.updateArcAABBBoundsAccurate(attribute, arcTheme, aabbBounds, graphic));
|
|
13813
13823
|
var tb1 = this.tempAABBBounds1,
|
|
13814
13824
|
tb2 = this.tempAABBBounds2;
|
|
@@ -13850,6 +13860,7 @@
|
|
|
13850
13860
|
}, {
|
|
13851
13861
|
key: "updateSymbolAABBBounds",
|
|
13852
13862
|
value: function updateSymbolAABBBounds(attribute, symbolTheme, aabbBounds, full, graphic) {
|
|
13863
|
+
if (!this._validCheck(attribute, symbolTheme, aabbBounds, graphic)) return aabbBounds;
|
|
13853
13864
|
this.updatePathProxyAABBBounds(aabbBounds, graphic) || (full ? this.updateSymbolAABBBoundsImprecise(attribute, symbolTheme, aabbBounds, graphic) : this.updateSymbolAABBBoundsAccurate(attribute, symbolTheme, aabbBounds, graphic));
|
|
13854
13865
|
var tb1 = this.tempAABBBounds1,
|
|
13855
13866
|
tb2 = this.tempAABBBounds2;
|
|
@@ -13882,6 +13893,7 @@
|
|
|
13882
13893
|
}, {
|
|
13883
13894
|
key: "updateImageAABBBounds",
|
|
13884
13895
|
value: function updateImageAABBBounds(attribute, imageTheme, aabbBounds, graphic) {
|
|
13896
|
+
if (!this._validCheck(attribute, imageTheme, aabbBounds, graphic)) return aabbBounds;
|
|
13885
13897
|
if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
|
|
13886
13898
|
var _attribute$width3 = attribute.width,
|
|
13887
13899
|
width = _attribute$width3 === void 0 ? imageTheme.width : _attribute$width3,
|
|
@@ -13928,6 +13940,15 @@
|
|
|
13928
13940
|
}
|
|
13929
13941
|
this.combindShadowAABBBounds(aabbBounds, graphic), vutils.transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix);
|
|
13930
13942
|
}
|
|
13943
|
+
}, {
|
|
13944
|
+
key: "_validCheck",
|
|
13945
|
+
value: function _validCheck(attribute, theme, aabbBounds, graphic) {
|
|
13946
|
+
if (!graphic) return !0;
|
|
13947
|
+
if (!graphic.valid) return aabbBounds.clear(), !1;
|
|
13948
|
+
var _attribute$visible = attribute.visible,
|
|
13949
|
+
visible = _attribute$visible === void 0 ? theme.visible : _attribute$visible;
|
|
13950
|
+
return !!visible || (aabbBounds.clear(), !1);
|
|
13951
|
+
}
|
|
13931
13952
|
}]);
|
|
13932
13953
|
return DefaultGraphicService;
|
|
13933
13954
|
}();
|
|
@@ -20795,18 +20816,18 @@
|
|
|
20795
20816
|
|
|
20796
20817
|
const defaultAlternativeColors = ['#ffffff', '#000000'];
|
|
20797
20818
|
const { Color } = vutils.ColorUtil;
|
|
20798
|
-
function labelSmartInvert(foregroundColorOrigin, backgroundColorOrogin, textType, contrastRatiosThreshold, alternativeColors) {
|
|
20819
|
+
function labelSmartInvert(foregroundColorOrigin, backgroundColorOrogin, textType, contrastRatiosThreshold, alternativeColors, mode) {
|
|
20799
20820
|
if (typeof foregroundColorOrigin !== 'string' || typeof backgroundColorOrogin !== 'string') {
|
|
20800
20821
|
return foregroundColorOrigin;
|
|
20801
20822
|
}
|
|
20802
20823
|
const foregroundColor = new Color(foregroundColorOrigin).toHex();
|
|
20803
20824
|
const backgroundColor = new Color(backgroundColorOrogin).toHex();
|
|
20804
|
-
if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold)) {
|
|
20805
|
-
return improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
|
|
20825
|
+
if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, mode)) {
|
|
20826
|
+
return improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode);
|
|
20806
20827
|
}
|
|
20807
20828
|
return foregroundColor;
|
|
20808
20829
|
}
|
|
20809
|
-
function improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors) {
|
|
20830
|
+
function improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode) {
|
|
20810
20831
|
const alternativeColorPalletes = [];
|
|
20811
20832
|
if (alternativeColors) {
|
|
20812
20833
|
if (alternativeColors instanceof Array) {
|
|
@@ -20821,13 +20842,27 @@
|
|
|
20821
20842
|
if (foregroundColor === alternativeColor) {
|
|
20822
20843
|
continue;
|
|
20823
20844
|
}
|
|
20824
|
-
if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold)) {
|
|
20845
|
+
if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold, mode)) {
|
|
20825
20846
|
return alternativeColor;
|
|
20826
20847
|
}
|
|
20827
20848
|
}
|
|
20828
20849
|
return undefined;
|
|
20829
20850
|
}
|
|
20830
|
-
function contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold) {
|
|
20851
|
+
function contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, mode) {
|
|
20852
|
+
if (mode === 'lightness') {
|
|
20853
|
+
const backgroundColorLightness = Color.getColorBrightness(new Color(backgroundColor));
|
|
20854
|
+
const foregroundColorLightness = Color.getColorBrightness(new Color(foregroundColor));
|
|
20855
|
+
if (foregroundColorLightness < 0.5) {
|
|
20856
|
+
if (backgroundColorLightness >= 0.5) {
|
|
20857
|
+
return true;
|
|
20858
|
+
}
|
|
20859
|
+
return false;
|
|
20860
|
+
}
|
|
20861
|
+
if (backgroundColorLightness < 0.5) {
|
|
20862
|
+
return true;
|
|
20863
|
+
}
|
|
20864
|
+
return false;
|
|
20865
|
+
}
|
|
20831
20866
|
if (contrastRatiosThreshold) {
|
|
20832
20867
|
if (contrastRatios(foregroundColor, backgroundColor) > contrastRatiosThreshold) {
|
|
20833
20868
|
return true;
|
|
@@ -20986,8 +21021,8 @@
|
|
|
20986
21021
|
this.name = 'tag';
|
|
20987
21022
|
}
|
|
20988
21023
|
render() {
|
|
20989
|
-
var _a
|
|
20990
|
-
const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state
|
|
21024
|
+
var _a;
|
|
21025
|
+
const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state } = this.attribute;
|
|
20991
21026
|
const parsedPadding = vutils.normalizePadding(padding);
|
|
20992
21027
|
const group = this.createOrUpdateChild('tag-content', { x: 0, y: 0, zIndex: 1 }, 'group');
|
|
20993
21028
|
let symbol;
|
|
@@ -21009,100 +21044,75 @@
|
|
|
21009
21044
|
}
|
|
21010
21045
|
tagWidth += symbolPlaceWidth;
|
|
21011
21046
|
textX += symbolPlaceWidth;
|
|
21012
|
-
|
|
21013
|
-
if (
|
|
21014
|
-
|
|
21015
|
-
|
|
21016
|
-
|
|
21017
|
-
|
|
21018
|
-
|
|
21019
|
-
|
|
21020
|
-
|
|
21021
|
-
|
|
21047
|
+
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 });
|
|
21048
|
+
if (vutils.isNil(textAttrs.lineHeight)) {
|
|
21049
|
+
textAttrs.lineHeight = textAttrs.fontSize;
|
|
21050
|
+
}
|
|
21051
|
+
const textShape = group.createOrUpdateChild('tag-text', textAttrs, 'text');
|
|
21052
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.text)) {
|
|
21053
|
+
textShape.states = state.text;
|
|
21054
|
+
}
|
|
21055
|
+
const textBounds = measureTextSize(textAttrs.text, textStyle);
|
|
21056
|
+
const textWidth = textBounds.width;
|
|
21057
|
+
const textHeight = textBounds.height;
|
|
21058
|
+
tagWidth += textWidth;
|
|
21059
|
+
const size = (_a = shape.size) !== null && _a !== void 0 ? _a : 10;
|
|
21060
|
+
const maxSize = vutils.isNumber(size) ? size : Math.max(size[0], size[1]);
|
|
21061
|
+
tagHeight += Math.max(textHeight, (shape === null || shape === void 0 ? void 0 : shape.visible) ? maxSize : 0);
|
|
21062
|
+
const { textAlign, textBaseline } = textStyle;
|
|
21063
|
+
if (vutils.isValid(minWidth) || vutils.isValid(maxWidth)) {
|
|
21064
|
+
if (vutils.isValid(minWidth) && tagWidth < minWidth) {
|
|
21065
|
+
tagWidth = minWidth;
|
|
21066
|
+
}
|
|
21067
|
+
if (vutils.isValid(maxWidth) && tagWidth > maxWidth) {
|
|
21068
|
+
tagWidth = maxWidth;
|
|
21069
|
+
textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
|
|
21070
|
+
}
|
|
21071
|
+
}
|
|
21072
|
+
let x = 0;
|
|
21073
|
+
let y = 0;
|
|
21074
|
+
if (textAlign === 'center') {
|
|
21075
|
+
x -= tagWidth / 2;
|
|
21076
|
+
if (symbol) {
|
|
21077
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
|
|
21022
21078
|
}
|
|
21079
|
+
group.setAttribute('x', -symbolPlaceWidth / 2);
|
|
21023
21080
|
}
|
|
21024
|
-
else if (
|
|
21025
|
-
|
|
21026
|
-
|
|
21027
|
-
|
|
21028
|
-
if (visible && vutils.isBoolean(bgVisible)) {
|
|
21029
|
-
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');
|
|
21030
|
-
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
21031
|
-
bgRect.states = state.panel;
|
|
21032
|
-
}
|
|
21081
|
+
else if (textAlign === 'right' || textAlign === 'end') {
|
|
21082
|
+
x -= tagWidth;
|
|
21083
|
+
if (symbol) {
|
|
21084
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
|
|
21033
21085
|
}
|
|
21086
|
+
group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
|
|
21034
21087
|
}
|
|
21035
|
-
else {
|
|
21036
|
-
|
|
21037
|
-
|
|
21038
|
-
|
|
21039
|
-
|
|
21040
|
-
|
|
21041
|
-
|
|
21042
|
-
textShape.states = state.text;
|
|
21043
|
-
}
|
|
21044
|
-
const textBounds = measureTextSize(textAttrs.text, textStyle);
|
|
21045
|
-
const textWidth = textBounds.width;
|
|
21046
|
-
const textHeight = textBounds.height;
|
|
21047
|
-
tagWidth += textWidth;
|
|
21048
|
-
const size = (_c = shape.size) !== null && _c !== void 0 ? _c : 10;
|
|
21049
|
-
const maxSize = vutils.isNumber(size) ? size : Math.max(size[0], size[1]);
|
|
21050
|
-
tagHeight += Math.max(textHeight, (shape === null || shape === void 0 ? void 0 : shape.visible) ? maxSize : 0);
|
|
21051
|
-
const { textAlign, textBaseline } = textStyle;
|
|
21052
|
-
if (vutils.isValid(minWidth) || vutils.isValid(maxWidth)) {
|
|
21053
|
-
if (vutils.isValid(minWidth) && tagWidth < minWidth) {
|
|
21054
|
-
tagWidth = minWidth;
|
|
21055
|
-
}
|
|
21056
|
-
if (vutils.isValid(maxWidth) && tagWidth > maxWidth) {
|
|
21057
|
-
tagWidth = maxWidth;
|
|
21058
|
-
textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
|
|
21059
|
-
}
|
|
21060
|
-
}
|
|
21061
|
-
let x = 0;
|
|
21062
|
-
let y = 0;
|
|
21063
|
-
if (textAlign === 'center') {
|
|
21064
|
-
x -= tagWidth / 2;
|
|
21065
|
-
if (symbol) {
|
|
21066
|
-
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
|
|
21067
|
-
}
|
|
21068
|
-
group.setAttribute('x', -symbolPlaceWidth / 2);
|
|
21069
|
-
}
|
|
21070
|
-
else if (textAlign === 'right' || textAlign === 'end') {
|
|
21071
|
-
x -= tagWidth;
|
|
21072
|
-
if (symbol) {
|
|
21073
|
-
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
|
|
21074
|
-
}
|
|
21075
|
-
group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
|
|
21076
|
-
}
|
|
21077
|
-
else if (textAlign === 'left' || textAlign === 'start') {
|
|
21078
|
-
group.setAttribute('x', parsedPadding[3]);
|
|
21079
|
-
}
|
|
21080
|
-
if (textBaseline === 'middle') {
|
|
21081
|
-
y -= tagHeight / 2;
|
|
21082
|
-
if (symbol) {
|
|
21083
|
-
symbol.setAttribute('y', 0);
|
|
21084
|
-
}
|
|
21088
|
+
else if (textAlign === 'left' || textAlign === 'start') {
|
|
21089
|
+
group.setAttribute('x', parsedPadding[3]);
|
|
21090
|
+
}
|
|
21091
|
+
if (textBaseline === 'middle') {
|
|
21092
|
+
y -= tagHeight / 2;
|
|
21093
|
+
if (symbol) {
|
|
21094
|
+
symbol.setAttribute('y', 0);
|
|
21085
21095
|
}
|
|
21086
|
-
|
|
21087
|
-
|
|
21088
|
-
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
group.setAttribute('y', -parsedPadding[2]);
|
|
21096
|
+
}
|
|
21097
|
+
else if (textBaseline === 'bottom') {
|
|
21098
|
+
y -= tagHeight;
|
|
21099
|
+
if (symbol) {
|
|
21100
|
+
symbol.setAttribute('y', -textHeight / 2);
|
|
21092
21101
|
}
|
|
21093
|
-
|
|
21094
|
-
|
|
21095
|
-
|
|
21096
|
-
|
|
21097
|
-
|
|
21102
|
+
group.setAttribute('y', -parsedPadding[2]);
|
|
21103
|
+
}
|
|
21104
|
+
else if (textBaseline === 'top') {
|
|
21105
|
+
group.setAttribute('y', parsedPadding[0]);
|
|
21106
|
+
if (symbol) {
|
|
21107
|
+
symbol.setAttribute('y', textHeight / 2);
|
|
21098
21108
|
}
|
|
21099
|
-
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
|
|
21104
|
-
|
|
21105
|
-
|
|
21109
|
+
}
|
|
21110
|
+
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
21111
|
+
if (visible && vutils.isBoolean(bgVisible)) {
|
|
21112
|
+
const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x,
|
|
21113
|
+
y, width: tagWidth, height: tagHeight }), 'rect');
|
|
21114
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
21115
|
+
bgRect.states = state.panel;
|
|
21106
21116
|
}
|
|
21107
21117
|
}
|
|
21108
21118
|
}
|
|
@@ -22371,24 +22381,6 @@
|
|
|
22371
22381
|
target.states = state;
|
|
22372
22382
|
}
|
|
22373
22383
|
_createLabelText(attributes) {
|
|
22374
|
-
var _a, _b;
|
|
22375
|
-
if (attributes.textType === 'rich') {
|
|
22376
|
-
attributes.textConfig = attributes.text;
|
|
22377
|
-
attributes.width = (_a = attributes.width) !== null && _a !== void 0 ? _a : 0;
|
|
22378
|
-
attributes.height = (_b = attributes.height) !== null && _b !== void 0 ? _b : 0;
|
|
22379
|
-
const text = createRichText(attributes);
|
|
22380
|
-
this._bindEvent(text);
|
|
22381
|
-
this._setStatesOfText(text);
|
|
22382
|
-
return text;
|
|
22383
|
-
}
|
|
22384
|
-
else if (attributes.textType === 'html') {
|
|
22385
|
-
attributes.textConfig = [];
|
|
22386
|
-
attributes.html = Object.assign({ dom: attributes.text, container: '', width: 30, height: 30, style: {} }, attributes);
|
|
22387
|
-
const text = createRichText(attributes);
|
|
22388
|
-
this._bindEvent(text);
|
|
22389
|
-
this._setStatesOfText(text);
|
|
22390
|
-
return text;
|
|
22391
|
-
}
|
|
22392
22384
|
const text = createText(attributes);
|
|
22393
22385
|
this._bindEvent(text);
|
|
22394
22386
|
this._setStatesOfText(text);
|
|
@@ -22484,10 +22476,11 @@
|
|
|
22484
22476
|
: baseMark.attribute.fill }, textStyle), textData);
|
|
22485
22477
|
const text = this._createLabelText(labelAttribute);
|
|
22486
22478
|
const textBounds = this.getGraphicBounds(text);
|
|
22479
|
+
const actualPosition = vutils.isFunction(position) ? position(textData) : position;
|
|
22487
22480
|
const graphicBounds = this._isCollectionBase
|
|
22488
|
-
? this.getGraphicBounds(null, this._idToPoint.get(textData.id))
|
|
22489
|
-
: this.getGraphicBounds(baseMark, { x: textData.x, y: textData.y });
|
|
22490
|
-
const textLocation = this.labeling(textBounds, graphicBounds,
|
|
22481
|
+
? this.getGraphicBounds(null, this._idToPoint.get(textData.id), actualPosition)
|
|
22482
|
+
: this.getGraphicBounds(baseMark, { x: textData.x, y: textData.y }, actualPosition);
|
|
22483
|
+
const textLocation = this.labeling(textBounds, graphicBounds, actualPosition, offset);
|
|
22491
22484
|
if (textLocation) {
|
|
22492
22485
|
labelAttribute.x = textLocation.x;
|
|
22493
22486
|
labelAttribute.y = textLocation.y;
|
|
@@ -22568,13 +22561,19 @@
|
|
|
22568
22561
|
}
|
|
22569
22562
|
if (!hasPlace && clampForce) {
|
|
22570
22563
|
const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);
|
|
22571
|
-
if (
|
|
22572
|
-
canPlace(bmpTool, bitmap, {
|
|
22573
|
-
|
|
22574
|
-
|
|
22575
|
-
|
|
22576
|
-
|
|
22577
|
-
|
|
22564
|
+
if (dx === 0 && dy === 0) {
|
|
22565
|
+
if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
|
|
22566
|
+
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
22567
|
+
result.push(text);
|
|
22568
|
+
continue;
|
|
22569
|
+
}
|
|
22570
|
+
}
|
|
22571
|
+
else if (canPlace(bmpTool, bitmap, {
|
|
22572
|
+
x1: text.AABBBounds.x1 + dx,
|
|
22573
|
+
x2: text.AABBBounds.x2 + dx,
|
|
22574
|
+
y1: text.AABBBounds.y1 + dy,
|
|
22575
|
+
y2: text.AABBBounds.y2 + dy
|
|
22576
|
+
})) {
|
|
22578
22577
|
text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
|
|
22579
22578
|
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
22580
22579
|
result.push(text);
|
|
@@ -22768,7 +22767,7 @@
|
|
|
22768
22767
|
_smartInvert(labels) {
|
|
22769
22768
|
var _a, _b, _c, _d, _e;
|
|
22770
22769
|
const option = (this.attribute.smartInvert || {});
|
|
22771
|
-
const { textType, contrastRatiosThreshold, alternativeColors } = option;
|
|
22770
|
+
const { textType, contrastRatiosThreshold, alternativeColors, mode } = option;
|
|
22772
22771
|
const fillStrategy = (_a = option.fillStrategy) !== null && _a !== void 0 ? _a : 'invertBase';
|
|
22773
22772
|
const strokeStrategy = (_b = option.strokeStrategy) !== null && _b !== void 0 ? _b : 'base';
|
|
22774
22773
|
const brightColor = (_c = option.brightColor) !== null && _c !== void 0 ? _c : '#ffffff';
|
|
@@ -22786,7 +22785,7 @@
|
|
|
22786
22785
|
const backgroundColor = baseMark.attribute.fill;
|
|
22787
22786
|
const foregroundColor = label.attribute.fill;
|
|
22788
22787
|
const baseColor = backgroundColor;
|
|
22789
|
-
const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
|
|
22788
|
+
const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode);
|
|
22790
22789
|
const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
|
|
22791
22790
|
if (outsideEnable) {
|
|
22792
22791
|
const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
|
|
@@ -22814,7 +22813,7 @@
|
|
|
22814
22813
|
}
|
|
22815
22814
|
if (label.attribute.stroke) {
|
|
22816
22815
|
label.setAttributes({
|
|
22817
|
-
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
|
|
22816
|
+
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors, mode)
|
|
22818
22817
|
});
|
|
22819
22818
|
continue;
|
|
22820
22819
|
}
|
|
@@ -22976,12 +22975,11 @@
|
|
|
22976
22975
|
super(vutils.merge({}, LineLabel.defaultAttributes, attributes));
|
|
22977
22976
|
this.name = 'line-label';
|
|
22978
22977
|
}
|
|
22979
|
-
getGraphicBounds(graphic, point = {}) {
|
|
22978
|
+
getGraphicBounds(graphic, point = {}, position = 'end') {
|
|
22980
22979
|
var _a;
|
|
22981
|
-
if (graphic.type !== 'line') {
|
|
22980
|
+
if (!graphic || graphic.type !== 'line') {
|
|
22982
22981
|
return super.getGraphicBounds(graphic, point);
|
|
22983
22982
|
}
|
|
22984
|
-
const { position = 'end' } = this.attribute;
|
|
22985
22983
|
const points = ((_a = graphic === null || graphic === void 0 ? void 0 : graphic.attribute) === null || _a === void 0 ? void 0 : _a.points) || [point];
|
|
22986
22984
|
const index = position === 'start' ? 0 : points.length - 1;
|
|
22987
22985
|
return {
|
|
@@ -23732,39 +23730,16 @@
|
|
|
23732
23730
|
pickable: false
|
|
23733
23731
|
};
|
|
23734
23732
|
|
|
23735
|
-
class LineDataLabel extends LabelBase {
|
|
23736
|
-
constructor(attributes) {
|
|
23737
|
-
super(vutils.merge({}, LineDataLabel.defaultAttributes, attributes));
|
|
23738
|
-
this.name = 'line-data-label';
|
|
23739
|
-
}
|
|
23740
|
-
labeling(textBounds, graphicBounds, position = 'top', offset = 0) {
|
|
23741
|
-
return labelingPoint(textBounds, graphicBounds, position, offset);
|
|
23742
|
-
}
|
|
23743
|
-
}
|
|
23744
|
-
LineDataLabel.defaultAttributes = {
|
|
23745
|
-
textStyle: {
|
|
23746
|
-
fontSize: 12,
|
|
23747
|
-
fill: '#000',
|
|
23748
|
-
textAlign: 'center',
|
|
23749
|
-
textBaseline: 'middle',
|
|
23750
|
-
boundsPadding: [-1, 0, -1, 0]
|
|
23751
|
-
},
|
|
23752
|
-
position: 'top',
|
|
23753
|
-
offset: 5,
|
|
23754
|
-
pickable: false
|
|
23755
|
-
};
|
|
23756
|
-
|
|
23757
23733
|
class AreaLabel extends LabelBase {
|
|
23758
23734
|
constructor(attributes) {
|
|
23759
23735
|
super(vutils.merge({}, AreaLabel.defaultAttributes, attributes));
|
|
23760
23736
|
this.name = 'line-label';
|
|
23761
23737
|
}
|
|
23762
|
-
getGraphicBounds(graphic, point = {}) {
|
|
23738
|
+
getGraphicBounds(graphic, point = {}, position = 'end') {
|
|
23763
23739
|
var _a;
|
|
23764
23740
|
if (graphic.type !== 'area') {
|
|
23765
23741
|
return super.getGraphicBounds(graphic, point);
|
|
23766
23742
|
}
|
|
23767
|
-
const { position = 'end' } = this.attribute;
|
|
23768
23743
|
const points = ((_a = graphic === null || graphic === void 0 ? void 0 : graphic.attribute) === null || _a === void 0 ? void 0 : _a.points) || [point];
|
|
23769
23744
|
const index = position === 'start' ? 0 : points.length - 1;
|
|
23770
23745
|
return {
|
|
@@ -23791,6 +23766,28 @@
|
|
|
23791
23766
|
pickable: false
|
|
23792
23767
|
};
|
|
23793
23768
|
|
|
23769
|
+
class LineDataLabel extends LabelBase {
|
|
23770
|
+
constructor(attributes) {
|
|
23771
|
+
super(vutils.merge({}, LineDataLabel.defaultAttributes, attributes));
|
|
23772
|
+
this.name = 'line-data-label';
|
|
23773
|
+
}
|
|
23774
|
+
labeling(textBounds, graphicBounds, position = 'top', offset = 0) {
|
|
23775
|
+
return labelingPoint(textBounds, graphicBounds, position, offset);
|
|
23776
|
+
}
|
|
23777
|
+
}
|
|
23778
|
+
LineDataLabel.defaultAttributes = {
|
|
23779
|
+
textStyle: {
|
|
23780
|
+
fontSize: 12,
|
|
23781
|
+
fill: '#000',
|
|
23782
|
+
textAlign: 'center',
|
|
23783
|
+
textBaseline: 'middle',
|
|
23784
|
+
boundsPadding: [-1, 0, -1, 0]
|
|
23785
|
+
},
|
|
23786
|
+
position: 'top',
|
|
23787
|
+
offset: 5,
|
|
23788
|
+
pickable: false
|
|
23789
|
+
};
|
|
23790
|
+
|
|
23794
23791
|
const labelComponentMap = {
|
|
23795
23792
|
rect: RectLabel,
|
|
23796
23793
|
symbol: SymbolLabel,
|
|
@@ -24351,26 +24348,12 @@
|
|
|
24351
24348
|
let textAlign = 'center';
|
|
24352
24349
|
let textBaseline = 'middle';
|
|
24353
24350
|
data.forEach((item, index) => {
|
|
24354
|
-
var _a, _b
|
|
24351
|
+
var _a, _b;
|
|
24355
24352
|
const labelStyle = this._getLabelAttribute(item, index, data, layer);
|
|
24356
|
-
|
|
24357
|
-
if ((labelStyle === null || labelStyle === void 0 ? void 0 : labelStyle.type) === 'rich') {
|
|
24358
|
-
labelStyle.textConfig = labelStyle.text;
|
|
24359
|
-
labelStyle.width = (_a = labelStyle.width) !== null && _a !== void 0 ? _a : 0;
|
|
24360
|
-
labelStyle.height = (_b = labelStyle.height) !== null && _b !== void 0 ? _b : 0;
|
|
24361
|
-
text = createRichText(labelStyle);
|
|
24362
|
-
}
|
|
24363
|
-
else if ((labelStyle === null || labelStyle === void 0 ? void 0 : labelStyle.type) === 'html') {
|
|
24364
|
-
labelStyle.textConfig = [];
|
|
24365
|
-
labelStyle.html = Object.assign({ dom: labelStyle.text, container: '', width: 30, height: 30, style: {} }, labelStyle);
|
|
24366
|
-
text = createRichText(labelStyle);
|
|
24367
|
-
}
|
|
24368
|
-
else {
|
|
24369
|
-
text = createText(labelStyle);
|
|
24370
|
-
}
|
|
24353
|
+
const text = createText(labelStyle);
|
|
24371
24354
|
text.name = exports.AXIS_ELEMENT_NAME.label;
|
|
24372
24355
|
text.id = this._getNodeId(`layer${layer}-label-${item.id}`);
|
|
24373
|
-
if (vutils.isEmpty((
|
|
24356
|
+
if (vutils.isEmpty((_a = this.attribute.label) === null || _a === void 0 ? void 0 : _a.state)) {
|
|
24374
24357
|
text.states = DEFAULT_STATES$2;
|
|
24375
24358
|
}
|
|
24376
24359
|
else {
|
|
@@ -24383,7 +24366,7 @@
|
|
|
24383
24366
|
text.states = labelState;
|
|
24384
24367
|
}
|
|
24385
24368
|
labelGroup.add(text);
|
|
24386
|
-
const angle = (
|
|
24369
|
+
const angle = (_b = labelStyle.angle) !== null && _b !== void 0 ? _b : 0;
|
|
24387
24370
|
maxTextWidth = Math.max(maxTextWidth, text.AABBBounds.width());
|
|
24388
24371
|
maxTextHeight = Math.max(maxTextHeight, text.AABBBounds.height());
|
|
24389
24372
|
if (angle) {
|
|
@@ -24532,7 +24515,7 @@
|
|
|
24532
24515
|
}
|
|
24533
24516
|
_getLabelAttribute(tickDatum, index, tickData, layer) {
|
|
24534
24517
|
var _a, _b, _c, _d, _e, _f;
|
|
24535
|
-
const _g = this.attribute.label, { space = 4, inside = false, formatMethod
|
|
24518
|
+
const _g = this.attribute.label, { space = 4, inside = false, formatMethod } = _g, tagAttributes = __rest(_g, ["space", "inside", "formatMethod"]);
|
|
24536
24519
|
let offset = space;
|
|
24537
24520
|
let tickLength = 0;
|
|
24538
24521
|
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) {
|
|
@@ -24553,9 +24536,7 @@
|
|
|
24553
24536
|
}
|
|
24554
24537
|
const point = this.getVerticalCoord(tickDatum.point, offset, inside);
|
|
24555
24538
|
const vector = this.getVerticalVector(offset, inside, point);
|
|
24556
|
-
const
|
|
24557
|
-
? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer)
|
|
24558
|
-
: tickDatum.label;
|
|
24539
|
+
const text = formatMethod ? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer) : tickDatum.label;
|
|
24559
24540
|
let { style: textStyle } = tagAttributes;
|
|
24560
24541
|
textStyle = vutils.isFunction(textStyle)
|
|
24561
24542
|
? vutils.merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer))
|
|
@@ -24570,7 +24551,7 @@
|
|
|
24570
24551
|
layer
|
|
24571
24552
|
});
|
|
24572
24553
|
}
|
|
24573
|
-
return Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector,
|
|
24554
|
+
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);
|
|
24574
24555
|
}
|
|
24575
24556
|
getLabelPosition(point, vector, text, style) {
|
|
24576
24557
|
return point;
|
|
@@ -25308,7 +25289,7 @@
|
|
|
25308
25289
|
let titleSpacing = 0;
|
|
25309
25290
|
const axisLineWidth = (line === null || line === void 0 ? void 0 : line.visible) ? (_b = line.style.lineWidth) !== null && _b !== void 0 ? _b : 1 : 0;
|
|
25310
25291
|
const tickLength = (tick === null || tick === void 0 ? void 0 : tick.visible) ? (_c = tick.length) !== null && _c !== void 0 ? _c : 4 : 0;
|
|
25311
|
-
if (
|
|
25292
|
+
if (title === null || title === void 0 ? void 0 : title.visible) {
|
|
25312
25293
|
titleHeight = measureTextSize(title.text, title.textStyle).height;
|
|
25313
25294
|
const padding = vutils.normalizePadding(title.padding);
|
|
25314
25295
|
titleSpacing = title.space + padding[0] + padding[2];
|
|
@@ -28150,7 +28131,7 @@
|
|
|
28150
28131
|
let focusSpace = 0;
|
|
28151
28132
|
if (focus) {
|
|
28152
28133
|
const focusSize = vutils.get(focusIconStyle, 'size', DEFAULT_SHAPE_SIZE);
|
|
28153
|
-
focusShape = createSymbol(Object.assign(Object.assign({ x: 0, y: -focusSize / 2 - 1, strokeBoundsBuffer: 0 }, focusIconStyle), { visible:
|
|
28134
|
+
focusShape = createSymbol(Object.assign(Object.assign({ x: 0, y: -focusSize / 2 - 1, strokeBoundsBuffer: 0 }, focusIconStyle), { visible: true, pickMode: 'imprecise', boundsPadding: parsedPadding }));
|
|
28154
28135
|
this._appendDataToShape(focusShape, exports.LEGEND_ELEMENT_NAME.focus, item, itemGroup);
|
|
28155
28136
|
focusSpace = focusSize;
|
|
28156
28137
|
}
|
|
@@ -28225,6 +28206,7 @@
|
|
|
28225
28206
|
const itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
|
|
28226
28207
|
itemGroup.attribute.width = itemGroupWidth;
|
|
28227
28208
|
itemGroup.attribute.height = itemGroupHeight;
|
|
28209
|
+
focusShape && focusShape.setAttribute('visible', false);
|
|
28228
28210
|
innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]);
|
|
28229
28211
|
return itemGroup;
|
|
28230
28212
|
}
|
|
@@ -29539,27 +29521,19 @@
|
|
|
29539
29521
|
this.name = 'title';
|
|
29540
29522
|
}
|
|
29541
29523
|
render() {
|
|
29542
|
-
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
|
|
29543
|
-
const {
|
|
29524
|
+
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;
|
|
29525
|
+
const { text, textStyle, subtext, subtextStyle, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
|
|
29544
29526
|
const parsedPadding = vutils.normalizePadding(padding);
|
|
29545
29527
|
const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
|
|
29546
29528
|
if (((_a = this.attribute) === null || _a === void 0 ? void 0 : _a.visible) !== false && (textStyle === null || textStyle === void 0 ? void 0 : textStyle.visible) !== false) {
|
|
29547
|
-
if (
|
|
29548
|
-
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);
|
|
29549
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
29550
|
-
}
|
|
29551
|
-
else if (textType === 'html') {
|
|
29552
|
-
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);
|
|
29553
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
29554
|
-
}
|
|
29555
|
-
else if (textStyle && vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.character)) {
|
|
29529
|
+
if (textStyle && vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.character)) {
|
|
29556
29530
|
const attr = {
|
|
29557
|
-
x: (
|
|
29558
|
-
y: (
|
|
29559
|
-
width: (
|
|
29560
|
-
height: (
|
|
29561
|
-
ellipsis: (
|
|
29562
|
-
wordBreak: (
|
|
29531
|
+
x: (_b = textStyle.x) !== null && _b !== void 0 ? _b : 0,
|
|
29532
|
+
y: (_c = textStyle.y) !== null && _c !== void 0 ? _c : 0,
|
|
29533
|
+
width: (_e = (_d = textStyle.width) !== null && _d !== void 0 ? _d : width) !== null && _e !== void 0 ? _e : 0,
|
|
29534
|
+
height: (_g = (_f = textStyle.height) !== null && _f !== void 0 ? _f : height) !== null && _g !== void 0 ? _g : 0,
|
|
29535
|
+
ellipsis: (_h = textStyle.ellipsis) !== null && _h !== void 0 ? _h : true,
|
|
29536
|
+
wordBreak: (_j = textStyle.wordBreak) !== null && _j !== void 0 ? _j : 'break-word',
|
|
29563
29537
|
maxHeight: textStyle.maxHeight,
|
|
29564
29538
|
maxWidth: textStyle.maxWidth,
|
|
29565
29539
|
textConfig: textStyle.character
|
|
@@ -29567,28 +29541,20 @@
|
|
|
29567
29541
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
29568
29542
|
}
|
|
29569
29543
|
else if (vutils.isValid(text)) {
|
|
29570
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: [text] }, textStyle), { maxLineWidth: (
|
|
29544
|
+
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');
|
|
29571
29545
|
}
|
|
29572
29546
|
}
|
|
29573
|
-
const maintextHeight = this._mainTitle ? (
|
|
29574
|
-
const maintextWidth = this._mainTitle ? (
|
|
29575
|
-
if (((
|
|
29576
|
-
if (
|
|
29577
|
-
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);
|
|
29578
|
-
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
29579
|
-
}
|
|
29580
|
-
else if (textType === 'html') {
|
|
29581
|
-
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);
|
|
29582
|
-
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
29583
|
-
}
|
|
29584
|
-
else if (subtextStyle && vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.character)) {
|
|
29547
|
+
const maintextHeight = this._mainTitle ? (_m = this._mainTitle) === null || _m === void 0 ? void 0 : _m.AABBBounds.height() : 0;
|
|
29548
|
+
const maintextWidth = this._mainTitle ? (_o = this._mainTitle) === null || _o === void 0 ? void 0 : _o.AABBBounds.width() : 0;
|
|
29549
|
+
if (((_p = this.attribute) === null || _p === void 0 ? void 0 : _p.visible) !== false && (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.visible) !== false) {
|
|
29550
|
+
if (subtextStyle && vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.character)) {
|
|
29585
29551
|
const attr = {
|
|
29586
|
-
x: (
|
|
29587
|
-
y: (
|
|
29588
|
-
width: (
|
|
29589
|
-
height: (
|
|
29590
|
-
ellipsis: (
|
|
29591
|
-
wordBreak: (
|
|
29552
|
+
x: (_q = subtextStyle.x) !== null && _q !== void 0 ? _q : 0,
|
|
29553
|
+
y: (_r = subtextStyle.y) !== null && _r !== void 0 ? _r : maintextHeight,
|
|
29554
|
+
width: (_t = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : width) !== null && _t !== void 0 ? _t : 0,
|
|
29555
|
+
height: (_v = (_u = subtextStyle.height) !== null && _u !== void 0 ? _u : height) !== null && _v !== void 0 ? _v : 0,
|
|
29556
|
+
ellipsis: (_w = subtextStyle.ellipsis) !== null && _w !== void 0 ? _w : true,
|
|
29557
|
+
wordBreak: (_x = subtextStyle.wordBreak) !== null && _x !== void 0 ? _x : 'break-word',
|
|
29592
29558
|
maxHeight: subtextStyle.maxHeight,
|
|
29593
29559
|
maxWidth: subtextStyle.maxWidth,
|
|
29594
29560
|
textConfig: subtextStyle.character
|
|
@@ -29596,17 +29562,17 @@
|
|
|
29596
29562
|
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
29597
29563
|
}
|
|
29598
29564
|
else if (vutils.isValid(subtext)) {
|
|
29599
|
-
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: [subtext] }, subtextStyle), { maxLineWidth: (
|
|
29565
|
+
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');
|
|
29600
29566
|
}
|
|
29601
29567
|
}
|
|
29602
|
-
const subtextHeight = this._subTitle ? (
|
|
29603
|
-
const subtextWidth = this._subTitle ? (
|
|
29568
|
+
const subtextHeight = this._subTitle ? (_0 = this._subTitle) === null || _0 === void 0 ? void 0 : _0.AABBBounds.height() : 0;
|
|
29569
|
+
const subtextWidth = this._subTitle ? (_1 = this._subTitle) === null || _1 === void 0 ? void 0 : _1.AABBBounds.width() : 0;
|
|
29604
29570
|
let titleWidth = Math.max(maintextWidth, subtextWidth);
|
|
29605
|
-
let titleHeight = maintextHeight + ((
|
|
29571
|
+
let titleHeight = maintextHeight + ((_2 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _2 !== void 0 ? _2 : subtextHeight);
|
|
29606
29572
|
if (vutils.isValid(width)) {
|
|
29607
29573
|
titleWidth = width;
|
|
29608
|
-
(
|
|
29609
|
-
(
|
|
29574
|
+
(_3 = this._mainTitle) === null || _3 === void 0 ? void 0 : _3.setAttribute('maxLineWidth', width);
|
|
29575
|
+
(_4 = this._subTitle) === null || _4 === void 0 ? void 0 : _4.setAttribute('maxLineWidth', width);
|
|
29610
29576
|
}
|
|
29611
29577
|
if (vutils.isValid(height)) {
|
|
29612
29578
|
titleHeight = height;
|
|
@@ -29615,10 +29581,10 @@
|
|
|
29615
29581
|
titleWidth = minWidth;
|
|
29616
29582
|
}
|
|
29617
29583
|
if (vutils.isValid(maxWidth)) {
|
|
29618
|
-
(
|
|
29619
|
-
(
|
|
29620
|
-
(
|
|
29621
|
-
(
|
|
29584
|
+
(_5 = this._mainTitle) === null || _5 === void 0 ? void 0 : _5.setAttribute('maxLineWidth', maxWidth);
|
|
29585
|
+
(_6 = this._subTitle) === null || _6 === void 0 ? void 0 : _6.setAttribute('maxLineWidth', maxWidth);
|
|
29586
|
+
(_7 = this._mainTitle) === null || _7 === void 0 ? void 0 : _7.setAttribute('maxWidth', maxWidth);
|
|
29587
|
+
(_8 = this._subTitle) === null || _8 === void 0 ? void 0 : _8.setAttribute('maxWidth', maxWidth);
|
|
29622
29588
|
if (titleWidth > maxWidth) {
|
|
29623
29589
|
titleWidth = maxWidth;
|
|
29624
29590
|
}
|
|
@@ -29627,8 +29593,8 @@
|
|
|
29627
29593
|
titleHeight = minHeight;
|
|
29628
29594
|
}
|
|
29629
29595
|
if (vutils.isValid(maxHeight)) {
|
|
29630
|
-
(
|
|
29631
|
-
(
|
|
29596
|
+
(_9 = this._mainTitle) === null || _9 === void 0 ? void 0 : _9.setAttribute('maxHeight', maxHeight);
|
|
29597
|
+
(_10 = this._subTitle) === null || _10 === void 0 ? void 0 : _10.setAttribute('maxHeight', maxHeight - maintextHeight);
|
|
29632
29598
|
if (titleHeight > maxHeight) {
|
|
29633
29599
|
titleHeight = maxHeight;
|
|
29634
29600
|
}
|
|
@@ -29638,67 +29604,67 @@
|
|
|
29638
29604
|
group.attribute.boundsPadding = parsedPadding;
|
|
29639
29605
|
if (vutils.isValid(align) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.align)) {
|
|
29640
29606
|
const mainTitleAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.align) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.align : align;
|
|
29641
|
-
const mainTitleWidth = (
|
|
29607
|
+
const mainTitleWidth = (_11 = textStyle === null || textStyle === void 0 ? void 0 : textStyle.width) !== null && _11 !== void 0 ? _11 : maintextWidth;
|
|
29642
29608
|
if (mainTitleAlign === 'left') {
|
|
29643
|
-
(
|
|
29644
|
-
(
|
|
29609
|
+
(_12 = this._mainTitle) === null || _12 === void 0 ? void 0 : _12.setAttribute('x', 0);
|
|
29610
|
+
(_13 = this._mainTitle) === null || _13 === void 0 ? void 0 : _13.setAttribute('textAlign', 'left');
|
|
29645
29611
|
}
|
|
29646
29612
|
else if (mainTitleAlign === 'center') {
|
|
29647
|
-
(
|
|
29648
|
-
(
|
|
29613
|
+
(_14 = this._mainTitle) === null || _14 === void 0 ? void 0 : _14.setAttribute('x', mainTitleWidth / 2);
|
|
29614
|
+
(_15 = this._mainTitle) === null || _15 === void 0 ? void 0 : _15.setAttribute('textAlign', 'center');
|
|
29649
29615
|
}
|
|
29650
29616
|
else if (mainTitleAlign === 'right') {
|
|
29651
|
-
(
|
|
29652
|
-
(
|
|
29617
|
+
(_16 = this._mainTitle) === null || _16 === void 0 ? void 0 : _16.setAttribute('x', mainTitleWidth);
|
|
29618
|
+
(_17 = this._mainTitle) === null || _17 === void 0 ? void 0 : _17.setAttribute('textAlign', 'right');
|
|
29653
29619
|
}
|
|
29654
29620
|
}
|
|
29655
29621
|
if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
|
|
29656
29622
|
const mainTitleVerticalAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign : verticalAlign;
|
|
29657
29623
|
const mainTitleHeight = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.height) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.height : titleHeight;
|
|
29658
29624
|
if (mainTitleVerticalAlign === 'top') {
|
|
29659
|
-
(
|
|
29660
|
-
(
|
|
29625
|
+
(_18 = this._mainTitle) === null || _18 === void 0 ? void 0 : _18.setAttribute('y', 0);
|
|
29626
|
+
(_19 = this._mainTitle) === null || _19 === void 0 ? void 0 : _19.setAttribute('textBaseline', 'top');
|
|
29661
29627
|
}
|
|
29662
29628
|
else if (mainTitleVerticalAlign === 'middle') {
|
|
29663
|
-
(
|
|
29664
|
-
(
|
|
29629
|
+
(_20 = this._mainTitle) === null || _20 === void 0 ? void 0 : _20.setAttribute('y', mainTitleHeight / 2);
|
|
29630
|
+
(_21 = this._mainTitle) === null || _21 === void 0 ? void 0 : _21.setAttribute('textBaseline', 'middle');
|
|
29665
29631
|
}
|
|
29666
29632
|
else if (mainTitleVerticalAlign === 'bottom') {
|
|
29667
|
-
(
|
|
29668
|
-
(
|
|
29633
|
+
(_22 = this._mainTitle) === null || _22 === void 0 ? void 0 : _22.setAttribute('y', mainTitleHeight);
|
|
29634
|
+
(_23 = this._mainTitle) === null || _23 === void 0 ? void 0 : _23.setAttribute('textBaseline', 'bottom');
|
|
29669
29635
|
}
|
|
29670
29636
|
}
|
|
29671
29637
|
if (vutils.isValid(align) || vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align)) {
|
|
29672
29638
|
const subTitleAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align : align;
|
|
29673
|
-
const subTitleWidth = (
|
|
29639
|
+
const subTitleWidth = (_24 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.width) !== null && _24 !== void 0 ? _24 : subtextWidth;
|
|
29674
29640
|
if (subTitleAlign === 'left') {
|
|
29675
|
-
(
|
|
29676
|
-
(
|
|
29641
|
+
(_25 = this._subTitle) === null || _25 === void 0 ? void 0 : _25.setAttribute('x', 0);
|
|
29642
|
+
(_26 = this._subTitle) === null || _26 === void 0 ? void 0 : _26.setAttribute('textAlign', 'left');
|
|
29677
29643
|
}
|
|
29678
29644
|
else if (subTitleAlign === 'center') {
|
|
29679
|
-
(
|
|
29680
|
-
(
|
|
29645
|
+
(_27 = this._subTitle) === null || _27 === void 0 ? void 0 : _27.setAttribute('x', subTitleWidth / 2);
|
|
29646
|
+
(_28 = this._subTitle) === null || _28 === void 0 ? void 0 : _28.setAttribute('textAlign', 'center');
|
|
29681
29647
|
}
|
|
29682
29648
|
else if (subTitleAlign === 'right') {
|
|
29683
|
-
(
|
|
29684
|
-
(
|
|
29649
|
+
(_29 = this._subTitle) === null || _29 === void 0 ? void 0 : _29.setAttribute('x', subTitleWidth);
|
|
29650
|
+
(_30 = this._subTitle) === null || _30 === void 0 ? void 0 : _30.setAttribute('textAlign', 'right');
|
|
29685
29651
|
}
|
|
29686
29652
|
}
|
|
29687
29653
|
if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
|
|
29688
29654
|
const subTitleVerticalAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign : verticalAlign;
|
|
29689
29655
|
const subTitleYStart = maintextHeight;
|
|
29690
|
-
const subTitleHeight = (
|
|
29656
|
+
const subTitleHeight = (_31 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _31 !== void 0 ? _31 : 0;
|
|
29691
29657
|
if (subTitleVerticalAlign === 'top') {
|
|
29692
|
-
(
|
|
29693
|
-
(
|
|
29658
|
+
(_32 = this._subTitle) === null || _32 === void 0 ? void 0 : _32.setAttribute('y', subTitleYStart);
|
|
29659
|
+
(_33 = this._subTitle) === null || _33 === void 0 ? void 0 : _33.setAttribute('textBaseline', 'top');
|
|
29694
29660
|
}
|
|
29695
29661
|
else if (subTitleVerticalAlign === 'middle') {
|
|
29696
|
-
(
|
|
29697
|
-
(
|
|
29662
|
+
(_34 = this._subTitle) === null || _34 === void 0 ? void 0 : _34.setAttribute('y', subTitleYStart + subTitleHeight / 2);
|
|
29663
|
+
(_35 = this._subTitle) === null || _35 === void 0 ? void 0 : _35.setAttribute('textBaseline', 'middle');
|
|
29698
29664
|
}
|
|
29699
29665
|
else if (subTitleVerticalAlign === 'bottom') {
|
|
29700
|
-
(
|
|
29701
|
-
(
|
|
29666
|
+
(_36 = this._subTitle) === null || _36 === void 0 ? void 0 : _36.setAttribute('y', subTitleYStart + subTitleHeight);
|
|
29667
|
+
(_37 = this._subTitle) === null || _37 === void 0 ? void 0 : _37.setAttribute('textBaseline', 'bottom');
|
|
29702
29668
|
}
|
|
29703
29669
|
}
|
|
29704
29670
|
}
|
|
@@ -29753,7 +29719,7 @@
|
|
|
29753
29719
|
this.name = 'indicator';
|
|
29754
29720
|
}
|
|
29755
29721
|
render() {
|
|
29756
|
-
var _a
|
|
29722
|
+
var _a;
|
|
29757
29723
|
const { visible, title, content, size, limitRatio = Infinity } = this.attribute;
|
|
29758
29724
|
const limit = Math.min(size.width, size.height) * limitRatio;
|
|
29759
29725
|
const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group');
|
|
@@ -29764,15 +29730,7 @@
|
|
|
29764
29730
|
if (vutils.isValid(title)) {
|
|
29765
29731
|
if (title.visible !== false) {
|
|
29766
29732
|
const titleStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);
|
|
29767
|
-
|
|
29768
|
-
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');
|
|
29769
|
-
}
|
|
29770
|
-
else if (titleStyle.type === 'html') {
|
|
29771
|
-
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');
|
|
29772
|
-
}
|
|
29773
|
-
else {
|
|
29774
|
-
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');
|
|
29775
|
-
}
|
|
29733
|
+
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');
|
|
29776
29734
|
if (title.autoFit && vutils.isValidNumber(limit)) {
|
|
29777
29735
|
this._setAutoFit(limit, this._title, title);
|
|
29778
29736
|
}
|
|
@@ -29793,19 +29751,9 @@
|
|
|
29793
29751
|
const contentComponents = [];
|
|
29794
29752
|
let lastContentHeight = 0;
|
|
29795
29753
|
contents.forEach((contentItem, i) => {
|
|
29796
|
-
var _a, _b;
|
|
29797
29754
|
if (contentItem.visible !== false) {
|
|
29798
29755
|
const contentStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);
|
|
29799
|
-
|
|
29800
|
-
if (contentStyle.type === 'rich') {
|
|
29801
|
-
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');
|
|
29802
|
-
}
|
|
29803
|
-
else if (contentStyle.type === 'html') {
|
|
29804
|
-
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');
|
|
29805
|
-
}
|
|
29806
|
-
else {
|
|
29807
|
-
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');
|
|
29808
|
-
}
|
|
29756
|
+
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');
|
|
29809
29757
|
if (contentItem.autoFit && vutils.isValidNumber(limit)) {
|
|
29810
29758
|
this._setAutoFit(limit, contentComponent, contentItem);
|
|
29811
29759
|
}
|
|
@@ -29823,7 +29771,7 @@
|
|
|
29823
29771
|
});
|
|
29824
29772
|
this._content = contentComponents;
|
|
29825
29773
|
}
|
|
29826
|
-
const totalHeight = (
|
|
29774
|
+
const totalHeight = (_a = group === null || group === void 0 ? void 0 : group.AABBBounds.height()) !== null && _a !== void 0 ? _a : 0;
|
|
29827
29775
|
group.setAttribute('y', size.height / 2 - totalHeight / 2);
|
|
29828
29776
|
group.setAttribute('x', size.width / 2);
|
|
29829
29777
|
}
|
|
@@ -31068,17 +31016,6 @@
|
|
|
31068
31016
|
};
|
|
31069
31017
|
const getRichTextAttribute = (attr) => {
|
|
31070
31018
|
const { width, height, wordBreak = 'break-word', textAlign, textBaseline, text } = attr;
|
|
31071
|
-
if (typeof text === 'object') {
|
|
31072
|
-
return {
|
|
31073
|
-
width,
|
|
31074
|
-
height,
|
|
31075
|
-
wordBreak: wordBreak,
|
|
31076
|
-
textAlign: textAlign,
|
|
31077
|
-
textBaseline: textBaseline,
|
|
31078
|
-
singleLine: false,
|
|
31079
|
-
textConfig: text.text
|
|
31080
|
-
};
|
|
31081
|
-
}
|
|
31082
31019
|
return {
|
|
31083
31020
|
width,
|
|
31084
31021
|
height,
|
|
@@ -31175,7 +31112,6 @@
|
|
|
31175
31112
|
this.name = 'tooltip';
|
|
31176
31113
|
}
|
|
31177
31114
|
render() {
|
|
31178
|
-
var _a;
|
|
31179
31115
|
const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure } = this.attribute;
|
|
31180
31116
|
if (!visible) {
|
|
31181
31117
|
this.hideAll();
|
|
@@ -31194,22 +31130,11 @@
|
|
|
31194
31130
|
this._tooltipTitleSymbol = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, vutils.merge({ symbolType: 'circle' }, titleAttr.shape, {
|
|
31195
31131
|
visible: isVisible(titleAttr) && isVisible(titleAttr.shape)
|
|
31196
31132
|
}), 'symbol');
|
|
31197
|
-
if (
|
|
31198
|
-
titleAttr.value.text !== null &&
|
|
31199
|
-
(titleAttr.value.text.type === 'rich' ||
|
|
31200
|
-
titleAttr.value.text.type === 'html')) {
|
|
31201
|
-
if (titleAttr.value.text.type === 'rich') {
|
|
31202
|
-
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, getRichTextAttribute(titleAttr.value)), 'richtext');
|
|
31203
|
-
}
|
|
31204
|
-
else if (titleAttr.value.text.type === 'html') {
|
|
31205
|
-
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ html: Object.assign({ dom: titleAttr.value.text.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');
|
|
31206
|
-
}
|
|
31207
|
-
}
|
|
31208
|
-
else if (titleAttr.value.multiLine) {
|
|
31133
|
+
if (titleAttr.value.multiLine) {
|
|
31209
31134
|
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, getRichTextAttribute(titleAttr.value)), 'richtext');
|
|
31210
31135
|
}
|
|
31211
31136
|
else {
|
|
31212
|
-
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ text:
|
|
31137
|
+
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ text: '', visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, titleAttr.value), 'text');
|
|
31213
31138
|
}
|
|
31214
31139
|
const titlePaddingLeft = isVisible(titleAttr.shape) ? titleAttr.shape.size + titleAttr.shape.spacing : 0;
|
|
31215
31140
|
const { textAlign, textBaseline } = titleAttr.value;
|
|
@@ -31240,7 +31165,7 @@
|
|
|
31240
31165
|
this._tooltipContent.setAttribute('y', padding[0] + titleHeight);
|
|
31241
31166
|
let lastYPos = 0;
|
|
31242
31167
|
content.forEach((item, i) => {
|
|
31243
|
-
var _a
|
|
31168
|
+
var _a;
|
|
31244
31169
|
const itemAttr = Tooltip.getContentAttr(this.attribute, i);
|
|
31245
31170
|
if (!isVisible(itemAttr)) {
|
|
31246
31171
|
return;
|
|
@@ -31262,21 +31187,8 @@
|
|
|
31262
31187
|
if (itemAttr.key.multiLine) {
|
|
31263
31188
|
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.key)), { textBaseline: 'top' }), 'richtext');
|
|
31264
31189
|
}
|
|
31265
|
-
else if (typeof itemAttr.key.text === 'object' &&
|
|
31266
|
-
itemAttr.key.text !== null &&
|
|
31267
|
-
(itemAttr.key.text.type === 'rich' ||
|
|
31268
|
-
itemAttr.key.text.type === 'html')) {
|
|
31269
|
-
if (itemAttr.key.text.type === 'rich') {
|
|
31270
|
-
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.key)), { textBaseline: 'top' }), 'richtext');
|
|
31271
|
-
}
|
|
31272
|
-
else {
|
|
31273
|
-
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, {
|
|
31274
|
-
html: Object.assign({ dom: itemAttr.key.text.text, container: '', width: 30, height: 30, style: {} }, itemAttr.key)
|
|
31275
|
-
}, 'richtext');
|
|
31276
|
-
}
|
|
31277
|
-
}
|
|
31278
31190
|
else {
|
|
31279
|
-
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true
|
|
31191
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, itemAttr.key), { textBaseline: 'top' }), 'text');
|
|
31280
31192
|
}
|
|
31281
31193
|
const { textAlign } = itemAttr.key;
|
|
31282
31194
|
if (textAlign === 'center') {
|
|
@@ -31296,21 +31208,8 @@
|
|
|
31296
31208
|
if (itemAttr.value.multiLine) {
|
|
31297
31209
|
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.value)), { textBaseline: 'top' }), 'richtext');
|
|
31298
31210
|
}
|
|
31299
|
-
else if (typeof itemAttr.value.text === 'object' &&
|
|
31300
|
-
itemAttr.value.text !== null &&
|
|
31301
|
-
(itemAttr.value.text.type === 'rich' ||
|
|
31302
|
-
itemAttr.value.text.type === 'html')) {
|
|
31303
|
-
if (itemAttr.value.text.type === 'rich') {
|
|
31304
|
-
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.value)), { textBaseline: 'top' }), 'richtext');
|
|
31305
|
-
}
|
|
31306
|
-
else {
|
|
31307
|
-
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, {
|
|
31308
|
-
html: Object.assign({ dom: itemAttr.value.text.text, container: '', width: 30, height: 30, style: {} }, itemAttr.value)
|
|
31309
|
-
}, 'richtext');
|
|
31310
|
-
}
|
|
31311
|
-
}
|
|
31312
31211
|
else {
|
|
31313
|
-
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true
|
|
31212
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, itemAttr.value), { textBaseline: 'top' }), 'text');
|
|
31314
31213
|
}
|
|
31315
31214
|
let textAlign = 'right';
|
|
31316
31215
|
if (vutils.isValid(itemAttr.value.textAlign)) {
|
|
@@ -31402,7 +31301,7 @@
|
|
|
31402
31301
|
let titleMaxHeight = 0;
|
|
31403
31302
|
const { value: titleValue, shape: titleShape } = titleAttr;
|
|
31404
31303
|
const { visible: titleHasShape = false, symbolType: titleShapeType = '' } = titleShape !== null && titleShape !== void 0 ? titleShape : {};
|
|
31405
|
-
if (vutils.isValid(titleValue)
|
|
31304
|
+
if (vutils.isValid(titleValue)) {
|
|
31406
31305
|
const { width, height } = initTextMeasure(titleValue).quickMeasure(titleValue.text);
|
|
31407
31306
|
maxWidth = width;
|
|
31408
31307
|
titleMaxHeight = height;
|
|
@@ -31659,11 +31558,12 @@
|
|
|
31659
31558
|
}
|
|
31660
31559
|
};
|
|
31661
31560
|
|
|
31662
|
-
const version = "0.16.17-alpha.
|
|
31561
|
+
const version = "0.16.17-alpha.4";
|
|
31663
31562
|
|
|
31664
31563
|
exports.AbstractComponent = AbstractComponent;
|
|
31665
31564
|
exports.ArcInfo = ArcInfo;
|
|
31666
31565
|
exports.ArcLabel = ArcLabel;
|
|
31566
|
+
exports.AreaLabel = AreaLabel;
|
|
31667
31567
|
exports.BasePlayer = BasePlayer;
|
|
31668
31568
|
exports.Brush = Brush;
|
|
31669
31569
|
exports.CheckBox = CheckBox;
|