@visactor/vchart-extension 2.1.0-alpha.20 → 2.1.0-alpha.22
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 +455 -419
- package/build/index.min.js +2 -2
- package/cjs/charts/storyline/interface.d.ts +2 -2
- package/cjs/charts/storyline/interface.js.map +1 -1
- package/cjs/charts/storyline/layouts/arc.d.ts +1 -1
- package/cjs/charts/storyline/layouts/arc.js +39 -102
- package/cjs/charts/storyline/layouts/arc.js.map +1 -1
- package/cjs/charts/storyline/layouts/clock.d.ts +1 -1
- package/cjs/charts/storyline/layouts/clock.js +40 -24
- package/cjs/charts/storyline/layouts/clock.js.map +1 -1
- package/cjs/charts/storyline/layouts/common.d.ts +54 -1
- package/cjs/charts/storyline/layouts/common.js +188 -23
- package/cjs/charts/storyline/layouts/common.js.map +1 -1
- package/cjs/charts/storyline/layouts/default.js +29 -14
- package/cjs/charts/storyline/layouts/default.js.map +1 -1
- package/cjs/charts/storyline/layouts/ladder.js +29 -13
- package/cjs/charts/storyline/layouts/ladder.js.map +1 -1
- package/cjs/charts/storyline/layouts/landscape.js +22 -23
- package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
- package/cjs/charts/storyline/layouts/portrait.d.ts +1 -1
- package/cjs/charts/storyline/layouts/portrait.js +64 -56
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
- package/cjs/charts/storyline/layouts/wing.d.ts +1 -0
- package/cjs/charts/storyline/layouts/wing.js +97 -55
- package/cjs/charts/storyline/layouts/wing.js.map +1 -1
- package/cjs/charts/storyline/storyline-transformer.js +18 -14
- package/cjs/charts/storyline/storyline-transformer.js.map +1 -1
- package/esm/charts/storyline/interface.d.ts +2 -2
- package/esm/charts/storyline/interface.js.map +1 -1
- package/esm/charts/storyline/layouts/arc.d.ts +1 -1
- package/esm/charts/storyline/layouts/arc.js +35 -100
- package/esm/charts/storyline/layouts/arc.js.map +1 -1
- package/esm/charts/storyline/layouts/clock.d.ts +1 -1
- package/esm/charts/storyline/layouts/clock.js +37 -23
- package/esm/charts/storyline/layouts/clock.js.map +1 -1
- package/esm/charts/storyline/layouts/common.d.ts +54 -1
- package/esm/charts/storyline/layouts/common.js +170 -20
- package/esm/charts/storyline/layouts/common.js.map +1 -1
- package/esm/charts/storyline/layouts/default.js +26 -13
- package/esm/charts/storyline/layouts/default.js.map +1 -1
- package/esm/charts/storyline/layouts/ladder.js +25 -12
- package/esm/charts/storyline/layouts/ladder.js.map +1 -1
- package/esm/charts/storyline/layouts/landscape.js +20 -23
- package/esm/charts/storyline/layouts/landscape.js.map +1 -1
- package/esm/charts/storyline/layouts/portrait.d.ts +1 -1
- package/esm/charts/storyline/layouts/portrait.js +61 -58
- package/esm/charts/storyline/layouts/portrait.js.map +1 -1
- package/esm/charts/storyline/layouts/wing.d.ts +1 -0
- package/esm/charts/storyline/layouts/wing.js +92 -55
- package/esm/charts/storyline/layouts/wing.js.map +1 -1
- package/esm/charts/storyline/storyline-transformer.js +20 -18
- package/esm/charts/storyline/storyline-transformer.js.map +1 -1
- package/package.json +4 -4
package/build/index.js
CHANGED
|
@@ -6078,6 +6078,11 @@
|
|
|
6078
6078
|
const DEFAULT_IMAGE_HEIGHT = 48;
|
|
6079
6079
|
const DEFAULT_IMAGE_GAP = 10;
|
|
6080
6080
|
const DEFAULT_THEME_COLOR = '#e8543d';
|
|
6081
|
+
const DEFAULT_TITLE_IMAGE_WIDTH_RATIO = 0.52;
|
|
6082
|
+
const DEFAULT_TITLE_IMAGE_MAX_WIDTH = 720;
|
|
6083
|
+
const DEFAULT_TITLE_IMAGE_HEIGHT_RATIO = 0.36;
|
|
6084
|
+
const DEFAULT_TITLE_IMAGE_TOP = 12;
|
|
6085
|
+
const DEFAULT_TITLE_IMAGE_BOTTOM = 24;
|
|
6081
6086
|
const isLandscape = (spec) => normalizeLayout(spec.layout).type === 'landscape';
|
|
6082
6087
|
const isPortrait = (spec) => normalizeLayout(spec.layout).type === 'portrait';
|
|
6083
6088
|
const isClock = (spec) => normalizeLayout(spec.layout).type === 'clock';
|
|
@@ -6085,6 +6090,144 @@
|
|
|
6085
6090
|
const isWing = (spec) => normalizeLayout(spec.layout).type === 'wing';
|
|
6086
6091
|
const isLadder = (spec) => normalizeLayout(spec.layout).type === 'ladder';
|
|
6087
6092
|
const getThemeColor = (spec) => { var _a; return (_a = spec.themeColor) !== null && _a !== void 0 ? _a : DEFAULT_THEME_COLOR; };
|
|
6093
|
+
const shouldShowImageBackground = (spec) => { var _a, _b; return (_b = (_a = spec.image) === null || _a === void 0 ? void 0 : _a.showBackground) !== null && _b !== void 0 ? _b : !(isPortrait(spec) || isLandscape(spec)); };
|
|
6094
|
+
const TITLE_FONT_SCALE_ID = 'storylineTitleFontSize';
|
|
6095
|
+
const MARKER_FONT_SCALE_ID = 'storylineMarkerFontSize';
|
|
6096
|
+
const clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
6097
|
+
const getTextWeight = (text) => {
|
|
6098
|
+
if (!text) {
|
|
6099
|
+
return 4;
|
|
6100
|
+
}
|
|
6101
|
+
return Math.max(Array.from(text).reduce((sum, char) => {
|
|
6102
|
+
if (char.trim().length === 0) {
|
|
6103
|
+
return sum + 0.32;
|
|
6104
|
+
}
|
|
6105
|
+
return sum + (char.charCodeAt(0) > 255 ? 1.05 : 0.62);
|
|
6106
|
+
}, 0), 1);
|
|
6107
|
+
};
|
|
6108
|
+
const getScaleRange = (spec, scaleId, fallback) => {
|
|
6109
|
+
var _a;
|
|
6110
|
+
const scales = spec.scales;
|
|
6111
|
+
const range = (_a = scales === null || scales === void 0 ? void 0 : scales.find(scale => scale.id === scaleId || scale.type === scaleId)) === null || _a === void 0 ? void 0 : _a.range;
|
|
6112
|
+
if (Array.isArray(range) && range.length >= 2 && typeof range[0] === 'number' && typeof range[1] === 'number') {
|
|
6113
|
+
return [Math.min(range[0], range[1]), Math.max(range[0], range[1])];
|
|
6114
|
+
}
|
|
6115
|
+
return fallback;
|
|
6116
|
+
};
|
|
6117
|
+
const getSpecGeometry = (spec, ctx) => {
|
|
6118
|
+
var _a, _b;
|
|
6119
|
+
if (ctx) {
|
|
6120
|
+
return getRegionGeometry(ctx, spec);
|
|
6121
|
+
}
|
|
6122
|
+
return {
|
|
6123
|
+
width: Math.max(Number((_a = spec.width) !== null && _a !== void 0 ? _a : 0), 1),
|
|
6124
|
+
height: Math.max(Number((_b = spec.height) !== null && _b !== void 0 ? _b : 0), 1),
|
|
6125
|
+
startX: 0,
|
|
6126
|
+
startY: 0
|
|
6127
|
+
};
|
|
6128
|
+
};
|
|
6129
|
+
const resolveAdaptiveFontSize = (spec, ctx, text, options) => {
|
|
6130
|
+
var _a;
|
|
6131
|
+
const configuredFontSize = (_a = options.style) === null || _a === void 0 ? void 0 : _a.fontSize;
|
|
6132
|
+
if (configuredFontSize != null) {
|
|
6133
|
+
return Number(configuredFontSize);
|
|
6134
|
+
}
|
|
6135
|
+
const [minFontSize, maxFontSize] = getScaleRange(spec, options.scaleId, options.range);
|
|
6136
|
+
const { width, height } = getSpecGeometry(spec, ctx);
|
|
6137
|
+
const textWeight = getTextWeight(text);
|
|
6138
|
+
const canvasSize = Math.sqrt(width * height) * options.canvasRatio;
|
|
6139
|
+
const lengthFactor = Math.sqrt(8 / Math.max(textWeight, 4));
|
|
6140
|
+
const adaptiveSize = width <= 1 && height <= 1 ? options.fallback : canvasSize * lengthFactor;
|
|
6141
|
+
const boxWidthLimit = options.boxWidth && options.boxWidth > 0 ? (options.boxWidth / textWeight) * 0.96 : Number.POSITIVE_INFINITY;
|
|
6142
|
+
const boxHeightLimit = options.boxHeight && options.boxHeight > 0 ? options.boxHeight / Math.max(textWeight, 1) : Number.POSITIVE_INFINITY;
|
|
6143
|
+
return Math.floor(clamp(Math.min(adaptiveSize, boxWidthLimit, boxHeightLimit), minFontSize, maxFontSize));
|
|
6144
|
+
};
|
|
6145
|
+
const resolveAdaptiveLineHeight = (fontSize, style, fallback, ratio = 1.35) => { var _a; return Number((_a = style === null || style === void 0 ? void 0 : style.lineHeight) !== null && _a !== void 0 ? _a : Math.round((Number.isFinite(fontSize) ? fontSize : fallback) * ratio)); };
|
|
6146
|
+
const resolveTitleFontSize = (spec, ctx, title, boxWidth, fallback, range = [16, 34]) => {
|
|
6147
|
+
var _a;
|
|
6148
|
+
return resolveAdaptiveFontSize(spec, ctx, title, {
|
|
6149
|
+
style: (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style,
|
|
6150
|
+
scaleId: TITLE_FONT_SCALE_ID,
|
|
6151
|
+
fallback,
|
|
6152
|
+
range,
|
|
6153
|
+
canvasRatio: 0.038,
|
|
6154
|
+
boxWidth
|
|
6155
|
+
});
|
|
6156
|
+
};
|
|
6157
|
+
const resolveMarkerFontSize = (spec, ctx, marker, boxHeight, fallback, range = [18, 46]) => {
|
|
6158
|
+
var _a;
|
|
6159
|
+
return resolveAdaptiveFontSize(spec, ctx, marker, {
|
|
6160
|
+
style: (_a = spec.marker) === null || _a === void 0 ? void 0 : _a.style,
|
|
6161
|
+
scaleId: MARKER_FONT_SCALE_ID,
|
|
6162
|
+
fallback,
|
|
6163
|
+
range,
|
|
6164
|
+
canvasRatio: 0.052,
|
|
6165
|
+
boxHeight
|
|
6166
|
+
});
|
|
6167
|
+
};
|
|
6168
|
+
const getImageBackgroundStyle = (spec) => {
|
|
6169
|
+
const themeColor = getThemeColor(spec);
|
|
6170
|
+
return {
|
|
6171
|
+
fill: {
|
|
6172
|
+
gradient: 'linear',
|
|
6173
|
+
x0: 0,
|
|
6174
|
+
y0: 0,
|
|
6175
|
+
x1: 1,
|
|
6176
|
+
y1: 1,
|
|
6177
|
+
stops: [
|
|
6178
|
+
{ offset: 0, color: '#ffffff' },
|
|
6179
|
+
{ offset: 0.58, color: withAlpha(themeColor, 0.12) },
|
|
6180
|
+
{ offset: 1, color: withAlpha(themeColor, 0.32) }
|
|
6181
|
+
]
|
|
6182
|
+
},
|
|
6183
|
+
stroke: withAlpha(themeColor, 0.78),
|
|
6184
|
+
lineWidth: 2,
|
|
6185
|
+
shadowColor: withAlpha(themeColor, 0.18),
|
|
6186
|
+
shadowBlur: 10,
|
|
6187
|
+
shadowOffsetX: 0,
|
|
6188
|
+
shadowOffsetY: 4
|
|
6189
|
+
};
|
|
6190
|
+
};
|
|
6191
|
+
const getTitleImageSize = (spec, width, height, options) => {
|
|
6192
|
+
var _a, _b, _c, _e, _f, _g, _h;
|
|
6193
|
+
const defaultWidth = Math.min(Math.max(width * ((_a = options === null || options === void 0 ? void 0 : options.widthRatio) !== null && _a !== void 0 ? _a : DEFAULT_TITLE_IMAGE_WIDTH_RATIO), 1), (_b = options === null || options === void 0 ? void 0 : options.maxWidth) !== null && _b !== void 0 ? _b : DEFAULT_TITLE_IMAGE_MAX_WIDTH);
|
|
6194
|
+
const imageWidth = Math.max(Number((_e = (_c = spec.titleImage) === null || _c === void 0 ? void 0 : _c.width) !== null && _e !== void 0 ? _e : defaultWidth), 1);
|
|
6195
|
+
const imageHeight = Math.max(Number((_g = (_f = spec.titleImage) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : Math.min(height, imageWidth * ((_h = options === null || options === void 0 ? void 0 : options.heightRatio) !== null && _h !== void 0 ? _h : DEFAULT_TITLE_IMAGE_HEIGHT_RATIO))), 1);
|
|
6196
|
+
return { width: imageWidth, height: imageHeight };
|
|
6197
|
+
};
|
|
6198
|
+
const getTitleImageReservedHeight = (spec, width, height, options) => {
|
|
6199
|
+
var _a, _b, _c;
|
|
6200
|
+
if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
|
|
6201
|
+
return 0;
|
|
6202
|
+
}
|
|
6203
|
+
const size = getTitleImageSize(spec, width, height, options);
|
|
6204
|
+
return Math.ceil(((_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : DEFAULT_TITLE_IMAGE_TOP) + size.height + ((_c = options === null || options === void 0 ? void 0 : options.bottom) !== null && _c !== void 0 ? _c : DEFAULT_TITLE_IMAGE_BOTTOM));
|
|
6205
|
+
};
|
|
6206
|
+
const getChartGeometry = (ctx, spec) => {
|
|
6207
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
6208
|
+
const chartRect = (_b = (_a = ctx.chart) === null || _a === void 0 ? void 0 : _a.getLayoutRect) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
6209
|
+
const bounds = (_c = ctx.getLayoutBounds) === null || _c === void 0 ? void 0 : _c.call(ctx);
|
|
6210
|
+
const width = Math.max((_h = (_g = (_e = chartRect === null || chartRect === void 0 ? void 0 : chartRect.width) !== null && _e !== void 0 ? _e : (_f = bounds === null || bounds === void 0 ? void 0 : bounds.width) === null || _f === void 0 ? void 0 : _f.call(bounds)) !== null && _g !== void 0 ? _g : spec === null || spec === void 0 ? void 0 : spec.width) !== null && _h !== void 0 ? _h : 0, 1);
|
|
6211
|
+
const height = Math.max((_m = (_l = (_j = chartRect === null || chartRect === void 0 ? void 0 : chartRect.height) !== null && _j !== void 0 ? _j : (_k = bounds === null || bounds === void 0 ? void 0 : bounds.height) === null || _k === void 0 ? void 0 : _k.call(bounds)) !== null && _l !== void 0 ? _l : spec === null || spec === void 0 ? void 0 : spec.height) !== null && _m !== void 0 ? _m : 0, 1);
|
|
6212
|
+
return { width, height, startX: 0, startY: 0 };
|
|
6213
|
+
};
|
|
6214
|
+
const buildTopTitleImageMark = (spec, options) => {
|
|
6215
|
+
var _a;
|
|
6216
|
+
if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
|
|
6217
|
+
return null;
|
|
6218
|
+
}
|
|
6219
|
+
return Object.assign(Object.assign({ type: 'image', name: 'storyline-title-image', interactive: false, zIndex: vchart.LayoutZIndex.Mark + 8 }, spec.titleImage), { style: Object.assign({ x: (_d, ctx) => {
|
|
6220
|
+
const { width, height, startX } = getChartGeometry(ctx, spec);
|
|
6221
|
+
const size = getTitleImageSize(spec, width, height, options);
|
|
6222
|
+
return startX + (width - size.width) / 2;
|
|
6223
|
+
}, y: (_d, ctx) => { var _a; return getChartGeometry(ctx, spec).startY + ((_a = options === null || options === void 0 ? void 0 : options.y) !== null && _a !== void 0 ? _a : DEFAULT_TITLE_IMAGE_TOP); }, width: (_d, ctx) => {
|
|
6224
|
+
const { width, height } = getChartGeometry(ctx, spec);
|
|
6225
|
+
return getTitleImageSize(spec, width, height, options).width;
|
|
6226
|
+
}, height: (_d, ctx) => {
|
|
6227
|
+
const { width, height } = getChartGeometry(ctx, spec);
|
|
6228
|
+
return getTitleImageSize(spec, width, height, options).height;
|
|
6229
|
+
}, image: spec.titleImage.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, spec.titleImage.style) });
|
|
6230
|
+
};
|
|
6088
6231
|
const withAlpha = (color, alpha) => {
|
|
6089
6232
|
const safeAlpha = Math.max(0, Math.min(1, alpha));
|
|
6090
6233
|
if (!color) {
|
|
@@ -6113,40 +6256,40 @@
|
|
|
6113
6256
|
return trimmed;
|
|
6114
6257
|
};
|
|
6115
6258
|
const resolveBlockWidth = (spec, viewWidth) => {
|
|
6116
|
-
var _a, _b, _c,
|
|
6259
|
+
var _a, _b, _c, _e, _f, _g, _h;
|
|
6117
6260
|
if ((_a = spec.block) === null || _a === void 0 ? void 0 : _a.width) {
|
|
6118
6261
|
return spec.block.width;
|
|
6119
6262
|
}
|
|
6120
6263
|
const ratio = (_c = (_b = spec.block) === null || _b === void 0 ? void 0 : _b.widthRatio) !== null && _c !== void 0 ? _c : DEFAULT_BLOCK_WIDTH_RATIO;
|
|
6121
|
-
const minWidth = (
|
|
6122
|
-
const maxWidth = (
|
|
6264
|
+
const minWidth = (_f = (_e = spec.block) === null || _e === void 0 ? void 0 : _e.minWidth) !== null && _f !== void 0 ? _f : DEFAULT_BLOCK_WIDTH;
|
|
6265
|
+
const maxWidth = (_h = (_g = spec.block) === null || _g === void 0 ? void 0 : _g.maxWidth) !== null && _h !== void 0 ? _h : Math.max(minWidth, 320);
|
|
6123
6266
|
return Math.max(minWidth, Math.min(maxWidth, Math.round(viewWidth * ratio)));
|
|
6124
6267
|
};
|
|
6125
6268
|
const getRegionGeometry = (ctx, spec) => {
|
|
6126
|
-
var _a, _b, _c,
|
|
6269
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
6127
6270
|
const region = (_c = (_b = (_a = ctx.chart) === null || _a === void 0 ? void 0 : _a.getAllRegions) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c[0];
|
|
6128
|
-
const regionRect = (
|
|
6129
|
-
const regionStart = (
|
|
6130
|
-
const chartRect = (
|
|
6131
|
-
const bounds = (
|
|
6132
|
-
const width = Math.max((
|
|
6133
|
-
const height = Math.max((
|
|
6271
|
+
const regionRect = (_e = region === null || region === void 0 ? void 0 : region.getLayoutRect) === null || _e === void 0 ? void 0 : _e.call(region);
|
|
6272
|
+
const regionStart = (_f = region === null || region === void 0 ? void 0 : region.getLayoutStartPoint) === null || _f === void 0 ? void 0 : _f.call(region);
|
|
6273
|
+
const chartRect = (_h = (_g = ctx.chart) === null || _g === void 0 ? void 0 : _g.getLayoutRect) === null || _h === void 0 ? void 0 : _h.call(_g);
|
|
6274
|
+
const bounds = (_j = ctx.getLayoutBounds) === null || _j === void 0 ? void 0 : _j.call(ctx);
|
|
6275
|
+
const width = Math.max((_p = (_o = (_l = (_k = regionRect === null || regionRect === void 0 ? void 0 : regionRect.width) !== null && _k !== void 0 ? _k : chartRect === null || chartRect === void 0 ? void 0 : chartRect.width) !== null && _l !== void 0 ? _l : (_m = bounds === null || bounds === void 0 ? void 0 : bounds.width) === null || _m === void 0 ? void 0 : _m.call(bounds)) !== null && _o !== void 0 ? _o : spec === null || spec === void 0 ? void 0 : spec.width) !== null && _p !== void 0 ? _p : 0, 1);
|
|
6276
|
+
const height = Math.max((_u = (_t = (_r = (_q = regionRect === null || regionRect === void 0 ? void 0 : regionRect.height) !== null && _q !== void 0 ? _q : chartRect === null || chartRect === void 0 ? void 0 : chartRect.height) !== null && _r !== void 0 ? _r : (_s = bounds === null || bounds === void 0 ? void 0 : bounds.height) === null || _s === void 0 ? void 0 : _s.call(bounds)) !== null && _t !== void 0 ? _t : spec === null || spec === void 0 ? void 0 : spec.height) !== null && _u !== void 0 ? _u : 0, 1);
|
|
6134
6277
|
return {
|
|
6135
6278
|
width,
|
|
6136
6279
|
height,
|
|
6137
|
-
startX: (
|
|
6138
|
-
startY: (
|
|
6280
|
+
startX: (_v = regionStart === null || regionStart === void 0 ? void 0 : regionStart.x) !== null && _v !== void 0 ? _v : 0,
|
|
6281
|
+
startY: (_w = regionStart === null || regionStart === void 0 ? void 0 : regionStart.y) !== null && _w !== void 0 ? _w : 0
|
|
6139
6282
|
};
|
|
6140
6283
|
};
|
|
6141
6284
|
const getLayout = (spec, ctx) => {
|
|
6142
|
-
var _a, _b, _c,
|
|
6285
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
6143
6286
|
const { width, height, startX, startY } = getRegionGeometry(ctx, spec);
|
|
6144
6287
|
let blockWidth = resolveBlockWidth(spec, width);
|
|
6145
6288
|
let blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : (isLandscape(spec) ? 320 : DEFAULT_BLOCK_HEIGHT);
|
|
6146
6289
|
if (isLandscape(spec) && !((_c = spec.block) === null || _c === void 0 ? void 0 : _c.width)) {
|
|
6147
|
-
const count = (
|
|
6290
|
+
const count = (_f = (_e = spec.data) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0;
|
|
6148
6291
|
if (count > 0) {
|
|
6149
|
-
const padding = normalizePadding((
|
|
6292
|
+
const padding = normalizePadding((_g = spec.block) === null || _g === void 0 ? void 0 : _g.padding);
|
|
6150
6293
|
const innerWidth = Math.max(width - padding.left - padding.right, 1);
|
|
6151
6294
|
const LANDSCAPE_IMAGE_GAP = 40;
|
|
6152
6295
|
const LANDSCAPE_IMAGE_MIN_WIDTH = 80;
|
|
@@ -6155,24 +6298,25 @@
|
|
|
6155
6298
|
blockWidth = Math.max(LANDSCAPE_IMAGE_MIN_WIDTH, Math.floor(adaptive));
|
|
6156
6299
|
}
|
|
6157
6300
|
}
|
|
6158
|
-
if (isPortrait(spec) && !((
|
|
6159
|
-
const count = (
|
|
6301
|
+
if (isPortrait(spec) && !((_h = spec.block) === null || _h === void 0 ? void 0 : _h.height)) {
|
|
6302
|
+
const count = (_k = (_j = spec.data) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0;
|
|
6160
6303
|
if (count > 0) {
|
|
6161
|
-
const
|
|
6304
|
+
const layoutPadding = typeof spec.layout === 'object' ? spec.layout.padding : undefined;
|
|
6305
|
+
const padding = normalizePadding(layoutPadding !== null && layoutPadding !== void 0 ? layoutPadding : (_l = spec.block) === null || _l === void 0 ? void 0 : _l.padding);
|
|
6162
6306
|
const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
|
|
6163
6307
|
blockHeight = Math.max(120, Math.floor(innerHeight / (count + 1)));
|
|
6164
6308
|
}
|
|
6165
6309
|
}
|
|
6166
|
-
const result = computeStorylineLayout((
|
|
6310
|
+
const result = computeStorylineLayout((_m = spec.data) !== null && _m !== void 0 ? _m : [], {
|
|
6167
6311
|
layout: spec.layout,
|
|
6168
6312
|
viewBox: { width, height },
|
|
6169
6313
|
block: {
|
|
6170
6314
|
width: blockWidth,
|
|
6171
6315
|
height: blockHeight
|
|
6172
6316
|
},
|
|
6173
|
-
gap: (
|
|
6174
|
-
padding: (
|
|
6175
|
-
lineDistance: (
|
|
6317
|
+
gap: (_p = (_o = spec.block) === null || _o === void 0 ? void 0 : _o.gap) !== null && _p !== void 0 ? _p : DEFAULT_BLOCK_GAP,
|
|
6318
|
+
padding: (_q = spec.block) === null || _q === void 0 ? void 0 : _q.padding,
|
|
6319
|
+
lineDistance: (_r = spec.line) === null || _r === void 0 ? void 0 : _r.distance
|
|
6176
6320
|
});
|
|
6177
6321
|
if (!startX && !startY) {
|
|
6178
6322
|
return result;
|
|
@@ -6183,11 +6327,11 @@
|
|
|
6183
6327
|
} }))), links: result.links.map(link => (Object.assign(Object.assign({}, link), { start: { x: link.start.x + startX, y: link.start.y + startY }, end: { x: link.end.x + startX, y: link.end.y + startY }, points: link.points.map(point => ({ x: point.x + startX, y: point.y + startY })) }))) });
|
|
6184
6328
|
};
|
|
6185
6329
|
const buildRichContent = (contentText, spec, overrides) => {
|
|
6186
|
-
var _a, _b, _c,
|
|
6187
|
-
const fontSize = Number((
|
|
6188
|
-
const lineHeight = Number((
|
|
6189
|
-
const fill = (
|
|
6190
|
-
const align = (
|
|
6330
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
6331
|
+
const fontSize = Number((_e = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.fontSize) !== null && _a !== void 0 ? _a : (_c = (_b = spec.content) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.fontSize) !== null && _e !== void 0 ? _e : 18);
|
|
6332
|
+
const lineHeight = Number((_j = (_f = overrides === null || overrides === void 0 ? void 0 : overrides.lineHeight) !== null && _f !== void 0 ? _f : (_h = (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.lineHeight) !== null && _j !== void 0 ? _j : 26);
|
|
6333
|
+
const fill = (_o = (_k = overrides === null || overrides === void 0 ? void 0 : overrides.fill) !== null && _k !== void 0 ? _k : (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.fill) !== null && _o !== void 0 ? _o : '#596173';
|
|
6334
|
+
const align = (_p = overrides === null || overrides === void 0 ? void 0 : overrides.align) !== null && _p !== void 0 ? _p : 'left';
|
|
6191
6335
|
return {
|
|
6192
6336
|
type: 'rich',
|
|
6193
6337
|
text: contentText.reduce((result, paragraph, index) => {
|
|
@@ -6290,8 +6434,6 @@
|
|
|
6290
6434
|
return d;
|
|
6291
6435
|
};
|
|
6292
6436
|
|
|
6293
|
-
const CLOCK_CENTER_RADIUS_RATIO = 0.6;
|
|
6294
|
-
const CLOCK_CENTER_IMAGE_INSET_RATIO = 0.9;
|
|
6295
6437
|
const CLOCK_ORBIT_RATIO = 0.68;
|
|
6296
6438
|
const CLOCK_DOT_RATIO = 0.68;
|
|
6297
6439
|
const CLOCK_TEXT_INNER_RATIO = 0.92;
|
|
@@ -6327,81 +6469,6 @@
|
|
|
6327
6469
|
y: cy + Math.sin(angle) * r
|
|
6328
6470
|
});
|
|
6329
6471
|
const isOnLeftHalf = (angle) => Math.cos(angle) < 0;
|
|
6330
|
-
const buildClockCenterImageMark = (spec) => {
|
|
6331
|
-
var _a, _b, _c, _e;
|
|
6332
|
-
if (((_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.visible) === false) {
|
|
6333
|
-
return null;
|
|
6334
|
-
}
|
|
6335
|
-
const themeColor = getThemeColor(spec);
|
|
6336
|
-
const hasImage = !!((_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.image);
|
|
6337
|
-
return {
|
|
6338
|
-
type: 'group',
|
|
6339
|
-
name: 'storyline-clock-center',
|
|
6340
|
-
zIndex: vchart.LayoutZIndex.Mark + 2,
|
|
6341
|
-
children: [
|
|
6342
|
-
{
|
|
6343
|
-
type: 'symbol',
|
|
6344
|
-
name: 'storyline-clock-center-halo',
|
|
6345
|
-
interactive: false,
|
|
6346
|
-
style: {
|
|
6347
|
-
x: (_d, ctx) => getClockGeometry(spec, ctx).cx,
|
|
6348
|
-
y: (_d, ctx) => getClockGeometry(spec, ctx).cy,
|
|
6349
|
-
size: (_d, ctx) => {
|
|
6350
|
-
const g = getClockGeometry(spec, ctx);
|
|
6351
|
-
return g.R * CLOCK_CENTER_RADIUS_RATIO * 2.16;
|
|
6352
|
-
},
|
|
6353
|
-
symbolType: 'circle',
|
|
6354
|
-
fill: withAlpha(themeColor, 0.28),
|
|
6355
|
-
stroke: 'transparent'
|
|
6356
|
-
}
|
|
6357
|
-
},
|
|
6358
|
-
hasImage
|
|
6359
|
-
? {
|
|
6360
|
-
type: 'image',
|
|
6361
|
-
name: 'storyline-clock-center-image',
|
|
6362
|
-
interactive: false,
|
|
6363
|
-
style: Object.assign({ x: (_d, ctx) => {
|
|
6364
|
-
const g = getClockGeometry(spec, ctx);
|
|
6365
|
-
return g.cx - g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO;
|
|
6366
|
-
}, y: (_d, ctx) => {
|
|
6367
|
-
const g = getClockGeometry(spec, ctx);
|
|
6368
|
-
return g.cy - g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO;
|
|
6369
|
-
}, width: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2, height: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2, image: (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center', cornerRadius: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO, anchor: (_d, ctx) => {
|
|
6370
|
-
const g = getClockGeometry(spec, ctx);
|
|
6371
|
-
return [g.cx, g.cy];
|
|
6372
|
-
}, dx: (_d, ctx) => {
|
|
6373
|
-
var _a, _b;
|
|
6374
|
-
const g = getClockGeometry(spec, ctx);
|
|
6375
|
-
const rectW = g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2;
|
|
6376
|
-
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
6377
|
-
const w = typeof userWidth === 'number' ? userWidth : rectW;
|
|
6378
|
-
return (rectW - w) / 2;
|
|
6379
|
-
}, dy: (_d, ctx) => {
|
|
6380
|
-
var _a, _b;
|
|
6381
|
-
const g = getClockGeometry(spec, ctx);
|
|
6382
|
-
const rectH = g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2;
|
|
6383
|
-
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
6384
|
-
const h = typeof userHeight === 'number' ? userHeight : rectH;
|
|
6385
|
-
return (rectH - h) / 2;
|
|
6386
|
-
} }, (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.style)
|
|
6387
|
-
}
|
|
6388
|
-
: {
|
|
6389
|
-
type: 'symbol',
|
|
6390
|
-
name: 'storyline-clock-center-placeholder',
|
|
6391
|
-
interactive: false,
|
|
6392
|
-
style: {
|
|
6393
|
-
x: (_d, ctx) => getClockGeometry(spec, ctx).cx,
|
|
6394
|
-
y: (_d, ctx) => getClockGeometry(spec, ctx).cy,
|
|
6395
|
-
size: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * 2,
|
|
6396
|
-
symbolType: 'circle',
|
|
6397
|
-
fill: '#ffffff',
|
|
6398
|
-
stroke: themeColor,
|
|
6399
|
-
lineWidth: 2
|
|
6400
|
-
}
|
|
6401
|
-
}
|
|
6402
|
-
].filter(Boolean)
|
|
6403
|
-
};
|
|
6404
|
-
};
|
|
6405
6472
|
const buildClockArcMark = (spec) => {
|
|
6406
6473
|
const themeColor = getThemeColor(spec);
|
|
6407
6474
|
const orbitPath = (_d, ctx) => {
|
|
@@ -6465,10 +6532,13 @@
|
|
|
6465
6532
|
return { x: innerPoint.x, y: innerPoint.y, width, onLeft, anchorY: innerPoint.y };
|
|
6466
6533
|
};
|
|
6467
6534
|
const buildClockBlockMark = (spec, block, index) => {
|
|
6468
|
-
var _a, _b, _c;
|
|
6535
|
+
var _a, _b, _c, _e;
|
|
6469
6536
|
const hasImage = !!block.image;
|
|
6470
6537
|
const themeColor = getThemeColor(spec);
|
|
6538
|
+
const showImageBackground = shouldShowImageBackground(spec);
|
|
6471
6539
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6540
|
+
const getTitleFontSize = (ctx) => resolveTitleFontSize(spec, ctx, block.title, getClockTextRect(spec, ctx, index).width, CLOCK_TITLE_FONT_SIZE, [8, 30]);
|
|
6541
|
+
const getTitleLineHeight = (ctx) => { var _a; return resolveAdaptiveLineHeight(getTitleFontSize(ctx), (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style, CLOCK_TITLE_LINE_HEIGHT, 1.28); };
|
|
6472
6542
|
const leadPath = (_d, ctx) => {
|
|
6473
6543
|
const { start, end } = getClockLeadLine(spec, ctx, index);
|
|
6474
6544
|
return `M ${start.x.toFixed(2)} ${start.y.toFixed(2)} L ${end.x.toFixed(2)} ${end.y.toFixed(2)}`;
|
|
@@ -6487,30 +6557,22 @@
|
|
|
6487
6557
|
fillOpacity: 0
|
|
6488
6558
|
}
|
|
6489
6559
|
},
|
|
6490
|
-
|
|
6560
|
+
showImageBackground
|
|
6491
6561
|
? {
|
|
6492
|
-
type: '
|
|
6493
|
-
name: `storyline-clock-dot-${index}`,
|
|
6562
|
+
type: 'symbol',
|
|
6563
|
+
name: `storyline-clock-dot-bg-${index}`,
|
|
6494
6564
|
interactive: false,
|
|
6495
|
-
style: {
|
|
6496
|
-
|
|
6565
|
+
style: Object.assign({ x: (_d, ctx) => getClockDotCenter(spec, ctx, index).x, y: (_d, ctx) => getClockDotCenter(spec, ctx, index).y, size: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter + 10, symbolType: 'circle' }, getImageBackgroundStyle(spec))
|
|
6566
|
+
}
|
|
6567
|
+
: null,
|
|
6568
|
+
hasImage
|
|
6569
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-clock-dot-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => {
|
|
6497
6570
|
const dot = getClockDotCenter(spec, ctx, index);
|
|
6498
6571
|
return dot.x - dot.diameter / 2;
|
|
6499
|
-
},
|
|
6500
|
-
y: (_d, ctx) => {
|
|
6572
|
+
}, y: (_d, ctx) => {
|
|
6501
6573
|
const dot = getClockDotCenter(spec, ctx, index);
|
|
6502
6574
|
return dot.y - dot.diameter / 2;
|
|
6503
|
-
},
|
|
6504
|
-
width: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
|
|
6505
|
-
height: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
|
|
6506
|
-
image: block.image,
|
|
6507
|
-
repeatX: 'no-repeat',
|
|
6508
|
-
repeatY: 'no-repeat',
|
|
6509
|
-
imageMode: 'cover',
|
|
6510
|
-
imagePosition: 'center',
|
|
6511
|
-
cornerRadius: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter / 2
|
|
6512
|
-
}
|
|
6513
|
-
}
|
|
6575
|
+
}, width: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter, height: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center', cornerRadius: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter / 2 }, (_a = spec.image) === null || _a === void 0 ? void 0 : _a.style) })
|
|
6514
6576
|
: {
|
|
6515
6577
|
type: 'symbol',
|
|
6516
6578
|
name: `storyline-clock-dot-${index}`,
|
|
@@ -6526,15 +6588,15 @@
|
|
|
6526
6588
|
}
|
|
6527
6589
|
},
|
|
6528
6590
|
block.title
|
|
6529
|
-
? 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 -
|
|
6591
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY - getTitleLineHeight(ctx), text: block.title, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, fontSize: (_d, ctx) => getTitleFontSize(ctx), lineHeight: (_d, ctx) => getTitleLineHeight(ctx), fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top' }, (_b = spec.title) === null || _b === void 0 ? void 0 : _b.style) })
|
|
6530
6592
|
: null,
|
|
6531
6593
|
contentText.length
|
|
6532
|
-
? 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' }, (
|
|
6594
|
+
? 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' }, (_c = spec.content) === null || _c === void 0 ? void 0 : _c.style) })
|
|
6533
6595
|
: null
|
|
6534
6596
|
];
|
|
6535
6597
|
return {
|
|
6536
6598
|
type: 'group',
|
|
6537
|
-
id: `storyline-block-${(
|
|
6599
|
+
id: `storyline-block-${(_e = block.id) !== null && _e !== void 0 ? _e : index}`,
|
|
6538
6600
|
name: `storyline-block-${index}`,
|
|
6539
6601
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
6540
6602
|
children: children.filter(Boolean)
|
|
@@ -6564,7 +6626,7 @@
|
|
|
6564
6626
|
};
|
|
6565
6627
|
};
|
|
6566
6628
|
const getDefaultBlockMetrics = (spec, ctx, index) => {
|
|
6567
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y
|
|
6629
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
6568
6630
|
const block = getLayout(spec, ctx).blocks[index];
|
|
6569
6631
|
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
6570
6632
|
const imagePosition = (_d = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.position) !== null && _d !== void 0 ? _d : 'top';
|
|
@@ -6572,19 +6634,21 @@
|
|
|
6572
6634
|
const imageHeight = (_h = (_g = spec.image) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : DEFAULT_IMAGE_HEIGHT;
|
|
6573
6635
|
const imageGap = (_k = (_j = spec.image) === null || _j === void 0 ? void 0 : _j.gap) !== null && _k !== void 0 ? _k : DEFAULT_IMAGE_GAP;
|
|
6574
6636
|
const hasImage = !!((_m = (_l = spec.data) === null || _l === void 0 ? void 0 : _l[index]) === null || _m === void 0 ? void 0 : _m.image);
|
|
6575
|
-
const
|
|
6576
|
-
const
|
|
6577
|
-
const titleHeight = ((_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title) ? titleLineHeight : 0;
|
|
6578
|
-
const blockWidth = (_w = block === null || block === void 0 ? void 0 : block.width) !== null && _w !== void 0 ? _w : resolveBlockWidth(spec, 0);
|
|
6579
|
-
const blockHeight = (_z = (_x = block === null || block === void 0 ? void 0 : block.height) !== null && _x !== void 0 ? _x : (_y = spec.block) === null || _y === void 0 ? void 0 : _y.height) !== null && _z !== void 0 ? _z : DEFAULT_BLOCK_HEIGHT;
|
|
6637
|
+
const blockWidth = (_o = block === null || block === void 0 ? void 0 : block.width) !== null && _o !== void 0 ? _o : resolveBlockWidth(spec, 0);
|
|
6638
|
+
const blockHeight = (_r = (_p = block === null || block === void 0 ? void 0 : block.height) !== null && _p !== void 0 ? _p : (_q = spec.block) === null || _q === void 0 ? void 0 : _q.height) !== null && _r !== void 0 ? _r : DEFAULT_BLOCK_HEIGHT;
|
|
6580
6639
|
const imageBox = getImageBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
6581
6640
|
const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
6582
|
-
const
|
|
6641
|
+
const titleFontSize = resolveTitleFontSize(spec, ctx, (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t.title, textBox.width, 18, [8, 28]);
|
|
6642
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_u = spec.title) === null || _u === void 0 ? void 0 : _u.style, Math.round(18 * 1.35));
|
|
6643
|
+
const titleHeight = ((_w = (_v = spec.data) === null || _v === void 0 ? void 0 : _v[index]) === null || _w === void 0 ? void 0 : _w.title) ? titleLineHeight : 0;
|
|
6644
|
+
const contentGap = ((_y = (_x = spec.data) === null || _x === void 0 ? void 0 : _x[index]) === null || _y === void 0 ? void 0 : _y.title) ? 8 : 0;
|
|
6583
6645
|
return {
|
|
6584
6646
|
block: {
|
|
6585
6647
|
width: blockWidth,
|
|
6586
6648
|
height: blockHeight
|
|
6587
6649
|
},
|
|
6650
|
+
titleFontSize,
|
|
6651
|
+
titleLineHeight,
|
|
6588
6652
|
imageBox,
|
|
6589
6653
|
textBox,
|
|
6590
6654
|
contentBox: {
|
|
@@ -6594,14 +6658,12 @@
|
|
|
6594
6658
|
};
|
|
6595
6659
|
};
|
|
6596
6660
|
const buildDefaultBlockMark = (spec, block, index) => {
|
|
6597
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
6661
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6598
6662
|
const hasImage = !!block.image;
|
|
6599
6663
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6600
|
-
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);
|
|
6601
|
-
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));
|
|
6602
6664
|
return {
|
|
6603
6665
|
type: 'group',
|
|
6604
|
-
id: `storyline-block-${(
|
|
6666
|
+
id: `storyline-block-${(_a = block.id) !== null && _a !== void 0 ? _a : index}`,
|
|
6605
6667
|
name: `storyline-block-${index}`,
|
|
6606
6668
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
6607
6669
|
style: {
|
|
@@ -6611,26 +6673,34 @@
|
|
|
6611
6673
|
height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height
|
|
6612
6674
|
},
|
|
6613
6675
|
children: [
|
|
6614
|
-
((
|
|
6676
|
+
((_b = spec.block) === null || _b === void 0 ? void 0 : _b.showBackground) === true
|
|
6615
6677
|
? {
|
|
6616
6678
|
type: 'rect',
|
|
6617
6679
|
name: `storyline-block-bg-${index}`,
|
|
6618
6680
|
interactive: false,
|
|
6619
|
-
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)' }, (
|
|
6681
|
+
style: Object.assign({ x: 0, y: 0, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_c = spec.block) === null || _c === void 0 ? void 0 : _c.style)
|
|
6682
|
+
}
|
|
6683
|
+
: null,
|
|
6684
|
+
shouldShowImageBackground(spec)
|
|
6685
|
+
? {
|
|
6686
|
+
type: 'rect',
|
|
6687
|
+
name: `storyline-block-image-bg-${index}`,
|
|
6688
|
+
interactive: false,
|
|
6689
|
+
style: Object.assign(Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), (_d = spec.block) === null || _d === void 0 ? void 0 : _d.style)
|
|
6620
6690
|
}
|
|
6621
6691
|
: null,
|
|
6622
6692
|
hasImage
|
|
6623
|
-
? 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 }, (
|
|
6693
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_e = spec.image) === null || _e === void 0 ? void 0 : _e.style) })
|
|
6624
6694
|
: null,
|
|
6625
6695
|
block.title
|
|
6626
|
-
? 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' }, (
|
|
6696
|
+
? 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: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
|
|
6627
6697
|
: null,
|
|
6628
6698
|
contentText.length
|
|
6629
6699
|
? 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, {
|
|
6630
6700
|
fontSize: 18,
|
|
6631
6701
|
lineHeight: 26,
|
|
6632
6702
|
fill: '#596173'
|
|
6633
|
-
}), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (
|
|
6703
|
+
}), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
|
|
6634
6704
|
: null
|
|
6635
6705
|
].filter(Boolean)
|
|
6636
6706
|
};
|
|
@@ -6750,14 +6820,14 @@
|
|
|
6750
6820
|
]
|
|
6751
6821
|
};
|
|
6752
6822
|
};
|
|
6753
|
-
const getLandscapeMetrics = (spec, blockWidth, blockHeight, index) => {
|
|
6754
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p
|
|
6823
|
+
const getLandscapeMetrics = (spec, blockWidth, blockHeight, index, ctx) => {
|
|
6824
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
6755
6825
|
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
6756
|
-
const titleFontSize =
|
|
6757
|
-
const titleLineHeight =
|
|
6758
|
-
const contentFontSize = Number((
|
|
6759
|
-
const contentLineHeight = Number((
|
|
6760
|
-
const imageHeight = Math.max((
|
|
6826
|
+
const titleFontSize = resolveTitleFontSize(spec, ctx, (_e = (_c = spec.data) === null || _c === void 0 ? void 0 : _c[index]) === null || _e === void 0 ? void 0 : _e.title, blockWidth, 26, [8, 34]);
|
|
6827
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style, LANDSCAPE_TITLE_LINE_HEIGHT);
|
|
6828
|
+
const contentFontSize = Number((_j = (_h = (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.fontSize) !== null && _j !== void 0 ? _j : LANDSCAPE_CONTENT_FONT_SIZE);
|
|
6829
|
+
const contentLineHeight = Number((_m = (_l = (_k = spec.content) === null || _k === void 0 ? void 0 : _k.style) === null || _l === void 0 ? void 0 : _l.lineHeight) !== null && _m !== void 0 ? _m : LANDSCAPE_CONTENT_LINE_HEIGHT);
|
|
6830
|
+
const imageHeight = Math.max((_p = (_o = spec.image) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : Math.round(blockHeight * LANDSCAPE_IMAGE_HEIGHT_RATIO), titleLineHeight + padding.top + padding.bottom);
|
|
6761
6831
|
const connectorGap = LANDSCAPE_DETACHED_GAP;
|
|
6762
6832
|
const canvasHeight = spec.height;
|
|
6763
6833
|
const contentHeight = canvasHeight
|
|
@@ -6828,27 +6898,25 @@
|
|
|
6828
6898
|
};
|
|
6829
6899
|
};
|
|
6830
6900
|
const buildLandscapeBlockMark = (spec, block, index) => {
|
|
6831
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m
|
|
6901
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
6832
6902
|
const hasImage = !!block.image;
|
|
6833
6903
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6834
|
-
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 26);
|
|
6835
|
-
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));
|
|
6836
6904
|
const getMetrics = (ctx) => {
|
|
6837
6905
|
var _a, _b, _c, _e;
|
|
6838
6906
|
const layoutBlock = getLayout(spec, ctx).blocks[index];
|
|
6839
6907
|
const w = (_a = layoutBlock === null || layoutBlock === void 0 ? void 0 : layoutBlock.width) !== null && _a !== void 0 ? _a : resolveBlockWidth(spec, 0);
|
|
6840
6908
|
const h = (_e = (_b = layoutBlock === null || layoutBlock === void 0 ? void 0 : layoutBlock.height) !== null && _b !== void 0 ? _b : (_c = spec.block) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : DEFAULT_BLOCK_HEIGHT;
|
|
6841
|
-
return getLandscapeMetrics(spec, w, h, index);
|
|
6909
|
+
return getLandscapeMetrics(spec, w, h, index, ctx);
|
|
6842
6910
|
};
|
|
6843
|
-
const blockStyle = (
|
|
6844
|
-
const lineStyle = (
|
|
6911
|
+
const blockStyle = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
|
|
6912
|
+
const lineStyle = (_e = (_c = spec.line) === null || _c === void 0 ? void 0 : _c.style) !== null && _e !== void 0 ? _e : {};
|
|
6845
6913
|
const themeColor = getThemeColor(spec);
|
|
6846
|
-
const connectorStroke = (
|
|
6847
|
-
const connectorLineWidth = (
|
|
6848
|
-
const connectorDash = (
|
|
6914
|
+
const connectorStroke = (_f = lineStyle.stroke) !== null && _f !== void 0 ? _f : themeColor;
|
|
6915
|
+
const connectorLineWidth = (_g = lineStyle.lineWidth) !== null && _g !== void 0 ? _g : 2;
|
|
6916
|
+
const connectorDash = (_h = lineStyle.lineDash) !== null && _h !== void 0 ? _h : [4, 4];
|
|
6849
6917
|
return {
|
|
6850
6918
|
type: 'group',
|
|
6851
|
-
id: `storyline-block-${(
|
|
6919
|
+
id: `storyline-block-${(_j = block.id) !== null && _j !== void 0 ? _j : index}`,
|
|
6852
6920
|
name: `storyline-block-${index}`,
|
|
6853
6921
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
6854
6922
|
style: {
|
|
@@ -6870,14 +6938,16 @@
|
|
|
6870
6938
|
height: (_d, ctx) => getMetrics(ctx).groupHeight
|
|
6871
6939
|
},
|
|
6872
6940
|
children: [
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6941
|
+
shouldShowImageBackground(spec)
|
|
6942
|
+
? {
|
|
6943
|
+
type: 'rect',
|
|
6944
|
+
name: `storyline-block-image-bg-${index}`,
|
|
6945
|
+
interactive: false,
|
|
6946
|
+
style: Object.assign(Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), blockStyle)
|
|
6947
|
+
}
|
|
6948
|
+
: null,
|
|
6879
6949
|
hasImage
|
|
6880
|
-
? 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: '
|
|
6950
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_k = spec.image) === null || _k === void 0 ? void 0 : _k.style) })
|
|
6881
6951
|
: null,
|
|
6882
6952
|
{
|
|
6883
6953
|
type: 'path',
|
|
@@ -6903,26 +6973,26 @@
|
|
|
6903
6973
|
}
|
|
6904
6974
|
},
|
|
6905
6975
|
block.title
|
|
6906
|
-
? 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' }, (
|
|
6976
|
+
? 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: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_l = spec.title) === null || _l === void 0 ? void 0 : _l.style) })
|
|
6907
6977
|
: null,
|
|
6908
6978
|
contentText.length
|
|
6909
6979
|
? 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, {
|
|
6910
6980
|
fontSize: LANDSCAPE_CONTENT_FONT_SIZE,
|
|
6911
6981
|
lineHeight: LANDSCAPE_CONTENT_LINE_HEIGHT,
|
|
6912
6982
|
fill: '#596173'
|
|
6913
|
-
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (
|
|
6983
|
+
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_m = spec.content) === null || _m === void 0 ? void 0 : _m.style) })
|
|
6914
6984
|
: null
|
|
6915
6985
|
].filter(Boolean)
|
|
6916
6986
|
};
|
|
6917
6987
|
};
|
|
6918
6988
|
|
|
6919
6989
|
const PORTRAIT_AXIS_WIDTH = 96;
|
|
6920
|
-
const PORTRAIT_AXIS_PADDING =
|
|
6990
|
+
const PORTRAIT_AXIS_PADDING = 120;
|
|
6921
6991
|
const PORTRAIT_MARKER_FONT_SIZE = 40;
|
|
6922
6992
|
const PORTRAIT_MARKER_LINE_HEIGHT = 28;
|
|
6923
6993
|
const PORTRAIT_MARKER_AXIS_PADDING = 6;
|
|
6924
6994
|
const PORTRAIT_IMAGE_HEIGHT_RATIO = 0.6;
|
|
6925
|
-
const PORTRAIT_CONTENT_HEIGHT_RATIO = 1;
|
|
6995
|
+
const PORTRAIT_CONTENT_HEIGHT_RATIO = 1.25;
|
|
6926
6996
|
const PORTRAIT_IMAGE_GAP_FROM_AXIS = 24;
|
|
6927
6997
|
const PORTRAIT_SHADOW_OFFSET_X = 24;
|
|
6928
6998
|
const PORTRAIT_SHADOW_OFFSET_Y = 16;
|
|
@@ -6933,27 +7003,10 @@
|
|
|
6933
7003
|
const PORTRAIT_CONTENT_LINE_HEIGHT = 26;
|
|
6934
7004
|
const PORTRAIT_CONTENT_FONT_SIZE = 18;
|
|
6935
7005
|
const PORTRAIT_TITLE_TO_CONTENT_GAP = 4;
|
|
6936
|
-
const getPortraitAxisRect = (spec, ctx) => {
|
|
6937
|
-
const blocks = getLayout(spec, ctx).blocks;
|
|
6938
|
-
if (!blocks.length) {
|
|
6939
|
-
return { x: 0, y: 0, width: 0, height: 0 };
|
|
6940
|
-
}
|
|
6941
|
-
const firstCy = blocks[0].center.y;
|
|
6942
|
-
const lastCy = blocks[blocks.length - 1].center.y;
|
|
6943
|
-
const top = Math.min(firstCy, lastCy);
|
|
6944
|
-
const bottom = Math.max(firstCy, lastCy);
|
|
6945
|
-
const cx = blocks[0].center.x;
|
|
6946
|
-
return {
|
|
6947
|
-
x: cx - PORTRAIT_AXIS_WIDTH / 2,
|
|
6948
|
-
y: top - PORTRAIT_AXIS_PADDING,
|
|
6949
|
-
width: PORTRAIT_AXIS_WIDTH,
|
|
6950
|
-
height: bottom - top + PORTRAIT_AXIS_PADDING * 2
|
|
6951
|
-
};
|
|
6952
|
-
};
|
|
6953
7006
|
const buildPortraitAxisMark = (spec) => {
|
|
6954
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k
|
|
6955
|
-
const themeColor =
|
|
6956
|
-
const lineStyle = (
|
|
7007
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k;
|
|
7008
|
+
const themeColor = (_a = spec.themeColor) !== null && _a !== void 0 ? _a : '#e8543d';
|
|
7009
|
+
const lineStyle = (_c = (_b = spec.line) === null || _b === void 0 ? void 0 : _b.style) !== null && _c !== void 0 ? _c : {};
|
|
6957
7010
|
const defaultFill = {
|
|
6958
7011
|
gradient: 'linear',
|
|
6959
7012
|
x0: 0,
|
|
@@ -6965,11 +7018,9 @@
|
|
|
6965
7018
|
{ offset: 1, color: withAlpha(themeColor, 1) }
|
|
6966
7019
|
]
|
|
6967
7020
|
};
|
|
6968
|
-
const
|
|
6969
|
-
const markerLineHeight = Number((_j = (_h = (_g = spec.marker) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.lineHeight) !== null && _j !== void 0 ? _j : PORTRAIT_MARKER_LINE_HEIGHT);
|
|
6970
|
-
const markerVisible = ((_k = spec.marker) === null || _k === void 0 ? void 0 : _k.visible) !== false;
|
|
7021
|
+
const markerVisible = ((_e = spec.marker) === null || _e === void 0 ? void 0 : _e.visible) !== false;
|
|
6971
7022
|
const markerMarks = markerVisible
|
|
6972
|
-
? ((
|
|
7023
|
+
? ((_f = spec.data) !== null && _f !== void 0 ? _f : [])
|
|
6973
7024
|
.map((block, index) => {
|
|
6974
7025
|
var _a;
|
|
6975
7026
|
if (!block.marker) {
|
|
@@ -6989,15 +7040,21 @@
|
|
|
6989
7040
|
var _a, _b;
|
|
6990
7041
|
const lb = getLayout(spec, ctx).blocks[index];
|
|
6991
7042
|
return (_b = (_a = lb === null || lb === void 0 ? void 0 : lb.center) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : 0;
|
|
6992
|
-
}, text: {
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7043
|
+
}, text: (_d, ctx) => {
|
|
7044
|
+
var _a, _b, _c;
|
|
7045
|
+
const axis = getPortraitAxisRect(spec, ctx);
|
|
7046
|
+
const markerFontSize = resolveMarkerFontSize(spec, ctx, block.marker, axis.height / Math.max((_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 1, 1), PORTRAIT_MARKER_FONT_SIZE);
|
|
7047
|
+
const markerLineHeight = resolveAdaptiveLineHeight(markerFontSize, (_c = spec.marker) === null || _c === void 0 ? void 0 : _c.style, PORTRAIT_MARKER_LINE_HEIGHT, 0.9);
|
|
7048
|
+
return {
|
|
7049
|
+
type: 'rich',
|
|
7050
|
+
text: block.marker.split('').map((char, i, arr) => ({
|
|
7051
|
+
text: char + (i < arr.length - 1 ? '\n' : ''),
|
|
7052
|
+
fontSize: markerFontSize,
|
|
7053
|
+
lineHeight: markerLineHeight,
|
|
7054
|
+
fill: '#fff',
|
|
7055
|
+
align: markerTextAlign
|
|
7056
|
+
}))
|
|
7057
|
+
};
|
|
7001
7058
|
}, fontWeight: 'bold', lineJoin: 'round', shadowColor: 'rgba(0, 0, 0, 0.3)', shadowBlur: 8, shadowOffsetX: 0, shadowOffsetY: 5, textAlign: markerTextAlign, textBaseline: 'middle' }, (_a = spec.marker) === null || _a === void 0 ? void 0 : _a.style) });
|
|
7002
7059
|
})
|
|
7003
7060
|
.filter(Boolean)
|
|
@@ -7012,10 +7069,10 @@
|
|
|
7012
7069
|
name: 'storyline-portrait-axis-rect',
|
|
7013
7070
|
interactive: false,
|
|
7014
7071
|
style: {
|
|
7015
|
-
fill: (
|
|
7016
|
-
stroke: (
|
|
7017
|
-
lineWidth: (
|
|
7018
|
-
cornerRadius: (
|
|
7072
|
+
fill: (_g = lineStyle.fill) !== null && _g !== void 0 ? _g : defaultFill,
|
|
7073
|
+
stroke: (_h = lineStyle.stroke) !== null && _h !== void 0 ? _h : false,
|
|
7074
|
+
lineWidth: (_j = lineStyle.lineWidth) !== null && _j !== void 0 ? _j : 0,
|
|
7075
|
+
cornerRadius: (_k = lineStyle.cornerRadius) !== null && _k !== void 0 ? _k : 0,
|
|
7019
7076
|
x: (_d, ctx) => getPortraitAxisRect(spec, ctx).x,
|
|
7020
7077
|
y: (_d, ctx) => getPortraitAxisRect(spec, ctx).y,
|
|
7021
7078
|
width: (_d, ctx) => getPortraitAxisRect(spec, ctx).width,
|
|
@@ -7026,15 +7083,15 @@
|
|
|
7026
7083
|
]
|
|
7027
7084
|
};
|
|
7028
7085
|
};
|
|
7029
|
-
const getPortraitMetrics = (spec, blockWidth, blockHeight, index) => {
|
|
7030
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p
|
|
7031
|
-
const
|
|
7032
|
-
const
|
|
7033
|
-
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);
|
|
7034
|
-
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);
|
|
7086
|
+
const getPortraitMetrics = (spec, blockWidth, blockHeight, index, ctx) => {
|
|
7087
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
7088
|
+
const contentFontSize = Number((_c = (_b = (_a = spec.content) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : PORTRAIT_CONTENT_FONT_SIZE);
|
|
7089
|
+
const contentLineHeight = Number((_g = (_f = (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : PORTRAIT_CONTENT_LINE_HEIGHT);
|
|
7035
7090
|
const titleToContentGap = PORTRAIT_TITLE_TO_CONTENT_GAP;
|
|
7036
|
-
const imageWidth = (
|
|
7037
|
-
const imageHeight = (
|
|
7091
|
+
const imageWidth = (_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : Math.max(blockWidth, 80);
|
|
7092
|
+
const imageHeight = (_l = (_k = spec.image) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : Math.round(blockHeight * PORTRAIT_IMAGE_HEIGHT_RATIO);
|
|
7093
|
+
const titleFontSize = resolveTitleFontSize(spec, ctx, (_o = (_m = spec.data) === null || _m === void 0 ? void 0 : _m[index]) === null || _o === void 0 ? void 0 : _o.title, imageWidth, 26, [8, 34]);
|
|
7094
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_p = spec.title) === null || _p === void 0 ? void 0 : _p.style, PORTRAIT_TITLE_LINE_HEIGHT);
|
|
7038
7095
|
const minContentHeight = PORTRAIT_CONTENT_LINES * contentLineHeight;
|
|
7039
7096
|
const contentHeight = Math.max(minContentHeight, Math.round(blockHeight * PORTRAIT_CONTENT_HEIGHT_RATIO));
|
|
7040
7097
|
const textHeight = titleLineHeight + titleToContentGap + contentHeight;
|
|
@@ -7078,25 +7135,44 @@
|
|
|
7078
7135
|
contentBox
|
|
7079
7136
|
};
|
|
7080
7137
|
};
|
|
7138
|
+
const getPortraitAxisRect = (spec, ctx) => {
|
|
7139
|
+
const blocks = getLayout(spec, ctx).blocks;
|
|
7140
|
+
if (!blocks.length) {
|
|
7141
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
7142
|
+
}
|
|
7143
|
+
let top = Number.POSITIVE_INFINITY;
|
|
7144
|
+
let bottom = Number.NEGATIVE_INFINITY;
|
|
7145
|
+
blocks.forEach((block, index) => {
|
|
7146
|
+
const metrics = getPortraitMetrics(spec, block.width, block.height, index, ctx);
|
|
7147
|
+
const localTop = Math.min(metrics.imageBox.y, metrics.shadowBox.y, metrics.textBox.y, metrics.contentBox.y);
|
|
7148
|
+
const localBottom = Math.max(metrics.imageBox.y + metrics.imageBox.height, metrics.shadowBox.y + metrics.shadowBox.height, metrics.textBox.y + metrics.textBox.height, metrics.contentBox.y + metrics.contentBox.height);
|
|
7149
|
+
top = Math.min(top, block.center.y + localTop);
|
|
7150
|
+
bottom = Math.max(bottom, block.center.y + localBottom);
|
|
7151
|
+
});
|
|
7152
|
+
const cx = blocks[0].center.x;
|
|
7153
|
+
return {
|
|
7154
|
+
x: cx - PORTRAIT_AXIS_WIDTH / 2,
|
|
7155
|
+
y: top - PORTRAIT_AXIS_PADDING,
|
|
7156
|
+
width: PORTRAIT_AXIS_WIDTH,
|
|
7157
|
+
height: bottom - top + PORTRAIT_AXIS_PADDING * 2
|
|
7158
|
+
};
|
|
7159
|
+
};
|
|
7081
7160
|
const buildPortraitBlockMark = (spec, block, index) => {
|
|
7082
|
-
var _a, _b, _c, _e, _f, _g
|
|
7161
|
+
var _a, _b, _c, _e, _f, _g;
|
|
7083
7162
|
const hasImage = !!block.image;
|
|
7084
7163
|
const hasSubImage = !!block.subImage;
|
|
7085
7164
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7086
|
-
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 26);
|
|
7087
|
-
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)));
|
|
7088
7165
|
const getMetrics = (ctx) => {
|
|
7089
7166
|
var _a, _b, _c, _e;
|
|
7090
7167
|
const lb = getLayout(spec, ctx).blocks[index];
|
|
7091
7168
|
const w = (_a = lb === null || lb === void 0 ? void 0 : lb.width) !== null && _a !== void 0 ? _a : resolveBlockWidth(spec, 0);
|
|
7092
7169
|
const h = (_e = (_b = lb === null || lb === void 0 ? void 0 : lb.height) !== null && _b !== void 0 ? _b : (_c = spec.block) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : DEFAULT_BLOCK_HEIGHT;
|
|
7093
|
-
return getPortraitMetrics(spec, w, h, index);
|
|
7170
|
+
return getPortraitMetrics(spec, w, h, index, ctx);
|
|
7094
7171
|
};
|
|
7095
|
-
const
|
|
7096
|
-
const blockStyle = (_j = (_h = spec.block) === null || _h === void 0 ? void 0 : _h.style) !== null && _j !== void 0 ? _j : {};
|
|
7172
|
+
const blockStyle = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
|
|
7097
7173
|
return {
|
|
7098
7174
|
type: 'group',
|
|
7099
|
-
id: `storyline-block-${(
|
|
7175
|
+
id: `storyline-block-${(_c = block.id) !== null && _c !== void 0 ? _c : index}`,
|
|
7100
7176
|
name: `storyline-block-${index}`,
|
|
7101
7177
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7102
7178
|
style: {
|
|
@@ -7125,31 +7201,31 @@
|
|
|
7125
7201
|
image: block.subImage,
|
|
7126
7202
|
repeatX: 'no-repeat',
|
|
7127
7203
|
repeatY: 'no-repeat',
|
|
7128
|
-
imageMode: '
|
|
7204
|
+
imageMode: 'contain',
|
|
7129
7205
|
imagePosition: 'center'
|
|
7130
7206
|
}
|
|
7131
7207
|
}
|
|
7132
7208
|
: null,
|
|
7133
|
-
(
|
|
7209
|
+
shouldShowImageBackground(spec)
|
|
7134
7210
|
? {
|
|
7135
7211
|
type: 'rect',
|
|
7136
7212
|
name: `storyline-block-image-bg-${index}`,
|
|
7137
7213
|
interactive: false,
|
|
7138
|
-
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
|
|
7214
|
+
style: Object.assign(Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), blockStyle)
|
|
7139
7215
|
}
|
|
7140
7216
|
: null,
|
|
7141
7217
|
hasImage
|
|
7142
|
-
? 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: '
|
|
7218
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_e = spec.image) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7143
7219
|
: null,
|
|
7144
7220
|
block.title
|
|
7145
|
-
? 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' }, (
|
|
7221
|
+
? 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: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
|
|
7146
7222
|
: null,
|
|
7147
7223
|
contentText.length
|
|
7148
7224
|
? 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, {
|
|
7149
7225
|
fontSize: PORTRAIT_CONTENT_FONT_SIZE,
|
|
7150
7226
|
lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT,
|
|
7151
7227
|
fill: '#596173'
|
|
7152
|
-
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (
|
|
7228
|
+
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
|
|
7153
7229
|
: null
|
|
7154
7230
|
].filter(Boolean)
|
|
7155
7231
|
};
|
|
@@ -7167,18 +7243,19 @@
|
|
|
7167
7243
|
const ARC_TITLE_TO_CONTENT_GAP = 4;
|
|
7168
7244
|
const ARC_TEXT_PADDING = 20;
|
|
7169
7245
|
const ARC_TEXT_BOX_MIN_WIDTH = 240;
|
|
7170
|
-
const
|
|
7171
|
-
const
|
|
7172
|
-
const
|
|
7246
|
+
const ARC_TITLE_IMAGE_WIDTH_RATIO = 0.68;
|
|
7247
|
+
const ARC_TITLE_IMAGE_MAX_WIDTH = 900;
|
|
7248
|
+
const ARC_TITLE_IMAGE_HEIGHT_RATIO = 0.34;
|
|
7249
|
+
const ARC_GAP_FROM_TITLE_IMAGE = 200;
|
|
7173
7250
|
const isDownArc = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7174
|
-
const
|
|
7251
|
+
const getArcTitleImageRect = (spec, ctx) => {
|
|
7175
7252
|
var _a, _b, _c, _e;
|
|
7176
7253
|
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
7177
7254
|
const innerWidth = Math.max(width, 1);
|
|
7178
7255
|
const innerHeight = Math.max(height, 1);
|
|
7179
|
-
const
|
|
7180
|
-
const w = Math.max((_b = (_a = spec.
|
|
7181
|
-
const h = Math.max((_e = (_c = spec.
|
|
7256
|
+
const baseWidth = Math.min(innerWidth * ARC_TITLE_IMAGE_WIDTH_RATIO, ARC_TITLE_IMAGE_MAX_WIDTH);
|
|
7257
|
+
const w = Math.max((_b = (_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : baseWidth, 80);
|
|
7258
|
+
const h = Math.max((_e = (_c = spec.titleImage) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : w * ARC_TITLE_IMAGE_HEIGHT_RATIO, 40);
|
|
7182
7259
|
const cx = startX + innerWidth / 2;
|
|
7183
7260
|
const isDown = isDownArc(spec);
|
|
7184
7261
|
const top = isDown ? startY : startY + innerHeight - h;
|
|
@@ -7195,20 +7272,20 @@
|
|
|
7195
7272
|
const endAngle = (_b = layoutOpt.endAngle) !== null && _b !== void 0 ? _b : (isDown ? 160 : 340);
|
|
7196
7273
|
const ratio = (_c = layoutOpt.radiusRatio) !== null && _c !== void 0 ? _c : 0.88;
|
|
7197
7274
|
const rx = Math.max((innerWidth - blockWidth) / 2, 1) * ratio;
|
|
7198
|
-
const
|
|
7199
|
-
const centerTop =
|
|
7200
|
-
const centerBottom =
|
|
7275
|
+
const titleImageRect = getArcTitleImageRect(spec, ctx);
|
|
7276
|
+
const centerTop = titleImageRect.y;
|
|
7277
|
+
const centerBottom = titleImageRect.y + titleImageRect.height;
|
|
7201
7278
|
const sinStart = Math.sin((startAngle / 180) * Math.PI);
|
|
7202
7279
|
let cy;
|
|
7203
7280
|
let ry;
|
|
7204
7281
|
if (isDown) {
|
|
7205
7282
|
const denom = Math.max(1 - sinStart, 0.05);
|
|
7206
|
-
ry = (
|
|
7283
|
+
ry = (titleImageRect.height + ARC_GAP_FROM_TITLE_IMAGE) / denom;
|
|
7207
7284
|
cy = centerTop - ry * sinStart;
|
|
7208
7285
|
}
|
|
7209
7286
|
else {
|
|
7210
7287
|
const denom = Math.max(1 + sinStart, 0.05);
|
|
7211
|
-
ry = (
|
|
7288
|
+
ry = (titleImageRect.height + ARC_GAP_FROM_TITLE_IMAGE) / denom;
|
|
7212
7289
|
cy = centerBottom - ry * sinStart;
|
|
7213
7290
|
}
|
|
7214
7291
|
return {
|
|
@@ -7282,121 +7359,45 @@
|
|
|
7282
7359
|
]
|
|
7283
7360
|
};
|
|
7284
7361
|
};
|
|
7285
|
-
const
|
|
7286
|
-
var _a
|
|
7287
|
-
|
|
7288
|
-
if (!visible) {
|
|
7362
|
+
const buildArcTitleImageMark = (spec) => {
|
|
7363
|
+
var _a;
|
|
7364
|
+
if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
|
|
7289
7365
|
return null;
|
|
7290
7366
|
}
|
|
7291
|
-
const themeColor = getThemeColor(spec);
|
|
7292
|
-
const hasImage = !!((_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.image);
|
|
7293
|
-
const symbolGradient = {
|
|
7294
|
-
gradient: 'linear',
|
|
7295
|
-
x0: 0.5,
|
|
7296
|
-
y0: 0,
|
|
7297
|
-
x1: 0.5,
|
|
7298
|
-
y1: 1,
|
|
7299
|
-
stops: [
|
|
7300
|
-
{ offset: 0, color: withAlpha(themeColor, 0.15) },
|
|
7301
|
-
{ offset: 1, color: themeColor }
|
|
7302
|
-
]
|
|
7303
|
-
};
|
|
7304
7367
|
return {
|
|
7305
7368
|
type: 'group',
|
|
7306
|
-
name: 'storyline-arc-
|
|
7307
|
-
zIndex: vchart.LayoutZIndex.Mark,
|
|
7369
|
+
name: 'storyline-arc-title-image',
|
|
7370
|
+
zIndex: vchart.LayoutZIndex.Mark + 6,
|
|
7308
7371
|
children: [
|
|
7309
|
-
{
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
return
|
|
7317
|
-
},
|
|
7318
|
-
|
|
7319
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7320
|
-
return r.y + r.height / 2;
|
|
7321
|
-
},
|
|
7322
|
-
size: (_d, ctx) => {
|
|
7323
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7324
|
-
return Math.max(r.width, r.height);
|
|
7325
|
-
},
|
|
7326
|
-
symbolType: 'circle',
|
|
7327
|
-
fill: hasImage ? symbolGradient : '#ffffff',
|
|
7328
|
-
stroke: themeColor,
|
|
7329
|
-
lineWidth: 2
|
|
7330
|
-
}
|
|
7331
|
-
},
|
|
7332
|
-
hasImage
|
|
7333
|
-
? Object.assign(Object.assign({ type: 'image', name: 'storyline-arc-center-image', interactive: false }, spec.centerImage), { style: Object.assign({ x: (_d, ctx) => {
|
|
7334
|
-
var _a, _b;
|
|
7335
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7336
|
-
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7337
|
-
const w = typeof userWidth === 'number'
|
|
7338
|
-
? userWidth
|
|
7339
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7340
|
-
return r.x + (r.width - w) / 2;
|
|
7341
|
-
}, y: (_d, ctx) => {
|
|
7342
|
-
var _a, _b;
|
|
7343
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7344
|
-
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
7345
|
-
const h = typeof userHeight === 'number'
|
|
7346
|
-
? userHeight
|
|
7347
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7348
|
-
return r.y + (r.height - h) / 2;
|
|
7349
|
-
}, width: (_d, ctx) => {
|
|
7350
|
-
var _a, _b;
|
|
7351
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7352
|
-
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7353
|
-
return typeof userWidth === 'number'
|
|
7354
|
-
? userWidth
|
|
7355
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7356
|
-
}, height: (_d, ctx) => {
|
|
7357
|
-
var _a, _b;
|
|
7358
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7359
|
-
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
7360
|
-
return typeof userHeight === 'number'
|
|
7361
|
-
? userHeight
|
|
7362
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7363
|
-
}, cornerRadius: (_d, ctx) => {
|
|
7364
|
-
var _a, _b, _c, _e;
|
|
7365
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7366
|
-
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7367
|
-
const userHeight = (_e = (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.style) === null || _e === void 0 ? void 0 : _e.height;
|
|
7368
|
-
const w = typeof userWidth === 'number'
|
|
7369
|
-
? userWidth
|
|
7370
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7371
|
-
const h = typeof userHeight === 'number'
|
|
7372
|
-
? userHeight
|
|
7373
|
-
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7374
|
-
return Math.max(w, h) / 2;
|
|
7375
|
-
}, 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) => {
|
|
7376
|
-
const r = getArcCenterImageRect(spec, ctx);
|
|
7377
|
-
return [r.x + r.width / 2, r.y + r.height / 2];
|
|
7378
|
-
} }, (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7379
|
-
: null
|
|
7380
|
-
].filter(Boolean)
|
|
7372
|
+
Object.assign(Object.assign({ type: 'image', name: 'storyline-arc-title-image-node', interactive: false }, spec.titleImage), { style: Object.assign({ x: (_d, ctx) => {
|
|
7373
|
+
return getArcTitleImageRect(spec, ctx).x;
|
|
7374
|
+
}, y: (_d, ctx) => {
|
|
7375
|
+
return getArcTitleImageRect(spec, ctx).y;
|
|
7376
|
+
}, width: (_d, ctx) => {
|
|
7377
|
+
return getArcTitleImageRect(spec, ctx).width;
|
|
7378
|
+
}, height: (_d, ctx) => {
|
|
7379
|
+
return getArcTitleImageRect(spec, ctx).height;
|
|
7380
|
+
}, image: spec.titleImage.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, spec.titleImage.style) })
|
|
7381
|
+
]
|
|
7381
7382
|
};
|
|
7382
7383
|
};
|
|
7383
7384
|
const getArcBlockMetrics = (spec, index = 0) => {
|
|
7384
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
7385
|
-
const
|
|
7386
|
-
const
|
|
7387
|
-
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);
|
|
7388
|
-
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);
|
|
7385
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
7386
|
+
const contentFontSize = Number((_c = (_b = (_a = spec.content) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : ARC_CONTENT_FONT_SIZE);
|
|
7387
|
+
const contentLineHeight = Number((_g = (_f = (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : ARC_CONTENT_LINE_HEIGHT);
|
|
7389
7388
|
const titleToContentGap = ARC_TITLE_TO_CONTENT_GAP;
|
|
7390
|
-
const
|
|
7391
|
-
const contentHeight = Math.max(textHeight - titleLineHeight - titleToContentGap, contentLineHeight);
|
|
7392
|
-
const imageDiameter = Math.max((_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : ARC_BLOCK_IMAGE_SIZE, (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : ARC_BLOCK_IMAGE_SIZE);
|
|
7389
|
+
const imageDiameter = Math.max((_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : ARC_BLOCK_IMAGE_SIZE, (_l = (_k = spec.image) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : ARC_BLOCK_IMAGE_SIZE);
|
|
7393
7390
|
const imageWidth = imageDiameter;
|
|
7394
7391
|
const imageHeight = imageDiameter;
|
|
7395
7392
|
const isDown = isDownArc(spec);
|
|
7396
|
-
const count = Math.max((
|
|
7397
|
-
const canvasWidth = Number((
|
|
7393
|
+
const count = Math.max((_o = (_m = spec.data) === null || _m === void 0 ? void 0 : _m.length) !== null && _o !== void 0 ? _o : 0, 1);
|
|
7394
|
+
const canvasWidth = Number((_p = spec.width) !== null && _p !== void 0 ? _p : imageWidth * count);
|
|
7398
7395
|
const defaultTextWidth = Math.round(canvasWidth / (count + 1));
|
|
7399
|
-
const textBoxWidth = Math.max(Number((
|
|
7396
|
+
const textBoxWidth = Math.max(Number((_r = (_q = spec.block) === null || _q === void 0 ? void 0 : _q.width) !== null && _r !== void 0 ? _r : defaultTextWidth), ARC_TEXT_BOX_MIN_WIDTH);
|
|
7397
|
+
const titleFontSize = resolveTitleFontSize(spec, undefined, (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t.title, textBoxWidth, ARC_TITLE_FONT_SIZE, [8, 40]);
|
|
7398
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_u = spec.title) === null || _u === void 0 ? void 0 : _u.style, ARC_TITLE_LINE_HEIGHT);
|
|
7399
|
+
const textHeight = ARC_TEXT_BOX_HEIGHT;
|
|
7400
|
+
const contentHeight = Math.max(textHeight - titleLineHeight - titleToContentGap, contentLineHeight);
|
|
7400
7401
|
const isLeftSide = index < count / 2;
|
|
7401
7402
|
const textAlign = isLeftSide ? 'right' : 'left';
|
|
7402
7403
|
const imageBox = {
|
|
@@ -7431,7 +7432,7 @@
|
|
|
7431
7432
|
};
|
|
7432
7433
|
};
|
|
7433
7434
|
const buildArcBlockMark = (spec, block, index) => {
|
|
7434
|
-
var _a, _b, _c, _e
|
|
7435
|
+
var _a, _b, _c, _e;
|
|
7435
7436
|
const hasImage = !!block.image;
|
|
7436
7437
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7437
7438
|
const themeColor = getThemeColor(spec);
|
|
@@ -7466,23 +7467,15 @@
|
|
|
7466
7467
|
}
|
|
7467
7468
|
},
|
|
7468
7469
|
hasImage
|
|
7469
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 3 }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: '
|
|
7470
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 3 }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
|
|
7470
7471
|
: {
|
|
7471
7472
|
type: 'symbol',
|
|
7472
7473
|
name: `storyline-block-image-bg-${index}`,
|
|
7473
7474
|
interactive: false,
|
|
7474
7475
|
zIndex: vchart.LayoutZIndex.Mark + 3,
|
|
7475
|
-
style: {
|
|
7476
|
-
x: 0,
|
|
7477
|
-
y: 0,
|
|
7478
|
-
size: Math.min(metrics.imageBox.width, metrics.imageBox.height),
|
|
7479
|
-
symbolType: 'circle',
|
|
7480
|
-
fill: '#ffffff',
|
|
7481
|
-
stroke: themeColor,
|
|
7482
|
-
lineWidth: 2
|
|
7483
|
-
}
|
|
7476
|
+
style: Object.assign({ x: 0, y: 0, size: Math.min(metrics.imageBox.width, metrics.imageBox.height), symbolType: 'circle' }, getImageBackgroundStyle(spec))
|
|
7484
7477
|
},
|
|
7485
|
-
(
|
|
7478
|
+
shouldShowImageBackground(spec)
|
|
7486
7479
|
? {
|
|
7487
7480
|
type: 'symbol',
|
|
7488
7481
|
name: `storyline-block-image-halo-${index}`,
|
|
@@ -7494,13 +7487,13 @@
|
|
|
7494
7487
|
size: Math.min(metrics.imageBox.width, metrics.imageBox.height) + ARC_BLOCK_IMAGE_HALO_PADDING * 2,
|
|
7495
7488
|
symbolType: 'circle',
|
|
7496
7489
|
fill: 'transparent',
|
|
7497
|
-
stroke: themeColor,
|
|
7490
|
+
stroke: withAlpha(themeColor, 0.82),
|
|
7498
7491
|
lineWidth: ARC_BLOCK_IMAGE_BORDER
|
|
7499
7492
|
}
|
|
7500
7493
|
}
|
|
7501
7494
|
: null,
|
|
7502
7495
|
block.title
|
|
7503
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 5 }, spec.title), { style: Object.assign({ x: metrics.textBox.x, y: metrics.textBox.y, text: block.title, maxLineWidth: metrics.textBox.width, fontSize: metrics.titleFontSize, lineHeight: metrics.titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: metrics.textAlign, textBaseline: 'top' }, (
|
|
7496
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 5 }, spec.title), { style: Object.assign({ x: metrics.textBox.x, y: metrics.textBox.y, text: block.title, maxLineWidth: metrics.textBox.width, fontSize: metrics.titleFontSize, lineHeight: metrics.titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: metrics.textAlign, textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7504
7497
|
: null,
|
|
7505
7498
|
contentText.length
|
|
7506
7499
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 4 }, 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, {
|
|
@@ -7508,7 +7501,7 @@
|
|
|
7508
7501
|
lineHeight: metrics.contentLineHeight,
|
|
7509
7502
|
fill: '#596173',
|
|
7510
7503
|
align: metrics.textAlign
|
|
7511
|
-
}), textAlign: metrics.textAlign, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (
|
|
7504
|
+
}), textAlign: metrics.textAlign, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7512
7505
|
: null
|
|
7513
7506
|
].filter(Boolean)
|
|
7514
7507
|
};
|
|
@@ -7522,9 +7515,10 @@
|
|
|
7522
7515
|
const WING_TEXT_BOX_WIDTH = 240;
|
|
7523
7516
|
const WING_TEXT_BOX_HEIGHT = 110;
|
|
7524
7517
|
const WING_TITLE_TO_CONTENT_GAP = 4;
|
|
7518
|
+
const WING_TITLE_IMAGE_WIDTH_RATIO = 0.6;
|
|
7519
|
+
const WING_TITLE_IMAGE_MAX_WIDTH = 820;
|
|
7525
7520
|
const getWingDirection = (spec) => {
|
|
7526
|
-
|
|
7527
|
-
return (_a = normalizeLayout(spec.layout).direction) !== null && _a !== void 0 ? _a : 'left';
|
|
7521
|
+
return normalizeLayout(spec.layout).direction === 'right' ? 'right' : 'left';
|
|
7528
7522
|
};
|
|
7529
7523
|
const getWingArcGeometry = (spec, ctx) => {
|
|
7530
7524
|
var _a, _b, _c;
|
|
@@ -7623,18 +7617,53 @@
|
|
|
7623
7617
|
]
|
|
7624
7618
|
};
|
|
7625
7619
|
};
|
|
7620
|
+
const buildWingTitleImageMark = (spec) => {
|
|
7621
|
+
var _a;
|
|
7622
|
+
if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
|
|
7623
|
+
return null;
|
|
7624
|
+
}
|
|
7625
|
+
return {
|
|
7626
|
+
type: 'group',
|
|
7627
|
+
name: 'storyline-wing-title-image',
|
|
7628
|
+
zIndex: vchart.LayoutZIndex.Mark + 8,
|
|
7629
|
+
children: [
|
|
7630
|
+
Object.assign(Object.assign({ type: 'image', name: 'storyline-wing-title-image-node', interactive: false }, spec.titleImage), { style: Object.assign({ x: (_d, ctx) => {
|
|
7631
|
+
const { width, height, startX } = getChartGeometry(ctx, spec);
|
|
7632
|
+
const size = getTitleImageSize(spec, width, height, {
|
|
7633
|
+
widthRatio: WING_TITLE_IMAGE_WIDTH_RATIO,
|
|
7634
|
+
maxWidth: WING_TITLE_IMAGE_MAX_WIDTH
|
|
7635
|
+
});
|
|
7636
|
+
return getWingDirection(spec) === 'right' ? startX : startX + width - size.width;
|
|
7637
|
+
}, y: (_d, ctx) => {
|
|
7638
|
+
return getChartGeometry(ctx, spec).startY + 12;
|
|
7639
|
+
}, width: (_d, ctx) => {
|
|
7640
|
+
const { width, height } = getChartGeometry(ctx, spec);
|
|
7641
|
+
return getTitleImageSize(spec, width, height, {
|
|
7642
|
+
widthRatio: WING_TITLE_IMAGE_WIDTH_RATIO,
|
|
7643
|
+
maxWidth: WING_TITLE_IMAGE_MAX_WIDTH
|
|
7644
|
+
}).width;
|
|
7645
|
+
}, height: (_d, ctx) => {
|
|
7646
|
+
const { width, height } = getChartGeometry(ctx, spec);
|
|
7647
|
+
return getTitleImageSize(spec, width, height, {
|
|
7648
|
+
widthRatio: WING_TITLE_IMAGE_WIDTH_RATIO,
|
|
7649
|
+
maxWidth: WING_TITLE_IMAGE_MAX_WIDTH
|
|
7650
|
+
}).height;
|
|
7651
|
+
}, image: spec.titleImage.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, spec.titleImage.style) })
|
|
7652
|
+
]
|
|
7653
|
+
};
|
|
7654
|
+
};
|
|
7626
7655
|
const WING_TEXT_IMAGE_GAP = 120;
|
|
7627
7656
|
const getWingBlockMetrics = (spec, ctx, index) => {
|
|
7628
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r
|
|
7629
|
-
const titleFontSize =
|
|
7630
|
-
const titleLineHeight =
|
|
7631
|
-
const contentFontSize = Number((
|
|
7632
|
-
const contentLineHeight = Number((
|
|
7657
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
7658
|
+
const titleFontSize = resolveTitleFontSize(spec, ctx, (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.title, WING_TEXT_BOX_WIDTH, WING_TITLE_FONT_SIZE, [8, 30]);
|
|
7659
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style, WING_TITLE_LINE_HEIGHT, 1.3);
|
|
7660
|
+
const contentFontSize = Number((_g = (_f = (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.fontSize) !== null && _g !== void 0 ? _g : WING_CONTENT_FONT_SIZE);
|
|
7661
|
+
const contentLineHeight = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.lineHeight) !== null && _k !== void 0 ? _k : WING_CONTENT_LINE_HEIGHT);
|
|
7633
7662
|
const titleToContentGap = WING_TITLE_TO_CONTENT_GAP;
|
|
7634
7663
|
const textHeight = WING_TEXT_BOX_HEIGHT;
|
|
7635
7664
|
const contentHeight = 100000;
|
|
7636
|
-
const imageWidth = Number((
|
|
7637
|
-
const imageHeight = Number((
|
|
7665
|
+
const imageWidth = Number((_m = (_l = spec.image) === null || _l === void 0 ? void 0 : _l.width) !== null && _m !== void 0 ? _m : WING_BLOCK_IMAGE_SIZE);
|
|
7666
|
+
const imageHeight = Number((_p = (_o = spec.image) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : WING_BLOCK_IMAGE_SIZE);
|
|
7638
7667
|
const imageBox = {
|
|
7639
7668
|
x: -imageWidth / 2,
|
|
7640
7669
|
y: -imageHeight / 2,
|
|
@@ -7642,7 +7671,7 @@
|
|
|
7642
7671
|
height: imageHeight
|
|
7643
7672
|
};
|
|
7644
7673
|
const direction = getWingDirection(spec);
|
|
7645
|
-
const count = (
|
|
7674
|
+
const count = (_r = (_q = spec.data) === null || _q === void 0 ? void 0 : _q.length) !== null && _r !== void 0 ? _r : 0;
|
|
7646
7675
|
const isSpecialBelow = (direction === 'right' && count > 0 && index === count - 1) || (direction === 'left' && index === 0);
|
|
7647
7676
|
const isVerticalLayout = isSpecialBelow;
|
|
7648
7677
|
const textWidth = WING_TEXT_BOX_WIDTH;
|
|
@@ -7706,14 +7735,14 @@
|
|
|
7706
7735
|
};
|
|
7707
7736
|
};
|
|
7708
7737
|
const buildWingBlockMark = (spec, block, index) => {
|
|
7709
|
-
var _a, _b, _c, _e
|
|
7738
|
+
var _a, _b, _c, _e;
|
|
7710
7739
|
const hasImage = !!block.image;
|
|
7711
7740
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7712
7741
|
const themeColor = getThemeColor(spec);
|
|
7713
|
-
const showBackground = (
|
|
7742
|
+
const showBackground = shouldShowImageBackground(spec);
|
|
7714
7743
|
return {
|
|
7715
7744
|
type: 'group',
|
|
7716
|
-
id: `storyline-block-${(
|
|
7745
|
+
id: `storyline-block-${(_a = block.id) !== null && _a !== void 0 ? _a : index}`,
|
|
7717
7746
|
name: `storyline-block-${index}`,
|
|
7718
7747
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7719
7748
|
style: {
|
|
@@ -7740,33 +7769,16 @@
|
|
|
7740
7769
|
type: 'symbol',
|
|
7741
7770
|
name: `storyline-block-image-halo-${index}`,
|
|
7742
7771
|
interactive: false,
|
|
7743
|
-
style: {
|
|
7744
|
-
x: 0,
|
|
7745
|
-
y: 0,
|
|
7746
|
-
size: (_d, ctx) => Math.max(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) + 12,
|
|
7747
|
-
symbolType: 'circle',
|
|
7748
|
-
fill: withAlpha(themeColor, 0.18),
|
|
7749
|
-
stroke: themeColor,
|
|
7750
|
-
lineWidth: 1.5
|
|
7751
|
-
}
|
|
7772
|
+
style: Object.assign(Object.assign({ x: 0, y: 0, size: (_d, ctx) => Math.max(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) + 12, symbolType: 'circle' }, getImageBackgroundStyle(spec)), { lineWidth: 1.5 })
|
|
7752
7773
|
}
|
|
7753
7774
|
: null,
|
|
7754
7775
|
hasImage
|
|
7755
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: '
|
|
7776
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
|
|
7756
7777
|
: {
|
|
7757
7778
|
type: 'rect',
|
|
7758
7779
|
name: `storyline-block-image-bg-${index}`,
|
|
7759
7780
|
interactive: false,
|
|
7760
|
-
style: {
|
|
7761
|
-
x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x,
|
|
7762
|
-
y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y,
|
|
7763
|
-
width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width,
|
|
7764
|
-
height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height,
|
|
7765
|
-
cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2,
|
|
7766
|
-
fill: '#ffffff',
|
|
7767
|
-
stroke: themeColor,
|
|
7768
|
-
lineWidth: 2
|
|
7769
|
-
}
|
|
7781
|
+
style: Object.assign({ x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2 }, getImageBackgroundStyle(spec))
|
|
7770
7782
|
},
|
|
7771
7783
|
block.title
|
|
7772
7784
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.title), { style: Object.assign({ x: (_d, ctx) => {
|
|
@@ -7781,7 +7793,7 @@
|
|
|
7781
7793
|
return 'center';
|
|
7782
7794
|
}
|
|
7783
7795
|
return m.onLeft ? 'right' : 'left';
|
|
7784
|
-
}, textBaseline: 'top' }, (
|
|
7796
|
+
}, textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7785
7797
|
: null,
|
|
7786
7798
|
contentText.length
|
|
7787
7799
|
? 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: (_d, ctx) => {
|
|
@@ -7796,7 +7808,7 @@
|
|
|
7796
7808
|
return 'center';
|
|
7797
7809
|
}
|
|
7798
7810
|
return m.onLeft ? 'right' : 'left';
|
|
7799
|
-
}, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#1f2430' }, (
|
|
7811
|
+
}, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#1f2430' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7800
7812
|
: null
|
|
7801
7813
|
].filter(Boolean)
|
|
7802
7814
|
};
|
|
@@ -7908,7 +7920,7 @@
|
|
|
7908
7920
|
};
|
|
7909
7921
|
const isOnLeft = (index) => index % 2 === 1;
|
|
7910
7922
|
const getLadderBlockMetrics = (spec, ctx, index) => {
|
|
7911
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x
|
|
7923
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
7912
7924
|
const block = getLayout(spec, ctx).blocks[index];
|
|
7913
7925
|
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
7914
7926
|
const imagePosition = isOnLeft(index) ? 'right' : 'left';
|
|
@@ -7916,16 +7928,18 @@
|
|
|
7916
7928
|
const imageHeight = (_g = (_f = spec.image) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : LADDER_BLOCK_IMAGE_SIZE;
|
|
7917
7929
|
const imageGap = (_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : DEFAULT_IMAGE_GAP;
|
|
7918
7930
|
const hasImage = !!((_l = (_k = spec.data) === null || _k === void 0 ? void 0 : _k[index]) === null || _l === void 0 ? void 0 : _l.image);
|
|
7919
|
-
const
|
|
7920
|
-
const
|
|
7921
|
-
const titleHeight = ((_u = (_t = spec.data) === null || _t === void 0 ? void 0 : _t[index]) === null || _u === void 0 ? void 0 : _u.title) ? titleLineHeight : 0;
|
|
7922
|
-
const blockWidth = (_v = block === null || block === void 0 ? void 0 : block.width) !== null && _v !== void 0 ? _v : resolveBlockWidth(spec, 0);
|
|
7923
|
-
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;
|
|
7931
|
+
const blockWidth = (_m = block === null || block === void 0 ? void 0 : block.width) !== null && _m !== void 0 ? _m : resolveBlockWidth(spec, 0);
|
|
7932
|
+
const blockHeight = (_q = (_o = block === null || block === void 0 ? void 0 : block.height) !== null && _o !== void 0 ? _o : (_p = spec.block) === null || _p === void 0 ? void 0 : _p.height) !== null && _q !== void 0 ? _q : DEFAULT_BLOCK_HEIGHT;
|
|
7924
7933
|
const imageBox = getImageBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
7925
7934
|
const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
7926
|
-
const
|
|
7935
|
+
const titleFontSize = resolveTitleFontSize(spec, ctx, (_s = (_r = spec.data) === null || _r === void 0 ? void 0 : _r[index]) === null || _s === void 0 ? void 0 : _s.title, textBox.width, LADDER_TITLE_FONT_SIZE, [8, 34]);
|
|
7936
|
+
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_t = spec.title) === null || _t === void 0 ? void 0 : _t.style, LADDER_TITLE_LINE_HEIGHT, LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE);
|
|
7937
|
+
const titleHeight = ((_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title) ? titleLineHeight : 0;
|
|
7938
|
+
const contentGap = ((_x = (_w = spec.data) === null || _w === void 0 ? void 0 : _w[index]) === null || _x === void 0 ? void 0 : _x.title) ? 8 : 0;
|
|
7927
7939
|
return {
|
|
7928
7940
|
block: { width: blockWidth, height: blockHeight },
|
|
7941
|
+
titleFontSize,
|
|
7942
|
+
titleLineHeight,
|
|
7929
7943
|
imageBox,
|
|
7930
7944
|
textBox,
|
|
7931
7945
|
contentBox: {
|
|
@@ -7935,21 +7949,20 @@
|
|
|
7935
7949
|
};
|
|
7936
7950
|
};
|
|
7937
7951
|
const buildLadderBlockMark = (spec, block, index) => {
|
|
7938
|
-
var _a, _b, _c, _e, _f, _g, _h
|
|
7952
|
+
var _a, _b, _c, _e, _f, _g, _h;
|
|
7939
7953
|
const hasImage = !!block.image;
|
|
7940
7954
|
const onLeft = isOnLeft(index);
|
|
7941
7955
|
const align = onLeft ? 'right' : 'left';
|
|
7942
7956
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7943
|
-
const
|
|
7944
|
-
const
|
|
7945
|
-
const showBackground = ((_h = spec.block) === null || _h === void 0 ? void 0 : _h.showBackground) === true;
|
|
7957
|
+
const showBackground = ((_a = spec.block) === null || _a === void 0 ? void 0 : _a.showBackground) === true;
|
|
7958
|
+
const showImageBackground = shouldShowImageBackground(spec);
|
|
7946
7959
|
const getTitleX = (ctx) => {
|
|
7947
7960
|
const m = getLadderBlockMetrics(spec, ctx, index);
|
|
7948
7961
|
return align === 'right' ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
7949
7962
|
};
|
|
7950
7963
|
return {
|
|
7951
7964
|
type: 'group',
|
|
7952
|
-
id: `storyline-block-${(
|
|
7965
|
+
id: `storyline-block-${(_b = block.id) !== null && _b !== void 0 ? _b : index}`,
|
|
7953
7966
|
name: `storyline-block-${index}`,
|
|
7954
7967
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7955
7968
|
style: {
|
|
@@ -7964,21 +7977,29 @@
|
|
|
7964
7977
|
type: 'rect',
|
|
7965
7978
|
name: `storyline-block-bg-${index}`,
|
|
7966
7979
|
interactive: false,
|
|
7967
|
-
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)' }, (
|
|
7980
|
+
style: Object.assign({ x: 0, y: 0, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_c = spec.block) === null || _c === void 0 ? void 0 : _c.style)
|
|
7981
|
+
}
|
|
7982
|
+
: null,
|
|
7983
|
+
showImageBackground
|
|
7984
|
+
? {
|
|
7985
|
+
type: 'rect',
|
|
7986
|
+
name: `storyline-block-image-bg-${index}`,
|
|
7987
|
+
interactive: false,
|
|
7988
|
+
style: Object.assign(Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), (_e = spec.block) === null || _e === void 0 ? void 0 : _e.style)
|
|
7968
7989
|
}
|
|
7969
7990
|
: null,
|
|
7970
7991
|
hasImage
|
|
7971
|
-
? 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 }, (
|
|
7992
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_f = spec.image) === null || _f === void 0 ? void 0 : _f.style) })
|
|
7972
7993
|
: null,
|
|
7973
7994
|
block.title
|
|
7974
|
-
? 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' }, (
|
|
7995
|
+
? 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: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textBaseline: 'top' }, (_g = spec.title) === null || _g === void 0 ? void 0 : _g.style), { textAlign: align }) })
|
|
7975
7996
|
: null,
|
|
7976
7997
|
contentText.length
|
|
7977
7998
|
? 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, {
|
|
7978
7999
|
fontSize: LADDER_CONTENT_FONT_SIZE,
|
|
7979
8000
|
lineHeight: LADDER_CONTENT_LINE_HEIGHT,
|
|
7980
8001
|
align: align
|
|
7981
|
-
}), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (
|
|
8002
|
+
}), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style), { textAlign: align }) })
|
|
7982
8003
|
: null
|
|
7983
8004
|
].filter(Boolean)
|
|
7984
8005
|
};
|
|
@@ -8011,6 +8032,16 @@
|
|
|
8011
8032
|
const ladder = isLadder(spec);
|
|
8012
8033
|
const wing = isWing(spec);
|
|
8013
8034
|
const clock = isClock(spec);
|
|
8035
|
+
const topTitleImageReserve = (() => {
|
|
8036
|
+
var _a, _b, _c, _d;
|
|
8037
|
+
if (arc ||
|
|
8038
|
+
ladder ||
|
|
8039
|
+
!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) ||
|
|
8040
|
+
((_b = spec.titleImage) === null || _b === void 0 ? void 0 : _b.visible) === false) {
|
|
8041
|
+
return 0;
|
|
8042
|
+
}
|
|
8043
|
+
return getTitleImageReservedHeight(spec, Number((_c = spec.width) !== null && _c !== void 0 ? _c : 1000), Number((_d = spec.height) !== null && _d !== void 0 ? _d : 600));
|
|
8044
|
+
})();
|
|
8014
8045
|
const portraitBottomReserve = (() => {
|
|
8015
8046
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
8016
8047
|
if (!portrait) {
|
|
@@ -8057,7 +8088,7 @@
|
|
|
8057
8088
|
const cap = canvasHeight ? Math.floor(canvasHeight * 0.3) : ideal;
|
|
8058
8089
|
return Math.min(ideal, cap);
|
|
8059
8090
|
})();
|
|
8060
|
-
const defaultTop = clock ? 40 : ladder ? ladderVerticalPadding : arcDown ? 0 : arcUp ? TEXT_RESERVE : SMALL;
|
|
8091
|
+
const defaultTop = Math.max(topTitleImageReserve, clock ? 40 : ladder ? ladderVerticalPadding : arcDown ? 0 : arcUp ? TEXT_RESERVE : SMALL);
|
|
8061
8092
|
const defaultBottom = clock
|
|
8062
8093
|
? 60
|
|
8063
8094
|
: portrait
|
|
@@ -8088,14 +8119,18 @@
|
|
|
8088
8119
|
spec.padding = [defaultTop, defaultRight, defaultBottom, defaultLeft];
|
|
8089
8120
|
return;
|
|
8090
8121
|
}
|
|
8122
|
+
if (typeof p === 'number') {
|
|
8123
|
+
spec.padding = [Math.max(p, topTitleImageReserve), p, p, p];
|
|
8124
|
+
return;
|
|
8125
|
+
}
|
|
8091
8126
|
if (Array.isArray(p)) {
|
|
8092
8127
|
const [t, r = defaultRight, b, l = defaultLeft] = p;
|
|
8093
|
-
spec.padding = [t !== null && t !== void 0 ? t : defaultTop, r, b !== null && b !== void 0 ? b : defaultBottom, l];
|
|
8128
|
+
spec.padding = [Math.max(t !== null && t !== void 0 ? t : defaultTop, topTitleImageReserve), r, b !== null && b !== void 0 ? b : defaultBottom, l];
|
|
8094
8129
|
return;
|
|
8095
8130
|
}
|
|
8096
8131
|
if (typeof p === 'object') {
|
|
8097
8132
|
spec.padding = {
|
|
8098
|
-
top: (_a = p.top) !== null && _a !== void 0 ? _a : defaultTop,
|
|
8133
|
+
top: Math.max((_a = p.top) !== null && _a !== void 0 ? _a : defaultTop, topTitleImageReserve),
|
|
8099
8134
|
right: (_b = p.right) !== null && _b !== void 0 ? _b : defaultRight,
|
|
8100
8135
|
bottom: (_c = p.bottom) !== null && _c !== void 0 ? _c : defaultBottom,
|
|
8101
8136
|
left: (_d = p.left) !== null && _d !== void 0 ? _d : defaultLeft
|
|
@@ -8106,32 +8141,33 @@
|
|
|
8106
8141
|
var _a;
|
|
8107
8142
|
const lineMark = buildLineMark(spec);
|
|
8108
8143
|
const blockMarks = ((_a = spec.data) !== null && _a !== void 0 ? _a : []).map((block, index) => buildBlockMark(spec, block, index));
|
|
8144
|
+
const titleImageMark = buildTopTitleImageMark(spec);
|
|
8109
8145
|
if (isLandscape(spec)) {
|
|
8110
|
-
return [...blockMarks, lineMark].filter(Boolean);
|
|
8146
|
+
return [titleImageMark, ...blockMarks, lineMark].filter(Boolean);
|
|
8111
8147
|
}
|
|
8112
8148
|
if (isPortrait(spec)) {
|
|
8113
|
-
return [lineMark, ...blockMarks].filter(Boolean);
|
|
8149
|
+
return [lineMark, titleImageMark, ...blockMarks].filter(Boolean);
|
|
8114
8150
|
}
|
|
8115
8151
|
if (isArc(spec)) {
|
|
8116
|
-
const
|
|
8152
|
+
const arcTitleImageMark = buildArcTitleImageMark(spec);
|
|
8117
8153
|
const arcMark = buildArcMark(spec);
|
|
8118
|
-
return [
|
|
8154
|
+
return [arcTitleImageMark, arcMark, ...blockMarks].filter(Boolean);
|
|
8119
8155
|
}
|
|
8120
8156
|
if (isClock(spec)) {
|
|
8121
8157
|
const ringsMark = buildClockArcMark(spec);
|
|
8122
|
-
|
|
8123
|
-
return [ringsMark, ...blockMarks, centerImageMark].filter(Boolean);
|
|
8158
|
+
return [titleImageMark, ringsMark, ...blockMarks].filter(Boolean);
|
|
8124
8159
|
}
|
|
8125
8160
|
if (isWing(spec)) {
|
|
8126
8161
|
const arcMark = buildWingArcMark(spec);
|
|
8127
|
-
|
|
8162
|
+
const wingTitleImageMark = buildWingTitleImageMark(spec);
|
|
8163
|
+
return [arcMark, wingTitleImageMark, ...blockMarks].filter(Boolean);
|
|
8128
8164
|
}
|
|
8129
8165
|
if (isLadder(spec)) {
|
|
8130
8166
|
const diagonalMark = buildLadderDiagonalMark(spec);
|
|
8131
8167
|
const headlineMark = buildLadderHeadlineMark(spec);
|
|
8132
8168
|
return [diagonalMark, headlineMark, ...blockMarks].filter(Boolean);
|
|
8133
8169
|
}
|
|
8134
|
-
return [lineMark, ...blockMarks].filter(Boolean);
|
|
8170
|
+
return [titleImageMark, lineMark, ...blockMarks].filter(Boolean);
|
|
8135
8171
|
};
|
|
8136
8172
|
const buildLineMark = (spec) => {
|
|
8137
8173
|
var _a, _b, _c;
|