@visactor/vchart-extension 2.1.0-alpha.21 → 2.1.0-alpha.23
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 +526 -489
- package/build/index.min.js +2 -2
- package/cjs/charts/axis-3d/index.js +2 -1
- package/cjs/charts/axis-3d/linear-axis.js +1 -2
- package/cjs/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/cjs/charts/bar-3d/chart.js +1 -1
- package/cjs/charts/bar-3d/constant.js +1 -1
- package/cjs/charts/bar-3d/index.js +1 -1
- package/cjs/charts/bar-3d/interface.js +1 -1
- package/cjs/charts/bar-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/bar-3d/series.js +1 -1
- package/cjs/charts/bar-3d/theme.js +1 -1
- package/cjs/charts/candlestick/candlestick-transformer.js +1 -1
- package/cjs/charts/candlestick/candlestick.js +1 -2
- package/cjs/charts/candlestick/index.js +1 -1
- package/cjs/charts/candlestick/interface.js +1 -1
- package/cjs/charts/candlestick/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 -2
- 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/funnel-3d/series.js +1 -1
- package/cjs/charts/funnel-3d/theme.js +1 -1
- package/cjs/charts/histogram-3d/chart.js +1 -1
- package/cjs/charts/storyline/interface.d.ts +2 -2
- package/cjs/charts/storyline/interface.js.map +1 -1
- package/cjs/charts/storyline/layouts/arc.d.ts +1 -1
- package/cjs/charts/storyline/layouts/arc.js +92 -111
- package/cjs/charts/storyline/layouts/arc.js.map +1 -1
- package/cjs/charts/storyline/layouts/clock.d.ts +1 -1
- package/cjs/charts/storyline/layouts/clock.js +47 -37
- package/cjs/charts/storyline/layouts/clock.js.map +1 -1
- package/cjs/charts/storyline/layouts/common.d.ts +56 -16
- package/cjs/charts/storyline/layouts/common.js +185 -40
- package/cjs/charts/storyline/layouts/common.js.map +1 -1
- package/cjs/charts/storyline/layouts/default.js +34 -28
- package/cjs/charts/storyline/layouts/default.js.map +1 -1
- package/cjs/charts/storyline/layouts/ladder.js +35 -28
- package/cjs/charts/storyline/layouts/ladder.js.map +1 -1
- package/cjs/charts/storyline/layouts/landscape.js +39 -34
- package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
- package/cjs/charts/storyline/layouts/portrait.d.ts +2 -2
- package/cjs/charts/storyline/layouts/portrait.js +78 -65
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
- package/cjs/charts/storyline/layouts/wing.d.ts +1 -0
- package/cjs/charts/storyline/layouts/wing.js +103 -54
- package/cjs/charts/storyline/layouts/wing.js.map +1 -1
- package/cjs/charts/storyline/storyline-transformer.js +18 -14
- 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 +1 -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 +2 -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 +2 -1
- package/cjs/components/series-label/constant.js +1 -1
- package/cjs/components/series-label/index.js +1 -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/axis-3d/index.js +2 -1
- package/esm/charts/axis-3d/linear-axis.js +1 -2
- package/esm/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/esm/charts/bar-3d/chart.js +1 -1
- package/esm/charts/bar-3d/constant.js +1 -1
- package/esm/charts/bar-3d/index.js +1 -1
- package/esm/charts/bar-3d/interface.js +1 -1
- package/esm/charts/bar-3d/series-spec-transformer.js +1 -1
- package/esm/charts/bar-3d/series.js +1 -1
- package/esm/charts/bar-3d/theme.js +1 -1
- package/esm/charts/candlestick/candlestick-transformer.js +1 -1
- package/esm/charts/candlestick/candlestick.js +1 -2
- package/esm/charts/candlestick/index.js +1 -1
- package/esm/charts/candlestick/interface.js +1 -1
- package/esm/charts/candlestick/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 -2
- 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/funnel-3d/series.js +1 -1
- package/esm/charts/funnel-3d/theme.js +1 -1
- package/esm/charts/histogram-3d/chart.js +1 -1
- package/esm/charts/storyline/interface.d.ts +2 -2
- package/esm/charts/storyline/interface.js.map +1 -1
- package/esm/charts/storyline/layouts/arc.d.ts +1 -1
- package/esm/charts/storyline/layouts/arc.js +86 -109
- package/esm/charts/storyline/layouts/arc.js.map +1 -1
- package/esm/charts/storyline/layouts/clock.d.ts +1 -1
- package/esm/charts/storyline/layouts/clock.js +45 -36
- package/esm/charts/storyline/layouts/clock.js.map +1 -1
- package/esm/charts/storyline/layouts/common.d.ts +56 -16
- package/esm/charts/storyline/layouts/common.js +168 -35
- package/esm/charts/storyline/layouts/common.js.map +1 -1
- package/esm/charts/storyline/layouts/default.js +30 -26
- package/esm/charts/storyline/layouts/default.js.map +1 -1
- package/esm/charts/storyline/layouts/ladder.js +30 -26
- package/esm/charts/storyline/layouts/ladder.js.map +1 -1
- package/esm/charts/storyline/layouts/landscape.js +35 -34
- package/esm/charts/storyline/layouts/landscape.js.map +1 -1
- package/esm/charts/storyline/layouts/portrait.d.ts +2 -2
- package/esm/charts/storyline/layouts/portrait.js +75 -68
- package/esm/charts/storyline/layouts/portrait.js.map +1 -1
- package/esm/charts/storyline/layouts/wing.d.ts +1 -0
- package/esm/charts/storyline/layouts/wing.js +97 -54
- package/esm/charts/storyline/layouts/wing.js.map +1 -1
- package/esm/charts/storyline/storyline-transformer.js +20 -18
- 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 +1 -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 +2 -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 +2 -1
- package/esm/components/series-label/constant.js +1 -1
- package/esm/components/series-label/index.js +1 -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 +2 -2
package/build/index.js
CHANGED
|
@@ -6078,6 +6078,12 @@
|
|
|
6078
6078
|
const DEFAULT_IMAGE_HEIGHT = 48;
|
|
6079
6079
|
const DEFAULT_IMAGE_GAP = 10;
|
|
6080
6080
|
const DEFAULT_THEME_COLOR = '#e8543d';
|
|
6081
|
+
const BLOCK_TITLE_MAX_LINES = 2;
|
|
6082
|
+
const DEFAULT_TITLE_IMAGE_WIDTH_RATIO = 0.52;
|
|
6083
|
+
const DEFAULT_TITLE_IMAGE_MAX_WIDTH = 720;
|
|
6084
|
+
const DEFAULT_TITLE_IMAGE_HEIGHT_RATIO = 0.36;
|
|
6085
|
+
const DEFAULT_TITLE_IMAGE_TOP = 12;
|
|
6086
|
+
const DEFAULT_TITLE_IMAGE_BOTTOM = 24;
|
|
6081
6087
|
const isLandscape = (spec) => normalizeLayout(spec.layout).type === 'landscape';
|
|
6082
6088
|
const isPortrait = (spec) => normalizeLayout(spec.layout).type === 'portrait';
|
|
6083
6089
|
const isClock = (spec) => normalizeLayout(spec.layout).type === 'clock';
|
|
@@ -6086,6 +6092,145 @@
|
|
|
6086
6092
|
const isLadder = (spec) => normalizeLayout(spec.layout).type === 'ladder';
|
|
6087
6093
|
const getThemeColor = (spec) => { var _a; return (_a = spec.themeColor) !== null && _a !== void 0 ? _a : DEFAULT_THEME_COLOR; };
|
|
6088
6094
|
const shouldShowImageBackground = (spec) => { var _a, _b; return (_b = (_a = spec.image) === null || _a === void 0 ? void 0 : _a.showBackground) !== null && _b !== void 0 ? _b : !(isPortrait(spec) || isLandscape(spec)); };
|
|
6095
|
+
const TITLE_FONT_SCALE_ID = 'storylineTitleFontSize';
|
|
6096
|
+
const MARKER_FONT_SCALE_ID = 'storylineMarkerFontSize';
|
|
6097
|
+
const clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
6098
|
+
const getTextWeight = (text) => {
|
|
6099
|
+
if (!text) {
|
|
6100
|
+
return 4;
|
|
6101
|
+
}
|
|
6102
|
+
return Math.max(Array.from(text).reduce((sum, char) => {
|
|
6103
|
+
if (char.trim().length === 0) {
|
|
6104
|
+
return sum + 0.32;
|
|
6105
|
+
}
|
|
6106
|
+
return sum + (char.charCodeAt(0) > 255 ? 1.05 : 0.62);
|
|
6107
|
+
}, 0), 1);
|
|
6108
|
+
};
|
|
6109
|
+
const getScaleRange = (spec, scaleId, fallback) => {
|
|
6110
|
+
var _a;
|
|
6111
|
+
const scales = spec.scales;
|
|
6112
|
+
const range = (_a = scales === null || scales === void 0 ? void 0 : scales.find(scale => scale.id === scaleId || scale.type === scaleId)) === null || _a === void 0 ? void 0 : _a.range;
|
|
6113
|
+
if (Array.isArray(range) && range.length >= 2 && typeof range[0] === 'number' && typeof range[1] === 'number') {
|
|
6114
|
+
return [Math.min(range[0], range[1]), Math.max(range[0], range[1])];
|
|
6115
|
+
}
|
|
6116
|
+
return fallback;
|
|
6117
|
+
};
|
|
6118
|
+
const getSpecGeometry = (spec, ctx) => {
|
|
6119
|
+
var _a, _b;
|
|
6120
|
+
if (ctx) {
|
|
6121
|
+
return getRegionGeometry(ctx, spec);
|
|
6122
|
+
}
|
|
6123
|
+
return {
|
|
6124
|
+
width: Math.max(Number((_a = spec.width) !== null && _a !== void 0 ? _a : 0), 1),
|
|
6125
|
+
height: Math.max(Number((_b = spec.height) !== null && _b !== void 0 ? _b : 0), 1),
|
|
6126
|
+
startX: 0,
|
|
6127
|
+
startY: 0
|
|
6128
|
+
};
|
|
6129
|
+
};
|
|
6130
|
+
const resolveAdaptiveFontSize = (spec, ctx, text, options) => {
|
|
6131
|
+
var _a;
|
|
6132
|
+
const configuredFontSize = (_a = options.style) === null || _a === void 0 ? void 0 : _a.fontSize;
|
|
6133
|
+
if (configuredFontSize != null) {
|
|
6134
|
+
return Number(configuredFontSize);
|
|
6135
|
+
}
|
|
6136
|
+
const [minFontSize, maxFontSize] = getScaleRange(spec, options.scaleId, options.range);
|
|
6137
|
+
const { width, height } = getSpecGeometry(spec, ctx);
|
|
6138
|
+
const textWeight = getTextWeight(text);
|
|
6139
|
+
const canvasSize = Math.sqrt(width * height) * options.canvasRatio;
|
|
6140
|
+
const lengthFactor = Math.sqrt(8 / Math.max(textWeight, 4));
|
|
6141
|
+
const adaptiveSize = width <= 1 && height <= 1 ? options.fallback : canvasSize * lengthFactor;
|
|
6142
|
+
const boxWidthLimit = options.boxWidth && options.boxWidth > 0
|
|
6143
|
+
? ((options.boxWidth * BLOCK_TITLE_MAX_LINES) / textWeight) * 0.96
|
|
6144
|
+
: Number.POSITIVE_INFINITY;
|
|
6145
|
+
const boxHeightLimit = options.boxHeight && options.boxHeight > 0 ? options.boxHeight / Math.max(textWeight, 1) : Number.POSITIVE_INFINITY;
|
|
6146
|
+
return Math.floor(clamp(Math.min(adaptiveSize, boxWidthLimit, boxHeightLimit), minFontSize, maxFontSize));
|
|
6147
|
+
};
|
|
6148
|
+
const resolveAdaptiveLineHeight = (fontSize, style, fallback, ratio = 1.35) => { var _a; return Number((_a = style === null || style === void 0 ? void 0 : style.lineHeight) !== null && _a !== void 0 ? _a : Math.round((Number.isFinite(fontSize) ? fontSize : fallback) * ratio)); };
|
|
6149
|
+
const resolveTitleFontSize = (spec, ctx, title, boxWidth, fallback, range = [16, 34]) => {
|
|
6150
|
+
var _a;
|
|
6151
|
+
return resolveAdaptiveFontSize(spec, ctx, title, {
|
|
6152
|
+
style: (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style,
|
|
6153
|
+
scaleId: TITLE_FONT_SCALE_ID,
|
|
6154
|
+
fallback,
|
|
6155
|
+
range,
|
|
6156
|
+
canvasRatio: 0.038,
|
|
6157
|
+
boxWidth
|
|
6158
|
+
});
|
|
6159
|
+
};
|
|
6160
|
+
const resolveMarkerFontSize = (spec, ctx, marker, boxHeight, fallback, range = [18, 46]) => {
|
|
6161
|
+
var _a;
|
|
6162
|
+
return resolveAdaptiveFontSize(spec, ctx, marker, {
|
|
6163
|
+
style: (_a = spec.marker) === null || _a === void 0 ? void 0 : _a.style,
|
|
6164
|
+
scaleId: MARKER_FONT_SCALE_ID,
|
|
6165
|
+
fallback,
|
|
6166
|
+
range,
|
|
6167
|
+
canvasRatio: 0.052,
|
|
6168
|
+
boxHeight
|
|
6169
|
+
});
|
|
6170
|
+
};
|
|
6171
|
+
const getImageBackgroundStyle = (spec) => {
|
|
6172
|
+
const themeColor = getThemeColor(spec);
|
|
6173
|
+
return {
|
|
6174
|
+
fill: {
|
|
6175
|
+
gradient: 'linear',
|
|
6176
|
+
x0: 0,
|
|
6177
|
+
y0: 0,
|
|
6178
|
+
x1: 1,
|
|
6179
|
+
y1: 1,
|
|
6180
|
+
stops: [
|
|
6181
|
+
{ offset: 0, color: '#ffffff' },
|
|
6182
|
+
{ offset: 0.58, color: withAlpha(themeColor, 0.12) },
|
|
6183
|
+
{ offset: 1, color: withAlpha(themeColor, 0.32) }
|
|
6184
|
+
]
|
|
6185
|
+
},
|
|
6186
|
+
stroke: withAlpha(themeColor, 0.78),
|
|
6187
|
+
lineWidth: 2,
|
|
6188
|
+
shadowColor: withAlpha(themeColor, 0.18),
|
|
6189
|
+
shadowBlur: 10,
|
|
6190
|
+
shadowOffsetX: 0,
|
|
6191
|
+
shadowOffsetY: 4
|
|
6192
|
+
};
|
|
6193
|
+
};
|
|
6194
|
+
const getTitleImageSize = (spec, width, height, options) => {
|
|
6195
|
+
var _a, _b, _c, _e, _f, _g, _h;
|
|
6196
|
+
const defaultWidth = Math.min(Math.max(width * ((_a = options === null || options === void 0 ? void 0 : options.widthRatio) !== null && _a !== void 0 ? _a : DEFAULT_TITLE_IMAGE_WIDTH_RATIO), 1), (_b = options === null || options === void 0 ? void 0 : options.maxWidth) !== null && _b !== void 0 ? _b : DEFAULT_TITLE_IMAGE_MAX_WIDTH);
|
|
6197
|
+
const imageWidth = Math.max(Number((_e = (_c = spec.titleImage) === null || _c === void 0 ? void 0 : _c.width) !== null && _e !== void 0 ? _e : defaultWidth), 1);
|
|
6198
|
+
const imageHeight = Math.max(Number((_g = (_f = spec.titleImage) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : Math.min(height, imageWidth * ((_h = options === null || options === void 0 ? void 0 : options.heightRatio) !== null && _h !== void 0 ? _h : DEFAULT_TITLE_IMAGE_HEIGHT_RATIO))), 1);
|
|
6199
|
+
return { width: imageWidth, height: imageHeight };
|
|
6200
|
+
};
|
|
6201
|
+
const getTitleImageReservedHeight = (spec, width, height, options) => {
|
|
6202
|
+
var _a, _b, _c;
|
|
6203
|
+
if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
|
|
6204
|
+
return 0;
|
|
6205
|
+
}
|
|
6206
|
+
const size = getTitleImageSize(spec, width, height, options);
|
|
6207
|
+
return Math.ceil(((_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : DEFAULT_TITLE_IMAGE_TOP) + size.height + ((_c = options === null || options === void 0 ? void 0 : options.bottom) !== null && _c !== void 0 ? _c : DEFAULT_TITLE_IMAGE_BOTTOM));
|
|
6208
|
+
};
|
|
6209
|
+
const getChartGeometry = (ctx, spec) => {
|
|
6210
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
6211
|
+
const chartRect = (_b = (_a = ctx.chart) === null || _a === void 0 ? void 0 : _a.getLayoutRect) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
6212
|
+
const bounds = (_c = ctx.getLayoutBounds) === null || _c === void 0 ? void 0 : _c.call(ctx);
|
|
6213
|
+
const width = Math.max((_h = (_g = (_e = chartRect === null || chartRect === void 0 ? void 0 : chartRect.width) !== null && _e !== void 0 ? _e : (_f = bounds === null || bounds === void 0 ? void 0 : bounds.width) === null || _f === void 0 ? void 0 : _f.call(bounds)) !== null && _g !== void 0 ? _g : spec === null || spec === void 0 ? void 0 : spec.width) !== null && _h !== void 0 ? _h : 0, 1);
|
|
6214
|
+
const height = Math.max((_m = (_l = (_j = chartRect === null || chartRect === void 0 ? void 0 : chartRect.height) !== null && _j !== void 0 ? _j : (_k = bounds === null || bounds === void 0 ? void 0 : bounds.height) === null || _k === void 0 ? void 0 : _k.call(bounds)) !== null && _l !== void 0 ? _l : spec === null || spec === void 0 ? void 0 : spec.height) !== null && _m !== void 0 ? _m : 0, 1);
|
|
6215
|
+
return { width, height, startX: 0, startY: 0 };
|
|
6216
|
+
};
|
|
6217
|
+
const buildTopTitleImageMark = (spec, options) => {
|
|
6218
|
+
var _a;
|
|
6219
|
+
if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
|
|
6220
|
+
return null;
|
|
6221
|
+
}
|
|
6222
|
+
return Object.assign(Object.assign({ type: 'image', name: 'storyline-title-image', interactive: false, zIndex: vchart.LayoutZIndex.Mark + 8 }, spec.titleImage), { style: Object.assign({ x: (_d, ctx) => {
|
|
6223
|
+
const { width, height, startX } = getChartGeometry(ctx, spec);
|
|
6224
|
+
const size = getTitleImageSize(spec, width, height, options);
|
|
6225
|
+
return startX + (width - size.width) / 2;
|
|
6226
|
+
}, y: (_d, ctx) => { var _a; return getChartGeometry(ctx, spec).startY + ((_a = options === null || options === void 0 ? void 0 : options.y) !== null && _a !== void 0 ? _a : DEFAULT_TITLE_IMAGE_TOP); }, width: (_d, ctx) => {
|
|
6227
|
+
const { width, height } = getChartGeometry(ctx, spec);
|
|
6228
|
+
return getTitleImageSize(spec, width, height, options).width;
|
|
6229
|
+
}, height: (_d, ctx) => {
|
|
6230
|
+
const { width, height } = getChartGeometry(ctx, spec);
|
|
6231
|
+
return getTitleImageSize(spec, width, height, options).height;
|
|
6232
|
+
}, image: spec.titleImage.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, spec.titleImage.style) });
|
|
6233
|
+
};
|
|
6089
6234
|
const withAlpha = (color, alpha) => {
|
|
6090
6235
|
const safeAlpha = Math.max(0, Math.min(1, alpha));
|
|
6091
6236
|
if (!color) {
|
|
@@ -6114,40 +6259,40 @@
|
|
|
6114
6259
|
return trimmed;
|
|
6115
6260
|
};
|
|
6116
6261
|
const resolveBlockWidth = (spec, viewWidth) => {
|
|
6117
|
-
var _a, _b, _c,
|
|
6262
|
+
var _a, _b, _c, _e, _f, _g, _h;
|
|
6118
6263
|
if ((_a = spec.block) === null || _a === void 0 ? void 0 : _a.width) {
|
|
6119
6264
|
return spec.block.width;
|
|
6120
6265
|
}
|
|
6121
6266
|
const ratio = (_c = (_b = spec.block) === null || _b === void 0 ? void 0 : _b.widthRatio) !== null && _c !== void 0 ? _c : DEFAULT_BLOCK_WIDTH_RATIO;
|
|
6122
|
-
const minWidth = (
|
|
6123
|
-
const maxWidth = (
|
|
6267
|
+
const minWidth = (_f = (_e = spec.block) === null || _e === void 0 ? void 0 : _e.minWidth) !== null && _f !== void 0 ? _f : DEFAULT_BLOCK_WIDTH;
|
|
6268
|
+
const maxWidth = (_h = (_g = spec.block) === null || _g === void 0 ? void 0 : _g.maxWidth) !== null && _h !== void 0 ? _h : Math.max(minWidth, 320);
|
|
6124
6269
|
return Math.max(minWidth, Math.min(maxWidth, Math.round(viewWidth * ratio)));
|
|
6125
6270
|
};
|
|
6126
6271
|
const getRegionGeometry = (ctx, spec) => {
|
|
6127
|
-
var _a, _b, _c,
|
|
6272
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
6128
6273
|
const region = (_c = (_b = (_a = ctx.chart) === null || _a === void 0 ? void 0 : _a.getAllRegions) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c[0];
|
|
6129
|
-
const regionRect = (
|
|
6130
|
-
const regionStart = (
|
|
6131
|
-
const chartRect = (
|
|
6132
|
-
const bounds = (
|
|
6133
|
-
const width = Math.max((
|
|
6134
|
-
const height = Math.max((
|
|
6274
|
+
const regionRect = (_e = region === null || region === void 0 ? void 0 : region.getLayoutRect) === null || _e === void 0 ? void 0 : _e.call(region);
|
|
6275
|
+
const regionStart = (_f = region === null || region === void 0 ? void 0 : region.getLayoutStartPoint) === null || _f === void 0 ? void 0 : _f.call(region);
|
|
6276
|
+
const chartRect = (_h = (_g = ctx.chart) === null || _g === void 0 ? void 0 : _g.getLayoutRect) === null || _h === void 0 ? void 0 : _h.call(_g);
|
|
6277
|
+
const bounds = (_j = ctx.getLayoutBounds) === null || _j === void 0 ? void 0 : _j.call(ctx);
|
|
6278
|
+
const width = Math.max((_p = (_o = (_l = (_k = regionRect === null || regionRect === void 0 ? void 0 : regionRect.width) !== null && _k !== void 0 ? _k : chartRect === null || chartRect === void 0 ? void 0 : chartRect.width) !== null && _l !== void 0 ? _l : (_m = bounds === null || bounds === void 0 ? void 0 : bounds.width) === null || _m === void 0 ? void 0 : _m.call(bounds)) !== null && _o !== void 0 ? _o : spec === null || spec === void 0 ? void 0 : spec.width) !== null && _p !== void 0 ? _p : 0, 1);
|
|
6279
|
+
const height = Math.max((_u = (_t = (_r = (_q = regionRect === null || regionRect === void 0 ? void 0 : regionRect.height) !== null && _q !== void 0 ? _q : chartRect === null || chartRect === void 0 ? void 0 : chartRect.height) !== null && _r !== void 0 ? _r : (_s = bounds === null || bounds === void 0 ? void 0 : bounds.height) === null || _s === void 0 ? void 0 : _s.call(bounds)) !== null && _t !== void 0 ? _t : spec === null || spec === void 0 ? void 0 : spec.height) !== null && _u !== void 0 ? _u : 0, 1);
|
|
6135
6280
|
return {
|
|
6136
6281
|
width,
|
|
6137
6282
|
height,
|
|
6138
|
-
startX: (
|
|
6139
|
-
startY: (
|
|
6283
|
+
startX: (_v = regionStart === null || regionStart === void 0 ? void 0 : regionStart.x) !== null && _v !== void 0 ? _v : 0,
|
|
6284
|
+
startY: (_w = regionStart === null || regionStart === void 0 ? void 0 : regionStart.y) !== null && _w !== void 0 ? _w : 0
|
|
6140
6285
|
};
|
|
6141
6286
|
};
|
|
6142
6287
|
const getLayout = (spec, ctx) => {
|
|
6143
|
-
var _a, _b, _c,
|
|
6288
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
6144
6289
|
const { width, height, startX, startY } = getRegionGeometry(ctx, spec);
|
|
6145
6290
|
let blockWidth = resolveBlockWidth(spec, width);
|
|
6146
6291
|
let blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : (isLandscape(spec) ? 320 : DEFAULT_BLOCK_HEIGHT);
|
|
6147
6292
|
if (isLandscape(spec) && !((_c = spec.block) === null || _c === void 0 ? void 0 : _c.width)) {
|
|
6148
|
-
const count = (
|
|
6293
|
+
const count = (_f = (_e = spec.data) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0;
|
|
6149
6294
|
if (count > 0) {
|
|
6150
|
-
const padding = normalizePadding((
|
|
6295
|
+
const padding = normalizePadding((_g = spec.block) === null || _g === void 0 ? void 0 : _g.padding);
|
|
6151
6296
|
const innerWidth = Math.max(width - padding.left - padding.right, 1);
|
|
6152
6297
|
const LANDSCAPE_IMAGE_GAP = 40;
|
|
6153
6298
|
const LANDSCAPE_IMAGE_MIN_WIDTH = 80;
|
|
@@ -6156,24 +6301,25 @@
|
|
|
6156
6301
|
blockWidth = Math.max(LANDSCAPE_IMAGE_MIN_WIDTH, Math.floor(adaptive));
|
|
6157
6302
|
}
|
|
6158
6303
|
}
|
|
6159
|
-
if (isPortrait(spec) && !((
|
|
6160
|
-
const count = (
|
|
6304
|
+
if (isPortrait(spec) && !((_h = spec.block) === null || _h === void 0 ? void 0 : _h.height)) {
|
|
6305
|
+
const count = (_k = (_j = spec.data) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0;
|
|
6161
6306
|
if (count > 0) {
|
|
6162
|
-
const
|
|
6307
|
+
const layoutPadding = typeof spec.layout === 'object' ? spec.layout.padding : undefined;
|
|
6308
|
+
const padding = normalizePadding(layoutPadding !== null && layoutPadding !== void 0 ? layoutPadding : (_l = spec.block) === null || _l === void 0 ? void 0 : _l.padding);
|
|
6163
6309
|
const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
|
|
6164
6310
|
blockHeight = Math.max(120, Math.floor(innerHeight / (count + 1)));
|
|
6165
6311
|
}
|
|
6166
6312
|
}
|
|
6167
|
-
const result = computeStorylineLayout((
|
|
6313
|
+
const result = computeStorylineLayout((_m = spec.data) !== null && _m !== void 0 ? _m : [], {
|
|
6168
6314
|
layout: spec.layout,
|
|
6169
6315
|
viewBox: { width, height },
|
|
6170
6316
|
block: {
|
|
6171
6317
|
width: blockWidth,
|
|
6172
6318
|
height: blockHeight
|
|
6173
6319
|
},
|
|
6174
|
-
gap: (
|
|
6175
|
-
padding: (
|
|
6176
|
-
lineDistance: (
|
|
6320
|
+
gap: (_p = (_o = spec.block) === null || _o === void 0 ? void 0 : _o.gap) !== null && _p !== void 0 ? _p : DEFAULT_BLOCK_GAP,
|
|
6321
|
+
padding: (_q = spec.block) === null || _q === void 0 ? void 0 : _q.padding,
|
|
6322
|
+
lineDistance: (_r = spec.line) === null || _r === void 0 ? void 0 : _r.distance
|
|
6177
6323
|
});
|
|
6178
6324
|
if (!startX && !startY) {
|
|
6179
6325
|
return result;
|
|
@@ -6183,27 +6329,8 @@
|
|
|
6183
6329
|
y: block.center.y + startY
|
|
6184
6330
|
} }))), links: result.links.map(link => (Object.assign(Object.assign({}, link), { start: { x: link.start.x + startX, y: link.start.y + startY }, end: { x: link.end.x + startX, y: link.end.y + startY }, points: link.points.map(point => ({ x: point.x + startX, y: point.y + startY })) }))) });
|
|
6185
6331
|
};
|
|
6186
|
-
const
|
|
6187
|
-
|
|
6188
|
-
const fontSize = Number((_d = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.fontSize) !== null && _a !== void 0 ? _a : (_c = (_b = spec.content) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.fontSize) !== null && _d !== void 0 ? _d : 18);
|
|
6189
|
-
const lineHeight = Number((_h = (_e = overrides === null || overrides === void 0 ? void 0 : overrides.lineHeight) !== null && _e !== void 0 ? _e : (_g = (_f = spec.content) === null || _f === void 0 ? void 0 : _f.style) === null || _g === void 0 ? void 0 : _g.lineHeight) !== null && _h !== void 0 ? _h : 26);
|
|
6190
|
-
const fill = (_m = (_j = overrides === null || overrides === void 0 ? void 0 : overrides.fill) !== null && _j !== void 0 ? _j : (_l = (_k = spec.content) === null || _k === void 0 ? void 0 : _k.style) === null || _l === void 0 ? void 0 : _l.fill) !== null && _m !== void 0 ? _m : '#596173';
|
|
6191
|
-
const align = (_o = overrides === null || overrides === void 0 ? void 0 : overrides.align) !== null && _o !== void 0 ? _o : 'left';
|
|
6192
|
-
return {
|
|
6193
|
-
type: 'rich',
|
|
6194
|
-
text: contentText.reduce((result, paragraph, index) => {
|
|
6195
|
-
const suffix = index === contentText.length - 1 ? '' : '\n';
|
|
6196
|
-
result.push({
|
|
6197
|
-
text: `${paragraph}${suffix}`,
|
|
6198
|
-
fontSize,
|
|
6199
|
-
lineHeight,
|
|
6200
|
-
fill,
|
|
6201
|
-
align
|
|
6202
|
-
});
|
|
6203
|
-
return result;
|
|
6204
|
-
}, [])
|
|
6205
|
-
};
|
|
6206
|
-
};
|
|
6332
|
+
const buildPlainContent = (contentText) => contentText.join('\n');
|
|
6333
|
+
const getBlockTitleHeight = (lineHeight, title) => title ? lineHeight * BLOCK_TITLE_MAX_LINES : 0;
|
|
6207
6334
|
const omitImageLayoutSpec = (imageSpec) => {
|
|
6208
6335
|
if (!imageSpec) {
|
|
6209
6336
|
return {};
|
|
@@ -6291,8 +6418,6 @@
|
|
|
6291
6418
|
return d;
|
|
6292
6419
|
};
|
|
6293
6420
|
|
|
6294
|
-
const CLOCK_CENTER_RADIUS_RATIO = 0.6;
|
|
6295
|
-
const CLOCK_CENTER_IMAGE_INSET_RATIO = 0.9;
|
|
6296
6421
|
const CLOCK_ORBIT_RATIO = 0.68;
|
|
6297
6422
|
const CLOCK_DOT_RATIO = 0.68;
|
|
6298
6423
|
const CLOCK_TEXT_INNER_RATIO = 0.92;
|
|
@@ -6303,8 +6428,9 @@
|
|
|
6303
6428
|
const CLOCK_ORBIT_DASH = [4, 4];
|
|
6304
6429
|
const CLOCK_TITLE_FONT_SIZE = 22;
|
|
6305
6430
|
const CLOCK_TITLE_LINE_HEIGHT = 28;
|
|
6306
|
-
const CLOCK_CONTENT_FONT_SIZE =
|
|
6307
|
-
const CLOCK_CONTENT_LINE_HEIGHT =
|
|
6431
|
+
const CLOCK_CONTENT_FONT_SIZE = 14;
|
|
6432
|
+
const CLOCK_CONTENT_LINE_HEIGHT = 20;
|
|
6433
|
+
const CLOCK_CONTENT_LINES = 4;
|
|
6308
6434
|
const getClockGeometry = (spec, ctx) => {
|
|
6309
6435
|
var _a, _b, _c;
|
|
6310
6436
|
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
@@ -6314,7 +6440,7 @@
|
|
|
6314
6440
|
const cx = startX + padding.left + innerWidth / 2;
|
|
6315
6441
|
const cy = startY + padding.top + innerHeight / 2;
|
|
6316
6442
|
const textReserveX = CLOCK_TEXT_MAX_WIDTH;
|
|
6317
|
-
const textReserveY = 4 + CLOCK_CONTENT_LINE_HEIGHT *
|
|
6443
|
+
const textReserveY = 4 + CLOCK_CONTENT_LINE_HEIGHT * CLOCK_CONTENT_LINES;
|
|
6318
6444
|
const rMaxX = (innerWidth / 2 - textReserveX) / CLOCK_TEXT_INNER_RATIO;
|
|
6319
6445
|
const rMaxY = (innerHeight / 2 - textReserveY) / CLOCK_TEXT_INNER_RATIO;
|
|
6320
6446
|
const R = Math.max(Math.min(rMaxX, rMaxY), 1);
|
|
@@ -6328,81 +6454,6 @@
|
|
|
6328
6454
|
y: cy + Math.sin(angle) * r
|
|
6329
6455
|
});
|
|
6330
6456
|
const isOnLeftHalf = (angle) => Math.cos(angle) < 0;
|
|
6331
|
-
const buildClockCenterImageMark = (spec) => {
|
|
6332
|
-
var _a, _b, _c, _e;
|
|
6333
|
-
if (((_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.visible) === false) {
|
|
6334
|
-
return null;
|
|
6335
|
-
}
|
|
6336
|
-
const themeColor = getThemeColor(spec);
|
|
6337
|
-
const hasImage = !!((_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.image);
|
|
6338
|
-
return {
|
|
6339
|
-
type: 'group',
|
|
6340
|
-
name: 'storyline-clock-center',
|
|
6341
|
-
zIndex: vchart.LayoutZIndex.Mark + 2,
|
|
6342
|
-
children: [
|
|
6343
|
-
{
|
|
6344
|
-
type: 'symbol',
|
|
6345
|
-
name: 'storyline-clock-center-halo',
|
|
6346
|
-
interactive: false,
|
|
6347
|
-
style: {
|
|
6348
|
-
x: (_d, ctx) => getClockGeometry(spec, ctx).cx,
|
|
6349
|
-
y: (_d, ctx) => getClockGeometry(spec, ctx).cy,
|
|
6350
|
-
size: (_d, ctx) => {
|
|
6351
|
-
const g = getClockGeometry(spec, ctx);
|
|
6352
|
-
return g.R * CLOCK_CENTER_RADIUS_RATIO * 2.16;
|
|
6353
|
-
},
|
|
6354
|
-
symbolType: 'circle',
|
|
6355
|
-
fill: withAlpha(themeColor, 0.28),
|
|
6356
|
-
stroke: 'transparent'
|
|
6357
|
-
}
|
|
6358
|
-
},
|
|
6359
|
-
hasImage
|
|
6360
|
-
? {
|
|
6361
|
-
type: 'image',
|
|
6362
|
-
name: 'storyline-clock-center-image',
|
|
6363
|
-
interactive: false,
|
|
6364
|
-
style: Object.assign({ x: (_d, ctx) => {
|
|
6365
|
-
const g = getClockGeometry(spec, ctx);
|
|
6366
|
-
return g.cx - g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO;
|
|
6367
|
-
}, y: (_d, ctx) => {
|
|
6368
|
-
const g = getClockGeometry(spec, ctx);
|
|
6369
|
-
return g.cy - g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO;
|
|
6370
|
-
}, width: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2, height: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2, image: (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center', cornerRadius: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO, anchor: (_d, ctx) => {
|
|
6371
|
-
const g = getClockGeometry(spec, ctx);
|
|
6372
|
-
return [g.cx, g.cy];
|
|
6373
|
-
}, dx: (_d, ctx) => {
|
|
6374
|
-
var _a, _b;
|
|
6375
|
-
const g = getClockGeometry(spec, ctx);
|
|
6376
|
-
const rectW = g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2;
|
|
6377
|
-
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
6378
|
-
const w = typeof userWidth === 'number' ? userWidth : rectW;
|
|
6379
|
-
return (rectW - w) / 2;
|
|
6380
|
-
}, dy: (_d, ctx) => {
|
|
6381
|
-
var _a, _b;
|
|
6382
|
-
const g = getClockGeometry(spec, ctx);
|
|
6383
|
-
const rectH = g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2;
|
|
6384
|
-
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
6385
|
-
const h = typeof userHeight === 'number' ? userHeight : rectH;
|
|
6386
|
-
return (rectH - h) / 2;
|
|
6387
|
-
} }, (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.style)
|
|
6388
|
-
}
|
|
6389
|
-
: {
|
|
6390
|
-
type: 'symbol',
|
|
6391
|
-
name: 'storyline-clock-center-placeholder',
|
|
6392
|
-
interactive: false,
|
|
6393
|
-
style: {
|
|
6394
|
-
x: (_d, ctx) => getClockGeometry(spec, ctx).cx,
|
|
6395
|
-
y: (_d, ctx) => getClockGeometry(spec, ctx).cy,
|
|
6396
|
-
size: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * 2,
|
|
6397
|
-
symbolType: 'circle',
|
|
6398
|
-
fill: '#ffffff',
|
|
6399
|
-
stroke: themeColor,
|
|
6400
|
-
lineWidth: 2
|
|
6401
|
-
}
|
|
6402
|
-
}
|
|
6403
|
-
].filter(Boolean)
|
|
6404
|
-
};
|
|
6405
|
-
};
|
|
6406
6457
|
const buildClockArcMark = (spec) => {
|
|
6407
6458
|
const themeColor = getThemeColor(spec);
|
|
6408
6459
|
const orbitPath = (_d, ctx) => {
|
|
@@ -6466,11 +6517,13 @@
|
|
|
6466
6517
|
return { x: innerPoint.x, y: innerPoint.y, width, onLeft, anchorY: innerPoint.y };
|
|
6467
6518
|
};
|
|
6468
6519
|
const buildClockBlockMark = (spec, block, index) => {
|
|
6469
|
-
var _a, _b, _c;
|
|
6520
|
+
var _a, _b, _c, _e;
|
|
6470
6521
|
const hasImage = !!block.image;
|
|
6471
6522
|
const themeColor = getThemeColor(spec);
|
|
6472
6523
|
const showImageBackground = shouldShowImageBackground(spec);
|
|
6473
6524
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6525
|
+
const getTitleFontSize = (ctx) => resolveTitleFontSize(spec, ctx, block.title, getClockTextRect(spec, ctx, index).width, CLOCK_TITLE_FONT_SIZE, [8, 30]);
|
|
6526
|
+
const getTitleLineHeight = (ctx) => { var _a; return resolveAdaptiveLineHeight(getTitleFontSize(ctx), (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style, CLOCK_TITLE_LINE_HEIGHT, 1.28); };
|
|
6474
6527
|
const leadPath = (_d, ctx) => {
|
|
6475
6528
|
const { start, end } = getClockLeadLine(spec, ctx, index);
|
|
6476
6529
|
return `M ${start.x.toFixed(2)} ${start.y.toFixed(2)} L ${end.x.toFixed(2)} ${end.y.toFixed(2)}`;
|
|
@@ -6494,41 +6547,17 @@
|
|
|
6494
6547
|
type: 'symbol',
|
|
6495
6548
|
name: `storyline-clock-dot-bg-${index}`,
|
|
6496
6549
|
interactive: false,
|
|
6497
|
-
style: {
|
|
6498
|
-
x: (_d, ctx) => getClockDotCenter(spec, ctx, index).x,
|
|
6499
|
-
y: (_d, ctx) => getClockDotCenter(spec, ctx, index).y,
|
|
6500
|
-
size: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter + 10,
|
|
6501
|
-
symbolType: 'circle',
|
|
6502
|
-
fill: '#ffffff',
|
|
6503
|
-
stroke: themeColor,
|
|
6504
|
-
lineWidth: 2
|
|
6505
|
-
}
|
|
6550
|
+
style: Object.assign({ x: (_d, ctx) => getClockDotCenter(spec, ctx, index).x, y: (_d, ctx) => getClockDotCenter(spec, ctx, index).y, size: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter + 10, symbolType: 'circle' }, getImageBackgroundStyle(spec))
|
|
6506
6551
|
}
|
|
6507
6552
|
: null,
|
|
6508
6553
|
hasImage
|
|
6509
|
-
? {
|
|
6510
|
-
type: 'image',
|
|
6511
|
-
name: `storyline-clock-dot-${index}`,
|
|
6512
|
-
interactive: false,
|
|
6513
|
-
style: {
|
|
6514
|
-
x: (_d, ctx) => {
|
|
6554
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-clock-dot-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => {
|
|
6515
6555
|
const dot = getClockDotCenter(spec, ctx, index);
|
|
6516
6556
|
return dot.x - dot.diameter / 2;
|
|
6517
|
-
},
|
|
6518
|
-
y: (_d, ctx) => {
|
|
6557
|
+
}, y: (_d, ctx) => {
|
|
6519
6558
|
const dot = getClockDotCenter(spec, ctx, index);
|
|
6520
6559
|
return dot.y - dot.diameter / 2;
|
|
6521
|
-
},
|
|
6522
|
-
width: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
|
|
6523
|
-
height: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
|
|
6524
|
-
image: block.image,
|
|
6525
|
-
repeatX: 'no-repeat',
|
|
6526
|
-
repeatY: 'no-repeat',
|
|
6527
|
-
imageMode: 'cover',
|
|
6528
|
-
imagePosition: 'center',
|
|
6529
|
-
cornerRadius: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter / 2
|
|
6530
|
-
}
|
|
6531
|
-
}
|
|
6560
|
+
}, width: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter, height: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center', cornerRadius: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter / 2 }, (_a = spec.image) === null || _a === void 0 ? void 0 : _a.style) })
|
|
6532
6561
|
: {
|
|
6533
6562
|
type: 'symbol',
|
|
6534
6563
|
name: `storyline-clock-dot-${index}`,
|
|
@@ -6544,15 +6573,15 @@
|
|
|
6544
6573
|
}
|
|
6545
6574
|
},
|
|
6546
6575
|
block.title
|
|
6547
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY -
|
|
6576
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY - getTitleLineHeight(ctx) * BLOCK_TITLE_MAX_LINES, text: block.title, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, height: (_d, ctx) => getTitleLineHeight(ctx) * BLOCK_TITLE_MAX_LINES, heightLimit: (_d, ctx) => getTitleLineHeight(ctx) * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getTitleFontSize(ctx), lineHeight: (_d, ctx) => getTitleLineHeight(ctx), fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_b = spec.title) === null || _b === void 0 ? void 0 : _b.style) })
|
|
6548
6577
|
: null,
|
|
6549
6578
|
contentText.length
|
|
6550
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-content-${index}`, interactive: false }, spec.content), {
|
|
6579
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY + 4, width: (_d, ctx) => getClockTextRect(spec, ctx, index).width, height: CLOCK_CONTENT_LINE_HEIGHT * CLOCK_CONTENT_LINES, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, heightLimit: CLOCK_CONTENT_LINE_HEIGHT * CLOCK_CONTENT_LINES, text: buildPlainContent(contentText), fontSize: CLOCK_CONTENT_FONT_SIZE, lineHeight: CLOCK_CONTENT_LINE_HEIGHT, fill: '#3a3f4d', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word' }, (_c = spec.content) === null || _c === void 0 ? void 0 : _c.style) })
|
|
6551
6580
|
: null
|
|
6552
6581
|
];
|
|
6553
6582
|
return {
|
|
6554
6583
|
type: 'group',
|
|
6555
|
-
id: `storyline-block-${(
|
|
6584
|
+
id: `storyline-block-${(_e = block.id) !== null && _e !== void 0 ? _e : index}`,
|
|
6556
6585
|
name: `storyline-block-${index}`,
|
|
6557
6586
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
6558
6587
|
children: children.filter(Boolean)
|
|
@@ -6582,7 +6611,7 @@
|
|
|
6582
6611
|
};
|
|
6583
6612
|
};
|
|
6584
6613
|
const getDefaultBlockMetrics = (spec, ctx, index) => {
|
|
6585
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y
|
|
6614
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
6586
6615
|
const block = getLayout(spec, ctx).blocks[index];
|
|
6587
6616
|
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
6588
6617
|
const imagePosition = (_d = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.position) !== null && _d !== void 0 ? _d : 'top';
|
|
@@ -6590,19 +6619,21 @@
|
|
|
6590
6619
|
const imageHeight = (_h = (_g = spec.image) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : DEFAULT_IMAGE_HEIGHT;
|
|
6591
6620
|
const imageGap = (_k = (_j = spec.image) === null || _j === void 0 ? void 0 : _j.gap) !== null && _k !== void 0 ? _k : DEFAULT_IMAGE_GAP;
|
|
6592
6621
|
const hasImage = !!((_m = (_l = spec.data) === null || _l === void 0 ? void 0 : _l[index]) === null || _m === void 0 ? void 0 : _m.image);
|
|
6593
|
-
const
|
|
6594
|
-
const
|
|
6595
|
-
const titleHeight = ((_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title) ? titleLineHeight : 0;
|
|
6596
|
-
const blockWidth = (_w = block === null || block === void 0 ? void 0 : block.width) !== null && _w !== void 0 ? _w : resolveBlockWidth(spec, 0);
|
|
6597
|
-
const blockHeight = (_z = (_x = block === null || block === void 0 ? void 0 : block.height) !== null && _x !== void 0 ? _x : (_y = spec.block) === null || _y === void 0 ? void 0 : _y.height) !== null && _z !== void 0 ? _z : DEFAULT_BLOCK_HEIGHT;
|
|
6622
|
+
const blockWidth = (_o = block === null || block === void 0 ? void 0 : block.width) !== null && _o !== void 0 ? _o : resolveBlockWidth(spec, 0);
|
|
6623
|
+
const blockHeight = (_r = (_p = block === null || block === void 0 ? void 0 : block.height) !== null && _p !== void 0 ? _p : (_q = spec.block) === null || _q === void 0 ? void 0 : _q.height) !== null && _r !== void 0 ? _r : DEFAULT_BLOCK_HEIGHT;
|
|
6598
6624
|
const imageBox = getImageBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
6599
6625
|
const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
6600
|
-
const
|
|
6626
|
+
const titleFontSize = resolveTitleFontSize(spec, ctx, (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t.title, textBox.width, 18, [8, 28]);
|
|
6627
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_u = spec.title) === null || _u === void 0 ? void 0 : _u.style, Math.round(18 * 1.35));
|
|
6628
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_w = (_v = spec.data) === null || _v === void 0 ? void 0 : _v[index]) === null || _w === void 0 ? void 0 : _w.title);
|
|
6629
|
+
const contentGap = ((_y = (_x = spec.data) === null || _x === void 0 ? void 0 : _x[index]) === null || _y === void 0 ? void 0 : _y.title) ? 8 : 0;
|
|
6601
6630
|
return {
|
|
6602
6631
|
block: {
|
|
6603
6632
|
width: blockWidth,
|
|
6604
6633
|
height: blockHeight
|
|
6605
6634
|
},
|
|
6635
|
+
titleFontSize,
|
|
6636
|
+
titleLineHeight,
|
|
6606
6637
|
imageBox,
|
|
6607
6638
|
textBox,
|
|
6608
6639
|
contentBox: {
|
|
@@ -6612,15 +6643,12 @@
|
|
|
6612
6643
|
};
|
|
6613
6644
|
};
|
|
6614
6645
|
const buildDefaultBlockMark = (spec, block, index) => {
|
|
6615
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
6646
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6616
6647
|
const hasImage = !!block.image;
|
|
6617
6648
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6618
|
-
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 18);
|
|
6619
|
-
const titleLineHeight = Number((_f = (_e = (_d = spec.title) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.lineHeight) !== null && _f !== void 0 ? _f : Math.round(titleFontSize * 1.35));
|
|
6620
|
-
const themeColor = getThemeColor(spec);
|
|
6621
6649
|
return {
|
|
6622
6650
|
type: 'group',
|
|
6623
|
-
id: `storyline-block-${(
|
|
6651
|
+
id: `storyline-block-${(_a = block.id) !== null && _a !== void 0 ? _a : index}`,
|
|
6624
6652
|
name: `storyline-block-${index}`,
|
|
6625
6653
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
6626
6654
|
style: {
|
|
@@ -6630,12 +6658,12 @@
|
|
|
6630
6658
|
height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height
|
|
6631
6659
|
},
|
|
6632
6660
|
children: [
|
|
6633
|
-
((
|
|
6661
|
+
((_b = spec.block) === null || _b === void 0 ? void 0 : _b.showBackground) === true
|
|
6634
6662
|
? {
|
|
6635
6663
|
type: 'rect',
|
|
6636
6664
|
name: `storyline-block-bg-${index}`,
|
|
6637
6665
|
interactive: false,
|
|
6638
|
-
style: Object.assign({ x: 0, y: 0, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (
|
|
6666
|
+
style: Object.assign({ x: 0, y: 0, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_c = spec.block) === null || _c === void 0 ? void 0 : _c.style)
|
|
6639
6667
|
}
|
|
6640
6668
|
: null,
|
|
6641
6669
|
shouldShowImageBackground(spec)
|
|
@@ -6643,21 +6671,17 @@
|
|
|
6643
6671
|
type: 'rect',
|
|
6644
6672
|
name: `storyline-block-image-bg-${index}`,
|
|
6645
6673
|
interactive: false,
|
|
6646
|
-
style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8
|
|
6674
|
+
style: Object.assign(Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), (_d = spec.block) === null || _d === void 0 ? void 0 : _d.style)
|
|
6647
6675
|
}
|
|
6648
6676
|
: null,
|
|
6649
6677
|
hasImage
|
|
6650
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (
|
|
6678
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_e = spec.image) === null || _e === void 0 ? void 0 : _e.style) })
|
|
6651
6679
|
: null,
|
|
6652
6680
|
block.title
|
|
6653
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, fontSize: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (
|
|
6681
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
|
|
6654
6682
|
: null,
|
|
6655
6683
|
contentText.length
|
|
6656
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), {
|
|
6657
|
-
fontSize: 18,
|
|
6658
|
-
lineHeight: 26,
|
|
6659
|
-
fill: '#596173'
|
|
6660
|
-
}), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style) })
|
|
6684
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, text: buildPlainContent(contentText), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, fontSize: 16, lineHeight: 23, textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
|
|
6661
6685
|
: null
|
|
6662
6686
|
].filter(Boolean)
|
|
6663
6687
|
};
|
|
@@ -6709,8 +6733,8 @@
|
|
|
6709
6733
|
const LANDSCAPE_TEXT_GAP_FROM_CONNECTOR = 12;
|
|
6710
6734
|
const LANDSCAPE_CONTENT_LINES = 10;
|
|
6711
6735
|
const LANDSCAPE_TITLE_LINE_HEIGHT = 34;
|
|
6712
|
-
const LANDSCAPE_CONTENT_LINE_HEIGHT =
|
|
6713
|
-
const LANDSCAPE_CONTENT_FONT_SIZE =
|
|
6736
|
+
const LANDSCAPE_CONTENT_LINE_HEIGHT = 23;
|
|
6737
|
+
const LANDSCAPE_CONTENT_FONT_SIZE = 16;
|
|
6714
6738
|
const LANDSCAPE_TITLE_TO_CONTENT_GAP = 4;
|
|
6715
6739
|
const getLandscapeImageCenter = (spec, ctx, index) => {
|
|
6716
6740
|
var _a, _b, _c, _e;
|
|
@@ -6777,21 +6801,22 @@
|
|
|
6777
6801
|
]
|
|
6778
6802
|
};
|
|
6779
6803
|
};
|
|
6780
|
-
const getLandscapeMetrics = (spec, blockWidth, blockHeight, index) => {
|
|
6781
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
6804
|
+
const getLandscapeMetrics = (spec, blockWidth, blockHeight, index, ctx) => {
|
|
6805
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
6782
6806
|
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
6783
|
-
const titleFontSize =
|
|
6784
|
-
const titleLineHeight =
|
|
6785
|
-
const
|
|
6786
|
-
const
|
|
6787
|
-
const
|
|
6807
|
+
const titleFontSize = resolveTitleFontSize(spec, ctx, (_e = (_c = spec.data) === null || _c === void 0 ? void 0 : _c[index]) === null || _e === void 0 ? void 0 : _e.title, blockWidth, 26, [8, 34]);
|
|
6808
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style, LANDSCAPE_TITLE_LINE_HEIGHT);
|
|
6809
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_h = (_g = spec.data) === null || _g === void 0 ? void 0 : _g[index]) === null || _h === void 0 ? void 0 : _h.title);
|
|
6810
|
+
const contentFontSize = Number((_l = (_k = (_j = spec.content) === null || _j === void 0 ? void 0 : _j.style) === null || _k === void 0 ? void 0 : _k.fontSize) !== null && _l !== void 0 ? _l : LANDSCAPE_CONTENT_FONT_SIZE);
|
|
6811
|
+
const contentLineHeight = Number((_p = (_o = (_m = spec.content) === null || _m === void 0 ? void 0 : _m.style) === null || _o === void 0 ? void 0 : _o.lineHeight) !== null && _p !== void 0 ? _p : LANDSCAPE_CONTENT_LINE_HEIGHT);
|
|
6812
|
+
const imageHeight = Math.max((_r = (_q = spec.image) === null || _q === void 0 ? void 0 : _q.height) !== null && _r !== void 0 ? _r : Math.round(blockHeight * LANDSCAPE_IMAGE_HEIGHT_RATIO), titleLineHeight + padding.top + padding.bottom);
|
|
6788
6813
|
const connectorGap = LANDSCAPE_DETACHED_GAP;
|
|
6789
6814
|
const canvasHeight = spec.height;
|
|
6790
6815
|
const contentHeight = canvasHeight
|
|
6791
6816
|
? Math.max(contentLineHeight * 2, Math.round(canvasHeight / 4))
|
|
6792
6817
|
: LANDSCAPE_CONTENT_LINES * contentLineHeight;
|
|
6793
6818
|
const titleToContentGap = LANDSCAPE_TITLE_TO_CONTENT_GAP;
|
|
6794
|
-
const textHeight =
|
|
6819
|
+
const textHeight = titleHeight + titleToContentGap + contentHeight;
|
|
6795
6820
|
const textOnTop = index % 2 === 0;
|
|
6796
6821
|
let textBox;
|
|
6797
6822
|
let contentBox;
|
|
@@ -6802,17 +6827,19 @@
|
|
|
6802
6827
|
const imageX = 0;
|
|
6803
6828
|
const connectorX = imageX + blockWidth * LANDSCAPE_CONNECTOR_X_RATIO;
|
|
6804
6829
|
const textX = connectorX + LANDSCAPE_TEXT_GAP_FROM_CONNECTOR;
|
|
6805
|
-
const
|
|
6830
|
+
const { width: regionWidth } = getRegionGeometry(ctx, spec);
|
|
6831
|
+
const blockCount = Math.max((_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s.length) !== null && _t !== void 0 ? _t : 1, 1);
|
|
6832
|
+
const textWidth = Math.max(regionWidth / blockCount, 1);
|
|
6806
6833
|
if (textOnTop) {
|
|
6807
6834
|
const imageY = 0;
|
|
6808
6835
|
const textY = imageY - connectorGap - textHeight;
|
|
6809
6836
|
const connectorY1 = imageY;
|
|
6810
|
-
const connectorY2 = textY + titleLineHeight / 2;
|
|
6837
|
+
const connectorY2 = textY + Math.max(titleHeight, titleLineHeight) / 2;
|
|
6811
6838
|
imageBox = { x: imageX, y: imageY, width: blockWidth, height: imageHeight };
|
|
6812
6839
|
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
6813
6840
|
contentBox = {
|
|
6814
6841
|
x: textX,
|
|
6815
|
-
y: textY +
|
|
6842
|
+
y: textY + titleHeight + titleToContentGap,
|
|
6816
6843
|
width: textWidth,
|
|
6817
6844
|
height: contentHeight
|
|
6818
6845
|
};
|
|
@@ -6829,7 +6856,7 @@
|
|
|
6829
6856
|
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
6830
6857
|
contentBox = {
|
|
6831
6858
|
x: textX,
|
|
6832
|
-
y: textY +
|
|
6859
|
+
y: textY + titleHeight + titleToContentGap,
|
|
6833
6860
|
width: textWidth,
|
|
6834
6861
|
height: contentHeight
|
|
6835
6862
|
};
|
|
@@ -6844,7 +6871,7 @@
|
|
|
6844
6871
|
contentFontSize,
|
|
6845
6872
|
contentLineHeight,
|
|
6846
6873
|
contentHeight,
|
|
6847
|
-
blockWidth,
|
|
6874
|
+
blockWidth: Math.max(blockWidth, textX + textWidth),
|
|
6848
6875
|
imageBox,
|
|
6849
6876
|
textBox,
|
|
6850
6877
|
contentBox,
|
|
@@ -6855,27 +6882,25 @@
|
|
|
6855
6882
|
};
|
|
6856
6883
|
};
|
|
6857
6884
|
const buildLandscapeBlockMark = (spec, block, index) => {
|
|
6858
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m
|
|
6885
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
6859
6886
|
const hasImage = !!block.image;
|
|
6860
6887
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6861
|
-
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 26);
|
|
6862
|
-
const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.round(titleFontSize * 1.35));
|
|
6863
6888
|
const getMetrics = (ctx) => {
|
|
6864
6889
|
var _a, _b, _c, _e;
|
|
6865
6890
|
const layoutBlock = getLayout(spec, ctx).blocks[index];
|
|
6866
6891
|
const w = (_a = layoutBlock === null || layoutBlock === void 0 ? void 0 : layoutBlock.width) !== null && _a !== void 0 ? _a : resolveBlockWidth(spec, 0);
|
|
6867
6892
|
const h = (_e = (_b = layoutBlock === null || layoutBlock === void 0 ? void 0 : layoutBlock.height) !== null && _b !== void 0 ? _b : (_c = spec.block) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : DEFAULT_BLOCK_HEIGHT;
|
|
6868
|
-
return getLandscapeMetrics(spec, w, h, index);
|
|
6893
|
+
return getLandscapeMetrics(spec, w, h, index, ctx);
|
|
6869
6894
|
};
|
|
6870
|
-
const blockStyle = (
|
|
6871
|
-
const lineStyle = (
|
|
6895
|
+
const blockStyle = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
|
|
6896
|
+
const lineStyle = (_e = (_c = spec.line) === null || _c === void 0 ? void 0 : _c.style) !== null && _e !== void 0 ? _e : {};
|
|
6872
6897
|
const themeColor = getThemeColor(spec);
|
|
6873
|
-
const connectorStroke = (
|
|
6874
|
-
const connectorLineWidth = (
|
|
6875
|
-
const connectorDash = (
|
|
6898
|
+
const connectorStroke = (_f = lineStyle.stroke) !== null && _f !== void 0 ? _f : themeColor;
|
|
6899
|
+
const connectorLineWidth = (_g = lineStyle.lineWidth) !== null && _g !== void 0 ? _g : 2;
|
|
6900
|
+
const connectorDash = (_h = lineStyle.lineDash) !== null && _h !== void 0 ? _h : [4, 4];
|
|
6876
6901
|
return {
|
|
6877
6902
|
type: 'group',
|
|
6878
|
-
id: `storyline-block-${(
|
|
6903
|
+
id: `storyline-block-${(_j = block.id) !== null && _j !== void 0 ? _j : index}`,
|
|
6879
6904
|
name: `storyline-block-${index}`,
|
|
6880
6905
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
6881
6906
|
style: {
|
|
@@ -6902,11 +6927,11 @@
|
|
|
6902
6927
|
type: 'rect',
|
|
6903
6928
|
name: `storyline-block-image-bg-${index}`,
|
|
6904
6929
|
interactive: false,
|
|
6905
|
-
style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: 8
|
|
6930
|
+
style: Object.assign(Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), blockStyle)
|
|
6906
6931
|
}
|
|
6907
6932
|
: null,
|
|
6908
6933
|
hasImage
|
|
6909
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: '
|
|
6934
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_k = spec.image) === null || _k === void 0 ? void 0 : _k.style) })
|
|
6910
6935
|
: null,
|
|
6911
6936
|
{
|
|
6912
6937
|
type: 'path',
|
|
@@ -6932,26 +6957,22 @@
|
|
|
6932
6957
|
}
|
|
6933
6958
|
},
|
|
6934
6959
|
block.title
|
|
6935
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, fontSize: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (
|
|
6960
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, height: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, heightLimit: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_l = spec.title) === null || _l === void 0 ? void 0 : _l.style) })
|
|
6936
6961
|
: null,
|
|
6937
6962
|
contentText.length
|
|
6938
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), {
|
|
6939
|
-
fontSize: LANDSCAPE_CONTENT_FONT_SIZE,
|
|
6940
|
-
lineHeight: LANDSCAPE_CONTENT_LINE_HEIGHT,
|
|
6941
|
-
fill: '#596173'
|
|
6942
|
-
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_t = spec.content) === null || _t === void 0 ? void 0 : _t.style) })
|
|
6963
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).contentBox.x, y: (_d, ctx) => getMetrics(ctx).contentBox.y, width: (_d, ctx) => getMetrics(ctx).contentBox.width, height: (_d, ctx) => getMetrics(ctx).contentBox.height, maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width, heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height, text: buildPlainContent(contentText), fontSize: (_d, ctx) => getMetrics(ctx).contentFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).contentLineHeight, textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_m = spec.content) === null || _m === void 0 ? void 0 : _m.style) })
|
|
6943
6964
|
: null
|
|
6944
6965
|
].filter(Boolean)
|
|
6945
6966
|
};
|
|
6946
6967
|
};
|
|
6947
6968
|
|
|
6948
6969
|
const PORTRAIT_AXIS_WIDTH = 96;
|
|
6949
|
-
const PORTRAIT_AXIS_PADDING =
|
|
6950
|
-
const PORTRAIT_MARKER_FONT_SIZE =
|
|
6951
|
-
const PORTRAIT_MARKER_LINE_HEIGHT =
|
|
6970
|
+
const PORTRAIT_AXIS_PADDING = 120;
|
|
6971
|
+
const PORTRAIT_MARKER_FONT_SIZE = 34;
|
|
6972
|
+
const PORTRAIT_MARKER_LINE_HEIGHT = 24;
|
|
6952
6973
|
const PORTRAIT_MARKER_AXIS_PADDING = 6;
|
|
6953
6974
|
const PORTRAIT_IMAGE_HEIGHT_RATIO = 0.6;
|
|
6954
|
-
const PORTRAIT_CONTENT_HEIGHT_RATIO = 1;
|
|
6975
|
+
const PORTRAIT_CONTENT_HEIGHT_RATIO = 1.25;
|
|
6955
6976
|
const PORTRAIT_IMAGE_GAP_FROM_AXIS = 24;
|
|
6956
6977
|
const PORTRAIT_SHADOW_OFFSET_X = 24;
|
|
6957
6978
|
const PORTRAIT_SHADOW_OFFSET_Y = 16;
|
|
@@ -6959,30 +6980,13 @@
|
|
|
6959
6980
|
const PORTRAIT_TEXT_GAP_FROM_IMAGE = 8;
|
|
6960
6981
|
const PORTRAIT_CONTENT_LINES = 3;
|
|
6961
6982
|
const PORTRAIT_TITLE_LINE_HEIGHT = 34;
|
|
6962
|
-
const PORTRAIT_CONTENT_LINE_HEIGHT =
|
|
6963
|
-
const PORTRAIT_CONTENT_FONT_SIZE =
|
|
6983
|
+
const PORTRAIT_CONTENT_LINE_HEIGHT = 23;
|
|
6984
|
+
const PORTRAIT_CONTENT_FONT_SIZE = 16;
|
|
6964
6985
|
const PORTRAIT_TITLE_TO_CONTENT_GAP = 4;
|
|
6965
|
-
const getPortraitAxisRect = (spec, ctx) => {
|
|
6966
|
-
const blocks = getLayout(spec, ctx).blocks;
|
|
6967
|
-
if (!blocks.length) {
|
|
6968
|
-
return { x: 0, y: 0, width: 0, height: 0 };
|
|
6969
|
-
}
|
|
6970
|
-
const firstCy = blocks[0].center.y;
|
|
6971
|
-
const lastCy = blocks[blocks.length - 1].center.y;
|
|
6972
|
-
const top = Math.min(firstCy, lastCy);
|
|
6973
|
-
const bottom = Math.max(firstCy, lastCy);
|
|
6974
|
-
const cx = blocks[0].center.x;
|
|
6975
|
-
return {
|
|
6976
|
-
x: cx - PORTRAIT_AXIS_WIDTH / 2,
|
|
6977
|
-
y: top - PORTRAIT_AXIS_PADDING,
|
|
6978
|
-
width: PORTRAIT_AXIS_WIDTH,
|
|
6979
|
-
height: bottom - top + PORTRAIT_AXIS_PADDING * 2
|
|
6980
|
-
};
|
|
6981
|
-
};
|
|
6982
6986
|
const buildPortraitAxisMark = (spec) => {
|
|
6983
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k
|
|
6984
|
-
const themeColor =
|
|
6985
|
-
const lineStyle = (
|
|
6987
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k;
|
|
6988
|
+
const themeColor = (_a = spec.themeColor) !== null && _a !== void 0 ? _a : '#e8543d';
|
|
6989
|
+
const lineStyle = (_c = (_b = spec.line) === null || _b === void 0 ? void 0 : _b.style) !== null && _c !== void 0 ? _c : {};
|
|
6986
6990
|
const defaultFill = {
|
|
6987
6991
|
gradient: 'linear',
|
|
6988
6992
|
x0: 0,
|
|
@@ -6994,11 +6998,9 @@
|
|
|
6994
6998
|
{ offset: 1, color: withAlpha(themeColor, 1) }
|
|
6995
6999
|
]
|
|
6996
7000
|
};
|
|
6997
|
-
const
|
|
6998
|
-
const markerLineHeight = Number((_j = (_h = (_g = spec.marker) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.lineHeight) !== null && _j !== void 0 ? _j : PORTRAIT_MARKER_LINE_HEIGHT);
|
|
6999
|
-
const markerVisible = ((_k = spec.marker) === null || _k === void 0 ? void 0 : _k.visible) !== false;
|
|
7001
|
+
const markerVisible = ((_e = spec.marker) === null || _e === void 0 ? void 0 : _e.visible) !== false;
|
|
7000
7002
|
const markerMarks = markerVisible
|
|
7001
|
-
? ((
|
|
7003
|
+
? ((_f = spec.data) !== null && _f !== void 0 ? _f : [])
|
|
7002
7004
|
.map((block, index) => {
|
|
7003
7005
|
var _a;
|
|
7004
7006
|
if (!block.marker) {
|
|
@@ -7018,15 +7020,21 @@
|
|
|
7018
7020
|
var _a, _b;
|
|
7019
7021
|
const lb = getLayout(spec, ctx).blocks[index];
|
|
7020
7022
|
return (_b = (_a = lb === null || lb === void 0 ? void 0 : lb.center) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : 0;
|
|
7021
|
-
}, text: {
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7023
|
+
}, text: (_d, ctx) => {
|
|
7024
|
+
var _a, _b, _c;
|
|
7025
|
+
const axis = getPortraitAxisRect(spec, ctx);
|
|
7026
|
+
const markerFontSize = resolveMarkerFontSize(spec, ctx, block.marker, axis.height / Math.max((_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 1, 1), PORTRAIT_MARKER_FONT_SIZE, [16, 38]);
|
|
7027
|
+
const markerLineHeight = resolveAdaptiveLineHeight(markerFontSize, (_c = spec.marker) === null || _c === void 0 ? void 0 : _c.style, PORTRAIT_MARKER_LINE_HEIGHT, 0.9);
|
|
7028
|
+
return {
|
|
7029
|
+
type: 'rich',
|
|
7030
|
+
text: block.marker.split('').map((char, i, arr) => ({
|
|
7031
|
+
text: char + (i < arr.length - 1 ? '\n' : ''),
|
|
7032
|
+
fontSize: markerFontSize,
|
|
7033
|
+
lineHeight: markerLineHeight,
|
|
7034
|
+
fill: '#fff',
|
|
7035
|
+
align: markerTextAlign
|
|
7036
|
+
}))
|
|
7037
|
+
};
|
|
7030
7038
|
}, fontWeight: 'bold', lineJoin: 'round', shadowColor: 'rgba(0, 0, 0, 0.3)', shadowBlur: 8, shadowOffsetX: 0, shadowOffsetY: 5, textAlign: markerTextAlign, textBaseline: 'middle' }, (_a = spec.marker) === null || _a === void 0 ? void 0 : _a.style) });
|
|
7031
7039
|
})
|
|
7032
7040
|
.filter(Boolean)
|
|
@@ -7041,10 +7049,10 @@
|
|
|
7041
7049
|
name: 'storyline-portrait-axis-rect',
|
|
7042
7050
|
interactive: false,
|
|
7043
7051
|
style: {
|
|
7044
|
-
fill: (
|
|
7045
|
-
stroke: (
|
|
7046
|
-
lineWidth: (
|
|
7047
|
-
cornerRadius: (
|
|
7052
|
+
fill: (_g = lineStyle.fill) !== null && _g !== void 0 ? _g : defaultFill,
|
|
7053
|
+
stroke: (_h = lineStyle.stroke) !== null && _h !== void 0 ? _h : false,
|
|
7054
|
+
lineWidth: (_j = lineStyle.lineWidth) !== null && _j !== void 0 ? _j : 0,
|
|
7055
|
+
cornerRadius: (_k = lineStyle.cornerRadius) !== null && _k !== void 0 ? _k : 0,
|
|
7048
7056
|
x: (_d, ctx) => getPortraitAxisRect(spec, ctx).x,
|
|
7049
7057
|
y: (_d, ctx) => getPortraitAxisRect(spec, ctx).y,
|
|
7050
7058
|
width: (_d, ctx) => getPortraitAxisRect(spec, ctx).width,
|
|
@@ -7055,18 +7063,19 @@
|
|
|
7055
7063
|
]
|
|
7056
7064
|
};
|
|
7057
7065
|
};
|
|
7058
|
-
const getPortraitMetrics = (spec, blockWidth, blockHeight, index) => {
|
|
7059
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r
|
|
7060
|
-
const
|
|
7061
|
-
const
|
|
7062
|
-
const contentFontSize = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.fontSize) !== null && _k !== void 0 ? _k : PORTRAIT_CONTENT_FONT_SIZE);
|
|
7063
|
-
const contentLineHeight = Number((_o = (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.lineHeight) !== null && _o !== void 0 ? _o : PORTRAIT_CONTENT_LINE_HEIGHT);
|
|
7066
|
+
const getPortraitMetrics = (spec, blockWidth, blockHeight, index, ctx) => {
|
|
7067
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
7068
|
+
const contentFontSize = Number((_c = (_b = (_a = spec.content) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : PORTRAIT_CONTENT_FONT_SIZE);
|
|
7069
|
+
const contentLineHeight = Number((_g = (_f = (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : PORTRAIT_CONTENT_LINE_HEIGHT);
|
|
7064
7070
|
const titleToContentGap = PORTRAIT_TITLE_TO_CONTENT_GAP;
|
|
7065
|
-
const imageWidth = (
|
|
7066
|
-
const imageHeight = (
|
|
7071
|
+
const imageWidth = (_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : Math.max(blockWidth, 80);
|
|
7072
|
+
const imageHeight = (_l = (_k = spec.image) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : Math.round(blockHeight * PORTRAIT_IMAGE_HEIGHT_RATIO);
|
|
7073
|
+
const titleFontSize = resolveTitleFontSize(spec, ctx, (_o = (_m = spec.data) === null || _m === void 0 ? void 0 : _m[index]) === null || _o === void 0 ? void 0 : _o.title, imageWidth, 26, [8, 34]);
|
|
7074
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_p = spec.title) === null || _p === void 0 ? void 0 : _p.style, PORTRAIT_TITLE_LINE_HEIGHT);
|
|
7075
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_r = (_q = spec.data) === null || _q === void 0 ? void 0 : _q[index]) === null || _r === void 0 ? void 0 : _r.title);
|
|
7067
7076
|
const minContentHeight = PORTRAIT_CONTENT_LINES * contentLineHeight;
|
|
7068
7077
|
const contentHeight = Math.max(minContentHeight, Math.round(blockHeight * PORTRAIT_CONTENT_HEIGHT_RATIO));
|
|
7069
|
-
const textHeight =
|
|
7078
|
+
const textHeight = titleHeight + titleToContentGap + contentHeight;
|
|
7070
7079
|
const onLeft = index % 2 === 0;
|
|
7071
7080
|
const axisHalf = PORTRAIT_AXIS_WIDTH / 2;
|
|
7072
7081
|
const imageX = onLeft
|
|
@@ -7078,7 +7087,7 @@
|
|
|
7078
7087
|
const textWidth = imageWidth;
|
|
7079
7088
|
const contentBox = {
|
|
7080
7089
|
x: textX,
|
|
7081
|
-
y: textY +
|
|
7090
|
+
y: textY + titleHeight + titleToContentGap,
|
|
7082
7091
|
width: textWidth,
|
|
7083
7092
|
height: contentHeight
|
|
7084
7093
|
};
|
|
@@ -7107,25 +7116,44 @@
|
|
|
7107
7116
|
contentBox
|
|
7108
7117
|
};
|
|
7109
7118
|
};
|
|
7119
|
+
const getPortraitAxisRect = (spec, ctx) => {
|
|
7120
|
+
const blocks = getLayout(spec, ctx).blocks;
|
|
7121
|
+
if (!blocks.length) {
|
|
7122
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
7123
|
+
}
|
|
7124
|
+
let top = Number.POSITIVE_INFINITY;
|
|
7125
|
+
let bottom = Number.NEGATIVE_INFINITY;
|
|
7126
|
+
blocks.forEach((block, index) => {
|
|
7127
|
+
const metrics = getPortraitMetrics(spec, block.width, block.height, index, ctx);
|
|
7128
|
+
const localTop = Math.min(metrics.imageBox.y, metrics.shadowBox.y, metrics.textBox.y, metrics.contentBox.y);
|
|
7129
|
+
const localBottom = Math.max(metrics.imageBox.y + metrics.imageBox.height, metrics.shadowBox.y + metrics.shadowBox.height, metrics.textBox.y + metrics.textBox.height, metrics.contentBox.y + metrics.contentBox.height);
|
|
7130
|
+
top = Math.min(top, block.center.y + localTop);
|
|
7131
|
+
bottom = Math.max(bottom, block.center.y + localBottom);
|
|
7132
|
+
});
|
|
7133
|
+
const cx = blocks[0].center.x;
|
|
7134
|
+
return {
|
|
7135
|
+
x: cx - PORTRAIT_AXIS_WIDTH / 2,
|
|
7136
|
+
y: top - PORTRAIT_AXIS_PADDING,
|
|
7137
|
+
width: PORTRAIT_AXIS_WIDTH,
|
|
7138
|
+
height: bottom - top + PORTRAIT_AXIS_PADDING * 2
|
|
7139
|
+
};
|
|
7140
|
+
};
|
|
7110
7141
|
const buildPortraitBlockMark = (spec, block, index) => {
|
|
7111
|
-
var _a, _b, _c, _e, _f, _g
|
|
7142
|
+
var _a, _b, _c, _e, _f, _g;
|
|
7112
7143
|
const hasImage = !!block.image;
|
|
7113
7144
|
const hasSubImage = !!block.subImage;
|
|
7114
7145
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7115
|
-
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 26);
|
|
7116
|
-
const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.max(PORTRAIT_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
|
|
7117
7146
|
const getMetrics = (ctx) => {
|
|
7118
7147
|
var _a, _b, _c, _e;
|
|
7119
7148
|
const lb = getLayout(spec, ctx).blocks[index];
|
|
7120
7149
|
const w = (_a = lb === null || lb === void 0 ? void 0 : lb.width) !== null && _a !== void 0 ? _a : resolveBlockWidth(spec, 0);
|
|
7121
7150
|
const h = (_e = (_b = lb === null || lb === void 0 ? void 0 : lb.height) !== null && _b !== void 0 ? _b : (_c = spec.block) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : DEFAULT_BLOCK_HEIGHT;
|
|
7122
|
-
return getPortraitMetrics(spec, w, h, index);
|
|
7151
|
+
return getPortraitMetrics(spec, w, h, index, ctx);
|
|
7123
7152
|
};
|
|
7124
|
-
const
|
|
7125
|
-
const blockStyle = (_j = (_h = spec.block) === null || _h === void 0 ? void 0 : _h.style) !== null && _j !== void 0 ? _j : {};
|
|
7153
|
+
const blockStyle = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
|
|
7126
7154
|
return {
|
|
7127
7155
|
type: 'group',
|
|
7128
|
-
id: `storyline-block-${(
|
|
7156
|
+
id: `storyline-block-${(_c = block.id) !== null && _c !== void 0 ? _c : index}`,
|
|
7129
7157
|
name: `storyline-block-${index}`,
|
|
7130
7158
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7131
7159
|
style: {
|
|
@@ -7154,7 +7182,7 @@
|
|
|
7154
7182
|
image: block.subImage,
|
|
7155
7183
|
repeatX: 'no-repeat',
|
|
7156
7184
|
repeatY: 'no-repeat',
|
|
7157
|
-
imageMode: '
|
|
7185
|
+
imageMode: 'contain',
|
|
7158
7186
|
imagePosition: 'center'
|
|
7159
7187
|
}
|
|
7160
7188
|
}
|
|
@@ -7164,21 +7192,17 @@
|
|
|
7164
7192
|
type: 'rect',
|
|
7165
7193
|
name: `storyline-block-image-bg-${index}`,
|
|
7166
7194
|
interactive: false,
|
|
7167
|
-
style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: 8
|
|
7195
|
+
style: Object.assign(Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), blockStyle)
|
|
7168
7196
|
}
|
|
7169
7197
|
: null,
|
|
7170
7198
|
hasImage
|
|
7171
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: '
|
|
7199
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_e = spec.image) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7172
7200
|
: null,
|
|
7173
7201
|
block.title
|
|
7174
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, fontSize: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (
|
|
7202
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, height: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, heightLimit: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
|
|
7175
7203
|
: null,
|
|
7176
7204
|
contentText.length
|
|
7177
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), {
|
|
7178
|
-
fontSize: PORTRAIT_CONTENT_FONT_SIZE,
|
|
7179
|
-
lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT,
|
|
7180
|
-
fill: '#596173'
|
|
7181
|
-
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style) })
|
|
7205
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).contentBox.x, y: (_d, ctx) => getMetrics(ctx).contentBox.y, width: (_d, ctx) => getMetrics(ctx).contentBox.width, height: (_d, ctx) => getMetrics(ctx).contentBox.height, maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width, heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height, text: buildPlainContent(contentText), fontSize: PORTRAIT_CONTENT_FONT_SIZE, lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
|
|
7182
7206
|
: null
|
|
7183
7207
|
].filter(Boolean)
|
|
7184
7208
|
};
|
|
@@ -7190,30 +7214,32 @@
|
|
|
7190
7214
|
const ARC_TEXT_GAP_FROM_IMAGE = 10;
|
|
7191
7215
|
const ARC_TITLE_FONT_SIZE = 32;
|
|
7192
7216
|
const ARC_TITLE_LINE_HEIGHT = 34;
|
|
7193
|
-
const ARC_CONTENT_LINE_HEIGHT =
|
|
7194
|
-
const ARC_CONTENT_FONT_SIZE =
|
|
7217
|
+
const ARC_CONTENT_LINE_HEIGHT = 24;
|
|
7218
|
+
const ARC_CONTENT_FONT_SIZE = 18;
|
|
7195
7219
|
const ARC_TEXT_BOX_HEIGHT = 240;
|
|
7196
7220
|
const ARC_TITLE_TO_CONTENT_GAP = 4;
|
|
7197
7221
|
const ARC_TEXT_PADDING = 20;
|
|
7198
7222
|
const ARC_TEXT_BOX_MIN_WIDTH = 240;
|
|
7199
|
-
const
|
|
7200
|
-
const
|
|
7201
|
-
const
|
|
7223
|
+
const ARC_TITLE_IMAGE_WIDTH_RATIO = 0.68;
|
|
7224
|
+
const ARC_TITLE_IMAGE_MAX_WIDTH = 900;
|
|
7225
|
+
const ARC_TITLE_IMAGE_HEIGHT_RATIO = 0.34;
|
|
7226
|
+
const ARC_GAP_FROM_TITLE_IMAGE = 200;
|
|
7227
|
+
const ARC_FIT_MARGIN = 8;
|
|
7202
7228
|
const isDownArc = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7203
|
-
const
|
|
7229
|
+
const getArcTitleImageRect = (spec, ctx) => {
|
|
7204
7230
|
var _a, _b, _c, _e;
|
|
7205
7231
|
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
7206
7232
|
const innerWidth = Math.max(width, 1);
|
|
7207
7233
|
const innerHeight = Math.max(height, 1);
|
|
7208
|
-
const
|
|
7209
|
-
const w = Math.max((_b = (_a = spec.
|
|
7210
|
-
const h = Math.max((_e = (_c = spec.
|
|
7234
|
+
const baseWidth = Math.min(innerWidth * ARC_TITLE_IMAGE_WIDTH_RATIO, ARC_TITLE_IMAGE_MAX_WIDTH);
|
|
7235
|
+
const w = Math.max((_b = (_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : baseWidth, 80);
|
|
7236
|
+
const h = Math.max((_e = (_c = spec.titleImage) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : w * ARC_TITLE_IMAGE_HEIGHT_RATIO, 40);
|
|
7211
7237
|
const cx = startX + innerWidth / 2;
|
|
7212
7238
|
const isDown = isDownArc(spec);
|
|
7213
7239
|
const top = isDown ? startY : startY + innerHeight - h;
|
|
7214
7240
|
return { x: cx - w / 2, y: top, width: w, height: h };
|
|
7215
7241
|
};
|
|
7216
|
-
const
|
|
7242
|
+
const getBaseArcGeometry = (spec, ctx) => {
|
|
7217
7243
|
var _a, _b, _c;
|
|
7218
7244
|
const { width, startX } = getRegionGeometry(ctx);
|
|
7219
7245
|
const innerWidth = Math.max(width, 1);
|
|
@@ -7224,20 +7250,20 @@
|
|
|
7224
7250
|
const endAngle = (_b = layoutOpt.endAngle) !== null && _b !== void 0 ? _b : (isDown ? 160 : 340);
|
|
7225
7251
|
const ratio = (_c = layoutOpt.radiusRatio) !== null && _c !== void 0 ? _c : 0.88;
|
|
7226
7252
|
const rx = Math.max((innerWidth - blockWidth) / 2, 1) * ratio;
|
|
7227
|
-
const
|
|
7228
|
-
const centerTop =
|
|
7229
|
-
const centerBottom =
|
|
7253
|
+
const titleImageRect = getArcTitleImageRect(spec, ctx);
|
|
7254
|
+
const centerTop = titleImageRect.y;
|
|
7255
|
+
const centerBottom = titleImageRect.y + titleImageRect.height;
|
|
7230
7256
|
const sinStart = Math.sin((startAngle / 180) * Math.PI);
|
|
7231
7257
|
let cy;
|
|
7232
7258
|
let ry;
|
|
7233
7259
|
if (isDown) {
|
|
7234
7260
|
const denom = Math.max(1 - sinStart, 0.05);
|
|
7235
|
-
ry = (
|
|
7261
|
+
ry = (titleImageRect.height + ARC_GAP_FROM_TITLE_IMAGE) / denom;
|
|
7236
7262
|
cy = centerTop - ry * sinStart;
|
|
7237
7263
|
}
|
|
7238
7264
|
else {
|
|
7239
7265
|
const denom = Math.max(1 + sinStart, 0.05);
|
|
7240
|
-
ry = (
|
|
7266
|
+
ry = (titleImageRect.height + ARC_GAP_FROM_TITLE_IMAGE) / denom;
|
|
7241
7267
|
cy = centerBottom - ry * sinStart;
|
|
7242
7268
|
}
|
|
7243
7269
|
return {
|
|
@@ -7251,9 +7277,8 @@
|
|
|
7251
7277
|
centerBottom
|
|
7252
7278
|
};
|
|
7253
7279
|
};
|
|
7254
|
-
const
|
|
7280
|
+
const getArcBlockCenterByGeometry = (spec, arc, index) => {
|
|
7255
7281
|
var _a, _b, _c, _e;
|
|
7256
|
-
const arc = getArcGeometry(spec, ctx);
|
|
7257
7282
|
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7258
7283
|
if (count <= 0) {
|
|
7259
7284
|
return { x: arc.cx, y: arc.cy };
|
|
@@ -7271,6 +7296,76 @@
|
|
|
7271
7296
|
const offset = imageHeight / 2;
|
|
7272
7297
|
return { x: px + nx * offset, y: py + ny * offset };
|
|
7273
7298
|
};
|
|
7299
|
+
const getArcBlockBounds = (spec, arc, index) => {
|
|
7300
|
+
const center = getArcBlockCenterByGeometry(spec, arc, index);
|
|
7301
|
+
const metrics = getArcBlockMetrics(spec, index);
|
|
7302
|
+
const halo = shouldShowImageBackground(spec) ? ARC_BLOCK_IMAGE_HALO_PADDING + ARC_BLOCK_IMAGE_BORDER : 0;
|
|
7303
|
+
const minX = Math.min(metrics.imageBox.x - halo, metrics.textBox.x, metrics.contentBox.x);
|
|
7304
|
+
const maxX = Math.max(metrics.imageBox.x + metrics.imageBox.width + halo, metrics.textBox.x + metrics.textBox.width, metrics.contentBox.x + metrics.contentBox.width);
|
|
7305
|
+
const minY = Math.min(metrics.imageBox.y - halo, metrics.textBox.y, metrics.contentBox.y);
|
|
7306
|
+
const maxY = Math.max(metrics.imageBox.y + metrics.imageBox.height + halo, metrics.textBox.y + metrics.textBox.height, metrics.contentBox.y + metrics.contentBox.height);
|
|
7307
|
+
return {
|
|
7308
|
+
left: center.x + minX,
|
|
7309
|
+
right: center.x + maxX,
|
|
7310
|
+
top: center.y + minY,
|
|
7311
|
+
bottom: center.y + maxY
|
|
7312
|
+
};
|
|
7313
|
+
};
|
|
7314
|
+
const getArcBlocksBounds = (spec, arc) => {
|
|
7315
|
+
var _a, _b;
|
|
7316
|
+
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7317
|
+
if (!count) {
|
|
7318
|
+
return { left: arc.cx, right: arc.cx, top: arc.cy, bottom: arc.cy };
|
|
7319
|
+
}
|
|
7320
|
+
return Array.from({ length: count }, (_, index) => getArcBlockBounds(spec, arc, index)).reduce((bounds, blockBounds) => ({
|
|
7321
|
+
left: Math.min(bounds.left, blockBounds.left),
|
|
7322
|
+
right: Math.max(bounds.right, blockBounds.right),
|
|
7323
|
+
top: Math.min(bounds.top, blockBounds.top),
|
|
7324
|
+
bottom: Math.max(bounds.bottom, blockBounds.bottom)
|
|
7325
|
+
}), {
|
|
7326
|
+
left: Number.POSITIVE_INFINITY,
|
|
7327
|
+
right: Number.NEGATIVE_INFINITY,
|
|
7328
|
+
top: Number.POSITIVE_INFINITY,
|
|
7329
|
+
bottom: Number.NEGATIVE_INFINITY
|
|
7330
|
+
});
|
|
7331
|
+
};
|
|
7332
|
+
const getArcGeometry = (spec, ctx) => {
|
|
7333
|
+
const arc = getBaseArcGeometry(spec, ctx);
|
|
7334
|
+
const region = getRegionGeometry(ctx);
|
|
7335
|
+
const bounds = getArcBlocksBounds(spec, arc);
|
|
7336
|
+
const fit = {
|
|
7337
|
+
left: region.startX + ARC_FIT_MARGIN,
|
|
7338
|
+
right: region.startX + region.width - ARC_FIT_MARGIN,
|
|
7339
|
+
top: region.startY + ARC_FIT_MARGIN,
|
|
7340
|
+
bottom: region.startY + region.height - ARC_FIT_MARGIN
|
|
7341
|
+
};
|
|
7342
|
+
let shiftX = 0;
|
|
7343
|
+
let shiftY = 0;
|
|
7344
|
+
const boundsWidth = bounds.right - bounds.left;
|
|
7345
|
+
const boundsHeight = bounds.bottom - bounds.top;
|
|
7346
|
+
const fitWidth = fit.right - fit.left;
|
|
7347
|
+
const fitHeight = fit.bottom - fit.top;
|
|
7348
|
+
if (boundsWidth > fitWidth) {
|
|
7349
|
+
shiftX = (fit.left + fit.right - bounds.left - bounds.right) / 2;
|
|
7350
|
+
}
|
|
7351
|
+
else if (bounds.left < fit.left) {
|
|
7352
|
+
shiftX = fit.left - bounds.left;
|
|
7353
|
+
}
|
|
7354
|
+
else if (bounds.right > fit.right) {
|
|
7355
|
+
shiftX = fit.right - bounds.right;
|
|
7356
|
+
}
|
|
7357
|
+
if (boundsHeight > fitHeight) {
|
|
7358
|
+
shiftY = (fit.top + fit.bottom - bounds.top - bounds.bottom) / 2;
|
|
7359
|
+
}
|
|
7360
|
+
else if (bounds.top < fit.top) {
|
|
7361
|
+
shiftY = fit.top - bounds.top;
|
|
7362
|
+
}
|
|
7363
|
+
else if (bounds.bottom > fit.bottom) {
|
|
7364
|
+
shiftY = fit.bottom - bounds.bottom;
|
|
7365
|
+
}
|
|
7366
|
+
return shiftX || shiftY ? Object.assign(Object.assign({}, arc), { cx: arc.cx + shiftX, cy: arc.cy + shiftY }) : arc;
|
|
7367
|
+
};
|
|
7368
|
+
const getArcBlockCenter = (spec, ctx, index) => getArcBlockCenterByGeometry(spec, getArcGeometry(spec, ctx), index);
|
|
7274
7369
|
const buildArcMark = (spec) => {
|
|
7275
7370
|
var _a;
|
|
7276
7371
|
if (((_a = spec.line) === null || _a === void 0 ? void 0 : _a.visible) !== true) {
|
|
@@ -7311,121 +7406,46 @@
|
|
|
7311
7406
|
]
|
|
7312
7407
|
};
|
|
7313
7408
|
};
|
|
7314
|
-
const
|
|
7315
|
-
var _a
|
|
7316
|
-
|
|
7317
|
-
if (!visible) {
|
|
7409
|
+
const buildArcTitleImageMark = (spec) => {
|
|
7410
|
+
var _a;
|
|
7411
|
+
if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
|
|
7318
7412
|
return null;
|
|
7319
7413
|
}
|
|
7320
|
-
const themeColor = getThemeColor(spec);
|
|
7321
|
-
const hasImage = !!((_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.image);
|
|
7322
|
-
const symbolGradient = {
|
|
7323
|
-
gradient: 'linear',
|
|
7324
|
-
x0: 0.5,
|
|
7325
|
-
y0: 0,
|
|
7326
|
-
x1: 0.5,
|
|
7327
|
-
y1: 1,
|
|
7328
|
-
stops: [
|
|
7329
|
-
{ offset: 0, color: withAlpha(themeColor, 0.15) },
|
|
7330
|
-
{ offset: 1, color: themeColor }
|
|
7331
|
-
]
|
|
7332
|
-
};
|
|
7333
7414
|
return {
|
|
7334
7415
|
type: 'group',
|
|
7335
|
-
name: 'storyline-arc-
|
|
7336
|
-
zIndex: vchart.LayoutZIndex.Mark,
|
|
7416
|
+
name: 'storyline-arc-title-image',
|
|
7417
|
+
zIndex: vchart.LayoutZIndex.Mark + 6,
|
|
7337
7418
|
children: [
|
|
7338
|
-
{
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
return
|
|
7346
|
-
},
|
|
7347
|
-
|
|
7348
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7349
|
-
return r.y + r.height / 2;
|
|
7350
|
-
},
|
|
7351
|
-
size: (_d, ctx) => {
|
|
7352
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7353
|
-
return Math.max(r.width, r.height);
|
|
7354
|
-
},
|
|
7355
|
-
symbolType: 'circle',
|
|
7356
|
-
fill: hasImage ? symbolGradient : '#ffffff',
|
|
7357
|
-
stroke: themeColor,
|
|
7358
|
-
lineWidth: 2
|
|
7359
|
-
}
|
|
7360
|
-
},
|
|
7361
|
-
hasImage
|
|
7362
|
-
? Object.assign(Object.assign({ type: 'image', name: 'storyline-arc-center-image', interactive: false }, spec.centerImage), { style: Object.assign({ x: (_d, ctx) => {
|
|
7363
|
-
var _a, _b;
|
|
7364
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7365
|
-
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7366
|
-
const w = typeof userWidth === 'number'
|
|
7367
|
-
? userWidth
|
|
7368
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7369
|
-
return r.x + (r.width - w) / 2;
|
|
7370
|
-
}, y: (_d, ctx) => {
|
|
7371
|
-
var _a, _b;
|
|
7372
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7373
|
-
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
7374
|
-
const h = typeof userHeight === 'number'
|
|
7375
|
-
? userHeight
|
|
7376
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7377
|
-
return r.y + (r.height - h) / 2;
|
|
7378
|
-
}, width: (_d, ctx) => {
|
|
7379
|
-
var _a, _b;
|
|
7380
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7381
|
-
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7382
|
-
return typeof userWidth === 'number'
|
|
7383
|
-
? userWidth
|
|
7384
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7385
|
-
}, height: (_d, ctx) => {
|
|
7386
|
-
var _a, _b;
|
|
7387
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7388
|
-
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
7389
|
-
return typeof userHeight === 'number'
|
|
7390
|
-
? userHeight
|
|
7391
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7392
|
-
}, cornerRadius: (_d, ctx) => {
|
|
7393
|
-
var _a, _b, _c, _e;
|
|
7394
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7395
|
-
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7396
|
-
const userHeight = (_e = (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.style) === null || _e === void 0 ? void 0 : _e.height;
|
|
7397
|
-
const w = typeof userWidth === 'number'
|
|
7398
|
-
? userWidth
|
|
7399
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7400
|
-
const h = typeof userHeight === 'number'
|
|
7401
|
-
? userHeight
|
|
7402
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7403
|
-
return Math.max(w, h) / 2;
|
|
7404
|
-
}, image: (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center', anchor: (_d, ctx) => {
|
|
7405
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7406
|
-
return [r.x + r.width / 2, r.y + r.height / 2];
|
|
7407
|
-
} }, (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7408
|
-
: null
|
|
7409
|
-
].filter(Boolean)
|
|
7419
|
+
Object.assign(Object.assign({ type: 'image', name: 'storyline-arc-title-image-node', interactive: false }, spec.titleImage), { style: Object.assign({ x: (_d, ctx) => {
|
|
7420
|
+
return getArcTitleImageRect(spec, ctx).x;
|
|
7421
|
+
}, y: (_d, ctx) => {
|
|
7422
|
+
return getArcTitleImageRect(spec, ctx).y;
|
|
7423
|
+
}, width: (_d, ctx) => {
|
|
7424
|
+
return getArcTitleImageRect(spec, ctx).width;
|
|
7425
|
+
}, height: (_d, ctx) => {
|
|
7426
|
+
return getArcTitleImageRect(spec, ctx).height;
|
|
7427
|
+
}, image: spec.titleImage.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, spec.titleImage.style) })
|
|
7428
|
+
]
|
|
7410
7429
|
};
|
|
7411
7430
|
};
|
|
7412
7431
|
const getArcBlockMetrics = (spec, index = 0) => {
|
|
7413
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w
|
|
7414
|
-
const
|
|
7415
|
-
const
|
|
7416
|
-
const contentFontSize = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.fontSize) !== null && _k !== void 0 ? _k : ARC_CONTENT_FONT_SIZE);
|
|
7417
|
-
const contentLineHeight = Number((_o = (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.lineHeight) !== null && _o !== void 0 ? _o : ARC_CONTENT_LINE_HEIGHT);
|
|
7432
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
7433
|
+
const contentFontSize = Number((_c = (_b = (_a = spec.content) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : ARC_CONTENT_FONT_SIZE);
|
|
7434
|
+
const contentLineHeight = Number((_g = (_f = (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : ARC_CONTENT_LINE_HEIGHT);
|
|
7418
7435
|
const titleToContentGap = ARC_TITLE_TO_CONTENT_GAP;
|
|
7419
|
-
const
|
|
7420
|
-
const contentHeight = Math.max(textHeight - titleLineHeight - titleToContentGap, contentLineHeight);
|
|
7421
|
-
const imageDiameter = Math.max((_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : ARC_BLOCK_IMAGE_SIZE, (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : ARC_BLOCK_IMAGE_SIZE);
|
|
7436
|
+
const imageDiameter = Math.max((_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : ARC_BLOCK_IMAGE_SIZE, (_l = (_k = spec.image) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : ARC_BLOCK_IMAGE_SIZE);
|
|
7422
7437
|
const imageWidth = imageDiameter;
|
|
7423
7438
|
const imageHeight = imageDiameter;
|
|
7424
7439
|
const isDown = isDownArc(spec);
|
|
7425
|
-
const count = Math.max((
|
|
7426
|
-
const canvasWidth = Number((
|
|
7440
|
+
const count = Math.max((_o = (_m = spec.data) === null || _m === void 0 ? void 0 : _m.length) !== null && _o !== void 0 ? _o : 0, 1);
|
|
7441
|
+
const canvasWidth = Number((_p = spec.width) !== null && _p !== void 0 ? _p : imageWidth * count);
|
|
7427
7442
|
const defaultTextWidth = Math.round(canvasWidth / (count + 1));
|
|
7428
|
-
const textBoxWidth = Math.max(Number((
|
|
7443
|
+
const textBoxWidth = Math.max(Number((_r = (_q = spec.block) === null || _q === void 0 ? void 0 : _q.width) !== null && _r !== void 0 ? _r : defaultTextWidth), ARC_TEXT_BOX_MIN_WIDTH);
|
|
7444
|
+
const titleFontSize = resolveTitleFontSize(spec, undefined, (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t.title, textBoxWidth, ARC_TITLE_FONT_SIZE, [8, 40]);
|
|
7445
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_u = spec.title) === null || _u === void 0 ? void 0 : _u.style, ARC_TITLE_LINE_HEIGHT);
|
|
7446
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_w = (_v = spec.data) === null || _v === void 0 ? void 0 : _v[index]) === null || _w === void 0 ? void 0 : _w.title);
|
|
7447
|
+
const textHeight = ARC_TEXT_BOX_HEIGHT;
|
|
7448
|
+
const contentHeight = Math.max(textHeight - titleHeight - titleToContentGap, contentLineHeight);
|
|
7429
7449
|
const isLeftSide = index < count / 2;
|
|
7430
7450
|
const textAlign = isLeftSide ? 'right' : 'left';
|
|
7431
7451
|
const imageBox = {
|
|
@@ -7443,7 +7463,7 @@
|
|
|
7443
7463
|
};
|
|
7444
7464
|
const contentBox = {
|
|
7445
7465
|
x: textBox.x,
|
|
7446
|
-
y: textBox.y +
|
|
7466
|
+
y: textBox.y + titleHeight + titleToContentGap,
|
|
7447
7467
|
width: textBox.width,
|
|
7448
7468
|
height: contentHeight
|
|
7449
7469
|
};
|
|
@@ -7495,21 +7515,13 @@
|
|
|
7495
7515
|
}
|
|
7496
7516
|
},
|
|
7497
7517
|
hasImage
|
|
7498
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 3 }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: '
|
|
7518
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 3 }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
|
|
7499
7519
|
: {
|
|
7500
7520
|
type: 'symbol',
|
|
7501
7521
|
name: `storyline-block-image-bg-${index}`,
|
|
7502
7522
|
interactive: false,
|
|
7503
7523
|
zIndex: vchart.LayoutZIndex.Mark + 3,
|
|
7504
|
-
style: {
|
|
7505
|
-
x: 0,
|
|
7506
|
-
y: 0,
|
|
7507
|
-
size: Math.min(metrics.imageBox.width, metrics.imageBox.height),
|
|
7508
|
-
symbolType: 'circle',
|
|
7509
|
-
fill: '#ffffff',
|
|
7510
|
-
stroke: themeColor,
|
|
7511
|
-
lineWidth: 2
|
|
7512
|
-
}
|
|
7524
|
+
style: Object.assign({ x: 0, y: 0, size: Math.min(metrics.imageBox.width, metrics.imageBox.height), symbolType: 'circle' }, getImageBackgroundStyle(spec))
|
|
7513
7525
|
},
|
|
7514
7526
|
shouldShowImageBackground(spec)
|
|
7515
7527
|
? {
|
|
@@ -7523,21 +7535,16 @@
|
|
|
7523
7535
|
size: Math.min(metrics.imageBox.width, metrics.imageBox.height) + ARC_BLOCK_IMAGE_HALO_PADDING * 2,
|
|
7524
7536
|
symbolType: 'circle',
|
|
7525
7537
|
fill: 'transparent',
|
|
7526
|
-
stroke: themeColor,
|
|
7538
|
+
stroke: withAlpha(themeColor, 0.82),
|
|
7527
7539
|
lineWidth: ARC_BLOCK_IMAGE_BORDER
|
|
7528
7540
|
}
|
|
7529
7541
|
}
|
|
7530
7542
|
: null,
|
|
7531
7543
|
block.title
|
|
7532
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 5 }, spec.title), { style: Object.assign({ x: metrics.textBox.x, y: metrics.textBox.y, text: block.title, maxLineWidth: metrics.textBox.width, fontSize: metrics.titleFontSize, lineHeight: metrics.titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: metrics.textAlign, textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7544
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 5 }, spec.title), { style: Object.assign({ x: metrics.textBox.x, y: metrics.textBox.y, text: block.title, maxLineWidth: metrics.textBox.width, height: metrics.titleLineHeight * BLOCK_TITLE_MAX_LINES, heightLimit: metrics.titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: metrics.titleFontSize, lineHeight: metrics.titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: metrics.textAlign, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7533
7545
|
: null,
|
|
7534
7546
|
contentText.length
|
|
7535
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 4 }, spec.content), {
|
|
7536
|
-
fontSize: metrics.contentFontSize,
|
|
7537
|
-
lineHeight: metrics.contentLineHeight,
|
|
7538
|
-
fill: '#596173',
|
|
7539
|
-
align: metrics.textAlign
|
|
7540
|
-
}), textAlign: metrics.textAlign, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7547
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 4 }, spec.content), { style: Object.assign({ x: metrics.contentBox.x, y: metrics.contentBox.y, width: metrics.contentBox.width, height: metrics.contentBox.height, maxLineWidth: metrics.contentBox.width, heightLimit: metrics.contentBox.height, text: buildPlainContent(contentText), fontSize: metrics.contentFontSize, lineHeight: metrics.contentLineHeight, textAlign: metrics.textAlign, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7541
7548
|
: null
|
|
7542
7549
|
].filter(Boolean)
|
|
7543
7550
|
};
|
|
@@ -7551,9 +7558,10 @@
|
|
|
7551
7558
|
const WING_TEXT_BOX_WIDTH = 240;
|
|
7552
7559
|
const WING_TEXT_BOX_HEIGHT = 110;
|
|
7553
7560
|
const WING_TITLE_TO_CONTENT_GAP = 4;
|
|
7561
|
+
const WING_TITLE_IMAGE_WIDTH_RATIO = 0.6;
|
|
7562
|
+
const WING_TITLE_IMAGE_MAX_WIDTH = 820;
|
|
7554
7563
|
const getWingDirection = (spec) => {
|
|
7555
|
-
|
|
7556
|
-
return (_a = normalizeLayout(spec.layout).direction) !== null && _a !== void 0 ? _a : 'left';
|
|
7564
|
+
return normalizeLayout(spec.layout).direction === 'right' ? 'right' : 'left';
|
|
7557
7565
|
};
|
|
7558
7566
|
const getWingArcGeometry = (spec, ctx) => {
|
|
7559
7567
|
var _a, _b, _c;
|
|
@@ -7652,18 +7660,54 @@
|
|
|
7652
7660
|
]
|
|
7653
7661
|
};
|
|
7654
7662
|
};
|
|
7663
|
+
const buildWingTitleImageMark = (spec) => {
|
|
7664
|
+
var _a;
|
|
7665
|
+
if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
|
|
7666
|
+
return null;
|
|
7667
|
+
}
|
|
7668
|
+
return {
|
|
7669
|
+
type: 'group',
|
|
7670
|
+
name: 'storyline-wing-title-image',
|
|
7671
|
+
zIndex: vchart.LayoutZIndex.Mark + 8,
|
|
7672
|
+
children: [
|
|
7673
|
+
Object.assign(Object.assign({ type: 'image', name: 'storyline-wing-title-image-node', interactive: false }, spec.titleImage), { style: Object.assign({ x: (_d, ctx) => {
|
|
7674
|
+
const { width, height, startX } = getChartGeometry(ctx, spec);
|
|
7675
|
+
const size = getTitleImageSize(spec, width, height, {
|
|
7676
|
+
widthRatio: WING_TITLE_IMAGE_WIDTH_RATIO,
|
|
7677
|
+
maxWidth: WING_TITLE_IMAGE_MAX_WIDTH
|
|
7678
|
+
});
|
|
7679
|
+
return getWingDirection(spec) === 'right' ? startX : startX + width - size.width;
|
|
7680
|
+
}, y: (_d, ctx) => {
|
|
7681
|
+
return getChartGeometry(ctx, spec).startY + 12;
|
|
7682
|
+
}, width: (_d, ctx) => {
|
|
7683
|
+
const { width, height } = getChartGeometry(ctx, spec);
|
|
7684
|
+
return getTitleImageSize(spec, width, height, {
|
|
7685
|
+
widthRatio: WING_TITLE_IMAGE_WIDTH_RATIO,
|
|
7686
|
+
maxWidth: WING_TITLE_IMAGE_MAX_WIDTH
|
|
7687
|
+
}).width;
|
|
7688
|
+
}, height: (_d, ctx) => {
|
|
7689
|
+
const { width, height } = getChartGeometry(ctx, spec);
|
|
7690
|
+
return getTitleImageSize(spec, width, height, {
|
|
7691
|
+
widthRatio: WING_TITLE_IMAGE_WIDTH_RATIO,
|
|
7692
|
+
maxWidth: WING_TITLE_IMAGE_MAX_WIDTH
|
|
7693
|
+
}).height;
|
|
7694
|
+
}, image: spec.titleImage.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, spec.titleImage.style) })
|
|
7695
|
+
]
|
|
7696
|
+
};
|
|
7697
|
+
};
|
|
7655
7698
|
const WING_TEXT_IMAGE_GAP = 120;
|
|
7656
7699
|
const getWingBlockMetrics = (spec, ctx, index) => {
|
|
7657
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t
|
|
7658
|
-
const titleFontSize =
|
|
7659
|
-
const titleLineHeight =
|
|
7660
|
-
const
|
|
7661
|
-
const
|
|
7700
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
7701
|
+
const titleFontSize = resolveTitleFontSize(spec, ctx, (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.title, WING_TEXT_BOX_WIDTH, WING_TITLE_FONT_SIZE, [8, 30]);
|
|
7702
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style, WING_TITLE_LINE_HEIGHT, 1.3);
|
|
7703
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_f = (_e = spec.data) === null || _e === void 0 ? void 0 : _e[index]) === null || _f === void 0 ? void 0 : _f.title);
|
|
7704
|
+
const contentFontSize = Number((_j = (_h = (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.fontSize) !== null && _j !== void 0 ? _j : WING_CONTENT_FONT_SIZE);
|
|
7705
|
+
const contentLineHeight = Number((_m = (_l = (_k = spec.content) === null || _k === void 0 ? void 0 : _k.style) === null || _l === void 0 ? void 0 : _l.lineHeight) !== null && _m !== void 0 ? _m : WING_CONTENT_LINE_HEIGHT);
|
|
7662
7706
|
const titleToContentGap = WING_TITLE_TO_CONTENT_GAP;
|
|
7663
7707
|
const textHeight = WING_TEXT_BOX_HEIGHT;
|
|
7664
7708
|
const contentHeight = 100000;
|
|
7665
|
-
const imageWidth = Number((
|
|
7666
|
-
const imageHeight = Number((
|
|
7709
|
+
const imageWidth = Number((_p = (_o = spec.image) === null || _o === void 0 ? void 0 : _o.width) !== null && _p !== void 0 ? _p : WING_BLOCK_IMAGE_SIZE);
|
|
7710
|
+
const imageHeight = Number((_r = (_q = spec.image) === null || _q === void 0 ? void 0 : _q.height) !== null && _r !== void 0 ? _r : WING_BLOCK_IMAGE_SIZE);
|
|
7667
7711
|
const imageBox = {
|
|
7668
7712
|
x: -imageWidth / 2,
|
|
7669
7713
|
y: -imageHeight / 2,
|
|
@@ -7671,7 +7715,7 @@
|
|
|
7671
7715
|
height: imageHeight
|
|
7672
7716
|
};
|
|
7673
7717
|
const direction = getWingDirection(spec);
|
|
7674
|
-
const count = (
|
|
7718
|
+
const count = (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s.length) !== null && _t !== void 0 ? _t : 0;
|
|
7675
7719
|
const isSpecialBelow = (direction === 'right' && count > 0 && index === count - 1) || (direction === 'left' && index === 0);
|
|
7676
7720
|
const isVerticalLayout = isSpecialBelow;
|
|
7677
7721
|
const textWidth = WING_TEXT_BOX_WIDTH;
|
|
@@ -7686,7 +7730,7 @@
|
|
|
7686
7730
|
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
7687
7731
|
contentBox = {
|
|
7688
7732
|
x: textX,
|
|
7689
|
-
y: textY +
|
|
7733
|
+
y: textY + titleHeight + titleToContentGap,
|
|
7690
7734
|
width: textWidth,
|
|
7691
7735
|
height: contentHeight
|
|
7692
7736
|
};
|
|
@@ -7706,7 +7750,7 @@
|
|
|
7706
7750
|
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
7707
7751
|
contentBox = {
|
|
7708
7752
|
x: textX,
|
|
7709
|
-
y: textY +
|
|
7753
|
+
y: textY + titleHeight + titleToContentGap,
|
|
7710
7754
|
width: textWidth,
|
|
7711
7755
|
height: contentHeight
|
|
7712
7756
|
};
|
|
@@ -7769,33 +7813,16 @@
|
|
|
7769
7813
|
type: 'symbol',
|
|
7770
7814
|
name: `storyline-block-image-halo-${index}`,
|
|
7771
7815
|
interactive: false,
|
|
7772
|
-
style: {
|
|
7773
|
-
x: 0,
|
|
7774
|
-
y: 0,
|
|
7775
|
-
size: (_d, ctx) => Math.max(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) + 12,
|
|
7776
|
-
symbolType: 'circle',
|
|
7777
|
-
fill: withAlpha(themeColor, 0.18),
|
|
7778
|
-
stroke: themeColor,
|
|
7779
|
-
lineWidth: 1.5
|
|
7780
|
-
}
|
|
7816
|
+
style: Object.assign(Object.assign({ x: 0, y: 0, size: (_d, ctx) => Math.max(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) + 12, symbolType: 'circle' }, getImageBackgroundStyle(spec)), { lineWidth: 1.5 })
|
|
7781
7817
|
}
|
|
7782
7818
|
: null,
|
|
7783
7819
|
hasImage
|
|
7784
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: '
|
|
7820
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
|
|
7785
7821
|
: {
|
|
7786
7822
|
type: 'rect',
|
|
7787
7823
|
name: `storyline-block-image-bg-${index}`,
|
|
7788
7824
|
interactive: false,
|
|
7789
|
-
style: {
|
|
7790
|
-
x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x,
|
|
7791
|
-
y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y,
|
|
7792
|
-
width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width,
|
|
7793
|
-
height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height,
|
|
7794
|
-
cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2,
|
|
7795
|
-
fill: '#ffffff',
|
|
7796
|
-
stroke: themeColor,
|
|
7797
|
-
lineWidth: 2
|
|
7798
|
-
}
|
|
7825
|
+
style: Object.assign({ x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2 }, getImageBackgroundStyle(spec))
|
|
7799
7826
|
},
|
|
7800
7827
|
block.title
|
|
7801
7828
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.title), { style: Object.assign({ x: (_d, ctx) => {
|
|
@@ -7804,28 +7831,28 @@
|
|
|
7804
7831
|
return m.textBox.x + m.textBox.width / 2;
|
|
7805
7832
|
}
|
|
7806
7833
|
return m.onLeft ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
7807
|
-
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width, fontSize: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => {
|
|
7834
|
+
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, heightLimit: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => {
|
|
7808
7835
|
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7809
7836
|
if (m.verticalAlign) {
|
|
7810
7837
|
return 'center';
|
|
7811
7838
|
}
|
|
7812
7839
|
return m.onLeft ? 'right' : 'left';
|
|
7813
|
-
}, textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7840
|
+
}, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7814
7841
|
: null,
|
|
7815
7842
|
contentText.length
|
|
7816
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.content), {
|
|
7843
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.content), { style: Object.assign({ x: (_d, ctx) => {
|
|
7817
7844
|
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7818
7845
|
if (m.verticalAlign) {
|
|
7819
7846
|
return m.contentBox.x + m.contentBox.width / 2;
|
|
7820
7847
|
}
|
|
7821
7848
|
return m.onLeft ? m.contentBox.x + m.contentBox.width : m.contentBox.x;
|
|
7822
|
-
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.height, maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.width, heightLimit: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.height, text:
|
|
7849
|
+
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.height, maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.width, heightLimit: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.height, text: buildPlainContent(contentText), fontSize: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentFontSize, lineHeight: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentLineHeight, textAlign: (_d, ctx) => {
|
|
7823
7850
|
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7824
7851
|
if (m.verticalAlign) {
|
|
7825
7852
|
return 'center';
|
|
7826
7853
|
}
|
|
7827
7854
|
return m.onLeft ? 'right' : 'left';
|
|
7828
|
-
}, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#1f2430' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7855
|
+
}, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#1f2430' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7829
7856
|
: null
|
|
7830
7857
|
].filter(Boolean)
|
|
7831
7858
|
};
|
|
@@ -7839,8 +7866,8 @@
|
|
|
7839
7866
|
const LADDER_BLOCK_IMAGE_SIZE = 100;
|
|
7840
7867
|
const LADDER_TITLE_FONT_SIZE = 28;
|
|
7841
7868
|
const LADDER_TITLE_LINE_HEIGHT = 26;
|
|
7842
|
-
const LADDER_CONTENT_FONT_SIZE =
|
|
7843
|
-
const LADDER_CONTENT_LINE_HEIGHT =
|
|
7869
|
+
const LADDER_CONTENT_FONT_SIZE = 16;
|
|
7870
|
+
const LADDER_CONTENT_LINE_HEIGHT = 23;
|
|
7844
7871
|
const isDownLadder = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7845
7872
|
const getLadderDiagonalGeometry = (spec, ctx) => {
|
|
7846
7873
|
var _a;
|
|
@@ -7937,7 +7964,7 @@
|
|
|
7937
7964
|
};
|
|
7938
7965
|
const isOnLeft = (index) => index % 2 === 1;
|
|
7939
7966
|
const getLadderBlockMetrics = (spec, ctx, index) => {
|
|
7940
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x
|
|
7967
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
7941
7968
|
const block = getLayout(spec, ctx).blocks[index];
|
|
7942
7969
|
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
7943
7970
|
const imagePosition = isOnLeft(index) ? 'right' : 'left';
|
|
@@ -7945,16 +7972,18 @@
|
|
|
7945
7972
|
const imageHeight = (_g = (_f = spec.image) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : LADDER_BLOCK_IMAGE_SIZE;
|
|
7946
7973
|
const imageGap = (_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : DEFAULT_IMAGE_GAP;
|
|
7947
7974
|
const hasImage = !!((_l = (_k = spec.data) === null || _k === void 0 ? void 0 : _k[index]) === null || _l === void 0 ? void 0 : _l.image);
|
|
7948
|
-
const
|
|
7949
|
-
const
|
|
7950
|
-
const titleHeight = ((_u = (_t = spec.data) === null || _t === void 0 ? void 0 : _t[index]) === null || _u === void 0 ? void 0 : _u.title) ? titleLineHeight : 0;
|
|
7951
|
-
const blockWidth = (_v = block === null || block === void 0 ? void 0 : block.width) !== null && _v !== void 0 ? _v : resolveBlockWidth(spec, 0);
|
|
7952
|
-
const blockHeight = (_y = (_w = block === null || block === void 0 ? void 0 : block.height) !== null && _w !== void 0 ? _w : (_x = spec.block) === null || _x === void 0 ? void 0 : _x.height) !== null && _y !== void 0 ? _y : DEFAULT_BLOCK_HEIGHT;
|
|
7975
|
+
const blockWidth = (_m = block === null || block === void 0 ? void 0 : block.width) !== null && _m !== void 0 ? _m : resolveBlockWidth(spec, 0);
|
|
7976
|
+
const blockHeight = (_q = (_o = block === null || block === void 0 ? void 0 : block.height) !== null && _o !== void 0 ? _o : (_p = spec.block) === null || _p === void 0 ? void 0 : _p.height) !== null && _q !== void 0 ? _q : DEFAULT_BLOCK_HEIGHT;
|
|
7953
7977
|
const imageBox = getImageBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
7954
7978
|
const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
7955
|
-
const
|
|
7979
|
+
const titleFontSize = resolveTitleFontSize(spec, ctx, (_s = (_r = spec.data) === null || _r === void 0 ? void 0 : _r[index]) === null || _s === void 0 ? void 0 : _s.title, textBox.width, LADDER_TITLE_FONT_SIZE, [8, 34]);
|
|
7980
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_t = spec.title) === null || _t === void 0 ? void 0 : _t.style, LADDER_TITLE_LINE_HEIGHT, LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE);
|
|
7981
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title);
|
|
7982
|
+
const contentGap = ((_x = (_w = spec.data) === null || _w === void 0 ? void 0 : _w[index]) === null || _x === void 0 ? void 0 : _x.title) ? 8 : 0;
|
|
7956
7983
|
return {
|
|
7957
7984
|
block: { width: blockWidth, height: blockHeight },
|
|
7985
|
+
titleFontSize,
|
|
7986
|
+
titleLineHeight,
|
|
7958
7987
|
imageBox,
|
|
7959
7988
|
textBox,
|
|
7960
7989
|
contentBox: {
|
|
@@ -7964,23 +7993,20 @@
|
|
|
7964
7993
|
};
|
|
7965
7994
|
};
|
|
7966
7995
|
const buildLadderBlockMark = (spec, block, index) => {
|
|
7967
|
-
var _a, _b, _c, _e, _f, _g, _h
|
|
7996
|
+
var _a, _b, _c, _e, _f, _g, _h;
|
|
7968
7997
|
const hasImage = !!block.image;
|
|
7969
7998
|
const onLeft = isOnLeft(index);
|
|
7970
7999
|
const align = onLeft ? 'right' : 'left';
|
|
7971
8000
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7972
|
-
const
|
|
7973
|
-
const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.round(titleFontSize * (LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE)));
|
|
7974
|
-
const showBackground = ((_h = spec.block) === null || _h === void 0 ? void 0 : _h.showBackground) === true;
|
|
8001
|
+
const showBackground = ((_a = spec.block) === null || _a === void 0 ? void 0 : _a.showBackground) === true;
|
|
7975
8002
|
const showImageBackground = shouldShowImageBackground(spec);
|
|
7976
|
-
const themeColor = getThemeColor(spec);
|
|
7977
8003
|
const getTitleX = (ctx) => {
|
|
7978
8004
|
const m = getLadderBlockMetrics(spec, ctx, index);
|
|
7979
8005
|
return align === 'right' ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
7980
8006
|
};
|
|
7981
8007
|
return {
|
|
7982
8008
|
type: 'group',
|
|
7983
|
-
id: `storyline-block-${(
|
|
8009
|
+
id: `storyline-block-${(_b = block.id) !== null && _b !== void 0 ? _b : index}`,
|
|
7984
8010
|
name: `storyline-block-${index}`,
|
|
7985
8011
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7986
8012
|
style: {
|
|
@@ -7995,7 +8021,7 @@
|
|
|
7995
8021
|
type: 'rect',
|
|
7996
8022
|
name: `storyline-block-bg-${index}`,
|
|
7997
8023
|
interactive: false,
|
|
7998
|
-
style: Object.assign({ x: 0, y: 0, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (
|
|
8024
|
+
style: Object.assign({ x: 0, y: 0, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_c = spec.block) === null || _c === void 0 ? void 0 : _c.style)
|
|
7999
8025
|
}
|
|
8000
8026
|
: null,
|
|
8001
8027
|
showImageBackground
|
|
@@ -8003,21 +8029,17 @@
|
|
|
8003
8029
|
type: 'rect',
|
|
8004
8030
|
name: `storyline-block-image-bg-${index}`,
|
|
8005
8031
|
interactive: false,
|
|
8006
|
-
style: Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8
|
|
8032
|
+
style: Object.assign(Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), (_e = spec.block) === null || _e === void 0 ? void 0 : _e.style)
|
|
8007
8033
|
}
|
|
8008
8034
|
: null,
|
|
8009
8035
|
hasImage
|
|
8010
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (
|
|
8036
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_f = spec.image) === null || _f === void 0 ? void 0 : _f.style) })
|
|
8011
8037
|
: null,
|
|
8012
8038
|
block.title
|
|
8013
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, fontSize: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textBaseline: 'top' }, (
|
|
8039
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_g = spec.title) === null || _g === void 0 ? void 0 : _g.style), { textAlign: align }) })
|
|
8014
8040
|
: null,
|
|
8015
8041
|
contentText.length
|
|
8016
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), {
|
|
8017
|
-
fontSize: LADDER_CONTENT_FONT_SIZE,
|
|
8018
|
-
lineHeight: LADDER_CONTENT_LINE_HEIGHT,
|
|
8019
|
-
align: align
|
|
8020
|
-
}), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_p = spec.content) === null || _p === void 0 ? void 0 : _p.style), { textAlign: align }) })
|
|
8042
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, text: buildPlainContent(contentText), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, fontSize: LADDER_CONTENT_FONT_SIZE, lineHeight: LADDER_CONTENT_LINE_HEIGHT, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style), { textAlign: align }) })
|
|
8021
8043
|
: null
|
|
8022
8044
|
].filter(Boolean)
|
|
8023
8045
|
};
|
|
@@ -8050,6 +8072,16 @@
|
|
|
8050
8072
|
const ladder = isLadder(spec);
|
|
8051
8073
|
const wing = isWing(spec);
|
|
8052
8074
|
const clock = isClock(spec);
|
|
8075
|
+
const topTitleImageReserve = (() => {
|
|
8076
|
+
var _a, _b, _c, _d;
|
|
8077
|
+
if (arc ||
|
|
8078
|
+
ladder ||
|
|
8079
|
+
!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) ||
|
|
8080
|
+
((_b = spec.titleImage) === null || _b === void 0 ? void 0 : _b.visible) === false) {
|
|
8081
|
+
return 0;
|
|
8082
|
+
}
|
|
8083
|
+
return getTitleImageReservedHeight(spec, Number((_c = spec.width) !== null && _c !== void 0 ? _c : 1000), Number((_d = spec.height) !== null && _d !== void 0 ? _d : 600));
|
|
8084
|
+
})();
|
|
8053
8085
|
const portraitBottomReserve = (() => {
|
|
8054
8086
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
8055
8087
|
if (!portrait) {
|
|
@@ -8096,7 +8128,7 @@
|
|
|
8096
8128
|
const cap = canvasHeight ? Math.floor(canvasHeight * 0.3) : ideal;
|
|
8097
8129
|
return Math.min(ideal, cap);
|
|
8098
8130
|
})();
|
|
8099
|
-
const defaultTop = clock ? 40 : ladder ? ladderVerticalPadding : arcDown ? 0 : arcUp ? TEXT_RESERVE : SMALL;
|
|
8131
|
+
const defaultTop = Math.max(topTitleImageReserve, clock ? 40 : ladder ? ladderVerticalPadding : arcDown ? 0 : arcUp ? TEXT_RESERVE : SMALL);
|
|
8100
8132
|
const defaultBottom = clock
|
|
8101
8133
|
? 60
|
|
8102
8134
|
: portrait
|
|
@@ -8127,14 +8159,18 @@
|
|
|
8127
8159
|
spec.padding = [defaultTop, defaultRight, defaultBottom, defaultLeft];
|
|
8128
8160
|
return;
|
|
8129
8161
|
}
|
|
8162
|
+
if (typeof p === 'number') {
|
|
8163
|
+
spec.padding = [Math.max(p, topTitleImageReserve), p, p, p];
|
|
8164
|
+
return;
|
|
8165
|
+
}
|
|
8130
8166
|
if (Array.isArray(p)) {
|
|
8131
8167
|
const [t, r = defaultRight, b, l = defaultLeft] = p;
|
|
8132
|
-
spec.padding = [t !== null && t !== void 0 ? t : defaultTop, r, b !== null && b !== void 0 ? b : defaultBottom, l];
|
|
8168
|
+
spec.padding = [Math.max(t !== null && t !== void 0 ? t : defaultTop, topTitleImageReserve), r, b !== null && b !== void 0 ? b : defaultBottom, l];
|
|
8133
8169
|
return;
|
|
8134
8170
|
}
|
|
8135
8171
|
if (typeof p === 'object') {
|
|
8136
8172
|
spec.padding = {
|
|
8137
|
-
top: (_a = p.top) !== null && _a !== void 0 ? _a : defaultTop,
|
|
8173
|
+
top: Math.max((_a = p.top) !== null && _a !== void 0 ? _a : defaultTop, topTitleImageReserve),
|
|
8138
8174
|
right: (_b = p.right) !== null && _b !== void 0 ? _b : defaultRight,
|
|
8139
8175
|
bottom: (_c = p.bottom) !== null && _c !== void 0 ? _c : defaultBottom,
|
|
8140
8176
|
left: (_d = p.left) !== null && _d !== void 0 ? _d : defaultLeft
|
|
@@ -8145,32 +8181,33 @@
|
|
|
8145
8181
|
var _a;
|
|
8146
8182
|
const lineMark = buildLineMark(spec);
|
|
8147
8183
|
const blockMarks = ((_a = spec.data) !== null && _a !== void 0 ? _a : []).map((block, index) => buildBlockMark(spec, block, index));
|
|
8184
|
+
const titleImageMark = buildTopTitleImageMark(spec);
|
|
8148
8185
|
if (isLandscape(spec)) {
|
|
8149
|
-
return [...blockMarks, lineMark].filter(Boolean);
|
|
8186
|
+
return [titleImageMark, ...blockMarks, lineMark].filter(Boolean);
|
|
8150
8187
|
}
|
|
8151
8188
|
if (isPortrait(spec)) {
|
|
8152
|
-
return [lineMark, ...blockMarks].filter(Boolean);
|
|
8189
|
+
return [lineMark, titleImageMark, ...blockMarks].filter(Boolean);
|
|
8153
8190
|
}
|
|
8154
8191
|
if (isArc(spec)) {
|
|
8155
|
-
const
|
|
8192
|
+
const arcTitleImageMark = buildArcTitleImageMark(spec);
|
|
8156
8193
|
const arcMark = buildArcMark(spec);
|
|
8157
|
-
return [
|
|
8194
|
+
return [arcTitleImageMark, arcMark, ...blockMarks].filter(Boolean);
|
|
8158
8195
|
}
|
|
8159
8196
|
if (isClock(spec)) {
|
|
8160
8197
|
const ringsMark = buildClockArcMark(spec);
|
|
8161
|
-
|
|
8162
|
-
return [ringsMark, ...blockMarks, centerImageMark].filter(Boolean);
|
|
8198
|
+
return [titleImageMark, ringsMark, ...blockMarks].filter(Boolean);
|
|
8163
8199
|
}
|
|
8164
8200
|
if (isWing(spec)) {
|
|
8165
8201
|
const arcMark = buildWingArcMark(spec);
|
|
8166
|
-
|
|
8202
|
+
const wingTitleImageMark = buildWingTitleImageMark(spec);
|
|
8203
|
+
return [arcMark, wingTitleImageMark, ...blockMarks].filter(Boolean);
|
|
8167
8204
|
}
|
|
8168
8205
|
if (isLadder(spec)) {
|
|
8169
8206
|
const diagonalMark = buildLadderDiagonalMark(spec);
|
|
8170
8207
|
const headlineMark = buildLadderHeadlineMark(spec);
|
|
8171
8208
|
return [diagonalMark, headlineMark, ...blockMarks].filter(Boolean);
|
|
8172
8209
|
}
|
|
8173
|
-
return [lineMark, ...blockMarks].filter(Boolean);
|
|
8210
|
+
return [titleImageMark, lineMark, ...blockMarks].filter(Boolean);
|
|
8174
8211
|
};
|
|
8175
8212
|
const buildLineMark = (spec) => {
|
|
8176
8213
|
var _a, _b, _c;
|