@visactor/vchart-extension 2.1.0-alpha.25 → 2.1.0-alpha.26
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/build/index.js +118 -17
- package/build/index.min.js +1 -1
- package/cjs/charts/3d/plugin.js +1 -1
- package/cjs/charts/3d/pyramid-3d.js +1 -1
- package/cjs/charts/3d/rect-3d.js +1 -1
- package/cjs/charts/3d/util.js +1 -1
- package/cjs/charts/axis-3d/axis-3d-mixin.js +1 -1
- package/cjs/charts/axis-3d/band-axis.js +1 -1
- package/cjs/charts/axis-3d/index.js +1 -1
- package/cjs/charts/axis-3d/linear-axis.js +1 -2
- package/cjs/charts/axis-3d/log-axis.js +1 -1
- package/cjs/charts/axis-3d/symlog-axis.js +1 -1
- package/cjs/charts/axis-3d/theme.js +1 -1
- package/cjs/charts/axis-3d/time-axis.js +1 -1
- package/cjs/charts/axis-3d/util.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/cjs/charts/combination-candlestick/constant.js +1 -1
- package/cjs/charts/combination-candlestick/index.js +1 -1
- package/cjs/charts/combination-candlestick/interface.js +1 -1
- package/cjs/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/cjs/charts/conversion-funnel/constants.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/cjs/charts/conversion-funnel/index.js +1 -1
- package/cjs/charts/conversion-funnel/interface.js +1 -1
- package/cjs/charts/conversion-funnel/util.js +1 -1
- package/cjs/charts/funnel-3d/chart.js +1 -1
- package/cjs/charts/funnel-3d/constant.js +1 -1
- package/cjs/charts/funnel-3d/index.js +1 -1
- package/cjs/charts/funnel-3d/interface.js +1 -1
- package/cjs/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/histogram-3d/chart.js +1 -2
- package/cjs/charts/histogram-3d/index.js +1 -1
- package/cjs/charts/histogram-3d/interface.js +1 -1
- package/cjs/charts/storyline/layouts/wing.js +92 -19
- package/cjs/charts/storyline/layouts/wing.js.map +1 -1
- package/cjs/charts/storyline/storyline-transformer.js +7 -3
- package/cjs/charts/storyline/storyline-transformer.js.map +1 -1
- package/cjs/components/bar-link/bar-link.js +1 -1
- package/cjs/components/bar-link/constant.js +1 -1
- package/cjs/components/bar-link/index.js +1 -1
- package/cjs/components/bar-link/type.js +1 -1
- package/cjs/components/bar-link/util.js +1 -1
- package/cjs/components/bar-regression-line/index.js +1 -1
- package/cjs/components/bar-regression-line/type.js +2 -1
- package/cjs/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/cjs/components/extension-mark-sync-state/index.js +1 -1
- package/cjs/components/extension-mark-sync-state/type.js +1 -1
- package/cjs/components/histogram-regression-line/index.js +1 -1
- package/cjs/components/histogram-regression-line/type.js +1 -1
- package/cjs/components/map-label/index.js +1 -1
- package/cjs/components/map-label/layout.js +1 -1
- package/cjs/components/map-label/map-label-transformer.js +1 -1
- package/cjs/components/map-label/map-label.js +1 -1
- package/cjs/components/map-label/theme.js +1 -1
- package/cjs/components/map-label/type.js +1 -1
- package/cjs/components/regression-line/index.js +1 -1
- package/cjs/components/regression-line/regression-line.js +1 -1
- package/cjs/components/regression-line/type.js +1 -1
- package/cjs/components/scatter-regression-line/index.js +1 -1
- package/cjs/components/scatter-regression-line/type.js +1 -1
- package/cjs/components/series-break/constant.js +1 -1
- package/cjs/components/series-break/index.js +1 -1
- package/cjs/components/series-break/series-break.js +1 -1
- package/cjs/components/series-break/type.js +1 -1
- package/cjs/components/series-break/util.js +1 -1
- package/cjs/components/series-label/constant.js +1 -1
- package/cjs/components/series-label/index.js +2 -1
- package/cjs/components/series-label/series-label.js +1 -1
- package/cjs/components/series-label/type.js +1 -1
- package/cjs/components/series-label/util.js +1 -1
- package/esm/charts/3d/plugin.js +1 -1
- package/esm/charts/3d/pyramid-3d.js +1 -1
- package/esm/charts/3d/rect-3d.js +1 -1
- package/esm/charts/3d/util.js +1 -1
- package/esm/charts/axis-3d/axis-3d-mixin.js +1 -1
- package/esm/charts/axis-3d/band-axis.js +1 -1
- package/esm/charts/axis-3d/index.js +1 -1
- package/esm/charts/axis-3d/linear-axis.js +1 -2
- package/esm/charts/axis-3d/log-axis.js +1 -1
- package/esm/charts/axis-3d/symlog-axis.js +1 -1
- package/esm/charts/axis-3d/theme.js +1 -1
- package/esm/charts/axis-3d/time-axis.js +1 -1
- package/esm/charts/axis-3d/util.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/esm/charts/combination-candlestick/constant.js +1 -1
- package/esm/charts/combination-candlestick/index.js +1 -1
- package/esm/charts/combination-candlestick/interface.js +1 -1
- package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/esm/charts/conversion-funnel/constants.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/esm/charts/conversion-funnel/index.js +1 -1
- package/esm/charts/conversion-funnel/interface.js +1 -1
- package/esm/charts/conversion-funnel/util.js +1 -1
- package/esm/charts/funnel-3d/chart.js +1 -1
- package/esm/charts/funnel-3d/constant.js +1 -1
- package/esm/charts/funnel-3d/index.js +1 -1
- package/esm/charts/funnel-3d/interface.js +1 -1
- package/esm/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/esm/charts/histogram-3d/chart.js +1 -2
- package/esm/charts/histogram-3d/index.js +1 -1
- package/esm/charts/histogram-3d/interface.js +1 -1
- package/esm/charts/storyline/layouts/wing.js +92 -19
- package/esm/charts/storyline/layouts/wing.js.map +1 -1
- package/esm/charts/storyline/storyline-transformer.js +5 -3
- package/esm/charts/storyline/storyline-transformer.js.map +1 -1
- package/esm/components/bar-link/bar-link.js +1 -1
- package/esm/components/bar-link/constant.js +1 -1
- package/esm/components/bar-link/index.js +1 -1
- package/esm/components/bar-link/type.js +1 -1
- package/esm/components/bar-link/util.js +1 -1
- package/esm/components/bar-regression-line/index.js +1 -1
- package/esm/components/bar-regression-line/type.js +2 -1
- package/esm/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/esm/components/extension-mark-sync-state/index.js +1 -1
- package/esm/components/extension-mark-sync-state/type.js +1 -1
- package/esm/components/histogram-regression-line/index.js +1 -1
- package/esm/components/histogram-regression-line/type.js +1 -1
- package/esm/components/map-label/index.js +1 -1
- package/esm/components/map-label/layout.js +1 -1
- package/esm/components/map-label/map-label-transformer.js +1 -1
- package/esm/components/map-label/map-label.js +1 -1
- package/esm/components/map-label/theme.js +1 -1
- package/esm/components/map-label/type.js +1 -1
- package/esm/components/regression-line/index.js +1 -1
- package/esm/components/regression-line/regression-line.js +1 -1
- package/esm/components/regression-line/type.js +1 -1
- package/esm/components/scatter-regression-line/index.js +1 -1
- package/esm/components/scatter-regression-line/type.js +1 -1
- package/esm/components/series-break/constant.js +1 -1
- package/esm/components/series-break/index.js +1 -1
- package/esm/components/series-break/series-break.js +1 -1
- package/esm/components/series-break/type.js +1 -1
- package/esm/components/series-break/util.js +1 -1
- package/esm/components/series-label/constant.js +1 -1
- package/esm/components/series-label/index.js +2 -1
- package/esm/components/series-label/series-label.js +1 -1
- package/esm/components/series-label/type.js +1 -1
- package/esm/components/series-label/util.js +1 -1
- package/package.json +4 -4
package/cjs/charts/3d/plugin.js
CHANGED
package/cjs/charts/3d/rect-3d.js
CHANGED
package/cjs/charts/3d/util.js
CHANGED
|
@@ -12,5 +12,4 @@ const vchart_1 = require("@visactor/vchart"), theme_1 = require("./theme"), vcha
|
|
|
12
12
|
}), (0, vchart_2.mixin)(AxisCls, axis_3d_mixin_1.Axis3dMixin);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
exports.registerCartesianLinearAxis3d = registerCartesianLinearAxis3d;
|
|
16
|
-
//# sourceMappingURL=linear-axis.js.map
|
|
15
|
+
exports.registerCartesianLinearAxis3d = registerCartesianLinearAxis3d;
|
|
@@ -201,4 +201,4 @@ class CombinationCandlestickChartSpecTransformer extends vchart_1.CartesianChart
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
exports.CombinationCandlestickChartSpecTransformer = CombinationCandlestickChartSpecTransformer;
|
|
204
|
-
//# sourceMappingURL=combination-candlestick-transformer.js.map
|
|
204
|
+
//# sourceMappingURL=combination-candlestick-transformer.js.map
|
|
@@ -19,4 +19,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./combination-candlestick"), exports), __exportStar(require("./interface"), exports),
|
|
21
21
|
__exportStar(require("./constant"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -193,5 +193,5 @@ function addFunnelBackgroundMark(funnelBackground) {
|
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
exports.ConversionFunnelChartSpecTransformer = ConversionFunnelChartSpecTransformer;
|
|
197
196
|
//# sourceMappingURL=conversion-funnel-transformer.js.map
|
|
197
|
+
exports.ConversionFunnelChartSpecTransformer = ConversionFunnelChartSpecTransformer;
|
|
@@ -18,4 +18,4 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./interface"), exports), __exportStar(require("./conversion-funnel"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -19,4 +19,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./chart"), exports), __exportStar(require("./series"), exports),
|
|
21
21
|
__exportStar(require("./series-spec-transformer"), exports), __exportStar(require("./interface"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -13,4 +13,4 @@ class Funnel3dSeriesSpecTransformer extends vchart_1.FunnelSeriesSpecTransformer
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
exports.Funnel3dSeriesSpecTransformer = Funnel3dSeriesSpecTransformer;
|
|
16
|
-
//# sourceMappingURL=series-spec-transformer.js.map
|
|
16
|
+
//# sourceMappingURL=series-spec-transformer.js.map
|
|
@@ -27,5 +27,4 @@ const registerHistogram3dChart = () => {
|
|
|
27
27
|
(0, series_1.registerBar3dSeries)(), vchart_1.Factory.registerChart(Histogram3dChart.type, Histogram3dChart);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
exports.registerHistogram3dChart = registerHistogram3dChart;
|
|
31
|
-
//# sourceMappingURL=chart.js.map
|
|
30
|
+
exports.registerHistogram3dChart = registerHistogram3dChart;
|
|
@@ -18,4 +18,4 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./chart"), exports), __exportStar(require("./interface"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.buildWingBlockMark = exports.buildWingTitleImageMark = exports.buildWingArcMark = void 0;
|
|
6
6
|
|
|
7
|
-
const vchart_1 = require("@visactor/vchart"), common_1 = require("./common"), WING_BLOCK_IMAGE_SIZE = 160, WING_TEXT_GAP_FROM_IMAGE = 14, WING_TITLE_LINE_HEIGHT = 30, WING_TITLE_FONT_SIZE = 22, WING_CONTENT_LINE_HEIGHT = 17, WING_CONTENT_FONT_SIZE = 12, WING_TEXT_BOX_WIDTH = 240, WING_TEXT_BOX_HEIGHT = 110, WING_TITLE_TO_CONTENT_GAP = 4, WING_TITLE_IMAGE_WIDTH_RATIO = .6, WING_TITLE_IMAGE_MAX_WIDTH = 820, WING_DEFAULT_PATH_END_WIDTH = 350, WING_IMAGE_MIN_SCALE = .52, WING_IMAGE_MAX_SCALE = 1.2, WING_BOTTOM_TEXT_IMAGE_GAP_RATIO = 1.35, clamp = (value, min, max) => Math.max(min, Math.min(max, value)), getWingDirection = spec => "right" === (0,
|
|
7
|
+
const vchart_1 = require("@visactor/vchart"), common_1 = require("./common"), WING_BLOCK_IMAGE_SIZE = 160, WING_TEXT_GAP_FROM_IMAGE = 14, WING_TITLE_LINE_HEIGHT = 30, WING_TITLE_FONT_SIZE = 22, WING_TITLE_MIN_FONT_SIZE = 14, WING_TITLE_MAX_FONT_SIZE = 30, WING_CONTENT_LINE_HEIGHT = 17, WING_CONTENT_FONT_SIZE = 12, WING_TEXT_BOX_WIDTH = 240, WING_TEXT_BOX_MIN_WIDTH = 240, WING_TEXT_BOX_MAX_WIDTH = 360, WING_TEXT_BOX_WIDTH_RATIO = .24, WING_TEXT_BOX_HEIGHT = 110, WING_TITLE_TO_CONTENT_GAP = 4, WING_TITLE_IMAGE_WIDTH_RATIO = .6, WING_TITLE_IMAGE_MAX_WIDTH = 820, WING_DEFAULT_PATH_END_WIDTH = 350, WING_IMAGE_MIN_SCALE = .52, WING_IMAGE_MAX_SCALE = 1.2, WING_BOTTOM_TEXT_IMAGE_GAP_RATIO = 1.35, WING_PATH_EDGE_GAP = 8, clamp = (value, min, max) => Math.max(min, Math.min(max, value)), getWingDirection = spec => "right" === (0,
|
|
8
8
|
common_1.normalizeLayout)(spec.layout).direction ? "right" : "left", getWingPathWidthRange = spec => {
|
|
9
9
|
var _a, _b, _c, _e, _f;
|
|
10
10
|
const lineStyle = null !== (_b = null === (_a = spec.line) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {}, startWidth = Math.max(Number(null !== (_c = lineStyle.startWidth) && void 0 !== _c ? _c : 50), .5);
|
|
@@ -19,15 +19,47 @@ common_1.normalizeLayout)(spec.layout).direction ? "right" : "left", getWingPath
|
|
|
19
19
|
}, getWingBlockImageScale = (spec, index) => {
|
|
20
20
|
const {startWidth: startWidth, endWidth: endWidth} = getWingPathWidthRange(spec), startScale = clamp(startWidth / 350, .52, 1.2);
|
|
21
21
|
return startScale + (clamp(endWidth / 350, .52, 1.2) - startScale) * getWingBlockPathRatio(spec, index);
|
|
22
|
+
}, getConfiguredTextBoxWidth = spec => {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
const style = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style, width = Number(null !== (_c = null !== (_b = null == style ? void 0 : style.width) && void 0 !== _b ? _b : null == style ? void 0 : style.maxLineWidth) && void 0 !== _c ? _c : 240);
|
|
25
|
+
return Number.isFinite(width) && width > 0 ? width : 240;
|
|
26
|
+
}, getWingTextBoxWidth = (spec, ctx) => {
|
|
27
|
+
const {width: width} = (0, common_1.getRegionGeometry)(ctx, spec), configuredWidth = getConfiguredTextBoxWidth(spec), adaptiveWidth = Math.max(configuredWidth, Math.round(.24 * width));
|
|
28
|
+
return clamp(adaptiveWidth, 240, 360);
|
|
29
|
+
}, estimateTextWidth = (text, fontSize) => Array.from(text).reduce(((sum, char) => 0 === char.trim().length ? sum + .32 * fontSize : sum + fontSize * (char.charCodeAt(0) > 255 ? 1.05 : .62)), 0), measureWingTitleWidth = (title, fontSize, style) => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (!title) return 0;
|
|
32
|
+
try {
|
|
33
|
+
const size = (0, vchart_1.measureText)(title, {
|
|
34
|
+
fontSize: fontSize,
|
|
35
|
+
fontFamily: style.fontFamily,
|
|
36
|
+
fontWeight: null !== (_a = style.fontWeight) && void 0 !== _a ? _a : "bold"
|
|
37
|
+
});
|
|
38
|
+
return Number.isFinite(size.width) && size.width > 0 ? size.width : estimateTextWidth(title, fontSize);
|
|
39
|
+
} catch (_err) {
|
|
40
|
+
return estimateTextWidth(title, fontSize);
|
|
41
|
+
}
|
|
42
|
+
}, getMeasuredTitleLineCount = (title, fontSize, textWidth, style) => {
|
|
43
|
+
if (!title) return 0;
|
|
44
|
+
const measuredWidth = measureWingTitleWidth(title, fontSize, style);
|
|
45
|
+
return Math.max(1, Math.min(common_1.BLOCK_TITLE_MAX_LINES, Math.ceil(measuredWidth / Math.max(.96 * textWidth, 1))));
|
|
46
|
+
}, resolveWingTitleFontSize = (spec, index, textWidth) => {
|
|
47
|
+
var _a, _b, _c, _e;
|
|
48
|
+
const style = null !== (_b = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {}, configuredFontSize = style.fontSize;
|
|
49
|
+
if (null != configuredFontSize) return Number(configuredFontSize);
|
|
50
|
+
const title = null === (_e = null === (_c = spec.data) || void 0 === _c ? void 0 : _c[index]) || void 0 === _e ? void 0 : _e.title, measuredWidth = measureWingTitleWidth(title, 22, style);
|
|
51
|
+
if (!measuredWidth) return 22;
|
|
52
|
+
const widthLimit = textWidth * common_1.BLOCK_TITLE_MAX_LINES * .96, measuredPerFont = measuredWidth / 22, fittedFontSize = Math.floor(widthLimit / Math.max(measuredPerFont, 1));
|
|
53
|
+
return clamp(fittedFontSize, 14, 30);
|
|
22
54
|
}, getWingArcGeometry = (spec, ctx) => {
|
|
23
55
|
var _a, _b, _c;
|
|
24
56
|
const {width: width, height: height, startX: startX, startY: startY} = (0, common_1.getRegionGeometry)(ctx), innerWidth = Math.max(width, 1), innerHeight = Math.max(height, 1), layoutOpt = (0,
|
|
25
|
-
common_1.normalizeLayout)(spec.layout), direction = getWingDirection(spec), defaultStart = "right" === direction ? 110 : -70, defaultEnd = "right" === direction ? 250 : 70, startAngle = null !== (_a = layoutOpt.startAngle) && void 0 !== _a ? _a : defaultStart, endAngle = null !== (_b = layoutOpt.endAngle) && void 0 !== _b ? _b : defaultEnd, ratio = null !== (_c = layoutOpt.radiusRatio) && void 0 !== _c ? _c : .92, rx = .6 * innerWidth * ratio;
|
|
57
|
+
common_1.normalizeLayout)(spec.layout), direction = getWingDirection(spec), defaultStart = "right" === direction ? 110 : -70, defaultEnd = "right" === direction ? 250 : 70, startAngle = null !== (_a = layoutOpt.startAngle) && void 0 !== _a ? _a : defaultStart, endAngle = null !== (_b = layoutOpt.endAngle) && void 0 !== _b ? _b : defaultEnd, ratio = null !== (_c = layoutOpt.radiusRatio) && void 0 !== _c ? _c : .92, {startWidth: startWidth, endWidth: endWidth} = getWingPathWidthRange(spec), topPathWidth = "right" === direction ? endWidth : startWidth, pathTopInset = Math.min(Math.max(innerHeight / 2 - 1, 0), Math.ceil(topPathWidth / 2 + 8)), ry = Math.max(innerHeight - pathTopInset, 1) / 2 * ratio, rx = .6 * innerWidth * ratio;
|
|
26
58
|
return {
|
|
27
59
|
cx: "right" === direction ? startX + innerWidth - .1 * rx : startX + .1 * rx,
|
|
28
|
-
cy: startY +
|
|
60
|
+
cy: startY + pathTopInset - Math.min(Math.sin(startAngle / 180 * Math.PI), Math.sin(endAngle / 180 * Math.PI), 0) * ry,
|
|
29
61
|
rx: rx,
|
|
30
|
-
ry:
|
|
62
|
+
ry: ry,
|
|
31
63
|
startAngle: startAngle,
|
|
32
64
|
endAngle: endAngle
|
|
33
65
|
};
|
|
@@ -107,11 +139,51 @@ const buildWingTitleImageMark = spec => {
|
|
|
107
139
|
name: "storyline-wing-title-image",
|
|
108
140
|
zIndex: vchart_1.LayoutZIndex.Mark + 8,
|
|
109
141
|
children: [ Object.assign(Object.assign({
|
|
142
|
+
type: "rect",
|
|
143
|
+
name: "storyline-wing-title-image-node",
|
|
144
|
+
interactive: !1
|
|
145
|
+
}, spec.titleImage), {
|
|
146
|
+
_debug_bounds: !0,
|
|
147
|
+
style: Object.assign({
|
|
148
|
+
_debug_bounds: !0,
|
|
149
|
+
x: (_d, ctx) => {
|
|
150
|
+
const {width: width, height: height, startX: startX} = (0, common_1.getChartGeometry)(ctx, spec), size = (0,
|
|
151
|
+
common_1.getTitleImageSize)(spec, width, height, {
|
|
152
|
+
widthRatio: .6,
|
|
153
|
+
maxWidth: 820
|
|
154
|
+
});
|
|
155
|
+
return "right" === getWingDirection(spec) ? startX : startX + width - size.width;
|
|
156
|
+
},
|
|
157
|
+
fill: "red",
|
|
158
|
+
y: (_d, ctx) => (0, common_1.getChartGeometry)(ctx, spec).startY + 12,
|
|
159
|
+
width: (_d, ctx) => {
|
|
160
|
+
const {width: width, height: height} = (0, common_1.getChartGeometry)(ctx, spec);
|
|
161
|
+
return (0, common_1.getTitleImageSize)(spec, width, height, {
|
|
162
|
+
widthRatio: .6,
|
|
163
|
+
maxWidth: 820
|
|
164
|
+
}).width;
|
|
165
|
+
},
|
|
166
|
+
height: (_d, ctx) => {
|
|
167
|
+
const {width: width, height: height} = (0, common_1.getChartGeometry)(ctx, spec);
|
|
168
|
+
return (0, common_1.getTitleImageSize)(spec, width, height, {
|
|
169
|
+
widthRatio: .6,
|
|
170
|
+
maxWidth: 820
|
|
171
|
+
}).height;
|
|
172
|
+
},
|
|
173
|
+
image: spec.titleImage.image,
|
|
174
|
+
repeatX: "no-repeat",
|
|
175
|
+
repeatY: "no-repeat",
|
|
176
|
+
imageMode: "contain",
|
|
177
|
+
imagePosition: "center"
|
|
178
|
+
}, spec.titleImage.style)
|
|
179
|
+
}), Object.assign(Object.assign({
|
|
110
180
|
type: "image",
|
|
111
181
|
name: "storyline-wing-title-image-node",
|
|
112
182
|
interactive: !1
|
|
113
183
|
}, spec.titleImage), {
|
|
184
|
+
_debug_bounds: !0,
|
|
114
185
|
style: Object.assign({
|
|
186
|
+
_debug_bounds: !0,
|
|
115
187
|
x: (_d, ctx) => {
|
|
116
188
|
const {width: width, height: height, startX: startX} = (0, common_1.getChartGeometry)(ctx, spec), size = (0,
|
|
117
189
|
common_1.getTitleImageSize)(spec, width, height, {
|
|
@@ -148,27 +220,26 @@ const buildWingTitleImageMark = spec => {
|
|
|
148
220
|
exports.buildWingTitleImageMark = buildWingTitleImageMark;
|
|
149
221
|
|
|
150
222
|
const WING_TEXT_IMAGE_GAP = 120, getWingBlockMetrics = (spec, ctx, index) => {
|
|
151
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
|
152
|
-
const
|
|
153
|
-
common_1.resolveAdaptiveLineHeight)(titleFontSize, null === (_c = spec.
|
|
154
|
-
common_1.getBlockTitleHeight)(titleLineHeight, null === (_f = null === (_e = spec.data) || void 0 === _e ? void 0 : _e[index]) || void 0 === _f ? void 0 : _f.title, 240, titleFontSize), contentFontSize = Number(null !== (_j = null === (_h = null === (_g = spec.content) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.fontSize) && void 0 !== _j ? _j : 12), contentLineHeight = Number(null !== (_m = null === (_l = null === (_k = spec.content) || void 0 === _k ? void 0 : _k.style) || void 0 === _l ? void 0 : _l.lineHeight) && void 0 !== _m ? _m : 17), imageScale = getWingBlockImageScale(spec, index), imageWidth = Math.round(Number(null !== (_p = null === (_o = spec.image) || void 0 === _o ? void 0 : _o.width) && void 0 !== _p ? _p : 160) * imageScale), imageHeight = Math.round(Number(null !== (_r = null === (_q = spec.image) || void 0 === _q ? void 0 : _q.height) && void 0 !== _r ? _r : 160) * imageScale), imageBox = {
|
|
223
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
224
|
+
const textWidth = getWingTextBoxWidth(spec, ctx), titleStyle = null !== (_b = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {}, titleFontSize = resolveWingTitleFontSize(spec, index, textWidth), titleLineHeight = (0,
|
|
225
|
+
common_1.resolveAdaptiveLineHeight)(titleFontSize, titleStyle, 30, 1.3), titleHeight = titleLineHeight * getMeasuredTitleLineCount(null === (_e = null === (_c = spec.data) || void 0 === _c ? void 0 : _c[index]) || void 0 === _e ? void 0 : _e.title, titleFontSize, textWidth, titleStyle), contentFontSize = Number(null !== (_h = null === (_g = null === (_f = spec.content) || void 0 === _f ? void 0 : _f.style) || void 0 === _g ? void 0 : _g.fontSize) && void 0 !== _h ? _h : 12), contentLineHeight = Number(null !== (_l = null === (_k = null === (_j = spec.content) || void 0 === _j ? void 0 : _j.style) || void 0 === _k ? void 0 : _k.lineHeight) && void 0 !== _l ? _l : 17), imageScale = getWingBlockImageScale(spec, index), imageWidth = Math.round(Number(null !== (_o = null === (_m = spec.image) || void 0 === _m ? void 0 : _m.width) && void 0 !== _o ? _o : 160) * imageScale), imageHeight = Math.round(Number(null !== (_q = null === (_p = spec.image) || void 0 === _p ? void 0 : _p.height) && void 0 !== _q ? _q : 160) * imageScale), imageBox = {
|
|
155
226
|
x: -imageWidth / 2,
|
|
156
227
|
y: -imageHeight / 2,
|
|
157
228
|
width: imageWidth,
|
|
158
229
|
height: imageHeight
|
|
159
|
-
}, direction = getWingDirection(spec), count = null !== (
|
|
230
|
+
}, direction = getWingDirection(spec), count = null !== (_s = null === (_r = spec.data) || void 0 === _r ? void 0 : _r.length) && void 0 !== _s ? _s : 0, isSpecialBelow = "right" === direction && count > 0 && index === count - 1 || "left" === direction && 0 === index, isBottomAbove = isWingBottomBlock(spec, ctx, index), isVerticalLayout = isBottomAbove || isSpecialBelow;
|
|
160
231
|
let textBox, contentBox, connectorBox, onLeft, verticalAlign;
|
|
161
232
|
if (isBottomAbove) {
|
|
162
|
-
const bottomTextImageGap = Math.round(162), textX = -
|
|
233
|
+
const bottomTextImageGap = Math.round(162), textX = -textWidth / 2, textY = -imageHeight / 2 - bottomTextImageGap - 110;
|
|
163
234
|
textBox = {
|
|
164
235
|
x: textX,
|
|
165
236
|
y: textY,
|
|
166
|
-
width:
|
|
237
|
+
width: textWidth,
|
|
167
238
|
height: 110
|
|
168
239
|
}, contentBox = {
|
|
169
240
|
x: textX,
|
|
170
241
|
y: textY + titleHeight + 4,
|
|
171
|
-
width:
|
|
242
|
+
width: textWidth,
|
|
172
243
|
height: 1e5
|
|
173
244
|
}, connectorBox = {
|
|
174
245
|
x: -1,
|
|
@@ -177,16 +248,16 @@ const WING_TEXT_IMAGE_GAP = 120, getWingBlockMetrics = (spec, ctx, index) => {
|
|
|
177
248
|
height: bottomTextImageGap
|
|
178
249
|
}, onLeft = !1, verticalAlign = "above";
|
|
179
250
|
} else if (isVerticalLayout) {
|
|
180
|
-
const textX = -
|
|
251
|
+
const textX = -textWidth / 2, textY = imageHeight / 2 + 120;
|
|
181
252
|
textBox = {
|
|
182
253
|
x: textX,
|
|
183
254
|
y: textY,
|
|
184
|
-
width:
|
|
255
|
+
width: textWidth,
|
|
185
256
|
height: 110
|
|
186
257
|
}, contentBox = {
|
|
187
258
|
x: textX,
|
|
188
259
|
y: textY + titleHeight + 4,
|
|
189
|
-
width:
|
|
260
|
+
width: textWidth,
|
|
190
261
|
height: 1e5
|
|
191
262
|
}, connectorBox = {
|
|
192
263
|
x: -1,
|
|
@@ -195,19 +266,19 @@ const WING_TEXT_IMAGE_GAP = 120, getWingBlockMetrics = (spec, ctx, index) => {
|
|
|
195
266
|
height: 120
|
|
196
267
|
}, onLeft = !1, verticalAlign = "below";
|
|
197
268
|
} else {
|
|
198
|
-
const textOnLeft = "right" === direction, textX = textOnLeft ? -imageWidth / 2 - 120 -
|
|
269
|
+
const textOnLeft = "right" === direction, textX = textOnLeft ? -imageWidth / 2 - 120 - textWidth : imageWidth / 2 + 120, textY = -55;
|
|
199
270
|
textBox = {
|
|
200
271
|
x: textX,
|
|
201
272
|
y: textY,
|
|
202
|
-
width:
|
|
273
|
+
width: textWidth,
|
|
203
274
|
height: 110
|
|
204
275
|
}, contentBox = {
|
|
205
276
|
x: textX,
|
|
206
277
|
y: textY + titleHeight + 4,
|
|
207
|
-
width:
|
|
278
|
+
width: textWidth,
|
|
208
279
|
height: 1e5
|
|
209
280
|
};
|
|
210
|
-
const imageEdgeX = textOnLeft ? -imageWidth / 2 : imageWidth / 2, textEdgeX = textOnLeft ? textX +
|
|
281
|
+
const imageEdgeX = textOnLeft ? -imageWidth / 2 : imageWidth / 2, textEdgeX = textOnLeft ? textX + textWidth : textX;
|
|
211
282
|
connectorBox = {
|
|
212
283
|
x: Math.min(imageEdgeX, textEdgeX),
|
|
213
284
|
y: 0,
|
|
@@ -306,6 +377,8 @@ const WING_TEXT_IMAGE_GAP = 120, getWingBlockMetrics = (spec, ctx, index) => {
|
|
|
306
377
|
return m.verticalAlign ? m.textBox.x + m.textBox.width / 2 : m.onLeft ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
307
378
|
},
|
|
308
379
|
y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.y,
|
|
380
|
+
width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width,
|
|
381
|
+
maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width,
|
|
309
382
|
text: block.title,
|
|
310
383
|
height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleHeight,
|
|
311
384
|
heightLimit: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight * common_1.BLOCK_TITLE_MAX_LINES,
|