@bino-bi/bn-template-engine 1.0.0-next.29 → 1.0.0-next.30
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/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/{p-69dfa165.entry.js → p-132ad556.entry.js} +1 -1
- package/dist/bn-template-engine/{p-5e66d1d0.entry.js → p-17d71782.entry.js} +1 -1
- package/dist/bn-template-engine/{p-f10950e8.entry.js → p-40ba7f43.entry.js} +1 -1
- package/dist/bn-template-engine/p-467871f3.entry.js +1 -0
- package/dist/bn-template-engine/p-64803a42.entry.js +1 -0
- package/dist/bn-template-engine/p-B8AjeKja.js +1 -0
- package/dist/bn-template-engine/p-CrT83eO4.js +1 -0
- package/dist/bn-template-engine/p-D_DzKxRV.js +1 -0
- package/dist/bn-template-engine/p-Z2rUaSh_.js +1 -0
- package/dist/bn-template-engine/{p-12c8c444.entry.js → p-c41c0a1b.entry.js} +1 -1
- package/dist/bn-template-engine/p-yc69rwuH.js +1 -0
- package/dist/cjs/{bn-asset_28.cjs.entry.js → bn-annotation-layer_30.cjs.entry.js} +1200 -233
- package/dist/cjs/bn-grid.cjs.entry.js +4 -4
- package/dist/cjs/bn-image.cjs.entry.js +3 -3
- package/dist/cjs/bn-internationalization.cjs.entry.js +3 -3
- package/dist/cjs/bn-ruleset.cjs.entry.js +3 -3
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +10 -10
- package/dist/cjs/{diagnostics-DMmUPOsm.js → diagnostics-C4Ggts3w.js} +49 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{withBodyObserver-CrSp_FfF.js → withBodyObserver-BK4idxqG.js} +1 -1
- package/dist/cjs/{withHasError-DpogV-4f.js → withHasError-CqvcS23z.js} +513 -507
- package/dist/cjs/{withStyled-TQ67jCAV.js → withStyled-70D4Isgt.js} +3 -2
- package/dist/cjs/{sanitizeHtml-Cr0jVSJ_.js → withTranslation-C6Pye2CM.js} +98 -98
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.css +24 -0
- package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +430 -0
- package/dist/collection/components/bn-annotation-layer/utils/marks.js +161 -0
- package/dist/collection/components/bn-annotation-layer/utils/matchPoint.js +25 -0
- package/dist/collection/components/bn-annotation-list/bn-annotation-list.css +46 -0
- package/dist/collection/components/bn-annotation-list/bn-annotation-list.js +112 -0
- package/dist/collection/components/bn-asset/bn-asset.js +1 -1
- package/dist/collection/components/bn-body/bn-body.js +1 -1
- package/dist/collection/components/bn-card/bn-card.js +1 -1
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +1 -1
- package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +29 -21
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +1 -1
- package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +18 -9
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +1 -1
- package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +21 -13
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +1 -1
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +26 -9
- package/dist/collection/components/bn-chart-structure/utils/elements/Bar.js +5 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +11 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/Marker.js +5 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +4 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +6 -2
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +28 -2
- package/dist/collection/components/bn-chart-time/utils/elements/Column.js +5 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +14 -0
- package/dist/collection/components/bn-chart-time/utils/elements/LineSeries.js +12 -9
- package/dist/collection/components/bn-chart-time/utils/elements/Marker.js +5 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +4 -1
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +6 -2
- package/dist/collection/components/bn-component-style/bn-component-style.js +1 -1
- package/dist/collection/components/bn-context/bn-context.js +2 -2
- package/dist/collection/components/bn-dataset/bn-dataset.js +1 -1
- package/dist/collection/components/bn-datasource/bn-datasource.js +1 -1
- package/dist/collection/components/bn-footer/bn-footer.js +1 -1
- package/dist/collection/components/bn-grid/bn-grid.js +1 -1
- package/dist/collection/components/bn-image/bn-image.js +1 -1
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +1 -1
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +1 -1
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +1 -1
- package/dist/collection/components/bn-message/bn-message.js +1 -1
- package/dist/collection/components/bn-page/bn-page.js +1 -1
- package/dist/collection/components/bn-ruleset/bn-ruleset.js +1 -1
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +1 -1
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +16 -3
- package/dist/collection/components/bn-table/bn-table.js +1 -1
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +26 -1
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +3 -1
- package/dist/collection/components/bn-text/bn-text.js +1 -1
- package/dist/collection/components/bn-title/bn-title-renderer/bn-title-renderer.js +1 -1
- package/dist/collection/components/bn-title/bn-title.js +1 -1
- package/dist/collection/stores/componentStyles.js +4 -0
- package/dist/collection/stores/createScopedStores.js +3 -1
- package/dist/collection/utils/annotations.js +66 -0
- package/dist/collection/utils/layoutState/dataPoint.js +59 -0
- package/dist/collection/utils/layoutState/geometry.js +46 -0
- package/dist/collection/utils/layoutState/index.js +1 -0
- package/dist/collection/utils/layoutState/svgChartElements.js +113 -11
- package/dist/collection/utils/withComponentStyle.js +2 -1
- package/dist/collection/utils/xy/pointKey.js +10 -0
- package/dist/components/bn-annotation-layer.d.ts +11 -0
- package/dist/components/bn-annotation-layer.js +1 -0
- package/dist/components/bn-annotation-list.d.ts +11 -0
- package/dist/components/bn-annotation-list.js +1 -0
- package/dist/components/bn-asset.js +1 -1
- package/dist/components/bn-body.js +1 -1
- package/dist/components/bn-card.js +1 -1
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet-renderer.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-renderer.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-message.js +1 -1
- package/dist/components/bn-page.js +1 -1
- package/dist/components/bn-ruleset.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title-renderer.js +1 -1
- package/dist/components/bn-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/p-B1nL0yOa.js +1 -0
- package/dist/components/p-B7uwck1J.js +1 -0
- package/dist/components/{p-Dd6b8E_1.js → p-BDS_jiow.js} +1 -1
- package/dist/components/p-BIIDTtcR.js +1 -0
- package/dist/components/{p-DCja-Yov.js → p-BQMKgvEC.js} +1 -1
- package/dist/components/{p-DynTmVfI.js → p-BSV_vyqs.js} +1 -1
- package/dist/components/p-BVKLCz2k.js +1 -0
- package/dist/components/{p-BN7PtJVV.js → p-BWBHlztH.js} +1 -1
- package/dist/components/{p-BI5orga2.js → p-BXrPfAvP.js} +1 -1
- package/dist/components/p-Ba9PUiBp.js +1 -0
- package/dist/components/{p-iJCxRAmO.js → p-BpCL2bfw.js} +1 -1
- package/dist/components/p-BpsXOtoW.js +1 -0
- package/dist/components/{p-DcfgLtdU.js → p-Bs-YxJEt.js} +1 -1
- package/dist/components/p-CGI6XIaK.js +1 -0
- package/dist/components/{p-Igh8PJUo.js → p-CMM8vtHW.js} +1 -1
- package/dist/components/p-COqIkH1M.js +1 -0
- package/dist/components/p-CkW23yp2.js +1 -0
- package/dist/components/{p-BgWfMdDE.js → p-CtBM3KFY.js} +1 -1
- package/dist/components/p-CurWSJkH.js +1 -0
- package/dist/components/{p-BhOssNAI.js → p-CxPSvrcF.js} +1 -1
- package/dist/components/{p-B7GzUuM1.js → p-D5-dYgK_.js} +1 -1
- package/dist/components/p-DEHnizot.js +1 -0
- package/dist/components/p-DIyUaSBg.js +1 -0
- package/dist/components/p-DPLcGhVt.js +1 -0
- package/dist/components/p-DUHp_9X-.js +1 -0
- package/dist/components/p-DYG9FH_u.js +1 -0
- package/dist/components/{p-DrN6R99a.js → p-DdGnuNtc.js} +1 -1
- package/dist/components/{p-C3Lz_w4H.js → p-Dlb4ncGF.js} +1 -1
- package/dist/components/p-Dm55bMs2.js +1 -0
- package/dist/components/p-Dq1AzGKX.js +1 -0
- package/dist/components/{p-BZe4T2ta.js → p-DsOaqeTN.js} +1 -1
- package/dist/components/p-Ds_BSK8v.js +1 -0
- package/dist/components/{p--cxUP_so.js → p-LZ9lAY8T.js} +1 -1
- package/dist/components/{p-DJijh10F.js → p-U3zkcEJZ.js} +1 -1
- package/dist/components/p-WzaayhTX.js +1 -0
- package/dist/components/p-X9hpquOX.js +1 -0
- package/dist/components/p-ey23VlID.js +1 -0
- package/dist/components/p-jbp6YiHf.js +1 -0
- package/dist/components/p-oJjMz8JF.js +1 -0
- package/dist/components/{p-CwzAQJSz.js → p-xhiPDAZa.js} +1 -1
- package/dist/components/{p-BcQv74MZ.js → p-xpguaboj.js} +1 -1
- package/dist/esm/{bn-asset_28.entry.js → bn-annotation-layer_30.entry.js} +1080 -115
- package/dist/esm/bn-grid.entry.js +4 -4
- package/dist/esm/bn-image.entry.js +3 -3
- package/dist/esm/bn-internationalization.entry.js +3 -3
- package/dist/esm/bn-ruleset.entry.js +3 -3
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +4 -4
- package/dist/esm/{diagnostics-BaXhpaAg.js → diagnostics-Cyqy1zDT.js} +48 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{withBodyObserver-1IBghfa8.js → withBodyObserver-JcRB9OPQ.js} +1 -1
- package/dist/esm/{withHasError-C8f_AGmT.js → withHasError-l3cMN-oP.js} +915 -909
- package/dist/esm/{withStyled-DS6G7yrL.js → withStyled-DGOiR00Q.js} +3 -2
- package/dist/esm/{sanitizeHtml-BpBu47OE.js → withTranslation-BpO8BC5B.js} +98 -98
- package/dist/schemas/theme.schema.json +21 -0
- package/dist/types/components/bn-annotation-layer/bn-annotation-layer.d.ts +81 -0
- package/dist/types/components/bn-annotation-layer/utils/marks.d.ts +69 -0
- package/dist/types/components/bn-annotation-layer/utils/matchPoint.d.ts +17 -0
- package/dist/types/components/bn-annotation-list/bn-annotation-list.d.ts +35 -0
- package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +2 -0
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +2 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +5 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Marker.d.ts +1 -0
- package/dist/types/components/bn-chart-structure/utils/elements/StackedBar.d.ts +2 -1
- package/dist/types/components/bn-chart-structure/utils/model/DataPoint.d.ts +3 -0
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +2 -0
- package/dist/types/components/bn-chart-time/utils/elements/Label.d.ts +5 -0
- package/dist/types/components/bn-chart-time/utils/elements/Marker.d.ts +1 -0
- package/dist/types/components/bn-chart-time/utils/elements/StackedColumn.d.ts +2 -1
- package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +3 -0
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -0
- package/dist/types/components/bn-table/utils/elements/TableRow.d.ts +3 -0
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +4 -0
- package/dist/types/components.d.ts +174 -0
- package/dist/types/context/context-protocol.d.ts +2 -0
- package/dist/types/stores/componentStyles.d.ts +8 -0
- package/dist/types/stores/createScopedStores.d.ts +1 -0
- package/dist/types/utils/annotations.d.ts +45 -0
- package/dist/types/utils/layoutState/dataPoint.d.ts +13 -0
- package/dist/types/utils/layoutState/geometry.d.ts +12 -0
- package/dist/types/utils/layoutState/index.d.ts +1 -0
- package/dist/types/utils/layoutState/svgChartElements.d.ts +9 -6
- package/dist/types/utils/layoutState/types.d.ts +29 -0
- package/dist/types/utils/xy/pointKey.d.ts +9 -0
- package/package.json +2 -2
- package/readme.md +2 -0
- package/dist/bn-template-engine/p-2cbccbe7.entry.js +0 -1
- package/dist/bn-template-engine/p-Bo7_IopT.js +0 -1
- package/dist/bn-template-engine/p-ByoAF_Qe.js +0 -1
- package/dist/bn-template-engine/p-CsupHyLQ.js +0 -1
- package/dist/bn-template-engine/p-D0qTf1_a.js +0 -1
- package/dist/bn-template-engine/p-b09430b6.entry.js +0 -1
- package/dist/bn-template-engine/p-qcLonXCz.js +0 -1
- package/dist/components/p-BFUNrRAN.js +0 -1
- package/dist/components/p-BN8vBcMD.js +0 -1
- package/dist/components/p-BbS6qL8Z.js +0 -1
- package/dist/components/p-BvuJFY7b.js +0 -1
- package/dist/components/p-CD39zcHF.js +0 -1
- package/dist/components/p-CYurh604.js +0 -1
- package/dist/components/p-CfBqQljd.js +0 -1
- package/dist/components/p-Ci4wYt6s.js +0 -1
- package/dist/components/p-ClvHVwGH.js +0 -1
- package/dist/components/p-Co1dDaxy.js +0 -1
- package/dist/components/p-Cq5MNEMN.js +0 -1
- package/dist/components/p-CtiP8VJ_.js +0 -1
- package/dist/components/p-D413xjVu.js +0 -1
- package/dist/components/p-D4lSYFwX.js +0 -1
- package/dist/components/p-DZ3ub5DV.js +0 -1
- package/dist/components/p-Di57x1j-.js +0 -1
- package/dist/components/p-DtBFwIVs.js +0 -1
- package/dist/components/p-e6lZYVYf.js +0 -1
- package/dist/components/p-g4dh_F-M.js +0 -1
- package/dist/components/p-kGB4WKet.js +0 -1
- package/dist/components/p-pH6_06qq.js +0 -1
- package/dist/components/p-xJ1DeaDY.js +0 -1
|
@@ -1,14 +1,656 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DGis1BzT.js');
|
|
4
|
-
var withHasError = require('./withHasError-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
4
|
+
var withHasError = require('./withHasError-CqvcS23z.js');
|
|
5
|
+
var withStyled = require('./withStyled-70D4Isgt.js');
|
|
6
|
+
var withTranslation = require('./withTranslation-C6Pye2CM.js');
|
|
7
|
+
var withBodyObserver = require('./withBodyObserver-BK4idxqG.js');
|
|
8
|
+
var diagnostics = require('./diagnostics-C4Ggts3w.js');
|
|
8
9
|
var index$1 = require('./index.cjs.js');
|
|
9
|
-
var sanitizeHtml = require('./sanitizeHtml-Cr0jVSJ_.js');
|
|
10
10
|
var queryError = require('./queryError-BZjnIW_w.js');
|
|
11
11
|
|
|
12
|
+
const COLOR_NAME = /^[a-z][a-z0-9-]*$/i;
|
|
13
|
+
/**
|
|
14
|
+
* CSS value of a named colour: `--bn-annotation-color-<name>` when the page
|
|
15
|
+
* sets it, else the colour of that name in the style, else the main colour
|
|
16
|
+
* (`--bn-annotation-color`, else `color` of the style). The name ends up in a
|
|
17
|
+
* style, so only a plain name counts.
|
|
18
|
+
*/
|
|
19
|
+
function annotationColor(name, style) {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
// a style can set the section or its keys to null, and that must not cost the page its marks
|
|
22
|
+
const main = (_a = style === null || style === void 0 ? void 0 : style.color) !== null && _a !== void 0 ? _a : withHasError.SYSTEM_STYLE_DEFAULTS["bn-annotation"].color;
|
|
23
|
+
const colors = (_b = style === null || style === void 0 ? void 0 : style.colors) !== null && _b !== void 0 ? _b : {};
|
|
24
|
+
const base = `var(--bn-annotation-color, ${main})`;
|
|
25
|
+
if (!name || !COLOR_NAME.test(name))
|
|
26
|
+
return base;
|
|
27
|
+
const own = Object.prototype.hasOwnProperty.call(colors, name) ? colors[name] : undefined;
|
|
28
|
+
return `var(--bn-annotation-color-${name}, ${own !== null && own !== void 0 ? own : base})`;
|
|
29
|
+
}
|
|
30
|
+
/** A value of an item as text. Anything else is dropped: an object in a JSX child would be taken for a vnode. */
|
|
31
|
+
const text = (value) => typeof value === "string" || typeof value === "number" ? String(value) : undefined;
|
|
32
|
+
/** The `items` of a layer. `undefined` when it is not a JSON array of objects. */
|
|
33
|
+
function parseLayerItems(json) {
|
|
34
|
+
var _a;
|
|
35
|
+
return (_a = parseItems(json)) === null || _a === void 0 ? void 0 : _a.map((item) => {
|
|
36
|
+
var _a;
|
|
37
|
+
return (Object.assign(Object.assign({}, item), { label: text(item.label), color: text(item.color), target: (_a = text(item.target)) !== null && _a !== void 0 ? _a : "", to: text(item.to) }));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** The `items` of a list. `undefined` when it is not a JSON array of objects. */
|
|
41
|
+
function parseListItems(json) {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = parseItems(json)) === null || _a === void 0 ? void 0 : _a.map((item) => ({
|
|
44
|
+
label: text(item.label),
|
|
45
|
+
title: text(item.title),
|
|
46
|
+
html: text(item.html),
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
function parseItems(json) {
|
|
50
|
+
if (json == null || json.trim() === "")
|
|
51
|
+
return [];
|
|
52
|
+
try {
|
|
53
|
+
const parsed = JSON.parse(json);
|
|
54
|
+
if (Array.isArray(parsed) && parsed.every((item) => item !== null && typeof item === "object")) {
|
|
55
|
+
return parsed;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (_a) {
|
|
59
|
+
// reported by the caller
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const pageKeys = new WeakMap();
|
|
64
|
+
let nextPageKey = 1;
|
|
65
|
+
/** Key of the page an annotation element sits on: a label is unique only within one page. */
|
|
66
|
+
function annotationPageKey(element) {
|
|
67
|
+
const page = element.closest("bn-layout-page");
|
|
68
|
+
if (!page)
|
|
69
|
+
return "";
|
|
70
|
+
let key = pageKeys.get(page);
|
|
71
|
+
if (!key) {
|
|
72
|
+
key = `page-${nextPageKey++}`;
|
|
73
|
+
pageKeys.set(page, key);
|
|
74
|
+
}
|
|
75
|
+
return key;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const centre = (box) => ({ x: box.x + box.width / 2, y: box.y + box.height / 2 });
|
|
79
|
+
/** Where the line from the centre of a box to `towards` leaves the box. */
|
|
80
|
+
function boxEdge(box, towards) {
|
|
81
|
+
const from = centre(box);
|
|
82
|
+
const dx = towards.x - from.x;
|
|
83
|
+
const dy = towards.y - from.y;
|
|
84
|
+
const scale = Math.min(dx === 0 ? Infinity : box.width / 2 / Math.abs(dx), dy === 0 ? Infinity : box.height / 2 / Math.abs(dy));
|
|
85
|
+
if (!Number.isFinite(scale))
|
|
86
|
+
return from;
|
|
87
|
+
return { x: from.x + dx * scale, y: from.y + dy * scale };
|
|
88
|
+
}
|
|
89
|
+
/** Keeps a circle inside the layer: `bn-body` clips what is outside of it. */
|
|
90
|
+
function keepInside(badge, area) {
|
|
91
|
+
if (!area)
|
|
92
|
+
return badge;
|
|
93
|
+
return Object.assign(Object.assign({}, badge), { cx: Math.max(badge.r, Math.min(badge.cx, area.width - badge.r)), cy: Math.max(badge.r, Math.min(badge.cy, area.height - badge.r)) });
|
|
94
|
+
}
|
|
95
|
+
const overlaps = (a, b) => a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height;
|
|
96
|
+
/** The size unit of a mark on a cell: the font of a scaled table or of a thereof row is smaller than the one of the page. */
|
|
97
|
+
const unitOf = (text, em) => (text ? Math.min(em, text.height / 1.3) : em);
|
|
98
|
+
/**
|
|
99
|
+
* A marker must not hide the number it points at: left of the text, else right
|
|
100
|
+
* of it. A dense table has no room for that, so there it gets as small as the
|
|
101
|
+
* wider gap next to the number, and sits in the middle of that gap.
|
|
102
|
+
*/
|
|
103
|
+
function besideText(text, r, unit, options) {
|
|
104
|
+
var _a, _b, _c;
|
|
105
|
+
const gap = 0.25 * unit;
|
|
106
|
+
const y = text.y + text.height / 2;
|
|
107
|
+
const obstacles = (_a = options.obstacles) !== null && _a !== void 0 ? _a : [];
|
|
108
|
+
const isFree = (x) => {
|
|
109
|
+
const circle = { x: x - r, y: y - r, width: 2 * r, height: 2 * r };
|
|
110
|
+
const area = options.area;
|
|
111
|
+
const inside = !area || (circle.x >= 0 && circle.x + circle.width <= area.width);
|
|
112
|
+
return inside && !obstacles.some((box) => overlaps(circle, box));
|
|
113
|
+
};
|
|
114
|
+
const textRight = text.x + text.width;
|
|
115
|
+
const left = text.x - gap - r;
|
|
116
|
+
const right = textRight + gap + r;
|
|
117
|
+
if (isFree(left))
|
|
118
|
+
return { x: left, y, r };
|
|
119
|
+
if (isFree(right))
|
|
120
|
+
return { x: right, y, r };
|
|
121
|
+
// a side without a neighbour on this line has room for the marker, and no more: it must stay at its number
|
|
122
|
+
const reach = 2 * (r + gap);
|
|
123
|
+
const onLine = obstacles.filter((box) => box.y < y && box.y + box.height > y);
|
|
124
|
+
const leftEdge = Math.max(0, text.x - reach, ...onLine.filter((box) => box.x + box.width <= text.x).map((box) => box.x + box.width));
|
|
125
|
+
const rightEdge = Math.min((_c = (_b = options.area) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : Infinity, textRight + reach, ...onLine.filter((box) => box.x >= textRight).map((box) => box.x));
|
|
126
|
+
const leftGap = text.x - leftEdge;
|
|
127
|
+
const rightGap = rightEdge - textRight;
|
|
128
|
+
const wider = Math.max(leftGap, rightGap);
|
|
129
|
+
const x = rightGap >= leftGap ? textRight + rightGap / 2 : text.x - leftGap / 2;
|
|
130
|
+
// the number in the circle must stay readable
|
|
131
|
+
return { x, y, r: Math.min(r, Math.max(wider / 2, 0.3 * unit)) };
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The geometry of one item. On a whole component a marker sits in the top-right
|
|
135
|
+
* corner, and on a table cell next to the number. A frame goes around the text
|
|
136
|
+
* of a cell. It is an oval around a text, and long sides stay straight, so it
|
|
137
|
+
* also fits a long label; a whole component keeps its corners. An arrow between
|
|
138
|
+
* two boxes with the same centre has no direction and gives `undefined`.
|
|
139
|
+
*/
|
|
140
|
+
function buildMark(item, box, toBox, em, options = {}) {
|
|
141
|
+
var _a;
|
|
142
|
+
const { label, color } = item;
|
|
143
|
+
const { whole, area, text } = options;
|
|
144
|
+
// a table row has no text of its own, but the same font
|
|
145
|
+
const isRow = !whole && !text && options.obstacles != null;
|
|
146
|
+
const unit = unitOf(text !== null && text !== void 0 ? text : (isRow ? box : undefined), em);
|
|
147
|
+
if (item.mark === "arrow") {
|
|
148
|
+
if (!toBox)
|
|
149
|
+
return undefined;
|
|
150
|
+
const from = centre(box);
|
|
151
|
+
const to = centre(toBox);
|
|
152
|
+
if (from.x === to.x && from.y === to.y)
|
|
153
|
+
return undefined;
|
|
154
|
+
let start = boxEdge(box, to);
|
|
155
|
+
let end = boxEdge(toBox, from);
|
|
156
|
+
// boxes that overlap: the edges have passed each other, the arrow would point backwards
|
|
157
|
+
if ((end.x - start.x) * (to.x - from.x) + (end.y - start.y) * (to.y - from.y) <= 0) {
|
|
158
|
+
start = from;
|
|
159
|
+
end = to;
|
|
160
|
+
}
|
|
161
|
+
const length = Math.hypot(end.x - start.x, end.y - start.y);
|
|
162
|
+
const headLength = Math.min(0.8 * em, length);
|
|
163
|
+
const ux = (end.x - start.x) / length;
|
|
164
|
+
const uy = (end.y - start.y) / length;
|
|
165
|
+
const baseX = end.x - ux * headLength;
|
|
166
|
+
const baseY = end.y - uy * headLength;
|
|
167
|
+
const halfWidth = 0.35 * em;
|
|
168
|
+
return {
|
|
169
|
+
kind: "arrow",
|
|
170
|
+
color,
|
|
171
|
+
x1: start.x,
|
|
172
|
+
y1: start.y,
|
|
173
|
+
// the line ends in the head: its blunt end must not stick out at the tip
|
|
174
|
+
x2: baseX,
|
|
175
|
+
y2: baseY,
|
|
176
|
+
head: [
|
|
177
|
+
`${end.x},${end.y}`,
|
|
178
|
+
`${baseX - uy * halfWidth},${baseY + ux * halfWidth}`,
|
|
179
|
+
`${baseX + uy * halfWidth},${baseY - ux * halfWidth}`,
|
|
180
|
+
].join(" "),
|
|
181
|
+
badge: label != null ? keepInside({ cx: start.x, cy: start.y, r: 0.65 * em, label }, area) : undefined,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
if (item.mark === "frame") {
|
|
185
|
+
const around = text !== null && text !== void 0 ? text : box;
|
|
186
|
+
const part = (_a = item.point) === null || _a === void 0 ? void 0 : _a.part;
|
|
187
|
+
const oval = !whole && (text != null || part === "label" || part === "total");
|
|
188
|
+
const paddingX = (oval ? 0.45 : 0.2) * unit;
|
|
189
|
+
const paddingY = (oval ? 0.1 : 0.2) * unit;
|
|
190
|
+
// a single digit gets a circle and not a narrow upright oval
|
|
191
|
+
const width = oval ? Math.max(around.width, around.height) : around.width;
|
|
192
|
+
const midX = around.x + around.width / 2;
|
|
193
|
+
// half of the stroke stays inside the layer too
|
|
194
|
+
const inset = 1;
|
|
195
|
+
const left = Math.max(area ? inset : -Infinity, midX - width / 2 - paddingX);
|
|
196
|
+
const top = Math.max(area ? inset : -Infinity, around.y - paddingY);
|
|
197
|
+
const x2 = Math.min(area ? area.width - inset : Infinity, midX + width / 2 + paddingX);
|
|
198
|
+
const y2 = Math.min(area ? area.height - inset : Infinity, around.y + around.height + paddingY);
|
|
199
|
+
const short = Math.min(x2 - left, y2 - top) / 2;
|
|
200
|
+
const ry = whole ? 0.25 * em : short;
|
|
201
|
+
const rx = whole ? 0.25 * em : oval ? Math.min((x2 - left) / 2, 1.6 * short) : short;
|
|
202
|
+
// the number sits on the outline, also where the outline is round; on a tight oval just outside, to not hide the text
|
|
203
|
+
const curve = 1 - Math.SQRT1_2;
|
|
204
|
+
const badgeR = 0.65 * unit;
|
|
205
|
+
const outside = oval ? 0.6 * badgeR : 0;
|
|
206
|
+
return {
|
|
207
|
+
kind: "frame",
|
|
208
|
+
color,
|
|
209
|
+
x: left,
|
|
210
|
+
y: top,
|
|
211
|
+
width: x2 - left,
|
|
212
|
+
height: y2 - top,
|
|
213
|
+
rx,
|
|
214
|
+
ry,
|
|
215
|
+
badge: label != null
|
|
216
|
+
? keepInside({ cx: x2 - rx * curve + outside, cy: top + ry * curve - outside, r: badgeR, label }, area)
|
|
217
|
+
: undefined,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
// without a number the circle is only a dot
|
|
221
|
+
if (text && !whole) {
|
|
222
|
+
const beside = besideText(text, (label == null ? 0.4 : 0.65) * unit, unit, options);
|
|
223
|
+
return { kind: "marker", color, badge: keepInside({ cx: beside.x, cy: beside.y, r: beside.r, label }, area) };
|
|
224
|
+
}
|
|
225
|
+
const size = (label == null ? 0.4 : 0.75) * unit;
|
|
226
|
+
const r = isRow ? Math.min(size, box.height / 2) : size;
|
|
227
|
+
const at = whole ? { x: box.x + box.width - r, y: box.y + r } : centre(box);
|
|
228
|
+
if (isRow) {
|
|
229
|
+
// the middle of a row is free in a wide table. In a narrow one it is a number: then next to that number
|
|
230
|
+
const circle = { x: at.x - r, y: at.y - r, width: 2 * r, height: 2 * r };
|
|
231
|
+
const number = options.obstacles.find((other) => overlaps(circle, other));
|
|
232
|
+
if (number) {
|
|
233
|
+
const beside = besideText(number, r, unit, options);
|
|
234
|
+
return { kind: "marker", color, badge: keepInside({ cx: beside.x, cy: beside.y, r: beside.r, label }, area) };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return { kind: "marker", color, badge: keepInside({ cx: at.x, cy: at.y, r, label }, area) };
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const KEY_FIELDS = ["rowGroup", "category", "subCategory", "date", "scenario", "row"];
|
|
241
|
+
/** A point without a field, or no point at all, means the component as a whole. */
|
|
242
|
+
function isWholeComponent(point) {
|
|
243
|
+
return !point || (KEY_FIELDS.every((field) => point[field] == null) && point.part == null);
|
|
244
|
+
}
|
|
245
|
+
function matches(found, point) {
|
|
246
|
+
var _a;
|
|
247
|
+
if (!found || found.part !== ((_a = point.part) !== null && _a !== void 0 ? _a : "element"))
|
|
248
|
+
return false;
|
|
249
|
+
return KEY_FIELDS.every((field) => point[field] == null || String(point[field]) === found[field]);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The rendered boxes of a point. A table point without a scenario means the
|
|
253
|
+
* whole row, so it is looked up in the rows and not in the cells. A thereof row
|
|
254
|
+
* of a table repeats the key of its parent and adds a `subCategory`, so a point
|
|
255
|
+
* without one means the parent: otherwise the parent could never be named.
|
|
256
|
+
*/
|
|
257
|
+
function matchPoint(state, point) {
|
|
258
|
+
var _a;
|
|
259
|
+
const candidates = state.table && point.scenario == null ? state.table.rows : ((_a = state.elements) !== null && _a !== void 0 ? _a : []);
|
|
260
|
+
const noThereof = state.table != null && point.subCategory == null;
|
|
261
|
+
return candidates
|
|
262
|
+
.filter((candidate) => matches(candidate.point, point) && !(noThereof && candidate.point.subCategory != null))
|
|
263
|
+
.map(({ rect, content, contentSign }) => ({ rect, content, contentSign }));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const bnAnnotationLayerCss = () => `:host{position:absolute;inset:0;z-index:1;display:block;pointer-events:none;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px)}svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}.badge-text{fill:#ffffff;font-weight:bold;text-anchor:middle;dominant-baseline:central}`;
|
|
267
|
+
|
|
268
|
+
/** A chart can draw its data late: a point without a match is reported when the page has been quiet for two checks. */
|
|
269
|
+
const REPORT_CHECK_MS = 200;
|
|
270
|
+
const REPORT_MAX_CHECKS = 50;
|
|
271
|
+
/** The centre of a screen box lies inside an element. An element without a size has no layout to judge by. */
|
|
272
|
+
function isVisibleIn(box, element) {
|
|
273
|
+
const area = element.getBoundingClientRect();
|
|
274
|
+
if (area.width === 0 || area.height === 0)
|
|
275
|
+
return true;
|
|
276
|
+
const x = box.x + box.width / 2;
|
|
277
|
+
const y = box.y + box.height / 2;
|
|
278
|
+
return x >= area.left && x <= area.right && y >= area.top && y <= area.bottom;
|
|
279
|
+
}
|
|
280
|
+
/** Elements in a slot that show nothing, so they are not what a mark points at. */
|
|
281
|
+
const CONFIG_ELEMENTS = new Set([
|
|
282
|
+
"bn-asset",
|
|
283
|
+
"bn-component-style",
|
|
284
|
+
"bn-dataset",
|
|
285
|
+
"bn-datasource",
|
|
286
|
+
"bn-internationalization",
|
|
287
|
+
"bn-ruleset",
|
|
288
|
+
"bn-scaling-group",
|
|
289
|
+
]);
|
|
290
|
+
/** The box has a size, and part of it lies inside an element. An element without a size has no layout to judge by. */
|
|
291
|
+
function reachesInto(box, element) {
|
|
292
|
+
const area = element.getBoundingClientRect();
|
|
293
|
+
if (area.width === 0 || area.height === 0)
|
|
294
|
+
return true;
|
|
295
|
+
return box.x < area.right && box.x + box.width > area.left && box.y < area.bottom && box.y + box.height > area.top;
|
|
296
|
+
}
|
|
297
|
+
/** A whole component cannot be seen: it has no box, or it lies outside of a cell around it or of the layer. */
|
|
298
|
+
function isHidden(box, slot, layer) {
|
|
299
|
+
if (box.width === 0 || box.height === 0 || !reachesInto(box, layer))
|
|
300
|
+
return true;
|
|
301
|
+
for (let cell = slot; cell && cell.localName !== "bn-layout-page"; cell = cell.parentElement) {
|
|
302
|
+
if (!reachesInto(box, cell))
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
/** The slot of a target can grow with its content: what clips it is then a cell further out, in a fit-to-content card. */
|
|
308
|
+
function isCutOff(box, slot) {
|
|
309
|
+
for (let cell = slot; cell && cell.localName !== "bn-layout-page"; cell = cell.parentElement) {
|
|
310
|
+
if (!isVisibleIn(box, cell))
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
const AnnotationLayer = class {
|
|
316
|
+
constructor(hostRef) {
|
|
317
|
+
index.registerInstance(this, hostRef);
|
|
318
|
+
this.marks = [];
|
|
319
|
+
this.pageKey = "";
|
|
320
|
+
this.parsedItems = [];
|
|
321
|
+
this.scheduled = false;
|
|
322
|
+
this.run = 0;
|
|
323
|
+
this.observed = new WeakSet();
|
|
324
|
+
this.reported = new Set();
|
|
325
|
+
/**
|
|
326
|
+
* Places the marks after the next paint. The layer counts as working until
|
|
327
|
+
* then, so a printer does not print a page with marks of an older layout.
|
|
328
|
+
*/
|
|
329
|
+
this.schedule = () => {
|
|
330
|
+
if (this.scheduled)
|
|
331
|
+
return;
|
|
332
|
+
this.scheduled = true;
|
|
333
|
+
this.holdStatus(new Promise((resolve) => {
|
|
334
|
+
requestAnimationFrame(() => {
|
|
335
|
+
this.scheduled = false;
|
|
336
|
+
this.place()
|
|
337
|
+
.catch((e) => console.error("bn-annotation-layer: placing the marks failed", e))
|
|
338
|
+
.finally(resolve);
|
|
339
|
+
});
|
|
340
|
+
}));
|
|
341
|
+
};
|
|
342
|
+
this.holdStatus = withHasError.withComponentStatus(this);
|
|
343
|
+
this.errors = withHasError.withHasError(this);
|
|
344
|
+
this.componentStyle = withStyled.withComponentStyle(this);
|
|
345
|
+
}
|
|
346
|
+
connectedCallback() {
|
|
347
|
+
var _a;
|
|
348
|
+
this.stores = withHasError.getStores(this.element);
|
|
349
|
+
this.pageKey = annotationPageKey(this.element);
|
|
350
|
+
this.observed = new WeakSet();
|
|
351
|
+
this.resizeObserver = new ResizeObserver(this.schedule);
|
|
352
|
+
this.mutationObserver = new MutationObserver(this.schedule);
|
|
353
|
+
this.observeSize(this.element);
|
|
354
|
+
// a target can be added or moved later, in a morphing preview for example
|
|
355
|
+
const page = this.element.closest("bn-layout-page");
|
|
356
|
+
if (page) {
|
|
357
|
+
this.mutationObserver.observe(page, {
|
|
358
|
+
childList: true,
|
|
359
|
+
subtree: true,
|
|
360
|
+
attributes: true,
|
|
361
|
+
attributeFilter: ["slot", "data-bino-annotation-target"],
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
(_a = document.fonts) === null || _a === void 0 ? void 0 : _a.addEventListener("loadingdone", this.schedule);
|
|
365
|
+
}
|
|
366
|
+
disconnectedCallback() {
|
|
367
|
+
var _a, _b, _c, _d;
|
|
368
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
369
|
+
(_b = this.mutationObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
370
|
+
(_c = document.fonts) === null || _c === void 0 ? void 0 : _c.removeEventListener("loadingdone", this.schedule);
|
|
371
|
+
this.run++;
|
|
372
|
+
if ((_d = this.stores) === null || _d === void 0 ? void 0 : _d.annotationsUnplaced.state[this.pageKey]) {
|
|
373
|
+
this.stores.annotationsUnplaced.set(this.pageKey, undefined);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
componentWillLoad() {
|
|
377
|
+
this.parseItems();
|
|
378
|
+
}
|
|
379
|
+
componentDidLoad() {
|
|
380
|
+
this.schedule();
|
|
381
|
+
}
|
|
382
|
+
onItemsChange() {
|
|
383
|
+
this.parseItems();
|
|
384
|
+
this.schedule();
|
|
385
|
+
}
|
|
386
|
+
parseItems() {
|
|
387
|
+
const items = parseLayerItems(this.items);
|
|
388
|
+
if (items) {
|
|
389
|
+
this.errors.remove("ERR_items");
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
this.errors.addOrReplace({ id: "ERR_items", type: "error", message: "items: not a JSON array of objects." });
|
|
393
|
+
}
|
|
394
|
+
this.parsedItems = items !== null && items !== void 0 ? items : [];
|
|
395
|
+
}
|
|
396
|
+
async place() {
|
|
397
|
+
var _a;
|
|
398
|
+
const run = ++this.run;
|
|
399
|
+
if (!this.element.isConnected || !this.svg)
|
|
400
|
+
return;
|
|
401
|
+
const page = this.element.closest("bn-layout-page");
|
|
402
|
+
const targets = new Map();
|
|
403
|
+
const slots = new Map();
|
|
404
|
+
page === null || page === void 0 ? void 0 : page.querySelectorAll("[data-bino-annotation-target]").forEach((slot) => {
|
|
405
|
+
const visual = Array.from(slot.querySelectorAll("*")).find((el) => el.localName.startsWith("bn-") && !CONFIG_ELEMENTS.has(el.localName));
|
|
406
|
+
const target = visual !== null && visual !== void 0 ? visual : slot;
|
|
407
|
+
targets.set(slot.getAttribute("data-bino-annotation-target"), target);
|
|
408
|
+
slots.set(target, slot);
|
|
409
|
+
});
|
|
410
|
+
// a cell that changes its size can move a target without resizing it, in a card too
|
|
411
|
+
page === null || page === void 0 ? void 0 : page.querySelectorAll("[slot]").forEach((cell) => this.observeSize(cell));
|
|
412
|
+
const needed = new Set(this.parsedItems.flatMap((item) => [item.target, item.to]));
|
|
413
|
+
const visuals = [...targets].filter(([id]) => needed.has(id)).map(([, visual]) => visual);
|
|
414
|
+
await Promise.all(visuals.map((visual) => { var _a; return (_a = visual.componentOnReady) === null || _a === void 0 ? void 0 : _a.call(visual); }));
|
|
415
|
+
if (run !== this.run)
|
|
416
|
+
return;
|
|
417
|
+
visuals.forEach((visual) => this.observe(visual));
|
|
418
|
+
const states = new Map();
|
|
419
|
+
await Promise.all(visuals.map(async (visual) => {
|
|
420
|
+
var _a;
|
|
421
|
+
states.set(visual, await ((_a = visual.getLayoutState) === null || _a === void 0 ? void 0 : _a.call(visual, { detail: "full" }).catch(() => undefined)));
|
|
422
|
+
}));
|
|
423
|
+
if (run !== this.run)
|
|
424
|
+
return;
|
|
425
|
+
const anchorOf = (id, point) => {
|
|
426
|
+
var _a;
|
|
427
|
+
const visual = id != null ? targets.get(id) : undefined;
|
|
428
|
+
if (!visual)
|
|
429
|
+
return { problem: `no target "${id}" on this page` };
|
|
430
|
+
const host = visual.getBoundingClientRect();
|
|
431
|
+
if (isWholeComponent(point)) {
|
|
432
|
+
const box = { x: host.left, y: host.top, width: host.width, height: host.height };
|
|
433
|
+
if (isHidden(box, slots.get(visual), this.element))
|
|
434
|
+
return { problem: `"${id}" cannot be seen` };
|
|
435
|
+
return { box, whole: true };
|
|
436
|
+
}
|
|
437
|
+
const state = states.get(visual);
|
|
438
|
+
const found = state ? matchPoint(state, point) : [];
|
|
439
|
+
if (found.length !== 1) {
|
|
440
|
+
return { problem: `${found.length} elements match the point ${JSON.stringify(point)} in "${id}"` };
|
|
441
|
+
}
|
|
442
|
+
const onScreen = ({ component: { x, y, width, height } }) => ({
|
|
443
|
+
x: host.left + x,
|
|
444
|
+
y: host.top + y,
|
|
445
|
+
width,
|
|
446
|
+
height,
|
|
447
|
+
});
|
|
448
|
+
const box = onScreen(found[0].rect);
|
|
449
|
+
// measuring ignores clipping: a row cut off by its cell would get its mark on the next component
|
|
450
|
+
if (isCutOff(box, slots.get(visual)) || !isVisibleIn(box, this.element)) {
|
|
451
|
+
return { problem: `the point ${JSON.stringify(point)} in "${id}" is cut off` };
|
|
452
|
+
}
|
|
453
|
+
const content = found[0].content;
|
|
454
|
+
if (!state.table)
|
|
455
|
+
return { box, whole: false };
|
|
456
|
+
const cells = ((_a = state.elements) !== null && _a !== void 0 ? _a : []).flatMap((element) => element.kind === "cell" && element.content
|
|
457
|
+
? [{ box: onScreen(element.content), sign: element.contentSign }]
|
|
458
|
+
: []);
|
|
459
|
+
return {
|
|
460
|
+
box,
|
|
461
|
+
whole: false,
|
|
462
|
+
text: content && { box: onScreen(content), sign: found[0].contentSign },
|
|
463
|
+
obstacles: cells,
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
const toLocal = this.toLocalSpace();
|
|
467
|
+
// here the text runs along x and a layout px is a px, also on a rotated or scaled page
|
|
468
|
+
const textToLocal = ({ box, sign = 0 }) => {
|
|
469
|
+
const local = toLocal(box);
|
|
470
|
+
return Object.assign(Object.assign({}, local), { x: local.x - sign, width: local.width + sign });
|
|
471
|
+
};
|
|
472
|
+
const em = parseFloat(getComputedStyle(this.svg).fontSize) || 13.3333;
|
|
473
|
+
// the layout size: on a rotated page the screen box has the sides swapped
|
|
474
|
+
const area = { width: this.element.clientWidth, height: this.element.clientHeight };
|
|
475
|
+
const marks = [];
|
|
476
|
+
const problems = [];
|
|
477
|
+
for (const item of this.parsedItems) {
|
|
478
|
+
const from = anchorOf(item.target, item.point);
|
|
479
|
+
const to = item.mark === "arrow" ? anchorOf(item.to, item.toPoint) : undefined;
|
|
480
|
+
const failed = "problem" in from ? from : to && "problem" in to ? to : undefined;
|
|
481
|
+
if (failed) {
|
|
482
|
+
problems.push({ item, problem: failed.problem });
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
const start = from;
|
|
486
|
+
const end = to;
|
|
487
|
+
const mark = buildMark(item, toLocal(start.box), end && toLocal(end.box), em, {
|
|
488
|
+
whole: start.whole,
|
|
489
|
+
area,
|
|
490
|
+
text: start.text && textToLocal(start.text),
|
|
491
|
+
obstacles: (_a = start.obstacles) === null || _a === void 0 ? void 0 : _a.map(textToLocal),
|
|
492
|
+
});
|
|
493
|
+
if (mark) {
|
|
494
|
+
marks.push(mark);
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
problems.push({ item, problem: "an arrow needs two ends at different places" });
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
this.marks = marks;
|
|
501
|
+
this.storeUnplaced(problems.flatMap(({ item }) => (item.label != null ? [item.label] : [])));
|
|
502
|
+
if (problems.length > 0)
|
|
503
|
+
void this.reportWhenQuiet(run, problems);
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Not part of the placement: the register would wait for this layer, and this
|
|
507
|
+
* layer for the register. The checks end within the quiet period the register
|
|
508
|
+
* has before it publishes, so the warning is out before a page counts as ready.
|
|
509
|
+
*/
|
|
510
|
+
async reportWhenQuiet(run, problems) {
|
|
511
|
+
let quiet = 0;
|
|
512
|
+
for (let check = 0; check < REPORT_MAX_CHECKS && quiet < 2; check++) {
|
|
513
|
+
await new Promise((resolve) => window.setTimeout(resolve, REPORT_CHECK_MS));
|
|
514
|
+
if (run !== this.run)
|
|
515
|
+
return;
|
|
516
|
+
quiet = withHasError.ComponentRegister.componentRegisterStatus().running === 0 ? quiet + 1 : 0;
|
|
517
|
+
}
|
|
518
|
+
this.report(problems);
|
|
519
|
+
}
|
|
520
|
+
report(problems) {
|
|
521
|
+
var _a, _b;
|
|
522
|
+
for (const { item, problem } of problems) {
|
|
523
|
+
const line = `bn-annotation-layer: ${(_a = item.mark) !== null && _a !== void 0 ? _a : "marker"} ${(_b = item.label) !== null && _b !== void 0 ? _b : "without a number"} is not drawn: ${problem}.`;
|
|
524
|
+
if (!this.reported.has(line)) {
|
|
525
|
+
this.reported.add(line);
|
|
526
|
+
console.warn(line);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
/** The screen box of an element is axis-aligned on a rotated page too, so its corners map to a box here. */
|
|
531
|
+
toLocalSpace() {
|
|
532
|
+
var _a;
|
|
533
|
+
const matrix = (_a = this.svg.getScreenCTM()) === null || _a === void 0 ? void 0 : _a.inverse();
|
|
534
|
+
return (box) => {
|
|
535
|
+
if (!matrix)
|
|
536
|
+
return box;
|
|
537
|
+
const corners = [
|
|
538
|
+
[box.x, box.y],
|
|
539
|
+
[box.x + box.width, box.y + box.height],
|
|
540
|
+
].map(([x, y]) => new DOMPoint(x, y).matrixTransform(matrix));
|
|
541
|
+
const x = Math.min(corners[0].x, corners[1].x);
|
|
542
|
+
const y = Math.min(corners[0].y, corners[1].y);
|
|
543
|
+
return { x, y, width: Math.abs(corners[1].x - corners[0].x), height: Math.abs(corners[1].y - corners[0].y) };
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
storeUnplaced(labels) {
|
|
547
|
+
var _a, _b;
|
|
548
|
+
const store = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.annotationsUnplaced;
|
|
549
|
+
const current = (_b = store === null || store === void 0 ? void 0 : store.state[this.pageKey]) !== null && _b !== void 0 ? _b : [];
|
|
550
|
+
if (store && JSON.stringify(current) !== JSON.stringify(labels)) {
|
|
551
|
+
store.set(this.pageKey, labels);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
/** A chart redraws inside its shadow roots, where the host and a mutation observer on it see nothing. */
|
|
555
|
+
observe(visual) {
|
|
556
|
+
this.observeSize(visual);
|
|
557
|
+
const walk = (root) => {
|
|
558
|
+
var _a;
|
|
559
|
+
if (!root)
|
|
560
|
+
return;
|
|
561
|
+
if (!this.observed.has(root)) {
|
|
562
|
+
this.observed.add(root);
|
|
563
|
+
// a table patches its cells in place: a bar gets a new width, its number a new x
|
|
564
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(root, {
|
|
565
|
+
childList: true,
|
|
566
|
+
subtree: true,
|
|
567
|
+
characterData: true,
|
|
568
|
+
attributes: true,
|
|
569
|
+
attributeFilter: ["x", "y", "width", "height", "transform", "style", "class"],
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
root.querySelectorAll("*").forEach((el) => walk(el.shadowRoot));
|
|
573
|
+
};
|
|
574
|
+
walk(visual.shadowRoot);
|
|
575
|
+
}
|
|
576
|
+
observeSize(element) {
|
|
577
|
+
var _a;
|
|
578
|
+
if (!this.observed.has(element)) {
|
|
579
|
+
this.observed.add(element);
|
|
580
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(element);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
renderBadge(badge, color) {
|
|
584
|
+
if (!badge)
|
|
585
|
+
return null;
|
|
586
|
+
return (index.h("g", null, index.h("circle", { cx: badge.cx, cy: badge.cy, r: badge.r, style: { fill: color } }), badge.label != null ? (index.h("text", { class: "badge-text", x: badge.cx, y: badge.cy, style: { fontSize: `${badge.r * 1.1}px` } }, badge.label)) : null));
|
|
587
|
+
}
|
|
588
|
+
renderMark(mark) {
|
|
589
|
+
var _a, _b;
|
|
590
|
+
const color = annotationColor(mark.color, this.componentStyle(($) => $["bn-annotation"]));
|
|
591
|
+
if (mark.kind === "marker") {
|
|
592
|
+
return (index.h("g", { class: "mark marker", "data-label": mark.badge.label }, this.renderBadge(mark.badge, color)));
|
|
593
|
+
}
|
|
594
|
+
if (mark.kind === "frame") {
|
|
595
|
+
return (index.h("g", { class: "mark frame", "data-label": (_a = mark.badge) === null || _a === void 0 ? void 0 : _a.label }, index.h("rect", { x: mark.x, y: mark.y, width: mark.width, height: mark.height, rx: mark.rx, ry: mark.ry, style: { fill: "none", stroke: color, strokeWidth: "1.5" } }), this.renderBadge(mark.badge, color)));
|
|
596
|
+
}
|
|
597
|
+
return (index.h("g", { class: "mark arrow", "data-label": (_b = mark.badge) === null || _b === void 0 ? void 0 : _b.label }, index.h("line", { x1: mark.x1, y1: mark.y1, x2: mark.x2, y2: mark.y2, style: { stroke: color, strokeWidth: "1.5" } }), index.h("polygon", { points: mark.head, style: { fill: color } }), this.renderBadge(mark.badge, color)));
|
|
598
|
+
}
|
|
599
|
+
render() {
|
|
600
|
+
return (index.h(index.Host, { key: '05ca564aeeaf190a45cd42020b307891990e04fe' }, index.h("svg", { key: '995c55b16803107766bf2c394d8d799c0de5765d', ref: (el) => (this.svg = el) }, this.marks.map((mark) => this.renderMark(mark)))));
|
|
601
|
+
}
|
|
602
|
+
get element() { return index.getElement(this); }
|
|
603
|
+
static get watchers() { return {
|
|
604
|
+
"items": [{
|
|
605
|
+
"onItemsChange": 0
|
|
606
|
+
}]
|
|
607
|
+
}; }
|
|
608
|
+
};
|
|
609
|
+
AnnotationLayer.style = bnAnnotationLayerCss();
|
|
610
|
+
|
|
611
|
+
const bnAnnotationListCss = () => `:host{display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}ol{margin:0;padding:0;list-style:none}li{display:flex;gap:0.5em;margin-bottom:0.6em;align-items:flex-start}.badge-space{flex:none;width:1.5em;height:1.5em}.badge{flex:none;display:flex;align-items:center;justify-content:center;width:1.5em;height:1.5em;border-radius:50%;color:#ffffff;font-weight:bold;line-height:1}.badge span{font-size:0.825em}.title{font-weight:bold}`;
|
|
612
|
+
|
|
613
|
+
const AnnotationList = class {
|
|
614
|
+
constructor(hostRef) {
|
|
615
|
+
index.registerInstance(this, hostRef);
|
|
616
|
+
this.pageKey = "";
|
|
617
|
+
withHasError.withComponentStatus(this);
|
|
618
|
+
this.errors = withHasError.withHasError(this);
|
|
619
|
+
this.componentStyle = withStyled.withComponentStyle(this);
|
|
620
|
+
}
|
|
621
|
+
connectedCallback() {
|
|
622
|
+
this.stores = withHasError.getStores(this.element);
|
|
623
|
+
this.pageKey = annotationPageKey(this.element);
|
|
624
|
+
this.unsubscribe = this.stores.annotationsUnplaced.on("set", (key) => {
|
|
625
|
+
if (key === this.pageKey)
|
|
626
|
+
index.forceUpdate(this.element);
|
|
627
|
+
});
|
|
628
|
+
// back in the document: Stencil does not render again, and the store or the page may have changed
|
|
629
|
+
index.forceUpdate(this.element);
|
|
630
|
+
}
|
|
631
|
+
disconnectedCallback() {
|
|
632
|
+
var _a;
|
|
633
|
+
(_a = this.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
634
|
+
}
|
|
635
|
+
render() {
|
|
636
|
+
var _a, _b;
|
|
637
|
+
const items = parseListItems(this.items);
|
|
638
|
+
if (items) {
|
|
639
|
+
this.errors.remove("ERR_items");
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
this.errors.addOrReplace({ id: "ERR_items", type: "error", message: "items: not a JSON array of objects." });
|
|
643
|
+
}
|
|
644
|
+
const color = annotationColor(undefined, this.componentStyle(($) => $["bn-annotation"]));
|
|
645
|
+
const unplaced = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.annotationsUnplaced.state[this.pageKey]) !== null && _b !== void 0 ? _b : [];
|
|
646
|
+
return (index.h(index.Host, { key: '69a1cb7ec4623dd722328638b93fa2ac05775dcf' }, index.h("ol", { key: 'cc7925db54a9015cd774242487967e25d0eb1dc0' }, (items !== null && items !== void 0 ? items : []).map((item) => (index.h("li", null, item.label != null && !unplaced.includes(item.label) ? (index.h("div", { class: "badge", style: { background: color } }, index.h("span", null, item.label))) : item.label != null ? (
|
|
647
|
+
// keeps the room of the circle: a list that changes its height can move the marked element, and with it the answer
|
|
648
|
+
index.h("div", { class: "badge-space" })) : null, index.h("div", { class: "text" }, item.title ? index.h("span", { class: "title" }, item.title, " ") : null, item.html ? index.h("span", { innerHTML: withTranslation.sanitizeHtml(item.html) }) : null)))))));
|
|
649
|
+
}
|
|
650
|
+
get element() { return index.getElement(this); }
|
|
651
|
+
};
|
|
652
|
+
AnnotationList.style = bnAnnotationListCss();
|
|
653
|
+
|
|
12
654
|
const bnAssetCss = () => `:host{display:none}`;
|
|
13
655
|
|
|
14
656
|
const Asset = class {
|
|
@@ -35,7 +677,7 @@ const Asset = class {
|
|
|
35
677
|
});
|
|
36
678
|
}
|
|
37
679
|
render() {
|
|
38
|
-
return index.h(index.Host, { key: '
|
|
680
|
+
return index.h(index.Host, { key: '9df81e3697e02833b8cb1fad7ea06a5f446852be' });
|
|
39
681
|
}
|
|
40
682
|
get element() { return index.getElement(this); }
|
|
41
683
|
};
|
|
@@ -62,7 +704,7 @@ const Body = class {
|
|
|
62
704
|
});
|
|
63
705
|
}
|
|
64
706
|
render() {
|
|
65
|
-
return (index.h(index.Host, { key: '
|
|
707
|
+
return (index.h(index.Host, { key: 'fb9799f1ea3fadbf10dbc88aa668cad9d3e63853', style: this.getFontStyles() }, index.h("slot", { key: 'e08e29cdcac02cdd5caab034b0398b78de8951bf' })));
|
|
66
708
|
}
|
|
67
709
|
get element() { return index.getElement(this); }
|
|
68
710
|
};
|
|
@@ -78,7 +720,7 @@ const Card = class {
|
|
|
78
720
|
this.componentStyle = withStyled.withComponentStyle(this);
|
|
79
721
|
}
|
|
80
722
|
render() {
|
|
81
|
-
return (index.h(index.Host, { key: '
|
|
723
|
+
return (index.h(index.Host, { key: '66b35f747b56462ca898e7f475edf580eeb5edc0', style: this.prepareStyle() }, index.h("slot", { key: 'deaa11cb68cffbdba8b6a4508417c32c0a949d6b' })));
|
|
82
724
|
}
|
|
83
725
|
prepareStyle() {
|
|
84
726
|
const pageStyle = {
|
|
@@ -128,7 +770,69 @@ function buildGenericState(el, origins) {
|
|
|
128
770
|
};
|
|
129
771
|
}
|
|
130
772
|
|
|
773
|
+
const KEY_ATTRIBUTES = [
|
|
774
|
+
["rowGroup", "data-bn-row-group"],
|
|
775
|
+
["category", "data-bn-category"],
|
|
776
|
+
["subCategory", "data-bn-sub-category"],
|
|
777
|
+
["date", "data-bn-date"],
|
|
778
|
+
["scenario", "data-bn-scenario"],
|
|
779
|
+
["row", "data-bn-row"],
|
|
780
|
+
];
|
|
781
|
+
const PART_ATTRIBUTE = "data-bn-part";
|
|
782
|
+
/**
|
|
783
|
+
* The `data-bn-*` attributes of a data-point element. Unknown fields stay out.
|
|
784
|
+
* Without `part` the element only carries the keys and cannot be addressed:
|
|
785
|
+
* the group around a bar, or a second shape of one data point.
|
|
786
|
+
*/
|
|
787
|
+
function dataPointAttributes(key, part) {
|
|
788
|
+
const attributes = {};
|
|
789
|
+
if (!key)
|
|
790
|
+
return attributes;
|
|
791
|
+
for (const [field, attribute] of KEY_ATTRIBUTES) {
|
|
792
|
+
const value = key[field];
|
|
793
|
+
if (value != null && value !== "")
|
|
794
|
+
attributes[attribute] = String(value);
|
|
795
|
+
}
|
|
796
|
+
if (part)
|
|
797
|
+
attributes[PART_ATTRIBUTE] = part;
|
|
798
|
+
return attributes;
|
|
799
|
+
}
|
|
800
|
+
/** The key of a rendered element, read back from its attributes. Only an element with a part has one. */
|
|
801
|
+
function readLayoutPoint(element) {
|
|
802
|
+
const part = element.getAttribute(PART_ATTRIBUTE);
|
|
803
|
+
if (!part)
|
|
804
|
+
return undefined;
|
|
805
|
+
const point = { part: part };
|
|
806
|
+
for (const [field, attribute] of KEY_ATTRIBUTES) {
|
|
807
|
+
const value = element.getAttribute(attribute);
|
|
808
|
+
if (value != null)
|
|
809
|
+
point[field] = value;
|
|
810
|
+
}
|
|
811
|
+
return point;
|
|
812
|
+
}
|
|
813
|
+
/** The start of a bucket as `YYYY-MM-DD`, with the time when it is not midnight: a bucket can be shorter than a day. */
|
|
814
|
+
function pointDate(iso) {
|
|
815
|
+
if (!iso)
|
|
816
|
+
return undefined;
|
|
817
|
+
const match = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/.exec(iso);
|
|
818
|
+
if (!match)
|
|
819
|
+
return iso;
|
|
820
|
+
return match[2] === "00:00:00" ? match[1] : `${match[1]}T${match[2]}`;
|
|
821
|
+
}
|
|
822
|
+
/** The dimension a chart's `level` shows, with the value of its row: `category` for `categoryIndex` too. */
|
|
823
|
+
function levelKey(level, value) {
|
|
824
|
+
if (value == null)
|
|
825
|
+
return {};
|
|
826
|
+
if (level.startsWith("rowGroup"))
|
|
827
|
+
return { rowGroup: String(value) };
|
|
828
|
+
if (level.startsWith("subCategory"))
|
|
829
|
+
return { subCategory: String(value) };
|
|
830
|
+
return { category: String(value) };
|
|
831
|
+
}
|
|
832
|
+
|
|
131
833
|
const SCENARIO_GROUP_RE = /^Scenario([1-4])$/;
|
|
834
|
+
const STACK_SEGMENT_RE = /^stacked_(?:col|bar)_(\d+)_seg_\d+$/;
|
|
835
|
+
const STACK_SEGMENTS = 'g[id^="stacked_col_"], g[id^="stacked_bar_"]';
|
|
132
836
|
/** Nearest `#Scenario1..4` ancestor of an element, as "scenario1".."scenario4". */
|
|
133
837
|
function scenarioOf(el, root) {
|
|
134
838
|
var _a;
|
|
@@ -143,9 +847,26 @@ function scenarioOf(el, root) {
|
|
|
143
847
|
}
|
|
144
848
|
/** Data-point index encoded in a group id like "3_RECT" or "3_DATA_Label". */
|
|
145
849
|
function indexOfGroup(id) {
|
|
850
|
+
if (id === "")
|
|
851
|
+
return undefined;
|
|
146
852
|
const parsed = Number(id.split("_")[0]);
|
|
147
853
|
return Number.isFinite(parsed) ? parsed : undefined;
|
|
148
854
|
}
|
|
855
|
+
/** Ordinal a mark without a group of its own carries itself. */
|
|
856
|
+
function ownIndex(el) {
|
|
857
|
+
const index = el.getAttribute("data-bn-index");
|
|
858
|
+
return index === null ? undefined : Number(index);
|
|
859
|
+
}
|
|
860
|
+
/** Index of the data-point group around an element: a marker shape has no id of its own. */
|
|
861
|
+
function indexAround(el, root) {
|
|
862
|
+
var _a;
|
|
863
|
+
for (let current = el; current && current !== root; current = current.parentElement) {
|
|
864
|
+
const index = indexOfGroup((_a = current.id) !== null && _a !== void 0 ? _a : "");
|
|
865
|
+
if (index !== undefined)
|
|
866
|
+
return index;
|
|
867
|
+
}
|
|
868
|
+
return undefined;
|
|
869
|
+
}
|
|
149
870
|
function hasClass$1(el, name) {
|
|
150
871
|
var _a;
|
|
151
872
|
return ((_a = el.getAttribute("class")) !== null && _a !== void 0 ? _a : "").split(/\s+/).includes(name);
|
|
@@ -164,14 +885,18 @@ function insideLabelGroup(el, root) {
|
|
|
164
885
|
/**
|
|
165
886
|
* Walks one time/structure chart segment SVG (`svg#drawCanvas`) and classifies
|
|
166
887
|
* its rendered elements by the chart's stable group-id conventions:
|
|
167
|
-
* `<index>_RECT` bar groups inside `#Scenario1..4`,
|
|
168
|
-
* `<index>_SCENARIO_Label` label groups,
|
|
169
|
-
* and the category/title texts of the
|
|
888
|
+
* `<index>_RECT` bar groups inside `#Scenario1..4`, `stacked_col_<index>_seg_<n>`
|
|
889
|
+
* stack segments, `<index>_DATA_Label` / `<index>_SCENARIO_Label` label groups,
|
|
890
|
+
* the `#axis` group's `.axis-*` line, and the category/title texts of the
|
|
891
|
+
* axis-labels group. Every other element with a `data-bn-part` attribute is a
|
|
892
|
+
* data point too: a value label, a stack total, a line or scenario marker.
|
|
170
893
|
*/
|
|
171
894
|
function collectChartSegmentElements(svgRoot, segment, origins) {
|
|
172
895
|
const elements = [];
|
|
896
|
+
const collected = new Set();
|
|
173
897
|
svgRoot.querySelectorAll('g[id$="_RECT"]').forEach((group, walkIndex) => {
|
|
174
898
|
var _a;
|
|
899
|
+
collected.add(group);
|
|
175
900
|
const bar = {
|
|
176
901
|
kind: "bar",
|
|
177
902
|
id: group.id,
|
|
@@ -179,6 +904,26 @@ function collectChartSegmentElements(svgRoot, segment, origins) {
|
|
|
179
904
|
scenario: scenarioOf(group, svgRoot),
|
|
180
905
|
index: (_a = indexOfGroup(group.id)) !== null && _a !== void 0 ? _a : walkIndex,
|
|
181
906
|
rect: diagnostics.measure(group, origins),
|
|
907
|
+
point: readLayoutPoint(group),
|
|
908
|
+
};
|
|
909
|
+
elements.push(bar);
|
|
910
|
+
});
|
|
911
|
+
svgRoot.querySelectorAll(STACK_SEGMENTS).forEach((group) => {
|
|
912
|
+
var _a, _b, _c;
|
|
913
|
+
const match = STACK_SEGMENT_RE.exec(group.id);
|
|
914
|
+
// a segment without a value keeps its place in the stack and draws nothing
|
|
915
|
+
if (!match || !group.querySelector("rect"))
|
|
916
|
+
return;
|
|
917
|
+
collected.add(group);
|
|
918
|
+
const point = readLayoutPoint(group);
|
|
919
|
+
const bar = {
|
|
920
|
+
kind: "bar",
|
|
921
|
+
id: group.id,
|
|
922
|
+
segment,
|
|
923
|
+
scenario: `stack:${(_c = (_b = (_a = point === null || point === void 0 ? void 0 : point.scenario) !== null && _a !== void 0 ? _a : point === null || point === void 0 ? void 0 : point.subCategory) !== null && _b !== void 0 ? _b : point === null || point === void 0 ? void 0 : point.category) !== null && _c !== void 0 ? _c : ""}`,
|
|
924
|
+
index: Number(match[1]),
|
|
925
|
+
rect: diagnostics.measure(group, origins),
|
|
926
|
+
point,
|
|
182
927
|
};
|
|
183
928
|
elements.push(bar);
|
|
184
929
|
});
|
|
@@ -190,6 +935,7 @@ function collectChartSegmentElements(svgRoot, segment, origins) {
|
|
|
190
935
|
const text = (_b = (_a = group.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : "";
|
|
191
936
|
if (!text)
|
|
192
937
|
return;
|
|
938
|
+
collected.add(group);
|
|
193
939
|
const label = {
|
|
194
940
|
kind: "label",
|
|
195
941
|
id: group.id,
|
|
@@ -198,10 +944,40 @@ function collectChartSegmentElements(svgRoot, segment, origins) {
|
|
|
198
944
|
segment,
|
|
199
945
|
index: (_c = indexOfGroup(group.id)) !== null && _c !== void 0 ? _c : walkIndex,
|
|
200
946
|
rect: diagnostics.measure(group, origins),
|
|
947
|
+
point: readLayoutPoint(group),
|
|
201
948
|
};
|
|
202
949
|
elements.push(label);
|
|
203
950
|
});
|
|
204
951
|
});
|
|
952
|
+
svgRoot.querySelectorAll("[data-bn-part]").forEach((el, walkIndex) => {
|
|
953
|
+
var _a, _b, _c;
|
|
954
|
+
if (collected.has(el))
|
|
955
|
+
return;
|
|
956
|
+
const point = readLayoutPoint(el);
|
|
957
|
+
const index = (_a = ownIndex(el)) !== null && _a !== void 0 ? _a : indexAround(el, svgRoot);
|
|
958
|
+
if (point.part === "element") {
|
|
959
|
+
const mark = {
|
|
960
|
+
kind: "point",
|
|
961
|
+
series: point.scenario,
|
|
962
|
+
index: index !== null && index !== void 0 ? index : walkIndex,
|
|
963
|
+
rect: diagnostics.measure(el, origins),
|
|
964
|
+
point,
|
|
965
|
+
};
|
|
966
|
+
elements.push(mark);
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
const label = {
|
|
970
|
+
kind: "label",
|
|
971
|
+
id: el.id || undefined,
|
|
972
|
+
role: "data",
|
|
973
|
+
text: (_c = (_b = el.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : "",
|
|
974
|
+
segment,
|
|
975
|
+
index,
|
|
976
|
+
rect: diagnostics.measure(el, origins),
|
|
977
|
+
point,
|
|
978
|
+
};
|
|
979
|
+
elements.push(label);
|
|
980
|
+
});
|
|
205
981
|
svgRoot.querySelectorAll('g[id="axis"] line').forEach((line) => {
|
|
206
982
|
var _a;
|
|
207
983
|
const styleClass = ((_a = line.getAttribute("class")) !== null && _a !== void 0 ? _a : "").split(/\s+/).find((cls) => cls.startsWith("axis-"));
|
|
@@ -233,12 +1009,19 @@ function collectChartSegmentElements(svgRoot, segment, origins) {
|
|
|
233
1009
|
});
|
|
234
1010
|
return elements;
|
|
235
1011
|
}
|
|
236
|
-
/** Number of data-point groups in the primary scenario layer (= category/bar count). */
|
|
1012
|
+
/** Number of data-point groups in the primary scenario layer, or of stacks in a stacked chart (= category/bar count). */
|
|
237
1013
|
function countPrimaryDataPoints(svgRoot) {
|
|
238
1014
|
const scenario1 = svgRoot.querySelector('g[id="Scenario1"]');
|
|
239
|
-
if (
|
|
240
|
-
return 0;
|
|
241
|
-
|
|
1015
|
+
if (scenario1) {
|
|
1016
|
+
return Array.from(scenario1.children).filter((child) => { var _a; return /^\d+$/.test((_a = child.id) !== null && _a !== void 0 ? _a : ""); }).length;
|
|
1017
|
+
}
|
|
1018
|
+
const stacks = new Set();
|
|
1019
|
+
svgRoot.querySelectorAll(STACK_SEGMENTS).forEach((group) => {
|
|
1020
|
+
const match = STACK_SEGMENT_RE.exec(group.id);
|
|
1021
|
+
if (match && group.querySelector("rect"))
|
|
1022
|
+
stacks.add(match[1]);
|
|
1023
|
+
});
|
|
1024
|
+
return stacks.size;
|
|
242
1025
|
}
|
|
243
1026
|
/**
|
|
244
1027
|
* Walks a chart facade's inner segment components (one per base/variance
|
|
@@ -277,21 +1060,41 @@ function collectChartFacadeLayout(host, innerTag, segments, origins, detail) {
|
|
|
277
1060
|
}
|
|
278
1061
|
/**
|
|
279
1062
|
* Walks an XY/bullet chart SVG. Its marks carry no ids or classes, so
|
|
280
|
-
* classification is by tag: circles/ellipses become points,
|
|
281
|
-
*
|
|
1063
|
+
* classification is by tag: circles/ellipses become points, keyed rects
|
|
1064
|
+
* (the bullet bars) become bars, texts become data labels. Gridlines and
|
|
1065
|
+
* frame geometry are deliberately skipped.
|
|
282
1066
|
*/
|
|
283
1067
|
function collectXYElements(svgRoot, origins) {
|
|
284
1068
|
const elements = [];
|
|
285
1069
|
svgRoot.querySelectorAll("circle, ellipse").forEach((mark, index) => {
|
|
286
|
-
const point = { kind: "point", index, rect: diagnostics.measure(mark, origins) };
|
|
1070
|
+
const point = { kind: "point", index, rect: diagnostics.measure(mark, origins), point: readLayoutPoint(mark) };
|
|
287
1071
|
elements.push(point);
|
|
288
1072
|
});
|
|
1073
|
+
svgRoot.querySelectorAll('rect[data-bn-part="element"]').forEach((mark, index) => {
|
|
1074
|
+
var _a;
|
|
1075
|
+
const point = readLayoutPoint(mark);
|
|
1076
|
+
const bar = {
|
|
1077
|
+
kind: "bar",
|
|
1078
|
+
segment: "base",
|
|
1079
|
+
scenario: point === null || point === void 0 ? void 0 : point.scenario,
|
|
1080
|
+
index: (_a = ownIndex(mark)) !== null && _a !== void 0 ? _a : index,
|
|
1081
|
+
rect: diagnostics.measure(mark, origins),
|
|
1082
|
+
point,
|
|
1083
|
+
};
|
|
1084
|
+
elements.push(bar);
|
|
1085
|
+
});
|
|
289
1086
|
svgRoot.querySelectorAll("text").forEach((textEl) => {
|
|
290
1087
|
var _a, _b;
|
|
291
1088
|
const text = (_b = (_a = textEl.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : "";
|
|
292
1089
|
if (!text)
|
|
293
1090
|
return;
|
|
294
|
-
const label = {
|
|
1091
|
+
const label = {
|
|
1092
|
+
kind: "label",
|
|
1093
|
+
role: "data",
|
|
1094
|
+
text,
|
|
1095
|
+
rect: diagnostics.measure(textEl, origins),
|
|
1096
|
+
point: readLayoutPoint(textEl),
|
|
1097
|
+
};
|
|
295
1098
|
elements.push(label);
|
|
296
1099
|
});
|
|
297
1100
|
return elements;
|
|
@@ -334,7 +1137,7 @@ function collectXYFacadeState(host, innerTag, title, em, origins, detail) {
|
|
|
334
1137
|
function checkXYOverflow(host, innerTag, errors) {
|
|
335
1138
|
var _a, _b, _c, _d, _e;
|
|
336
1139
|
const errId = "WARN_overflow";
|
|
337
|
-
const parent =
|
|
1140
|
+
const parent = withTranslation.getParentDimensions(host);
|
|
338
1141
|
const svgHeight = parseFloat((_e = (_d = (_c = (_b = (_a = host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(innerTag)) === null || _b === void 0 ? void 0 : _b.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector("svg#drawCanvas")) === null || _d === void 0 ? void 0 : _d.getAttribute("height")) !== null && _e !== void 0 ? _e : "");
|
|
339
1142
|
const contentHeight = Math.max(Number.isNaN(svgHeight) ? 0 : Math.floor(svgHeight), host.scrollHeight || 0);
|
|
340
1143
|
const contentWidth = host.scrollWidth || 0;
|
|
@@ -342,7 +1145,7 @@ function checkXYOverflow(host, innerTag, errors) {
|
|
|
342
1145
|
if (parent.width > 0 && contentWidth > parent.width + 1) {
|
|
343
1146
|
dims.push(`width (${Math.round(contentWidth)}px > ${Math.round(parent.width)}px)`);
|
|
344
1147
|
}
|
|
345
|
-
const clipped =
|
|
1148
|
+
const clipped = withTranslation.getClippedHeight(host, contentHeight);
|
|
346
1149
|
if (clipped > 1) {
|
|
347
1150
|
dims.push(`height (${Math.round(contentHeight)}px > ${Math.round(contentHeight - clipped)}px)`);
|
|
348
1151
|
}
|
|
@@ -490,12 +1293,12 @@ const withRuleSet = (component) => {
|
|
|
490
1293
|
ancestorObserver.disconnect();
|
|
491
1294
|
ancestorObserver = null;
|
|
492
1295
|
}
|
|
493
|
-
if (raw &&
|
|
494
|
-
const ancestors =
|
|
495
|
-
selectedRuleset =
|
|
1296
|
+
if (raw && withTranslation.isInheritedValue(raw)) {
|
|
1297
|
+
const ancestors = withTranslation.findLayoutAncestors(element, raw);
|
|
1298
|
+
selectedRuleset = withTranslation.readInherited(ancestors, "ruleset");
|
|
496
1299
|
if (ancestors.length > 0) {
|
|
497
1300
|
ancestorObserver = new MutationObserver(() => {
|
|
498
|
-
selectedRuleset =
|
|
1301
|
+
selectedRuleset = withTranslation.readInherited(ancestors, "ruleset");
|
|
499
1302
|
updateConfig();
|
|
500
1303
|
index.forceUpdate(component);
|
|
501
1304
|
});
|
|
@@ -971,7 +1774,7 @@ const ChartBubble = class {
|
|
|
971
1774
|
this.errors.remove(errId);
|
|
972
1775
|
return;
|
|
973
1776
|
}
|
|
974
|
-
const { mode, factor } =
|
|
1777
|
+
const { mode, factor } = withTranslation.parseScaling(newValue);
|
|
975
1778
|
if (mode === "factor" && (factor === undefined || factor <= 0)) {
|
|
976
1779
|
this.errors.addOrReplace({
|
|
977
1780
|
id: errId,
|
|
@@ -1059,7 +1862,7 @@ const ChartBubble = class {
|
|
|
1059
1862
|
this.translateForInner = (key, data) => this.t(key, data);
|
|
1060
1863
|
withStyled.withStyled(this);
|
|
1061
1864
|
withHasError.withComponentStatus(this);
|
|
1062
|
-
|
|
1865
|
+
withTranslation.withDataset(this, (name, _data) => {
|
|
1063
1866
|
this.datasetName = (name === null || name === void 0 ? void 0 : name.startsWith("$")) ? name.substring(1) : name || "";
|
|
1064
1867
|
this.dataVersion = this.dataVersion + 1;
|
|
1065
1868
|
}, (_name, meta) => {
|
|
@@ -1069,7 +1872,7 @@ const ChartBubble = class {
|
|
|
1069
1872
|
withScalingGroup(this);
|
|
1070
1873
|
this.componentStyle = withStyled.withComponentStyle(this);
|
|
1071
1874
|
this.ruleSetConfig = withRuleSet(this);
|
|
1072
|
-
this.t =
|
|
1875
|
+
this.t = withTranslation.withTranslation(this).t;
|
|
1073
1876
|
}
|
|
1074
1877
|
componentWillLoad() {
|
|
1075
1878
|
this.validateFilter(this.filter);
|
|
@@ -1089,7 +1892,7 @@ const ChartBubble = class {
|
|
|
1089
1892
|
}
|
|
1090
1893
|
componentDidRender() {
|
|
1091
1894
|
syncEmptyState(this.element, "bn-chart-bubble-renderer");
|
|
1092
|
-
const { mode } =
|
|
1895
|
+
const { mode } = withTranslation.parseScaling(this.scale);
|
|
1093
1896
|
if (mode !== "auto" && mode !== "empty") {
|
|
1094
1897
|
this._autoScaleGuard = false;
|
|
1095
1898
|
this.checkOverflow();
|
|
@@ -1101,7 +1904,7 @@ const ChartBubble = class {
|
|
|
1101
1904
|
return;
|
|
1102
1905
|
}
|
|
1103
1906
|
const host = this.element;
|
|
1104
|
-
const { width: parentWidth } =
|
|
1907
|
+
const { width: parentWidth } = withTranslation.getParentDimensions(host);
|
|
1105
1908
|
if (parentWidth <= 0) {
|
|
1106
1909
|
this.checkOverflow();
|
|
1107
1910
|
return;
|
|
@@ -1147,7 +1950,7 @@ const ChartBubble = class {
|
|
|
1147
1950
|
this.layoutObserver = observeParentResize(this.element, () => {
|
|
1148
1951
|
if (this._autoScaleGuard)
|
|
1149
1952
|
return;
|
|
1150
|
-
const { width } =
|
|
1953
|
+
const { width } = withTranslation.getParentDimensions(this.element);
|
|
1151
1954
|
if (width > 0 && Math.abs(width - this._lastObservedWidth) > 2) {
|
|
1152
1955
|
this._lastObservedWidth = width;
|
|
1153
1956
|
index.forceUpdate(this);
|
|
@@ -1163,7 +1966,7 @@ const ChartBubble = class {
|
|
|
1163
1966
|
requestAnimationFrame(() => {
|
|
1164
1967
|
if (this._autoScaleGuard)
|
|
1165
1968
|
return;
|
|
1166
|
-
const { width } =
|
|
1969
|
+
const { width } = withTranslation.getParentDimensions(this.element);
|
|
1167
1970
|
this._lastObservedWidth = width;
|
|
1168
1971
|
index.forceUpdate(this);
|
|
1169
1972
|
});
|
|
@@ -1508,7 +2311,7 @@ const ChartBubble = class {
|
|
|
1508
2311
|
return collectXYFacadeState(this.element, "bn-chart-bubble-renderer", this.chartTitle || undefined, { fontSizePx, appliedScaleFactor: factor }, origins, detail);
|
|
1509
2312
|
}
|
|
1510
2313
|
getEffectiveScaleFactor() {
|
|
1511
|
-
const { mode, factor } =
|
|
2314
|
+
const { mode, factor } = withTranslation.parseScaling(this.scale);
|
|
1512
2315
|
if (mode === "factor")
|
|
1513
2316
|
return factor;
|
|
1514
2317
|
if (mode === "auto" || mode === "empty")
|
|
@@ -1602,11 +2405,11 @@ const ChartBubble = class {
|
|
|
1602
2405
|
const pointLevel = this.preparePointLevel();
|
|
1603
2406
|
const preparedI18n = this.prepareI18n();
|
|
1604
2407
|
const preparedStyle = this.prepareStyle();
|
|
1605
|
-
const fullParentWidth =
|
|
2408
|
+
const fullParentWidth = withTranslation.getParentDimensions(this.element).width;
|
|
1606
2409
|
return (index.h("bn-chart-bubble-renderer", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.chartTitle, x: x, y: y, size: size, share: share, compareFamily: this.prepareCompareFamily(), labels: this.prepareLabels(), legend: this.prepareLegend(), facet: facet, pointLevel: pointLevel, seriesLevel: this.prepareSeriesLevel(pointLevel), aspect: this.prepareAspect(), limit: this.prepareLimit(), filter: this.filter, sizeAreaPerUnit: this.prepareSizeAreaPerUnit(), styles: preparedStyle, i18n: preparedI18n, containerWidth: fullParentWidth, ruleSetConfig: this.ruleSetConfig(), errors: this.errors, translator: this.translateForInner }));
|
|
1607
2410
|
}
|
|
1608
2411
|
render() {
|
|
1609
|
-
return (index.h(index.Host, { key: '
|
|
2412
|
+
return (index.h(index.Host, { key: '2c420ff611b866ae161e3e4a559f7a5a69d1cd33', style: this.getFontStyles() }, index.h("div", { key: '5ae3d9c267424e71aac4b689bd0fbb757f442e9e', class: "container" }, this.chartTemplate())));
|
|
1610
2413
|
}
|
|
1611
2414
|
get element() { return index.getElement(this); }
|
|
1612
2415
|
static get watchers() { return {
|
|
@@ -8152,6 +8955,17 @@ registerMorphableType([
|
|
|
8152
8955
|
]);
|
|
8153
8956
|
makeMorphable();
|
|
8154
8957
|
|
|
8958
|
+
/** The dimensions of one XY mark: its name, and its series and panel when the chart has them. */
|
|
8959
|
+
function xyPointKey(point, facetKey, config) {
|
|
8960
|
+
const key = { [config.pointLevel]: point.name };
|
|
8961
|
+
if (config.seriesLevel !== null && point.seriesKey !== "")
|
|
8962
|
+
key[config.seriesLevel] = point.seriesKey;
|
|
8963
|
+
if (config.facet !== null && facetKey !== "") {
|
|
8964
|
+
key[config.facet.level === "rowgroup" ? "rowGroup" : "category"] = facetKey;
|
|
8965
|
+
}
|
|
8966
|
+
return key;
|
|
8967
|
+
}
|
|
8968
|
+
|
|
8155
8969
|
var lib = {};
|
|
8156
8970
|
|
|
8157
8971
|
var hasRequiredLib;
|
|
@@ -8605,6 +9419,7 @@ let Label$1 = class Label {
|
|
|
8605
9419
|
this.CSS_CATEGORIES = "categories";
|
|
8606
9420
|
this.isRelativeLabel = false;
|
|
8607
9421
|
this.segmentFillColor = null;
|
|
9422
|
+
this.pointPart = "label";
|
|
8608
9423
|
this.x = xPosition;
|
|
8609
9424
|
this.y = yPosition;
|
|
8610
9425
|
this.value = value;
|
|
@@ -8627,6 +9442,12 @@ let Label$1 = class Label {
|
|
|
8627
9442
|
this.segmentFillColor = color;
|
|
8628
9443
|
return this;
|
|
8629
9444
|
}
|
|
9445
|
+
/** The data row this label belongs to. Written on the label group when the label is visible. */
|
|
9446
|
+
setPoint(key, part = "label") {
|
|
9447
|
+
this.pointKey = key;
|
|
9448
|
+
this.pointPart = part;
|
|
9449
|
+
return this;
|
|
9450
|
+
}
|
|
8630
9451
|
updateGroup(newGroup) {
|
|
8631
9452
|
this.group = newGroup;
|
|
8632
9453
|
return this;
|
|
@@ -8665,6 +9486,9 @@ let Label$1 = class Label {
|
|
|
8665
9486
|
text.addClass("hide");
|
|
8666
9487
|
label.addClass("hide");
|
|
8667
9488
|
}
|
|
9489
|
+
else if (this.pointKey) {
|
|
9490
|
+
label.attr(dataPointAttributes(this.pointKey, this.pointPart));
|
|
9491
|
+
}
|
|
8668
9492
|
return this;
|
|
8669
9493
|
}
|
|
8670
9494
|
isEmpty() {
|
|
@@ -8679,6 +9503,9 @@ let Label$1 = class Label {
|
|
|
8679
9503
|
const label = this.group;
|
|
8680
9504
|
const labelStr = "" + this.value;
|
|
8681
9505
|
this.drawLabel(label, labelStr);
|
|
9506
|
+
if (this.pointKey) {
|
|
9507
|
+
label.attr(dataPointAttributes(this.pointKey, this.pointPart));
|
|
9508
|
+
}
|
|
8682
9509
|
return this;
|
|
8683
9510
|
}
|
|
8684
9511
|
drawLabel(label, labelStr) {
|
|
@@ -9128,7 +9955,7 @@ class XYFrame {
|
|
|
9128
9955
|
drawGrid(group, ticksY, ticksX) {
|
|
9129
9956
|
const stroke = {
|
|
9130
9957
|
color: this.styles.axisStyles.pp.stroke,
|
|
9131
|
-
width:
|
|
9958
|
+
width: withTranslation.strokeWidthPx(this.styles.scaleFactors.gridLineWidth, this.em),
|
|
9132
9959
|
};
|
|
9133
9960
|
for (const tick of ticksY) {
|
|
9134
9961
|
const y = this.yScale.scale(tick);
|
|
@@ -9145,7 +9972,7 @@ class XYFrame {
|
|
|
9145
9972
|
drawRefLines(group, xRef, yRef) {
|
|
9146
9973
|
const stroke = {
|
|
9147
9974
|
color: this.styles.axisStyles.fc.stroke,
|
|
9148
|
-
width:
|
|
9975
|
+
width: withTranslation.strokeWidthPx(this.styles.scaleFactors.refLineWidth, this.em),
|
|
9149
9976
|
};
|
|
9150
9977
|
if (xRef !== undefined) {
|
|
9151
9978
|
const x = this.xScale.scale(xRef);
|
|
@@ -9164,7 +9991,7 @@ class XYFrame {
|
|
|
9164
9991
|
.fill("none")
|
|
9165
9992
|
.stroke({
|
|
9166
9993
|
color: this.styles.axisStyles.ac.stroke,
|
|
9167
|
-
width:
|
|
9994
|
+
width: withTranslation.strokeWidthPx(this.styles.scaleFactors.gridLineWidth, this.em),
|
|
9168
9995
|
});
|
|
9169
9996
|
}
|
|
9170
9997
|
/** Tick labels along the outer edges (no tick marks - template style). */
|
|
@@ -9735,7 +10562,7 @@ class BubbleChart {
|
|
|
9735
10562
|
}
|
|
9736
10563
|
drawText(group, text, x, y, options = {}) {
|
|
9737
10564
|
var _a, _b;
|
|
9738
|
-
group
|
|
10565
|
+
return group
|
|
9739
10566
|
.text(text)
|
|
9740
10567
|
.font({
|
|
9741
10568
|
size: this.styles.fontStyles.size,
|
|
@@ -9999,7 +10826,7 @@ class BubbleChart {
|
|
|
9999
10826
|
.id(`xy-fc-${seriesIndex}`);
|
|
10000
10827
|
}
|
|
10001
10828
|
drawPanel(root, panel, facet, radiusScale, ticksX, ticksY, xDecimals, yDecimals, isOuterLeft, isOuterBottom, panelTitle = "") {
|
|
10002
|
-
var _a, _b, _c, _d;
|
|
10829
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10003
10830
|
const group = root.group();
|
|
10004
10831
|
const em = this.em;
|
|
10005
10832
|
panel.frame.drawBands(group, this.config.x.highlight, this.config.y.highlight);
|
|
@@ -10038,17 +10865,19 @@ class BubbleChart {
|
|
|
10038
10865
|
this.drawValueLabel(compareGroup, ccx, ccy, cr, point.compare.size, compareTreatment.fill);
|
|
10039
10866
|
}
|
|
10040
10867
|
}
|
|
10041
|
-
|
|
10868
|
+
const key = xyPointKey(point, facet.key, this.config);
|
|
10869
|
+
(_e = this.drawBubble(primaryGroup, cx, cy, r, treatment, seriesIndex, hue)) === null || _e === void 0 ? void 0 : _e.attr(dataPointAttributes(key, "element"));
|
|
10042
10870
|
labeler.registerMark(cx, cy, r);
|
|
10043
10871
|
if (point.share !== undefined && r > 0) {
|
|
10044
|
-
|
|
10872
|
+
// no part: the bubble is the one addressable mark of this point
|
|
10873
|
+
(_f = this.drawShareSlice(primaryGroup, cx, cy, r, point.share, withHasError.shade(hue))) === null || _f === void 0 ? void 0 : _f.attr(dataPointAttributes(key));
|
|
10045
10874
|
}
|
|
10046
10875
|
if (this.config.labels.values && point.size !== undefined) {
|
|
10047
10876
|
this.drawValueLabel(primaryGroup, cx, cy, r, point.size, treatment.hatch === true ? "#ffffff" : treatment.fill);
|
|
10048
10877
|
}
|
|
10049
10878
|
marks.push({ point, cx, cy, r, seriesIndex, hue, treatment });
|
|
10050
10879
|
}
|
|
10051
|
-
this.drawNameLabels(group, labeler, marks);
|
|
10880
|
+
this.drawNameLabels(group, labeler, marks, facet.key);
|
|
10052
10881
|
panel.frame.drawTickLabels(group, {
|
|
10053
10882
|
ticksX,
|
|
10054
10883
|
ticksY,
|
|
@@ -10068,9 +10897,9 @@ class BubbleChart {
|
|
|
10068
10897
|
}
|
|
10069
10898
|
drawBubble(group, cx, cy, r, treatment, seriesIndex, hue) {
|
|
10070
10899
|
if (r <= 0) {
|
|
10071
|
-
return;
|
|
10900
|
+
return undefined;
|
|
10072
10901
|
}
|
|
10073
|
-
group
|
|
10902
|
+
return group
|
|
10074
10903
|
.circle(r * 2)
|
|
10075
10904
|
.center(cx, cy)
|
|
10076
10905
|
.fill(this.treatmentFill(treatment, seriesIndex, hue))
|
|
@@ -10079,20 +10908,19 @@ class BubbleChart {
|
|
|
10079
10908
|
/** Pie sector from 12 o'clock, clockwise, angle = share·360° (10E). */
|
|
10080
10909
|
drawShareSlice(group, cx, cy, r, share, fill) {
|
|
10081
10910
|
if (share <= 0) {
|
|
10082
|
-
return;
|
|
10911
|
+
return undefined;
|
|
10083
10912
|
}
|
|
10084
10913
|
if (share >= 1) {
|
|
10085
|
-
group
|
|
10914
|
+
return group
|
|
10086
10915
|
.circle(r * 2)
|
|
10087
10916
|
.center(cx, cy)
|
|
10088
10917
|
.fill(fill);
|
|
10089
|
-
return;
|
|
10090
10918
|
}
|
|
10091
10919
|
const angle = share * 2 * Math.PI;
|
|
10092
10920
|
const endX = cx + r * Math.sin(angle);
|
|
10093
10921
|
const endY = cy - r * Math.cos(angle);
|
|
10094
10922
|
const largeArc = angle > Math.PI ? 1 : 0;
|
|
10095
|
-
group
|
|
10923
|
+
return group
|
|
10096
10924
|
.path(`M ${cx} ${cy} L ${cx} ${cy - r} A ${r} ${r} 0 ${largeArc} 1 ${endX} ${endY} Z`)
|
|
10097
10925
|
.fill(fill)
|
|
10098
10926
|
.stroke("none");
|
|
@@ -10110,23 +10938,28 @@ class BubbleChart {
|
|
|
10110
10938
|
});
|
|
10111
10939
|
}
|
|
10112
10940
|
/** Name labels - bubbles are few, named entities; labels prefer the spot above (10A). */
|
|
10113
|
-
drawNameLabels(group, labeler, marks) {
|
|
10941
|
+
drawNameLabels(group, labeler, marks, facetKey) {
|
|
10114
10942
|
// Rank by size descending: big bubbles claim their labels first.
|
|
10115
10943
|
const ranked = [...marks].sort((a, b) => { var _a, _b; return ((_a = b.point.size) !== null && _a !== void 0 ? _a : 0) - ((_b = a.point.size) !== null && _b !== void 0 ? _b : 0); });
|
|
10116
10944
|
const { selected, unknownNames } = labeler.selectCandidates(ranked, this.config.labels.points, this.config.labels.max, (mark) => mark.point.name);
|
|
10117
10945
|
if (unknownNames.length > 0) {
|
|
10118
10946
|
this.addWarningOnce("xy-label-unknown", { names: unknownNames.join(", ") });
|
|
10119
10947
|
}
|
|
10120
|
-
const
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10948
|
+
const pointOf = new Map();
|
|
10949
|
+
const candidates = selected.map((mark) => {
|
|
10950
|
+
const candidate = {
|
|
10951
|
+
name: mark.point.name,
|
|
10952
|
+
cx: mark.cx,
|
|
10953
|
+
cy: mark.cy,
|
|
10954
|
+
r: mark.r,
|
|
10955
|
+
width: this.textWidth(mark.point.name),
|
|
10956
|
+
height: 1.1 * this.em,
|
|
10957
|
+
};
|
|
10958
|
+
pointOf.set(candidate, mark.point);
|
|
10959
|
+
return candidate;
|
|
10960
|
+
});
|
|
10128
10961
|
for (const placed of labeler.place(candidates)) {
|
|
10129
|
-
this.drawText(group, placed.candidate.name, placed.x, placed.y + 0.9 * placed.candidate.height, {});
|
|
10962
|
+
this.drawText(group, placed.candidate.name, placed.x, placed.y + 0.9 * placed.candidate.height, {}).attr(dataPointAttributes(xyPointKey(pointOf.get(placed.candidate), facetKey, this.config), "label"));
|
|
10130
10963
|
}
|
|
10131
10964
|
}
|
|
10132
10965
|
/** Decimals of the value labels: three significant digits of the largest value (32,0 and 0,0320). */
|
|
@@ -10494,7 +11327,7 @@ const ChartBullet = class {
|
|
|
10494
11327
|
this.errors.remove(errId);
|
|
10495
11328
|
return;
|
|
10496
11329
|
}
|
|
10497
|
-
const { mode, factor } =
|
|
11330
|
+
const { mode, factor } = withTranslation.parseScaling(newValue);
|
|
10498
11331
|
if (mode === "factor" && (factor === undefined || factor <= 0)) {
|
|
10499
11332
|
this.errors.addOrReplace({
|
|
10500
11333
|
id: errId,
|
|
@@ -10589,7 +11422,7 @@ const ChartBullet = class {
|
|
|
10589
11422
|
this.translateForInner = (key, data) => this.t(key, data);
|
|
10590
11423
|
withStyled.withStyled(this);
|
|
10591
11424
|
withHasError.withComponentStatus(this);
|
|
10592
|
-
|
|
11425
|
+
withTranslation.withDataset(this, (name, _data) => {
|
|
10593
11426
|
this.datasetName = (name === null || name === void 0 ? void 0 : name.startsWith("$")) ? name.substring(1) : name || "";
|
|
10594
11427
|
this.dataVersion = this.dataVersion + 1;
|
|
10595
11428
|
}, (_name, meta) => {
|
|
@@ -10598,7 +11431,7 @@ const ChartBullet = class {
|
|
|
10598
11431
|
this.errors = withHasError.withHasError(this);
|
|
10599
11432
|
this.componentStyle = withStyled.withComponentStyle(this);
|
|
10600
11433
|
this.ruleSetConfig = withRuleSet(this);
|
|
10601
|
-
this.t =
|
|
11434
|
+
this.t = withTranslation.withTranslation(this).t;
|
|
10602
11435
|
}
|
|
10603
11436
|
componentWillLoad() {
|
|
10604
11437
|
this.validateFilter(this.filter);
|
|
@@ -10619,7 +11452,7 @@ const ChartBullet = class {
|
|
|
10619
11452
|
// Bullet height is data-driven (rows × rowHeight), so the auto-fit
|
|
10620
11453
|
// scales against the parent HEIGHT - the structure-chart variant, not
|
|
10621
11454
|
// the width-based XY one.
|
|
10622
|
-
const { mode } =
|
|
11455
|
+
const { mode } = withTranslation.parseScaling(this.scale);
|
|
10623
11456
|
if (mode !== "auto" && mode !== "empty") {
|
|
10624
11457
|
this._autoScaleGuard = false;
|
|
10625
11458
|
return;
|
|
@@ -10629,7 +11462,7 @@ const ChartBullet = class {
|
|
|
10629
11462
|
return;
|
|
10630
11463
|
}
|
|
10631
11464
|
const host = this.element;
|
|
10632
|
-
const { height: parentHeight } =
|
|
11465
|
+
const { height: parentHeight } = withTranslation.getParentDimensions(host);
|
|
10633
11466
|
if (parentHeight <= 0)
|
|
10634
11467
|
return;
|
|
10635
11468
|
this._lastScaledParentHeight = parentHeight;
|
|
@@ -10667,7 +11500,7 @@ const ChartBullet = class {
|
|
|
10667
11500
|
this.layoutObserver = observeParentResize(this.element, () => {
|
|
10668
11501
|
if (this._autoScaleGuard)
|
|
10669
11502
|
return;
|
|
10670
|
-
const { height } =
|
|
11503
|
+
const { height } = withTranslation.getParentDimensions(this.element);
|
|
10671
11504
|
if (height > 0 && Math.abs(height - this._lastScaledParentHeight) > 2) {
|
|
10672
11505
|
this._lastScaledParentHeight = height;
|
|
10673
11506
|
index.forceUpdate(this);
|
|
@@ -10679,7 +11512,7 @@ const ChartBullet = class {
|
|
|
10679
11512
|
requestAnimationFrame(() => {
|
|
10680
11513
|
if (this._autoScaleGuard)
|
|
10681
11514
|
return;
|
|
10682
|
-
const { height } =
|
|
11515
|
+
const { height } = withTranslation.getParentDimensions(this.element);
|
|
10683
11516
|
this._lastScaledParentHeight = height;
|
|
10684
11517
|
index.forceUpdate(this);
|
|
10685
11518
|
});
|
|
@@ -10986,7 +11819,7 @@ const ChartBullet = class {
|
|
|
10986
11819
|
return collectXYFacadeState(this.element, "bn-chart-bullet-renderer", this.chartTitle || undefined, { fontSizePx, appliedScaleFactor: factor }, origins, detail);
|
|
10987
11820
|
}
|
|
10988
11821
|
getEffectiveScaleFactor() {
|
|
10989
|
-
const { mode, factor } =
|
|
11822
|
+
const { mode, factor } = withTranslation.parseScaling(this.scale);
|
|
10990
11823
|
if (mode === "factor")
|
|
10991
11824
|
return factor;
|
|
10992
11825
|
if (mode === "auto" || mode === "empty")
|
|
@@ -11055,10 +11888,10 @@ const ChartBullet = class {
|
|
|
11055
11888
|
if (this.hasBlockingErrors() || actual === null) {
|
|
11056
11889
|
return null;
|
|
11057
11890
|
}
|
|
11058
|
-
return (index.h("bn-chart-bullet-renderer", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.chartTitle, actual: actual, target: target, ranges: ranges, normalizeMode: normalize, showVariances: this.prepareShowVariances(), level: this.prepareLevel(), order: this.prepareOrder(), limit: this.prepareLimit(), labels: this.prepareLabels(), filter: this.filter, styles: this.prepareStyle(), i18n: this.prepareI18n(), containerWidth:
|
|
11891
|
+
return (index.h("bn-chart-bullet-renderer", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.chartTitle, actual: actual, target: target, ranges: ranges, normalizeMode: normalize, showVariances: this.prepareShowVariances(), level: this.prepareLevel(), order: this.prepareOrder(), limit: this.prepareLimit(), labels: this.prepareLabels(), filter: this.filter, styles: this.prepareStyle(), i18n: this.prepareI18n(), containerWidth: withTranslation.getParentDimensions(this.element).width, ruleSetConfig: this.ruleSetConfig(), errors: this.errors, translator: this.translateForInner }));
|
|
11059
11892
|
}
|
|
11060
11893
|
render() {
|
|
11061
|
-
return (index.h(index.Host, { key: '
|
|
11894
|
+
return (index.h(index.Host, { key: '6112536add9b6762b9df8eb7a8c8dd3ab0e9a717', style: this.getFontStyles() }, index.h("div", { key: 'c33e3e78b180b61ac7c727d93202add9fd39fe10', class: "container" }, this.chartTemplate())));
|
|
11062
11895
|
}
|
|
11063
11896
|
get element() { return index.getElement(this); }
|
|
11064
11897
|
static get watchers() { return {
|
|
@@ -11338,7 +12171,7 @@ class BulletChart {
|
|
|
11338
12171
|
}
|
|
11339
12172
|
drawText(group, text, x, y, options = {}) {
|
|
11340
12173
|
var _a, _b, _c;
|
|
11341
|
-
group
|
|
12174
|
+
return group
|
|
11342
12175
|
.text(text)
|
|
11343
12176
|
.font({
|
|
11344
12177
|
size: (_a = options.size) !== null && _a !== void 0 ? _a : this.styles.fontStyles.size,
|
|
@@ -11470,7 +12303,7 @@ class BulletChart {
|
|
|
11470
12303
|
});
|
|
11471
12304
|
root
|
|
11472
12305
|
.line(plotX, rowsTop - 0.2 * em, plotX, rowsBottom + 0.2 * em)
|
|
11473
|
-
.stroke({ color: this.styles.axisStyles.ac.stroke, width:
|
|
12306
|
+
.stroke({ color: this.styles.axisStyles.ac.stroke, width: withTranslation.strokeWidthPx(factors.axisLineWidth, this.em) });
|
|
11474
12307
|
// Stable, empty hook for a future annotation layer.
|
|
11475
12308
|
container.group().addClass("annotations");
|
|
11476
12309
|
}
|
|
@@ -11486,7 +12319,7 @@ class BulletChart {
|
|
|
11486
12319
|
const targetStyle = this.styles.barStyles.getSVGStyle(this.targetFamily());
|
|
11487
12320
|
const targetLine = root
|
|
11488
12321
|
.line(targetX, rowsTop - 0.3 * em, targetX, rowsBottom + 0.3 * em)
|
|
11489
|
-
.stroke({ color: targetStyle.stroke, width:
|
|
12322
|
+
.stroke({ color: targetStyle.stroke, width: withTranslation.strokeWidthPx(factors.targetLineWidth, this.em) });
|
|
11490
12323
|
if (targetStyle.dasharray !== undefined) {
|
|
11491
12324
|
targetLine.attr("stroke-dasharray", targetStyle.dasharray);
|
|
11492
12325
|
}
|
|
@@ -11495,7 +12328,7 @@ class BulletChart {
|
|
|
11495
12328
|
const cy = rowsTop + index * rowBlockH + rowH / 2;
|
|
11496
12329
|
if (row.fraction === null) {
|
|
11497
12330
|
// Not normalizable (missing/invalid target or negative actual): value text only.
|
|
11498
|
-
this.drawValueText(root, valueTexts[index], plotX + factors.labelToBar * em, cy);
|
|
12331
|
+
this.drawValueText(root, valueTexts[index], plotX + factors.labelToBar * em, cy, row);
|
|
11499
12332
|
return;
|
|
11500
12333
|
}
|
|
11501
12334
|
const barH = factors.barHeight * em;
|
|
@@ -11504,7 +12337,9 @@ class BulletChart {
|
|
|
11504
12337
|
.rect(Math.max(0, barEnd - plotX), barH)
|
|
11505
12338
|
.move(plotX, cy - barH / 2)
|
|
11506
12339
|
.fill(this.styles.barStyles.ac.fill)
|
|
11507
|
-
.stroke({ color: this.styles.barStyles.ac.stroke, width: this.styles.barStyles.ac.width })
|
|
12340
|
+
.stroke({ color: this.styles.barStyles.ac.stroke, width: this.styles.barStyles.ac.width })
|
|
12341
|
+
.attr(dataPointAttributes(this.rowKey(row), "element"))
|
|
12342
|
+
.attr("data-bn-index", String(index));
|
|
11508
12343
|
if (this.config.showVariances && row.sentiment !== "neu") {
|
|
11509
12344
|
const varianceH = factors.varianceHeight * em;
|
|
11510
12345
|
const varianceStyle = this.styles.varianceStyles.getSVGStyle(row.sentiment);
|
|
@@ -11514,7 +12349,7 @@ class BulletChart {
|
|
|
11514
12349
|
.fill(varianceStyle.fill)
|
|
11515
12350
|
.stroke({ color: varianceStyle.stroke, width: varianceStyle.width });
|
|
11516
12351
|
}
|
|
11517
|
-
this.drawValueText(root, valueTexts[index], Math.max(barEnd, targetX) + factors.labelToBar * em, cy);
|
|
12352
|
+
this.drawValueText(root, valueTexts[index], Math.max(barEnd, targetX) + factors.labelToBar * em, cy, row);
|
|
11518
12353
|
});
|
|
11519
12354
|
}
|
|
11520
12355
|
/** Classic mode: per-row scales with tick strips, target ticks, optional range bands. */
|
|
@@ -11530,7 +12365,7 @@ class BulletChart {
|
|
|
11530
12365
|
const bandEnds = drawRanges && row.target !== null ? this.config.ranges.map((r) => r * row.target) : [];
|
|
11531
12366
|
const rowMax = Math.max((_a = row.actual) !== null && _a !== void 0 ? _a : 0, (_b = row.target) !== null && _b !== void 0 ? _b : 0, ...bandEnds);
|
|
11532
12367
|
if (rowMax <= 0) {
|
|
11533
|
-
this.drawValueText(root, valueTexts[index], plotX + factors.labelToBar * em, cy);
|
|
12368
|
+
this.drawValueText(root, valueTexts[index], plotX + factors.labelToBar * em, cy, row);
|
|
11534
12369
|
return;
|
|
11535
12370
|
}
|
|
11536
12371
|
const step = NumericScale.niceStep(rowMax, 4);
|
|
@@ -11554,7 +12389,9 @@ class BulletChart {
|
|
|
11554
12389
|
.rect(barEnd - plotX, barH)
|
|
11555
12390
|
.move(plotX, cy - barH / 2)
|
|
11556
12391
|
.fill(this.styles.barStyles.ac.fill)
|
|
11557
|
-
.stroke({ color: this.styles.barStyles.ac.stroke, width: this.styles.barStyles.ac.width })
|
|
12392
|
+
.stroke({ color: this.styles.barStyles.ac.stroke, width: this.styles.barStyles.ac.width })
|
|
12393
|
+
.attr(dataPointAttributes(this.rowKey(row), "element"))
|
|
12394
|
+
.attr("data-bn-index", String(index));
|
|
11558
12395
|
rowRight = barEnd;
|
|
11559
12396
|
}
|
|
11560
12397
|
if (row.target !== null && row.target > 0) {
|
|
@@ -11563,7 +12400,7 @@ class BulletChart {
|
|
|
11563
12400
|
const targetStyle = this.styles.barStyles.getSVGStyle(this.targetFamily());
|
|
11564
12401
|
const tick = root
|
|
11565
12402
|
.line(tickX, cy - tickH / 2, tickX, cy + tickH / 2)
|
|
11566
|
-
.stroke({ color: targetStyle.stroke, width:
|
|
12403
|
+
.stroke({ color: targetStyle.stroke, width: withTranslation.strokeWidthPx(factors.targetLineWidth, this.em) });
|
|
11567
12404
|
if (targetStyle.dasharray !== undefined) {
|
|
11568
12405
|
tick.attr("stroke-dasharray", targetStyle.dasharray);
|
|
11569
12406
|
}
|
|
@@ -11573,7 +12410,7 @@ class BulletChart {
|
|
|
11573
12410
|
rowRight = Math.max(rowRight, tickX);
|
|
11574
12411
|
}
|
|
11575
12412
|
rowRight = Math.max(rowRight, bandStart);
|
|
11576
|
-
this.drawValueText(root, valueTexts[index], rowRight + factors.labelToBar * em, cy);
|
|
12413
|
+
this.drawValueText(root, valueTexts[index], rowRight + factors.labelToBar * em, cy, row);
|
|
11577
12414
|
// Per-row tick strip below the band.
|
|
11578
12415
|
const ticks = scale.ticks(4);
|
|
11579
12416
|
const decimals = NumericScale.tickDecimals(ticks);
|
|
@@ -11582,16 +12419,20 @@ class BulletChart {
|
|
|
11582
12419
|
const tickX = scale.scale(tick);
|
|
11583
12420
|
root
|
|
11584
12421
|
.line(tickX, tickTop, tickX, tickTop + factors.axisTickLength * em)
|
|
11585
|
-
.stroke({ color: this.styles.axisStyles.ac.stroke, width:
|
|
12422
|
+
.stroke({ color: this.styles.axisStyles.ac.stroke, width: withTranslation.strokeWidthPx(factors.axisLineWidth, this.em) });
|
|
11586
12423
|
this.drawText(root, Formatter.number(tick, "decimal", decimals, decimals, 1, this.styles.locale), tickX, tickTop + factors.tickStripHeight * em - 0.2 * em, { anchor: "middle" });
|
|
11587
12424
|
}
|
|
11588
12425
|
});
|
|
11589
12426
|
}
|
|
11590
|
-
drawValueText(root, text, x, cy) {
|
|
12427
|
+
drawValueText(root, text, x, cy, row) {
|
|
11591
12428
|
if (text === "") {
|
|
11592
12429
|
return;
|
|
11593
12430
|
}
|
|
11594
|
-
this.drawText(root, text, x, cy + 0.35 * this.em, {});
|
|
12431
|
+
this.drawText(root, text, x, cy + 0.35 * this.em, {}).attr(dataPointAttributes(this.rowKey(row), "label"));
|
|
12432
|
+
}
|
|
12433
|
+
/** The row of a bullet: its value of the chart's level and the actual measure. */
|
|
12434
|
+
rowKey(row) {
|
|
12435
|
+
return Object.assign(Object.assign({}, levelKey(this.config.level, row.category)), { scenario: this.config.actual.measure });
|
|
11595
12436
|
}
|
|
11596
12437
|
}
|
|
11597
12438
|
|
|
@@ -11944,7 +12785,7 @@ const ChartScatter = class {
|
|
|
11944
12785
|
this.errors.remove(errId);
|
|
11945
12786
|
return;
|
|
11946
12787
|
}
|
|
11947
|
-
const { mode, factor } =
|
|
12788
|
+
const { mode, factor } = withTranslation.parseScaling(newValue);
|
|
11948
12789
|
if (mode === "factor" && (factor === undefined || factor <= 0)) {
|
|
11949
12790
|
this.errors.addOrReplace({
|
|
11950
12791
|
id: errId,
|
|
@@ -12023,7 +12864,7 @@ const ChartScatter = class {
|
|
|
12023
12864
|
this.translateForInner = (key, data) => this.t(key, data);
|
|
12024
12865
|
withStyled.withStyled(this);
|
|
12025
12866
|
withHasError.withComponentStatus(this);
|
|
12026
|
-
|
|
12867
|
+
withTranslation.withDataset(this, (name, _data) => {
|
|
12027
12868
|
this.datasetName = (name === null || name === void 0 ? void 0 : name.startsWith("$")) ? name.substring(1) : name || "";
|
|
12028
12869
|
this.dataVersion = this.dataVersion + 1;
|
|
12029
12870
|
}, (_name, meta) => {
|
|
@@ -12032,7 +12873,7 @@ const ChartScatter = class {
|
|
|
12032
12873
|
this.errors = withHasError.withHasError(this);
|
|
12033
12874
|
this.componentStyle = withStyled.withComponentStyle(this);
|
|
12034
12875
|
this.ruleSetConfig = withRuleSet(this);
|
|
12035
|
-
this.t =
|
|
12876
|
+
this.t = withTranslation.withTranslation(this).t;
|
|
12036
12877
|
}
|
|
12037
12878
|
componentWillLoad() {
|
|
12038
12879
|
this.validateFilter(this.filter);
|
|
@@ -12050,7 +12891,7 @@ const ChartScatter = class {
|
|
|
12050
12891
|
}
|
|
12051
12892
|
componentDidRender() {
|
|
12052
12893
|
syncEmptyState(this.element, "bn-chart-scatter-renderer");
|
|
12053
|
-
const { mode } =
|
|
12894
|
+
const { mode } = withTranslation.parseScaling(this.scale);
|
|
12054
12895
|
if (mode !== "auto" && mode !== "empty") {
|
|
12055
12896
|
this._autoScaleGuard = false;
|
|
12056
12897
|
this.checkOverflow();
|
|
@@ -12062,7 +12903,7 @@ const ChartScatter = class {
|
|
|
12062
12903
|
return;
|
|
12063
12904
|
}
|
|
12064
12905
|
const host = this.element;
|
|
12065
|
-
const { width: parentWidth } =
|
|
12906
|
+
const { width: parentWidth } = withTranslation.getParentDimensions(host);
|
|
12066
12907
|
if (parentWidth <= 0) {
|
|
12067
12908
|
this.checkOverflow();
|
|
12068
12909
|
return;
|
|
@@ -12108,7 +12949,7 @@ const ChartScatter = class {
|
|
|
12108
12949
|
this.layoutObserver = observeParentResize(this.element, () => {
|
|
12109
12950
|
if (this._autoScaleGuard)
|
|
12110
12951
|
return;
|
|
12111
|
-
const { width } =
|
|
12952
|
+
const { width } = withTranslation.getParentDimensions(this.element);
|
|
12112
12953
|
if (width > 0 && Math.abs(width - this._lastObservedWidth) > 2) {
|
|
12113
12954
|
this._lastObservedWidth = width;
|
|
12114
12955
|
index.forceUpdate(this);
|
|
@@ -12124,7 +12965,7 @@ const ChartScatter = class {
|
|
|
12124
12965
|
requestAnimationFrame(() => {
|
|
12125
12966
|
if (this._autoScaleGuard)
|
|
12126
12967
|
return;
|
|
12127
|
-
const { width } =
|
|
12968
|
+
const { width } = withTranslation.getParentDimensions(this.element);
|
|
12128
12969
|
this._lastObservedWidth = width;
|
|
12129
12970
|
index.forceUpdate(this);
|
|
12130
12971
|
});
|
|
@@ -12411,7 +13252,7 @@ const ChartScatter = class {
|
|
|
12411
13252
|
return collectXYFacadeState(this.element, "bn-chart-scatter-renderer", this.chartTitle || undefined, { fontSizePx, appliedScaleFactor: factor }, origins, detail);
|
|
12412
13253
|
}
|
|
12413
13254
|
getEffectiveScaleFactor() {
|
|
12414
|
-
const { mode, factor } =
|
|
13255
|
+
const { mode, factor } = withTranslation.parseScaling(this.scale);
|
|
12415
13256
|
if (mode === "factor")
|
|
12416
13257
|
return factor;
|
|
12417
13258
|
if (mode === "auto" || mode === "empty")
|
|
@@ -12486,11 +13327,11 @@ const ChartScatter = class {
|
|
|
12486
13327
|
const pointLevel = this.preparePointLevel();
|
|
12487
13328
|
const preparedI18n = this.prepareI18n();
|
|
12488
13329
|
const preparedStyle = this.prepareStyle();
|
|
12489
|
-
const fullParentWidth =
|
|
13330
|
+
const fullParentWidth = withTranslation.getParentDimensions(this.element).width;
|
|
12490
13331
|
return (index.h("bn-chart-scatter-renderer", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.chartTitle, x: x, y: y, iso: this.prepareIso(), labels: this.prepareLabels(), legend: this.prepareLegend(), facet: facet, pointLevel: pointLevel, seriesLevel: this.prepareSeriesLevel(pointLevel), aspect: this.prepareAspect(), limit: this.prepareLimit(), filter: this.filter, styles: preparedStyle, i18n: preparedI18n, containerWidth: fullParentWidth, ruleSetConfig: this.ruleSetConfig(), errors: this.errors, translator: this.translateForInner }));
|
|
12491
13332
|
}
|
|
12492
13333
|
render() {
|
|
12493
|
-
return (index.h(index.Host, { key: '
|
|
13334
|
+
return (index.h(index.Host, { key: 'e3b4145baa75c73aa1dce6f44f3eac3a2a093cac', style: this.getFontStyles() }, index.h("div", { key: 'e60ee9b18969fc5c51ec59aae202b8519789d0a3', class: "container" }, this.chartTemplate())));
|
|
12494
13335
|
}
|
|
12495
13336
|
get element() { return index.getElement(this); }
|
|
12496
13337
|
static get watchers() { return {
|
|
@@ -12763,7 +13604,7 @@ class ScatterChart {
|
|
|
12763
13604
|
}
|
|
12764
13605
|
drawText(group, text, x, y, options = {}) {
|
|
12765
13606
|
var _a, _b, _c;
|
|
12766
|
-
group
|
|
13607
|
+
return group
|
|
12767
13608
|
.text(text)
|
|
12768
13609
|
.font({
|
|
12769
13610
|
size: (_a = options.size) !== null && _a !== void 0 ? _a : this.styles.fontStyles.size,
|
|
@@ -13020,13 +13861,14 @@ class ScatterChart {
|
|
|
13020
13861
|
.circle(radius * 2)
|
|
13021
13862
|
.center(cx, cy)
|
|
13022
13863
|
.fill(treatment.fill)
|
|
13023
|
-
.stroke({ color: treatment.stroke, width: treatment.strokeWidth })
|
|
13864
|
+
.stroke({ color: treatment.stroke, width: treatment.strokeWidth })
|
|
13865
|
+
.attr(dataPointAttributes(xyPointKey(point, facet.key, this.config), "element"));
|
|
13024
13866
|
if (treatment.dasharray !== undefined) {
|
|
13025
13867
|
circle.attr("stroke-dasharray", treatment.dasharray);
|
|
13026
13868
|
}
|
|
13027
13869
|
labeler.registerMark(cx, cy, radius);
|
|
13028
13870
|
}
|
|
13029
|
-
this.drawPointLabels(group, labeler, marks, radius);
|
|
13871
|
+
this.drawPointLabels(group, labeler, marks, radius, facet.key);
|
|
13030
13872
|
panel.frame.drawTickLabels(group, {
|
|
13031
13873
|
ticksX,
|
|
13032
13874
|
ticksY,
|
|
@@ -13041,7 +13883,7 @@ class ScatterChart {
|
|
|
13041
13883
|
panel.frame.drawPanelTitle(group, panelTitle);
|
|
13042
13884
|
}
|
|
13043
13885
|
}
|
|
13044
|
-
drawPointLabels(group, labeler, marks, radius) {
|
|
13886
|
+
drawPointLabels(group, labeler, marks, radius, facetKey) {
|
|
13045
13887
|
// Rank by extremity: distance from the pixel-space centroid.
|
|
13046
13888
|
const centroidX = marks.reduce((sum, m) => sum + m.cx, 0) / Math.max(1, marks.length);
|
|
13047
13889
|
const centroidY = marks.reduce((sum, m) => sum + m.cy, 0) / Math.max(1, marks.length);
|
|
@@ -13050,16 +13892,21 @@ class ScatterChart {
|
|
|
13050
13892
|
if (unknownNames.length > 0) {
|
|
13051
13893
|
this.addWarningOnce("xy-label-unknown", { names: unknownNames.join(", ") });
|
|
13052
13894
|
}
|
|
13053
|
-
const
|
|
13054
|
-
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
|
|
13059
|
-
|
|
13060
|
-
|
|
13895
|
+
const pointOf = new Map();
|
|
13896
|
+
const candidates = selected.map((mark) => {
|
|
13897
|
+
const candidate = {
|
|
13898
|
+
name: mark.point.name,
|
|
13899
|
+
cx: mark.cx,
|
|
13900
|
+
cy: mark.cy,
|
|
13901
|
+
r: radius,
|
|
13902
|
+
width: this.textWidth(mark.point.name),
|
|
13903
|
+
height: 1.1 * this.em,
|
|
13904
|
+
};
|
|
13905
|
+
pointOf.set(candidate, mark.point);
|
|
13906
|
+
return candidate;
|
|
13907
|
+
});
|
|
13061
13908
|
for (const placed of labeler.place(candidates)) {
|
|
13062
|
-
this.drawText(group, placed.candidate.name, placed.x, placed.y + 0.9 * placed.candidate.height, {});
|
|
13909
|
+
this.drawText(group, placed.candidate.name, placed.x, placed.y + 0.9 * placed.candidate.height, {}).attr(dataPointAttributes(xyPointKey(pointOf.get(placed.candidate), facetKey, this.config), "label"));
|
|
13063
13910
|
}
|
|
13064
13911
|
}
|
|
13065
13912
|
drawIso(group, panel) {
|
|
@@ -13076,7 +13923,7 @@ class ScatterChart {
|
|
|
13076
13923
|
}
|
|
13077
13924
|
const stroke = {
|
|
13078
13925
|
color: this.styles.axisStyles.fc.stroke,
|
|
13079
|
-
width:
|
|
13926
|
+
width: withTranslation.strokeWidthPx(this.styles.scaleFactors.gridLineWidth, this.em),
|
|
13080
13927
|
};
|
|
13081
13928
|
let topExit = null;
|
|
13082
13929
|
for (const [index, k] of ks.entries()) {
|
|
@@ -13269,7 +14116,7 @@ const Chart$1 = class Chart {
|
|
|
13269
14116
|
}
|
|
13270
14117
|
validateScenario(newValue) {
|
|
13271
14118
|
const errId = "WARN_scenarios";
|
|
13272
|
-
if (
|
|
14119
|
+
if (withTranslation.isInheritedValue(newValue)) {
|
|
13273
14120
|
this.errors.remove(errId);
|
|
13274
14121
|
return;
|
|
13275
14122
|
}
|
|
@@ -13287,7 +14134,7 @@ const Chart$1 = class Chart {
|
|
|
13287
14134
|
}
|
|
13288
14135
|
validateVariances(newValue) {
|
|
13289
14136
|
const errIdVar = "WARN_variances";
|
|
13290
|
-
if (
|
|
14137
|
+
if (withTranslation.isInheritedValue(newValue)) {
|
|
13291
14138
|
this.errors.remove(errIdVar);
|
|
13292
14139
|
return;
|
|
13293
14140
|
}
|
|
@@ -13309,7 +14156,7 @@ const Chart$1 = class Chart {
|
|
|
13309
14156
|
this.errors.remove(errId);
|
|
13310
14157
|
return;
|
|
13311
14158
|
}
|
|
13312
|
-
if (
|
|
14159
|
+
if (withTranslation.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
13313
14160
|
this.errors.addOrReplace({
|
|
13314
14161
|
id: errId,
|
|
13315
14162
|
type: "warning",
|
|
@@ -13326,7 +14173,7 @@ const Chart$1 = class Chart {
|
|
|
13326
14173
|
this.errors.remove(errId);
|
|
13327
14174
|
return;
|
|
13328
14175
|
}
|
|
13329
|
-
if (
|
|
14176
|
+
if (withTranslation.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
13330
14177
|
this.errors.addOrReplace({
|
|
13331
14178
|
id: errId,
|
|
13332
14179
|
type: "warning",
|
|
@@ -13356,7 +14203,7 @@ const Chart$1 = class Chart {
|
|
|
13356
14203
|
}
|
|
13357
14204
|
validateOrderList(newValue) {
|
|
13358
14205
|
const errId = "WARN_order";
|
|
13359
|
-
if (
|
|
14206
|
+
if (withTranslation.isInheritedValue(newValue)) {
|
|
13360
14207
|
this.errors.remove(errId);
|
|
13361
14208
|
return;
|
|
13362
14209
|
}
|
|
@@ -13374,7 +14221,7 @@ const Chart$1 = class Chart {
|
|
|
13374
14221
|
}
|
|
13375
14222
|
validateOrderDirection(newValue) {
|
|
13376
14223
|
const errId = "WARN_orderDirection";
|
|
13377
|
-
if (
|
|
14224
|
+
if (withTranslation.isInheritedValue(newValue) || withStyled.isBlankInput(newValue)) {
|
|
13378
14225
|
this.errors.remove(errId);
|
|
13379
14226
|
return;
|
|
13380
14227
|
}
|
|
@@ -13572,7 +14419,7 @@ const Chart$1 = class Chart {
|
|
|
13572
14419
|
this.errors.addOrReplace({
|
|
13573
14420
|
id: "AUTO_unitScaling",
|
|
13574
14421
|
type: "warning",
|
|
13575
|
-
message: `unit-scaling: ${Chart$1.describeScalingInput(String((_e = this.unitScaling) !== null && _e !== void 0 ? _e : "").trim())}, auto-fitted to 1 em ≈ ${
|
|
14422
|
+
message: `unit-scaling: ${Chart$1.describeScalingInput(String((_e = this.unitScaling) !== null && _e !== void 0 ? _e : "").trim())}, auto-fitted to 1 em ≈ ${withTranslation.formatScalingValue(unitsPerEm)} units.`,
|
|
13576
14423
|
});
|
|
13577
14424
|
}
|
|
13578
14425
|
}
|
|
@@ -13583,14 +14430,14 @@ const Chart$1 = class Chart {
|
|
|
13583
14430
|
this.errors.addOrReplace({
|
|
13584
14431
|
id: "AUTO_percentageScaling",
|
|
13585
14432
|
type: "warning",
|
|
13586
|
-
message: `percentage-scaling: ${Chart$1.describeScalingInput(String((_f = this.percentageScaling) !== null && _f !== void 0 ? _f : "").trim())}, auto-fitted to 1 em ≈ ${
|
|
14433
|
+
message: `percentage-scaling: ${Chart$1.describeScalingInput(String((_f = this.percentageScaling) !== null && _f !== void 0 ? _f : "").trim())}, auto-fitted to 1 em ≈ ${withTranslation.formatScalingValue(ppPerEm)} percentage points.`,
|
|
13587
14434
|
});
|
|
13588
14435
|
}
|
|
13589
14436
|
}
|
|
13590
14437
|
};
|
|
13591
14438
|
withStyled.withStyled(this);
|
|
13592
14439
|
withHasError.withComponentStatus(this);
|
|
13593
|
-
|
|
14440
|
+
withTranslation.withDataset(this, (name, _data) => {
|
|
13594
14441
|
this.datasetName = (name === null || name === void 0 ? void 0 : name.startsWith("$")) ? name.substring(1) : name || "";
|
|
13595
14442
|
this.dataVersion = this.dataVersion + 1;
|
|
13596
14443
|
}, (_name, meta) => {
|
|
@@ -13601,8 +14448,8 @@ const Chart$1 = class Chart {
|
|
|
13601
14448
|
withScalingGroup(this);
|
|
13602
14449
|
this.componentStyle = withStyled.withComponentStyle(this);
|
|
13603
14450
|
this.ruleSetConfig = withRuleSet(this);
|
|
13604
|
-
this.t =
|
|
13605
|
-
this.resolveInherited =
|
|
14451
|
+
this.t = withTranslation.withTranslation(this).t;
|
|
14452
|
+
this.resolveInherited = withTranslation.withInheritedProps(this, [
|
|
13606
14453
|
{ propName: "scenarios", ancestorAttr: "title-scenarios" },
|
|
13607
14454
|
{ propName: "variances", ancestorAttr: "title-variances" },
|
|
13608
14455
|
{ propName: "order", ancestorAttr: "title-order" },
|
|
@@ -13624,7 +14471,7 @@ const Chart$1 = class Chart {
|
|
|
13624
14471
|
}
|
|
13625
14472
|
componentDidRender() {
|
|
13626
14473
|
syncEmptyState(this.element, "bn-chart-structure-renderer");
|
|
13627
|
-
const { mode } =
|
|
14474
|
+
const { mode } = withTranslation.parseScaling(this.scale);
|
|
13628
14475
|
if (mode !== "auto" && mode !== "empty") {
|
|
13629
14476
|
this._autoScaleGuard = false;
|
|
13630
14477
|
this.checkOverflow();
|
|
@@ -13636,7 +14483,7 @@ const Chart$1 = class Chart {
|
|
|
13636
14483
|
return;
|
|
13637
14484
|
}
|
|
13638
14485
|
const host = this.element;
|
|
13639
|
-
const { height: parentHeight } =
|
|
14486
|
+
const { height: parentHeight } = withTranslation.getParentDimensions(host);
|
|
13640
14487
|
if (parentHeight <= 0) {
|
|
13641
14488
|
this.checkOverflow();
|
|
13642
14489
|
return;
|
|
@@ -13699,7 +14546,7 @@ const Chart$1 = class Chart {
|
|
|
13699
14546
|
this.layoutObserver = observeParentResize(this.element, () => {
|
|
13700
14547
|
if (this._autoScaleGuard)
|
|
13701
14548
|
return;
|
|
13702
|
-
const { height } =
|
|
14549
|
+
const { height } = withTranslation.getParentDimensions(this.element);
|
|
13703
14550
|
// Only react to HEIGHT changes - structure chart scales by height.
|
|
13704
14551
|
// Width changes are handled separately via checkWidthOverflow.
|
|
13705
14552
|
if (height > 0 && Math.abs(height - this._lastScaledParentHeight) > 2) {
|
|
@@ -13713,7 +14560,7 @@ const Chart$1 = class Chart {
|
|
|
13713
14560
|
requestAnimationFrame(() => {
|
|
13714
14561
|
if (this._autoScaleGuard)
|
|
13715
14562
|
return;
|
|
13716
|
-
const { height } =
|
|
14563
|
+
const { height } = withTranslation.getParentDimensions(this.element);
|
|
13717
14564
|
this._lastScaledParentHeight = height;
|
|
13718
14565
|
index.forceUpdate(this);
|
|
13719
14566
|
});
|
|
@@ -13758,7 +14605,7 @@ const Chart$1 = class Chart {
|
|
|
13758
14605
|
* construction, so it only fires when the content cannot fit at any scale.
|
|
13759
14606
|
*/
|
|
13760
14607
|
checkOverflow() {
|
|
13761
|
-
const parent =
|
|
14608
|
+
const parent = withTranslation.getParentDimensions(this.element);
|
|
13762
14609
|
const contentWidth = this.measureContentWidth();
|
|
13763
14610
|
const contentHeight = this.element.scrollHeight;
|
|
13764
14611
|
const widthOver = parent.width > 0 && contentWidth > parent.width + 1;
|
|
@@ -13768,9 +14615,9 @@ const Chart$1 = class Chart {
|
|
|
13768
14615
|
return;
|
|
13769
14616
|
}
|
|
13770
14617
|
const hasRelativeVariance = this.prepareVariances().some((variance) => variance.startsWith("dr"));
|
|
13771
|
-
const fixedUnit =
|
|
13772
|
-
const fixedPercent = hasRelativeVariance &&
|
|
13773
|
-
const { mode } =
|
|
14618
|
+
const fixedUnit = withTranslation.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap).kind === "value";
|
|
14619
|
+
const fixedPercent = hasRelativeVariance && withTranslation.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap).kind === "value";
|
|
14620
|
+
const { mode } = withTranslation.parseScaling(this.scale);
|
|
13774
14621
|
const fixedScale = mode !== "auto" && mode !== "empty";
|
|
13775
14622
|
const fixedAttrs = [];
|
|
13776
14623
|
if (widthOver && fixedUnit)
|
|
@@ -13790,7 +14637,7 @@ const Chart$1 = class Chart {
|
|
|
13790
14637
|
: "Content does not fit even at minimum auto scaling; enlarge the container."), fixedAttrs.length > 0);
|
|
13791
14638
|
}
|
|
13792
14639
|
prepareDimension() {
|
|
13793
|
-
const parent =
|
|
14640
|
+
const parent = withTranslation.getParentDimensions(this.element);
|
|
13794
14641
|
const variancesList = this.prepareVariances();
|
|
13795
14642
|
const segmentCount = 1 + variancesList.length;
|
|
13796
14643
|
this.canvasWidthSegmented = parent.width / segmentCount;
|
|
@@ -13851,7 +14698,7 @@ const Chart$1 = class Chart {
|
|
|
13851
14698
|
return raw === "" ? "not set" : `invalid value "${raw}"`;
|
|
13852
14699
|
}
|
|
13853
14700
|
preparePixelPerUnit() {
|
|
13854
|
-
const resolved =
|
|
14701
|
+
const resolved = withTranslation.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
13855
14702
|
if (resolved.kind === "value") {
|
|
13856
14703
|
this.errors.remove("AUTO_unitScaling");
|
|
13857
14704
|
this.autoUnitWarningActive = false;
|
|
@@ -13876,7 +14723,7 @@ const Chart$1 = class Chart {
|
|
|
13876
14723
|
return 0;
|
|
13877
14724
|
}
|
|
13878
14725
|
preparePixelPerPercentage() {
|
|
13879
|
-
const resolved =
|
|
14726
|
+
const resolved = withTranslation.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
13880
14727
|
if (resolved.kind === "value") {
|
|
13881
14728
|
this.errors.remove("AUTO_percentageScaling");
|
|
13882
14729
|
this.autoPctWarningActive = false;
|
|
@@ -14165,7 +15012,7 @@ const Chart$1 = class Chart {
|
|
|
14165
15012
|
resolveScalingInfo(effFontPx) {
|
|
14166
15013
|
var _a, _b;
|
|
14167
15014
|
const info = {};
|
|
14168
|
-
const unit =
|
|
15015
|
+
const unit = withTranslation.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
14169
15016
|
if (unit.kind === "value") {
|
|
14170
15017
|
info.unitMode = "fixed";
|
|
14171
15018
|
info.unitsPerEm = unit.value;
|
|
@@ -14179,7 +15026,7 @@ const Chart$1 = class Chart {
|
|
|
14179
15026
|
info.unitsPerEm = effFontPx / pxPerUnit;
|
|
14180
15027
|
}
|
|
14181
15028
|
}
|
|
14182
|
-
const pct =
|
|
15029
|
+
const pct = withTranslation.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
14183
15030
|
if (pct.kind === "value") {
|
|
14184
15031
|
info.percentageMode = "fixed";
|
|
14185
15032
|
info.percentagePointsPerEm = pct.value;
|
|
@@ -14196,7 +15043,7 @@ const Chart$1 = class Chart {
|
|
|
14196
15043
|
return info;
|
|
14197
15044
|
}
|
|
14198
15045
|
getEffectiveScaleFactor() {
|
|
14199
|
-
const { mode, factor } =
|
|
15046
|
+
const { mode, factor } = withTranslation.parseScaling(this.scale);
|
|
14200
15047
|
if (mode === "factor")
|
|
14201
15048
|
return factor;
|
|
14202
15049
|
if (mode === "auto" || mode === "empty")
|
|
@@ -14228,7 +15075,7 @@ const Chart$1 = class Chart {
|
|
|
14228
15075
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
14229
15076
|
}
|
|
14230
15077
|
const fontStyles = this.getFontStyles();
|
|
14231
|
-
return (index.h(index.Host, { key: '
|
|
15078
|
+
return (index.h(index.Host, { key: 'fa4590815428039a2168ab248f70a5196712e119', style: fontStyles }, index.h("div", { key: '46bdb7161116459ed7ba096bef4752348dc73548', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
14232
15079
|
}
|
|
14233
15080
|
get element() { return index.getElement(this); }
|
|
14234
15081
|
static get watchers() { return {
|
|
@@ -15330,6 +16177,7 @@ class Label {
|
|
|
15330
16177
|
this.maxWidth = null;
|
|
15331
16178
|
this.ID_SCENARIOLABEL = "Label";
|
|
15332
16179
|
this.CSS_CATEGORIES = "categories";
|
|
16180
|
+
this.pointPart = "label";
|
|
15333
16181
|
this.x = xPosition;
|
|
15334
16182
|
this.y = yPosition;
|
|
15335
16183
|
this.value = value;
|
|
@@ -15359,6 +16207,12 @@ class Label {
|
|
|
15359
16207
|
this.maxWidth = width;
|
|
15360
16208
|
return this;
|
|
15361
16209
|
}
|
|
16210
|
+
/** The data row this label belongs to. Written on the label group when the label is drawn. */
|
|
16211
|
+
setPoint(key, part = "label") {
|
|
16212
|
+
this.pointKey = key;
|
|
16213
|
+
this.pointPart = part;
|
|
16214
|
+
return this;
|
|
16215
|
+
}
|
|
15362
16216
|
updateGroup(newGroup) {
|
|
15363
16217
|
this.group = newGroup;
|
|
15364
16218
|
return this;
|
|
@@ -15434,6 +16288,9 @@ class Label {
|
|
|
15434
16288
|
else {
|
|
15435
16289
|
label === null || label === void 0 ? void 0 : label.rect(boxWidth, boxHeight * 0.9).stroke(background).fill(background).opacity(0.7).move(text.x(), text.y() + boxHeight * 0.1).insertBefore(text);
|
|
15436
16290
|
}
|
|
16291
|
+
if (this.pointKey) {
|
|
16292
|
+
label === null || label === void 0 ? void 0 : label.attr(dataPointAttributes(this.pointKey, this.pointPart));
|
|
16293
|
+
}
|
|
15437
16294
|
return this;
|
|
15438
16295
|
}
|
|
15439
16296
|
isEmpty() {
|
|
@@ -15543,7 +16400,7 @@ class Bar {
|
|
|
15543
16400
|
textLabelHook = HookLocation.Right;
|
|
15544
16401
|
}
|
|
15545
16402
|
this.dimensions = this.createDimensions(position, dataPoint, index, isPrimaryBar);
|
|
15546
|
-
this.label = new Label(this.scenarioGroup, this.dimensions.labelXPos, this.dimensions.yPos, this.ID_DATA_PREFIX, dataPoint.value, this.styles, HookLocation.Center, textLabelHook);
|
|
16403
|
+
this.label = new Label(this.scenarioGroup, this.dimensions.labelXPos, this.dimensions.yPos, this.ID_DATA_PREFIX, dataPoint.value, this.styles, HookLocation.Center, textLabelHook).setPoint(dataPoint.key);
|
|
15547
16404
|
this.scenarioLabel = this.getScenarioLabel(barLabel);
|
|
15548
16405
|
}
|
|
15549
16406
|
}
|
|
@@ -15568,6 +16425,7 @@ class Bar {
|
|
|
15568
16425
|
return this;
|
|
15569
16426
|
}
|
|
15570
16427
|
draw(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
|
|
16428
|
+
var _a, _b;
|
|
15571
16429
|
if (this.isEmpty() || this.dataPoint.getScenario() == null) {
|
|
15572
16430
|
return this;
|
|
15573
16431
|
}
|
|
@@ -15585,6 +16443,8 @@ class Bar {
|
|
|
15585
16443
|
fillStyle = polygonPattern.pattern;
|
|
15586
16444
|
}
|
|
15587
16445
|
}
|
|
16446
|
+
(_a = this.scenarioGroup) === null || _a === void 0 ? void 0 : _a.attr(dataPointAttributes(this.dataPoint.key));
|
|
16447
|
+
(_b = this.barGroup) === null || _b === void 0 ? void 0 : _b.attr(dataPointAttributes(this.dataPoint.key, "element"));
|
|
15588
16448
|
if (this.barGroup != null) {
|
|
15589
16449
|
if (this.isOverflowing && this.overflowConfig) {
|
|
15590
16450
|
this.drawOverdriveBar(fillStyle, strokeStyle);
|
|
@@ -15809,6 +16669,7 @@ let Marker$1 = class Marker {
|
|
|
15809
16669
|
this.scenario = scenario;
|
|
15810
16670
|
if ((dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.isEmpty()) !== true) {
|
|
15811
16671
|
this.hasData = true;
|
|
16672
|
+
this.pointKey = dataPoint.key;
|
|
15812
16673
|
this.dimensions = this.createMarkerDimensions(dataPoint, index, isPrimaryMarker);
|
|
15813
16674
|
this.scenarioLabel = this.getScenarioLabel(labelText, styles, isPrimaryMarker);
|
|
15814
16675
|
}
|
|
@@ -15870,6 +16731,7 @@ let Marker$1 = class Marker {
|
|
|
15870
16731
|
fillStyle = polygonPattern.pattern;
|
|
15871
16732
|
}
|
|
15872
16733
|
}
|
|
16734
|
+
this.markerGroup.attr(dataPointAttributes(this.pointKey));
|
|
15873
16735
|
this.markerGroup
|
|
15874
16736
|
.polygon(this.markerPattern.background)
|
|
15875
16737
|
.fill(whiteBorder)
|
|
@@ -15880,7 +16742,8 @@ let Marker$1 = class Marker {
|
|
|
15880
16742
|
.fill(fillStyle)
|
|
15881
16743
|
.stroke(strokeStyle)
|
|
15882
16744
|
.cy(this.dimensions.yPos)
|
|
15883
|
-
.cx(this.dimensions.xPos)
|
|
16745
|
+
.cx(this.dimensions.xPos)
|
|
16746
|
+
.attr(dataPointAttributes(this.pointKey, "element"));
|
|
15884
16747
|
if (this.scenarioLabel != null && !this.scenarioLabel.isEmpty()) {
|
|
15885
16748
|
this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos, this.dimensions.scenarioLabelYPos).draw();
|
|
15886
16749
|
}
|
|
@@ -15940,7 +16803,7 @@ let Needle$1 = class Needle {
|
|
|
15940
16803
|
textLabelHook = HookLocation.Right;
|
|
15941
16804
|
}
|
|
15942
16805
|
this.label = new Label(this.scenarioGroup, this.dimensions.labelXPos, this.dimensions.yPos, this.ID_DATA_PREFIX, notAvailable ? withStyled.NOT_AVAILABLE : dataPoint.value, this.styles, HookLocation.Center, textLabelHook);
|
|
15943
|
-
this.label.setToRelativeVarianceLabel();
|
|
16806
|
+
this.label.setToRelativeVarianceLabel().setPoint(dataPoint.key);
|
|
15944
16807
|
}
|
|
15945
16808
|
}
|
|
15946
16809
|
updateLabelGroup(newGroup) {
|
|
@@ -15964,6 +16827,8 @@ let Needle$1 = class Needle {
|
|
|
15964
16827
|
if (this.dimensions == null) {
|
|
15965
16828
|
return this;
|
|
15966
16829
|
}
|
|
16830
|
+
this.scenarioGroup.attr(dataPointAttributes(this.dataPoint.key));
|
|
16831
|
+
this.barGroup.attr(dataPointAttributes(this.dataPoint.key, "element"));
|
|
15967
16832
|
// Needles always use varianceStyles (falls back to 'neu'); bars use barStyles (falls back to 'ac')
|
|
15968
16833
|
const scenarioStyle = this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle());
|
|
15969
16834
|
const strokeStyle = scenarioStyle.stroke;
|
|
@@ -16089,6 +16954,7 @@ class StackedBar {
|
|
|
16089
16954
|
const fillColor = colors[this.segmentIndex % colors.length];
|
|
16090
16955
|
const fillStyle = { color: fillColor };
|
|
16091
16956
|
const strokeStyle = { color: fillColor, width: 0.5 };
|
|
16957
|
+
this.barGroup.attr(dataPointAttributes(this.dataPoint.key, "element"));
|
|
16092
16958
|
this.barGroup.rect(Math.max(segmentLength, 0.5), barWidth).fill(fillStyle).stroke(strokeStyle).cy(yPos).x(xPos);
|
|
16093
16959
|
// Draw segment value label centered on bar if wide enough
|
|
16094
16960
|
const LABEL_PADDING = 6;
|
|
@@ -16100,6 +16966,7 @@ class StackedBar {
|
|
|
16100
16966
|
new Label(this.group, labelX, yPos, "STACK_SEG", labelValue, this.styles, HookLocation.Center, HookLocation.Center)
|
|
16101
16967
|
.setSegmentFill(fillColor)
|
|
16102
16968
|
.setMaxWidth(availableWidth)
|
|
16969
|
+
.setPoint(this.dataPoint.key)
|
|
16103
16970
|
.draw();
|
|
16104
16971
|
}
|
|
16105
16972
|
else {
|
|
@@ -16107,11 +16974,12 @@ class StackedBar {
|
|
|
16107
16974
|
new Label(this.group, labelX, yPos, "STACK_SEG", value, this.styles, HookLocation.Center, HookLocation.Center)
|
|
16108
16975
|
.setSegmentFill(fillColor)
|
|
16109
16976
|
.setMaxWidth(availableWidth)
|
|
16977
|
+
.setPoint(this.dataPoint.key)
|
|
16110
16978
|
.draw(dataFormatDigits, measureScale);
|
|
16111
16979
|
}
|
|
16112
16980
|
}
|
|
16113
16981
|
}
|
|
16114
|
-
drawTotalLabel(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
|
|
16982
|
+
drawTotalLabel(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix(), key) {
|
|
16115
16983
|
if (this.stackMode === withStyled.StackMode.RELATIVE) {
|
|
16116
16984
|
return;
|
|
16117
16985
|
}
|
|
@@ -16121,7 +16989,7 @@ class StackedBar {
|
|
|
16121
16989
|
const labelX = this.position.getLabelPositionX(end * this.dataPoint.pixelPerUnit);
|
|
16122
16990
|
const yPos = this.position.getBarPositionY(this.index, true);
|
|
16123
16991
|
const label = new Label(this.group, labelX, yPos, "STACK_TOTAL", this.stack.total, this.styles, HookLocation.Center, isNegative ? HookLocation.Right : HookLocation.Left);
|
|
16124
|
-
label.draw(dataFormatDigits, measureScale);
|
|
16992
|
+
label.setPoint(key, "total").draw(dataFormatDigits, measureScale);
|
|
16125
16993
|
}
|
|
16126
16994
|
}
|
|
16127
16995
|
|
|
@@ -16413,6 +17281,8 @@ class StructureChart {
|
|
|
16413
17281
|
this.highestVarianceDataPointValue = new DataPoint$1(0, Scenario$1.AC1, 1, Scenario$1.NEU);
|
|
16414
17282
|
this.pixelPerUnit = 1;
|
|
16415
17283
|
this.pixelPerPercentage = 1;
|
|
17284
|
+
/** The dimension a bar stands for: names the `data-bn-*` key of its value. */
|
|
17285
|
+
this.level = withStyled.AggregationLevel.CATEGORY;
|
|
16416
17286
|
this.hideCategories = false;
|
|
16417
17287
|
this.axisScenario = Scenario$1.AC1;
|
|
16418
17288
|
this.CSS_CATEGORIES = "categories";
|
|
@@ -16459,7 +17329,7 @@ class StructureChart {
|
|
|
16459
17329
|
this.ruleSet = ruleSet || new IBCSRuleSet();
|
|
16460
17330
|
}
|
|
16461
17331
|
setConfig(config) {
|
|
16462
|
-
var _a;
|
|
17332
|
+
var _a, _b;
|
|
16463
17333
|
this.state = FactoryState$3.DIRTY;
|
|
16464
17334
|
this.scenarioPropOrder = [...config.scenarios];
|
|
16465
17335
|
const scenarios = this.sortScenariosbyVisualisationRules(config.scenarios);
|
|
@@ -16468,14 +17338,23 @@ class StructureChart {
|
|
|
16468
17338
|
this.pixelPerUnit = config.pixelPerUnit || 1;
|
|
16469
17339
|
this.pixelPerPercentage = config.pixelPerPercentage || 100;
|
|
16470
17340
|
this.setSource(config.filter);
|
|
17341
|
+
this.level = config.level;
|
|
16471
17342
|
this.dataModel = this.populateModel(scenarios, config.level, config.sortOrder);
|
|
17343
|
+
for (const row of this.dataModel) {
|
|
17344
|
+
for (const dataPoint of [row.scenario1, row.scenario2, row.scenario3, row.scenario4]) {
|
|
17345
|
+
// a category without a value has no bar: nothing an annotation can point at
|
|
17346
|
+
if (dataPoint.value != null && !Number.isNaN(dataPoint.value)) {
|
|
17347
|
+
dataPoint.key = Object.assign(Object.assign({}, levelKey(this.level, row.category)), { scenario: (_a = dataPoint.scenario) !== null && _a !== void 0 ? _a : undefined });
|
|
17348
|
+
}
|
|
17349
|
+
}
|
|
17350
|
+
}
|
|
16472
17351
|
// Populate per-dimension stack segments when stacking by a data dimension
|
|
16473
17352
|
if (config.stackConfig && config.stackConfig.by !== withStyled.StackBy.SCENARIOS) {
|
|
16474
17353
|
this.populateDimensionStackSegments(scenarios, config.stackConfig, config.level);
|
|
16475
17354
|
}
|
|
16476
17355
|
this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
|
|
16477
17356
|
this.configTitle = config.title;
|
|
16478
|
-
this.configVariances = (
|
|
17357
|
+
this.configVariances = (_b = config === null || config === void 0 ? void 0 : config.variances) !== null && _b !== void 0 ? _b : [];
|
|
16479
17358
|
this.updateTitle();
|
|
16480
17359
|
this.smallestDataPointValue = this.findSmallestDataPointValue(this.dataModel);
|
|
16481
17360
|
this.smallestVarianceDataPointValue = this.findSmallestDataPointValue(this.variancesDataModel);
|
|
@@ -17053,11 +17932,15 @@ class StructureChart {
|
|
|
17053
17932
|
pixelPerUnit = this.pixelPerPercentage;
|
|
17054
17933
|
}
|
|
17055
17934
|
for (const index in dataModel) {
|
|
17935
|
+
const point = new DataPoint$1(this.calculateVariance(scenarios, dataModel[index], scenariomap), scenarios.base, pixelPerUnit, directon);
|
|
17936
|
+
if (point.value !== null && !Number.isNaN(point.value)) {
|
|
17937
|
+
point.key = Object.assign(Object.assign({}, levelKey(this.level, dataModel[index].category)), { scenario: variancesConfig[varianceScenario] });
|
|
17938
|
+
}
|
|
17056
17939
|
varianceModel.push({
|
|
17057
17940
|
id: Number(index),
|
|
17058
17941
|
category: dataModel[index].category,
|
|
17059
17942
|
type: scenarios.type === "dr" ? VarianceType$1.RELATIVE : VarianceType$1.ABSOLUTE,
|
|
17060
|
-
scenario1:
|
|
17943
|
+
scenario1: point,
|
|
17061
17944
|
scenario2: new DataPoint$1(null, null, null, null),
|
|
17062
17945
|
scenario3: new DataPoint$1(null, null, null, null),
|
|
17063
17946
|
scenario4: new DataPoint$1(null, null, null, null),
|
|
@@ -17219,7 +18102,8 @@ class StructureChart {
|
|
|
17219
18102
|
lastBar = bar;
|
|
17220
18103
|
});
|
|
17221
18104
|
if (lastBar && group.hasValue) {
|
|
17222
|
-
|
|
18105
|
+
// an overlay has one total per scenario family: the family tells them apart
|
|
18106
|
+
lastBar.drawTotalLabel(this.dataFormatDigits, this.measureScale, Object.assign(Object.assign({}, levelKey(this.level, elements.category)), { scenario: groups.length > 1 ? group.prefix : undefined }));
|
|
17223
18107
|
}
|
|
17224
18108
|
});
|
|
17225
18109
|
});
|
|
@@ -17393,11 +18277,11 @@ class StructureChart {
|
|
|
17393
18277
|
for (const row of this.dataModel) {
|
|
17394
18278
|
const segments = groupMap.get(row.category);
|
|
17395
18279
|
if (segments && segments.length > 0) {
|
|
17396
|
-
row.stackSegments = segments.map((seg) =>
|
|
17397
|
-
|
|
17398
|
-
|
|
17399
|
-
|
|
17400
|
-
})
|
|
18280
|
+
row.stackSegments = segments.map((seg) => {
|
|
18281
|
+
const dataPoint = new DataPoint$1(seg.value, scenario, this.pixelPerUnit, Scenario$1.NEU);
|
|
18282
|
+
dataPoint.key = Object.assign(Object.assign({}, levelKey(this.level, row.category)), { [stackColumn]: seg.label, scenario });
|
|
18283
|
+
return { label: seg.label, value: seg.value, dataPoint };
|
|
18284
|
+
});
|
|
17401
18285
|
}
|
|
17402
18286
|
else {
|
|
17403
18287
|
row.stackSegments = [];
|
|
@@ -17818,7 +18702,7 @@ const Chart = class {
|
|
|
17818
18702
|
}
|
|
17819
18703
|
validateScenario(newValue) {
|
|
17820
18704
|
const errId = "WARN_scenarios";
|
|
17821
|
-
if (
|
|
18705
|
+
if (withTranslation.isInheritedValue(newValue)) {
|
|
17822
18706
|
this.errors.remove(errId);
|
|
17823
18707
|
return;
|
|
17824
18708
|
}
|
|
@@ -17836,7 +18720,7 @@ const Chart = class {
|
|
|
17836
18720
|
}
|
|
17837
18721
|
validateVariances(newValue) {
|
|
17838
18722
|
const errIdVar = "WARN_variances";
|
|
17839
|
-
if (
|
|
18723
|
+
if (withTranslation.isInheritedValue(newValue)) {
|
|
17840
18724
|
this.errors.remove(errIdVar);
|
|
17841
18725
|
return;
|
|
17842
18726
|
}
|
|
@@ -17871,7 +18755,7 @@ const Chart = class {
|
|
|
17871
18755
|
this.errors.remove(errId);
|
|
17872
18756
|
return;
|
|
17873
18757
|
}
|
|
17874
|
-
if (
|
|
18758
|
+
if (withTranslation.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
17875
18759
|
this.errors.addOrReplace({
|
|
17876
18760
|
id: errId,
|
|
17877
18761
|
type: "warning",
|
|
@@ -17888,7 +18772,7 @@ const Chart = class {
|
|
|
17888
18772
|
this.errors.remove(errId);
|
|
17889
18773
|
return;
|
|
17890
18774
|
}
|
|
17891
|
-
if (
|
|
18775
|
+
if (withTranslation.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
17892
18776
|
this.errors.addOrReplace({
|
|
17893
18777
|
id: errId,
|
|
17894
18778
|
type: "warning",
|
|
@@ -18173,7 +19057,7 @@ const Chart = class {
|
|
|
18173
19057
|
this.errors.addOrReplace({
|
|
18174
19058
|
id: "AUTO_unitScaling",
|
|
18175
19059
|
type: "warning",
|
|
18176
|
-
message: `unit-scaling: ${Chart.describeScalingInput(String((_e = this.unitScaling) !== null && _e !== void 0 ? _e : "").trim())}, auto-fitted to 1 em ≈ ${
|
|
19060
|
+
message: `unit-scaling: ${Chart.describeScalingInput(String((_e = this.unitScaling) !== null && _e !== void 0 ? _e : "").trim())}, auto-fitted to 1 em ≈ ${withTranslation.formatScalingValue(unitsPerEm)} units.`,
|
|
18177
19061
|
});
|
|
18178
19062
|
}
|
|
18179
19063
|
}
|
|
@@ -18184,14 +19068,14 @@ const Chart = class {
|
|
|
18184
19068
|
this.errors.addOrReplace({
|
|
18185
19069
|
id: "AUTO_percentageScaling",
|
|
18186
19070
|
type: "warning",
|
|
18187
|
-
message: `percentage-scaling: ${Chart.describeScalingInput(String((_f = this.percentageScaling) !== null && _f !== void 0 ? _f : "").trim())}, auto-fitted to 1 em ≈ ${
|
|
19071
|
+
message: `percentage-scaling: ${Chart.describeScalingInput(String((_f = this.percentageScaling) !== null && _f !== void 0 ? _f : "").trim())}, auto-fitted to 1 em ≈ ${withTranslation.formatScalingValue(ppPerEm)} percentage points.`,
|
|
18188
19072
|
});
|
|
18189
19073
|
}
|
|
18190
19074
|
}
|
|
18191
19075
|
};
|
|
18192
19076
|
withStyled.withStyled(this);
|
|
18193
19077
|
withHasError.withComponentStatus(this);
|
|
18194
|
-
|
|
19078
|
+
withTranslation.withDataset(this, (name, _data) => {
|
|
18195
19079
|
this.datasetName = (name === null || name === void 0 ? void 0 : name.startsWith("$")) ? name.substring(1) : name || "";
|
|
18196
19080
|
this.dataVersion = this.dataVersion + 1;
|
|
18197
19081
|
}, (_name, meta) => {
|
|
@@ -18202,8 +19086,8 @@ const Chart = class {
|
|
|
18202
19086
|
withScalingGroup(this);
|
|
18203
19087
|
this.componentStyle = withStyled.withComponentStyle(this);
|
|
18204
19088
|
this.ruleSetConfig = withRuleSet(this);
|
|
18205
|
-
this.t =
|
|
18206
|
-
this.resolveInherited =
|
|
19089
|
+
this.t = withTranslation.withTranslation(this).t;
|
|
19090
|
+
this.resolveInherited = withTranslation.withInheritedProps(this, [
|
|
18207
19091
|
{ propName: "scenarios", ancestorAttr: "title-scenarios" },
|
|
18208
19092
|
{ propName: "variances", ancestorAttr: "title-variances" },
|
|
18209
19093
|
], this.errors);
|
|
@@ -18274,7 +19158,7 @@ const Chart = class {
|
|
|
18274
19158
|
* construction, so it only fires when the content cannot fit at any scale.
|
|
18275
19159
|
*/
|
|
18276
19160
|
checkOverflow() {
|
|
18277
|
-
const parent =
|
|
19161
|
+
const parent = withTranslation.getParentDimensions(this.element);
|
|
18278
19162
|
const contentWidth = this.measureContentWidth();
|
|
18279
19163
|
const contentHeight = this.measureContentHeight();
|
|
18280
19164
|
const widthOver = parent.width > 0 && contentWidth > parent.width + 1;
|
|
@@ -18284,9 +19168,9 @@ const Chart = class {
|
|
|
18284
19168
|
return;
|
|
18285
19169
|
}
|
|
18286
19170
|
const hasRelativeVariance = this.prepareVariances().some((variance) => variance.startsWith("dr"));
|
|
18287
|
-
const fixedUnit =
|
|
18288
|
-
const fixedPercent = hasRelativeVariance &&
|
|
18289
|
-
const { mode } =
|
|
19171
|
+
const fixedUnit = withTranslation.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap).kind === "value";
|
|
19172
|
+
const fixedPercent = hasRelativeVariance && withTranslation.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap).kind === "value";
|
|
19173
|
+
const { mode } = withTranslation.parseScaling(this.scale);
|
|
18290
19174
|
const fixedScale = mode !== "auto" && mode !== "empty";
|
|
18291
19175
|
const fixedAttrs = [];
|
|
18292
19176
|
if (heightOver && fixedUnit)
|
|
@@ -18307,7 +19191,7 @@ const Chart = class {
|
|
|
18307
19191
|
}
|
|
18308
19192
|
componentDidRender() {
|
|
18309
19193
|
syncEmptyState(this.element, "bn-chart-time-renderer");
|
|
18310
|
-
const { mode } =
|
|
19194
|
+
const { mode } = withTranslation.parseScaling(this.scale);
|
|
18311
19195
|
if (mode !== "auto" && mode !== "empty") {
|
|
18312
19196
|
this._autoScaleGuard = false;
|
|
18313
19197
|
this.checkOverflow();
|
|
@@ -18319,7 +19203,7 @@ const Chart = class {
|
|
|
18319
19203
|
return;
|
|
18320
19204
|
}
|
|
18321
19205
|
const host = this.element;
|
|
18322
|
-
const { width: parentWidth } =
|
|
19206
|
+
const { width: parentWidth } = withTranslation.getParentDimensions(host);
|
|
18323
19207
|
if (parentWidth <= 0) {
|
|
18324
19208
|
this.checkOverflow();
|
|
18325
19209
|
return;
|
|
@@ -18371,7 +19255,7 @@ const Chart = class {
|
|
|
18371
19255
|
this.layoutObserver = observeParentResize(this.element, () => {
|
|
18372
19256
|
if (this._autoScaleGuard)
|
|
18373
19257
|
return;
|
|
18374
|
-
const { width } =
|
|
19258
|
+
const { width } = withTranslation.getParentDimensions(this.element);
|
|
18375
19259
|
// Only react to WIDTH changes - this chart scales by width.
|
|
18376
19260
|
// Height changes (e.g. from page-fit-to-content auto grid rows)
|
|
18377
19261
|
// are irrelevant and would cause an infinite render loop.
|
|
@@ -18386,7 +19270,7 @@ const Chart = class {
|
|
|
18386
19270
|
requestAnimationFrame(() => {
|
|
18387
19271
|
if (this._autoScaleGuard)
|
|
18388
19272
|
return;
|
|
18389
|
-
const { width } =
|
|
19273
|
+
const { width } = withTranslation.getParentDimensions(this.element);
|
|
18390
19274
|
this._lastObservedWidth = width;
|
|
18391
19275
|
index.forceUpdate(this);
|
|
18392
19276
|
});
|
|
@@ -18409,7 +19293,7 @@ const Chart = class {
|
|
|
18409
19293
|
this._settleTimer = null;
|
|
18410
19294
|
if (!this.element.isConnected)
|
|
18411
19295
|
return;
|
|
18412
|
-
const { height } =
|
|
19296
|
+
const { height } = withTranslation.getParentDimensions(this.element);
|
|
18413
19297
|
// 8px threshold: hydration corrections are large (hundreds of px);
|
|
18414
19298
|
// small jitter must not cause re-renders, because every re-render
|
|
18415
19299
|
// gives the width-overflow font scaler a chance to ratchet down.
|
|
@@ -18433,7 +19317,7 @@ const Chart = class {
|
|
|
18433
19317
|
}
|
|
18434
19318
|
}
|
|
18435
19319
|
prepareDimension() {
|
|
18436
|
-
const parent =
|
|
19320
|
+
const parent = withTranslation.getParentDimensions(this.element);
|
|
18437
19321
|
const scenariosList = this.prepareScenarios();
|
|
18438
19322
|
const variancesList = this.prepareVariances();
|
|
18439
19323
|
this.canvasWidthSegmented = parent.width / (scenariosList.length + variancesList.length || 1);
|
|
@@ -18535,7 +19419,7 @@ const Chart = class {
|
|
|
18535
19419
|
return raw === "" ? "not set" : `invalid value "${raw}"`;
|
|
18536
19420
|
}
|
|
18537
19421
|
preparePixelPerUnit() {
|
|
18538
|
-
const resolved =
|
|
19422
|
+
const resolved = withTranslation.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
18539
19423
|
if (resolved.kind === "value") {
|
|
18540
19424
|
this.errors.remove("AUTO_unitScaling");
|
|
18541
19425
|
this.autoUnitWarningActive = false;
|
|
@@ -18560,7 +19444,7 @@ const Chart = class {
|
|
|
18560
19444
|
return 0;
|
|
18561
19445
|
}
|
|
18562
19446
|
preparePixelPerPercentage() {
|
|
18563
|
-
const resolved =
|
|
19447
|
+
const resolved = withTranslation.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
18564
19448
|
if (resolved.kind === "value") {
|
|
18565
19449
|
this.errors.remove("AUTO_percentageScaling");
|
|
18566
19450
|
this.autoPctWarningActive = false;
|
|
@@ -18791,7 +19675,7 @@ const Chart = class {
|
|
|
18791
19675
|
chartTemplate(localScenarioString, idx) {
|
|
18792
19676
|
const preparedI18n = this.prepareI18n();
|
|
18793
19677
|
const preparedStyle = this.prepareStyle();
|
|
18794
|
-
const fullParentWidth =
|
|
19678
|
+
const fullParentWidth = withTranslation.getParentDimensions(this.element).width;
|
|
18795
19679
|
const ppu = this.preparePixelPerUnit();
|
|
18796
19680
|
const ppp = this.preparePixelPerPercentage();
|
|
18797
19681
|
const stackConfig = this.prepareStackConfig();
|
|
@@ -18851,7 +19735,7 @@ const Chart = class {
|
|
|
18851
19735
|
resolveScalingInfo(effFontPx) {
|
|
18852
19736
|
var _a, _b;
|
|
18853
19737
|
const info = {};
|
|
18854
|
-
const unit =
|
|
19738
|
+
const unit = withTranslation.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
18855
19739
|
if (unit.kind === "value") {
|
|
18856
19740
|
info.unitMode = "fixed";
|
|
18857
19741
|
info.unitsPerEm = unit.value;
|
|
@@ -18865,7 +19749,7 @@ const Chart = class {
|
|
|
18865
19749
|
info.unitsPerEm = effFontPx / pxPerUnit;
|
|
18866
19750
|
}
|
|
18867
19751
|
}
|
|
18868
|
-
const pct =
|
|
19752
|
+
const pct = withTranslation.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
18869
19753
|
if (pct.kind === "value") {
|
|
18870
19754
|
info.percentageMode = "fixed";
|
|
18871
19755
|
info.percentagePointsPerEm = pct.value;
|
|
@@ -18882,7 +19766,7 @@ const Chart = class {
|
|
|
18882
19766
|
return info;
|
|
18883
19767
|
}
|
|
18884
19768
|
getEffectiveScaleFactor() {
|
|
18885
|
-
const { mode, factor } =
|
|
19769
|
+
const { mode, factor } = withTranslation.parseScaling(this.scale);
|
|
18886
19770
|
if (mode === "factor")
|
|
18887
19771
|
return factor;
|
|
18888
19772
|
if (mode === "auto" || mode === "empty")
|
|
@@ -18915,7 +19799,7 @@ const Chart = class {
|
|
|
18915
19799
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
18916
19800
|
}
|
|
18917
19801
|
const fontStyles = this.getFontStyles();
|
|
18918
|
-
return (index.h(index.Host, { key: '
|
|
19802
|
+
return (index.h(index.Host, { key: '13fb6e9b83ed9de038f68a78d4e0ac4075606442', style: fontStyles }, index.h("div", { key: 'abdaf094fad7102521ff92f65a370d7ac48b71d8', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
18919
19803
|
}
|
|
18920
19804
|
get element() { return index.getElement(this); }
|
|
18921
19805
|
static get watchers() { return {
|
|
@@ -19834,6 +20718,7 @@ class Column {
|
|
|
19834
20718
|
return this;
|
|
19835
20719
|
}
|
|
19836
20720
|
draw(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
|
|
20721
|
+
var _a;
|
|
19837
20722
|
// TODE: JHE: Remove DataFOrmatDigits Type Duplicates
|
|
19838
20723
|
if (this.isEmpty()) {
|
|
19839
20724
|
return this;
|
|
@@ -19841,6 +20726,8 @@ class Column {
|
|
|
19841
20726
|
const scenarioStyle = this.getScenarioStyle();
|
|
19842
20727
|
const strokeStyle = this.convertToSVGStyle(scenarioStyle, "stroke");
|
|
19843
20728
|
const fillStyle = this.getFillStyle(scenarioStyle);
|
|
20729
|
+
this.scenarioGroup.attr(dataPointAttributes(this.dataPoint.key));
|
|
20730
|
+
(_a = this.columnGroup) === null || _a === void 0 ? void 0 : _a.attr(dataPointAttributes(this.dataPoint.key, "element"));
|
|
19844
20731
|
if (this.columnGroup != null) {
|
|
19845
20732
|
if (this.isOverflowing && this.overflowConfig) {
|
|
19846
20733
|
this.drawOverdriveBar(fillStyle, strokeStyle);
|
|
@@ -19984,7 +20871,7 @@ class Column {
|
|
|
19984
20871
|
const labelY = this.isOverflowing
|
|
19985
20872
|
? this.dimensions.labelYPos
|
|
19986
20873
|
: this.position.getColumnDataLabelPositionY(this.dataPoint.getScaledUnit());
|
|
19987
|
-
return new Label$1(this.scenarioGroup, this.position.getColumnCenterPositionX(this.index), labelY, this.ID_DATA_PREFIX, dataPoint.value, this.styles, labelHook, HookLocation$1.Center);
|
|
20874
|
+
return new Label$1(this.scenarioGroup, this.position.getColumnCenterPositionX(this.index), labelY, this.ID_DATA_PREFIX, dataPoint.value, this.styles, labelHook, HookLocation$1.Center).setPoint(dataPoint.key);
|
|
19988
20875
|
}
|
|
19989
20876
|
getScenarioLabel(columnLabel) {
|
|
19990
20877
|
if (this.isPrimaryColumn) {
|
|
@@ -20065,6 +20952,7 @@ class Marker {
|
|
|
20065
20952
|
this.scenario = scenario;
|
|
20066
20953
|
if ((dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.isEmpty()) !== true) {
|
|
20067
20954
|
this.hasData = true;
|
|
20955
|
+
this.pointKey = dataPoint.key;
|
|
20068
20956
|
this.dimensions = this.createMarkerDimensions(dataPoint, index, isPrimaryMarker);
|
|
20069
20957
|
this.scenarioLabel = this.getScenarioLabel(labelText, styles, isPrimaryMarker);
|
|
20070
20958
|
}
|
|
@@ -20083,6 +20971,7 @@ class Marker {
|
|
|
20083
20971
|
fillStyle = polygonPattern.pattern;
|
|
20084
20972
|
}
|
|
20085
20973
|
}
|
|
20974
|
+
this.markerGroup.attr(dataPointAttributes(this.pointKey));
|
|
20086
20975
|
this.markerGroup
|
|
20087
20976
|
.polygon(this.markerPattern.background)
|
|
20088
20977
|
.fill(whiteBorder)
|
|
@@ -20093,7 +20982,8 @@ class Marker {
|
|
|
20093
20982
|
.fill(fillStyle)
|
|
20094
20983
|
.stroke(strokeStyle)
|
|
20095
20984
|
.cy(this.dimensions.yPos - this.dimensions.columnLength)
|
|
20096
|
-
.cx(this.dimensions.xPos)
|
|
20985
|
+
.cx(this.dimensions.xPos)
|
|
20986
|
+
.attr(dataPointAttributes(this.pointKey, "element"));
|
|
20097
20987
|
if (this.scenarioLabel != null && !this.scenarioLabel.isEmpty()) {
|
|
20098
20988
|
this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos, this.dimensions.scenarioLabelYPos).draw();
|
|
20099
20989
|
}
|
|
@@ -20193,7 +21083,7 @@ class Needle {
|
|
|
20193
21083
|
this.hasData = true;
|
|
20194
21084
|
this.dimensions = this.createDimensions(position, dataPoint, index);
|
|
20195
21085
|
this.dataLabel = new Label$1(this.scenarioGroup, this.position.getColumnCenterPositionX(this.index), this.position.getNeedleDataLabelPositionY(this.dataPoint.getScaledPercentUnit()), this.ID_DATA_PREFIX, notAvailable ? withStyled.NOT_AVAILABLE : dataPoint.value, this.styles, HookLocation$1.Center, HookLocation$1.Center);
|
|
20196
|
-
this.dataLabel.setToRelativeVarianceLabel();
|
|
21086
|
+
this.dataLabel.setToRelativeVarianceLabel().setPoint(dataPoint.key);
|
|
20197
21087
|
}
|
|
20198
21088
|
}
|
|
20199
21089
|
updateLabelGroup(newGroup) {
|
|
@@ -20214,6 +21104,8 @@ class Needle {
|
|
|
20214
21104
|
if (this.isEmpty()) {
|
|
20215
21105
|
return this;
|
|
20216
21106
|
}
|
|
21107
|
+
this.scenarioGroup.attr(dataPointAttributes(this.dataPoint.key));
|
|
21108
|
+
this.barGroup.attr(dataPointAttributes(this.dataPoint.key, "element"));
|
|
20217
21109
|
const scenarioStyle = this.styles.varianceStyles[this.dataPoint.getVarianceStyle()];
|
|
20218
21110
|
const strokeStyle = this.convertToSVGStyle(scenarioStyle, "stroke");
|
|
20219
21111
|
let fillStyle = this.convertToSVGStyle(scenarioStyle, "fill");
|
|
@@ -20384,7 +21276,7 @@ class LineSeries {
|
|
|
20384
21276
|
*/
|
|
20385
21277
|
drawSquareMarker(group, cx, cy, style) {
|
|
20386
21278
|
const halfSize = this.MARKER_SIZE / 2;
|
|
20387
|
-
group
|
|
21279
|
+
return group
|
|
20388
21280
|
.rect(this.MARKER_SIZE, this.MARKER_SIZE)
|
|
20389
21281
|
.fill(style.markerFill)
|
|
20390
21282
|
.stroke({ color: style.markerStroke, width: 1 })
|
|
@@ -20394,7 +21286,7 @@ class LineSeries {
|
|
|
20394
21286
|
* Draws a circle marker (variant 2: ac2, pp2, fc2, pl2)
|
|
20395
21287
|
*/
|
|
20396
21288
|
drawCircleMarker(group, cx, cy, style) {
|
|
20397
|
-
group
|
|
21289
|
+
return group
|
|
20398
21290
|
.circle(this.MARKER_SIZE)
|
|
20399
21291
|
.fill(style.markerFill)
|
|
20400
21292
|
.stroke({ color: style.markerStroke, width: 1 })
|
|
@@ -20405,7 +21297,7 @@ class LineSeries {
|
|
|
20405
21297
|
*/
|
|
20406
21298
|
drawTriangleMarker(group, cx, cy, style) {
|
|
20407
21299
|
const s = this.MARKER_SIZE / 2;
|
|
20408
|
-
group
|
|
21300
|
+
return group
|
|
20409
21301
|
.polygon(`${cx},${cy - s} ${cx - s},${cy + s} ${cx + s},${cy + s}`)
|
|
20410
21302
|
.fill(style.markerFill)
|
|
20411
21303
|
.stroke({ color: style.markerStroke, width: 1 });
|
|
@@ -20415,7 +21307,7 @@ class LineSeries {
|
|
|
20415
21307
|
*/
|
|
20416
21308
|
drawDiamondMarker(group, cx, cy, style) {
|
|
20417
21309
|
const s = this.MARKER_SIZE / 2;
|
|
20418
|
-
group
|
|
21310
|
+
return group
|
|
20419
21311
|
.polygon(`${cx},${cy - s} ${cx + s},${cy} ${cx},${cy + s} ${cx - s},${cy}`)
|
|
20420
21312
|
.fill(style.markerFill)
|
|
20421
21313
|
.stroke({ color: style.markerStroke, width: 1 });
|
|
@@ -20459,20 +21351,22 @@ class LineSeries {
|
|
|
20459
21351
|
const centerX = this.position.getColumnCenterPositionX(point.index);
|
|
20460
21352
|
const centerY = this.position.getColumnPositionY() - point.dataPoint.getScaledUnit();
|
|
20461
21353
|
// Draw marker shape based on scenario variant
|
|
21354
|
+
let marker;
|
|
20462
21355
|
switch (variant) {
|
|
20463
21356
|
case 2:
|
|
20464
|
-
this.drawCircleMarker(markerGroup, centerX, centerY, lineStyle);
|
|
21357
|
+
marker = this.drawCircleMarker(markerGroup, centerX, centerY, lineStyle);
|
|
20465
21358
|
break;
|
|
20466
21359
|
case 3:
|
|
20467
|
-
this.drawTriangleMarker(markerGroup, centerX, centerY, lineStyle);
|
|
21360
|
+
marker = this.drawTriangleMarker(markerGroup, centerX, centerY, lineStyle);
|
|
20468
21361
|
break;
|
|
20469
21362
|
case 4:
|
|
20470
|
-
this.drawDiamondMarker(markerGroup, centerX, centerY, lineStyle);
|
|
21363
|
+
marker = this.drawDiamondMarker(markerGroup, centerX, centerY, lineStyle);
|
|
20471
21364
|
break;
|
|
20472
21365
|
default: // variant 1 or unknown
|
|
20473
|
-
this.drawSquareMarker(markerGroup, centerX, centerY, lineStyle);
|
|
21366
|
+
marker = this.drawSquareMarker(markerGroup, centerX, centerY, lineStyle);
|
|
20474
21367
|
break;
|
|
20475
21368
|
}
|
|
21369
|
+
marker.attr(dataPointAttributes(point.dataPoint.key, "element")).attr("data-bn-index", String(point.index));
|
|
20476
21370
|
}
|
|
20477
21371
|
}
|
|
20478
21372
|
/**
|
|
@@ -20540,7 +21434,7 @@ class LineSeries {
|
|
|
20540
21434
|
this.collisionManager.register(bounds);
|
|
20541
21435
|
}
|
|
20542
21436
|
const label = new Label$1(this.labelGroup, labelX, labelY, this.ID_LABEL_PREFIX, point.dataPoint.value, this.styles, verticalHook, horizontalHook);
|
|
20543
|
-
label.draw(true, dataFormatDigits, measureScale);
|
|
21437
|
+
label.setPoint(point.dataPoint.key).draw(true, dataFormatDigits, measureScale);
|
|
20544
21438
|
}
|
|
20545
21439
|
}
|
|
20546
21440
|
drawScenarioLabel() {
|
|
@@ -20621,6 +21515,7 @@ class StackedColumn {
|
|
|
20621
21515
|
const fillColor = colors[this.segmentIndex % colors.length];
|
|
20622
21516
|
const fillStyle = { color: fillColor };
|
|
20623
21517
|
const strokeStyle = { color: fillColor, width: 0.5 };
|
|
21518
|
+
this.columnGroup.attr(dataPointAttributes(this.dataPoint.key, "element"));
|
|
20624
21519
|
// Draw rectangle
|
|
20625
21520
|
this.columnGroup
|
|
20626
21521
|
.rect(columnWidth, Math.max(segmentHeight, 0.5))
|
|
@@ -20636,12 +21531,14 @@ class StackedColumn {
|
|
|
20636
21531
|
const labelValue = Formatter.number(this.segment.share, "percent", dataFormatDigits.percent, dataFormatDigits.percent, 1, this.styles.locale);
|
|
20637
21532
|
new Label$1(this.group, xPos, labelY, "STACK_SEG", labelValue, this.styles, HookLocation$1.Center, HookLocation$1.Center)
|
|
20638
21533
|
.setSegmentFill(fillColor)
|
|
21534
|
+
.setPoint(this.dataPoint.key)
|
|
20639
21535
|
.forceStringTypeDraw();
|
|
20640
21536
|
}
|
|
20641
21537
|
else {
|
|
20642
21538
|
// Pass raw numeric value - Label.draw() formats with measureScale
|
|
20643
21539
|
new Label$1(this.group, xPos, labelY, "STACK_SEG", value, this.styles, HookLocation$1.Center, HookLocation$1.Center)
|
|
20644
21540
|
.setSegmentFill(fillColor)
|
|
21541
|
+
.setPoint(this.dataPoint.key)
|
|
20645
21542
|
.draw(true, dataFormatDigits, measureScale);
|
|
20646
21543
|
}
|
|
20647
21544
|
}
|
|
@@ -20649,7 +21546,7 @@ class StackedColumn {
|
|
|
20649
21546
|
/**
|
|
20650
21547
|
* Draw the signed total of the stack: above the positive side, or below the negative side for a negative total.
|
|
20651
21548
|
*/
|
|
20652
|
-
drawTotalLabel(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
|
|
21549
|
+
drawTotalLabel(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix(), key) {
|
|
20653
21550
|
if (this.stackMode === withStyled.StackMode.RELATIVE) {
|
|
20654
21551
|
// Don't show total for 100% stacked (always 100%)
|
|
20655
21552
|
return;
|
|
@@ -20660,7 +21557,7 @@ class StackedColumn {
|
|
|
20660
21557
|
const xPos = this.position.getColumnCenterPositionX(this.index);
|
|
20661
21558
|
const labelY = this.position.getColumnDataLabelPositionY(end * this.dataPoint.pixelPerUnit);
|
|
20662
21559
|
const label = new Label$1(this.group, xPos, labelY, "STACK_TOTAL", this.stack.total, this.styles, isNegative ? HookLocation$1.Top : HookLocation$1.Bottom, HookLocation$1.Center);
|
|
20663
|
-
label.draw(true, dataFormatDigits, measureScale);
|
|
21560
|
+
label.setPoint(key, "total").draw(true, dataFormatDigits, measureScale);
|
|
20664
21561
|
}
|
|
20665
21562
|
}
|
|
20666
21563
|
|
|
@@ -21848,6 +22745,7 @@ class TimeChart {
|
|
|
21848
22745
|
return result;
|
|
21849
22746
|
}
|
|
21850
22747
|
createDataRows(result, selectedScenarios) {
|
|
22748
|
+
var _a;
|
|
21851
22749
|
const dataModel = [];
|
|
21852
22750
|
result.forEach((element, index) => {
|
|
21853
22751
|
dataModel.push({
|
|
@@ -21862,8 +22760,21 @@ class TimeChart {
|
|
|
21862
22760
|
});
|
|
21863
22761
|
//}
|
|
21864
22762
|
});
|
|
22763
|
+
for (const entry of dataModel) {
|
|
22764
|
+
for (const dataPoint of [entry.scenario1, entry.scenario2, entry.scenario3, entry.scenario4]) {
|
|
22765
|
+
// a bucket without a value has a bar of height 0: nothing an annotation can point at
|
|
22766
|
+
if (dataPoint.value != null && !Number.isNaN(dataPoint.value)) {
|
|
22767
|
+
dataPoint.key = { date: TimeChart.pointDate(entry.date), scenario: (_a = dataPoint.scenario) !== null && _a !== void 0 ? _a : undefined };
|
|
22768
|
+
}
|
|
22769
|
+
}
|
|
22770
|
+
}
|
|
21865
22771
|
return dataModel;
|
|
21866
22772
|
}
|
|
22773
|
+
/** The bucket a point belongs to. */
|
|
22774
|
+
static pointDate(date) {
|
|
22775
|
+
var _a;
|
|
22776
|
+
return pointDate((_a = date === null || date === void 0 ? void 0 : date.toISO) === null || _a === void 0 ? void 0 : _a.call(date));
|
|
22777
|
+
}
|
|
21867
22778
|
findSmallestDataPointValue(dataModel) {
|
|
21868
22779
|
const pixel = this.isVarianceChart() ? this.pixelPerPercentage : this.pixelPerUnit;
|
|
21869
22780
|
let smallestDataPoint = new DataPoint(0, "default", pixel, Scenario.NEU);
|
|
@@ -21908,12 +22819,19 @@ class TimeChart {
|
|
|
21908
22819
|
const directon = scenarios.direction;
|
|
21909
22820
|
const pixelPerUnit = scenarios.type === "dr" ? this.pixelPerPercentage : this.pixelPerUnit;
|
|
21910
22821
|
for (const index in dataModel) {
|
|
22822
|
+
const point = new DataPoint(this.calculateVariance(scenarios, dataModel[index], scenariomap), scenarios.delta, pixelPerUnit, directon);
|
|
22823
|
+
if (point.value !== null && !Number.isNaN(point.value)) {
|
|
22824
|
+
point.key = {
|
|
22825
|
+
date: TimeChart.pointDate(dataModel[index].date),
|
|
22826
|
+
scenario: variancesConfig[varianceScenario],
|
|
22827
|
+
};
|
|
22828
|
+
}
|
|
21911
22829
|
varianceModel.push({
|
|
21912
22830
|
id: Number(index),
|
|
21913
22831
|
category: dataModel[index].category,
|
|
21914
22832
|
type: scenarios.type === "dr" ? VarianceType.RELATIVE : VarianceType.ABSOLUTE,
|
|
21915
22833
|
date: dataModel[index].date,
|
|
21916
|
-
scenario1:
|
|
22834
|
+
scenario1: point,
|
|
21917
22835
|
scenario2: new DataPoint(null, null, null, null),
|
|
21918
22836
|
scenario3: new DataPoint(null, null, null, null),
|
|
21919
22837
|
scenario4: new DataPoint(null, null, null, null),
|
|
@@ -22357,7 +23275,11 @@ class TimeChart {
|
|
|
22357
23275
|
lastColumn = column;
|
|
22358
23276
|
});
|
|
22359
23277
|
if (lastColumn && group.hasValue) {
|
|
22360
|
-
|
|
23278
|
+
// an overlay has one total per scenario family: the family tells them apart
|
|
23279
|
+
lastColumn.drawTotalLabel(this.dataFormatDigits, this.measureScale, {
|
|
23280
|
+
date: TimeChart.pointDate(elements.date),
|
|
23281
|
+
scenario: groups.length > 1 ? group.prefix : undefined,
|
|
23282
|
+
});
|
|
22361
23283
|
}
|
|
22362
23284
|
});
|
|
22363
23285
|
});
|
|
@@ -23127,7 +24049,7 @@ const ComponentStyle = class {
|
|
|
23127
24049
|
});
|
|
23128
24050
|
}
|
|
23129
24051
|
render() {
|
|
23130
|
-
return index.h(index.Host, { key: '
|
|
24052
|
+
return index.h(index.Host, { key: '443fd52bc75e267b8699e29f754a15130f444315' });
|
|
23131
24053
|
}
|
|
23132
24054
|
get element() { return index.getElement(this); }
|
|
23133
24055
|
};
|
|
@@ -23228,7 +24150,7 @@ const read = (element, property, attribute) => {
|
|
|
23228
24150
|
return property in element ? null : element.getAttribute(attribute);
|
|
23229
24151
|
};
|
|
23230
24152
|
/** Every visual bn-* component; non-visual producers (bn-dataset, ...) are excluded. */
|
|
23231
|
-
const VISUAL_SELECTOR = "bn-body, bn-card, bn-chart-bubble, bn-chart-bullet, bn-chart-scatter, " +
|
|
24153
|
+
const VISUAL_SELECTOR = "bn-annotation-layer, bn-annotation-list, bn-body, bn-card, bn-chart-bubble, bn-chart-bullet, bn-chart-scatter, " +
|
|
23232
24154
|
"bn-chart-structure, bn-chart-time, bn-footer, bn-grid, bn-image, " +
|
|
23233
24155
|
"bn-layout-card, bn-layout-page, bn-message, bn-page, bn-table, " +
|
|
23234
24156
|
"bn-text, bn-title, bn-tree";
|
|
@@ -23393,7 +24315,7 @@ const Context = class {
|
|
|
23393
24315
|
componentWillUpdate() { }
|
|
23394
24316
|
componentDidUpdate() { }
|
|
23395
24317
|
render() {
|
|
23396
|
-
return (index.h(index.Host, { key: '
|
|
24318
|
+
return (index.h(index.Host, { key: 'a50946d9cb100a1644a2c758af7854900826c5ce' }, index.h("slot", { key: 'c02525871433af7bb15f39c62c1417365a28d931' })));
|
|
23397
24319
|
}
|
|
23398
24320
|
get element() { return index.getElement(this); }
|
|
23399
24321
|
static get watchers() { return {
|
|
@@ -24417,7 +25339,7 @@ const Dataset = class {
|
|
|
24417
25339
|
}
|
|
24418
25340
|
}
|
|
24419
25341
|
render() {
|
|
24420
|
-
return index.h(index.Host, { key: '
|
|
25342
|
+
return index.h(index.Host, { key: '9a491c13d9ad8fba5da3c30f502a027a5ae1c606' });
|
|
24421
25343
|
}
|
|
24422
25344
|
get element() { return index.getElement(this); }
|
|
24423
25345
|
static get watchers() { return {
|
|
@@ -24662,7 +25584,7 @@ const Datasource = class {
|
|
|
24662
25584
|
}
|
|
24663
25585
|
}
|
|
24664
25586
|
render() {
|
|
24665
|
-
return index.h(index.Host, { key: '
|
|
25587
|
+
return index.h(index.Host, { key: '323018b2b642f9905874f94010c75b19bebde639' });
|
|
24666
25588
|
}
|
|
24667
25589
|
get element() { return index.getElement(this); }
|
|
24668
25590
|
static get watchers() { return {
|
|
@@ -24709,7 +25631,7 @@ const Footer$1 = class Footer {
|
|
|
24709
25631
|
});
|
|
24710
25632
|
}
|
|
24711
25633
|
render() {
|
|
24712
|
-
return (index.h(index.Host, { key: '
|
|
25634
|
+
return (index.h(index.Host, { key: 'af4dda021b22094c4c55e25eb34da67dc1a8e41d', id: this.displayPageNumber || this.text ? "container-page-footer" : "container", style: this.getFontStyles() }, index.h("div", { key: 'f059b4ca265505730e9e384704d3b74579e3af9f', id: "footer-text" }, this.text != null ? index.h("span", { class: "note" }, this.text) : ""), index.h("div", { key: '0c00b17953457763640c4ebad3e0eb99ea742bfd', id: "page-number" }, this.displayPageNumber ? index.h("span", { class: "page" }, this.pageNumber) : "")));
|
|
24713
25635
|
}
|
|
24714
25636
|
get element() { return index.getElement(this); }
|
|
24715
25637
|
};
|
|
@@ -24912,7 +25834,7 @@ const LayoutCard = class {
|
|
|
24912
25834
|
this.cardShowBorder = true;
|
|
24913
25835
|
withHasError.withComponentStatus(this);
|
|
24914
25836
|
this.errors = withHasError.withHasError(this);
|
|
24915
|
-
this.resolveInherited =
|
|
25837
|
+
this.resolveInherited = withTranslation.withInheritedProps(this, [
|
|
24916
25838
|
{ propName: "titleScenarios", ancestorAttr: "title-scenarios" },
|
|
24917
25839
|
{ propName: "titleVariances", ancestorAttr: "title-variances" },
|
|
24918
25840
|
{ propName: "titleOrder", ancestorAttr: "title-order" },
|
|
@@ -25015,7 +25937,7 @@ const LayoutCard = class {
|
|
|
25015
25937
|
var _a;
|
|
25016
25938
|
const style = this.getLayoutStyle();
|
|
25017
25939
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
25018
|
-
return (index.h("bn-card", { key: '
|
|
25940
|
+
return (index.h("bn-card", { key: '867690c16715585ca9f879ac80e00c95cb37b577', styles: this.styles, "selected-style": this.selectedStyle, class: this.setCardClass() }, index.h("div", { key: 'c25c8e5aec46acebe38d6fac2a4516f41d25fe90', class: "cardtitle" }, index.h("bn-title", { key: '8a3da2a58cb7fb72fddcd838f27a1b231c2805e2', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : this.titleNamespace, ruleset: this.titleProp("ruleset"), "business-unit": this.titleBusinessUnit, scenarios: this.titleProp("titleScenarios"), variances: this.titleProp("titleVariances"), order: this.titleProp("titleOrder"), "order-direction": this.titleProp("titleOrderDirection"), measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), this.titleImage != null && this.titleImage !== "" ? (index.h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), index.h("bn-body", { key: 'c0616d184dce59190238ceb98ecd2828e65991af' }, index.h("div", { key: '42596bc88ddf38c2b820de17a69091df2e3c4227', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: 'ca29bc6d17eb385b3ded5fb46e0efe1ee228e405', text: this.footerText, "page-number": "0", "display-page-number": "false" })));
|
|
25019
25941
|
}
|
|
25020
25942
|
get element() { return index.getElement(this); }
|
|
25021
25943
|
};
|
|
@@ -25251,7 +26173,7 @@ const LayoutPage = class {
|
|
|
25251
26173
|
const style = this.getLayoutStyle();
|
|
25252
26174
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
25253
26175
|
const rotation = this.rotation();
|
|
25254
|
-
return (index.h(index.Host, { key: '
|
|
26176
|
+
return (index.h(index.Host, { key: 'a0553f8e1fcb8c16e5f1119adf3287f47431a032', style: rotation === null || rotation === void 0 ? void 0 : rotation.host }, index.h("bn-page", { key: 'f29c2a88180e49ebda60f858e82d3836be79c275', styles: this.styles, "selected-style": this.selectedStyle, format: this.pageFormat, orientation: this.pageOrientation, style: rotation === null || rotation === void 0 ? void 0 : rotation.page }, index.h("bn-message", { key: '114f2a708fbd24a287870773450a7372417f966c', text: this.messageText, image: this.messageImage }), index.h("bn-title", { key: '0413e2645444d2410114bce588ab41aaf8c645ac', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : this.titleNamespace, ruleset: this.ruleset, "business-unit": this.titleBusinessUnit, scenarios: this.titleScenarios, variances: this.titleVariances, order: this.titleOrder, "order-direction": this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), index.h("bn-body", { key: '0ca2389cec30412f58995abc6ec5fb921895da8b' }, index.h("div", { key: 'a3718ddafecff39d38bf608b4e28f4bc04139c45', style: style, "data-bn-fit-content": this.pageFitToContent ? String(this.getRowCount(this.pageLayout)) : null }, this.getSlots(arrOfSlots)), index.h("slot", { key: '9e6a0d1077e33e95f4cba0398f62cf5579b52eb8', name: "annotations" })), index.h("bn-footer", { key: 'c19b05ac728b4a51e02c53903da2d436d72e19c5', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber }))));
|
|
25255
26177
|
}
|
|
25256
26178
|
get element() { return index.getElement(this); }
|
|
25257
26179
|
};
|
|
@@ -25292,7 +26214,7 @@ const Footer = class {
|
|
|
25292
26214
|
return assetsState[value] || value;
|
|
25293
26215
|
}
|
|
25294
26216
|
render() {
|
|
25295
|
-
return (index.h(index.Host, { key: '
|
|
26217
|
+
return (index.h(index.Host, { key: '4de8953156b05196149fe7a89e2b6a2d9f831695', id: this.text || this.image ? "container-page-message" : "container", style: this.getFontStyles() }, index.h("div", { key: 'ca005a6c2c06b59facea40c0aab4e146d51be557', id: "message-text" }, this.text != null && this.text !== "" ? index.h("span", { class: "note", innerHTML: withTranslation.sanitizeHtml(this.text) }) : ""), index.h("div", { key: '8fbdc7014401f0f02ef5c79b37bcc57b29a18a59', id: "page-image" }, this.image != null && this.image !== "" ? index.h("img", { class: "image", src: this.prepareAssetUrl(this.image) }) : "")));
|
|
25296
26218
|
}
|
|
25297
26219
|
get element() { return index.getElement(this); }
|
|
25298
26220
|
};
|
|
@@ -25339,7 +26261,7 @@ const Page = class {
|
|
|
25339
26261
|
this.validateOrientation(this.orientation);
|
|
25340
26262
|
}
|
|
25341
26263
|
render() {
|
|
25342
|
-
return (index.h(index.Host, { key: '
|
|
26264
|
+
return (index.h(index.Host, { key: 'b2d1a2638c7bee2b2e134d5fedbac63fe38e9830', format: this.format, orientation: this.orientation, style: this.prepareStyle() }, index.h("slot", { key: '4769d18000916a16ee9da8fb0c19b5d8b12393c0' })));
|
|
25343
26265
|
}
|
|
25344
26266
|
prepareStyle() {
|
|
25345
26267
|
const pageStyle = {
|
|
@@ -25417,7 +26339,7 @@ const ScalingGroup = class {
|
|
|
25417
26339
|
if (!this.stores)
|
|
25418
26340
|
return;
|
|
25419
26341
|
const trimmedName = (_a = this.name) === null || _a === void 0 ? void 0 : _a.toString().trim();
|
|
25420
|
-
const nameParse =
|
|
26342
|
+
const nameParse = withTranslation.parseScalingValue(trimmedName);
|
|
25421
26343
|
// Validate: "auto" is reserved
|
|
25422
26344
|
if (nameParse.kind === "auto") {
|
|
25423
26345
|
this.errors.addOrReplace({
|
|
@@ -25448,7 +26370,7 @@ const ScalingGroup = class {
|
|
|
25448
26370
|
return;
|
|
25449
26371
|
}
|
|
25450
26372
|
this.errors.remove("WARN_numeric_name");
|
|
25451
|
-
const parsedValue =
|
|
26373
|
+
const parsedValue = withTranslation.parseScalingValue(this.value);
|
|
25452
26374
|
if (parsedValue.kind !== "number") {
|
|
25453
26375
|
this.errors.addOrReplace({
|
|
25454
26376
|
id: "WARN_invalid_value",
|
|
@@ -25464,7 +26386,7 @@ const ScalingGroup = class {
|
|
|
25464
26386
|
this.errors.addOrReplace({
|
|
25465
26387
|
id: "WARN_duplicate_group",
|
|
25466
26388
|
type: "warning",
|
|
25467
|
-
message: `bn-scaling-group: "${trimmedName}" is already registered with a different value (${
|
|
26389
|
+
message: `bn-scaling-group: "${trimmedName}" is already registered with a different value (${withTranslation.formatScalingValue(existing)}); overwriting.`,
|
|
25468
26390
|
});
|
|
25469
26391
|
}
|
|
25470
26392
|
else {
|
|
@@ -25479,7 +26401,7 @@ const ScalingGroup = class {
|
|
|
25479
26401
|
this.storedValue = parsedValue.value;
|
|
25480
26402
|
}
|
|
25481
26403
|
render() {
|
|
25482
|
-
return index.h(index.Host, { key: '
|
|
26404
|
+
return index.h(index.Host, { key: 'db1fe7bbe3d3caf76ad32eac64f944eef10b1ccd' });
|
|
25483
26405
|
}
|
|
25484
26406
|
get element() { return index.getElement(this); }
|
|
25485
26407
|
static get watchers() { return {
|
|
@@ -25563,6 +26485,10 @@ const INTERVAL_NONE = "none";
|
|
|
25563
26485
|
const INTERVAL_SETNAME = "setname";
|
|
25564
26486
|
/** Label rendered for the bucket collecting rows with a blank setname. */
|
|
25565
26487
|
const BLANK_BUCKET_LABEL = "-";
|
|
26488
|
+
/** True for all date-based interval values (everything except none/setname). */
|
|
26489
|
+
function isDateInterval(interval) {
|
|
26490
|
+
return interval !== INTERVAL_NONE && interval !== INTERVAL_SETNAME;
|
|
26491
|
+
}
|
|
25566
26492
|
/**
|
|
25567
26493
|
* SQL expression computing the bucket value of a source row.
|
|
25568
26494
|
* Dates are normalized to the start of their bucket via the `normalizeDate`
|
|
@@ -25984,7 +26910,7 @@ const Table$1 = class Table {
|
|
|
25984
26910
|
this.errors.addOrReplace({
|
|
25985
26911
|
id: "AUTO_unitScaling",
|
|
25986
26912
|
type: "warning",
|
|
25987
|
-
message: `unit-scaling: invalid value "${this.unitScaling}" - auto-fitted to 1 em ≈ ${
|
|
26913
|
+
message: `unit-scaling: invalid value "${this.unitScaling}" - auto-fitted to 1 em ≈ ${withTranslation.formatScalingValue(unitsPerEm)} units.`,
|
|
25988
26914
|
});
|
|
25989
26915
|
}
|
|
25990
26916
|
}
|
|
@@ -25995,7 +26921,7 @@ const Table$1 = class Table {
|
|
|
25995
26921
|
this.errors.addOrReplace({
|
|
25996
26922
|
id: "AUTO_percentageScaling",
|
|
25997
26923
|
type: "warning",
|
|
25998
|
-
message: `percentage-scaling: invalid value "${this.percentageScaling}" - auto-fitted to 1 em ≈ ${
|
|
26924
|
+
message: `percentage-scaling: invalid value "${this.percentageScaling}" - auto-fitted to 1 em ≈ ${withTranslation.formatScalingValue(ppPerEm)} percentage points.`,
|
|
25999
26925
|
});
|
|
26000
26926
|
}
|
|
26001
26927
|
}
|
|
@@ -26006,7 +26932,7 @@ const Table$1 = class Table {
|
|
|
26006
26932
|
withScalingGroup(this);
|
|
26007
26933
|
this.componentStyle = withStyled.withComponentStyle(this);
|
|
26008
26934
|
this.ruleSetConfig = withRuleSet(this);
|
|
26009
|
-
|
|
26935
|
+
withTranslation.withDataset(this, (name, data) => {
|
|
26010
26936
|
// Helpers query the shared alasql database directly by name; we just
|
|
26011
26937
|
// record the active dataset and bump a version counter so Stencil
|
|
26012
26938
|
// re-renders when the data changes.
|
|
@@ -26017,8 +26943,8 @@ const Table$1 = class Table {
|
|
|
26017
26943
|
}, (_name, meta) => {
|
|
26018
26944
|
this.datasetMeta = meta;
|
|
26019
26945
|
});
|
|
26020
|
-
this.t =
|
|
26021
|
-
this.resolveInherited =
|
|
26946
|
+
this.t = withTranslation.withTranslation(this).t;
|
|
26947
|
+
this.resolveInherited = withTranslation.withInheritedProps(this, [
|
|
26022
26948
|
{ propName: "scenarios", ancestorAttr: "title-scenarios" },
|
|
26023
26949
|
{ propName: "variances", ancestorAttr: "title-variances" },
|
|
26024
26950
|
{ propName: "order", ancestorAttr: "title-order" },
|
|
@@ -26040,7 +26966,7 @@ const Table$1 = class Table {
|
|
|
26040
26966
|
}
|
|
26041
26967
|
validateScenario(newValue) {
|
|
26042
26968
|
const errId = "WARN_scenarios";
|
|
26043
|
-
if (
|
|
26969
|
+
if (withTranslation.isInheritedValue(newValue)) {
|
|
26044
26970
|
this.errors.remove(errId);
|
|
26045
26971
|
return;
|
|
26046
26972
|
}
|
|
@@ -26058,7 +26984,7 @@ const Table$1 = class Table {
|
|
|
26058
26984
|
}
|
|
26059
26985
|
validateVariances(newValue) {
|
|
26060
26986
|
const errId = "WARN_variances";
|
|
26061
|
-
if (
|
|
26987
|
+
if (withTranslation.isInheritedValue(newValue)) {
|
|
26062
26988
|
this.errors.remove(errId);
|
|
26063
26989
|
return;
|
|
26064
26990
|
}
|
|
@@ -26107,7 +27033,7 @@ const Table$1 = class Table {
|
|
|
26107
27033
|
}
|
|
26108
27034
|
validateUnitScaling(newValue) {
|
|
26109
27035
|
const errId = "WARN_unitScaling";
|
|
26110
|
-
if (
|
|
27036
|
+
if (withTranslation.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
26111
27037
|
this.errors.addOrReplace({
|
|
26112
27038
|
id: errId,
|
|
26113
27039
|
type: "warning",
|
|
@@ -26120,7 +27046,7 @@ const Table$1 = class Table {
|
|
|
26120
27046
|
}
|
|
26121
27047
|
validatePercentageScaling(newValue) {
|
|
26122
27048
|
const errId = "WARN_percentageScaling";
|
|
26123
|
-
if (
|
|
27049
|
+
if (withTranslation.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
26124
27050
|
this.errors.addOrReplace({
|
|
26125
27051
|
id: errId,
|
|
26126
27052
|
type: "warning",
|
|
@@ -26200,7 +27126,7 @@ const Table$1 = class Table {
|
|
|
26200
27126
|
}
|
|
26201
27127
|
validateOrderList(newValue) {
|
|
26202
27128
|
const errId = "WARN_order";
|
|
26203
|
-
if (
|
|
27129
|
+
if (withTranslation.isInheritedValue(newValue)) {
|
|
26204
27130
|
this.errors.remove(errId);
|
|
26205
27131
|
return;
|
|
26206
27132
|
}
|
|
@@ -26218,7 +27144,7 @@ const Table$1 = class Table {
|
|
|
26218
27144
|
}
|
|
26219
27145
|
validateOrderDirection(newValue) {
|
|
26220
27146
|
const errId = "WARN_orderDirection";
|
|
26221
|
-
if (
|
|
27147
|
+
if (withTranslation.isInheritedValue(newValue)) {
|
|
26222
27148
|
this.errors.remove(errId);
|
|
26223
27149
|
return;
|
|
26224
27150
|
}
|
|
@@ -26371,7 +27297,7 @@ const Table$1 = class Table {
|
|
|
26371
27297
|
this.layoutObserver = observeParentResize(this.element, () => {
|
|
26372
27298
|
if (this._autoScaleGuard)
|
|
26373
27299
|
return;
|
|
26374
|
-
const { width } =
|
|
27300
|
+
const { width } = withTranslation.getParentDimensions(this.element);
|
|
26375
27301
|
// Only react to WIDTH changes - table scales by width.
|
|
26376
27302
|
// Height changes (e.g. from page-fit-to-content auto grid rows)
|
|
26377
27303
|
// are irrelevant and would cause an infinite render loop.
|
|
@@ -26388,7 +27314,7 @@ const Table$1 = class Table {
|
|
|
26388
27314
|
}
|
|
26389
27315
|
componentDidRender() {
|
|
26390
27316
|
syncEmptyState(this.element, "bn-table-renderer");
|
|
26391
|
-
const { mode } =
|
|
27317
|
+
const { mode } = withTranslation.parseScaling(this.scale);
|
|
26392
27318
|
// Only auto-scale for 'auto' and 'empty' (blank) modes
|
|
26393
27319
|
if (mode !== "auto" && mode !== "empty") {
|
|
26394
27320
|
this._autoScaleGuard = false;
|
|
@@ -26402,7 +27328,7 @@ const Table$1 = class Table {
|
|
|
26402
27328
|
return;
|
|
26403
27329
|
}
|
|
26404
27330
|
const host = this.element;
|
|
26405
|
-
const { width: parentWidth } =
|
|
27331
|
+
const { width: parentWidth } = withTranslation.getParentDimensions(host);
|
|
26406
27332
|
if (parentWidth <= 0) {
|
|
26407
27333
|
this.checkOverflow();
|
|
26408
27334
|
return;
|
|
@@ -26461,7 +27387,7 @@ const Table$1 = class Table {
|
|
|
26461
27387
|
* In auto mode it is a warning.
|
|
26462
27388
|
*/
|
|
26463
27389
|
checkOverflow() {
|
|
26464
|
-
const parent =
|
|
27390
|
+
const parent = withTranslation.getParentDimensions(this.element);
|
|
26465
27391
|
const contentWidth = this.element.scrollWidth;
|
|
26466
27392
|
const contentHeight = this.element.scrollHeight;
|
|
26467
27393
|
const widthOver = parent.width > 0 && contentWidth > parent.width + 1;
|
|
@@ -26470,7 +27396,7 @@ const Table$1 = class Table {
|
|
|
26470
27396
|
withHasError.reportOverflow(this.errors, null);
|
|
26471
27397
|
return;
|
|
26472
27398
|
}
|
|
26473
|
-
const { mode } =
|
|
27399
|
+
const { mode } = withTranslation.parseScaling(this.scale);
|
|
26474
27400
|
const fixedScale = mode !== "auto" && mode !== "empty";
|
|
26475
27401
|
const dims = [];
|
|
26476
27402
|
if (widthOver)
|
|
@@ -26775,7 +27701,7 @@ const Table$1 = class Table {
|
|
|
26775
27701
|
return this.barColumns.split(",").map((col) => col.trim());
|
|
26776
27702
|
}
|
|
26777
27703
|
prepareUnitScaling() {
|
|
26778
|
-
const resolved =
|
|
27704
|
+
const resolved = withTranslation.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
26779
27705
|
if (resolved.kind === "value") {
|
|
26780
27706
|
this.errors.remove("AUTO_unitScaling");
|
|
26781
27707
|
this.autoUnitWarningActive = false;
|
|
@@ -26798,7 +27724,7 @@ const Table$1 = class Table {
|
|
|
26798
27724
|
return 0;
|
|
26799
27725
|
}
|
|
26800
27726
|
preparePercentageScaling() {
|
|
26801
|
-
const resolved =
|
|
27727
|
+
const resolved = withTranslation.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
26802
27728
|
if (resolved.kind === "value") {
|
|
26803
27729
|
this.errors.remove("AUTO_percentageScaling");
|
|
26804
27730
|
this.autoPctWarningActive = false;
|
|
@@ -26912,7 +27838,7 @@ const Table$1 = class Table {
|
|
|
26912
27838
|
resolveScalingInfo(emPx) {
|
|
26913
27839
|
var _a, _b;
|
|
26914
27840
|
const info = {};
|
|
26915
|
-
const unit =
|
|
27841
|
+
const unit = withTranslation.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
26916
27842
|
if (unit.kind === "value") {
|
|
26917
27843
|
info.unitMode = "fixed";
|
|
26918
27844
|
info.unitsPerEm = unit.value;
|
|
@@ -26926,7 +27852,7 @@ const Table$1 = class Table {
|
|
|
26926
27852
|
info.unitPxPerUnit = emPerUnit * emPx;
|
|
26927
27853
|
}
|
|
26928
27854
|
}
|
|
26929
|
-
const pct =
|
|
27855
|
+
const pct = withTranslation.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
26930
27856
|
if (pct.kind === "value") {
|
|
26931
27857
|
info.percentageMode = "fixed";
|
|
26932
27858
|
info.percentagePointsPerEm = pct.value;
|
|
@@ -26943,7 +27869,7 @@ const Table$1 = class Table {
|
|
|
26943
27869
|
return info;
|
|
26944
27870
|
}
|
|
26945
27871
|
getEffectiveScaleFactor() {
|
|
26946
|
-
const { mode, factor } =
|
|
27872
|
+
const { mode, factor } = withTranslation.parseScaling(this.scale);
|
|
26947
27873
|
if (mode === "factor")
|
|
26948
27874
|
return factor;
|
|
26949
27875
|
if (mode === "auto" || mode === "empty")
|
|
@@ -26966,7 +27892,7 @@ const Table$1 = class Table {
|
|
|
26966
27892
|
render() {
|
|
26967
27893
|
const fontStyles = this.getFontStyles();
|
|
26968
27894
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
26969
|
-
return (index.h(index.Host, { key: '
|
|
27895
|
+
return (index.h(index.Host, { key: '1ff079411e15668767cd158aeab1456c75808ea2', style: fontStyles }, index.h("div", { key: 'db4ff9921de92fef2acefeb33454a29e9087bf58' }, index.h("bn-table-renderer", { key: '5bbdba321b5f73207fed36dc0bf9b4ebffa52e85', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, errors: this.errors, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
|
|
26970
27896
|
}
|
|
26971
27897
|
get element() { return index.getElement(this); }
|
|
26972
27898
|
static get watchers() { return {
|
|
@@ -27858,13 +28784,14 @@ class DataQuery {
|
|
|
27858
28784
|
* Only emitted when a limit is set and the group has more rows than the limit.
|
|
27859
28785
|
*/
|
|
27860
28786
|
createRestRow(rowGroupEntry, querys, groups, scenarios, queryWhereSection, order) {
|
|
28787
|
+
var _a;
|
|
27861
28788
|
// Generates REST Row; sumsup the Bottom (total number of rows - limit)
|
|
27862
28789
|
if (rowGroupEntry.totalRowCnt - this.config.limit > 0 && this.config.limit !== 0) {
|
|
27863
28790
|
// sums every column the inner subquery produces (scenario values, _cnt companions, dr_* denominators)
|
|
27864
28791
|
const restScenarios = this.exctractScenarioNames(scenarios)
|
|
27865
28792
|
.map((name) => `SUM(${name}) as ${name}`)
|
|
27866
28793
|
.join(", ");
|
|
27867
|
-
querys.push(`SELECT ${QueryColumnNames.ROWNR}, 1 as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, 'NO_GROUP' as ${QueryColumnNames.ROWGROUP}, 'REST' as ${QueryColumnNames.CATEGORY} ${restScenarios.length > 0 ? ", " + restScenarios : ""} FROM` +
|
|
28794
|
+
querys.push(`SELECT ${QueryColumnNames.ROWNR}, 1 as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, 'NO_GROUP' as ${QueryColumnNames.ROWGROUP}, ${this.bind(String((_a = rowGroupEntry.rowGroup) !== null && _a !== void 0 ? _a : ""))} as restRowGroup, 'REST' as ${QueryColumnNames.CATEGORY} ${restScenarios.length > 0 ? ", " + restScenarios : ""} FROM` +
|
|
27868
28795
|
` (SELECT ROWNUM() AS ${QueryColumnNames.ROWNR}, ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, ${this.bind(String(rowGroupEntry.rowGroup || "NO_GROUP"))} as ${QueryColumnNames.ROWGROUP}, ${groups.select()} ${scenarios.length > 0 ? ",".concat(scenarios) : ""} FROM ${this.fromExpr} ${queryWhereSection} GROUP BY ${groups} ORDER BY ${order[0]})` +
|
|
27869
28796
|
` t WHERE t.rowNr > ${this.config.limit}`);
|
|
27870
28797
|
}
|
|
@@ -28018,6 +28945,7 @@ class DataQuery {
|
|
|
28018
28945
|
if (drillItem.rowGroup != null &&
|
|
28019
28946
|
drillItem.rowGroup !== "" &&
|
|
28020
28947
|
duplicateSubCategoriesList.includes(`${drillItem.category}##${drillItem.subCategory}`)) {
|
|
28948
|
+
drillItem.rawSubCategory = drillItem.subCategory;
|
|
28021
28949
|
drillItem.subCategory = `${drillItem.subCategory} (${drillItem.rowGroup})`;
|
|
28022
28950
|
}
|
|
28023
28951
|
resSegment.splice(index + drillItem[QueryColumnNames.ROWNR], 0, drillItem);
|
|
@@ -28957,6 +29885,8 @@ class TableDataSetFactory {
|
|
|
28957
29885
|
this.attributesByAlias = new Map();
|
|
28958
29886
|
/** Set by createBodyRows(): the grouped table has rows with a blank rowGroup. */
|
|
28959
29887
|
this.hasBlankRowGroup = false;
|
|
29888
|
+
/** The interval columns stand for dates, so a cell of one has a date. */
|
|
29889
|
+
this.dateBuckets = false;
|
|
28960
29890
|
}
|
|
28961
29891
|
/** The underline class of a scenario column: the one of the style slot its colorIndex selects. */
|
|
28962
29892
|
underlineClass(type) {
|
|
@@ -29087,6 +30017,7 @@ class TableDataSetFactory {
|
|
|
29087
30017
|
const bodyRows = [];
|
|
29088
30018
|
let iGroupIndex = -1; // index used in detailRow JSON to count the current group
|
|
29089
30019
|
const dataQuery = new DataQuery(config, i18n);
|
|
30020
|
+
this.dateBuckets = isDateInterval(config.interval);
|
|
29090
30021
|
const queryData = dataQuery.execute(db, fromExpr); // collection of all query results
|
|
29091
30022
|
this.hasBlankRowGroup = dataQuery.hasBlankRowGroup;
|
|
29092
30023
|
// Calculate column statistics for bar columns
|
|
@@ -29227,6 +30158,7 @@ class TableDataSetFactory {
|
|
|
29227
30158
|
const type = rawDataRow[QueryColumnNames.TYPE];
|
|
29228
30159
|
const isSecondElement = rawDataRow[QueryColumnNames.ROWNR] >= 2;
|
|
29229
30160
|
const detailsRow = this.createDetailRow(type, iRowIndex, iGroupIndex, groupData.length);
|
|
30161
|
+
detailsRow.key = this.rowKey(rawDataRow);
|
|
29230
30162
|
for (const scenario of this.normalizedHeader) {
|
|
29231
30163
|
const value = this.getRawDataRowElement(rawDataRow, scenario);
|
|
29232
30164
|
const isBarChart = (_a = barColumns === null || barColumns === void 0 ? void 0 : barColumns.includes(scenario.type)) !== null && _a !== void 0 ? _a : false;
|
|
@@ -29239,11 +30171,31 @@ class TableDataSetFactory {
|
|
|
29239
30171
|
? waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.get(rawDataRow, scenario.type)
|
|
29240
30172
|
: undefined;
|
|
29241
30173
|
detailsRow.createElement(this.translateSumCellLabel(i18nMode, i18n, value, groupName, subCategory, type, scenario.type), scenario.type, this.createColumnType(scenario), this.setCellType(scenario.type, scenariosUnitType), this.translateCellPrefix(i18n, type, scenario.type), this.translateScenarioCSS(scenario.type, value), isSecondElement, categoryWidth, measureScale === null || measureScale === void 0 ? void 0 : measureScale.value, isBarChart, columnStats, 1, waterfall);
|
|
30174
|
+
if (this.dateBuckets && scenario.bucket !== undefined) {
|
|
30175
|
+
detailsRow.elements[detailsRow.elements.length - 1].date = pointDate(scenario.bucket);
|
|
30176
|
+
}
|
|
29242
30177
|
}
|
|
29243
30178
|
result.push(detailsRow);
|
|
29244
30179
|
}
|
|
29245
30180
|
return result;
|
|
29246
30181
|
}
|
|
30182
|
+
/** The raw dimensions of a row. `rowGroup` of the ungrouped rows and of the total is the engine's own label. */
|
|
30183
|
+
rowKey(row) {
|
|
30184
|
+
var _a;
|
|
30185
|
+
const rowGroup = row.restRowGroup != null ? row.restRowGroup : row.rowGroup === "NO_GROUP" ? undefined : row.rowGroup;
|
|
30186
|
+
switch (row.type) {
|
|
30187
|
+
case TableRowType.ENTRY:
|
|
30188
|
+
return { rowGroup, category: row.category, subCategory: row.subCategory };
|
|
30189
|
+
case TableRowType.DRILLELEMENT:
|
|
30190
|
+
return { rowGroup, category: row.category, subCategory: (_a = row.rawSubCategory) !== null && _a !== void 0 ? _a : row.subCategory };
|
|
30191
|
+
case TableRowType.GROUPSUM:
|
|
30192
|
+
return { rowGroup, row: "subtotal" };
|
|
30193
|
+
case TableRowType.SUM:
|
|
30194
|
+
return { row: "total" };
|
|
30195
|
+
default:
|
|
30196
|
+
return undefined;
|
|
30197
|
+
}
|
|
30198
|
+
}
|
|
29247
30199
|
getRawDataRowElement(rawDataRow, scenario) {
|
|
29248
30200
|
if (scenario.bucket !== undefined) {
|
|
29249
30201
|
// interval column: value lives under the composite bucket key
|
|
@@ -29989,7 +30941,13 @@ const BnTableRenderer = class {
|
|
|
29989
30941
|
const tr = domRows[rowIndex];
|
|
29990
30942
|
if (!tr)
|
|
29991
30943
|
return;
|
|
29992
|
-
rows.push({
|
|
30944
|
+
rows.push({
|
|
30945
|
+
section,
|
|
30946
|
+
index: rowIndex,
|
|
30947
|
+
type: row.type,
|
|
30948
|
+
rect: diagnostics.measure(tr, origins),
|
|
30949
|
+
point: readLayoutPoint(tr),
|
|
30950
|
+
});
|
|
29993
30951
|
const cells = row.getCells();
|
|
29994
30952
|
const domCells = Array.from(tr.children);
|
|
29995
30953
|
if (cells.length !== domCells.length) {
|
|
@@ -30013,7 +30971,12 @@ const BnTableRenderer = class {
|
|
|
30013
30971
|
text: ((_b = domCell.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || undefined,
|
|
30014
30972
|
type: cell.type || undefined,
|
|
30015
30973
|
rect: diagnostics.measure(domCell, origins),
|
|
30974
|
+
point: readLayoutPoint(domCell),
|
|
30016
30975
|
};
|
|
30976
|
+
if (entry.point) {
|
|
30977
|
+
entry.content = diagnostics.measureContent(domCell, origins);
|
|
30978
|
+
entry.contentSign = diagnostics.measureSign(domCell) || undefined;
|
|
30979
|
+
}
|
|
30017
30980
|
const barSvg = domCell.querySelector("svg.cell-bar-chart");
|
|
30018
30981
|
if (barSvg) {
|
|
30019
30982
|
entry.bar = {
|
|
@@ -30056,7 +31019,9 @@ const BnTableRenderer = class {
|
|
|
30056
31019
|
return index.h("div", { class: "empty-state" }, errorMsg);
|
|
30057
31020
|
}
|
|
30058
31021
|
const locale = (_d = (_c = (_b = this.stores) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.locale;
|
|
30059
|
-
return (index.h("table", null, index.h("thead", null, this.table.getHeader().map((row) => (index.h("tr", { class: row.cssStyle }, row.getCells().map((cell) => (index.h("th", { colSpan: cell.colSpan, class: cell.cssStyle }, cell.getAsHeaderList().map((line, i, arr) => (index.h("span", null, i === arr.length - 1 ? (index.h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (index.h("span", null, line, cell.drawPrefix(), index.h("br", null))))))))))))), index.h("tbody", null, this.table.getBody().map((row) => (index.h("tr", { class: row.cssStyle }, row === null || row === void 0 ? void 0 : row.getCells().map((cell) => (index.h("td", { colSpan: cell.colSpan, class: cell.type ? `${cell.cssStyle} ${cell.type}` : cell.cssStyle }, cell.
|
|
31022
|
+
return (index.h("table", null, index.h("thead", null, this.table.getHeader().map((row) => (index.h("tr", { class: row.cssStyle }, row.getCells().map((cell) => (index.h("th", { colSpan: cell.colSpan, class: cell.cssStyle }, cell.getAsHeaderList().map((line, i, arr) => (index.h("span", null, i === arr.length - 1 ? (index.h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (index.h("span", null, line, cell.drawPrefix(), index.h("br", null))))))))))))), index.h("tbody", null, this.table.getBody().map((row) => (index.h("tr", Object.assign({ class: row.cssStyle }, dataPointAttributes(row.key, "element")), row === null || row === void 0 ? void 0 : row.getCells().map((cell) => (index.h("td", Object.assign({ colSpan: cell.colSpan, class: cell.type ? `${cell.cssStyle} ${cell.type}` : cell.cssStyle }, (row.key && cell.value != null && cell.value !== "" && cell.value !== "-"
|
|
31023
|
+
? dataPointAttributes(Object.assign(Object.assign({}, row.key), { date: cell.date, scenario: cell.key }), "element")
|
|
31024
|
+
: {})), cell.prefix != null ? (index.h("span", { class: cell.cssStyle + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
|
|
30060
31025
|
cell.columnStats &&
|
|
30061
31026
|
cell.value !== withStyled.NOT_AVAILABLE &&
|
|
30062
31027
|
(cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (index.h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, locale: locale, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles, waterfall: cell.waterfall })) : (index.h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.key.endsWith("_pos"),
|
|
@@ -30345,7 +31310,7 @@ const Title$1 = class Title {
|
|
|
30345
31310
|
this.dateLink = "none";
|
|
30346
31311
|
withStyled.withStyled(this);
|
|
30347
31312
|
withHasError.withComponentStatus(this);
|
|
30348
|
-
this.t =
|
|
31313
|
+
this.t = withTranslation.withTranslation(this).t;
|
|
30349
31314
|
this.errors = withHasError.withHasError(this);
|
|
30350
31315
|
this.componentStyle = withStyled.withComponentStyle(this);
|
|
30351
31316
|
this.ruleSetConfig = withRuleSet(this);
|
|
@@ -30574,7 +31539,7 @@ const Title$1 = class Title {
|
|
|
30574
31539
|
}
|
|
30575
31540
|
render() {
|
|
30576
31541
|
const fontStyles = this.getFontStyles();
|
|
30577
|
-
return (index.h(index.Host, { key: '
|
|
31542
|
+
return (index.h(index.Host, { key: 'f7509ed1e738bade4d252ae05b14e2531f118cb4', style: fontStyles }, index.h("bn-title-renderer", { key: 'fb9dcca5c06a11c4d3d6237ce4ade4d42a62396b', businessUnit: this.prepareBusinessUnit(), scenarios: this.prepareScenarios(), measures: this.prepareMeasures(), timeperiod: this.prepareTitleTimePeriod(), order: this.prepareTitleOrder(), i18n: this.prepareI18n(), "i18n-mode": this.prepareI18nMode(), locale: this.prepareLocale(), ruleSetConfig: this.ruleSetConfig() })));
|
|
30578
31543
|
}
|
|
30579
31544
|
get element() { return index.getElement(this); }
|
|
30580
31545
|
static get watchers() { return {
|
|
@@ -30927,7 +31892,7 @@ const BnTitleRenderer = class {
|
|
|
30927
31892
|
withHasError.withComponentStatus(this);
|
|
30928
31893
|
}
|
|
30929
31894
|
render() {
|
|
30930
|
-
return (index.h("div", { key: '
|
|
31895
|
+
return (index.h("div", { key: 'ecc33a660538732ceea3e4620afabfcb8ffbce95' }, index.h("div", { key: 'cb1c3b074817a4c0647419fdc0f2b94c113ebc09', innerHTML: withTranslation.sanitizeHtml(this.title.unit) }), index.h("div", { key: '92b6ef66f67d33bd3bff6a760d1fc1bee605105d' }, this.title.measures.map((measure, index$1) => (index.h("span", null, this.isFirstElement(index$1) ? this.title.i18n.get("SEPARATOR_WS") : "", index.h("span", { class: "measure" }, measure.name), " ", measure.unit ? this.title.i18n.get("in") : "", " ", measure.unit)))), index.h("div", { key: '74cc33e0e63592e5422b3c0e5c7a52715210c486' }, this.title.dimension)));
|
|
30931
31896
|
}
|
|
30932
31897
|
componentWillLoad() {
|
|
30933
31898
|
const config = this.prepareConfig();
|
|
@@ -31962,7 +32927,7 @@ const ChartTree = class {
|
|
|
31962
32927
|
checkOverflow() {
|
|
31963
32928
|
var _a, _b;
|
|
31964
32929
|
const errId = "WARN_overflow";
|
|
31965
|
-
const parent =
|
|
32930
|
+
const parent = withTranslation.getParentDimensions(this.element);
|
|
31966
32931
|
const width = ((_a = this.gridContainer) === null || _a === void 0 ? void 0 : _a.scrollWidth) || 0;
|
|
31967
32932
|
const height = ((_b = this.gridContainer) === null || _b === void 0 ? void 0 : _b.scrollHeight) || 0;
|
|
31968
32933
|
const dims = [];
|
|
@@ -31970,7 +32935,7 @@ const ChartTree = class {
|
|
|
31970
32935
|
dims.push(`width (${Math.round(width)}px > ${Math.round(parent.width)}px)`);
|
|
31971
32936
|
}
|
|
31972
32937
|
// the tree does not adapt to the height it has: only what an ancestor really cuts off counts
|
|
31973
|
-
const clipped =
|
|
32938
|
+
const clipped = withTranslation.getClippedHeight(this.element, height);
|
|
31974
32939
|
if (clipped > 1) {
|
|
31975
32940
|
dims.push(`height (${Math.round(height)}px > ${Math.round(height - clipped)}px)`);
|
|
31976
32941
|
}
|
|
@@ -32137,6 +33102,8 @@ const ChartTree = class {
|
|
|
32137
33102
|
};
|
|
32138
33103
|
ChartTree.style = bnTreeCss();
|
|
32139
33104
|
|
|
33105
|
+
exports.bn_annotation_layer = AnnotationLayer;
|
|
33106
|
+
exports.bn_annotation_list = AnnotationList;
|
|
32140
33107
|
exports.bn_asset = Asset;
|
|
32141
33108
|
exports.bn_body = Body;
|
|
32142
33109
|
exports.bn_card = Card;
|