@visactor/vchart-extension 2.1.0-alpha.20 → 2.1.0-alpha.21
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 +68 -29
- package/build/index.min.js +2 -2
- package/cjs/charts/storyline/interface.js.map +1 -1
- package/cjs/charts/storyline/layouts/arc.js +4 -4
- package/cjs/charts/storyline/layouts/arc.js.map +1 -1
- package/cjs/charts/storyline/layouts/clock.js +16 -2
- package/cjs/charts/storyline/layouts/clock.js.map +1 -1
- package/cjs/charts/storyline/layouts/common.d.ts +1 -0
- package/cjs/charts/storyline/layouts/common.js +9 -1
- package/cjs/charts/storyline/layouts/common.js.map +1 -1
- package/cjs/charts/storyline/layouts/default.js +20 -5
- package/cjs/charts/storyline/layouts/default.js.map +1 -1
- package/cjs/charts/storyline/layouts/ladder.js +20 -5
- package/cjs/charts/storyline/layouts/ladder.js.map +1 -1
- package/cjs/charts/storyline/layouts/landscape.js +2 -2
- package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
- package/cjs/charts/storyline/layouts/portrait.js +5 -5
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
- package/cjs/charts/storyline/layouts/wing.js +6 -6
- package/cjs/charts/storyline/layouts/wing.js.map +1 -1
- package/esm/charts/storyline/interface.js.map +1 -1
- package/esm/charts/storyline/layouts/arc.js +5 -5
- package/esm/charts/storyline/layouts/arc.js.map +1 -1
- package/esm/charts/storyline/layouts/clock.js +16 -3
- package/esm/charts/storyline/layouts/clock.js.map +1 -1
- package/esm/charts/storyline/layouts/common.d.ts +1 -0
- package/esm/charts/storyline/layouts/common.js +5 -0
- package/esm/charts/storyline/layouts/common.js.map +1 -1
- package/esm/charts/storyline/layouts/default.js +20 -6
- package/esm/charts/storyline/layouts/default.js.map +1 -1
- package/esm/charts/storyline/layouts/ladder.js +20 -6
- package/esm/charts/storyline/layouts/ladder.js.map +1 -1
- package/esm/charts/storyline/layouts/landscape.js +3 -3
- package/esm/charts/storyline/layouts/landscape.js.map +1 -1
- package/esm/charts/storyline/layouts/portrait.js +6 -6
- package/esm/charts/storyline/layouts/portrait.js.map +1 -1
- package/esm/charts/storyline/layouts/wing.js +7 -7
- package/esm/charts/storyline/layouts/wing.js.map +1 -1
- package/package.json +4 -4
package/build/index.js
CHANGED
|
@@ -6085,6 +6085,7 @@
|
|
|
6085
6085
|
const isWing = (spec) => normalizeLayout(spec.layout).type === 'wing';
|
|
6086
6086
|
const isLadder = (spec) => normalizeLayout(spec.layout).type === 'ladder';
|
|
6087
6087
|
const getThemeColor = (spec) => { var _a; return (_a = spec.themeColor) !== null && _a !== void 0 ? _a : DEFAULT_THEME_COLOR; };
|
|
6088
|
+
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)); };
|
|
6088
6089
|
const withAlpha = (color, alpha) => {
|
|
6089
6090
|
const safeAlpha = Math.max(0, Math.min(1, alpha));
|
|
6090
6091
|
if (!color) {
|
|
@@ -6468,6 +6469,7 @@
|
|
|
6468
6469
|
var _a, _b, _c;
|
|
6469
6470
|
const hasImage = !!block.image;
|
|
6470
6471
|
const themeColor = getThemeColor(spec);
|
|
6472
|
+
const showImageBackground = shouldShowImageBackground(spec);
|
|
6471
6473
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6472
6474
|
const leadPath = (_d, ctx) => {
|
|
6473
6475
|
const { start, end } = getClockLeadLine(spec, ctx, index);
|
|
@@ -6487,6 +6489,22 @@
|
|
|
6487
6489
|
fillOpacity: 0
|
|
6488
6490
|
}
|
|
6489
6491
|
},
|
|
6492
|
+
showImageBackground
|
|
6493
|
+
? {
|
|
6494
|
+
type: 'symbol',
|
|
6495
|
+
name: `storyline-clock-dot-bg-${index}`,
|
|
6496
|
+
interactive: false,
|
|
6497
|
+
style: {
|
|
6498
|
+
x: (_d, ctx) => getClockDotCenter(spec, ctx, index).x,
|
|
6499
|
+
y: (_d, ctx) => getClockDotCenter(spec, ctx, index).y,
|
|
6500
|
+
size: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter + 10,
|
|
6501
|
+
symbolType: 'circle',
|
|
6502
|
+
fill: '#ffffff',
|
|
6503
|
+
stroke: themeColor,
|
|
6504
|
+
lineWidth: 2
|
|
6505
|
+
}
|
|
6506
|
+
}
|
|
6507
|
+
: null,
|
|
6490
6508
|
hasImage
|
|
6491
6509
|
? {
|
|
6492
6510
|
type: 'image',
|
|
@@ -6594,11 +6612,12 @@
|
|
|
6594
6612
|
};
|
|
6595
6613
|
};
|
|
6596
6614
|
const buildDefaultBlockMark = (spec, block, index) => {
|
|
6597
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
6615
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
6598
6616
|
const hasImage = !!block.image;
|
|
6599
6617
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6600
6618
|
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 18);
|
|
6601
6619
|
const titleLineHeight = Number((_f = (_e = (_d = spec.title) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.lineHeight) !== null && _f !== void 0 ? _f : Math.round(titleFontSize * 1.35));
|
|
6620
|
+
const themeColor = getThemeColor(spec);
|
|
6602
6621
|
return {
|
|
6603
6622
|
type: 'group',
|
|
6604
6623
|
id: `storyline-block-${(_g = block.id) !== null && _g !== void 0 ? _g : index}`,
|
|
@@ -6619,18 +6638,26 @@
|
|
|
6619
6638
|
style: Object.assign({ x: 0, y: 0, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_j = spec.block) === null || _j === void 0 ? void 0 : _j.style)
|
|
6620
6639
|
}
|
|
6621
6640
|
: null,
|
|
6641
|
+
shouldShowImageBackground(spec)
|
|
6642
|
+
? {
|
|
6643
|
+
type: 'rect',
|
|
6644
|
+
name: `storyline-block-image-bg-${index}`,
|
|
6645
|
+
interactive: false,
|
|
6646
|
+
style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8, fill: '#ffffff', stroke: themeColor, lineWidth: 2 }, (_k = spec.block) === null || _k === void 0 ? void 0 : _k.style)
|
|
6647
|
+
}
|
|
6648
|
+
: null,
|
|
6622
6649
|
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 }, (
|
|
6650
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_l = spec.image) === null || _l === void 0 ? void 0 : _l.style) })
|
|
6624
6651
|
: null,
|
|
6625
6652
|
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' }, (
|
|
6653
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, fontSize: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_m = spec.title) === null || _m === void 0 ? void 0 : _m.style) })
|
|
6627
6654
|
: null,
|
|
6628
6655
|
contentText.length
|
|
6629
6656
|
? 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
6657
|
fontSize: 18,
|
|
6631
6658
|
lineHeight: 26,
|
|
6632
6659
|
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' }, (
|
|
6660
|
+
}), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style) })
|
|
6634
6661
|
: null
|
|
6635
6662
|
].filter(Boolean)
|
|
6636
6663
|
};
|
|
@@ -6870,12 +6897,14 @@
|
|
|
6870
6897
|
height: (_d, ctx) => getMetrics(ctx).groupHeight
|
|
6871
6898
|
},
|
|
6872
6899
|
children: [
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6900
|
+
shouldShowImageBackground(spec)
|
|
6901
|
+
? {
|
|
6902
|
+
type: 'rect',
|
|
6903
|
+
name: `storyline-block-image-bg-${index}`,
|
|
6904
|
+
interactive: false,
|
|
6905
|
+
style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: 8, fill: '#ffffff', stroke: themeColor, lineWidth: 2 }, blockStyle)
|
|
6906
|
+
}
|
|
6907
|
+
: null,
|
|
6879
6908
|
hasImage
|
|
6880
6909
|
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_r = spec.image) === null || _r === void 0 ? void 0 : _r.style) })
|
|
6881
6910
|
: null,
|
|
@@ -7079,7 +7108,7 @@
|
|
|
7079
7108
|
};
|
|
7080
7109
|
};
|
|
7081
7110
|
const buildPortraitBlockMark = (spec, block, index) => {
|
|
7082
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
|
7111
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
7083
7112
|
const hasImage = !!block.image;
|
|
7084
7113
|
const hasSubImage = !!block.subImage;
|
|
7085
7114
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
@@ -7130,7 +7159,7 @@
|
|
|
7130
7159
|
}
|
|
7131
7160
|
}
|
|
7132
7161
|
: null,
|
|
7133
|
-
(
|
|
7162
|
+
shouldShowImageBackground(spec)
|
|
7134
7163
|
? {
|
|
7135
7164
|
type: 'rect',
|
|
7136
7165
|
name: `storyline-block-image-bg-${index}`,
|
|
@@ -7139,17 +7168,17 @@
|
|
|
7139
7168
|
}
|
|
7140
7169
|
: null,
|
|
7141
7170
|
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: 'cover', imagePosition: 'center' }, (
|
|
7171
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_l = spec.image) === null || _l === void 0 ? void 0 : _l.style) })
|
|
7143
7172
|
: null,
|
|
7144
7173
|
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' }, (
|
|
7174
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, fontSize: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_m = spec.title) === null || _m === void 0 ? void 0 : _m.style) })
|
|
7146
7175
|
: null,
|
|
7147
7176
|
contentText.length
|
|
7148
7177
|
? 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
7178
|
fontSize: PORTRAIT_CONTENT_FONT_SIZE,
|
|
7150
7179
|
lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT,
|
|
7151
7180
|
fill: '#596173'
|
|
7152
|
-
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (
|
|
7181
|
+
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style) })
|
|
7153
7182
|
: null
|
|
7154
7183
|
].filter(Boolean)
|
|
7155
7184
|
};
|
|
@@ -7431,7 +7460,7 @@
|
|
|
7431
7460
|
};
|
|
7432
7461
|
};
|
|
7433
7462
|
const buildArcBlockMark = (spec, block, index) => {
|
|
7434
|
-
var _a, _b, _c, _e
|
|
7463
|
+
var _a, _b, _c, _e;
|
|
7435
7464
|
const hasImage = !!block.image;
|
|
7436
7465
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7437
7466
|
const themeColor = getThemeColor(spec);
|
|
@@ -7482,7 +7511,7 @@
|
|
|
7482
7511
|
lineWidth: 2
|
|
7483
7512
|
}
|
|
7484
7513
|
},
|
|
7485
|
-
(
|
|
7514
|
+
shouldShowImageBackground(spec)
|
|
7486
7515
|
? {
|
|
7487
7516
|
type: 'symbol',
|
|
7488
7517
|
name: `storyline-block-image-halo-${index}`,
|
|
@@ -7500,7 +7529,7 @@
|
|
|
7500
7529
|
}
|
|
7501
7530
|
: null,
|
|
7502
7531
|
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' }, (
|
|
7532
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 5 }, spec.title), { style: Object.assign({ x: metrics.textBox.x, y: metrics.textBox.y, text: block.title, maxLineWidth: metrics.textBox.width, fontSize: metrics.titleFontSize, lineHeight: metrics.titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: metrics.textAlign, textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7504
7533
|
: null,
|
|
7505
7534
|
contentText.length
|
|
7506
7535
|
? 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 +7537,7 @@
|
|
|
7508
7537
|
lineHeight: metrics.contentLineHeight,
|
|
7509
7538
|
fill: '#596173',
|
|
7510
7539
|
align: metrics.textAlign
|
|
7511
|
-
}), textAlign: metrics.textAlign, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (
|
|
7540
|
+
}), textAlign: metrics.textAlign, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7512
7541
|
: null
|
|
7513
7542
|
].filter(Boolean)
|
|
7514
7543
|
};
|
|
@@ -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: {
|
|
@@ -7752,7 +7781,7 @@
|
|
|
7752
7781
|
}
|
|
7753
7782
|
: null,
|
|
7754
7783
|
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: 'cover', imagePosition: 'center' }, (
|
|
7784
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
|
|
7756
7785
|
: {
|
|
7757
7786
|
type: 'rect',
|
|
7758
7787
|
name: `storyline-block-image-bg-${index}`,
|
|
@@ -7781,7 +7810,7 @@
|
|
|
7781
7810
|
return 'center';
|
|
7782
7811
|
}
|
|
7783
7812
|
return m.onLeft ? 'right' : 'left';
|
|
7784
|
-
}, textBaseline: 'top' }, (
|
|
7813
|
+
}, textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7785
7814
|
: null,
|
|
7786
7815
|
contentText.length
|
|
7787
7816
|
? 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 +7825,7 @@
|
|
|
7796
7825
|
return 'center';
|
|
7797
7826
|
}
|
|
7798
7827
|
return m.onLeft ? 'right' : 'left';
|
|
7799
|
-
}, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#1f2430' }, (
|
|
7828
|
+
}, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#1f2430' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7800
7829
|
: null
|
|
7801
7830
|
].filter(Boolean)
|
|
7802
7831
|
};
|
|
@@ -7935,7 +7964,7 @@
|
|
|
7935
7964
|
};
|
|
7936
7965
|
};
|
|
7937
7966
|
const buildLadderBlockMark = (spec, block, index) => {
|
|
7938
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
7967
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
7939
7968
|
const hasImage = !!block.image;
|
|
7940
7969
|
const onLeft = isOnLeft(index);
|
|
7941
7970
|
const align = onLeft ? 'right' : 'left';
|
|
@@ -7943,6 +7972,8 @@
|
|
|
7943
7972
|
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : LADDER_TITLE_FONT_SIZE);
|
|
7944
7973
|
const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.round(titleFontSize * (LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE)));
|
|
7945
7974
|
const showBackground = ((_h = spec.block) === null || _h === void 0 ? void 0 : _h.showBackground) === true;
|
|
7975
|
+
const showImageBackground = shouldShowImageBackground(spec);
|
|
7976
|
+
const themeColor = getThemeColor(spec);
|
|
7946
7977
|
const getTitleX = (ctx) => {
|
|
7947
7978
|
const m = getLadderBlockMetrics(spec, ctx, index);
|
|
7948
7979
|
return align === 'right' ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
@@ -7967,18 +7998,26 @@
|
|
|
7967
7998
|
style: Object.assign({ x: 0, y: 0, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_k = spec.block) === null || _k === void 0 ? void 0 : _k.style)
|
|
7968
7999
|
}
|
|
7969
8000
|
: null,
|
|
8001
|
+
showImageBackground
|
|
8002
|
+
? {
|
|
8003
|
+
type: 'rect',
|
|
8004
|
+
name: `storyline-block-image-bg-${index}`,
|
|
8005
|
+
interactive: false,
|
|
8006
|
+
style: Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8, fill: '#ffffff', stroke: themeColor, lineWidth: 2 }, (_l = spec.block) === null || _l === void 0 ? void 0 : _l.style)
|
|
8007
|
+
}
|
|
8008
|
+
: null,
|
|
7970
8009
|
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 }, (
|
|
8010
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_m = spec.image) === null || _m === void 0 ? void 0 : _m.style) })
|
|
7972
8011
|
: null,
|
|
7973
8012
|
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' }, (
|
|
8013
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, fontSize: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textBaseline: 'top' }, (_o = spec.title) === null || _o === void 0 ? void 0 : _o.style), { textAlign: align }) })
|
|
7975
8014
|
: null,
|
|
7976
8015
|
contentText.length
|
|
7977
8016
|
? 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
8017
|
fontSize: LADDER_CONTENT_FONT_SIZE,
|
|
7979
8018
|
lineHeight: LADDER_CONTENT_LINE_HEIGHT,
|
|
7980
8019
|
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' }, (
|
|
8020
|
+
}), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_p = spec.content) === null || _p === void 0 ? void 0 : _p.style), { textAlign: align }) })
|
|
7982
8021
|
: null
|
|
7983
8022
|
].filter(Boolean)
|
|
7984
8023
|
};
|