@visactor/vrender-components 0.16.17-alpha.4 → 0.16.17-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/axis/base.js +19 -12
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/circle.d.ts +1 -2
- package/cjs/axis/circle.js.map +1 -1
- package/cjs/axis/line.js +1 -1
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/type.d.ts +5 -6
- package/cjs/axis/type.js.map +1 -1
- package/cjs/constant.d.ts +6 -0
- package/cjs/constant.js +6 -1
- package/cjs/constant.js.map +1 -1
- package/cjs/core/type.d.ts +15 -0
- package/cjs/core/type.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/indicator.js +43 -7
- package/cjs/indicator/indicator.js.map +1 -1
- package/cjs/indicator/type.d.ts +2 -1
- package/cjs/indicator/type.js.map +1 -1
- package/cjs/label/arc.d.ts +4 -3
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +11 -11
- package/cjs/label/base.js +15 -1
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/type.d.ts +8 -4
- package/cjs/label/type.js.map +1 -1
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +1 -1
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +14 -14
- package/cjs/marker/type.js.map +1 -1
- package/cjs/tag/tag.js +87 -41
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/tag/type.d.ts +4 -5
- package/cjs/tag/type.js.map +1 -1
- package/cjs/title/title.js +85 -53
- package/cjs/title/title.js.map +1 -1
- package/cjs/title/type.d.ts +10 -5
- package/cjs/title/type.js.map +1 -1
- package/cjs/tooltip/tooltip.js +49 -12
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/cjs/tooltip/type.d.ts +7 -2
- package/cjs/tooltip/type.js.map +1 -1
- package/cjs/tooltip/util.js +9 -1
- package/cjs/tooltip/util.js.map +1 -1
- package/dist/index.js +291 -163
- package/dist/index.min.js +1 -1
- package/es/axis/base.js +21 -11
- package/es/axis/base.js.map +1 -1
- package/es/axis/circle.d.ts +1 -2
- package/es/axis/circle.js.map +1 -1
- package/es/axis/line.js +1 -1
- package/es/axis/line.js.map +1 -1
- package/es/axis/type.d.ts +5 -6
- package/es/axis/type.js.map +1 -1
- package/es/constant.d.ts +6 -0
- package/es/constant.js +7 -0
- package/es/constant.js.map +1 -1
- package/es/core/type.d.ts +15 -0
- package/es/core/type.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/indicator/indicator.js +44 -6
- package/es/indicator/indicator.js.map +1 -1
- package/es/indicator/type.d.ts +2 -1
- package/es/indicator/type.js.map +1 -1
- package/es/label/arc.d.ts +4 -3
- package/es/label/arc.js.map +1 -1
- package/es/label/base.d.ts +11 -11
- package/es/label/base.js +17 -1
- package/es/label/base.js.map +1 -1
- package/es/label/type.d.ts +8 -4
- package/es/label/type.js.map +1 -1
- package/es/marker/area.js.map +1 -1
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +1 -1
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +14 -14
- package/es/marker/type.js.map +1 -1
- package/es/tag/tag.js +86 -38
- package/es/tag/tag.js.map +1 -1
- package/es/tag/type.d.ts +4 -5
- package/es/tag/type.js.map +1 -1
- package/es/title/title.js +84 -50
- package/es/title/title.js.map +1 -1
- package/es/title/type.d.ts +10 -5
- package/es/title/type.js.map +1 -1
- package/es/tooltip/tooltip.js +50 -11
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/tooltip/type.d.ts +7 -2
- package/es/tooltip/type.js.map +1 -1
- package/es/tooltip/util.js +9 -1
- package/es/tooltip/util.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -11467,9 +11467,7 @@
|
|
|
11467
11467
|
cacheList = [];
|
|
11468
11468
|
_path.forEach(function (item) {
|
|
11469
11469
|
var cache = new CustomPath2D().fromString(item.d),
|
|
11470
|
-
attribute = {
|
|
11471
|
-
fill: "black"
|
|
11472
|
-
};
|
|
11470
|
+
attribute = {};
|
|
11473
11471
|
SVG_PARSE_ATTRIBUTE_MAP_KEYS.forEach(function (k) {
|
|
11474
11472
|
item[k] && (attribute[SVG_PARSE_ATTRIBUTE_MAP[k]] = item[k]);
|
|
11475
11473
|
}), cacheList.push({
|
|
@@ -15407,10 +15405,20 @@
|
|
|
15407
15405
|
var p = context.project(x, y, z),
|
|
15408
15406
|
camera = context.camera;
|
|
15409
15407
|
context.camera = null, !1 === parsedPath.draw(context, size, p.x, p.y, void 0, function (p, a) {
|
|
15410
|
-
|
|
15408
|
+
var _a, _b, _c;
|
|
15409
|
+
if (symbol._parsedPath.svgCache) {
|
|
15410
|
+
var obj = Object.assign({}, a);
|
|
15411
|
+
obj.fill = null !== (_a = a.fill) && void 0 !== _a ? _a : symbol.attribute.fill, obj.opacity = null !== (_b = a.fill) && void 0 !== _b ? _b : symbol.attribute.opacity, obj.fillOpacity = symbol.attribute.fillOpacity, obj.stroke = null !== (_c = a.stroke) && void 0 !== _c ? _c : symbol.attribute.stroke, a = obj;
|
|
15412
|
+
}
|
|
15413
|
+
a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute), context.fill())), a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
|
|
15411
15414
|
}) && context.closePath(), context.camera = camera;
|
|
15412
15415
|
} else !1 === parsedPath.draw(context, size, x, y, z, function (p, a) {
|
|
15413
|
-
|
|
15416
|
+
var _a, _b, _c;
|
|
15417
|
+
if (symbol._parsedPath.svgCache) {
|
|
15418
|
+
var obj = Object.assign({}, a);
|
|
15419
|
+
obj.fill = null !== (_a = a.fill) && void 0 !== _a ? _a : symbol.attribute.fill, obj.opacity = null !== (_b = a.opacity) && void 0 !== _b ? _b : symbol.attribute.opacity, obj.fillOpacity = symbol.attribute.fillOpacity, obj.stroke = null !== (_c = a.stroke) && void 0 !== _c ? _c : symbol.attribute.stroke, a = obj;
|
|
15420
|
+
}
|
|
15421
|
+
a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute), context.fill())), a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
|
|
15414
15422
|
}) && context.closePath();
|
|
15415
15423
|
context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb), doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill())), doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke())), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
15416
15424
|
}
|
|
@@ -15848,7 +15856,7 @@
|
|
|
15848
15856
|
var repeat = 0;
|
|
15849
15857
|
if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
|
|
15850
15858
|
var pattern = context.createPattern(res.data, repeatStr[repeat]);
|
|
15851
|
-
context.fillStyle = pattern, context.
|
|
15859
|
+
context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
|
|
15852
15860
|
} else context.drawImage(res.data, x, y, width, height);
|
|
15853
15861
|
needRestore && context.restore();
|
|
15854
15862
|
}
|
|
@@ -17076,7 +17084,7 @@
|
|
|
17076
17084
|
graphic.add(g);
|
|
17077
17085
|
});
|
|
17078
17086
|
} else result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams);
|
|
17079
|
-
return context.camera = null, pickParams.in3dInterceptor = !1, result;
|
|
17087
|
+
return context.camera = null, pickParams.in3dInterceptor = !1, context.restore(), result;
|
|
17080
17088
|
}
|
|
17081
17089
|
return context.restore(), null;
|
|
17082
17090
|
}
|
|
@@ -20989,6 +20997,12 @@
|
|
|
20989
20997
|
[StateValue.hover]: {},
|
|
20990
20998
|
[StateValue.hoverReverse]: {}
|
|
20991
20999
|
};
|
|
21000
|
+
const DEFAULT_HTML_TEXT_SPEC = {
|
|
21001
|
+
container: '',
|
|
21002
|
+
width: 30,
|
|
21003
|
+
height: 30,
|
|
21004
|
+
style: {}
|
|
21005
|
+
};
|
|
20992
21006
|
|
|
20993
21007
|
const initTextMeasure = (textSpec, option, useNaiveCanvas) => {
|
|
20994
21008
|
return new vutils.TextMeasure(Object.assign({ defaultFontParams: {
|
|
@@ -21021,8 +21035,8 @@
|
|
|
21021
21035
|
this.name = 'tag';
|
|
21022
21036
|
}
|
|
21023
21037
|
render() {
|
|
21024
|
-
var _a;
|
|
21025
|
-
const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state } = this.attribute;
|
|
21038
|
+
var _a, _b, _c;
|
|
21039
|
+
const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type } = this.attribute;
|
|
21026
21040
|
const parsedPadding = vutils.normalizePadding(padding);
|
|
21027
21041
|
const group = this.createOrUpdateChild('tag-content', { x: 0, y: 0, zIndex: 1 }, 'group');
|
|
21028
21042
|
let symbol;
|
|
@@ -21044,75 +21058,100 @@
|
|
|
21044
21058
|
}
|
|
21045
21059
|
tagWidth += symbolPlaceWidth;
|
|
21046
21060
|
textX += symbolPlaceWidth;
|
|
21047
|
-
|
|
21048
|
-
if (
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
|
|
21052
|
-
|
|
21053
|
-
|
|
21054
|
-
|
|
21055
|
-
|
|
21056
|
-
|
|
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);
|
|
21061
|
+
let textShape;
|
|
21062
|
+
if (type === 'rich') {
|
|
21063
|
+
const richTextAttrs = Object.assign(Object.assign({ textConfig: text, visible: vutils.isValid(text) && visible !== false }, textStyle), { x: textX, y: 0, width: (_a = textStyle.width) !== null && _a !== void 0 ? _a : 0, height: (_b = textStyle.height) !== null && _b !== void 0 ? _b : 0 });
|
|
21064
|
+
textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext');
|
|
21065
|
+
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
21066
|
+
if (visible && vutils.isBoolean(bgVisible)) {
|
|
21067
|
+
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');
|
|
21068
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
21069
|
+
bgRect.states = state.panel;
|
|
21070
|
+
}
|
|
21078
21071
|
}
|
|
21079
|
-
group.setAttribute('x', -symbolPlaceWidth / 2);
|
|
21080
21072
|
}
|
|
21081
|
-
else if (
|
|
21082
|
-
x
|
|
21083
|
-
|
|
21084
|
-
|
|
21073
|
+
else if (type === 'html') {
|
|
21074
|
+
const richTextAttrs = Object.assign(Object.assign({ textConfig: [], visible: vutils.isValid(text) && visible !== false, html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle) }, textStyle), { x: textX, y: 0 });
|
|
21075
|
+
textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext');
|
|
21076
|
+
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
21077
|
+
if (visible && vutils.isBoolean(bgVisible)) {
|
|
21078
|
+
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');
|
|
21079
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
21080
|
+
bgRect.states = state.panel;
|
|
21081
|
+
}
|
|
21085
21082
|
}
|
|
21086
|
-
group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
|
|
21087
21083
|
}
|
|
21088
|
-
else
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
|
|
21092
|
-
|
|
21093
|
-
|
|
21094
|
-
|
|
21084
|
+
else {
|
|
21085
|
+
const textAttrs = Object.assign(Object.assign({ text: text, visible: vutils.isValid(text) && visible !== false, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize }, textStyle), { x: textX, y: 0 });
|
|
21086
|
+
if (vutils.isNil(textAttrs.lineHeight)) {
|
|
21087
|
+
textAttrs.lineHeight = textStyle.fontSize;
|
|
21088
|
+
}
|
|
21089
|
+
textShape = group.createOrUpdateChild('tag-text', textAttrs, 'text');
|
|
21090
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.text)) {
|
|
21091
|
+
textShape.states = state.text;
|
|
21092
|
+
}
|
|
21093
|
+
const textBounds = measureTextSize(textAttrs.text, textStyle);
|
|
21094
|
+
const textWidth = textBounds.width;
|
|
21095
|
+
const textHeight = textBounds.height;
|
|
21096
|
+
tagWidth += textWidth;
|
|
21097
|
+
const size = (_c = shape.size) !== null && _c !== void 0 ? _c : 10;
|
|
21098
|
+
const maxSize = vutils.isNumber(size) ? size : Math.max(size[0], size[1]);
|
|
21099
|
+
tagHeight += Math.max(textHeight, (shape === null || shape === void 0 ? void 0 : shape.visible) ? maxSize : 0);
|
|
21100
|
+
const { textAlign, textBaseline } = textStyle;
|
|
21101
|
+
if (vutils.isValid(minWidth) || vutils.isValid(maxWidth)) {
|
|
21102
|
+
if (vutils.isValid(minWidth) && tagWidth < minWidth) {
|
|
21103
|
+
tagWidth = minWidth;
|
|
21104
|
+
}
|
|
21105
|
+
if (vutils.isValid(maxWidth) && tagWidth > maxWidth) {
|
|
21106
|
+
tagWidth = maxWidth;
|
|
21107
|
+
textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
|
|
21108
|
+
}
|
|
21095
21109
|
}
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
symbol
|
|
21110
|
+
let x = 0;
|
|
21111
|
+
let y = 0;
|
|
21112
|
+
if (textAlign === 'center') {
|
|
21113
|
+
x -= tagWidth / 2;
|
|
21114
|
+
if (symbol) {
|
|
21115
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
|
|
21116
|
+
}
|
|
21117
|
+
group.setAttribute('x', -symbolPlaceWidth / 2);
|
|
21101
21118
|
}
|
|
21102
|
-
|
|
21103
|
-
|
|
21104
|
-
|
|
21105
|
-
|
|
21106
|
-
|
|
21107
|
-
|
|
21119
|
+
else if (textAlign === 'right' || textAlign === 'end') {
|
|
21120
|
+
x -= tagWidth;
|
|
21121
|
+
if (symbol) {
|
|
21122
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
|
|
21123
|
+
}
|
|
21124
|
+
group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
|
|
21108
21125
|
}
|
|
21109
|
-
|
|
21110
|
-
|
|
21111
|
-
|
|
21112
|
-
|
|
21113
|
-
y
|
|
21114
|
-
|
|
21115
|
-
|
|
21126
|
+
else if (textAlign === 'left' || textAlign === 'start') {
|
|
21127
|
+
group.setAttribute('x', parsedPadding[3]);
|
|
21128
|
+
}
|
|
21129
|
+
if (textBaseline === 'middle') {
|
|
21130
|
+
y -= tagHeight / 2;
|
|
21131
|
+
if (symbol) {
|
|
21132
|
+
symbol.setAttribute('y', 0);
|
|
21133
|
+
}
|
|
21134
|
+
}
|
|
21135
|
+
else if (textBaseline === 'bottom') {
|
|
21136
|
+
y -= tagHeight;
|
|
21137
|
+
if (symbol) {
|
|
21138
|
+
symbol.setAttribute('y', -textHeight / 2);
|
|
21139
|
+
}
|
|
21140
|
+
group.setAttribute('y', -parsedPadding[2]);
|
|
21141
|
+
}
|
|
21142
|
+
else if (textBaseline === 'top') {
|
|
21143
|
+
group.setAttribute('y', parsedPadding[0]);
|
|
21144
|
+
if (symbol) {
|
|
21145
|
+
symbol.setAttribute('y', textHeight / 2);
|
|
21146
|
+
}
|
|
21147
|
+
}
|
|
21148
|
+
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
21149
|
+
if (visible && vutils.isBoolean(bgVisible)) {
|
|
21150
|
+
const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x,
|
|
21151
|
+
y, width: tagWidth, height: tagHeight }), 'rect');
|
|
21152
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
21153
|
+
bgRect.states = state.panel;
|
|
21154
|
+
}
|
|
21116
21155
|
}
|
|
21117
21156
|
}
|
|
21118
21157
|
}
|
|
@@ -22381,6 +22420,24 @@
|
|
|
22381
22420
|
target.states = state;
|
|
22382
22421
|
}
|
|
22383
22422
|
_createLabelText(attributes) {
|
|
22423
|
+
var _a, _b;
|
|
22424
|
+
if (attributes.textType === 'rich') {
|
|
22425
|
+
attributes.textConfig = attributes.text;
|
|
22426
|
+
attributes.width = (_a = attributes.width) !== null && _a !== void 0 ? _a : 0;
|
|
22427
|
+
attributes.height = (_b = attributes.height) !== null && _b !== void 0 ? _b : 0;
|
|
22428
|
+
const text = createRichText(attributes);
|
|
22429
|
+
this._bindEvent(text);
|
|
22430
|
+
this._setStatesOfText(text);
|
|
22431
|
+
return text;
|
|
22432
|
+
}
|
|
22433
|
+
else if (attributes.textType === 'html') {
|
|
22434
|
+
attributes.textConfig = [];
|
|
22435
|
+
attributes.html = Object.assign(Object.assign({ dom: attributes.text }, DEFAULT_HTML_TEXT_SPEC), attributes);
|
|
22436
|
+
const text = createRichText(attributes);
|
|
22437
|
+
this._bindEvent(text);
|
|
22438
|
+
this._setStatesOfText(text);
|
|
22439
|
+
return text;
|
|
22440
|
+
}
|
|
22384
22441
|
const text = createText(attributes);
|
|
22385
22442
|
this._bindEvent(text);
|
|
22386
22443
|
this._setStatesOfText(text);
|
|
@@ -24348,12 +24405,26 @@
|
|
|
24348
24405
|
let textAlign = 'center';
|
|
24349
24406
|
let textBaseline = 'middle';
|
|
24350
24407
|
data.forEach((item, index) => {
|
|
24351
|
-
var _a, _b;
|
|
24408
|
+
var _a, _b, _c, _d;
|
|
24352
24409
|
const labelStyle = this._getLabelAttribute(item, index, data, layer);
|
|
24353
|
-
|
|
24410
|
+
let text;
|
|
24411
|
+
if (labelStyle.type === 'rich') {
|
|
24412
|
+
labelStyle.textConfig = labelStyle.text;
|
|
24413
|
+
labelStyle.width = (_a = labelStyle.width) !== null && _a !== void 0 ? _a : 0;
|
|
24414
|
+
labelStyle.height = (_b = labelStyle.height) !== null && _b !== void 0 ? _b : 0;
|
|
24415
|
+
text = createRichText(labelStyle);
|
|
24416
|
+
}
|
|
24417
|
+
else if (labelStyle.type === 'html') {
|
|
24418
|
+
labelStyle.textConfig = [];
|
|
24419
|
+
labelStyle.html = Object.assign(Object.assign({ dom: labelStyle.text }, DEFAULT_HTML_TEXT_SPEC), labelStyle);
|
|
24420
|
+
text = createRichText(labelStyle);
|
|
24421
|
+
}
|
|
24422
|
+
else {
|
|
24423
|
+
text = createText(labelStyle);
|
|
24424
|
+
}
|
|
24354
24425
|
text.name = exports.AXIS_ELEMENT_NAME.label;
|
|
24355
24426
|
text.id = this._getNodeId(`layer${layer}-label-${item.id}`);
|
|
24356
|
-
if (vutils.isEmpty((
|
|
24427
|
+
if (vutils.isEmpty((_c = this.attribute.label) === null || _c === void 0 ? void 0 : _c.state)) {
|
|
24357
24428
|
text.states = DEFAULT_STATES$2;
|
|
24358
24429
|
}
|
|
24359
24430
|
else {
|
|
@@ -24366,7 +24437,7 @@
|
|
|
24366
24437
|
text.states = labelState;
|
|
24367
24438
|
}
|
|
24368
24439
|
labelGroup.add(text);
|
|
24369
|
-
const angle = (
|
|
24440
|
+
const angle = (_d = labelStyle.angle) !== null && _d !== void 0 ? _d : 0;
|
|
24370
24441
|
maxTextWidth = Math.max(maxTextWidth, text.AABBBounds.width());
|
|
24371
24442
|
maxTextHeight = Math.max(maxTextHeight, text.AABBBounds.height());
|
|
24372
24443
|
if (angle) {
|
|
@@ -24515,7 +24586,7 @@
|
|
|
24515
24586
|
}
|
|
24516
24587
|
_getLabelAttribute(tickDatum, index, tickData, layer) {
|
|
24517
24588
|
var _a, _b, _c, _d, _e, _f;
|
|
24518
|
-
const _g = this.attribute.label, { space = 4, inside = false, formatMethod } = _g, tagAttributes = __rest(_g, ["space", "inside", "formatMethod"]);
|
|
24589
|
+
const _g = this.attribute.label, { space = 4, inside = false, formatMethod, type = 'text', text } = _g, tagAttributes = __rest(_g, ["space", "inside", "formatMethod", "type", "text"]);
|
|
24519
24590
|
let offset = space;
|
|
24520
24591
|
let tickLength = 0;
|
|
24521
24592
|
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) {
|
|
@@ -24536,7 +24607,9 @@
|
|
|
24536
24607
|
}
|
|
24537
24608
|
const point = this.getVerticalCoord(tickDatum.point, offset, inside);
|
|
24538
24609
|
const vector = this.getVerticalVector(offset, inside, point);
|
|
24539
|
-
const
|
|
24610
|
+
const textContent = formatMethod
|
|
24611
|
+
? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer)
|
|
24612
|
+
: tickDatum.label;
|
|
24540
24613
|
let { style: textStyle } = tagAttributes;
|
|
24541
24614
|
textStyle = vutils.isFunction(textStyle)
|
|
24542
24615
|
? vutils.merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer))
|
|
@@ -24551,7 +24624,7 @@
|
|
|
24551
24624
|
layer
|
|
24552
24625
|
});
|
|
24553
24626
|
}
|
|
24554
|
-
return Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector,
|
|
24627
|
+
return Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), { text: text !== null && text !== void 0 ? text : textContent, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize, type }), textStyle);
|
|
24555
24628
|
}
|
|
24556
24629
|
getLabelPosition(point, vector, text, style) {
|
|
24557
24630
|
return point;
|
|
@@ -25289,7 +25362,7 @@
|
|
|
25289
25362
|
let titleSpacing = 0;
|
|
25290
25363
|
const axisLineWidth = (line === null || line === void 0 ? void 0 : line.visible) ? (_b = line.style.lineWidth) !== null && _b !== void 0 ? _b : 1 : 0;
|
|
25291
25364
|
const tickLength = (tick === null || tick === void 0 ? void 0 : tick.visible) ? (_c = tick.length) !== null && _c !== void 0 ? _c : 4 : 0;
|
|
25292
|
-
if (title === null || title === void 0 ? void 0 : title.visible) {
|
|
25365
|
+
if ((title === null || title === void 0 ? void 0 : title.visible) && typeof title.text === 'string') {
|
|
25293
25366
|
titleHeight = measureTextSize(title.text, title.textStyle).height;
|
|
25294
25367
|
const padding = vutils.normalizePadding(title.padding);
|
|
25295
25368
|
titleSpacing = title.space + padding[0] + padding[2];
|
|
@@ -29521,58 +29594,46 @@
|
|
|
29521
29594
|
this.name = 'title';
|
|
29522
29595
|
}
|
|
29523
29596
|
render() {
|
|
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;
|
|
29597
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55;
|
|
29598
|
+
const { textType, text, subtextType, textStyle, subtext, subtextStyle, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
|
|
29526
29599
|
const parsedPadding = vutils.normalizePadding(padding);
|
|
29527
29600
|
const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
|
|
29528
29601
|
if (((_a = this.attribute) === null || _a === void 0 ? void 0 : _a.visible) !== false && (textStyle === null || textStyle === void 0 ? void 0 : textStyle.visible) !== false) {
|
|
29529
|
-
if (
|
|
29530
|
-
const attr = {
|
|
29531
|
-
|
|
29532
|
-
|
|
29533
|
-
|
|
29534
|
-
|
|
29535
|
-
ellipsis: (_h = textStyle.ellipsis) !== null && _h !== void 0 ? _h : true,
|
|
29536
|
-
wordBreak: (_j = textStyle.wordBreak) !== null && _j !== void 0 ? _j : 'break-word',
|
|
29537
|
-
maxHeight: textStyle.maxHeight,
|
|
29538
|
-
maxWidth: textStyle.maxWidth,
|
|
29539
|
-
textConfig: textStyle.character
|
|
29540
|
-
};
|
|
29602
|
+
if (textType === 'rich' || vutils.isValid(textStyle.character)) {
|
|
29603
|
+
const attr = Object.assign({ x: (_b = textStyle.x) !== null && _b !== void 0 ? _b : 0, y: (_c = textStyle.y) !== null && _c !== void 0 ? _c : 0, width: (_e = (_d = textStyle.width) !== null && _d !== void 0 ? _d : width) !== null && _e !== void 0 ? _e : 0, height: (_g = (_f = textStyle.height) !== null && _f !== void 0 ? _f : height) !== null && _g !== void 0 ? _g : 0, ellipsis: (_h = textStyle.ellipsis) !== null && _h !== void 0 ? _h : true, wordBreak: (_j = textStyle.wordBreak) !== null && _j !== void 0 ? _j : 'break-word', maxHeight: textStyle.maxHeight, maxWidth: textStyle.maxWidth, textConfig: (_k = textStyle.character) !== null && _k !== void 0 ? _k : text }, textStyle);
|
|
29604
|
+
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
29605
|
+
}
|
|
29606
|
+
else if (textType === 'html') {
|
|
29607
|
+
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle), x: (_l = textStyle.x) !== null && _l !== void 0 ? _l : 0, y: (_m = textStyle.y) !== null && _m !== void 0 ? _m : 0, width: (_p = (_o = textStyle.width) !== null && _o !== void 0 ? _o : width) !== null && _p !== void 0 ? _p : 0, height: (_r = (_q = textStyle.height) !== null && _q !== void 0 ? _q : height) !== null && _r !== void 0 ? _r : 0, ellipsis: (_s = textStyle.ellipsis) !== null && _s !== void 0 ? _s : true, wordBreak: (_t = textStyle.wordBreak) !== null && _t !== void 0 ? _t : 'break-word', maxHeight: textStyle.maxHeight, maxWidth: textStyle.maxWidth, textConfig: [] }, textStyle);
|
|
29541
29608
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
29542
29609
|
}
|
|
29543
29610
|
else if (vutils.isValid(text)) {
|
|
29544
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: [text] }, textStyle), { maxLineWidth: (
|
|
29545
|
-
}
|
|
29546
|
-
}
|
|
29547
|
-
const maintextHeight = this._mainTitle ? (
|
|
29548
|
-
const maintextWidth = this._mainTitle ? (
|
|
29549
|
-
if (((
|
|
29550
|
-
if (
|
|
29551
|
-
const attr = {
|
|
29552
|
-
|
|
29553
|
-
|
|
29554
|
-
|
|
29555
|
-
|
|
29556
|
-
ellipsis: (_w = subtextStyle.ellipsis) !== null && _w !== void 0 ? _w : true,
|
|
29557
|
-
wordBreak: (_x = subtextStyle.wordBreak) !== null && _x !== void 0 ? _x : 'break-word',
|
|
29558
|
-
maxHeight: subtextStyle.maxHeight,
|
|
29559
|
-
maxWidth: subtextStyle.maxWidth,
|
|
29560
|
-
textConfig: subtextStyle.character
|
|
29561
|
-
};
|
|
29611
|
+
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: [text] }, textStyle), { maxLineWidth: (_u = textStyle === null || textStyle === void 0 ? void 0 : textStyle.maxLineWidth) !== null && _u !== void 0 ? _u : width, heightLimit: textStyle === null || textStyle === void 0 ? void 0 : textStyle.heightLimit, lineClamp: textStyle === null || textStyle === void 0 ? void 0 : textStyle.lineClamp, ellipsis: (_v = textStyle === null || textStyle === void 0 ? void 0 : textStyle.ellipsis) !== null && _v !== void 0 ? _v : true, x: 0, y: 0 }), 'wrapText');
|
|
29612
|
+
}
|
|
29613
|
+
}
|
|
29614
|
+
const maintextHeight = this._mainTitle ? (_w = this._mainTitle) === null || _w === void 0 ? void 0 : _w.AABBBounds.height() : 0;
|
|
29615
|
+
const maintextWidth = this._mainTitle ? (_x = this._mainTitle) === null || _x === void 0 ? void 0 : _x.AABBBounds.width() : 0;
|
|
29616
|
+
if (((_y = this.attribute) === null || _y === void 0 ? void 0 : _y.visible) !== false && (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.visible) !== false) {
|
|
29617
|
+
if (subtextType === 'rich' || vutils.isValid(subtextStyle.character)) {
|
|
29618
|
+
const attr = Object.assign({ x: (_z = subtextStyle.x) !== null && _z !== void 0 ? _z : 0, y: (_0 = subtextStyle.y) !== null && _0 !== void 0 ? _0 : 0, width: (_2 = (_1 = subtextStyle.width) !== null && _1 !== void 0 ? _1 : width) !== null && _2 !== void 0 ? _2 : 0, height: (_4 = (_3 = subtextStyle.height) !== null && _3 !== void 0 ? _3 : height) !== null && _4 !== void 0 ? _4 : 0, ellipsis: (_5 = subtextStyle.ellipsis) !== null && _5 !== void 0 ? _5 : true, wordBreak: (_6 = subtextStyle.wordBreak) !== null && _6 !== void 0 ? _6 : 'break-word', maxHeight: subtextStyle.maxHeight, maxWidth: subtextStyle.maxWidth, textConfig: (_7 = subtextStyle.character) !== null && _7 !== void 0 ? _7 : subtext }, subtextStyle);
|
|
29619
|
+
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
29620
|
+
}
|
|
29621
|
+
else if (subtextType === 'html') {
|
|
29622
|
+
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: subtext }, DEFAULT_HTML_TEXT_SPEC), subtextStyle), x: (_8 = subtextStyle.x) !== null && _8 !== void 0 ? _8 : 0, y: (_9 = subtextStyle.y) !== null && _9 !== void 0 ? _9 : 0, width: (_11 = (_10 = subtextStyle.width) !== null && _10 !== void 0 ? _10 : width) !== null && _11 !== void 0 ? _11 : 0, height: (_13 = (_12 = subtextStyle.height) !== null && _12 !== void 0 ? _12 : height) !== null && _13 !== void 0 ? _13 : 0, ellipsis: (_14 = subtextStyle.ellipsis) !== null && _14 !== void 0 ? _14 : true, wordBreak: (_15 = subtextStyle.wordBreak) !== null && _15 !== void 0 ? _15 : 'break-word', maxHeight: subtextStyle.maxHeight, maxWidth: subtextStyle.maxWidth, textConfig: [] }, subtextStyle);
|
|
29562
29623
|
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
29563
29624
|
}
|
|
29564
29625
|
else if (vutils.isValid(subtext)) {
|
|
29565
|
-
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: [subtext] }, subtextStyle), { maxLineWidth: (
|
|
29626
|
+
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: [subtext] }, subtextStyle), { maxLineWidth: (_16 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.maxLineWidth) !== null && _16 !== void 0 ? _16 : width, heightLimit: subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.heightLimit, lineClamp: subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.lineClamp, ellipsis: (_17 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.ellipsis) !== null && _17 !== void 0 ? _17 : true, x: 0, y: maintextHeight }), 'wrapText');
|
|
29566
29627
|
}
|
|
29567
29628
|
}
|
|
29568
|
-
const subtextHeight = this._subTitle ? (
|
|
29569
|
-
const subtextWidth = this._subTitle ? (
|
|
29629
|
+
const subtextHeight = this._subTitle ? (_18 = this._subTitle) === null || _18 === void 0 ? void 0 : _18.AABBBounds.height() : 0;
|
|
29630
|
+
const subtextWidth = this._subTitle ? (_19 = this._subTitle) === null || _19 === void 0 ? void 0 : _19.AABBBounds.width() : 0;
|
|
29570
29631
|
let titleWidth = Math.max(maintextWidth, subtextWidth);
|
|
29571
|
-
let titleHeight = maintextHeight + ((
|
|
29632
|
+
let titleHeight = maintextHeight + ((_20 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _20 !== void 0 ? _20 : subtextHeight);
|
|
29572
29633
|
if (vutils.isValid(width)) {
|
|
29573
29634
|
titleWidth = width;
|
|
29574
|
-
(
|
|
29575
|
-
(
|
|
29635
|
+
(_21 = this._mainTitle) === null || _21 === void 0 ? void 0 : _21.setAttribute('maxLineWidth', width);
|
|
29636
|
+
(_22 = this._subTitle) === null || _22 === void 0 ? void 0 : _22.setAttribute('maxLineWidth', width);
|
|
29576
29637
|
}
|
|
29577
29638
|
if (vutils.isValid(height)) {
|
|
29578
29639
|
titleHeight = height;
|
|
@@ -29581,10 +29642,10 @@
|
|
|
29581
29642
|
titleWidth = minWidth;
|
|
29582
29643
|
}
|
|
29583
29644
|
if (vutils.isValid(maxWidth)) {
|
|
29584
|
-
(
|
|
29585
|
-
(
|
|
29586
|
-
(
|
|
29587
|
-
(
|
|
29645
|
+
(_23 = this._mainTitle) === null || _23 === void 0 ? void 0 : _23.setAttribute('maxLineWidth', maxWidth);
|
|
29646
|
+
(_24 = this._subTitle) === null || _24 === void 0 ? void 0 : _24.setAttribute('maxLineWidth', maxWidth);
|
|
29647
|
+
(_25 = this._mainTitle) === null || _25 === void 0 ? void 0 : _25.setAttribute('maxWidth', maxWidth);
|
|
29648
|
+
(_26 = this._subTitle) === null || _26 === void 0 ? void 0 : _26.setAttribute('maxWidth', maxWidth);
|
|
29588
29649
|
if (titleWidth > maxWidth) {
|
|
29589
29650
|
titleWidth = maxWidth;
|
|
29590
29651
|
}
|
|
@@ -29593,8 +29654,8 @@
|
|
|
29593
29654
|
titleHeight = minHeight;
|
|
29594
29655
|
}
|
|
29595
29656
|
if (vutils.isValid(maxHeight)) {
|
|
29596
|
-
(
|
|
29597
|
-
(
|
|
29657
|
+
(_27 = this._mainTitle) === null || _27 === void 0 ? void 0 : _27.setAttribute('maxHeight', maxHeight);
|
|
29658
|
+
(_28 = this._subTitle) === null || _28 === void 0 ? void 0 : _28.setAttribute('maxHeight', maxHeight - maintextHeight);
|
|
29598
29659
|
if (titleHeight > maxHeight) {
|
|
29599
29660
|
titleHeight = maxHeight;
|
|
29600
29661
|
}
|
|
@@ -29604,67 +29665,67 @@
|
|
|
29604
29665
|
group.attribute.boundsPadding = parsedPadding;
|
|
29605
29666
|
if (vutils.isValid(align) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.align)) {
|
|
29606
29667
|
const mainTitleAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.align) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.align : align;
|
|
29607
|
-
const mainTitleWidth = (
|
|
29668
|
+
const mainTitleWidth = (_29 = textStyle === null || textStyle === void 0 ? void 0 : textStyle.width) !== null && _29 !== void 0 ? _29 : maintextWidth;
|
|
29608
29669
|
if (mainTitleAlign === 'left') {
|
|
29609
|
-
(
|
|
29610
|
-
(
|
|
29670
|
+
(_30 = this._mainTitle) === null || _30 === void 0 ? void 0 : _30.setAttribute('x', 0);
|
|
29671
|
+
(_31 = this._mainTitle) === null || _31 === void 0 ? void 0 : _31.setAttribute('textAlign', 'left');
|
|
29611
29672
|
}
|
|
29612
29673
|
else if (mainTitleAlign === 'center') {
|
|
29613
|
-
(
|
|
29614
|
-
(
|
|
29674
|
+
(_32 = this._mainTitle) === null || _32 === void 0 ? void 0 : _32.setAttribute('x', mainTitleWidth / 2);
|
|
29675
|
+
(_33 = this._mainTitle) === null || _33 === void 0 ? void 0 : _33.setAttribute('textAlign', 'center');
|
|
29615
29676
|
}
|
|
29616
29677
|
else if (mainTitleAlign === 'right') {
|
|
29617
|
-
(
|
|
29618
|
-
(
|
|
29678
|
+
(_34 = this._mainTitle) === null || _34 === void 0 ? void 0 : _34.setAttribute('x', mainTitleWidth);
|
|
29679
|
+
(_35 = this._mainTitle) === null || _35 === void 0 ? void 0 : _35.setAttribute('textAlign', 'right');
|
|
29619
29680
|
}
|
|
29620
29681
|
}
|
|
29621
29682
|
if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
|
|
29622
29683
|
const mainTitleVerticalAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign : verticalAlign;
|
|
29623
29684
|
const mainTitleHeight = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.height) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.height : titleHeight;
|
|
29624
29685
|
if (mainTitleVerticalAlign === 'top') {
|
|
29625
|
-
(
|
|
29626
|
-
(
|
|
29686
|
+
(_36 = this._mainTitle) === null || _36 === void 0 ? void 0 : _36.setAttribute('y', 0);
|
|
29687
|
+
(_37 = this._mainTitle) === null || _37 === void 0 ? void 0 : _37.setAttribute('textBaseline', 'top');
|
|
29627
29688
|
}
|
|
29628
29689
|
else if (mainTitleVerticalAlign === 'middle') {
|
|
29629
|
-
(
|
|
29630
|
-
(
|
|
29690
|
+
(_38 = this._mainTitle) === null || _38 === void 0 ? void 0 : _38.setAttribute('y', mainTitleHeight / 2);
|
|
29691
|
+
(_39 = this._mainTitle) === null || _39 === void 0 ? void 0 : _39.setAttribute('textBaseline', 'middle');
|
|
29631
29692
|
}
|
|
29632
29693
|
else if (mainTitleVerticalAlign === 'bottom') {
|
|
29633
|
-
(
|
|
29634
|
-
(
|
|
29694
|
+
(_40 = this._mainTitle) === null || _40 === void 0 ? void 0 : _40.setAttribute('y', mainTitleHeight);
|
|
29695
|
+
(_41 = this._mainTitle) === null || _41 === void 0 ? void 0 : _41.setAttribute('textBaseline', 'bottom');
|
|
29635
29696
|
}
|
|
29636
29697
|
}
|
|
29637
29698
|
if (vutils.isValid(align) || vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align)) {
|
|
29638
29699
|
const subTitleAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align : align;
|
|
29639
|
-
const subTitleWidth = (
|
|
29700
|
+
const subTitleWidth = (_42 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.width) !== null && _42 !== void 0 ? _42 : subtextWidth;
|
|
29640
29701
|
if (subTitleAlign === 'left') {
|
|
29641
|
-
(
|
|
29642
|
-
(
|
|
29702
|
+
(_43 = this._subTitle) === null || _43 === void 0 ? void 0 : _43.setAttribute('x', 0);
|
|
29703
|
+
(_44 = this._subTitle) === null || _44 === void 0 ? void 0 : _44.setAttribute('textAlign', 'left');
|
|
29643
29704
|
}
|
|
29644
29705
|
else if (subTitleAlign === 'center') {
|
|
29645
|
-
(
|
|
29646
|
-
(
|
|
29706
|
+
(_45 = this._subTitle) === null || _45 === void 0 ? void 0 : _45.setAttribute('x', subTitleWidth / 2);
|
|
29707
|
+
(_46 = this._subTitle) === null || _46 === void 0 ? void 0 : _46.setAttribute('textAlign', 'center');
|
|
29647
29708
|
}
|
|
29648
29709
|
else if (subTitleAlign === 'right') {
|
|
29649
|
-
(
|
|
29650
|
-
(
|
|
29710
|
+
(_47 = this._subTitle) === null || _47 === void 0 ? void 0 : _47.setAttribute('x', subTitleWidth);
|
|
29711
|
+
(_48 = this._subTitle) === null || _48 === void 0 ? void 0 : _48.setAttribute('textAlign', 'right');
|
|
29651
29712
|
}
|
|
29652
29713
|
}
|
|
29653
29714
|
if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
|
|
29654
29715
|
const subTitleVerticalAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign : verticalAlign;
|
|
29655
29716
|
const subTitleYStart = maintextHeight;
|
|
29656
|
-
const subTitleHeight = (
|
|
29717
|
+
const subTitleHeight = (_49 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _49 !== void 0 ? _49 : 0;
|
|
29657
29718
|
if (subTitleVerticalAlign === 'top') {
|
|
29658
|
-
(
|
|
29659
|
-
(
|
|
29719
|
+
(_50 = this._subTitle) === null || _50 === void 0 ? void 0 : _50.setAttribute('y', subTitleYStart);
|
|
29720
|
+
(_51 = this._subTitle) === null || _51 === void 0 ? void 0 : _51.setAttribute('textBaseline', 'top');
|
|
29660
29721
|
}
|
|
29661
29722
|
else if (subTitleVerticalAlign === 'middle') {
|
|
29662
|
-
(
|
|
29663
|
-
(
|
|
29723
|
+
(_52 = this._subTitle) === null || _52 === void 0 ? void 0 : _52.setAttribute('y', subTitleYStart + subTitleHeight / 2);
|
|
29724
|
+
(_53 = this._subTitle) === null || _53 === void 0 ? void 0 : _53.setAttribute('textBaseline', 'middle');
|
|
29664
29725
|
}
|
|
29665
29726
|
else if (subTitleVerticalAlign === 'bottom') {
|
|
29666
|
-
(
|
|
29667
|
-
(
|
|
29727
|
+
(_54 = this._subTitle) === null || _54 === void 0 ? void 0 : _54.setAttribute('y', subTitleYStart + subTitleHeight);
|
|
29728
|
+
(_55 = this._subTitle) === null || _55 === void 0 ? void 0 : _55.setAttribute('textBaseline', 'bottom');
|
|
29668
29729
|
}
|
|
29669
29730
|
}
|
|
29670
29731
|
}
|
|
@@ -29719,7 +29780,7 @@
|
|
|
29719
29780
|
this.name = 'indicator';
|
|
29720
29781
|
}
|
|
29721
29782
|
render() {
|
|
29722
|
-
var _a;
|
|
29783
|
+
var _a, _b, _c;
|
|
29723
29784
|
const { visible, title, content, size, limitRatio = Infinity } = this.attribute;
|
|
29724
29785
|
const limit = Math.min(size.width, size.height) * limitRatio;
|
|
29725
29786
|
const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group');
|
|
@@ -29730,7 +29791,15 @@
|
|
|
29730
29791
|
if (vutils.isValid(title)) {
|
|
29731
29792
|
if (title.visible !== false) {
|
|
29732
29793
|
const titleStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);
|
|
29733
|
-
|
|
29794
|
+
if (titleStyle.type === 'rich') {
|
|
29795
|
+
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');
|
|
29796
|
+
}
|
|
29797
|
+
else if (titleStyle.type === 'html') {
|
|
29798
|
+
this._title = group.createOrUpdateChild('indicator-title', Object.assign(Object.assign({ textConfig: [], html: Object.assign(Object.assign({ dom: titleStyle.text }, DEFAULT_HTML_TEXT_SPEC), titleStyle) }, titleStyle), { visible: title.visible, x: 0, y: 0 }), 'richtext');
|
|
29799
|
+
}
|
|
29800
|
+
else {
|
|
29801
|
+
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');
|
|
29802
|
+
}
|
|
29734
29803
|
if (title.autoFit && vutils.isValidNumber(limit)) {
|
|
29735
29804
|
this._setAutoFit(limit, this._title, title);
|
|
29736
29805
|
}
|
|
@@ -29751,9 +29820,19 @@
|
|
|
29751
29820
|
const contentComponents = [];
|
|
29752
29821
|
let lastContentHeight = 0;
|
|
29753
29822
|
contents.forEach((contentItem, i) => {
|
|
29823
|
+
var _a, _b;
|
|
29754
29824
|
if (contentItem.visible !== false) {
|
|
29755
29825
|
const contentStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);
|
|
29756
|
-
|
|
29826
|
+
let contentComponent;
|
|
29827
|
+
if (contentStyle.type === 'rich') {
|
|
29828
|
+
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');
|
|
29829
|
+
}
|
|
29830
|
+
else if (contentStyle.type === 'html') {
|
|
29831
|
+
contentComponent = group.createOrUpdateChild('indicator-content-' + i, Object.assign(Object.assign({ textConfig: [], html: Object.assign(Object.assign({ dom: contentStyle.text }, DEFAULT_HTML_TEXT_SPEC), contentStyle) }, contentStyle), { visible: title.visible, x: 0, y: titleHeight + titleSpace + lastContentHeight }), 'richtext');
|
|
29832
|
+
}
|
|
29833
|
+
else {
|
|
29834
|
+
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');
|
|
29835
|
+
}
|
|
29757
29836
|
if (contentItem.autoFit && vutils.isValidNumber(limit)) {
|
|
29758
29837
|
this._setAutoFit(limit, contentComponent, contentItem);
|
|
29759
29838
|
}
|
|
@@ -29771,13 +29850,13 @@
|
|
|
29771
29850
|
});
|
|
29772
29851
|
this._content = contentComponents;
|
|
29773
29852
|
}
|
|
29774
|
-
const totalHeight = (
|
|
29853
|
+
const totalHeight = (_c = group === null || group === void 0 ? void 0 : group.AABBBounds.height()) !== null && _c !== void 0 ? _c : 0;
|
|
29775
29854
|
group.setAttribute('y', size.height / 2 - totalHeight / 2);
|
|
29776
29855
|
group.setAttribute('x', size.width / 2);
|
|
29777
29856
|
}
|
|
29778
29857
|
_setAutoFit(limit, indicatorItem, indicatorItemSpec) {
|
|
29779
29858
|
var _a, _b, _c, _d, _e, _f;
|
|
29780
|
-
const originWidth = measureTextSize((_b = (_a = indicatorItemSpec.style) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : '', (_c = indicatorItemSpec.style) !== null && _c !== void 0 ? _c : {}).width;
|
|
29859
|
+
const originWidth = measureTextSize(((_b = (_a = indicatorItemSpec.style) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : ''), ((_c = indicatorItemSpec.style) !== null && _c !== void 0 ? _c : {})).width;
|
|
29781
29860
|
if (originWidth > 0) {
|
|
29782
29861
|
const ratio = (limit * ((_d = indicatorItemSpec.fitPercent) !== null && _d !== void 0 ? _d : 0.5)) / originWidth;
|
|
29783
29862
|
const fontSize = Math.floor(((_f = (_e = indicatorItemSpec.style) === null || _e === void 0 ? void 0 : _e.fontSize) !== null && _f !== void 0 ? _f : 20) * ratio);
|
|
@@ -31016,6 +31095,17 @@
|
|
|
31016
31095
|
};
|
|
31017
31096
|
const getRichTextAttribute = (attr) => {
|
|
31018
31097
|
const { width, height, wordBreak = 'break-word', textAlign, textBaseline, text } = attr;
|
|
31098
|
+
if (Array.isArray(text)) {
|
|
31099
|
+
return {
|
|
31100
|
+
width,
|
|
31101
|
+
height,
|
|
31102
|
+
wordBreak: wordBreak,
|
|
31103
|
+
textAlign: textAlign,
|
|
31104
|
+
textBaseline: textBaseline,
|
|
31105
|
+
singleLine: false,
|
|
31106
|
+
textConfig: vutils.array(text).map(text => (Object.assign(Object.assign({}, attr), { text })))
|
|
31107
|
+
};
|
|
31108
|
+
}
|
|
31019
31109
|
return {
|
|
31020
31110
|
width,
|
|
31021
31111
|
height,
|
|
@@ -31023,7 +31113,7 @@
|
|
|
31023
31113
|
textAlign: textAlign,
|
|
31024
31114
|
textBaseline: textBaseline,
|
|
31025
31115
|
singleLine: false,
|
|
31026
|
-
textConfig:
|
|
31116
|
+
textConfig: text.text
|
|
31027
31117
|
};
|
|
31028
31118
|
};
|
|
31029
31119
|
|
|
@@ -31112,6 +31202,7 @@
|
|
|
31112
31202
|
this.name = 'tooltip';
|
|
31113
31203
|
}
|
|
31114
31204
|
render() {
|
|
31205
|
+
var _a;
|
|
31115
31206
|
const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure } = this.attribute;
|
|
31116
31207
|
if (!visible) {
|
|
31117
31208
|
this.hideAll();
|
|
@@ -31130,11 +31221,22 @@
|
|
|
31130
31221
|
this._tooltipTitleSymbol = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, vutils.merge({ symbolType: 'circle' }, titleAttr.shape, {
|
|
31131
31222
|
visible: isVisible(titleAttr) && isVisible(titleAttr.shape)
|
|
31132
31223
|
}), 'symbol');
|
|
31133
|
-
if (titleAttr.value.
|
|
31224
|
+
if (typeof titleAttr.value.text === 'object' &&
|
|
31225
|
+
titleAttr.value.text !== null &&
|
|
31226
|
+
(titleAttr.value.text.type === 'rich' ||
|
|
31227
|
+
titleAttr.value.text.type === 'html')) {
|
|
31228
|
+
if (titleAttr.value.text.type === 'rich') {
|
|
31229
|
+
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, getRichTextAttribute(titleAttr.value)), 'richtext');
|
|
31230
|
+
}
|
|
31231
|
+
else if (titleAttr.value.text.type === 'html') {
|
|
31232
|
+
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ html: Object.assign(Object.assign({ dom: titleAttr.value.text.text }, DEFAULT_HTML_TEXT_SPEC), titleAttr.value), visible: isVisible(titleAttr) && isVisible(titleAttr.value), width: titleAttr.value.width, height: titleAttr.value.height, wordBreak: titleAttr.value.wordBreak, textAlign: titleAttr.value.textAlign, textBaseline: titleAttr.value.textBaseline, singleLine: false, textConfig: [] }, titleAttr.value), 'richtext');
|
|
31233
|
+
}
|
|
31234
|
+
}
|
|
31235
|
+
else if (titleAttr.value.multiLine) {
|
|
31134
31236
|
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, getRichTextAttribute(titleAttr.value)), 'richtext');
|
|
31135
31237
|
}
|
|
31136
31238
|
else {
|
|
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');
|
|
31239
|
+
this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ text: ((_a = titleAttr.value.text) !== null && _a !== void 0 ? _a : ''), visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, titleAttr.value), 'text');
|
|
31138
31240
|
}
|
|
31139
31241
|
const titlePaddingLeft = isVisible(titleAttr.shape) ? titleAttr.shape.size + titleAttr.shape.spacing : 0;
|
|
31140
31242
|
const { textAlign, textBaseline } = titleAttr.value;
|
|
@@ -31165,7 +31267,7 @@
|
|
|
31165
31267
|
this._tooltipContent.setAttribute('y', padding[0] + titleHeight);
|
|
31166
31268
|
let lastYPos = 0;
|
|
31167
31269
|
content.forEach((item, i) => {
|
|
31168
|
-
var _a;
|
|
31270
|
+
var _a, _b, _c;
|
|
31169
31271
|
const itemAttr = Tooltip.getContentAttr(this.attribute, i);
|
|
31170
31272
|
if (!isVisible(itemAttr)) {
|
|
31171
31273
|
return;
|
|
@@ -31187,8 +31289,21 @@
|
|
|
31187
31289
|
if (itemAttr.key.multiLine) {
|
|
31188
31290
|
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.key)), { textBaseline: 'top' }), 'richtext');
|
|
31189
31291
|
}
|
|
31292
|
+
else if (typeof itemAttr.key.text === 'object' &&
|
|
31293
|
+
itemAttr.key.text !== null &&
|
|
31294
|
+
(itemAttr.key.text.type === 'rich' ||
|
|
31295
|
+
itemAttr.key.text.type === 'html')) {
|
|
31296
|
+
if (itemAttr.key.text.type === 'rich') {
|
|
31297
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.key)), { textBaseline: 'top' }), 'richtext');
|
|
31298
|
+
}
|
|
31299
|
+
else {
|
|
31300
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, {
|
|
31301
|
+
html: Object.assign(Object.assign({ dom: itemAttr.key.text.text }, DEFAULT_HTML_TEXT_SPEC), itemAttr.key)
|
|
31302
|
+
}, 'richtext');
|
|
31303
|
+
}
|
|
31304
|
+
}
|
|
31190
31305
|
else {
|
|
31191
|
-
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, itemAttr.key), { textBaseline: 'top' }), 'text');
|
|
31306
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true, text: ((_b = itemAttr.key.text) !== null && _b !== void 0 ? _b : '') }, itemAttr.key), { textBaseline: 'top' }), 'text');
|
|
31192
31307
|
}
|
|
31193
31308
|
const { textAlign } = itemAttr.key;
|
|
31194
31309
|
if (textAlign === 'center') {
|
|
@@ -31208,8 +31323,21 @@
|
|
|
31208
31323
|
if (itemAttr.value.multiLine) {
|
|
31209
31324
|
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.value)), { textBaseline: 'top' }), 'richtext');
|
|
31210
31325
|
}
|
|
31326
|
+
else if (typeof itemAttr.value.text === 'object' &&
|
|
31327
|
+
itemAttr.value.text !== null &&
|
|
31328
|
+
(itemAttr.value.text.type === 'rich' ||
|
|
31329
|
+
itemAttr.value.text.type === 'html')) {
|
|
31330
|
+
if (itemAttr.value.text.type === 'rich') {
|
|
31331
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.value)), { textBaseline: 'top' }), 'richtext');
|
|
31332
|
+
}
|
|
31333
|
+
else {
|
|
31334
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, {
|
|
31335
|
+
html: Object.assign({ dom: itemAttr.value.text.text, container: '', width: 30, height: 30, style: {} }, itemAttr.value)
|
|
31336
|
+
}, 'richtext');
|
|
31337
|
+
}
|
|
31338
|
+
}
|
|
31211
31339
|
else {
|
|
31212
|
-
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, itemAttr.value), { textBaseline: 'top' }), 'text');
|
|
31340
|
+
element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true, text: ((_c = itemAttr.value.text) !== null && _c !== void 0 ? _c : '') }, itemAttr.value), { textBaseline: 'top' }), 'text');
|
|
31213
31341
|
}
|
|
31214
31342
|
let textAlign = 'right';
|
|
31215
31343
|
if (vutils.isValid(itemAttr.value.textAlign)) {
|
|
@@ -31301,7 +31429,7 @@
|
|
|
31301
31429
|
let titleMaxHeight = 0;
|
|
31302
31430
|
const { value: titleValue, shape: titleShape } = titleAttr;
|
|
31303
31431
|
const { visible: titleHasShape = false, symbolType: titleShapeType = '' } = titleShape !== null && titleShape !== void 0 ? titleShape : {};
|
|
31304
|
-
if (vutils.isValid(titleValue)) {
|
|
31432
|
+
if (vutils.isValid(titleValue) && typeof titleAttr.value.text !== 'object') {
|
|
31305
31433
|
const { width, height } = initTextMeasure(titleValue).quickMeasure(titleValue.text);
|
|
31306
31434
|
maxWidth = width;
|
|
31307
31435
|
titleMaxHeight = height;
|
|
@@ -31558,7 +31686,7 @@
|
|
|
31558
31686
|
}
|
|
31559
31687
|
};
|
|
31560
31688
|
|
|
31561
|
-
const version = "0.16.17-alpha.
|
|
31689
|
+
const version = "0.16.17-alpha.8";
|
|
31562
31690
|
|
|
31563
31691
|
exports.AbstractComponent = AbstractComponent;
|
|
31564
31692
|
exports.ArcInfo = ArcInfo;
|