@visactor/vchart-extension 2.1.0-alpha.15 → 2.1.0-alpha.17
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 +551 -363
- 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 -2
- 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 -1
- 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 -2
- package/cjs/charts/conversion-funnel/constants.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/cjs/charts/conversion-funnel/index.js +1 -1
- package/cjs/charts/conversion-funnel/interface.js +1 -1
- package/cjs/charts/conversion-funnel/util.js +1 -1
- package/cjs/charts/funnel-3d/chart.js +1 -1
- package/cjs/charts/funnel-3d/constant.js +1 -1
- package/cjs/charts/funnel-3d/index.js +1 -1
- package/cjs/charts/funnel-3d/interface.js +1 -1
- package/cjs/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/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 +9 -1
- package/cjs/charts/storyline/interface.js.map +1 -1
- package/cjs/charts/storyline/layout.js +25 -32
- package/cjs/charts/storyline/layout.js.map +1 -1
- package/cjs/charts/storyline/layouts/arc.d.ts +5 -0
- package/cjs/charts/storyline/layouts/{dome.js → arc.js} +69 -60
- package/cjs/charts/storyline/layouts/arc.js.map +1 -0
- package/cjs/charts/storyline/layouts/clock.js +23 -10
- package/cjs/charts/storyline/layouts/clock.js.map +1 -1
- package/cjs/charts/storyline/layouts/common.d.ts +4 -2
- package/cjs/charts/storyline/layouts/common.js +9 -5
- package/cjs/charts/storyline/layouts/common.js.map +1 -1
- package/cjs/charts/storyline/layouts/default.js +6 -4
- package/cjs/charts/storyline/layouts/default.js.map +1 -1
- package/cjs/charts/storyline/layouts/ladder.d.ts +5 -0
- package/cjs/charts/storyline/layouts/ladder.js +205 -0
- package/cjs/charts/storyline/layouts/ladder.js.map +1 -0
- package/cjs/charts/storyline/layouts/landscape.js +5 -3
- package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
- package/cjs/charts/storyline/layouts/portrait.js +16 -42
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
- package/cjs/charts/storyline/layouts/{bowl.d.ts → wing.d.ts} +2 -3
- package/cjs/charts/storyline/layouts/wing.js +215 -0
- package/cjs/charts/storyline/layouts/wing.js.map +1 -0
- package/cjs/charts/storyline/storyline-transformer.js +34 -18
- 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 -2
- 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 -1
- 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 -2
- package/esm/charts/conversion-funnel/constants.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/esm/charts/conversion-funnel/index.js +1 -1
- package/esm/charts/conversion-funnel/interface.js +1 -1
- package/esm/charts/conversion-funnel/util.js +1 -1
- package/esm/charts/funnel-3d/chart.js +1 -1
- package/esm/charts/funnel-3d/constant.js +1 -1
- package/esm/charts/funnel-3d/index.js +1 -1
- package/esm/charts/funnel-3d/interface.js +1 -1
- package/esm/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/esm/charts/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 +9 -1
- package/esm/charts/storyline/interface.js.map +1 -1
- package/esm/charts/storyline/layout.js +25 -32
- package/esm/charts/storyline/layout.js.map +1 -1
- package/esm/charts/storyline/layouts/arc.d.ts +5 -0
- package/esm/charts/storyline/layouts/{bowl.js → arc.js} +64 -56
- package/esm/charts/storyline/layouts/arc.js.map +1 -0
- package/esm/charts/storyline/layouts/clock.js +23 -10
- package/esm/charts/storyline/layouts/clock.js.map +1 -1
- package/esm/charts/storyline/layouts/common.d.ts +4 -2
- package/esm/charts/storyline/layouts/common.js +4 -2
- package/esm/charts/storyline/layouts/common.js.map +1 -1
- package/esm/charts/storyline/layouts/default.js +6 -4
- package/esm/charts/storyline/layouts/default.js.map +1 -1
- package/esm/charts/storyline/layouts/ladder.d.ts +5 -0
- package/esm/charts/storyline/layouts/ladder.js +196 -0
- package/esm/charts/storyline/layouts/ladder.js.map +1 -0
- package/esm/charts/storyline/layouts/landscape.js +5 -3
- package/esm/charts/storyline/layouts/landscape.js.map +1 -1
- package/esm/charts/storyline/layouts/portrait.js +16 -42
- package/esm/charts/storyline/layouts/portrait.js.map +1 -1
- package/esm/charts/storyline/layouts/{bowl.d.ts → wing.d.ts} +2 -3
- package/esm/charts/storyline/layouts/wing.js +210 -0
- package/esm/charts/storyline/layouts/wing.js.map +1 -0
- package/esm/charts/storyline/storyline-transformer.js +32 -17
- 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 +4 -4
- package/cjs/charts/storyline/layouts/bowl.js +0 -286
- package/cjs/charts/storyline/layouts/bowl.js.map +0 -1
- package/cjs/charts/storyline/layouts/dome.d.ts +0 -5
- package/cjs/charts/storyline/layouts/dome.js.map +0 -1
- package/esm/charts/storyline/layouts/bowl.js.map +0 -1
- package/esm/charts/storyline/layouts/dome.d.ts +0 -5
- package/esm/charts/storyline/layouts/dome.js +0 -278
- package/esm/charts/storyline/layouts/dome.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -5880,33 +5880,49 @@
|
|
|
5880
5880
|
case 'portrait':
|
|
5881
5881
|
centers = lineCenters(count, center.x, inner.y + block.height / 2, center.x, inner.y + inner.height - block.height / 2);
|
|
5882
5882
|
break;
|
|
5883
|
-
case '
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5883
|
+
case 'ladder': {
|
|
5884
|
+
const isDown = layout.direction === 'down';
|
|
5885
|
+
const x0 = inner.x + block.width / 2;
|
|
5886
|
+
const x1 = inner.x + inner.width - block.width / 2;
|
|
5887
|
+
const yTop = inner.y + block.height / 2;
|
|
5888
|
+
const yBot = inner.y + inner.height - block.height / 2;
|
|
5889
|
+
const y0 = isDown ? yTop : yBot;
|
|
5890
|
+
const y1 = isDown ? yBot : yTop;
|
|
5891
|
+
const anchors = lineCenters(count, x0, y0, x1, y1);
|
|
5892
|
+
const dx = x1 - x0;
|
|
5893
|
+
const dy = y1 - y0;
|
|
5894
|
+
const len = Math.hypot(dx, dy) || 1;
|
|
5895
|
+
const nx = -dy / len;
|
|
5896
|
+
const ny = dx / len;
|
|
5897
|
+
const headlineFontSize = Math.max(80, Math.min(240, Math.round(inner.height * 0.42)));
|
|
5898
|
+
const offset = headlineFontSize * 1.2;
|
|
5899
|
+
centers = anchors.map((p, i) => {
|
|
5900
|
+
const sign = i % 2 === 0 ? 1 : -1;
|
|
5901
|
+
return {
|
|
5902
|
+
x: p.x + nx * offset * sign,
|
|
5903
|
+
y: p.y + ny * offset * sign
|
|
5904
|
+
};
|
|
5905
|
+
});
|
|
5891
5906
|
break;
|
|
5907
|
+
}
|
|
5892
5908
|
case 'spiral':
|
|
5893
5909
|
centers = alternatingVerticalCenters(count, inner, block, gap);
|
|
5894
5910
|
break;
|
|
5895
5911
|
case 'clock':
|
|
5896
5912
|
centers = circularCenters(count, viewBox, block, padding, layout);
|
|
5897
5913
|
break;
|
|
5898
|
-
case '
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
centers = arcCenters(count, inner, block, layout, 160, 20);
|
|
5914
|
+
case 'arc': {
|
|
5915
|
+
const isDown = layout.direction === 'down';
|
|
5916
|
+
const [s, e] = isDown ? [20, 160] : [200, 340];
|
|
5917
|
+
centers = arcCenters(count, inner, block, layout, s, e);
|
|
5903
5918
|
break;
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
centers = arcCenters(count, inner, block, layout,
|
|
5919
|
+
}
|
|
5920
|
+
case 'wing': {
|
|
5921
|
+
const direction = layout.direction === 'right' ? 'right' : 'left';
|
|
5922
|
+
const [s, e] = direction === 'right' ? [110, 250] : [-70, 70];
|
|
5923
|
+
centers = arcCenters(count, inner, block, layout, s, e);
|
|
5909
5924
|
break;
|
|
5925
|
+
}
|
|
5910
5926
|
case 'landscape':
|
|
5911
5927
|
default:
|
|
5912
5928
|
centers = lineCenters(count, inner.x + block.width / 2, center.y, inner.x + inner.width - block.width / 2, center.y);
|
|
@@ -5938,15 +5954,6 @@
|
|
|
5938
5954
|
};
|
|
5939
5955
|
});
|
|
5940
5956
|
};
|
|
5941
|
-
const alternatingHorizontalCenters = (count, inner, block, gap) => {
|
|
5942
|
-
const baseY = inner.y + inner.height / 2;
|
|
5943
|
-
const offset = Math.min(Math.max(block.height * 0.65 + gap / 2, 0), Math.max((inner.height - block.height) / 2, 0));
|
|
5944
|
-
const points = lineCenters(count, inner.x + block.width / 2, baseY, inner.x + inner.width - block.width / 2, baseY);
|
|
5945
|
-
return points.map((point, index) => ({
|
|
5946
|
-
x: point.x,
|
|
5947
|
-
y: point.y + (index % 2 === 0 ? -offset : offset)
|
|
5948
|
-
}));
|
|
5949
|
-
};
|
|
5950
5957
|
const alternatingVerticalCenters = (count, inner, block, gap) => {
|
|
5951
5958
|
const baseX = inner.x + inner.width / 2;
|
|
5952
5959
|
const offset = Math.min(Math.max(block.width * 0.65 + gap / 2, 0), Math.max((inner.width - block.width) / 2, 0));
|
|
@@ -6066,8 +6073,9 @@
|
|
|
6066
6073
|
const isLandscape = (spec) => normalizeLayout(spec.layout).type === 'landscape';
|
|
6067
6074
|
const isPortrait = (spec) => normalizeLayout(spec.layout).type === 'portrait';
|
|
6068
6075
|
const isClock = (spec) => normalizeLayout(spec.layout).type === 'clock';
|
|
6069
|
-
const
|
|
6070
|
-
const
|
|
6076
|
+
const isArc = (spec) => normalizeLayout(spec.layout).type === 'arc';
|
|
6077
|
+
const isWing = (spec) => normalizeLayout(spec.layout).type === 'wing';
|
|
6078
|
+
const isLadder = (spec) => normalizeLayout(spec.layout).type === 'ladder';
|
|
6071
6079
|
const getThemeColor = (spec) => { var _a; return (_a = spec.themeColor) !== null && _a !== void 0 ? _a : DEFAULT_THEME_COLOR; };
|
|
6072
6080
|
const withAlpha = (color, alpha) => {
|
|
6073
6081
|
const safeAlpha = Math.max(0, Math.min(1, alpha));
|
|
@@ -6282,8 +6290,8 @@
|
|
|
6282
6290
|
const CLOCK_LEAD_LINE_GAP = 6;
|
|
6283
6291
|
const CLOCK_TEXT_GAP_FROM_LEAD = 8;
|
|
6284
6292
|
const CLOCK_ORBIT_DASH = [4, 4];
|
|
6285
|
-
const CLOCK_TITLE_FONT_SIZE =
|
|
6286
|
-
const CLOCK_TITLE_LINE_HEIGHT =
|
|
6293
|
+
const CLOCK_TITLE_FONT_SIZE = 18;
|
|
6294
|
+
const CLOCK_TITLE_LINE_HEIGHT = 24;
|
|
6287
6295
|
const CLOCK_CONTENT_FONT_SIZE = 11;
|
|
6288
6296
|
const CLOCK_CONTENT_LINE_HEIGHT = 15;
|
|
6289
6297
|
const getClockGeometry = (spec, ctx) => {
|
|
@@ -6344,7 +6352,24 @@
|
|
|
6344
6352
|
}, y: (_d, ctx) => {
|
|
6345
6353
|
const g = getClockGeometry(spec, ctx);
|
|
6346
6354
|
return g.cy - g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO;
|
|
6347
|
-
}, 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,
|
|
6355
|
+
}, 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', anchor: (_d, ctx) => {
|
|
6356
|
+
const g = getClockGeometry(spec, ctx);
|
|
6357
|
+
return [g.cx, g.cy];
|
|
6358
|
+
}, dx: (_d, ctx) => {
|
|
6359
|
+
var _a, _b;
|
|
6360
|
+
const g = getClockGeometry(spec, ctx);
|
|
6361
|
+
const rectW = g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2;
|
|
6362
|
+
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
6363
|
+
const w = typeof userWidth === 'number' ? userWidth : rectW;
|
|
6364
|
+
return (rectW - w) / 2;
|
|
6365
|
+
}, dy: (_d, ctx) => {
|
|
6366
|
+
var _a, _b;
|
|
6367
|
+
const g = getClockGeometry(spec, ctx);
|
|
6368
|
+
const rectH = g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2;
|
|
6369
|
+
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
6370
|
+
const h = typeof userHeight === 'number' ? userHeight : rectH;
|
|
6371
|
+
return (rectH - h) / 2;
|
|
6372
|
+
} }, (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.style)
|
|
6348
6373
|
}
|
|
6349
6374
|
: {
|
|
6350
6375
|
type: 'symbol',
|
|
@@ -6465,13 +6490,10 @@
|
|
|
6465
6490
|
width: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
|
|
6466
6491
|
height: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
|
|
6467
6492
|
image: block.image,
|
|
6468
|
-
cornerRadius: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter / 2,
|
|
6469
6493
|
repeatX: 'no-repeat',
|
|
6470
6494
|
repeatY: 'no-repeat',
|
|
6471
6495
|
imageMode: 'cover',
|
|
6472
|
-
imagePosition: 'center'
|
|
6473
|
-
stroke: themeColor,
|
|
6474
|
-
lineWidth: 2
|
|
6496
|
+
imagePosition: 'center'
|
|
6475
6497
|
}
|
|
6476
6498
|
}
|
|
6477
6499
|
: {
|
|
@@ -6489,7 +6511,7 @@
|
|
|
6489
6511
|
}
|
|
6490
6512
|
},
|
|
6491
6513
|
block.title
|
|
6492
|
-
? 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 - CLOCK_TITLE_LINE_HEIGHT, text: block.title, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, fontSize: CLOCK_TITLE_FONT_SIZE, lineHeight: CLOCK_TITLE_LINE_HEIGHT, fontWeight: 'bold', fill: themeColor, textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top' }, (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) })
|
|
6514
|
+
? 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 - CLOCK_TITLE_LINE_HEIGHT, text: block.title, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, fontSize: CLOCK_TITLE_FONT_SIZE, lineHeight: CLOCK_TITLE_LINE_HEIGHT, fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top' }, (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) })
|
|
6493
6515
|
: null,
|
|
6494
6516
|
contentText.length
|
|
6495
6517
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, text: buildRichContent(contentText, spec), fontSize: CLOCK_CONTENT_FONT_SIZE, lineHeight: CLOCK_CONTENT_LINE_HEIGHT, fill: '#3a3f4d', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top', wordBreak: 'break-word' }, (_b = spec.content) === null || _b === void 0 ? void 0 : _b.style) })
|
|
@@ -6535,7 +6557,7 @@
|
|
|
6535
6557
|
const imageHeight = (_h = (_g = spec.image) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : DEFAULT_IMAGE_HEIGHT;
|
|
6536
6558
|
const imageGap = (_k = (_j = spec.image) === null || _j === void 0 ? void 0 : _j.gap) !== null && _k !== void 0 ? _k : DEFAULT_IMAGE_GAP;
|
|
6537
6559
|
const hasImage = !!((_m = (_l = spec.data) === null || _l === void 0 ? void 0 : _l[index]) === null || _m === void 0 ? void 0 : _m.image);
|
|
6538
|
-
const titleFontSize = Number((_q = (_p = (_o = spec.title) === null || _o === void 0 ? void 0 : _o.style) === null || _p === void 0 ? void 0 : _p.fontSize) !== null && _q !== void 0 ? _q :
|
|
6560
|
+
const titleFontSize = Number((_q = (_p = (_o = spec.title) === null || _o === void 0 ? void 0 : _o.style) === null || _p === void 0 ? void 0 : _p.fontSize) !== null && _q !== void 0 ? _q : 18);
|
|
6539
6561
|
const titleLineHeight = Number((_t = (_s = (_r = spec.title) === null || _r === void 0 ? void 0 : _r.style) === null || _s === void 0 ? void 0 : _s.lineHeight) !== null && _t !== void 0 ? _t : Math.round(titleFontSize * 1.35));
|
|
6540
6562
|
const titleHeight = ((_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title) ? titleLineHeight : 0;
|
|
6541
6563
|
const blockWidth = (_w = block === null || block === void 0 ? void 0 : block.width) !== null && _w !== void 0 ? _w : resolveBlockWidth(spec, 0);
|
|
@@ -6560,7 +6582,7 @@
|
|
|
6560
6582
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
6561
6583
|
const hasImage = !!block.image;
|
|
6562
6584
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6563
|
-
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 :
|
|
6585
|
+
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);
|
|
6564
6586
|
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));
|
|
6565
6587
|
return {
|
|
6566
6588
|
type: 'group',
|
|
@@ -6581,10 +6603,10 @@
|
|
|
6581
6603
|
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)' }, (_h = spec.block) === null || _h === void 0 ? void 0 : _h.style)
|
|
6582
6604
|
},
|
|
6583
6605
|
hasImage
|
|
6584
|
-
? 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
|
|
6606
|
+
? 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 }, (_j = spec.image) === null || _j === void 0 ? void 0 : _j.style) })
|
|
6585
6607
|
: null,
|
|
6586
6608
|
block.title
|
|
6587
|
-
? 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', textAlign: 'left', textBaseline: 'top' }, (_k = spec.title) === null || _k === void 0 ? void 0 : _k.style) })
|
|
6609
|
+
? 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' }, (_k = spec.title) === null || _k === void 0 ? void 0 : _k.style) })
|
|
6588
6610
|
: null,
|
|
6589
6611
|
contentText.length
|
|
6590
6612
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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, text: buildRichContent(contentText, spec), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, fontSize: 12, lineHeight: 18, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) })
|
|
@@ -6710,7 +6732,7 @@
|
|
|
6710
6732
|
const getLandscapeMetrics = (spec, blockWidth, blockHeight, index) => {
|
|
6711
6733
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
6712
6734
|
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
6713
|
-
const titleFontSize = Number((_f = (_e = (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) === null || _e === void 0 ? void 0 : _e.fontSize) !== null && _f !== void 0 ? _f :
|
|
6735
|
+
const titleFontSize = Number((_f = (_e = (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) === null || _e === void 0 ? void 0 : _e.fontSize) !== null && _f !== void 0 ? _f : 18);
|
|
6714
6736
|
const titleLineHeight = Number((_j = (_h = (_g = spec.title) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.lineHeight) !== null && _j !== void 0 ? _j : Math.max(LANDSCAPE_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
|
|
6715
6737
|
const contentFontSize = Number((_m = (_l = (_k = spec.content) === null || _k === void 0 ? void 0 : _k.style) === null || _l === void 0 ? void 0 : _l.fontSize) !== null && _m !== void 0 ? _m : LANDSCAPE_CONTENT_FONT_SIZE);
|
|
6716
6738
|
const contentLineHeight = Number((_q = (_p = (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style) === null || _p === void 0 ? void 0 : _p.lineHeight) !== null && _q !== void 0 ? _q : LANDSCAPE_CONTENT_LINE_HEIGHT);
|
|
@@ -6785,7 +6807,7 @@
|
|
|
6785
6807
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
6786
6808
|
const hasImage = !!block.image;
|
|
6787
6809
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6788
|
-
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 :
|
|
6810
|
+
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);
|
|
6789
6811
|
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));
|
|
6790
6812
|
const getMetrics = (ctx) => {
|
|
6791
6813
|
var _a, _b, _c, _e;
|
|
@@ -6831,7 +6853,7 @@
|
|
|
6831
6853
|
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, fill: '#ffffff', stroke: themeColor, lineWidth: 2 }, blockStyle)
|
|
6832
6854
|
},
|
|
6833
6855
|
hasImage
|
|
6834
|
-
? 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,
|
|
6856
|
+
? 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: 'cover', imagePosition: 'center' }, (_r = spec.image) === null || _r === void 0 ? void 0 : _r.style) })
|
|
6835
6857
|
: null,
|
|
6836
6858
|
{
|
|
6837
6859
|
type: 'path',
|
|
@@ -6857,7 +6879,7 @@
|
|
|
6857
6879
|
}
|
|
6858
6880
|
},
|
|
6859
6881
|
block.title
|
|
6860
|
-
? 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', textAlign: 'left', textBaseline: 'top' }, (_s = spec.title) === null || _s === void 0 ? void 0 : _s.style) })
|
|
6882
|
+
? 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' }, (_s = spec.title) === null || _s === void 0 ? void 0 : _s.style) })
|
|
6861
6883
|
: null,
|
|
6862
6884
|
contentText.length
|
|
6863
6885
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize: LANDSCAPE_CONTENT_FONT_SIZE, lineHeight: LANDSCAPE_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_t = spec.content) === null || _t === void 0 ? void 0 : _t.style) })
|
|
@@ -6871,9 +6893,9 @@
|
|
|
6871
6893
|
const PORTRAIT_IMAGE_WIDTH = 180;
|
|
6872
6894
|
const PORTRAIT_IMAGE_HEIGHT = 110;
|
|
6873
6895
|
const PORTRAIT_IMAGE_GAP_FROM_AXIS = 24;
|
|
6874
|
-
const PORTRAIT_SHADOW_OFFSET_X =
|
|
6875
|
-
const PORTRAIT_SHADOW_OFFSET_Y =
|
|
6876
|
-
const PORTRAIT_SHADOW_SCALE = 1
|
|
6896
|
+
const PORTRAIT_SHADOW_OFFSET_X = 24;
|
|
6897
|
+
const PORTRAIT_SHADOW_OFFSET_Y = 16;
|
|
6898
|
+
const PORTRAIT_SHADOW_SCALE = 1;
|
|
6877
6899
|
const PORTRAIT_TEXT_GAP_FROM_IMAGE = 8;
|
|
6878
6900
|
const PORTRAIT_CONTENT_LINES = 3;
|
|
6879
6901
|
const PORTRAIT_TITLE_LINE_HEIGHT = 19;
|
|
@@ -6937,7 +6959,7 @@
|
|
|
6937
6959
|
};
|
|
6938
6960
|
const getPortraitMetrics = (spec, blockWidth, _blockHeight, index) => {
|
|
6939
6961
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
6940
|
-
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 :
|
|
6962
|
+
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);
|
|
6941
6963
|
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)));
|
|
6942
6964
|
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);
|
|
6943
6965
|
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);
|
|
@@ -6987,11 +7009,13 @@
|
|
|
6987
7009
|
};
|
|
6988
7010
|
};
|
|
6989
7011
|
const buildPortraitBlockMark = (spec, block, index) => {
|
|
6990
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
7012
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
6991
7013
|
const hasImage = !!block.image;
|
|
7014
|
+
const hasSubImage = !!block.subImage;
|
|
6992
7015
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6993
|
-
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 :
|
|
7016
|
+
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);
|
|
6994
7017
|
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)));
|
|
7018
|
+
const showBackground = ((_h = spec.image) === null || _h === void 0 ? void 0 : _h.showBackground) === true;
|
|
6995
7019
|
const getMetrics = (ctx) => {
|
|
6996
7020
|
var _a, _b, _c, _e;
|
|
6997
7021
|
const lb = getLayout(spec, ctx).blocks[index];
|
|
@@ -7000,10 +7024,10 @@
|
|
|
7000
7024
|
return getPortraitMetrics(spec, w, h, index);
|
|
7001
7025
|
};
|
|
7002
7026
|
const themeColor = getThemeColor(spec);
|
|
7003
|
-
const blockStyle = (
|
|
7027
|
+
const blockStyle = (_k = (_j = spec.block) === null || _j === void 0 ? void 0 : _j.style) !== null && _k !== void 0 ? _k : {};
|
|
7004
7028
|
return {
|
|
7005
7029
|
type: 'group',
|
|
7006
|
-
id: `storyline-block-${(
|
|
7030
|
+
id: `storyline-block-${(_l = block.id) !== null && _l !== void 0 ? _l : index}`,
|
|
7007
7031
|
name: `storyline-block-${index}`,
|
|
7008
7032
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7009
7033
|
style: {
|
|
@@ -7019,7 +7043,7 @@
|
|
|
7019
7043
|
}
|
|
7020
7044
|
},
|
|
7021
7045
|
children: [
|
|
7022
|
-
|
|
7046
|
+
hasSubImage && showBackground
|
|
7023
7047
|
? {
|
|
7024
7048
|
type: 'image',
|
|
7025
7049
|
name: `storyline-block-shadow-image-${index}`,
|
|
@@ -7029,8 +7053,7 @@
|
|
|
7029
7053
|
y: (_d, ctx) => getMetrics(ctx).shadowBox.y,
|
|
7030
7054
|
width: (_d, ctx) => getMetrics(ctx).shadowBox.width,
|
|
7031
7055
|
height: (_d, ctx) => getMetrics(ctx).shadowBox.height,
|
|
7032
|
-
image: block.
|
|
7033
|
-
cornerRadius: 8,
|
|
7056
|
+
image: block.subImage,
|
|
7034
7057
|
repeatX: 'no-repeat',
|
|
7035
7058
|
repeatY: 'no-repeat',
|
|
7036
7059
|
imageMode: 'cover',
|
|
@@ -7038,33 +7061,6 @@
|
|
|
7038
7061
|
}
|
|
7039
7062
|
}
|
|
7040
7063
|
: null,
|
|
7041
|
-
hasImage
|
|
7042
|
-
? {
|
|
7043
|
-
type: 'rect',
|
|
7044
|
-
name: `storyline-block-shadow-mask-${index}`,
|
|
7045
|
-
interactive: false,
|
|
7046
|
-
style: {
|
|
7047
|
-
x: (_d, ctx) => getMetrics(ctx).shadowBox.x,
|
|
7048
|
-
y: (_d, ctx) => getMetrics(ctx).shadowBox.y,
|
|
7049
|
-
width: (_d, ctx) => getMetrics(ctx).shadowBox.width,
|
|
7050
|
-
height: (_d, ctx) => getMetrics(ctx).shadowBox.height,
|
|
7051
|
-
cornerRadius: 8,
|
|
7052
|
-
stroke: false,
|
|
7053
|
-
lineWidth: 0,
|
|
7054
|
-
fill: {
|
|
7055
|
-
gradient: 'linear',
|
|
7056
|
-
x0: 0,
|
|
7057
|
-
y0: 0,
|
|
7058
|
-
x1: 0,
|
|
7059
|
-
y1: 1,
|
|
7060
|
-
stops: [
|
|
7061
|
-
{ offset: 0, color: withAlpha(themeColor, 0.2) },
|
|
7062
|
-
{ offset: 1, color: withAlpha(themeColor, 1) }
|
|
7063
|
-
]
|
|
7064
|
-
}
|
|
7065
|
-
}
|
|
7066
|
-
}
|
|
7067
|
-
: null,
|
|
7068
7064
|
{
|
|
7069
7065
|
type: 'rect',
|
|
7070
7066
|
name: `storyline-block-image-bg-${index}`,
|
|
@@ -7072,59 +7068,76 @@
|
|
|
7072
7068
|
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, fill: '#ffffff', stroke: themeColor, lineWidth: 2 }, blockStyle)
|
|
7073
7069
|
},
|
|
7074
7070
|
hasImage
|
|
7075
|
-
? 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,
|
|
7071
|
+
? 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: 'cover', imagePosition: 'center' }, (_m = spec.image) === null || _m === void 0 ? void 0 : _m.style) })
|
|
7076
7072
|
: null,
|
|
7077
7073
|
block.title
|
|
7078
|
-
? 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', textAlign: 'left', textBaseline: 'top' }, (
|
|
7074
|
+
? 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' }, (_o = spec.title) === null || _o === void 0 ? void 0 : _o.style) })
|
|
7079
7075
|
: null,
|
|
7080
7076
|
contentText.length
|
|
7081
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize: PORTRAIT_CONTENT_FONT_SIZE, lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (
|
|
7077
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize: PORTRAIT_CONTENT_FONT_SIZE, lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_p = spec.content) === null || _p === void 0 ? void 0 : _p.style) })
|
|
7082
7078
|
: null
|
|
7083
7079
|
].filter(Boolean)
|
|
7084
7080
|
};
|
|
7085
7081
|
};
|
|
7086
7082
|
|
|
7087
|
-
const
|
|
7088
|
-
const
|
|
7089
|
-
const
|
|
7090
|
-
const
|
|
7091
|
-
const
|
|
7092
|
-
const
|
|
7093
|
-
const
|
|
7094
|
-
const
|
|
7095
|
-
const
|
|
7096
|
-
const
|
|
7097
|
-
const
|
|
7098
|
-
const
|
|
7083
|
+
const ARC_BLOCK_IMAGE_SIZE = 140;
|
|
7084
|
+
const ARC_TEXT_GAP_FROM_IMAGE = 10;
|
|
7085
|
+
const ARC_TITLE_LINE_HEIGHT = 19;
|
|
7086
|
+
const ARC_CONTENT_LINE_HEIGHT = 17;
|
|
7087
|
+
const ARC_CONTENT_FONT_SIZE = 12;
|
|
7088
|
+
const ARC_TEXT_BOX_HEIGHT = 240;
|
|
7089
|
+
const ARC_TITLE_TO_CONTENT_GAP = 4;
|
|
7090
|
+
const ARC_TEXT_LEFT_PADDING = 20;
|
|
7091
|
+
const ARC_TEXT_BOX_MIN_WIDTH = 200;
|
|
7092
|
+
const ARC_CENTER_IMAGE_SIZE_RATIO = 0.4;
|
|
7093
|
+
const ARC_GAP_FROM_CENTER_IMAGE = 200;
|
|
7094
|
+
const isDownArc = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7095
|
+
const getArcCenterImageRect = (spec, ctx) => {
|
|
7099
7096
|
var _a, _b, _c, _e, _f;
|
|
7100
7097
|
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
7101
7098
|
const padding = normalizePadding((_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding);
|
|
7102
7099
|
const innerWidth = Math.max(width - padding.left - padding.right, 1);
|
|
7103
7100
|
const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
|
|
7104
|
-
const
|
|
7105
|
-
const
|
|
7101
|
+
const baseSize = Math.min(innerWidth, innerHeight) * ARC_CENTER_IMAGE_SIZE_RATIO;
|
|
7102
|
+
const w = Math.max((_c = (_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : baseSize, 80);
|
|
7103
|
+
const h = Math.max((_f = (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : baseSize, 80);
|
|
7106
7104
|
const cx = startX + padding.left + innerWidth / 2;
|
|
7107
|
-
const
|
|
7105
|
+
const isDown = isDownArc(spec);
|
|
7106
|
+
const top = isDown
|
|
7107
|
+
?
|
|
7108
|
+
startY + padding.top
|
|
7109
|
+
:
|
|
7110
|
+
startY + padding.top + innerHeight - h;
|
|
7108
7111
|
return { x: cx - w / 2, y: top, width: w, height: h };
|
|
7109
7112
|
};
|
|
7110
|
-
const
|
|
7113
|
+
const getArcGeometry = (spec, ctx) => {
|
|
7111
7114
|
var _a, _b, _c, _e;
|
|
7112
7115
|
const { width, startX } = getRegionGeometry(ctx);
|
|
7113
7116
|
const blockPadding = normalizePadding((_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding);
|
|
7114
7117
|
const innerWidth = Math.max(width - blockPadding.left - blockPadding.right, 1);
|
|
7115
7118
|
const blockWidth = resolveBlockWidth(spec, width);
|
|
7116
7119
|
const layoutOpt = normalizeLayout(spec.layout);
|
|
7117
|
-
const
|
|
7118
|
-
const
|
|
7120
|
+
const isDown = layoutOpt.direction === 'down';
|
|
7121
|
+
const startAngle = (_b = layoutOpt.startAngle) !== null && _b !== void 0 ? _b : (isDown ? 20 : 200);
|
|
7122
|
+
const endAngle = (_c = layoutOpt.endAngle) !== null && _c !== void 0 ? _c : (isDown ? 160 : 340);
|
|
7119
7123
|
const ratio = (_e = layoutOpt.radiusRatio) !== null && _e !== void 0 ? _e : 0.88;
|
|
7120
7124
|
const rx = Math.max((innerWidth - blockWidth) / 2, 1) * ratio;
|
|
7121
|
-
const centerRect =
|
|
7125
|
+
const centerRect = getArcCenterImageRect(spec, ctx);
|
|
7122
7126
|
const centerTop = centerRect.y;
|
|
7123
7127
|
const centerBottom = centerRect.y + centerRect.height;
|
|
7124
7128
|
const sinStart = Math.sin((startAngle / 180) * Math.PI);
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7129
|
+
let cy;
|
|
7130
|
+
let ry;
|
|
7131
|
+
if (isDown) {
|
|
7132
|
+
const denom = Math.max(1 - sinStart, 0.05);
|
|
7133
|
+
ry = (centerRect.height + ARC_GAP_FROM_CENTER_IMAGE) / denom;
|
|
7134
|
+
cy = centerTop - ry * sinStart;
|
|
7135
|
+
}
|
|
7136
|
+
else {
|
|
7137
|
+
const denom = Math.max(1 + sinStart, 0.05);
|
|
7138
|
+
ry = (centerRect.height + ARC_GAP_FROM_CENTER_IMAGE) / denom;
|
|
7139
|
+
cy = centerBottom - ry * sinStart;
|
|
7140
|
+
}
|
|
7128
7141
|
return {
|
|
7129
7142
|
cx: startX + blockPadding.left + innerWidth / 2,
|
|
7130
7143
|
cy,
|
|
@@ -7136,9 +7149,9 @@
|
|
|
7136
7149
|
centerBottom
|
|
7137
7150
|
};
|
|
7138
7151
|
};
|
|
7139
|
-
const
|
|
7152
|
+
const getArcBlockCenter = (spec, ctx, index) => {
|
|
7140
7153
|
var _a, _b, _c, _e;
|
|
7141
|
-
const arc =
|
|
7154
|
+
const arc = getArcGeometry(spec, ctx);
|
|
7142
7155
|
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7143
7156
|
if (count <= 0) {
|
|
7144
7157
|
return { x: arc.cx, y: arc.cy };
|
|
@@ -7152,11 +7165,11 @@
|
|
|
7152
7165
|
const nLen = Math.hypot(nxRaw, nyRaw) || 1;
|
|
7153
7166
|
const nx = nxRaw / nLen;
|
|
7154
7167
|
const ny = nyRaw / nLen;
|
|
7155
|
-
const imageHeight = (_e = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e :
|
|
7168
|
+
const imageHeight = (_e = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : ARC_BLOCK_IMAGE_SIZE;
|
|
7156
7169
|
const offset = imageHeight / 2;
|
|
7157
7170
|
return { x: px + nx * offset, y: py + ny * offset };
|
|
7158
7171
|
};
|
|
7159
|
-
const
|
|
7172
|
+
const buildArcMark = (spec) => {
|
|
7160
7173
|
var _a;
|
|
7161
7174
|
if (((_a = spec.line) === null || _a === void 0 ? void 0 : _a.visible) !== true) {
|
|
7162
7175
|
return null;
|
|
@@ -7164,12 +7177,12 @@
|
|
|
7164
7177
|
const themeColor = getThemeColor(spec);
|
|
7165
7178
|
return {
|
|
7166
7179
|
type: 'group',
|
|
7167
|
-
name: 'storyline-
|
|
7180
|
+
name: 'storyline-arc',
|
|
7168
7181
|
zIndex: vchart.LayoutZIndex.Mark,
|
|
7169
7182
|
children: [
|
|
7170
7183
|
{
|
|
7171
7184
|
type: 'path',
|
|
7172
|
-
name: 'storyline-
|
|
7185
|
+
name: 'storyline-arc-path',
|
|
7173
7186
|
interactive: false,
|
|
7174
7187
|
style: {
|
|
7175
7188
|
stroke: themeColor,
|
|
@@ -7178,7 +7191,7 @@
|
|
|
7178
7191
|
fill: 'transparent',
|
|
7179
7192
|
fillOpacity: 0,
|
|
7180
7193
|
path: (_d, ctx) => {
|
|
7181
|
-
const arc =
|
|
7194
|
+
const arc = getArcGeometry(spec, ctx);
|
|
7182
7195
|
const span = arc.endAngle - arc.startAngle;
|
|
7183
7196
|
const samples = 64;
|
|
7184
7197
|
const segments = [];
|
|
@@ -7196,7 +7209,7 @@
|
|
|
7196
7209
|
]
|
|
7197
7210
|
};
|
|
7198
7211
|
};
|
|
7199
|
-
const
|
|
7212
|
+
const buildArcCenterImageMark = (spec) => {
|
|
7200
7213
|
var _a, _b, _c, _e;
|
|
7201
7214
|
const visible = ((_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.visible) !== false;
|
|
7202
7215
|
if (!visible) {
|
|
@@ -7217,24 +7230,24 @@
|
|
|
7217
7230
|
};
|
|
7218
7231
|
return {
|
|
7219
7232
|
type: 'group',
|
|
7220
|
-
name: 'storyline-
|
|
7233
|
+
name: 'storyline-arc-center',
|
|
7221
7234
|
zIndex: vchart.LayoutZIndex.Mark,
|
|
7222
7235
|
children: [
|
|
7223
7236
|
{
|
|
7224
7237
|
type: 'symbol',
|
|
7225
|
-
name: 'storyline-
|
|
7238
|
+
name: 'storyline-arc-center-symbol',
|
|
7226
7239
|
interactive: false,
|
|
7227
7240
|
style: {
|
|
7228
7241
|
x: (_d, ctx) => {
|
|
7229
|
-
const r =
|
|
7242
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7230
7243
|
return r.x + r.width / 2;
|
|
7231
7244
|
},
|
|
7232
7245
|
y: (_d, ctx) => {
|
|
7233
|
-
const r =
|
|
7246
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7234
7247
|
return r.y + r.height / 2;
|
|
7235
7248
|
},
|
|
7236
7249
|
size: (_d, ctx) => {
|
|
7237
|
-
const r =
|
|
7250
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7238
7251
|
return Math.max(r.width, r.height) * 1.1;
|
|
7239
7252
|
},
|
|
7240
7253
|
symbolType: 'circle',
|
|
@@ -7243,48 +7256,50 @@
|
|
|
7243
7256
|
lineWidth: 2
|
|
7244
7257
|
}
|
|
7245
7258
|
},
|
|
7246
|
-
{
|
|
7247
|
-
type: 'rect',
|
|
7248
|
-
name: 'storyline-dome-center-rect',
|
|
7249
|
-
interactive: false,
|
|
7250
|
-
style: {
|
|
7251
|
-
x: (_d, ctx) => getDomeCenterImageRect(spec, ctx).x,
|
|
7252
|
-
y: (_d, ctx) => getDomeCenterImageRect(spec, ctx).y,
|
|
7253
|
-
width: (_d, ctx) => getDomeCenterImageRect(spec, ctx).width,
|
|
7254
|
-
height: (_d, ctx) => getDomeCenterImageRect(spec, ctx).height,
|
|
7255
|
-
cornerRadius: 12,
|
|
7256
|
-
fill: '#ffffff',
|
|
7257
|
-
stroke: themeColor,
|
|
7258
|
-
lineWidth: 2
|
|
7259
|
-
}
|
|
7260
|
-
},
|
|
7261
7259
|
hasImage
|
|
7262
|
-
? Object.assign(Object.assign({ type: 'image', name: 'storyline-
|
|
7260
|
+
? Object.assign(Object.assign({ type: 'image', name: 'storyline-arc-center-image', interactive: false }, spec.centerImage), { style: Object.assign({ x: (_d, ctx) => getArcCenterImageRect(spec, ctx).x, y: (_d, ctx) => getArcCenterImageRect(spec, ctx).y, width: (_d, ctx) => getArcCenterImageRect(spec, ctx).width, height: (_d, ctx) => getArcCenterImageRect(spec, ctx).height, 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) => {
|
|
7261
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7262
|
+
return [r.x + r.width / 2, r.y + r.height / 2];
|
|
7263
|
+
}, dx: (_d, ctx) => {
|
|
7264
|
+
var _a, _b;
|
|
7265
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7266
|
+
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7267
|
+
const w = typeof userWidth === 'number' ? userWidth : r.width;
|
|
7268
|
+
return (r.width - w) / 2;
|
|
7269
|
+
}, dy: (_d, ctx) => {
|
|
7270
|
+
var _a, _b;
|
|
7271
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7272
|
+
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
7273
|
+
const h = typeof userHeight === 'number' ? userHeight : r.height;
|
|
7274
|
+
return (r.height - h) / 2;
|
|
7275
|
+
} }, (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7263
7276
|
: null
|
|
7264
7277
|
].filter(Boolean)
|
|
7265
7278
|
};
|
|
7266
7279
|
};
|
|
7267
|
-
const
|
|
7280
|
+
const getArcBlockMetrics = (spec) => {
|
|
7268
7281
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
7269
|
-
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 :
|
|
7270
|
-
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(
|
|
7271
|
-
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 :
|
|
7272
|
-
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 :
|
|
7273
|
-
const titleToContentGap =
|
|
7274
|
-
const textHeight =
|
|
7282
|
+
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);
|
|
7283
|
+
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(ARC_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
|
|
7284
|
+
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);
|
|
7285
|
+
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);
|
|
7286
|
+
const titleToContentGap = ARC_TITLE_TO_CONTENT_GAP;
|
|
7287
|
+
const textHeight = ARC_TEXT_BOX_HEIGHT;
|
|
7275
7288
|
const contentHeight = Math.max(textHeight - titleLineHeight - titleToContentGap, contentLineHeight);
|
|
7276
|
-
const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q :
|
|
7277
|
-
const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s :
|
|
7289
|
+
const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : ARC_BLOCK_IMAGE_SIZE;
|
|
7290
|
+
const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : ARC_BLOCK_IMAGE_SIZE;
|
|
7291
|
+
const isDown = isDownArc(spec);
|
|
7278
7292
|
const imageBox = {
|
|
7279
7293
|
x: -imageWidth / 2,
|
|
7280
7294
|
y: -imageHeight / 2,
|
|
7281
7295
|
width: imageWidth,
|
|
7282
7296
|
height: imageHeight
|
|
7283
7297
|
};
|
|
7298
|
+
const textBoxWidth = Math.max(imageWidth - ARC_TEXT_LEFT_PADDING, ARC_TEXT_BOX_MIN_WIDTH);
|
|
7284
7299
|
const textBox = {
|
|
7285
|
-
x: -imageWidth / 2 +
|
|
7286
|
-
y: imageBox.y -
|
|
7287
|
-
width:
|
|
7300
|
+
x: -imageWidth / 2 + ARC_TEXT_LEFT_PADDING,
|
|
7301
|
+
y: isDown ? imageBox.y + imageHeight + ARC_TEXT_GAP_FROM_IMAGE : imageBox.y - ARC_TEXT_GAP_FROM_IMAGE - textHeight,
|
|
7302
|
+
width: textBoxWidth,
|
|
7288
7303
|
height: textHeight
|
|
7289
7304
|
};
|
|
7290
7305
|
const contentBox = {
|
|
@@ -7300,23 +7315,28 @@
|
|
|
7300
7315
|
contentLineHeight,
|
|
7301
7316
|
imageBox,
|
|
7302
7317
|
textBox,
|
|
7303
|
-
contentBox
|
|
7318
|
+
contentBox,
|
|
7319
|
+
isDown
|
|
7304
7320
|
};
|
|
7305
7321
|
};
|
|
7306
|
-
const
|
|
7322
|
+
const buildArcBlockMark = (spec, block, index) => {
|
|
7307
7323
|
var _a, _b, _c, _e;
|
|
7308
7324
|
const hasImage = !!block.image;
|
|
7309
7325
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7310
7326
|
const themeColor = getThemeColor(spec);
|
|
7311
|
-
const metrics =
|
|
7327
|
+
const metrics = getArcBlockMetrics(spec);
|
|
7328
|
+
const connectorY = metrics.isDown ? metrics.imageBox.y + metrics.imageBox.height : metrics.textBox.y;
|
|
7329
|
+
const connectorHeight = metrics.isDown
|
|
7330
|
+
? Math.max(metrics.textBox.y + metrics.textBox.height - (metrics.imageBox.y + metrics.imageBox.height), 0)
|
|
7331
|
+
: Math.max(metrics.imageBox.y - metrics.textBox.y, 0);
|
|
7312
7332
|
return {
|
|
7313
7333
|
type: 'group',
|
|
7314
7334
|
id: `storyline-block-${(_a = block.id) !== null && _a !== void 0 ? _a : index}`,
|
|
7315
7335
|
name: `storyline-block-${index}`,
|
|
7316
7336
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7317
7337
|
style: {
|
|
7318
|
-
x: (_d, ctx) =>
|
|
7319
|
-
y: (_d, ctx) =>
|
|
7338
|
+
x: (_d, ctx) => getArcBlockCenter(spec, ctx, index).x,
|
|
7339
|
+
y: (_d, ctx) => getArcBlockCenter(spec, ctx, index).y
|
|
7320
7340
|
},
|
|
7321
7341
|
children: [
|
|
7322
7342
|
{
|
|
@@ -7325,15 +7345,15 @@
|
|
|
7325
7345
|
interactive: false,
|
|
7326
7346
|
style: {
|
|
7327
7347
|
x: metrics.imageBox.x,
|
|
7328
|
-
y:
|
|
7348
|
+
y: connectorY,
|
|
7329
7349
|
width: 2,
|
|
7330
|
-
height:
|
|
7350
|
+
height: connectorHeight,
|
|
7331
7351
|
fill: themeColor,
|
|
7332
7352
|
fillOpacity: 0.6
|
|
7333
7353
|
}
|
|
7334
7354
|
},
|
|
7335
7355
|
hasImage
|
|
7336
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, image: block.image,
|
|
7356
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
|
|
7337
7357
|
: {
|
|
7338
7358
|
type: 'rect',
|
|
7339
7359
|
name: `storyline-block-image-bg-${index}`,
|
|
@@ -7350,120 +7370,123 @@
|
|
|
7350
7370
|
}
|
|
7351
7371
|
},
|
|
7352
7372
|
block.title
|
|
7353
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, 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', textAlign: 'left', textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7373
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, 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: 'left', textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7354
7374
|
: null,
|
|
7355
7375
|
contentText.length
|
|
7356
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize:
|
|
7376
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize: ARC_CONTENT_FONT_SIZE, lineHeight: ARC_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7357
7377
|
: null
|
|
7358
7378
|
].filter(Boolean)
|
|
7359
7379
|
};
|
|
7360
7380
|
};
|
|
7361
7381
|
|
|
7362
|
-
const
|
|
7363
|
-
const
|
|
7364
|
-
const
|
|
7365
|
-
const
|
|
7366
|
-
const
|
|
7367
|
-
const
|
|
7368
|
-
const
|
|
7369
|
-
const
|
|
7370
|
-
const
|
|
7371
|
-
const
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7382
|
+
const WING_BLOCK_IMAGE_SIZE = 96;
|
|
7383
|
+
const WING_TEXT_GAP_FROM_IMAGE = 14;
|
|
7384
|
+
const WING_TITLE_LINE_HEIGHT = 30;
|
|
7385
|
+
const WING_TITLE_FONT_SIZE = 22;
|
|
7386
|
+
const WING_CONTENT_LINE_HEIGHT = 17;
|
|
7387
|
+
const WING_CONTENT_FONT_SIZE = 12;
|
|
7388
|
+
const WING_TEXT_BOX_WIDTH = 240;
|
|
7389
|
+
const WING_TEXT_BOX_HEIGHT = 110;
|
|
7390
|
+
const WING_TITLE_TO_CONTENT_GAP = 4;
|
|
7391
|
+
const getWingDirection = (spec) => {
|
|
7392
|
+
var _a;
|
|
7393
|
+
return (_a = normalizeLayout(spec.layout).direction) !== null && _a !== void 0 ? _a : 'left';
|
|
7394
|
+
};
|
|
7395
|
+
const getWingArcGeometry = (spec, ctx) => {
|
|
7396
|
+
var _a, _b, _c, _e;
|
|
7375
7397
|
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
7376
7398
|
const padding = normalizePadding((_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding);
|
|
7377
7399
|
const innerWidth = Math.max(width - padding.left - padding.right, 1);
|
|
7378
7400
|
const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
|
|
7379
|
-
const w = Math.max((_c = (_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : innerWidth * BOWL_CENTER_IMAGE_WIDTH_RATIO, 80);
|
|
7380
|
-
const h = Math.max((_f = (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : innerHeight * BOWL_CENTER_IMAGE_HEIGHT_RATIO, 60);
|
|
7381
|
-
const cx = startX + padding.left + innerWidth / 2;
|
|
7382
|
-
const top = startY + padding.top;
|
|
7383
|
-
return { x: cx - w / 2, y: top, width: w, height: h };
|
|
7384
|
-
};
|
|
7385
|
-
const getBowlArcGeometry = (spec, ctx) => {
|
|
7386
|
-
var _a, _b, _c, _e;
|
|
7387
|
-
const { width, startX } = getRegionGeometry(ctx);
|
|
7388
|
-
const blockPadding = normalizePadding((_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding);
|
|
7389
|
-
const innerWidth = Math.max(width - blockPadding.left - blockPadding.right, 1);
|
|
7390
|
-
const blockWidth = resolveBlockWidth(spec, width);
|
|
7391
7401
|
const layoutOpt = normalizeLayout(spec.layout);
|
|
7392
|
-
const
|
|
7393
|
-
const
|
|
7394
|
-
const
|
|
7395
|
-
const
|
|
7396
|
-
const
|
|
7397
|
-
const
|
|
7398
|
-
const
|
|
7399
|
-
const
|
|
7400
|
-
const
|
|
7401
|
-
const
|
|
7402
|
-
|
|
7403
|
-
return {
|
|
7404
|
-
cx: startX + blockPadding.left + innerWidth / 2,
|
|
7405
|
-
cy,
|
|
7406
|
-
rx,
|
|
7407
|
-
ry,
|
|
7408
|
-
startAngle,
|
|
7409
|
-
endAngle,
|
|
7410
|
-
centerTop,
|
|
7411
|
-
centerBottom
|
|
7412
|
-
};
|
|
7402
|
+
const direction = getWingDirection(spec);
|
|
7403
|
+
const defaultStart = direction === 'right' ? 110 : -70;
|
|
7404
|
+
const defaultEnd = direction === 'right' ? 250 : 70;
|
|
7405
|
+
const startAngle = (_b = layoutOpt.startAngle) !== null && _b !== void 0 ? _b : defaultStart;
|
|
7406
|
+
const endAngle = (_c = layoutOpt.endAngle) !== null && _c !== void 0 ? _c : defaultEnd;
|
|
7407
|
+
const ratio = (_e = layoutOpt.radiusRatio) !== null && _e !== void 0 ? _e : 0.92;
|
|
7408
|
+
const ry = (innerHeight / 2) * ratio;
|
|
7409
|
+
const rx = innerWidth * 0.6 * ratio;
|
|
7410
|
+
const cx = direction === 'right' ? startX + padding.left + innerWidth - rx * 0.1 : startX + padding.left + rx * 0.1;
|
|
7411
|
+
const cy = startY + padding.top + innerHeight / 2;
|
|
7412
|
+
return { cx, cy, rx, ry, startAngle, endAngle };
|
|
7413
7413
|
};
|
|
7414
|
-
const
|
|
7415
|
-
var _a, _b
|
|
7416
|
-
const arc =
|
|
7414
|
+
const getWingBlockCenter = (spec, ctx, index) => {
|
|
7415
|
+
var _a, _b;
|
|
7416
|
+
const arc = getWingArcGeometry(spec, ctx);
|
|
7417
7417
|
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7418
7418
|
if (count <= 0) {
|
|
7419
7419
|
return { x: arc.cx, y: arc.cy };
|
|
7420
7420
|
}
|
|
7421
7421
|
const t = count === 1 ? 0.5 : index / (count - 1);
|
|
7422
7422
|
const angle = ((arc.startAngle + (arc.endAngle - arc.startAngle) * t) / 180) * Math.PI;
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
const nLen = Math.hypot(nxRaw, nyRaw) || 1;
|
|
7428
|
-
const nx = nxRaw / nLen;
|
|
7429
|
-
const ny = nyRaw / nLen;
|
|
7430
|
-
const imageHeight = (_e = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : BOWL_BLOCK_IMAGE_SIZE;
|
|
7431
|
-
const offset = imageHeight / 2;
|
|
7432
|
-
return { x: px + nx * offset, y: py + ny * offset };
|
|
7423
|
+
return {
|
|
7424
|
+
x: arc.cx + Math.cos(angle) * arc.rx,
|
|
7425
|
+
y: arc.cy + Math.sin(angle) * arc.ry
|
|
7426
|
+
};
|
|
7433
7427
|
};
|
|
7434
|
-
const
|
|
7435
|
-
|
|
7436
|
-
|
|
7428
|
+
const isTextOnLeft = (spec, index) => {
|
|
7429
|
+
const direction = getWingDirection(spec);
|
|
7430
|
+
return direction === 'right' ? index % 2 === 1 : index % 2 === 0;
|
|
7431
|
+
};
|
|
7432
|
+
const buildWingArcMark = (spec) => {
|
|
7433
|
+
var _a, _b, _c, _e, _f, _g, _h, _j;
|
|
7434
|
+
if (((_a = spec.line) === null || _a === void 0 ? void 0 : _a.visible) === false) {
|
|
7437
7435
|
return null;
|
|
7438
7436
|
}
|
|
7439
7437
|
const themeColor = getThemeColor(spec);
|
|
7438
|
+
const lineStyle = ((_c = (_b = spec.line) === null || _b === void 0 ? void 0 : _b.style) !== null && _c !== void 0 ? _c : {});
|
|
7439
|
+
const startWidth = Math.max(Number((_e = lineStyle.startWidth) !== null && _e !== void 0 ? _e : 2), 0.5);
|
|
7440
|
+
const endWidth = Math.max(Number((_g = (_f = lineStyle.endWidth) !== null && _f !== void 0 ? _f : lineStyle.lineWidth) !== null && _g !== void 0 ? _g : 18), startWidth);
|
|
7440
7441
|
return {
|
|
7441
7442
|
type: 'group',
|
|
7442
|
-
name: 'storyline-
|
|
7443
|
+
name: 'storyline-wing-arc',
|
|
7443
7444
|
zIndex: vchart.LayoutZIndex.Mark,
|
|
7444
7445
|
children: [
|
|
7445
7446
|
{
|
|
7446
7447
|
type: 'path',
|
|
7447
|
-
name: 'storyline-
|
|
7448
|
+
name: 'storyline-wing-arc-path',
|
|
7448
7449
|
interactive: false,
|
|
7449
7450
|
style: {
|
|
7450
|
-
stroke:
|
|
7451
|
-
lineWidth:
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
fillOpacity: 0,
|
|
7451
|
+
stroke: false,
|
|
7452
|
+
lineWidth: 0,
|
|
7453
|
+
fill: (_j = (_h = lineStyle.fill) !== null && _h !== void 0 ? _h : lineStyle.stroke) !== null && _j !== void 0 ? _j : themeColor,
|
|
7454
|
+
opacity: 0.95,
|
|
7455
7455
|
path: (_d, ctx) => {
|
|
7456
|
-
const arc =
|
|
7456
|
+
const arc = getWingArcGeometry(spec, ctx);
|
|
7457
7457
|
const span = arc.endAngle - arc.startAngle;
|
|
7458
|
-
const samples =
|
|
7459
|
-
const
|
|
7458
|
+
const samples = 96;
|
|
7459
|
+
const pts = [];
|
|
7460
7460
|
for (let i = 0; i <= samples; i++) {
|
|
7461
7461
|
const t = i / samples;
|
|
7462
7462
|
const angle = ((arc.startAngle + span * t) / 180) * Math.PI;
|
|
7463
|
-
const
|
|
7464
|
-
const
|
|
7463
|
+
const cx = arc.cx + Math.cos(angle) * arc.rx;
|
|
7464
|
+
const cy = arc.cy + Math.sin(angle) * arc.ry;
|
|
7465
|
+
const nxRaw = Math.cos(angle) / arc.rx;
|
|
7466
|
+
const nyRaw = Math.sin(angle) / arc.ry;
|
|
7467
|
+
const nLen = Math.hypot(nxRaw, nyRaw) || 1;
|
|
7468
|
+
pts.push({
|
|
7469
|
+
x: cx,
|
|
7470
|
+
y: cy,
|
|
7471
|
+
nx: nxRaw / nLen,
|
|
7472
|
+
ny: nyRaw / nLen,
|
|
7473
|
+
w: startWidth + (endWidth - startWidth) * t
|
|
7474
|
+
});
|
|
7475
|
+
}
|
|
7476
|
+
const segments = [];
|
|
7477
|
+
for (let i = 0; i < pts.length; i++) {
|
|
7478
|
+
const p = pts[i];
|
|
7479
|
+
const x = p.x + p.nx * (p.w / 2);
|
|
7480
|
+
const y = p.y + p.ny * (p.w / 2);
|
|
7465
7481
|
segments.push(`${i === 0 ? 'M' : 'L'} ${x.toFixed(2)} ${y.toFixed(2)}`);
|
|
7466
7482
|
}
|
|
7483
|
+
for (let i = pts.length - 1; i >= 0; i--) {
|
|
7484
|
+
const p = pts[i];
|
|
7485
|
+
const x = p.x - p.nx * (p.w / 2);
|
|
7486
|
+
const y = p.y - p.ny * (p.w / 2);
|
|
7487
|
+
segments.push(`L ${x.toFixed(2)} ${y.toFixed(2)}`);
|
|
7488
|
+
}
|
|
7489
|
+
segments.push('Z');
|
|
7467
7490
|
return segments.join(' ');
|
|
7468
7491
|
}
|
|
7469
7492
|
}
|
|
@@ -7471,104 +7494,38 @@
|
|
|
7471
7494
|
]
|
|
7472
7495
|
};
|
|
7473
7496
|
};
|
|
7474
|
-
const
|
|
7475
|
-
var _a, _b, _c, _e;
|
|
7476
|
-
const visible = ((_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.visible) !== false;
|
|
7477
|
-
if (!visible) {
|
|
7478
|
-
return null;
|
|
7479
|
-
}
|
|
7480
|
-
const themeColor = getThemeColor(spec);
|
|
7481
|
-
const hasImage = !!((_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.image);
|
|
7482
|
-
const symbolGradient = {
|
|
7483
|
-
gradient: 'linear',
|
|
7484
|
-
x0: 0.5,
|
|
7485
|
-
y0: 0,
|
|
7486
|
-
x1: 0.5,
|
|
7487
|
-
y1: 1,
|
|
7488
|
-
stops: [
|
|
7489
|
-
{ offset: 0, color: withAlpha(themeColor, 0.15) },
|
|
7490
|
-
{ offset: 1, color: themeColor }
|
|
7491
|
-
]
|
|
7492
|
-
};
|
|
7493
|
-
return {
|
|
7494
|
-
type: 'group',
|
|
7495
|
-
name: 'storyline-bowl-center',
|
|
7496
|
-
zIndex: vchart.LayoutZIndex.Mark,
|
|
7497
|
-
children: [
|
|
7498
|
-
{
|
|
7499
|
-
type: 'symbol',
|
|
7500
|
-
name: 'storyline-bowl-center-symbol',
|
|
7501
|
-
interactive: false,
|
|
7502
|
-
style: {
|
|
7503
|
-
x: (_d, ctx) => {
|
|
7504
|
-
const r = getBowlCenterImageRect(spec, ctx);
|
|
7505
|
-
return r.x + r.width / 2;
|
|
7506
|
-
},
|
|
7507
|
-
y: (_d, ctx) => {
|
|
7508
|
-
const r = getBowlCenterImageRect(spec, ctx);
|
|
7509
|
-
return r.y + r.height / 2;
|
|
7510
|
-
},
|
|
7511
|
-
size: (_d, ctx) => {
|
|
7512
|
-
const r = getBowlCenterImageRect(spec, ctx);
|
|
7513
|
-
return Math.max(r.width, r.height) * 1.1;
|
|
7514
|
-
},
|
|
7515
|
-
symbolType: 'circle',
|
|
7516
|
-
fill: symbolGradient,
|
|
7517
|
-
stroke: themeColor,
|
|
7518
|
-
lineWidth: 2
|
|
7519
|
-
}
|
|
7520
|
-
},
|
|
7521
|
-
{
|
|
7522
|
-
type: 'rect',
|
|
7523
|
-
name: 'storyline-bowl-center-rect',
|
|
7524
|
-
interactive: false,
|
|
7525
|
-
style: {
|
|
7526
|
-
x: (_d, ctx) => getBowlCenterImageRect(spec, ctx).x,
|
|
7527
|
-
y: (_d, ctx) => getBowlCenterImageRect(spec, ctx).y,
|
|
7528
|
-
width: (_d, ctx) => getBowlCenterImageRect(spec, ctx).width,
|
|
7529
|
-
height: (_d, ctx) => getBowlCenterImageRect(spec, ctx).height,
|
|
7530
|
-
cornerRadius: 12,
|
|
7531
|
-
fill: '#ffffff',
|
|
7532
|
-
stroke: themeColor,
|
|
7533
|
-
lineWidth: 2
|
|
7534
|
-
}
|
|
7535
|
-
},
|
|
7536
|
-
hasImage
|
|
7537
|
-
? Object.assign(Object.assign({ type: 'image', name: 'storyline-bowl-center-image', interactive: false }, spec.centerImage), { style: Object.assign({ x: (_d, ctx) => getBowlCenterImageRect(spec, ctx).x, y: (_d, ctx) => getBowlCenterImageRect(spec, ctx).y, width: (_d, ctx) => getBowlCenterImageRect(spec, ctx).width, height: (_d, ctx) => getBowlCenterImageRect(spec, ctx).height, image: (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.image, cornerRadius: 12, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7538
|
-
: null
|
|
7539
|
-
].filter(Boolean)
|
|
7540
|
-
};
|
|
7541
|
-
};
|
|
7542
|
-
const getBowlBlockMetrics = (spec) => {
|
|
7497
|
+
const getWingBlockMetrics = (spec, index) => {
|
|
7543
7498
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
7544
|
-
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 :
|
|
7545
|
-
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(
|
|
7546
|
-
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 :
|
|
7547
|
-
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 :
|
|
7548
|
-
const titleToContentGap =
|
|
7549
|
-
const textHeight =
|
|
7499
|
+
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 : WING_TITLE_FONT_SIZE);
|
|
7500
|
+
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(WING_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.3)));
|
|
7501
|
+
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 : WING_CONTENT_FONT_SIZE);
|
|
7502
|
+
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 : WING_CONTENT_LINE_HEIGHT);
|
|
7503
|
+
const titleToContentGap = WING_TITLE_TO_CONTENT_GAP;
|
|
7504
|
+
const textHeight = WING_TEXT_BOX_HEIGHT;
|
|
7550
7505
|
const contentHeight = Math.max(textHeight - titleLineHeight - titleToContentGap, contentLineHeight);
|
|
7551
|
-
const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q :
|
|
7552
|
-
const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s :
|
|
7506
|
+
const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : WING_BLOCK_IMAGE_SIZE;
|
|
7507
|
+
const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : WING_BLOCK_IMAGE_SIZE;
|
|
7553
7508
|
const imageBox = {
|
|
7554
7509
|
x: -imageWidth / 2,
|
|
7555
7510
|
y: -imageHeight / 2,
|
|
7556
7511
|
width: imageWidth,
|
|
7557
7512
|
height: imageHeight
|
|
7558
7513
|
};
|
|
7559
|
-
const
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7514
|
+
const onLeft = isTextOnLeft(spec, index);
|
|
7515
|
+
const textWidth = WING_TEXT_BOX_WIDTH;
|
|
7516
|
+
const textX = onLeft
|
|
7517
|
+
? -imageWidth / 2 - WING_TEXT_GAP_FROM_IMAGE - textWidth
|
|
7518
|
+
: imageWidth / 2 + WING_TEXT_GAP_FROM_IMAGE;
|
|
7519
|
+
const textY = -textHeight / 2;
|
|
7520
|
+
const textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
7565
7521
|
const contentBox = {
|
|
7566
|
-
x:
|
|
7567
|
-
y:
|
|
7568
|
-
width:
|
|
7522
|
+
x: textX,
|
|
7523
|
+
y: textY + titleLineHeight + titleToContentGap,
|
|
7524
|
+
width: textWidth,
|
|
7569
7525
|
height: contentHeight
|
|
7570
7526
|
};
|
|
7571
7527
|
return {
|
|
7528
|
+
onLeft,
|
|
7572
7529
|
titleFontSize,
|
|
7573
7530
|
titleLineHeight,
|
|
7574
7531
|
contentFontSize,
|
|
@@ -7578,37 +7535,41 @@
|
|
|
7578
7535
|
contentBox
|
|
7579
7536
|
};
|
|
7580
7537
|
};
|
|
7581
|
-
const
|
|
7582
|
-
var _a, _b, _c, _e;
|
|
7538
|
+
const buildWingBlockMark = (spec, block, index) => {
|
|
7539
|
+
var _a, _b, _c, _e, _f;
|
|
7583
7540
|
const hasImage = !!block.image;
|
|
7584
7541
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7585
7542
|
const themeColor = getThemeColor(spec);
|
|
7586
|
-
const metrics =
|
|
7543
|
+
const metrics = getWingBlockMetrics(spec, index);
|
|
7544
|
+
const showBackground = ((_a = spec.image) === null || _a === void 0 ? void 0 : _a.showBackground) === true;
|
|
7587
7545
|
return {
|
|
7588
7546
|
type: 'group',
|
|
7589
|
-
id: `storyline-block-${(
|
|
7547
|
+
id: `storyline-block-${(_b = block.id) !== null && _b !== void 0 ? _b : index}`,
|
|
7590
7548
|
name: `storyline-block-${index}`,
|
|
7591
7549
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7592
7550
|
style: {
|
|
7593
|
-
x: (_d, ctx) =>
|
|
7594
|
-
y: (_d, ctx) =>
|
|
7551
|
+
x: (_d, ctx) => getWingBlockCenter(spec, ctx, index).x,
|
|
7552
|
+
y: (_d, ctx) => getWingBlockCenter(spec, ctx, index).y
|
|
7595
7553
|
},
|
|
7596
7554
|
children: [
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7555
|
+
showBackground
|
|
7556
|
+
? {
|
|
7557
|
+
type: 'symbol',
|
|
7558
|
+
name: `storyline-block-image-halo-${index}`,
|
|
7559
|
+
interactive: false,
|
|
7560
|
+
style: {
|
|
7561
|
+
x: 0,
|
|
7562
|
+
y: 0,
|
|
7563
|
+
size: Math.max(metrics.imageBox.width, metrics.imageBox.height) + 12,
|
|
7564
|
+
symbolType: 'circle',
|
|
7565
|
+
fill: withAlpha(themeColor, 0.18),
|
|
7566
|
+
stroke: themeColor,
|
|
7567
|
+
lineWidth: 1.5
|
|
7568
|
+
}
|
|
7608
7569
|
}
|
|
7609
|
-
|
|
7570
|
+
: null,
|
|
7610
7571
|
hasImage
|
|
7611
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, image: block.image,
|
|
7572
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_c = spec.image) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7612
7573
|
: {
|
|
7613
7574
|
type: 'rect',
|
|
7614
7575
|
name: `storyline-block-image-bg-${index}`,
|
|
@@ -7625,10 +7586,188 @@
|
|
|
7625
7586
|
}
|
|
7626
7587
|
},
|
|
7627
7588
|
block.title
|
|
7628
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, 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: '#
|
|
7589
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.title), { style: Object.assign({ x: metrics.onLeft ? metrics.textBox.x + metrics.textBox.width : metrics.textBox.x, y: metrics.textBox.y, text: block.title, maxLineWidth: metrics.textBox.width, fontSize: metrics.titleFontSize, lineHeight: metrics.titleLineHeight, fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: metrics.onLeft ? 'right' : 'left', textBaseline: 'top' }, (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7629
7590
|
: null,
|
|
7630
7591
|
contentText.length
|
|
7631
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize:
|
|
7592
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.content), { textType: 'rich', style: Object.assign({ x: metrics.onLeft ? metrics.contentBox.x + metrics.contentBox.width : metrics.contentBox.x, y: metrics.contentBox.y, width: metrics.contentBox.width, height: metrics.contentBox.height, maxLineWidth: metrics.contentBox.width, heightLimit: metrics.contentBox.height, text: buildRichContent(contentText, spec), fontSize: WING_CONTENT_FONT_SIZE, lineHeight: WING_CONTENT_LINE_HEIGHT, textAlign: metrics.onLeft ? 'right' : 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#1f2430' }, (_f = spec.content) === null || _f === void 0 ? void 0 : _f.style) })
|
|
7593
|
+
: null
|
|
7594
|
+
].filter(Boolean)
|
|
7595
|
+
};
|
|
7596
|
+
};
|
|
7597
|
+
|
|
7598
|
+
const LADDER_HEADLINE_FONT_RATIO = 0.42;
|
|
7599
|
+
const LADDER_HEADLINE_FONT_MIN = 80;
|
|
7600
|
+
const LADDER_HEADLINE_FONT_MAX = 240;
|
|
7601
|
+
const LADDER_DIAGONAL_LINE_WIDTH = 2;
|
|
7602
|
+
const LADDER_DIAGONAL_DASH = [12, 8];
|
|
7603
|
+
const LADDER_BLOCK_IMAGE_SIZE = 96;
|
|
7604
|
+
const LADDER_TITLE_FONT_SIZE = 28;
|
|
7605
|
+
const LADDER_TITLE_LINE_HEIGHT = 36;
|
|
7606
|
+
const LADDER_CONTENT_FONT_SIZE = 16;
|
|
7607
|
+
const LADDER_CONTENT_LINE_HEIGHT = 24;
|
|
7608
|
+
const isDownLadder = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7609
|
+
const getLadderDiagonalGeometry = (spec, ctx) => {
|
|
7610
|
+
var _a;
|
|
7611
|
+
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
7612
|
+
const padding = normalizePadding((_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding);
|
|
7613
|
+
const innerX = startX + padding.left;
|
|
7614
|
+
const innerY = startY + padding.top;
|
|
7615
|
+
const innerW = Math.max(width - padding.left - padding.right, 1);
|
|
7616
|
+
const innerH = Math.max(height - padding.top - padding.bottom, 1);
|
|
7617
|
+
const isDown = isDownLadder(spec);
|
|
7618
|
+
const x0 = innerX;
|
|
7619
|
+
const x1 = innerX + innerW;
|
|
7620
|
+
const y0 = isDown ? innerY : innerY + innerH;
|
|
7621
|
+
const y1 = isDown ? innerY + innerH : innerY;
|
|
7622
|
+
const cx = (x0 + x1) / 2;
|
|
7623
|
+
const cy = (y0 + y1) / 2;
|
|
7624
|
+
const dx = x1 - x0;
|
|
7625
|
+
const dy = y1 - y0;
|
|
7626
|
+
const angleRad = (Math.atan2(dy, dx) / Math.PI) * 180;
|
|
7627
|
+
const fontSize = Math.max(LADDER_HEADLINE_FONT_MIN, Math.min(LADDER_HEADLINE_FONT_MAX, Math.round(innerH * LADDER_HEADLINE_FONT_RATIO)));
|
|
7628
|
+
return { x0, y0, x1, y1, cx, cy, angleRad, fontSize };
|
|
7629
|
+
};
|
|
7630
|
+
const getLadderHeadlineText = (spec) => {
|
|
7631
|
+
var _a, _b;
|
|
7632
|
+
const layoutOpt = normalizeLayout(spec.layout);
|
|
7633
|
+
if (typeof layoutOpt.headline === 'string' && layoutOpt.headline.length > 0) {
|
|
7634
|
+
return layoutOpt.headline;
|
|
7635
|
+
}
|
|
7636
|
+
const title = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.text;
|
|
7637
|
+
if (typeof title === 'string' && title.length > 0) {
|
|
7638
|
+
return title;
|
|
7639
|
+
}
|
|
7640
|
+
return 'storyline';
|
|
7641
|
+
};
|
|
7642
|
+
const buildLadderDiagonalMark = (spec) => {
|
|
7643
|
+
const themeColor = getThemeColor(spec);
|
|
7644
|
+
return {
|
|
7645
|
+
type: 'group',
|
|
7646
|
+
name: 'storyline-ladder-diagonal',
|
|
7647
|
+
zIndex: vchart.LayoutZIndex.Mark - 1,
|
|
7648
|
+
children: [
|
|
7649
|
+
{
|
|
7650
|
+
type: 'path',
|
|
7651
|
+
name: 'storyline-ladder-diagonal-line',
|
|
7652
|
+
interactive: false,
|
|
7653
|
+
style: {
|
|
7654
|
+
path: (_d, ctx) => {
|
|
7655
|
+
const g = getLadderDiagonalGeometry(spec, ctx);
|
|
7656
|
+
return `M ${g.x0} ${g.y0} L ${g.x1} ${g.y1}`;
|
|
7657
|
+
},
|
|
7658
|
+
stroke: withAlpha(themeColor, 0.85),
|
|
7659
|
+
lineWidth: LADDER_DIAGONAL_LINE_WIDTH,
|
|
7660
|
+
lineDash: LADDER_DIAGONAL_DASH,
|
|
7661
|
+
fill: 'transparent'
|
|
7662
|
+
}
|
|
7663
|
+
}
|
|
7664
|
+
]
|
|
7665
|
+
};
|
|
7666
|
+
};
|
|
7667
|
+
const buildLadderHeadlineMark = (spec) => {
|
|
7668
|
+
const text = getLadderHeadlineText(spec);
|
|
7669
|
+
if (!text) {
|
|
7670
|
+
return null;
|
|
7671
|
+
}
|
|
7672
|
+
const themeColor = getThemeColor(spec);
|
|
7673
|
+
return {
|
|
7674
|
+
type: 'group',
|
|
7675
|
+
name: 'storyline-ladder-headline',
|
|
7676
|
+
zIndex: vchart.LayoutZIndex.Mark,
|
|
7677
|
+
style: {
|
|
7678
|
+
x: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).cx,
|
|
7679
|
+
y: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).cy,
|
|
7680
|
+
angle: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).angleRad
|
|
7681
|
+
},
|
|
7682
|
+
children: [
|
|
7683
|
+
{
|
|
7684
|
+
type: 'text',
|
|
7685
|
+
name: 'storyline-ladder-headline-text',
|
|
7686
|
+
interactive: false,
|
|
7687
|
+
style: {
|
|
7688
|
+
x: 0,
|
|
7689
|
+
y: 0,
|
|
7690
|
+
text,
|
|
7691
|
+
fontSize: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).fontSize,
|
|
7692
|
+
fontWeight: 900,
|
|
7693
|
+
fontFamily: 'Impact, "Arial Black", sans-serif',
|
|
7694
|
+
fill: withAlpha(themeColor, 0.92),
|
|
7695
|
+
textAlign: 'center',
|
|
7696
|
+
textBaseline: 'middle'
|
|
7697
|
+
}
|
|
7698
|
+
}
|
|
7699
|
+
]
|
|
7700
|
+
};
|
|
7701
|
+
};
|
|
7702
|
+
const isOnLeft = (index) => index % 2 === 1;
|
|
7703
|
+
const getLadderBlockMetrics = (spec, ctx, index) => {
|
|
7704
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
7705
|
+
const block = getLayout(spec, ctx).blocks[index];
|
|
7706
|
+
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
7707
|
+
const imagePosition = isOnLeft(index) ? 'right' : 'left';
|
|
7708
|
+
const imageWidth = (_e = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.width) !== null && _e !== void 0 ? _e : LADDER_BLOCK_IMAGE_SIZE;
|
|
7709
|
+
const imageHeight = (_g = (_f = spec.image) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : LADDER_BLOCK_IMAGE_SIZE;
|
|
7710
|
+
const imageGap = (_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : DEFAULT_IMAGE_GAP;
|
|
7711
|
+
const hasImage = !!((_l = (_k = spec.data) === null || _k === void 0 ? void 0 : _k[index]) === null || _l === void 0 ? void 0 : _l.image);
|
|
7712
|
+
const titleFontSize = Number((_p = (_o = (_m = spec.title) === null || _m === void 0 ? void 0 : _m.style) === null || _o === void 0 ? void 0 : _o.fontSize) !== null && _p !== void 0 ? _p : LADDER_TITLE_FONT_SIZE);
|
|
7713
|
+
const titleLineHeight = Number((_s = (_r = (_q = spec.title) === null || _q === void 0 ? void 0 : _q.style) === null || _r === void 0 ? void 0 : _r.lineHeight) !== null && _s !== void 0 ? _s : Math.round(titleFontSize * (LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE)));
|
|
7714
|
+
const titleHeight = ((_u = (_t = spec.data) === null || _t === void 0 ? void 0 : _t[index]) === null || _u === void 0 ? void 0 : _u.title) ? titleLineHeight : 0;
|
|
7715
|
+
const blockWidth = (_v = block === null || block === void 0 ? void 0 : block.width) !== null && _v !== void 0 ? _v : resolveBlockWidth(spec, 0);
|
|
7716
|
+
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;
|
|
7717
|
+
const imageBox = getImageBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
7718
|
+
const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
7719
|
+
const contentGap = ((_0 = (_z = spec.data) === null || _z === void 0 ? void 0 : _z[index]) === null || _0 === void 0 ? void 0 : _0.title) ? 8 : 0;
|
|
7720
|
+
return {
|
|
7721
|
+
block: { width: blockWidth, height: blockHeight },
|
|
7722
|
+
imageBox,
|
|
7723
|
+
textBox,
|
|
7724
|
+
contentBox: {
|
|
7725
|
+
y: textBox.y + titleHeight + contentGap,
|
|
7726
|
+
height: Math.max(0, textBox.height - titleHeight - contentGap)
|
|
7727
|
+
}
|
|
7728
|
+
};
|
|
7729
|
+
};
|
|
7730
|
+
const buildLadderBlockMark = (spec, block, index) => {
|
|
7731
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
7732
|
+
const hasImage = !!block.image;
|
|
7733
|
+
const onLeft = isOnLeft(index);
|
|
7734
|
+
const align = onLeft ? 'right' : 'left';
|
|
7735
|
+
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7736
|
+
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 : LADDER_TITLE_FONT_SIZE);
|
|
7737
|
+
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)));
|
|
7738
|
+
const showBackground = ((_h = spec.block) === null || _h === void 0 ? void 0 : _h.showBackground) === true;
|
|
7739
|
+
const getTitleX = (ctx) => {
|
|
7740
|
+
const m = getLadderBlockMetrics(spec, ctx, index);
|
|
7741
|
+
return align === 'right' ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
7742
|
+
};
|
|
7743
|
+
return {
|
|
7744
|
+
type: 'group',
|
|
7745
|
+
id: `storyline-block-${(_j = block.id) !== null && _j !== void 0 ? _j : index}`,
|
|
7746
|
+
name: `storyline-block-${index}`,
|
|
7747
|
+
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7748
|
+
style: {
|
|
7749
|
+
x: (_d, ctx) => { var _a, _b; return (_b = (_a = getLayout(spec, ctx).blocks[index]) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0; },
|
|
7750
|
+
y: (_d, ctx) => { var _a, _b; return (_b = (_a = getLayout(spec, ctx).blocks[index]) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : 0; },
|
|
7751
|
+
width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.width,
|
|
7752
|
+
height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.height
|
|
7753
|
+
},
|
|
7754
|
+
children: [
|
|
7755
|
+
showBackground
|
|
7756
|
+
? {
|
|
7757
|
+
type: 'rect',
|
|
7758
|
+
name: `storyline-block-bg-${index}`,
|
|
7759
|
+
interactive: false,
|
|
7760
|
+
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)' }, (_k = spec.block) === null || _k === void 0 ? void 0 : _k.style)
|
|
7761
|
+
}
|
|
7762
|
+
: null,
|
|
7763
|
+
hasImage
|
|
7764
|
+
? 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 }, (_l = spec.image) === null || _l === void 0 ? void 0 : _l.style) })
|
|
7765
|
+
: null,
|
|
7766
|
+
block.title
|
|
7767
|
+
? 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' }, (_m = spec.title) === null || _m === void 0 ? void 0 : _m.style), { textAlign: align }) })
|
|
7768
|
+
: null,
|
|
7769
|
+
contentText.length
|
|
7770
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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, text: buildRichContent(contentText, spec), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, fontSize: LADDER_CONTENT_FONT_SIZE, lineHeight: LADDER_CONTENT_LINE_HEIGHT, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style), { textAlign: align }) })
|
|
7632
7771
|
: null
|
|
7633
7772
|
].filter(Boolean)
|
|
7634
7773
|
};
|
|
@@ -7651,28 +7790,70 @@
|
|
|
7651
7790
|
}
|
|
7652
7791
|
const applyDefaultPadding = (spec) => {
|
|
7653
7792
|
var _a, _b, _c, _d;
|
|
7654
|
-
const
|
|
7655
|
-
const
|
|
7793
|
+
const LARGE = 100;
|
|
7794
|
+
const SMALL = 20;
|
|
7795
|
+
const TEXT_RESERVE = 280;
|
|
7796
|
+
const PORTRAIT_BOTTOM_RESERVE = 160;
|
|
7797
|
+
const arc = isArc(spec);
|
|
7798
|
+
const arcDown = arc && normalizeLayout(spec.layout).direction === 'down';
|
|
7799
|
+
const arcUp = arc && !arcDown;
|
|
7800
|
+
const portrait = isPortrait(spec);
|
|
7801
|
+
const ladder = isLadder(spec);
|
|
7802
|
+
const ladderHorizontalPadding = (() => {
|
|
7803
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7804
|
+
if (!ladder) {
|
|
7805
|
+
return 0;
|
|
7806
|
+
}
|
|
7807
|
+
const blockWidth = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.minWidth) !== null && _b !== void 0 ? _b : resolveBlockWidth(spec, 0);
|
|
7808
|
+
const imageWidth = (_d = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 96;
|
|
7809
|
+
const imageGap = (_f = (_e = spec.image) === null || _e === void 0 ? void 0 : _e.gap) !== null && _f !== void 0 ? _f : DEFAULT_IMAGE_GAP;
|
|
7810
|
+
const innerPadding = 12 * 2;
|
|
7811
|
+
const contentWidth = Math.max(blockWidth - imageWidth - imageGap - innerPadding, DEFAULT_BLOCK_WIDTH * 0.5);
|
|
7812
|
+
return Math.round(contentWidth * 2);
|
|
7813
|
+
})();
|
|
7814
|
+
const ladderVerticalPadding = (() => {
|
|
7815
|
+
var _a, _b;
|
|
7816
|
+
if (!ladder) {
|
|
7817
|
+
return 0;
|
|
7818
|
+
}
|
|
7819
|
+
const blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 132;
|
|
7820
|
+
return Math.round(blockHeight * 3);
|
|
7821
|
+
})();
|
|
7822
|
+
const defaultTop = ladder ? ladderVerticalPadding : arcDown ? LARGE : arcUp ? TEXT_RESERVE : SMALL;
|
|
7823
|
+
const defaultBottom = ladder
|
|
7824
|
+
? ladderVerticalPadding
|
|
7825
|
+
: arcDown
|
|
7826
|
+
? TEXT_RESERVE
|
|
7827
|
+
: portrait
|
|
7828
|
+
? PORTRAIT_BOTTOM_RESERVE
|
|
7829
|
+
: LARGE;
|
|
7830
|
+
const defaultLeft = ladder ? ladderHorizontalPadding : SMALL;
|
|
7831
|
+
const defaultRight = ladder ? ladderHorizontalPadding : SMALL;
|
|
7656
7832
|
const p = spec.padding;
|
|
7657
7833
|
if (p === undefined || p === null) {
|
|
7658
|
-
spec.padding = [
|
|
7834
|
+
spec.padding = [defaultTop, defaultRight, defaultBottom, defaultLeft];
|
|
7659
7835
|
return;
|
|
7660
7836
|
}
|
|
7661
7837
|
if (typeof p === 'number') {
|
|
7662
|
-
spec.padding = [
|
|
7838
|
+
spec.padding = [
|
|
7839
|
+
Math.max(p, defaultTop),
|
|
7840
|
+
Math.max(p, defaultRight),
|
|
7841
|
+
Math.max(p, defaultBottom),
|
|
7842
|
+
Math.max(p, defaultLeft)
|
|
7843
|
+
];
|
|
7663
7844
|
return;
|
|
7664
7845
|
}
|
|
7665
7846
|
if (Array.isArray(p)) {
|
|
7666
|
-
const [t
|
|
7667
|
-
spec.padding = [t, r, b !== null && b !== void 0 ? b :
|
|
7847
|
+
const [t, r = defaultRight, b, l = defaultLeft] = p;
|
|
7848
|
+
spec.padding = [t !== null && t !== void 0 ? t : defaultTop, r, b !== null && b !== void 0 ? b : defaultBottom, l];
|
|
7668
7849
|
return;
|
|
7669
7850
|
}
|
|
7670
7851
|
if (typeof p === 'object') {
|
|
7671
7852
|
spec.padding = {
|
|
7672
|
-
top: (_a = p.top) !== null && _a !== void 0 ? _a :
|
|
7673
|
-
right: (_b = p.right) !== null && _b !== void 0 ? _b :
|
|
7674
|
-
bottom: (_c = p.bottom) !== null && _c !== void 0 ? _c :
|
|
7675
|
-
left: (_d = p.left) !== null && _d !== void 0 ? _d :
|
|
7853
|
+
top: (_a = p.top) !== null && _a !== void 0 ? _a : defaultTop,
|
|
7854
|
+
right: (_b = p.right) !== null && _b !== void 0 ? _b : defaultRight,
|
|
7855
|
+
bottom: (_c = p.bottom) !== null && _c !== void 0 ? _c : defaultBottom,
|
|
7856
|
+
left: (_d = p.left) !== null && _d !== void 0 ? _d : defaultLeft
|
|
7676
7857
|
};
|
|
7677
7858
|
}
|
|
7678
7859
|
};
|
|
@@ -7686,14 +7867,9 @@
|
|
|
7686
7867
|
if (isPortrait(spec)) {
|
|
7687
7868
|
return [lineMark, ...blockMarks].filter(Boolean);
|
|
7688
7869
|
}
|
|
7689
|
-
if (
|
|
7690
|
-
const centerImageMark =
|
|
7691
|
-
const arcMark =
|
|
7692
|
-
return [centerImageMark, arcMark, ...blockMarks].filter(Boolean);
|
|
7693
|
-
}
|
|
7694
|
-
if (isBowl(spec)) {
|
|
7695
|
-
const centerImageMark = buildBowlCenterImageMark(spec);
|
|
7696
|
-
const arcMark = buildBowlArcMark(spec);
|
|
7870
|
+
if (isArc(spec)) {
|
|
7871
|
+
const centerImageMark = buildArcCenterImageMark(spec);
|
|
7872
|
+
const arcMark = buildArcMark(spec);
|
|
7697
7873
|
return [centerImageMark, arcMark, ...blockMarks].filter(Boolean);
|
|
7698
7874
|
}
|
|
7699
7875
|
if (isClock(spec)) {
|
|
@@ -7701,6 +7877,15 @@
|
|
|
7701
7877
|
const centerImageMark = buildClockCenterImageMark(spec);
|
|
7702
7878
|
return [ringsMark, ...blockMarks, centerImageMark].filter(Boolean);
|
|
7703
7879
|
}
|
|
7880
|
+
if (isWing(spec)) {
|
|
7881
|
+
const arcMark = buildWingArcMark(spec);
|
|
7882
|
+
return [arcMark, ...blockMarks].filter(Boolean);
|
|
7883
|
+
}
|
|
7884
|
+
if (isLadder(spec)) {
|
|
7885
|
+
const diagonalMark = buildLadderDiagonalMark(spec);
|
|
7886
|
+
const headlineMark = buildLadderHeadlineMark(spec);
|
|
7887
|
+
return [diagonalMark, headlineMark, ...blockMarks].filter(Boolean);
|
|
7888
|
+
}
|
|
7704
7889
|
return [lineMark, ...blockMarks].filter(Boolean);
|
|
7705
7890
|
};
|
|
7706
7891
|
const buildLineMark = (spec) => {
|
|
@@ -7723,15 +7908,18 @@
|
|
|
7723
7908
|
if (isPortrait(spec)) {
|
|
7724
7909
|
return buildPortraitBlockMark(spec, block, index);
|
|
7725
7910
|
}
|
|
7726
|
-
if (
|
|
7727
|
-
return
|
|
7728
|
-
}
|
|
7729
|
-
if (isBowl(spec)) {
|
|
7730
|
-
return buildBowlBlockMark(spec, block, index);
|
|
7911
|
+
if (isArc(spec)) {
|
|
7912
|
+
return buildArcBlockMark(spec, block, index);
|
|
7731
7913
|
}
|
|
7732
7914
|
if (isClock(spec)) {
|
|
7733
7915
|
return buildClockBlockMark(spec, block, index);
|
|
7734
7916
|
}
|
|
7917
|
+
if (isWing(spec)) {
|
|
7918
|
+
return buildWingBlockMark(spec, block, index);
|
|
7919
|
+
}
|
|
7920
|
+
if (isLadder(spec)) {
|
|
7921
|
+
return buildLadderBlockMark(spec, block, index);
|
|
7922
|
+
}
|
|
7735
7923
|
return buildDefaultBlockMark(spec, block, index);
|
|
7736
7924
|
};
|
|
7737
7925
|
|