@bino-bi/bn-template-engine 1.0.0-alpha.3 → 1.0.0-alpha.4
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-1265d8d3.entry.js +1 -0
- package/dist/bn-template-engine/p-15516dac.entry.js +1 -0
- package/dist/bn-template-engine/p-1c716641.entry.js +1 -0
- package/dist/bn-template-engine/p-27cc8dc0.entry.js +1 -0
- package/dist/bn-template-engine/p-4426d484.entry.js +1 -0
- package/dist/bn-template-engine/p-51f8dc9e.entry.js +1 -0
- package/dist/bn-template-engine/p-53d4e690.entry.js +1 -0
- package/dist/bn-template-engine/p-5KQYRQLK.js +1 -0
- package/dist/bn-template-engine/p-745f4596.entry.js +1 -0
- package/dist/bn-template-engine/{p-0f1504f3.entry.js → p-75e97c87.entry.js} +1 -1
- package/dist/bn-template-engine/p-7a560278.entry.js +1 -0
- package/dist/bn-template-engine/p-7ea7c325.entry.js +1 -0
- package/dist/bn-template-engine/p-945cc95d.entry.js +1 -0
- package/dist/bn-template-engine/p-BYBpC0EO.js +1 -0
- package/dist/bn-template-engine/p-BfXY5dsy.js +1 -0
- package/dist/bn-template-engine/p-BgnHJQ9Q.js +1 -0
- package/dist/bn-template-engine/{p-B4ySv9KQ.js → p-Bhd_WSML.js} +1 -1
- package/dist/bn-template-engine/p-Bka-Z6jo.js +1 -0
- package/dist/bn-template-engine/p-Bnhh02CF.js +1 -0
- package/dist/bn-template-engine/p-C7dQL8CS.js +1 -0
- package/dist/bn-template-engine/p-CL1RYuNU.js +1 -0
- package/dist/bn-template-engine/p-CYwd_ZNM.js +1 -0
- package/dist/bn-template-engine/p-ChlK-T9I.js +1 -0
- package/dist/bn-template-engine/p-DHezf8pZ.js +1 -0
- package/dist/bn-template-engine/{p-DVMu6dEy.js → p-DlppAFq9.js} +1 -1
- package/dist/bn-template-engine/p-DvDDgmcV.js +1 -0
- package/dist/bn-template-engine/p-DvvwfRQG.js +1 -0
- package/dist/bn-template-engine/{p-DG-1MR_T.js → p-P7pGJBgc.js} +1 -1
- package/dist/bn-template-engine/p-b34eaf86.entry.js +1 -0
- package/dist/bn-template-engine/p-bdb8b44c.entry.js +1 -0
- package/dist/bn-template-engine/p-c44fcb8e.entry.js +1 -0
- package/dist/bn-template-engine/p-c7e1a49b.entry.js +1 -0
- package/dist/bn-template-engine/p-d9003041.entry.js +1 -0
- package/dist/bn-template-engine/p-daa7ffa3.entry.js +1 -0
- package/dist/bn-template-engine/p-e084f50a.entry.js +1 -0
- package/dist/bn-template-engine/p-eaba6658.entry.js +1 -0
- package/dist/bn-template-engine/{p-C0yAPzJz.js → p-u8igQLRZ.js} +1 -1
- package/dist/cjs/{DataFormatDigits-DAmZzqbD.js → DataFormatDigits-DKcOeLNK.js} +1 -1
- package/dist/cjs/{DateStringFactory-CcluhpGI.js → DateStringFactory-CSKvbS8K.js} +1 -1
- package/dist/cjs/{Order-BKoDS21t.js → Order-iG11HI4R.js} +8 -5
- package/dist/cjs/{SVGVariancesStyleGroup-DYYAU-81.js → SVGVariancesStyleGroup-K-Tw6lOD.js} +1 -14
- package/dist/cjs/bn-asset.cjs.entry.js +5 -4
- package/dist/cjs/bn-body_4.cjs.entry.js +15 -13
- package/dist/cjs/bn-card.cjs.entry.js +5 -4
- package/dist/cjs/{ibcs-chart-structure.cjs.entry.js → bn-chart-structure_5.cjs.entry.js} +1058 -28
- package/dist/cjs/bn-chart-time.cjs.entry.js +38 -12
- package/dist/cjs/bn-component-style.cjs.entry.js +5 -4
- package/dist/cjs/bn-dataset.cjs.entry.js +38 -9
- package/dist/cjs/bn-grid.cjs.entry.js +9 -7
- package/dist/cjs/bn-image.cjs.entry.js +9 -7
- package/dist/cjs/bn-internationalization.cjs.entry.js +5 -4
- package/dist/cjs/bn-layout-card.cjs.entry.js +3 -2
- package/dist/cjs/bn-layout-page.cjs.entry.js +2 -1
- package/dist/cjs/bn-message.cjs.entry.js +5 -4
- package/dist/cjs/bn-table.cjs.entry.js +979 -0
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +3 -2
- package/dist/cjs/bn-text.cjs.entry.js +11 -9
- package/dist/cjs/bn-tree.cjs.entry.js +9 -7
- package/dist/cjs/contentDecoder-JxOldq1e.js +419 -0
- package/dist/cjs/{context-protocol-CRPmux5D.js → context-protocol-DRQWrwsA.js} +2 -0
- package/dist/cjs/editor-companion.cjs.entry.js +1 -1
- package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +57 -0
- package/dist/cjs/ibcs-chart-time.cjs.entry.js +22 -18
- package/dist/cjs/{bn-context_5.cjs.entry.js → ibcs-table.cjs.entry.js} +122 -1293
- package/dist/cjs/{StringAdapter-Bneo8T4k.js → ibcsRuleSet-DgUoXOfd.js} +10 -10
- package/dist/cjs/index-Dm85hG6t.js +65 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-D8sIIKft.js → scaling-9Tz595RQ.js} +7 -7
- package/dist/cjs/{withHasError-B8gHkfV2.js → utils-CwHIVbbL.js} +1 -69
- package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-CKpSD8UT.js} +3 -3
- package/dist/cjs/{withComponentStatus-_x4LQZ0N.js → withComponentStatus-Bw70BhO0.js} +5 -5
- package/dist/cjs/{withComponentStyle-DMtic_9Y.js → withComponentStyle-aIbTCtfj.js} +5 -5
- package/dist/cjs/withHasError-D7ue5vAv.js +72 -0
- package/dist/cjs/{withStyled-CW30Bh6c.js → withStyled-CS1Yp4sv.js} +8 -61
- package/dist/cjs/{withTranslation-CWPAIRjh.js → withTranslation-rwgyITqe.js} +5 -5
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +226 -99
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +13 -3
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +94 -11
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +3 -4
- package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +4 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +28 -4
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +3 -3
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -4
- package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +4 -0
- package/dist/collection/components/bn-dataset/bn-dataset.js +49 -2
- package/dist/collection/components/bn-datasource/bn-datasource.js +46 -3
- package/dist/collection/components/bn-table/bn-table.js +9 -12
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +58 -41
- package/dist/collection/stores/componentStyles.js +2 -0
- package/dist/collection/utils/constants.js +8 -5
- package/dist/collection/utils/contentDecoder.js +28 -0
- package/dist/collection/utils/stackColors.js +2 -2
- package/dist/collection/utils/validate.js +1 -1
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGVariancesStyleGroup.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/contentDecoder.js +1 -0
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/emotion-hash.esm.js +1 -0
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/ibcs-title2.js +1 -1
- package/dist/components/ibcsRuleSet.js +1 -1
- package/dist/components/validate.js +1 -1
- package/dist/components/withStyled.js +1 -1
- package/dist/esm/{DataFormatDigits--qIbKvXa.js → DataFormatDigits-oSZ1hBKE.js} +1 -1
- package/dist/esm/{DateStringFactory-XWdUjsn8.js → DateStringFactory-CSGz6TDk.js} +1 -1
- package/dist/esm/{Order-sqjrku2z.js → Order-Bnhh02CF.js} +9 -6
- package/dist/esm/{SVGVariancesStyleGroup-ibg3sLjM.js → SVGVariancesStyleGroup-CqTjrZYg.js} +2 -13
- package/dist/esm/bn-asset.entry.js +5 -4
- package/dist/esm/bn-body_4.entry.js +11 -9
- package/dist/esm/bn-card.entry.js +5 -4
- package/dist/esm/{ibcs-chart-structure.entry.js → bn-chart-structure_5.entry.js} +1048 -22
- package/dist/esm/bn-chart-time.entry.js +38 -12
- package/dist/esm/bn-component-style.entry.js +5 -4
- package/dist/esm/bn-dataset.entry.js +35 -6
- package/dist/esm/bn-grid.entry.js +9 -7
- package/dist/esm/bn-image.entry.js +9 -7
- package/dist/esm/bn-internationalization.entry.js +5 -4
- package/dist/esm/bn-layout-card.entry.js +3 -2
- package/dist/esm/bn-layout-page.entry.js +2 -1
- package/dist/esm/bn-message.entry.js +5 -4
- package/dist/esm/bn-table.entry.js +977 -0
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +3 -2
- package/dist/esm/bn-text.entry.js +11 -9
- package/dist/esm/bn-tree.entry.js +9 -7
- package/dist/esm/contentDecoder-oMmxz6nJ.js +416 -0
- package/dist/esm/{context-protocol-Bz5klD-F.js → context-protocol-BHnQsVsr.js} +2 -0
- package/dist/esm/editor-companion.entry.js +1 -1
- package/dist/esm/emotion-hash.esm-BYBpC0EO.js +55 -0
- package/dist/esm/ibcs-chart-time.entry.js +15 -11
- package/dist/esm/{bn-context_5.entry.js → ibcs-table.entry.js} +68 -1235
- package/dist/esm/{StringAdapter-BCLJpQQ8.js → ibcsRuleSet-K4ytuA1f.js} +10 -10
- package/dist/esm/index-DHezf8pZ.js +65 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{scaling-C6K8FYSF.js → scaling-Cehc74IE.js} +2 -2
- package/dist/esm/{withHasError-B3QX2emi.js → utils-DvvwfRQG.js} +1 -69
- package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-FQ8NwCIz.js} +1 -1
- package/dist/esm/{withComponentStatus-DodoSXe-.js → withComponentStatus-DWjDYtZ7.js} +1 -1
- package/dist/esm/{withComponentStyle-BerJY64r.js → withComponentStyle-9uP_hcDq.js} +2 -2
- package/dist/esm/withHasError-FyY5mQ_3.js +70 -0
- package/dist/esm/{withStyled-D1fAWJ3g.js → withStyled--qQWquTH.js} +6 -59
- package/dist/esm/{withTranslation-mimbJdER.js → withTranslation-BqD0Kp7b.js} +2 -2
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +155 -109
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +7 -0
- package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +1 -0
- package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +1 -0
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +6 -0
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +8 -0
- package/dist/types/components/bn-table/bn-table.d.ts +3 -3
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +0 -2
- package/dist/types/components.d.ts +100 -36
- package/dist/types/stores/componentStyles.d.ts +2 -0
- package/dist/types/utils/constants.d.ts +8 -5
- package/dist/types/utils/contentDecoder.d.ts +12 -0
- package/package.json +2 -1
- package/dist/bn-template-engine/p-05a82a77.entry.js +0 -1
- package/dist/bn-template-engine/p-1970906d.entry.js +0 -1
- package/dist/bn-template-engine/p-1dbd339c.entry.js +0 -1
- package/dist/bn-template-engine/p-2e68cf09.entry.js +0 -1
- package/dist/bn-template-engine/p-31cc6a2d.entry.js +0 -1
- package/dist/bn-template-engine/p-37881d05.entry.js +0 -1
- package/dist/bn-template-engine/p-3b894997.entry.js +0 -1
- package/dist/bn-template-engine/p-50e49732.entry.js +0 -1
- package/dist/bn-template-engine/p-6c7c0455.entry.js +0 -1
- package/dist/bn-template-engine/p-6da93eae.entry.js +0 -1
- package/dist/bn-template-engine/p-701e1578.entry.js +0 -1
- package/dist/bn-template-engine/p-8tsCnxIz.js +0 -1
- package/dist/bn-template-engine/p-997b2fe4.entry.js +0 -1
- package/dist/bn-template-engine/p-BL8gyUwE.js +0 -1
- package/dist/bn-template-engine/p-BSfqOkN_.js +0 -1
- package/dist/bn-template-engine/p-CRLgp9-v.js +0 -1
- package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
- package/dist/bn-template-engine/p-DRikHQE-.js +0 -1
- package/dist/bn-template-engine/p-DtdQCMzj.js +0 -1
- package/dist/bn-template-engine/p-a90f1cbe.entry.js +0 -1
- package/dist/bn-template-engine/p-b7bec050.entry.js +0 -1
- package/dist/bn-template-engine/p-d7f0cbaf.entry.js +0 -1
- package/dist/bn-template-engine/p-dfb61aa5.entry.js +0 -1
- package/dist/bn-template-engine/p-ece17f84.entry.js +0 -1
- package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
- package/dist/bn-template-engine/p-fd427179.entry.js +0 -1
- package/dist/bn-template-engine/p-sqjrku2z.js +0 -1
- package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
- package/dist/cjs/bn-chart-structure.cjs.entry.js +0 -700
- package/dist/esm/bn-chart-structure.entry.js +0 -698
|
@@ -1,14 +1,943 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-Cjw0q6gP.js');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var withStyled = require('./withStyled-CS1Yp4sv.js');
|
|
5
|
+
var scaling = require('./scaling-9Tz595RQ.js');
|
|
6
|
+
var withComponentStatus = require('./withComponentStatus-Bw70BhO0.js');
|
|
7
|
+
var withTranslation = require('./withTranslation-rwgyITqe.js');
|
|
8
|
+
var contextProtocol = require('./context-protocol-DRQWrwsA.js');
|
|
9
|
+
var withComponentStyle = require('./withComponentStyle-aIbTCtfj.js');
|
|
10
|
+
var withHasError = require('./withHasError-D7ue5vAv.js');
|
|
11
|
+
var Order = require('./Order-iG11HI4R.js');
|
|
12
|
+
var withBodyObserver = require('./withBodyObserver-CKpSD8UT.js');
|
|
13
|
+
var contentDecoder = require('./contentDecoder-JxOldq1e.js');
|
|
14
|
+
var SVGVariancesStyleGroup = require('./SVGVariancesStyleGroup-K-Tw6lOD.js');
|
|
15
|
+
var DataFormatDigits = require('./DataFormatDigits-DKcOeLNK.js');
|
|
7
16
|
var formatter = require('./formatter-DIJL_crx.js');
|
|
8
17
|
var alasql_min = require('./alasql.min-C_nHTuEQ.js');
|
|
9
|
-
var
|
|
18
|
+
var ibcsRuleSet = require('./ibcsRuleSet-DgUoXOfd.js');
|
|
19
|
+
require('./emotion-hash.esm-nbbEQ0Dn.js');
|
|
20
|
+
require('./DateStringFactory-CSKvbS8K.js');
|
|
21
|
+
require('./utils-CwHIVbbL.js');
|
|
10
22
|
require('./_commonjsHelpers-BJu3ubxk.js');
|
|
11
23
|
|
|
24
|
+
const bnChartStructureCss$1 = () => `:host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}`;
|
|
25
|
+
|
|
26
|
+
const Chart = class {
|
|
27
|
+
validateScenario(newValue) {
|
|
28
|
+
const invalidScenarios = withStyled.validateScenarioList(newValue);
|
|
29
|
+
const errId = "ERR_scenarios";
|
|
30
|
+
if (invalidScenarios.length > 0) {
|
|
31
|
+
this.errors.addOrReplace({
|
|
32
|
+
id: errId,
|
|
33
|
+
type: "warning",
|
|
34
|
+
message: "scenarios: invalid value(s) '" + JSON.stringify(invalidScenarios) + "' are not supported.",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.errors.remove(errId);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
validateVariances(newValue) {
|
|
42
|
+
const errIdVar = "ERR_variances";
|
|
43
|
+
const invalidVariances = withStyled.validateVariancesList(newValue);
|
|
44
|
+
if (invalidVariances.length > 0) {
|
|
45
|
+
this.errors.addOrReplace({
|
|
46
|
+
id: errIdVar,
|
|
47
|
+
type: "warning",
|
|
48
|
+
message: "variances: invalid value(s) '" + JSON.stringify(invalidVariances) + "' are not supported.",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.errors.remove(errIdVar);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
validateUnitScaling(newValue) {
|
|
56
|
+
const errId = "ERR_unitScaling";
|
|
57
|
+
if (!withStyled.isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
58
|
+
this.errors.addOrReplace({
|
|
59
|
+
id: errId,
|
|
60
|
+
type: "warning",
|
|
61
|
+
message: "unitScaling: invalid value(s) '" + newValue + "' are not supported.",
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
this.errors.remove(errId);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
validatePercentageScaling(newValue) {
|
|
69
|
+
const errId = "ERR_percentageScaling";
|
|
70
|
+
if (!withStyled.isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
71
|
+
this.errors.addOrReplace({
|
|
72
|
+
id: errId,
|
|
73
|
+
type: "warning",
|
|
74
|
+
message: "percentageScaling: invalid value(s) '" + newValue + "' are not supported.",
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.errors.remove(errId);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
validateLevel(newValue) {
|
|
82
|
+
const errId = "ERR_level";
|
|
83
|
+
if (!withStyled.isValidLevel(newValue)) {
|
|
84
|
+
this.errors.addOrReplace({
|
|
85
|
+
id: errId,
|
|
86
|
+
type: "warning",
|
|
87
|
+
message: "level: invalid value(s) '" + newValue + "' are not supported.",
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
this.errors.remove(errId);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
validateOrderList(newValue) {
|
|
95
|
+
const invalidElements = withStyled.validateOrderList(newValue);
|
|
96
|
+
const errId = "ERR_order";
|
|
97
|
+
if (invalidElements.length > 0) {
|
|
98
|
+
this.errors.addOrReplace({
|
|
99
|
+
id: errId,
|
|
100
|
+
type: "warning",
|
|
101
|
+
message: "order: invalid value(s) '" + JSON.stringify(invalidElements) + "' are not supported.",
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
this.errors.remove(errId);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
validateOrderDirection(newValue) {
|
|
109
|
+
const errId = "ERR_orderDirection";
|
|
110
|
+
if (!withStyled.isValidDirection(newValue)) {
|
|
111
|
+
this.errors.addOrReplace({
|
|
112
|
+
id: errId,
|
|
113
|
+
type: "warning",
|
|
114
|
+
message: "orderDirection: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
this.errors.remove(errId);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
validateLimit(newValue) {
|
|
122
|
+
const errId = "ERR_limit";
|
|
123
|
+
if (!withStyled.isValidInteger(newValue)) {
|
|
124
|
+
this.errors.addOrReplace({
|
|
125
|
+
id: errId,
|
|
126
|
+
type: "warning",
|
|
127
|
+
message: "limit: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this.errors.remove(errId);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
validateShowCategories(newValue) {
|
|
135
|
+
const errId = "ERR_showCategories";
|
|
136
|
+
if (!withStyled.isValidBoolean(newValue)) {
|
|
137
|
+
this.errors.addOrReplace({
|
|
138
|
+
id: errId,
|
|
139
|
+
type: "warning",
|
|
140
|
+
message: "showCategories: invalid value(s) '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' are not supported.",
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
this.errors.remove(errId);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
validateMeasureScale(newValue) {
|
|
148
|
+
const errId = "ERR_measureScale";
|
|
149
|
+
if (!withStyled.isValidMeasureScale(newValue)) {
|
|
150
|
+
this.errors.addOrReplace({
|
|
151
|
+
id: errId,
|
|
152
|
+
type: "warning",
|
|
153
|
+
message: "measureScale: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
this.errors.remove(errId);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
validateShowMeasureScale(newValue) {
|
|
161
|
+
const errId = "ERR_grouped";
|
|
162
|
+
if (!withStyled.isValidBoolean(newValue)) {
|
|
163
|
+
this.errors.addOrReplace({
|
|
164
|
+
id: errId,
|
|
165
|
+
type: "warning",
|
|
166
|
+
message: "showMeasureScale: invalid value(s) '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' are not supported.",
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
this.errors.remove(errId);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
validateStack(newValue) {
|
|
174
|
+
const errId = "ERR_stack";
|
|
175
|
+
const errors = withStyled.validateStackConfig(newValue);
|
|
176
|
+
if (errors.length > 0) {
|
|
177
|
+
this.errors.addOrReplace({
|
|
178
|
+
id: errId,
|
|
179
|
+
type: "warning",
|
|
180
|
+
message: errors.join("; "),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
this.errors.remove(errId);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
validateScaling(newValue) {
|
|
188
|
+
if (newValue == null || newValue === "" || newValue === "none" || newValue === "auto") {
|
|
189
|
+
this.errors.remove("ERR_scale");
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const num = Number(newValue);
|
|
193
|
+
if (isNaN(num) || num <= 0) {
|
|
194
|
+
this.errors.addOrReplace({
|
|
195
|
+
id: "ERR_scale",
|
|
196
|
+
type: "warning",
|
|
197
|
+
message: `Invalid scale value: "${newValue}". Use "none", "auto", or a positive number.`,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
this.errors.remove("ERR_scale");
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
constructor(hostRef) {
|
|
205
|
+
index.registerInstance(this, hostRef);
|
|
206
|
+
this.data = [];
|
|
207
|
+
this.datasetMeta = null;
|
|
208
|
+
this.appliedScaleFactor = 1;
|
|
209
|
+
/**
|
|
210
|
+
* Title displayed above the chart. When empty, the title is derived
|
|
211
|
+
* from the variance scenario labels (if variances are configured).
|
|
212
|
+
*
|
|
213
|
+
* @example chart-title="Revenue by Category"
|
|
214
|
+
*/
|
|
215
|
+
this.chartTitle = "";
|
|
216
|
+
/**
|
|
217
|
+
* AlaSQL WHERE clause fragment injected into the data query to filter
|
|
218
|
+
* rows before rendering.
|
|
219
|
+
*
|
|
220
|
+
* @example filter="rowGroup = 'Revenue'"
|
|
221
|
+
*/
|
|
222
|
+
this.filter = "";
|
|
223
|
+
/**
|
|
224
|
+
* Maximum number of bars to display. Excess rows are aggregated into
|
|
225
|
+
* a "REST" summary bar. `0` means no limit (all rows are shown).
|
|
226
|
+
*
|
|
227
|
+
* @default 0
|
|
228
|
+
* @example limit="5"
|
|
229
|
+
*/
|
|
230
|
+
this.limit = 0;
|
|
231
|
+
/**
|
|
232
|
+
* Whether to display category labels on the left side of the chart.
|
|
233
|
+
*
|
|
234
|
+
* Values: `"true"` | `"false"`.
|
|
235
|
+
*
|
|
236
|
+
* @default "true"
|
|
237
|
+
* @example show-categories="false"
|
|
238
|
+
*/
|
|
239
|
+
this.showCategories = "true";
|
|
240
|
+
/**
|
|
241
|
+
* SI prefix applied to data values, dividing them for display
|
|
242
|
+
* (e.g. `"k"` divides by 1 000, showing 14 000 as "14").
|
|
243
|
+
*
|
|
244
|
+
* Common prefixes: `"k"` (×10³), `"M"` (×10⁶), `"G"` (×10⁹), `"T"` (×10¹²).
|
|
245
|
+
* Use `"_"` for no prefix (raw values).
|
|
246
|
+
*
|
|
247
|
+
* | Special value | Behavior |
|
|
248
|
+
* |---------------|--------------------------------------------------------------|
|
|
249
|
+
* | `"GREATEST"` | Auto-select prefix based on the largest value in the dataset |
|
|
250
|
+
* | `"LEAST"` | Auto-select prefix based on the smallest value |
|
|
251
|
+
*
|
|
252
|
+
* The selected prefix is shown in the chart footer when `show-measure-scale` is enabled.
|
|
253
|
+
*
|
|
254
|
+
* @default "greatest"
|
|
255
|
+
* @example measure-scale="k"
|
|
256
|
+
*/
|
|
257
|
+
this.measureScale = "greatest";
|
|
258
|
+
/**
|
|
259
|
+
* Toggles display of the SI prefix and unit label in the chart footer
|
|
260
|
+
* (e.g. "k EUR").
|
|
261
|
+
*
|
|
262
|
+
* Values: `"true"` | `"false"`.
|
|
263
|
+
*
|
|
264
|
+
* @default "false"
|
|
265
|
+
* @example show-measure-scale="true"
|
|
266
|
+
*/
|
|
267
|
+
this.showMeasureScale = "false";
|
|
268
|
+
/**
|
|
269
|
+
* Unit label displayed alongside the SI prefix in the chart footer
|
|
270
|
+
* (e.g. "EUR", "USD", "pcs"). Only visible when `show-measure-scale` is `"true"`.
|
|
271
|
+
*
|
|
272
|
+
* @default ""
|
|
273
|
+
* @example measure-unit="EUR"
|
|
274
|
+
*/
|
|
275
|
+
this.measureUnit = "";
|
|
276
|
+
/**
|
|
277
|
+
* Stacking configuration as a JSON string. When set, bars are drawn as
|
|
278
|
+
* stacked segments instead of side-by-side.
|
|
279
|
+
*
|
|
280
|
+
* **Properties:**
|
|
281
|
+
*
|
|
282
|
+
* | Key | Values | Description |
|
|
283
|
+
* |---------|-----------------------------------------------|----------------------------------------------------|
|
|
284
|
+
* | `by` | `"scenarios"` \| `"dimensions"` | **Required.** What to stack. |
|
|
285
|
+
* | `mode` | `"absolute"` \| `"relative"` \| `"absolute-relative"` | Stacking mode. Default: `"absolute"`. |
|
|
286
|
+
* | `order` | `"asc"` \| `"desc"` \| `"dataset"` | Segment sort order. Default: `"dataset"`. |
|
|
287
|
+
*
|
|
288
|
+
* - `by: "scenarios"` — stacks the scenarios listed in the `scenarios` prop end-to-end.
|
|
289
|
+
* - `by: "dimensions"` — stacks by the next-lower hierarchy level derived from `level`
|
|
290
|
+
* (e.g. level `"rowGroup"` stacks by category). Only the first scenario is used;
|
|
291
|
+
* extra scenarios trigger a `WARN_stack_dimensions_scenarios` warning.
|
|
292
|
+
* - `mode: "relative"` — normalizes each bar to 100%, showing proportions.
|
|
293
|
+
* - `mode: "absolute-relative"` — absolute bars with percentage labels.
|
|
294
|
+
*
|
|
295
|
+
* Segment colors are configurable via the `stackColors` array in component styles.
|
|
296
|
+
*
|
|
297
|
+
* @default "" (no stacking)
|
|
298
|
+
* @example stack='{"by":"scenarios","mode":"absolute"}'
|
|
299
|
+
* @example stack='{"by":"dimensions","mode":"relative"}'
|
|
300
|
+
*/
|
|
301
|
+
this.stack = "";
|
|
302
|
+
this.scenariosArray = [""];
|
|
303
|
+
this.pixelPerUnitGroupMap = new Map();
|
|
304
|
+
this._autoScaleGuard = false;
|
|
305
|
+
withStyled.withStyled(this);
|
|
306
|
+
withComponentStatus.withComponentStatus(this);
|
|
307
|
+
scaling.withDataset(this, (_name, data) => {
|
|
308
|
+
this.data = (data || []);
|
|
309
|
+
}, (_name, meta) => {
|
|
310
|
+
this.datasetMeta = meta;
|
|
311
|
+
});
|
|
312
|
+
this.chartTemplate = this.chartTemplate.bind(this);
|
|
313
|
+
this.errors = withHasError.withHasError(this);
|
|
314
|
+
this.componentStyle = withComponentStyle.withComponentStyle(this);
|
|
315
|
+
this.t = withTranslation.withTranslation(this).t;
|
|
316
|
+
}
|
|
317
|
+
componentWillLoad() {
|
|
318
|
+
this.validateScenario(this.scenarios);
|
|
319
|
+
this.validateVariances(this.variances);
|
|
320
|
+
this.validateUnitScaling(this.unitScaling);
|
|
321
|
+
//this.validateSelectedStyle(this.selectedStyle);
|
|
322
|
+
this.validateLevel(this.level);
|
|
323
|
+
this.validateOrderDirection(this.orderDirection);
|
|
324
|
+
this.validateOrderList(this.order);
|
|
325
|
+
this.validateShowCategories(this.showCategories);
|
|
326
|
+
this.validateMeasureScale(this.measureScale);
|
|
327
|
+
this.validateShowMeasureScale(this.showMeasureScale);
|
|
328
|
+
this.validateStack(this.stack);
|
|
329
|
+
this.validateScaling(this.scale);
|
|
330
|
+
}
|
|
331
|
+
componentDidRender() {
|
|
332
|
+
var _a, _b;
|
|
333
|
+
const { mode } = scaling.parseScaling(this.scale);
|
|
334
|
+
if (mode !== "auto" && mode !== "empty") {
|
|
335
|
+
this._autoScaleGuard = false;
|
|
336
|
+
this.checkWidthOverflow();
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (this._autoScaleGuard) {
|
|
340
|
+
this._autoScaleGuard = false;
|
|
341
|
+
this.checkWidthOverflow();
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const host = this.element;
|
|
345
|
+
const { height: parentHeight } = scaling.getParentDimensions(host);
|
|
346
|
+
if (parentHeight <= 0) {
|
|
347
|
+
this.checkWidthOverflow();
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
// Measure at base (unscaled) font size to get true content height
|
|
351
|
+
const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
|
|
352
|
+
host.style.setProperty("--bn-font-size", `${baseFontSize}px`);
|
|
353
|
+
// Reading scrollHeight forces a synchronous reflow at base size
|
|
354
|
+
const div = (_a = host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".container");
|
|
355
|
+
const unscaledHeight = (_b = div === null || div === void 0 ? void 0 : div.scrollHeight) !== null && _b !== void 0 ? _b : host.scrollHeight;
|
|
356
|
+
if (unscaledHeight <= parentHeight + 1) {
|
|
357
|
+
this.errors.remove("AUTO_scale");
|
|
358
|
+
if (this.appliedScaleFactor !== 1) {
|
|
359
|
+
this._autoScaleGuard = true;
|
|
360
|
+
this.appliedScaleFactor = 1;
|
|
361
|
+
}
|
|
362
|
+
this.checkWidthOverflow();
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const computedFactor = (parentHeight - 1) / unscaledHeight;
|
|
366
|
+
host.style.setProperty("--bn-font-size", `${baseFontSize * computedFactor}px`);
|
|
367
|
+
if (mode === "empty") {
|
|
368
|
+
this.errors.addOrReplace({
|
|
369
|
+
id: "AUTO_scale",
|
|
370
|
+
type: "warning",
|
|
371
|
+
message: `Auto-scaled chart by factor ${computedFactor.toFixed(3)}`,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
this.errors.remove("AUTO_scale");
|
|
376
|
+
}
|
|
377
|
+
if (Math.abs(computedFactor - this.appliedScaleFactor) > 0.001) {
|
|
378
|
+
this._autoScaleGuard = true;
|
|
379
|
+
this.appliedScaleFactor = computedFactor;
|
|
380
|
+
}
|
|
381
|
+
this.checkWidthOverflow();
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Emits an error when a custom unit-scaling value causes the chart to exceed its container width.
|
|
385
|
+
* Skipped for auto/unset unit-scaling since auto-fit handles width.
|
|
386
|
+
*/
|
|
387
|
+
checkWidthOverflow() {
|
|
388
|
+
var _a;
|
|
389
|
+
const errId = "WARN_overflow";
|
|
390
|
+
const us = String((_a = this.unitScaling) !== null && _a !== void 0 ? _a : "")
|
|
391
|
+
.trim()
|
|
392
|
+
.toLowerCase();
|
|
393
|
+
if (us === "" || us === "auto") {
|
|
394
|
+
this.errors.remove(errId);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const parent = scaling.getParentDimensions(this.element);
|
|
398
|
+
if (parent.width > 0 && this.element.scrollWidth > parent.width + 1) {
|
|
399
|
+
this.errors.addOrReplace({
|
|
400
|
+
id: errId,
|
|
401
|
+
type: "error",
|
|
402
|
+
message: `Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(parent.width)}px). Reduce unit-scaling or set to "auto".`,
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
this.errors.remove(errId);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
prepareDimension() {
|
|
410
|
+
const parent = scaling.getParentDimensions(this.element);
|
|
411
|
+
this.canvasWidthSegmented = parent.width / this.scenariosArray.length;
|
|
412
|
+
return { width: this.canvasWidthSegmented, height: parent.height };
|
|
413
|
+
}
|
|
414
|
+
prepareScenarios() {
|
|
415
|
+
var _a, _b, _c, _d;
|
|
416
|
+
const isAuto = ((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
417
|
+
if (withStyled.isBlankInput(this.scenarios) || isAuto) {
|
|
418
|
+
if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
419
|
+
if (!isAuto) {
|
|
420
|
+
this.errors.addOrReplace({
|
|
421
|
+
id: "AUTO_scenarios",
|
|
422
|
+
type: "warning",
|
|
423
|
+
message: `scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
this.errors.remove("AUTO_scenarios");
|
|
428
|
+
}
|
|
429
|
+
return this.datasetMeta.availableScenarios;
|
|
430
|
+
}
|
|
431
|
+
return [];
|
|
432
|
+
}
|
|
433
|
+
this.errors.remove("AUTO_scenarios");
|
|
434
|
+
return (_d = this.scenarios) === null || _d === void 0 ? void 0 : _d.split(",").map((entry) => entry.trim());
|
|
435
|
+
}
|
|
436
|
+
prepareVariances() {
|
|
437
|
+
var _a;
|
|
438
|
+
if (withStyled.isBlankInput(this.variances)) {
|
|
439
|
+
return [];
|
|
440
|
+
}
|
|
441
|
+
return (_a = this.variances) === null || _a === void 0 ? void 0 : _a.split(",").map((entry) => entry.trim());
|
|
442
|
+
}
|
|
443
|
+
prepareHideCategories(idx) {
|
|
444
|
+
return idx >= 1 || this.showCategories !== "true";
|
|
445
|
+
}
|
|
446
|
+
prepareI18n() {
|
|
447
|
+
const i18nMetaLabelsLocal = [];
|
|
448
|
+
const i18nMetaLabelsGlobal = contextProtocol.globalLabelKeys;
|
|
449
|
+
const i18nMapLocal = new Map(i18nMetaLabelsLocal.map((key) => [key, this.t(".".concat(key))]));
|
|
450
|
+
const i18nMapGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
|
|
451
|
+
return new Map([...i18nMapGlobal.entries(), ...i18nMapLocal.entries()]);
|
|
452
|
+
}
|
|
453
|
+
preparePixelPerUnit() {
|
|
454
|
+
var _a;
|
|
455
|
+
if (this.pixelPerUnitGroupMap.has(this.unitScaling)) {
|
|
456
|
+
this.errors.remove("AUTO_unitScaling");
|
|
457
|
+
return this.pixelPerUnitGroupMap.get(this.unitScaling);
|
|
458
|
+
}
|
|
459
|
+
// Explicit 'auto' → auto-calculate silently
|
|
460
|
+
if (((_a = this.unitScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
|
|
461
|
+
this.errors.remove("AUTO_unitScaling");
|
|
462
|
+
return 0;
|
|
463
|
+
}
|
|
464
|
+
const numeric = Number(this.unitScaling);
|
|
465
|
+
if (!isNaN(numeric) && numeric > 0) {
|
|
466
|
+
this.errors.remove("AUTO_unitScaling");
|
|
467
|
+
return numeric;
|
|
468
|
+
}
|
|
469
|
+
// Not set / invalid → auto-calculate with warning
|
|
470
|
+
this.errors.addOrReplace({
|
|
471
|
+
id: "AUTO_unitScaling",
|
|
472
|
+
type: "warning",
|
|
473
|
+
message: `unit-scaling: not set, auto-calculated to fit available space.`,
|
|
474
|
+
});
|
|
475
|
+
return 0;
|
|
476
|
+
}
|
|
477
|
+
preparePixelPerPercentage() {
|
|
478
|
+
if (this.pixelPerUnitGroupMap.has(this.percentageScaling)) {
|
|
479
|
+
return this.pixelPerUnitGroupMap.get(this.percentageScaling);
|
|
480
|
+
}
|
|
481
|
+
return Number(this.percentageScaling) * 100;
|
|
482
|
+
}
|
|
483
|
+
prepareLevel() {
|
|
484
|
+
var _a, _b, _c;
|
|
485
|
+
const isAuto = ((_a = this.level) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
486
|
+
if (withStyled.isBlankInput(this.level) || isAuto) {
|
|
487
|
+
if ((_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.suggestedLevel) {
|
|
488
|
+
if (!isAuto) {
|
|
489
|
+
this.errors.addOrReplace({
|
|
490
|
+
id: "AUTO_level",
|
|
491
|
+
type: "warning",
|
|
492
|
+
message: `level: not set, auto-detected: ${this.datasetMeta.suggestedLevel}`,
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
this.errors.remove("AUTO_level");
|
|
497
|
+
}
|
|
498
|
+
return Order.AggregationLevel[this.datasetMeta.suggestedLevel.toUpperCase()];
|
|
499
|
+
}
|
|
500
|
+
return undefined;
|
|
501
|
+
}
|
|
502
|
+
this.errors.remove("AUTO_level");
|
|
503
|
+
return Order.AggregationLevel[(_c = this.level) === null || _c === void 0 ? void 0 : _c.toUpperCase()];
|
|
504
|
+
}
|
|
505
|
+
prepareOrder() {
|
|
506
|
+
var _a, _b, _c;
|
|
507
|
+
const isAuto = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
508
|
+
let orderStr;
|
|
509
|
+
if (withStyled.isBlankInput(this.order) || isAuto) {
|
|
510
|
+
if ((_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.suggestedOrder) {
|
|
511
|
+
if (!isAuto) {
|
|
512
|
+
this.errors.addOrReplace({
|
|
513
|
+
id: "AUTO_order",
|
|
514
|
+
type: "warning",
|
|
515
|
+
message: `order: not set, auto-detected: ${this.datasetMeta.suggestedOrder}`,
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
this.errors.remove("AUTO_order");
|
|
520
|
+
}
|
|
521
|
+
orderStr = this.datasetMeta.suggestedOrder;
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
orderStr = this.order;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
this.errors.remove("AUTO_order");
|
|
529
|
+
orderStr = this.order;
|
|
530
|
+
}
|
|
531
|
+
const tableOrder = {
|
|
532
|
+
hierarchy: orderStr === null || orderStr === void 0 ? void 0 : orderStr.split(",").map((entry) => Order.OrderColumn[entry === null || entry === void 0 ? void 0 : entry.toUpperCase()]),
|
|
533
|
+
direction: Order.OrderDirection[(_c = this.orderDirection) === null || _c === void 0 ? void 0 : _c.toUpperCase()],
|
|
534
|
+
};
|
|
535
|
+
return tableOrder;
|
|
536
|
+
}
|
|
537
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
538
|
+
prepareStyle() {
|
|
539
|
+
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
540
|
+
return this.componentStyle(($) => {
|
|
541
|
+
const baseFontSize = $["global"]["fontSizePx"];
|
|
542
|
+
const scaledFontSize = baseFontSize * effectiveFactor;
|
|
543
|
+
return {
|
|
544
|
+
scaleFactors: {
|
|
545
|
+
scenarioOffset: $["bn-chart-structure"]["scaleFactors"]["scenarioOffset"],
|
|
546
|
+
scenarioLabelToBar: $["bn-chart-structure"]["scaleFactors"]["scenarioLabelToBar"],
|
|
547
|
+
labelToBar: $["bn-chart-structure"]["scaleFactors"]["labelToBar"],
|
|
548
|
+
labelToAxis: $["bn-chart-structure"]["scaleFactors"]["labelToAxis"],
|
|
549
|
+
needleWidth: $["bn-chart-structure"]["scaleFactors"]["needleWidth"],
|
|
550
|
+
needleHeadWidth: $["bn-chart-structure"]["scaleFactors"]["needleHeadWidth"],
|
|
551
|
+
barWidth: $["bn-chart-structure"]["scaleFactors"]["barWidth"],
|
|
552
|
+
varianceAxisLineWidth: $["bn-chart-structure"]["scaleFactors"]["varianceAxisLineWidth"],
|
|
553
|
+
axisLineWidth: $["bn-chart-structure"]["scaleFactors"]["axisLineWidth"],
|
|
554
|
+
auxiliaryLineWidth: $["bn-chart-structure"]["scaleFactors"]["auxiliaryLineWidth"],
|
|
555
|
+
scenarioLineWidth: $["bn-chart-structure"]["scaleFactors"]["scenarioLineWidth"],
|
|
556
|
+
markerWidth: $["bn-chart-structure"]["scaleFactors"]["markerWidth"],
|
|
557
|
+
markerOffset: $["bn-chart-structure"]["scaleFactors"]["markerOffset"],
|
|
558
|
+
categoryWidth: $["bn-chart-structure"]["scaleFactors"]["categoryWidth"],
|
|
559
|
+
axisTickLength: $["bn-chart-structure"]["scaleFactors"]["axisTickLength"],
|
|
560
|
+
},
|
|
561
|
+
fontStyles: {
|
|
562
|
+
font: `${scaledFontSize}px ${$["global"]["fontFamily"]}`,
|
|
563
|
+
size: scaledFontSize,
|
|
564
|
+
color: $["global"]["fontColor"],
|
|
565
|
+
background: $["global"]["fontBackgroundColor"],
|
|
566
|
+
leading: 1.8,
|
|
567
|
+
},
|
|
568
|
+
axisStyles: $["bn-chart-structure"]["axisStyles"],
|
|
569
|
+
barStyles: $["bn-chart-structure"]["barStyles"],
|
|
570
|
+
varianceStyles: $["bn-chart-structure"]["varianceStyles"],
|
|
571
|
+
padding: $["bn-chart-structure"]["padding"],
|
|
572
|
+
pattern: null,
|
|
573
|
+
};
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
prepareChartTitle(idx) {
|
|
577
|
+
if (idx >= 1) {
|
|
578
|
+
return "";
|
|
579
|
+
}
|
|
580
|
+
return this.chartTitle;
|
|
581
|
+
}
|
|
582
|
+
prepareStackConfig() {
|
|
583
|
+
if (withStyled.isBlankInput(this.stack)) {
|
|
584
|
+
this.errors.remove("WARN_stack_dimensions_scenarios");
|
|
585
|
+
return null;
|
|
586
|
+
}
|
|
587
|
+
try {
|
|
588
|
+
const parsed = JSON.parse(this.stack);
|
|
589
|
+
const by = parsed.by;
|
|
590
|
+
const errId = "WARN_stack_dimensions_scenarios";
|
|
591
|
+
if (by === Order.StackBy.DIMENSIONS) {
|
|
592
|
+
const scenarios = this.prepareScenarios();
|
|
593
|
+
if (scenarios.length > 1) {
|
|
594
|
+
this.errors.addOrReplace({
|
|
595
|
+
id: errId,
|
|
596
|
+
type: "warning",
|
|
597
|
+
message: `stack by dimensions: only the first scenario "${scenarios[0]}" is used, the rest (${scenarios.slice(1).join(", ")}) are discarded.`,
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
this.errors.remove(errId);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
this.errors.remove(errId);
|
|
606
|
+
}
|
|
607
|
+
return {
|
|
608
|
+
by,
|
|
609
|
+
mode: parsed.mode || Order.StackMode.ABSOLUTE,
|
|
610
|
+
order: parsed.order || Order.StackOrder.DATASET,
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
catch (_a) {
|
|
614
|
+
this.errors.remove("WARN_stack_dimensions_scenarios");
|
|
615
|
+
return null;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
prepareFilter() {
|
|
619
|
+
if (this.filter.length === 0) {
|
|
620
|
+
return "";
|
|
621
|
+
}
|
|
622
|
+
return this.filter;
|
|
623
|
+
}
|
|
624
|
+
prepareLimit() {
|
|
625
|
+
return Math.floor(Number(this.limit) || 0);
|
|
626
|
+
}
|
|
627
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
628
|
+
getDataStructure() {
|
|
629
|
+
const dataSetStructure = {
|
|
630
|
+
IStructureChartDataRow: {
|
|
631
|
+
operation: { type: "string", isOptional: false, description: "" },
|
|
632
|
+
rowGroup: { type: "string", isOptional: false, description: "" },
|
|
633
|
+
rowGroupIndex: { type: "number", isOptional: false, description: "" },
|
|
634
|
+
category: { type: "string", isOptional: false, description: "" },
|
|
635
|
+
categoryIndex: { type: "number", isOptional: false, description: "" },
|
|
636
|
+
subCategory: { type: "string", isOptional: false, description: "" },
|
|
637
|
+
subCategoryIndex: { type: "number", isOptional: false, description: "" },
|
|
638
|
+
columnGroup: { type: "string", isOptional: false, description: "" },
|
|
639
|
+
columnGroupIndex: { type: "number", isOptional: false, description: "" },
|
|
640
|
+
columnSubGroup: { type: "string", isOptional: false, description: "" },
|
|
641
|
+
columnSubGroupIndex: { type: "number", isOptional: false, description: "" },
|
|
642
|
+
ac1: { type: "number", isOptional: false, description: "" },
|
|
643
|
+
ac2: { type: "number", isOptional: false, description: "" },
|
|
644
|
+
ac3: { type: "number", isOptional: false, description: "" },
|
|
645
|
+
ac4: { type: "number", isOptional: false, description: "" },
|
|
646
|
+
pp1: { type: "number", isOptional: false, description: "" },
|
|
647
|
+
pp2: { type: "number", isOptional: false, description: "" },
|
|
648
|
+
pp3: { type: "number", isOptional: false, description: "" },
|
|
649
|
+
pp4: { type: "number", isOptional: false, description: "" },
|
|
650
|
+
fc1: { type: "number", isOptional: false, description: "" },
|
|
651
|
+
fc2: { type: "number", isOptional: false, description: "" },
|
|
652
|
+
fc3: { type: "number", isOptional: false, description: "" },
|
|
653
|
+
fc4: { type: "number", isOptional: false, description: "" },
|
|
654
|
+
pl1: { type: "number", isOptional: false, description: "" },
|
|
655
|
+
pl2: { type: "number", isOptional: false, description: "" },
|
|
656
|
+
pl3: { type: "number", isOptional: false, description: "" },
|
|
657
|
+
pl4: { type: "number", isOptional: false, description: "" },
|
|
658
|
+
},
|
|
659
|
+
};
|
|
660
|
+
return dataSetStructure;
|
|
661
|
+
}
|
|
662
|
+
prepareMeasureScale() {
|
|
663
|
+
if (withStyled.isBlankInput(this.measureScale)) {
|
|
664
|
+
return "GREATEST";
|
|
665
|
+
}
|
|
666
|
+
if (["_", "k", "M", "G", "T", "P", "E", "Z", "Y", "m", "μ", "n", "p", "P", "f", "a", "z", "y"].includes(this.measureScale.trim())) {
|
|
667
|
+
return this.measureScale.trim();
|
|
668
|
+
}
|
|
669
|
+
if (this.measureScale.trim().toUpperCase() === "LEAST") {
|
|
670
|
+
return this.measureScale.trim();
|
|
671
|
+
}
|
|
672
|
+
return "GREATEST";
|
|
673
|
+
}
|
|
674
|
+
prepareShowMeasureScale(idx) {
|
|
675
|
+
return idx === 0 && this.showMeasureScale === "true";
|
|
676
|
+
}
|
|
677
|
+
prepareMeasureUnit() {
|
|
678
|
+
if (this.measureUnit === "" || this.measureUnit == null) {
|
|
679
|
+
return "";
|
|
680
|
+
}
|
|
681
|
+
return this.measureUnit;
|
|
682
|
+
}
|
|
683
|
+
chartTemplate(localScenarioString, idx) {
|
|
684
|
+
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
685
|
+
const ppu = this.preparePixelPerUnit();
|
|
686
|
+
const ppp = this.preparePixelPerPercentage();
|
|
687
|
+
const stackConfig = this.prepareStackConfig();
|
|
688
|
+
const scenarios = this.prepareScenarios();
|
|
689
|
+
// Dimension stacking uses only the first scenario
|
|
690
|
+
const effectiveScenarios = (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === Order.StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
|
|
691
|
+
return (index.h("ibcs-chart-structure", { data: this.data, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideCategories: this.prepareHideCategories(idx), pixelPerUnit: ppu > 0 ? ppu * effectiveFactor : 0, pixelPerPercentage: ppp > 0 ? ppp * effectiveFactor : 0, limit: this.prepareLimit(), styles: this.prepareStyle(), i18n: this.prepareI18n(), order: this.prepareOrder(), level: this.prepareLevel(), filter: this.prepareFilter(), "measure-scale": this.prepareMeasureScale(), "measure-unit": this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(idx), stackConfig: stackConfig, parentDimensions: this.prepareDimension() }));
|
|
692
|
+
}
|
|
693
|
+
getEffectiveScaleFactor() {
|
|
694
|
+
const { mode, factor } = scaling.parseScaling(this.scale);
|
|
695
|
+
if (mode === "factor")
|
|
696
|
+
return factor;
|
|
697
|
+
if (mode === "auto" || mode === "empty")
|
|
698
|
+
return this.appliedScaleFactor;
|
|
699
|
+
return 1;
|
|
700
|
+
}
|
|
701
|
+
getFontStyles() {
|
|
702
|
+
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
703
|
+
return this.componentStyle(($) => {
|
|
704
|
+
var _a, _b, _c, _d;
|
|
705
|
+
const baseFontSize = ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333;
|
|
706
|
+
return {
|
|
707
|
+
"--bn-font-family": ((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontFamily"]) || "'Noto Sans', sans-serif",
|
|
708
|
+
"--bn-font-size": `${baseFontSize * effectiveFactor}px`,
|
|
709
|
+
"--bn-font-color": ((_c = $["global"]) === null || _c === void 0 ? void 0 : _c["fontColor"]) || "#000000",
|
|
710
|
+
"--bn-font-background": ((_d = $["global"]) === null || _d === void 0 ? void 0 : _d["fontBackgroundColor"]) || "#ffffff",
|
|
711
|
+
};
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
render() {
|
|
715
|
+
let scenariosArray = [""];
|
|
716
|
+
const variancesArray = this.prepareVariances();
|
|
717
|
+
if (variancesArray.length > 0) {
|
|
718
|
+
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
719
|
+
}
|
|
720
|
+
const fontStyles = this.getFontStyles();
|
|
721
|
+
return (index.h(index.Host, { key: '570fb741ddf481be0f3055d346314ad39a455361', style: fontStyles }, index.h("div", { key: 'e84cfe2e00dd2f960f038844e00449431efa6ce0', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
722
|
+
}
|
|
723
|
+
get element() { return index.getElement(this); }
|
|
724
|
+
static get watchers() { return {
|
|
725
|
+
"scenarios": [{
|
|
726
|
+
"validateScenario": 0
|
|
727
|
+
}],
|
|
728
|
+
"variances": [{
|
|
729
|
+
"validateVariances": 0
|
|
730
|
+
}],
|
|
731
|
+
"unitScaling": [{
|
|
732
|
+
"validateUnitScaling": 0
|
|
733
|
+
}],
|
|
734
|
+
"percentageScaling": [{
|
|
735
|
+
"validatePercentageScaling": 0
|
|
736
|
+
}],
|
|
737
|
+
"level": [{
|
|
738
|
+
"validateLevel": 0
|
|
739
|
+
}],
|
|
740
|
+
"order": [{
|
|
741
|
+
"validateOrderList": 0
|
|
742
|
+
}],
|
|
743
|
+
"orderDirection": [{
|
|
744
|
+
"validateOrderDirection": 0
|
|
745
|
+
}],
|
|
746
|
+
"limit": [{
|
|
747
|
+
"validateLimit": 0
|
|
748
|
+
}],
|
|
749
|
+
"showCategories": [{
|
|
750
|
+
"validateShowCategories": 0
|
|
751
|
+
}],
|
|
752
|
+
"measureScale": [{
|
|
753
|
+
"validateMeasureScale": 0
|
|
754
|
+
}],
|
|
755
|
+
"showMeasureScale": [{
|
|
756
|
+
"validateShowMeasureScale": 0
|
|
757
|
+
}],
|
|
758
|
+
"stack": [{
|
|
759
|
+
"validateStack": 0
|
|
760
|
+
}],
|
|
761
|
+
"scale": [{
|
|
762
|
+
"validateScaling": 0
|
|
763
|
+
}]
|
|
764
|
+
}; }
|
|
765
|
+
};
|
|
766
|
+
Chart.style = bnChartStructureCss$1();
|
|
767
|
+
|
|
768
|
+
const bnContextCss = () => `:host{display:block}`;
|
|
769
|
+
|
|
770
|
+
const Context = class {
|
|
771
|
+
constructor(hostRef) {
|
|
772
|
+
index.registerInstance(this, hostRef);
|
|
773
|
+
this.currentPageUpdate = undefined;
|
|
774
|
+
withComponentStatus.withComponentStatus(this);
|
|
775
|
+
this.errors = withHasError.withHasError(this);
|
|
776
|
+
}
|
|
777
|
+
setLocale(newValue) {
|
|
778
|
+
this.stores.context.state.locale = newValue;
|
|
779
|
+
}
|
|
780
|
+
connectedCallback() {
|
|
781
|
+
// Retrieve (or create) the stores for this context element.
|
|
782
|
+
// A descendant component may have already triggered creation via
|
|
783
|
+
// getStores() if Stencil initialized it before this component.
|
|
784
|
+
this.stores = contextProtocol.getOrCreateStores(this.element);
|
|
785
|
+
if (this.locale) {
|
|
786
|
+
this.stores.context.state.locale = this.locale;
|
|
787
|
+
}
|
|
788
|
+
this.currentPageUpdate = setTimeout(() => {
|
|
789
|
+
this.element.querySelectorAll("bn-page, bn-layout-page").forEach((page, index) => {
|
|
790
|
+
if (page.localName === "bn-layout-page") {
|
|
791
|
+
page.setAttribute("page-number", (index + 1).toString());
|
|
792
|
+
}
|
|
793
|
+
else {
|
|
794
|
+
const footer = page.querySelector("bn-footer");
|
|
795
|
+
if (footer) {
|
|
796
|
+
// @ts-ignore
|
|
797
|
+
footer.setAttribute("page-number", (index + 1).toString());
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
}, 250);
|
|
802
|
+
}
|
|
803
|
+
disconnectedCallback() {
|
|
804
|
+
if (this.currentPageUpdate) {
|
|
805
|
+
clearTimeout(this.currentPageUpdate);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
componentWillLoad() {
|
|
809
|
+
// stencil needs one componenet implementing all lifecycle steps to get mixing working
|
|
810
|
+
}
|
|
811
|
+
componentDidLoad() { }
|
|
812
|
+
componentShouldUpdate() { }
|
|
813
|
+
componentWillRender() { }
|
|
814
|
+
componentDidRender() { }
|
|
815
|
+
componentWillUpdate() { }
|
|
816
|
+
componentDidUpdate() { }
|
|
817
|
+
render() {
|
|
818
|
+
return (index.h(index.Host, { key: 'b92019b909e271225baca2cf740c8301e324164e' }, index.h("slot", { key: '87bac4bb29bca32d961afe31355dc1bd48fff0f8' })));
|
|
819
|
+
}
|
|
820
|
+
get element() { return index.getElement(this); }
|
|
821
|
+
static get watchers() { return {
|
|
822
|
+
"locale": [{
|
|
823
|
+
"setLocale": 0
|
|
824
|
+
}]
|
|
825
|
+
}; }
|
|
826
|
+
};
|
|
827
|
+
Context.style = bnContextCss();
|
|
828
|
+
|
|
829
|
+
const bnDatasourceCss = () => `bn-datasource{display:none}`;
|
|
830
|
+
|
|
831
|
+
const Datasource = class {
|
|
832
|
+
constructor(hostRef) {
|
|
833
|
+
index.registerInstance(this, hostRef);
|
|
834
|
+
/**
|
|
835
|
+
* When true (default), body content is plain JSON text.
|
|
836
|
+
* When false, body content is a compressed payload (`<hash>:<base64_gzip>`).
|
|
837
|
+
*/
|
|
838
|
+
this.raw = true;
|
|
839
|
+
this.lastHash = null;
|
|
840
|
+
withComponentStatus.withComponentStatus(this);
|
|
841
|
+
this.errors = withHasError.withHasError(this);
|
|
842
|
+
withBodyObserver.withBodyObserver(this, (data) => {
|
|
843
|
+
if (!this.stores)
|
|
844
|
+
this.stores = contextProtocol.getStores(this.element);
|
|
845
|
+
try {
|
|
846
|
+
let contentHash;
|
|
847
|
+
let jsonString;
|
|
848
|
+
if (this.raw) {
|
|
849
|
+
contentHash = contentDecoder.computeContentHash(data);
|
|
850
|
+
jsonString = data;
|
|
851
|
+
}
|
|
852
|
+
else {
|
|
853
|
+
const decoded = contentDecoder.decodeCompressedContent(data);
|
|
854
|
+
contentHash = decoded.hash;
|
|
855
|
+
jsonString = decoded.json;
|
|
856
|
+
}
|
|
857
|
+
if (contentHash === this.lastHash)
|
|
858
|
+
return;
|
|
859
|
+
this.lastHash = contentHash;
|
|
860
|
+
const json = JSON.parse(jsonString);
|
|
861
|
+
// @ts-ignore
|
|
862
|
+
this.stores.datasources.set(this.name, json);
|
|
863
|
+
}
|
|
864
|
+
catch (e) {
|
|
865
|
+
console.error("Error parsing datasource", e, String(data).slice(0, 200));
|
|
866
|
+
// @ts-ignore
|
|
867
|
+
this.stores.datasources.set(this.name, []);
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
render() {
|
|
872
|
+
return index.h(index.Host, { key: '43b691b07f63d12ad6c835dfb5d5bf6053b3bbf4' });
|
|
873
|
+
}
|
|
874
|
+
get element() { return index.getElement(this); }
|
|
875
|
+
};
|
|
876
|
+
Datasource.style = bnDatasourceCss();
|
|
877
|
+
|
|
878
|
+
const bnPageCss = () => `:host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);height:768px;width:1024px;display:flex;flex-direction:column;page-break-after:always;overflow:hidden}:host([format=xga]){height:768px;width:1024px}:host([format=xga][orientation=portrait]){height:1024px;width:768px}:host([format=xga][orientation=landscape]){height:768px;width:1024px}:host([format=hd]){height:720px;width:1280px}:host([format=hd][orientation=portrait]){height:1280px;width:720px}:host([format=hd][orientation=landscape]){height:720px;width:1280px}:host([format=full_hd]){height:1080px;width:1920px}:host([format=full_hd][orientation=portrait]){height:1920px;width:1080px}:host([format=full_hd][orientation=landscape]){height:1080px;width:1920px}:host([format="4k"]){height:2160px;width:3840px}:host([format="4k"][orientation=portrait]){height:3840px;width:2160px}:host([format="4k"][orientation=landscape]){height:2160px;width:3840px}:host([format="4k2k"]){height:2160px;width:4096px}:host([format="4k2k"][orientation=portrait]){height:4096px;width:2160px}:host([format="4k2k"][orientation=landscape]){height:2160px;width:4096px}:host([format=a6]){height:5.83in;width:4.13in}:host([format=a6][orientation=portrait]){height:5.83in;width:4.13in}:host([format=a6][orientation=landscape]){height:4.13in;width:5.83in}:host([format=a5]){height:8.27in;width:5.83in}:host([format=a5][orientation=portrait]){height:8.27in;width:5.83in}:host([format=a5][orientation=landscape]){height:5.83in;width:8.27in}:host([format=a4]){height:11.6in;width:8.17in}:host([format=a4][orientation=portrait]){height:11.6in;width:8.17in}:host([format=a4][orientation=landscape]){height:8.17in;width:11.6in}:host([format=a3]){height:16.54in;width:11.7in}:host([format=a3][orientation=portrait]){height:16.54in;width:11.7in}:host([format=a3][orientation=landscape]){height:11.7in;width:16.54in}:host([format=a2]){height:23.4in;width:16.54in}:host([format=a2][orientation=portrait]){height:23.4in;width:16.54in}:host([format=a2][orientation=landscape]){height:16.54in;width:23.4in}:host([format=a1]){height:33.1in;width:23.4in}:host([format=a1][orientation=portrait]){height:33.1in;width:23.4in}:host([format=a1][orientation=landscape]){height:23.4in;width:33.1in}:host([format=a0]){height:46.8in;width:33.1in}:host([format=a0][orientation=portrait]){height:46.8in;width:33.1in}:host([format=a0][orientation=landscape]){height:33.1in;width:46.8in}:host([format=letter]){height:11in;width:8.5in}:host([format=letter][orientation=portrait]){height:11in;width:8.5in}:host([format=letter][orientation=landscape]){height:8.5in;width:11in}:host([format=legal]){height:14in;width:8.5in}:host([format=legal][orientation=portrait]){height:14in;width:8.5in}:host([format=legal][orientation=landscape]){height:8.5in;width:14in}:host([format=tabloid]){height:17in;width:11in}:host([format=tabloid][orientation=portrait]){height:17in;width:11in}:host([format=tabloid][orientation=landscape]){height:11in;width:17in}:host([format=ledger]){height:11in;width:17in}:host([format=ledger][orientation=portrait]){height:17in;width:11in}:host([format=ledger][orientation=landscape]){height:11in;width:17in}`;
|
|
879
|
+
|
|
880
|
+
const VALID_FORMATS = ["xga", "hd", "full-hd", "4k", "4k2k", "a4", "a3", "a2", "a1", "a0", "letter", "legal"];
|
|
881
|
+
const VALID_ORIENTATIONS = ["landscape", "portrait"];
|
|
882
|
+
const Page = class {
|
|
883
|
+
constructor(hostRef) {
|
|
884
|
+
index.registerInstance(this, hostRef);
|
|
885
|
+
withComponentStatus.withComponentStatus(this);
|
|
886
|
+
this.errors = withHasError.withHasError(this);
|
|
887
|
+
this.componentStyle = withComponentStyle.withComponentStyle(this);
|
|
888
|
+
}
|
|
889
|
+
validateFormat(newValue) {
|
|
890
|
+
const errId = "ERR_format";
|
|
891
|
+
if (!withStyled.isBlankInput(newValue) && !VALID_FORMATS.includes(newValue)) {
|
|
892
|
+
this.errors.addOrReplace({
|
|
893
|
+
id: errId,
|
|
894
|
+
type: "warning",
|
|
895
|
+
message: `format: invalid value '${newValue}' is not supported. Valid values: ${VALID_FORMATS.join(", ")}`,
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
else {
|
|
899
|
+
this.errors.remove(errId);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
validateOrientation(newValue) {
|
|
903
|
+
const errId = "ERR_orientation";
|
|
904
|
+
if (!withStyled.isBlankInput(newValue) && !VALID_ORIENTATIONS.includes(newValue)) {
|
|
905
|
+
this.errors.addOrReplace({
|
|
906
|
+
id: errId,
|
|
907
|
+
type: "warning",
|
|
908
|
+
message: `orientation: invalid value '${newValue}' is not supported. Valid values: ${VALID_ORIENTATIONS.join(", ")}`,
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
else {
|
|
912
|
+
this.errors.remove(errId);
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
render() {
|
|
916
|
+
return (index.h(index.Host, { key: 'b4d682a8f6e83f77c58236265eaf9d1327809c6f', format: this.format, orientation: this.orientation, style: this.prepareStyle() }, index.h("slot", { key: 'ef49c43c1f8926c4c968b752608627adbe330d6c' })));
|
|
917
|
+
}
|
|
918
|
+
prepareStyle() {
|
|
919
|
+
const pageStyle = {
|
|
920
|
+
"font-family": this.componentStyle(($) => $.global["fontFamily"]),
|
|
921
|
+
"font-size": `${this.componentStyle(($) => $.global["fontSizePx"])}px`,
|
|
922
|
+
"--bn-font-family": this.componentStyle(($) => $.global["fontFamily"]) || "'Noto Sans', sans-serif",
|
|
923
|
+
"--bn-font-size": `${this.componentStyle(($) => $.global["fontSizePx"]) || 13.3333}px`,
|
|
924
|
+
"--bn-font-color": this.componentStyle(($) => $.global["fontColor"]) || "#000000",
|
|
925
|
+
"--bn-font-background": this.componentStyle(($) => $.global["fontBackgroundColor"]) || "#ffffff",
|
|
926
|
+
};
|
|
927
|
+
return pageStyle;
|
|
928
|
+
}
|
|
929
|
+
get element() { return index.getElement(this); }
|
|
930
|
+
static get watchers() { return {
|
|
931
|
+
"format": [{
|
|
932
|
+
"validateFormat": 0
|
|
933
|
+
}],
|
|
934
|
+
"orientation": [{
|
|
935
|
+
"validateOrientation": 0
|
|
936
|
+
}]
|
|
937
|
+
}; }
|
|
938
|
+
};
|
|
939
|
+
Page.style = bnPageCss();
|
|
940
|
+
|
|
12
941
|
/**
|
|
13
942
|
* Spatial layout engine for the structure chart (horizontal bars).
|
|
14
943
|
*
|
|
@@ -359,7 +1288,7 @@ class StructureChartComponentConfig {
|
|
|
359
1288
|
this.pixelPerPercentage = 50;
|
|
360
1289
|
/** Maximum data points to display; 0 means unlimited. */
|
|
361
1290
|
this.limit = 0;
|
|
362
|
-
this.sortOrder = new Order.OrderAdapter(new
|
|
1291
|
+
this.sortOrder = new Order.OrderAdapter(new ibcsRuleSet.StringAdapter()).default();
|
|
363
1292
|
this.level = Order.AggregationLevel.CATEGORY;
|
|
364
1293
|
this.filter = "";
|
|
365
1294
|
/** SI prefix for measure scaling (e.g. "k" for thousands, "M" for millions). */
|
|
@@ -681,6 +1610,7 @@ class StructureChartStyle {
|
|
|
681
1610
|
this.varianceStyles = varianceStyles;
|
|
682
1611
|
this.padding = padding;
|
|
683
1612
|
this.pattern = new Map();
|
|
1613
|
+
this.stackColors = ["#000000", "#c0c0c0", "#808080"];
|
|
684
1614
|
}
|
|
685
1615
|
}
|
|
686
1616
|
/** Adapts raw componentStyle JSON into a StructureChartStyle, falling back to defaults for missing properties. */
|
|
@@ -713,6 +1643,9 @@ class StructureChartStylesAdapter {
|
|
|
713
1643
|
if (Order.CompareUtil.isExisting(data.padding)) {
|
|
714
1644
|
styles.padding = this.paddingadapter.adapt(data.padding);
|
|
715
1645
|
}
|
|
1646
|
+
if (Array.isArray(data.stackColors) && data.stackColors.length > 0) {
|
|
1647
|
+
styles.stackColors = data.stackColors;
|
|
1648
|
+
}
|
|
716
1649
|
styles.pattern = new MarkerPattern(styles.fontStyles.size).createPatternMapForStructureBar();
|
|
717
1650
|
}
|
|
718
1651
|
return styles;
|
|
@@ -1638,10 +2571,10 @@ class StackedBar {
|
|
|
1638
2571
|
xPos = axisX + baselinePixels;
|
|
1639
2572
|
}
|
|
1640
2573
|
const yPos = this.position.getBarPositionY(this.index, true);
|
|
1641
|
-
|
|
1642
|
-
const fillColor =
|
|
2574
|
+
const colors = this.styles.stackColors;
|
|
2575
|
+
const fillColor = colors[this.segmentIndex % colors.length];
|
|
1643
2576
|
const fillStyle = { color: fillColor };
|
|
1644
|
-
const strokeStyle = { color:
|
|
2577
|
+
const strokeStyle = { color: fillColor, width: 0.5 };
|
|
1645
2578
|
this.barGroup.rect(Math.max(segmentLength, 0.5), barWidth).fill(fillStyle).stroke(strokeStyle).cy(yPos).x(xPos);
|
|
1646
2579
|
// Draw segment value label centered on bar if wide enough
|
|
1647
2580
|
const MIN_SEGMENT_WIDTH_FOR_LABEL = 30;
|
|
@@ -1837,8 +2770,9 @@ class StructureChart {
|
|
|
1837
2770
|
this.dataFormatDigits = { percent: 2, decimal: 1 };
|
|
1838
2771
|
this.stackConfig = null;
|
|
1839
2772
|
this.overflowConfig = null;
|
|
2773
|
+
this.highestStackedTotal = 0;
|
|
1840
2774
|
this.initSQLFunctions();
|
|
1841
|
-
this.ruleSet = ruleSet || new
|
|
2775
|
+
this.ruleSet = ruleSet || new ibcsRuleSet.IBCSRuleSet();
|
|
1842
2776
|
this.i18n = this.createI18n(new Map());
|
|
1843
2777
|
this.styles = styles;
|
|
1844
2778
|
this.setConfig(config);
|
|
@@ -1875,7 +2809,7 @@ class StructureChart {
|
|
|
1875
2809
|
this.setData([...config.data], config.filter);
|
|
1876
2810
|
this.dataModel = this.populateModel(config.scenarios, config.level, config.sortOrder);
|
|
1877
2811
|
// Populate per-dimension stack segments when stacking by a data dimension
|
|
1878
|
-
if (config.stackConfig && config.stackConfig.by !== Order.StackBy.
|
|
2812
|
+
if (config.stackConfig && config.stackConfig.by !== Order.StackBy.SCENARIOS) {
|
|
1879
2813
|
this.populateDimensionStackSegments(config.scenarios, config.stackConfig, config.level);
|
|
1880
2814
|
}
|
|
1881
2815
|
this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
|
|
@@ -1889,6 +2823,7 @@ class StructureChart {
|
|
|
1889
2823
|
this.measureUnit = config.measureUnit;
|
|
1890
2824
|
this.dataFormatDigits = config.dataFormatDigits;
|
|
1891
2825
|
this.stackConfig = config.stackConfig;
|
|
2826
|
+
this.highestStackedTotal = this.findHighestStackedRowTotal(this.dataModel);
|
|
1892
2827
|
this.updatePosition();
|
|
1893
2828
|
}
|
|
1894
2829
|
sortScenariosbyVisualisationRules(config) {
|
|
@@ -1978,6 +2913,30 @@ class StructureChart {
|
|
|
1978
2913
|
this.preparedDataSet = data;
|
|
1979
2914
|
}
|
|
1980
2915
|
}
|
|
2916
|
+
/**
|
|
2917
|
+
* Returns the data value whose bar extent is proportional to pixelPerUnit.
|
|
2918
|
+
* Used by autoFitScaling to separate fixed vs variable width components.
|
|
2919
|
+
*/
|
|
2920
|
+
getMaxBarValue() {
|
|
2921
|
+
var _a, _b;
|
|
2922
|
+
// Stacked: bar extent = highestStackedTotal * ppu (or just ppu for relative)
|
|
2923
|
+
if (this.stackConfig != null && this.highestStackedTotal > 0) {
|
|
2924
|
+
if (this.stackConfig.mode === Order.StackMode.RELATIVE) {
|
|
2925
|
+
return 1;
|
|
2926
|
+
}
|
|
2927
|
+
return this.highestStackedTotal;
|
|
2928
|
+
}
|
|
2929
|
+
// Non-stacked: bar extent = highestDataPointValue * ppu
|
|
2930
|
+
const vt = this.getVarianceType();
|
|
2931
|
+
if (vt === VarianceType.NONE && ((_a = this.highestDataPointValue) === null || _a === void 0 ? void 0 : _a.value) != null) {
|
|
2932
|
+
return Math.abs(this.highestDataPointValue.value);
|
|
2933
|
+
}
|
|
2934
|
+
if (vt === VarianceType.ABSOLUTE && ((_b = this.highestVarianceDataPointValue) === null || _b === void 0 ? void 0 : _b.value) != null) {
|
|
2935
|
+
return Math.abs(this.highestVarianceDataPointValue.value);
|
|
2936
|
+
}
|
|
2937
|
+
// RELATIVE variance depends on pixelPerPercentage, not pixelPerUnit
|
|
2938
|
+
return 0;
|
|
2939
|
+
}
|
|
1981
2940
|
getAllocatedCanvasWidth() {
|
|
1982
2941
|
//let columnLabelWidth = this.calculateCategoryWidth();
|
|
1983
2942
|
const leftSideWidth = this.position.getAxisPositionX(); //this.calculateLeftSideWidth(this.getVarianceType());
|
|
@@ -2228,6 +3187,48 @@ class StructureChart {
|
|
|
2228
3187
|
}
|
|
2229
3188
|
return highestDataPoint;
|
|
2230
3189
|
}
|
|
3190
|
+
findHighestStackedRowTotal(dataModel) {
|
|
3191
|
+
if (!this.stackConfig || dataModel.length === 0)
|
|
3192
|
+
return 0;
|
|
3193
|
+
const isScenarioStack = this.stackConfig.by === Order.StackBy.SCENARIOS;
|
|
3194
|
+
let maxTotal = 0;
|
|
3195
|
+
for (const row of dataModel) {
|
|
3196
|
+
let rowTotal = 0;
|
|
3197
|
+
if (isScenarioStack) {
|
|
3198
|
+
const scenarioKeys = ["scenario1", "scenario2", "scenario3", "scenario4"];
|
|
3199
|
+
const segments = [];
|
|
3200
|
+
for (const key of scenarioKeys) {
|
|
3201
|
+
const dp = row[key];
|
|
3202
|
+
if (dp && !dp.isEmpty() && dp.value != null) {
|
|
3203
|
+
segments.push({ value: dp.value, scenario: dp.scenario });
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
const prefixes = new Set(segments.map((s) => SVGVariancesStyleGroup.getScenarioPrefix(s.scenario)));
|
|
3207
|
+
if (prefixes.size > 1) {
|
|
3208
|
+
// Overlay: groups overlap from baseline, width = max group total
|
|
3209
|
+
const groupMap = new Map();
|
|
3210
|
+
for (const seg of segments) {
|
|
3211
|
+
const prefix = SVGVariancesStyleGroup.getScenarioPrefix(seg.scenario);
|
|
3212
|
+
groupMap.set(prefix, (groupMap.get(prefix) || 0) + Math.abs(seg.value));
|
|
3213
|
+
}
|
|
3214
|
+
rowTotal = Math.max(...groupMap.values());
|
|
3215
|
+
}
|
|
3216
|
+
else {
|
|
3217
|
+
// Single group: segments stack end-to-end, width = sum
|
|
3218
|
+
rowTotal = segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
else {
|
|
3222
|
+
// Dimension stacking: use stackSegments
|
|
3223
|
+
if (row.stackSegments && row.stackSegments.length > 0) {
|
|
3224
|
+
rowTotal = row.stackSegments.reduce((sum, s) => sum + Math.abs(s.value), 0);
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
if (rowTotal > maxTotal)
|
|
3228
|
+
maxTotal = rowTotal;
|
|
3229
|
+
}
|
|
3230
|
+
return maxTotal;
|
|
3231
|
+
}
|
|
2231
3232
|
populateVarianceModel(variancesConfig, dataModel) {
|
|
2232
3233
|
const varianceModel = [];
|
|
2233
3234
|
if (variancesConfig.length === 0) {
|
|
@@ -2375,7 +3376,7 @@ class StructureChart {
|
|
|
2375
3376
|
if (!this.stackConfig)
|
|
2376
3377
|
return;
|
|
2377
3378
|
const stackGroup = svgContainer.group().id("StackedScenarios");
|
|
2378
|
-
const isScenarioStack = this.stackConfig.by === Order.StackBy.
|
|
3379
|
+
const isScenarioStack = this.stackConfig.by === Order.StackBy.SCENARIOS;
|
|
2379
3380
|
dataModel.forEach((elements, index) => {
|
|
2380
3381
|
const scenarioKeys = ["scenario1", "scenario2", "scenario3", "scenario4"];
|
|
2381
3382
|
const segments = [];
|
|
@@ -2476,7 +3477,7 @@ class StructureChart {
|
|
|
2476
3477
|
drawStackedHeaders(dataModel, svgContainer) {
|
|
2477
3478
|
if (!this.stackConfig || dataModel.length === 0)
|
|
2478
3479
|
return;
|
|
2479
|
-
const isScenarioStack = this.stackConfig.by === Order.StackBy.
|
|
3480
|
+
const isScenarioStack = this.stackConfig.by === Order.StackBy.SCENARIOS;
|
|
2480
3481
|
const headerGroup = svgContainer.group().id("StackedHeaders");
|
|
2481
3482
|
const firstRow = dataModel[0];
|
|
2482
3483
|
// Dimension stacking: use stackSegments from first row for headers
|
|
@@ -2611,6 +3612,20 @@ class StructureChart {
|
|
|
2611
3612
|
}
|
|
2612
3613
|
calculateRightSideWidth(varianceType) {
|
|
2613
3614
|
var _a, _b, _c;
|
|
3615
|
+
// Stacked charts: width based on max row total, not individual max
|
|
3616
|
+
if (this.stackConfig != null && this.highestStackedTotal > 0) {
|
|
3617
|
+
const labelToBar = this.styles.fontStyles.size * this.styles.scaleFactors.labelToBar;
|
|
3618
|
+
let barExtent;
|
|
3619
|
+
if (this.stackConfig.mode === Order.StackMode.RELATIVE) {
|
|
3620
|
+
barExtent = this.pixelPerUnit;
|
|
3621
|
+
}
|
|
3622
|
+
else {
|
|
3623
|
+
barExtent = this.highestStackedTotal * this.pixelPerUnit;
|
|
3624
|
+
}
|
|
3625
|
+
const sizeTotalLabel = this.calculateTextBoxWidth(this.highestStackedTotal);
|
|
3626
|
+
const width = barExtent + labelToBar + sizeTotalLabel;
|
|
3627
|
+
return Math.max(width, this.titleLength);
|
|
3628
|
+
}
|
|
2614
3629
|
let width = 0;
|
|
2615
3630
|
const labelToBar = this.styles.fontStyles.size * this.styles.scaleFactors.labelToBar;
|
|
2616
3631
|
if (VarianceType.NONE === varianceType &&
|
|
@@ -2640,19 +3655,20 @@ class StructureChart {
|
|
|
2640
3655
|
* For dimension stacking (by category, subcategory, or rowgroup), query the raw data
|
|
2641
3656
|
* at the stack dimension level and attach stackSegments to each dataModel row.
|
|
2642
3657
|
*/
|
|
2643
|
-
populateDimensionStackSegments(scenarios,
|
|
3658
|
+
populateDimensionStackSegments(scenarios, _stackConfig, level) {
|
|
2644
3659
|
var _a;
|
|
2645
3660
|
if (((_a = this.preparedDataSet) === null || _a === void 0 ? void 0 : _a.length) === 0 || scenarios.length === 0)
|
|
2646
3661
|
return;
|
|
2647
|
-
//
|
|
2648
|
-
const
|
|
2649
|
-
[Order.
|
|
2650
|
-
[Order.
|
|
2651
|
-
[Order.
|
|
3662
|
+
// Derive stack column from level: stack by the next-lower hierarchy dimension
|
|
3663
|
+
const nextLowerDimension = {
|
|
3664
|
+
[Order.AggregationLevel.ROWGROUP]: "category",
|
|
3665
|
+
[Order.AggregationLevel.ROWGROUPINDEX]: "category",
|
|
3666
|
+
[Order.AggregationLevel.CATEGORY]: "subCategory",
|
|
3667
|
+
[Order.AggregationLevel.CATEGORYINDEX]: "subCategory",
|
|
2652
3668
|
};
|
|
2653
|
-
const stackColumn =
|
|
3669
|
+
const stackColumn = nextLowerDimension[level];
|
|
2654
3670
|
if (!stackColumn)
|
|
2655
|
-
return;
|
|
3671
|
+
return; // subCategory has no lower dimension
|
|
2656
3672
|
// The display level column (what each bar represents)
|
|
2657
3673
|
const displayColumn = level.toString(); // e.g. 'rowGroup', 'category', 'subCategory'
|
|
2658
3674
|
const scenario = scenarios[0]; // dimension stacking uses first scenario
|
|
@@ -2799,7 +3815,7 @@ const IbcsChartStructure = class {
|
|
|
2799
3815
|
var _a;
|
|
2800
3816
|
const config = this.prepareConfig();
|
|
2801
3817
|
const styles = this.prepareStyle();
|
|
2802
|
-
this.chart = new StructureChart(new
|
|
3818
|
+
this.chart = new StructureChart(new ibcsRuleSet.IBCSRuleSet(), config, styles);
|
|
2803
3819
|
this.chart.setI18n(this.i18n);
|
|
2804
3820
|
this.autoFitScaling(config, styles);
|
|
2805
3821
|
this.chart.setAvailableWidth(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
|
|
@@ -2835,23 +3851,33 @@ const IbcsChartStructure = class {
|
|
|
2835
3851
|
const targetWidth = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width;
|
|
2836
3852
|
if (!targetWidth || targetWidth <= 0) {
|
|
2837
3853
|
config.pixelPerUnit = 1;
|
|
2838
|
-
this.chart = new StructureChart(new
|
|
3854
|
+
this.chart = new StructureChart(new ibcsRuleSet.IBCSRuleSet(), config, styles);
|
|
2839
3855
|
this.chart.setI18n(this.i18n);
|
|
2840
3856
|
return;
|
|
2841
3857
|
}
|
|
2842
|
-
// First pass with pixelPerUnit=1 to measure
|
|
3858
|
+
// First pass with pixelPerUnit=1 to measure total width and bar extent
|
|
2843
3859
|
config.pixelPerUnit = 1;
|
|
2844
|
-
this.chart = new StructureChart(new
|
|
3860
|
+
this.chart = new StructureChart(new ibcsRuleSet.IBCSRuleSet(), config, styles);
|
|
2845
3861
|
this.chart.setI18n(this.i18n);
|
|
2846
3862
|
this.chart.toString();
|
|
2847
3863
|
const svgWidth = this.chart.getAllocatedCanvasWidth();
|
|
2848
3864
|
if (svgWidth <= 0) {
|
|
2849
3865
|
return;
|
|
2850
3866
|
}
|
|
2851
|
-
//
|
|
2852
|
-
|
|
3867
|
+
// Separate fixed parts (labels, padding, spacing) from variable part (bar extent).
|
|
3868
|
+
// totalWidth(ppu) = fixedWidth + maxBarValue * ppu
|
|
3869
|
+
// Solving for ppu: ppu = (targetWidth - fixedWidth) / maxBarValue
|
|
3870
|
+
const maxBarValue = this.chart.getMaxBarValue();
|
|
3871
|
+
if (maxBarValue > 0) {
|
|
3872
|
+
const fixedWidth = svgWidth - maxBarValue; // at ppu=1, barExtent = maxBarValue * 1
|
|
3873
|
+
config.pixelPerUnit = Math.max(0.001, (targetWidth - fixedWidth) / maxBarValue);
|
|
3874
|
+
}
|
|
3875
|
+
else {
|
|
3876
|
+
// Fallback (e.g. relative variance charts)
|
|
3877
|
+
config.pixelPerUnit = (targetWidth * 0.9) / svgWidth;
|
|
3878
|
+
}
|
|
2853
3879
|
// Second pass with the corrected scaling
|
|
2854
|
-
this.chart = new StructureChart(new
|
|
3880
|
+
this.chart = new StructureChart(new ibcsRuleSet.IBCSRuleSet(), config, styles);
|
|
2855
3881
|
this.chart.setI18n(this.i18n);
|
|
2856
3882
|
}
|
|
2857
3883
|
async componentWillRender() {
|
|
@@ -2875,7 +3901,7 @@ const IbcsChartStructure = class {
|
|
|
2875
3901
|
// }
|
|
2876
3902
|
}
|
|
2877
3903
|
prepareConfig() {
|
|
2878
|
-
return new StructureChartComponentConfigAdapter(new StructureChartDataRowAdapter(), new Order.OrderAdapter(new
|
|
3904
|
+
return new StructureChartComponentConfigAdapter(new StructureChartDataRowAdapter(), new Order.OrderAdapter(new ibcsRuleSet.StringAdapter()), new ibcsRuleSet.StringAdapter(), new DataFormatDigits.DataFormatDigitsAdapter(), this.data).adapt({
|
|
2879
3905
|
data: this.data,
|
|
2880
3906
|
scenarios: this.scenarios,
|
|
2881
3907
|
variances: this.variances,
|
|
@@ -2901,4 +3927,8 @@ const IbcsChartStructure = class {
|
|
|
2901
3927
|
};
|
|
2902
3928
|
IbcsChartStructure.style = bnChartStructureCss();
|
|
2903
3929
|
|
|
3930
|
+
exports.bn_chart_structure = Chart;
|
|
3931
|
+
exports.bn_context = Context;
|
|
3932
|
+
exports.bn_datasource = Datasource;
|
|
3933
|
+
exports.bn_page = Page;
|
|
2904
3934
|
exports.ibcs_chart_structure = IbcsChartStructure;
|