@bino-bi/bn-template-engine 1.0.0-alpha.3 → 1.0.0-alpha.5

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.
Files changed (198) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-1265d8d3.entry.js +1 -0
  3. package/dist/bn-template-engine/p-15516dac.entry.js +1 -0
  4. package/dist/bn-template-engine/p-1c716641.entry.js +1 -0
  5. package/dist/bn-template-engine/p-27cc8dc0.entry.js +1 -0
  6. package/dist/bn-template-engine/p-3b4c7425.entry.js +1 -0
  7. package/dist/bn-template-engine/p-4426d484.entry.js +1 -0
  8. package/dist/bn-template-engine/p-51f8dc9e.entry.js +1 -0
  9. package/dist/bn-template-engine/p-53d4e690.entry.js +1 -0
  10. package/dist/bn-template-engine/p-5KQYRQLK.js +1 -0
  11. package/dist/bn-template-engine/p-7337e03d.entry.js +1 -0
  12. package/dist/bn-template-engine/{p-0f1504f3.entry.js → p-75e97c87.entry.js} +1 -1
  13. package/dist/bn-template-engine/p-7a560278.entry.js +1 -0
  14. package/dist/bn-template-engine/p-BYBpC0EO.js +1 -0
  15. package/dist/bn-template-engine/p-BfXY5dsy.js +1 -0
  16. package/dist/bn-template-engine/p-BgnHJQ9Q.js +1 -0
  17. package/dist/bn-template-engine/{p-B4ySv9KQ.js → p-Bhd_WSML.js} +1 -1
  18. package/dist/bn-template-engine/p-Bka-Z6jo.js +1 -0
  19. package/dist/bn-template-engine/p-Bnhh02CF.js +1 -0
  20. package/dist/bn-template-engine/p-C7dQL8CS.js +1 -0
  21. package/dist/bn-template-engine/p-CL1RYuNU.js +1 -0
  22. package/dist/bn-template-engine/p-CYwd_ZNM.js +1 -0
  23. package/dist/bn-template-engine/p-ChlK-T9I.js +1 -0
  24. package/dist/bn-template-engine/p-DHezf8pZ.js +1 -0
  25. package/dist/bn-template-engine/{p-DVMu6dEy.js → p-DlppAFq9.js} +1 -1
  26. package/dist/bn-template-engine/p-DvDDgmcV.js +1 -0
  27. package/dist/bn-template-engine/p-DvvwfRQG.js +1 -0
  28. package/dist/bn-template-engine/{p-DG-1MR_T.js → p-P7pGJBgc.js} +1 -1
  29. package/dist/bn-template-engine/p-abc0067c.entry.js +1 -0
  30. package/dist/bn-template-engine/p-b34eaf86.entry.js +1 -0
  31. package/dist/bn-template-engine/p-bdb8b44c.entry.js +1 -0
  32. package/dist/bn-template-engine/p-c44fcb8e.entry.js +1 -0
  33. package/dist/bn-template-engine/p-c7e1a49b.entry.js +1 -0
  34. package/dist/bn-template-engine/p-d9003041.entry.js +1 -0
  35. package/dist/bn-template-engine/p-daa7ffa3.entry.js +1 -0
  36. package/dist/bn-template-engine/p-e084f50a.entry.js +1 -0
  37. package/dist/bn-template-engine/p-eaba6658.entry.js +1 -0
  38. package/dist/bn-template-engine/{p-C0yAPzJz.js → p-u8igQLRZ.js} +1 -1
  39. package/dist/cjs/{DataFormatDigits-DAmZzqbD.js → DataFormatDigits-DKcOeLNK.js} +1 -1
  40. package/dist/cjs/{DateStringFactory-CcluhpGI.js → DateStringFactory-CSKvbS8K.js} +1 -1
  41. package/dist/cjs/{Order-BKoDS21t.js → Order-iG11HI4R.js} +8 -5
  42. package/dist/cjs/{SVGVariancesStyleGroup-DYYAU-81.js → SVGVariancesStyleGroup-K-Tw6lOD.js} +1 -14
  43. package/dist/cjs/bn-asset.cjs.entry.js +5 -4
  44. package/dist/cjs/bn-body_4.cjs.entry.js +15 -13
  45. package/dist/cjs/bn-card.cjs.entry.js +5 -4
  46. package/dist/cjs/{ibcs-chart-structure.cjs.entry.js → bn-chart-structure_5.cjs.entry.js} +1074 -30
  47. package/dist/cjs/bn-chart-time.cjs.entry.js +38 -12
  48. package/dist/cjs/bn-component-style.cjs.entry.js +5 -4
  49. package/dist/cjs/bn-dataset.cjs.entry.js +38 -9
  50. package/dist/cjs/bn-grid.cjs.entry.js +9 -7
  51. package/dist/cjs/bn-image.cjs.entry.js +9 -7
  52. package/dist/cjs/bn-internationalization.cjs.entry.js +5 -4
  53. package/dist/cjs/bn-layout-card.cjs.entry.js +3 -2
  54. package/dist/cjs/bn-layout-page.cjs.entry.js +2 -1
  55. package/dist/cjs/bn-message.cjs.entry.js +5 -4
  56. package/dist/cjs/bn-table.cjs.entry.js +981 -0
  57. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  58. package/dist/cjs/bn-template.cjs.entry.js +3 -2
  59. package/dist/cjs/bn-text.cjs.entry.js +11 -9
  60. package/dist/cjs/bn-tree.cjs.entry.js +9 -7
  61. package/dist/cjs/contentDecoder-JxOldq1e.js +419 -0
  62. package/dist/cjs/{context-protocol-CRPmux5D.js → context-protocol-DRQWrwsA.js} +2 -0
  63. package/dist/cjs/editor-companion.cjs.entry.js +1 -1
  64. package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +57 -0
  65. package/dist/cjs/ibcs-chart-time.cjs.entry.js +22 -18
  66. package/dist/cjs/{bn-context_5.cjs.entry.js → ibcs-table.cjs.entry.js} +122 -1293
  67. package/dist/cjs/{StringAdapter-Bneo8T4k.js → ibcsRuleSet-DgUoXOfd.js} +10 -10
  68. package/dist/cjs/index-Dm85hG6t.js +65 -0
  69. package/dist/cjs/loader.cjs.js +1 -1
  70. package/dist/cjs/{scaling-D8sIIKft.js → scaling-9Tz595RQ.js} +7 -7
  71. package/dist/cjs/{withHasError-B8gHkfV2.js → utils-CwHIVbbL.js} +1 -69
  72. package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-CKpSD8UT.js} +3 -3
  73. package/dist/cjs/{withComponentStatus-_x4LQZ0N.js → withComponentStatus-Bw70BhO0.js} +5 -5
  74. package/dist/cjs/{withComponentStyle-DMtic_9Y.js → withComponentStyle-aIbTCtfj.js} +5 -5
  75. package/dist/cjs/withHasError-D7ue5vAv.js +72 -0
  76. package/dist/cjs/{withStyled-CW30Bh6c.js → withStyled-CS1Yp4sv.js} +8 -61
  77. package/dist/cjs/{withTranslation-CWPAIRjh.js → withTranslation-rwgyITqe.js} +5 -5
  78. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +226 -99
  79. package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +13 -3
  80. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +94 -11
  81. package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +11 -0
  82. package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +8 -6
  83. package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +4 -0
  84. package/dist/collection/components/bn-chart-time/bn-chart-time.js +28 -4
  85. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +3 -3
  86. package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -4
  87. package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +4 -0
  88. package/dist/collection/components/bn-dataset/bn-dataset.js +49 -2
  89. package/dist/collection/components/bn-datasource/bn-datasource.js +46 -3
  90. package/dist/collection/components/bn-table/bn-table.js +20 -21
  91. package/dist/collection/components/bn-table/ibcs-table.js +2 -2
  92. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +58 -41
  93. package/dist/collection/stores/componentStyles.js +2 -0
  94. package/dist/collection/utils/constants.js +8 -5
  95. package/dist/collection/utils/contentDecoder.js +28 -0
  96. package/dist/collection/utils/stackColors.js +2 -2
  97. package/dist/collection/utils/validate.js +1 -1
  98. package/dist/components/DataFormatDigits.js +1 -1
  99. package/dist/components/Order.js +1 -1
  100. package/dist/components/SVGVariancesStyleGroup.js +1 -1
  101. package/dist/components/bn-chart-structure.js +1 -1
  102. package/dist/components/bn-chart-time.js +1 -1
  103. package/dist/components/bn-dataset.js +1 -1
  104. package/dist/components/bn-datasource.js +1 -1
  105. package/dist/components/bn-table.js +1 -1
  106. package/dist/components/contentDecoder.js +1 -0
  107. package/dist/components/context-protocol.js +1 -1
  108. package/dist/components/emotion-hash.esm.js +1 -0
  109. package/dist/components/ibcs-chart-structure2.js +1 -1
  110. package/dist/components/ibcs-chart-time2.js +1 -1
  111. package/dist/components/ibcs-table2.js +1 -1
  112. package/dist/components/ibcs-title2.js +1 -1
  113. package/dist/components/ibcsRuleSet.js +1 -1
  114. package/dist/components/validate.js +1 -1
  115. package/dist/components/withStyled.js +1 -1
  116. package/dist/esm/{DataFormatDigits--qIbKvXa.js → DataFormatDigits-oSZ1hBKE.js} +1 -1
  117. package/dist/esm/{DateStringFactory-XWdUjsn8.js → DateStringFactory-CSGz6TDk.js} +1 -1
  118. package/dist/esm/{Order-sqjrku2z.js → Order-Bnhh02CF.js} +9 -6
  119. package/dist/esm/{SVGVariancesStyleGroup-ibg3sLjM.js → SVGVariancesStyleGroup-CqTjrZYg.js} +2 -13
  120. package/dist/esm/bn-asset.entry.js +5 -4
  121. package/dist/esm/bn-body_4.entry.js +11 -9
  122. package/dist/esm/bn-card.entry.js +5 -4
  123. package/dist/esm/{ibcs-chart-structure.entry.js → bn-chart-structure_5.entry.js} +1064 -24
  124. package/dist/esm/bn-chart-time.entry.js +38 -12
  125. package/dist/esm/bn-component-style.entry.js +5 -4
  126. package/dist/esm/bn-dataset.entry.js +35 -6
  127. package/dist/esm/bn-grid.entry.js +9 -7
  128. package/dist/esm/bn-image.entry.js +9 -7
  129. package/dist/esm/bn-internationalization.entry.js +5 -4
  130. package/dist/esm/bn-layout-card.entry.js +3 -2
  131. package/dist/esm/bn-layout-page.entry.js +2 -1
  132. package/dist/esm/bn-message.entry.js +5 -4
  133. package/dist/esm/bn-table.entry.js +979 -0
  134. package/dist/esm/bn-template-engine.js +1 -1
  135. package/dist/esm/bn-template.entry.js +3 -2
  136. package/dist/esm/bn-text.entry.js +11 -9
  137. package/dist/esm/bn-tree.entry.js +9 -7
  138. package/dist/esm/contentDecoder-oMmxz6nJ.js +416 -0
  139. package/dist/esm/{context-protocol-Bz5klD-F.js → context-protocol-BHnQsVsr.js} +2 -0
  140. package/dist/esm/editor-companion.entry.js +1 -1
  141. package/dist/esm/emotion-hash.esm-BYBpC0EO.js +55 -0
  142. package/dist/esm/ibcs-chart-time.entry.js +15 -11
  143. package/dist/esm/{bn-context_5.entry.js → ibcs-table.entry.js} +69 -1236
  144. package/dist/esm/{StringAdapter-BCLJpQQ8.js → ibcsRuleSet-K4ytuA1f.js} +10 -10
  145. package/dist/esm/index-DHezf8pZ.js +65 -0
  146. package/dist/esm/loader.js +1 -1
  147. package/dist/esm/{scaling-C6K8FYSF.js → scaling-Cehc74IE.js} +2 -2
  148. package/dist/esm/{withHasError-B3QX2emi.js → utils-DvvwfRQG.js} +1 -69
  149. package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-FQ8NwCIz.js} +1 -1
  150. package/dist/esm/{withComponentStatus-DodoSXe-.js → withComponentStatus-DWjDYtZ7.js} +1 -1
  151. package/dist/esm/{withComponentStyle-BerJY64r.js → withComponentStyle-9uP_hcDq.js} +2 -2
  152. package/dist/esm/withHasError-FyY5mQ_3.js +70 -0
  153. package/dist/esm/{withStyled-D1fAWJ3g.js → withStyled--qQWquTH.js} +6 -59
  154. package/dist/esm/{withTranslation-mimbJdER.js → withTranslation-BqD0Kp7b.js} +2 -2
  155. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +155 -109
  156. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +7 -0
  157. package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +2 -0
  158. package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +1 -0
  159. package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +1 -0
  160. package/dist/types/components/bn-dataset/bn-dataset.d.ts +6 -0
  161. package/dist/types/components/bn-datasource/bn-datasource.d.ts +8 -0
  162. package/dist/types/components/bn-table/bn-table.d.ts +10 -8
  163. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +0 -2
  164. package/dist/types/components.d.ts +102 -38
  165. package/dist/types/stores/componentStyles.d.ts +2 -0
  166. package/dist/types/utils/constants.d.ts +8 -5
  167. package/dist/types/utils/contentDecoder.d.ts +12 -0
  168. package/package.json +2 -1
  169. package/dist/bn-template-engine/p-05a82a77.entry.js +0 -1
  170. package/dist/bn-template-engine/p-1970906d.entry.js +0 -1
  171. package/dist/bn-template-engine/p-1dbd339c.entry.js +0 -1
  172. package/dist/bn-template-engine/p-2e68cf09.entry.js +0 -1
  173. package/dist/bn-template-engine/p-31cc6a2d.entry.js +0 -1
  174. package/dist/bn-template-engine/p-37881d05.entry.js +0 -1
  175. package/dist/bn-template-engine/p-3b894997.entry.js +0 -1
  176. package/dist/bn-template-engine/p-50e49732.entry.js +0 -1
  177. package/dist/bn-template-engine/p-6c7c0455.entry.js +0 -1
  178. package/dist/bn-template-engine/p-6da93eae.entry.js +0 -1
  179. package/dist/bn-template-engine/p-701e1578.entry.js +0 -1
  180. package/dist/bn-template-engine/p-8tsCnxIz.js +0 -1
  181. package/dist/bn-template-engine/p-997b2fe4.entry.js +0 -1
  182. package/dist/bn-template-engine/p-BL8gyUwE.js +0 -1
  183. package/dist/bn-template-engine/p-BSfqOkN_.js +0 -1
  184. package/dist/bn-template-engine/p-CRLgp9-v.js +0 -1
  185. package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
  186. package/dist/bn-template-engine/p-DRikHQE-.js +0 -1
  187. package/dist/bn-template-engine/p-DtdQCMzj.js +0 -1
  188. package/dist/bn-template-engine/p-a90f1cbe.entry.js +0 -1
  189. package/dist/bn-template-engine/p-b7bec050.entry.js +0 -1
  190. package/dist/bn-template-engine/p-d7f0cbaf.entry.js +0 -1
  191. package/dist/bn-template-engine/p-dfb61aa5.entry.js +0 -1
  192. package/dist/bn-template-engine/p-ece17f84.entry.js +0 -1
  193. package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
  194. package/dist/bn-template-engine/p-fd427179.entry.js +0 -1
  195. package/dist/bn-template-engine/p-sqjrku2z.js +0 -1
  196. package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
  197. package/dist/cjs/bn-chart-structure.cjs.entry.js +0 -700
  198. 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 SVGVariancesStyleGroup = require('./SVGVariancesStyleGroup-DYYAU-81.js');
5
- var Order = require('./Order-BKoDS21t.js');
6
- var DataFormatDigits = require('./DataFormatDigits-DAmZzqbD.js');
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 StringAdapter = require('./StringAdapter-Bneo8T4k.js');
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 StringAdapter.StringAdapter()).default();
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;
@@ -890,6 +1823,7 @@ class Label {
890
1823
  constructor(parent, xPosition, yPosition, groupPrefix, value, styles, verticalHookLocation, horizontalHookLocation) {
891
1824
  this.group = null;
892
1825
  this.segmentFillColor = null;
1826
+ this.maxWidth = null;
893
1827
  this.ID_SCENARIOLABEL = "Label";
894
1828
  this.CSS_CATEGORIES = "categories";
895
1829
  this.x = xPosition;
@@ -917,6 +1851,10 @@ class Label {
917
1851
  this.segmentFillColor = color;
918
1852
  return this;
919
1853
  }
1854
+ setMaxWidth(width) {
1855
+ this.maxWidth = width;
1856
+ return this;
1857
+ }
920
1858
  updateGroup(newGroup) {
921
1859
  this.group = newGroup;
922
1860
  return this;
@@ -925,6 +1863,7 @@ class Label {
925
1863
  return prefix + "_" + groupPrefix + "_" + this.ID_SCENARIOLABEL;
926
1864
  }
927
1865
  draw(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new DataFormatDigits.SiPrefix()) {
1866
+ var _a;
928
1867
  if (this.isEmpty()) {
929
1868
  return this;
930
1869
  }
@@ -962,6 +1901,11 @@ class Label {
962
1901
  text.move(this.x, this.y);
963
1902
  const boxWidth = text.bbox().w;
964
1903
  const boxHeight = text.bbox().h;
1904
+ if (this.maxWidth != null && boxWidth > this.maxWidth) {
1905
+ (_a = this.group) === null || _a === void 0 ? void 0 : _a.remove();
1906
+ this.group = null;
1907
+ return this;
1908
+ }
965
1909
  if (this.horizontalHookLocation === HookLocation.Right) {
966
1910
  labelAnchor = "end";
967
1911
  text.move(text.x() - text.length(), text.y());
@@ -1638,26 +2582,29 @@ class StackedBar {
1638
2582
  xPos = axisX + baselinePixels;
1639
2583
  }
1640
2584
  const yPos = this.position.getBarPositionY(this.index, true);
1641
- // Unified IBCS 3-color palette for all stacking modes
1642
- const fillColor = SVGVariancesStyleGroup.getStackFill(this.segmentIndex);
2585
+ const colors = this.styles.stackColors;
2586
+ const fillColor = colors[this.segmentIndex % colors.length];
1643
2587
  const fillStyle = { color: fillColor };
1644
- const strokeStyle = { color: SVGVariancesStyleGroup.getStackStroke(this.segmentIndex), width: 0.5 };
2588
+ const strokeStyle = { color: fillColor, width: 0.5 };
1645
2589
  this.barGroup.rect(Math.max(segmentLength, 0.5), barWidth).fill(fillStyle).stroke(strokeStyle).cy(yPos).x(xPos);
1646
2590
  // Draw segment value label centered on bar if wide enough
1647
- const MIN_SEGMENT_WIDTH_FOR_LABEL = 30;
1648
- if (segmentLength >= MIN_SEGMENT_WIDTH_FOR_LABEL) {
2591
+ const LABEL_PADDING = 6;
2592
+ const availableWidth = segmentLength - LABEL_PADDING;
2593
+ if (availableWidth > 0) {
1649
2594
  const labelX = xPos + segmentLength / 2;
1650
2595
  if (this.stackMode === Order.StackMode.RELATIVE || this.stackMode === Order.StackMode.ABSOLUTE_RELATIVE) {
1651
2596
  const pct = this.totalValue !== 0 ? (value / this.totalValue) * 100 : 0;
1652
2597
  const labelValue = pct.toFixed(dataFormatDigits.percent) + "%";
1653
2598
  new Label(this.group, labelX, yPos, "STACK_SEG", labelValue, this.styles, HookLocation.Center, HookLocation.Center)
1654
2599
  .setSegmentFill(fillColor)
2600
+ .setMaxWidth(availableWidth)
1655
2601
  .draw();
1656
2602
  }
1657
2603
  else {
1658
2604
  // Pass raw numeric value — Label.draw() formats with measureScale
1659
2605
  new Label(this.group, labelX, yPos, "STACK_SEG", value, this.styles, HookLocation.Center, HookLocation.Center)
1660
2606
  .setSegmentFill(fillColor)
2607
+ .setMaxWidth(availableWidth)
1661
2608
  .draw(dataFormatDigits, measureScale);
1662
2609
  }
1663
2610
  }
@@ -1837,8 +2784,9 @@ class StructureChart {
1837
2784
  this.dataFormatDigits = { percent: 2, decimal: 1 };
1838
2785
  this.stackConfig = null;
1839
2786
  this.overflowConfig = null;
2787
+ this.highestStackedTotal = 0;
1840
2788
  this.initSQLFunctions();
1841
- this.ruleSet = ruleSet || new StringAdapter.IBCSRuleSet();
2789
+ this.ruleSet = ruleSet || new ibcsRuleSet.IBCSRuleSet();
1842
2790
  this.i18n = this.createI18n(new Map());
1843
2791
  this.styles = styles;
1844
2792
  this.setConfig(config);
@@ -1875,7 +2823,7 @@ class StructureChart {
1875
2823
  this.setData([...config.data], config.filter);
1876
2824
  this.dataModel = this.populateModel(config.scenarios, config.level, config.sortOrder);
1877
2825
  // Populate per-dimension stack segments when stacking by a data dimension
1878
- if (config.stackConfig && config.stackConfig.by !== Order.StackBy.SCENARIO) {
2826
+ if (config.stackConfig && config.stackConfig.by !== Order.StackBy.SCENARIOS) {
1879
2827
  this.populateDimensionStackSegments(config.scenarios, config.stackConfig, config.level);
1880
2828
  }
1881
2829
  this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
@@ -1889,6 +2837,7 @@ class StructureChart {
1889
2837
  this.measureUnit = config.measureUnit;
1890
2838
  this.dataFormatDigits = config.dataFormatDigits;
1891
2839
  this.stackConfig = config.stackConfig;
2840
+ this.highestStackedTotal = this.findHighestStackedRowTotal(this.dataModel);
1892
2841
  this.updatePosition();
1893
2842
  }
1894
2843
  sortScenariosbyVisualisationRules(config) {
@@ -1978,6 +2927,30 @@ class StructureChart {
1978
2927
  this.preparedDataSet = data;
1979
2928
  }
1980
2929
  }
2930
+ /**
2931
+ * Returns the data value whose bar extent is proportional to pixelPerUnit.
2932
+ * Used by autoFitScaling to separate fixed vs variable width components.
2933
+ */
2934
+ getMaxBarValue() {
2935
+ var _a, _b;
2936
+ // Stacked: bar extent = highestStackedTotal * ppu (or just ppu for relative)
2937
+ if (this.stackConfig != null && this.highestStackedTotal > 0) {
2938
+ if (this.stackConfig.mode === Order.StackMode.RELATIVE) {
2939
+ return 1;
2940
+ }
2941
+ return this.highestStackedTotal;
2942
+ }
2943
+ // Non-stacked: bar extent = highestDataPointValue * ppu
2944
+ const vt = this.getVarianceType();
2945
+ if (vt === VarianceType.NONE && ((_a = this.highestDataPointValue) === null || _a === void 0 ? void 0 : _a.value) != null) {
2946
+ return Math.abs(this.highestDataPointValue.value);
2947
+ }
2948
+ if (vt === VarianceType.ABSOLUTE && ((_b = this.highestVarianceDataPointValue) === null || _b === void 0 ? void 0 : _b.value) != null) {
2949
+ return Math.abs(this.highestVarianceDataPointValue.value);
2950
+ }
2951
+ // RELATIVE variance depends on pixelPerPercentage, not pixelPerUnit
2952
+ return 0;
2953
+ }
1981
2954
  getAllocatedCanvasWidth() {
1982
2955
  //let columnLabelWidth = this.calculateCategoryWidth();
1983
2956
  const leftSideWidth = this.position.getAxisPositionX(); //this.calculateLeftSideWidth(this.getVarianceType());
@@ -2228,6 +3201,48 @@ class StructureChart {
2228
3201
  }
2229
3202
  return highestDataPoint;
2230
3203
  }
3204
+ findHighestStackedRowTotal(dataModel) {
3205
+ if (!this.stackConfig || dataModel.length === 0)
3206
+ return 0;
3207
+ const isScenarioStack = this.stackConfig.by === Order.StackBy.SCENARIOS;
3208
+ let maxTotal = 0;
3209
+ for (const row of dataModel) {
3210
+ let rowTotal = 0;
3211
+ if (isScenarioStack) {
3212
+ const scenarioKeys = ["scenario1", "scenario2", "scenario3", "scenario4"];
3213
+ const segments = [];
3214
+ for (const key of scenarioKeys) {
3215
+ const dp = row[key];
3216
+ if (dp && !dp.isEmpty() && dp.value != null) {
3217
+ segments.push({ value: dp.value, scenario: dp.scenario });
3218
+ }
3219
+ }
3220
+ const prefixes = new Set(segments.map((s) => SVGVariancesStyleGroup.getScenarioPrefix(s.scenario)));
3221
+ if (prefixes.size > 1) {
3222
+ // Overlay: groups overlap from baseline, width = max group total
3223
+ const groupMap = new Map();
3224
+ for (const seg of segments) {
3225
+ const prefix = SVGVariancesStyleGroup.getScenarioPrefix(seg.scenario);
3226
+ groupMap.set(prefix, (groupMap.get(prefix) || 0) + Math.abs(seg.value));
3227
+ }
3228
+ rowTotal = Math.max(...groupMap.values());
3229
+ }
3230
+ else {
3231
+ // Single group: segments stack end-to-end, width = sum
3232
+ rowTotal = segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
3233
+ }
3234
+ }
3235
+ else {
3236
+ // Dimension stacking: use stackSegments
3237
+ if (row.stackSegments && row.stackSegments.length > 0) {
3238
+ rowTotal = row.stackSegments.reduce((sum, s) => sum + Math.abs(s.value), 0);
3239
+ }
3240
+ }
3241
+ if (rowTotal > maxTotal)
3242
+ maxTotal = rowTotal;
3243
+ }
3244
+ return maxTotal;
3245
+ }
2231
3246
  populateVarianceModel(variancesConfig, dataModel) {
2232
3247
  const varianceModel = [];
2233
3248
  if (variancesConfig.length === 0) {
@@ -2375,7 +3390,7 @@ class StructureChart {
2375
3390
  if (!this.stackConfig)
2376
3391
  return;
2377
3392
  const stackGroup = svgContainer.group().id("StackedScenarios");
2378
- const isScenarioStack = this.stackConfig.by === Order.StackBy.SCENARIO;
3393
+ const isScenarioStack = this.stackConfig.by === Order.StackBy.SCENARIOS;
2379
3394
  dataModel.forEach((elements, index) => {
2380
3395
  const scenarioKeys = ["scenario1", "scenario2", "scenario3", "scenario4"];
2381
3396
  const segments = [];
@@ -2476,7 +3491,7 @@ class StructureChart {
2476
3491
  drawStackedHeaders(dataModel, svgContainer) {
2477
3492
  if (!this.stackConfig || dataModel.length === 0)
2478
3493
  return;
2479
- const isScenarioStack = this.stackConfig.by === Order.StackBy.SCENARIO;
3494
+ const isScenarioStack = this.stackConfig.by === Order.StackBy.SCENARIOS;
2480
3495
  const headerGroup = svgContainer.group().id("StackedHeaders");
2481
3496
  const firstRow = dataModel[0];
2482
3497
  // Dimension stacking: use stackSegments from first row for headers
@@ -2611,6 +3626,20 @@ class StructureChart {
2611
3626
  }
2612
3627
  calculateRightSideWidth(varianceType) {
2613
3628
  var _a, _b, _c;
3629
+ // Stacked charts: width based on max row total, not individual max
3630
+ if (this.stackConfig != null && this.highestStackedTotal > 0) {
3631
+ const labelToBar = this.styles.fontStyles.size * this.styles.scaleFactors.labelToBar;
3632
+ let barExtent;
3633
+ if (this.stackConfig.mode === Order.StackMode.RELATIVE) {
3634
+ barExtent = this.pixelPerUnit;
3635
+ }
3636
+ else {
3637
+ barExtent = this.highestStackedTotal * this.pixelPerUnit;
3638
+ }
3639
+ const sizeTotalLabel = this.calculateTextBoxWidth(this.highestStackedTotal);
3640
+ const width = barExtent + labelToBar + sizeTotalLabel;
3641
+ return Math.max(width, this.titleLength);
3642
+ }
2614
3643
  let width = 0;
2615
3644
  const labelToBar = this.styles.fontStyles.size * this.styles.scaleFactors.labelToBar;
2616
3645
  if (VarianceType.NONE === varianceType &&
@@ -2640,19 +3669,20 @@ class StructureChart {
2640
3669
  * For dimension stacking (by category, subcategory, or rowgroup), query the raw data
2641
3670
  * at the stack dimension level and attach stackSegments to each dataModel row.
2642
3671
  */
2643
- populateDimensionStackSegments(scenarios, stackConfig, level) {
3672
+ populateDimensionStackSegments(scenarios, _stackConfig, level) {
2644
3673
  var _a;
2645
3674
  if (((_a = this.preparedDataSet) === null || _a === void 0 ? void 0 : _a.length) === 0 || scenarios.length === 0)
2646
3675
  return;
2647
- // Map StackBy value to the actual data column name
2648
- const stackColumnMap = {
2649
- [Order.StackBy.CATEGORY]: "category",
2650
- [Order.StackBy.SUBCATEGORY]: "subCategory",
2651
- [Order.StackBy.ROWGROUP]: "rowGroup",
3676
+ // Derive stack column from level: stack by the next-lower hierarchy dimension
3677
+ const nextLowerDimension = {
3678
+ [Order.AggregationLevel.ROWGROUP]: "category",
3679
+ [Order.AggregationLevel.ROWGROUPINDEX]: "category",
3680
+ [Order.AggregationLevel.CATEGORY]: "subCategory",
3681
+ [Order.AggregationLevel.CATEGORYINDEX]: "subCategory",
2652
3682
  };
2653
- const stackColumn = stackColumnMap[stackConfig.by];
3683
+ const stackColumn = nextLowerDimension[level];
2654
3684
  if (!stackColumn)
2655
- return;
3685
+ return; // subCategory has no lower dimension
2656
3686
  // The display level column (what each bar represents)
2657
3687
  const displayColumn = level.toString(); // e.g. 'rowGroup', 'category', 'subCategory'
2658
3688
  const scenario = scenarios[0]; // dimension stacking uses first scenario
@@ -2799,7 +3829,7 @@ const IbcsChartStructure = class {
2799
3829
  var _a;
2800
3830
  const config = this.prepareConfig();
2801
3831
  const styles = this.prepareStyle();
2802
- this.chart = new StructureChart(new StringAdapter.IBCSRuleSet(), config, styles);
3832
+ this.chart = new StructureChart(new ibcsRuleSet.IBCSRuleSet(), config, styles);
2803
3833
  this.chart.setI18n(this.i18n);
2804
3834
  this.autoFitScaling(config, styles);
2805
3835
  this.chart.setAvailableWidth(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
@@ -2835,23 +3865,33 @@ const IbcsChartStructure = class {
2835
3865
  const targetWidth = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width;
2836
3866
  if (!targetWidth || targetWidth <= 0) {
2837
3867
  config.pixelPerUnit = 1;
2838
- this.chart = new StructureChart(new StringAdapter.IBCSRuleSet(), config, styles);
3868
+ this.chart = new StructureChart(new ibcsRuleSet.IBCSRuleSet(), config, styles);
2839
3869
  this.chart.setI18n(this.i18n);
2840
3870
  return;
2841
3871
  }
2842
- // First pass with pixelPerUnit=1 to measure the real SVG width
3872
+ // First pass with pixelPerUnit=1 to measure total width and bar extent
2843
3873
  config.pixelPerUnit = 1;
2844
- this.chart = new StructureChart(new StringAdapter.IBCSRuleSet(), config, styles);
3874
+ this.chart = new StructureChart(new ibcsRuleSet.IBCSRuleSet(), config, styles);
2845
3875
  this.chart.setI18n(this.i18n);
2846
3876
  this.chart.toString();
2847
3877
  const svgWidth = this.chart.getAllocatedCanvasWidth();
2848
3878
  if (svgWidth <= 0) {
2849
3879
  return;
2850
3880
  }
2851
- // Scale so the chart fits in ~90% of the available width
2852
- config.pixelPerUnit = (targetWidth * 0.9) / svgWidth;
3881
+ // Separate fixed parts (labels, padding, spacing) from variable part (bar extent).
3882
+ // totalWidth(ppu) = fixedWidth + maxBarValue * ppu
3883
+ // Solving for ppu: ppu = (targetWidth - fixedWidth) / maxBarValue
3884
+ const maxBarValue = this.chart.getMaxBarValue();
3885
+ if (maxBarValue > 0) {
3886
+ const fixedWidth = svgWidth - maxBarValue; // at ppu=1, barExtent = maxBarValue * 1
3887
+ config.pixelPerUnit = Math.max(0.001, (targetWidth - fixedWidth) / maxBarValue);
3888
+ }
3889
+ else {
3890
+ // Fallback (e.g. relative variance charts)
3891
+ config.pixelPerUnit = (targetWidth * 0.9) / svgWidth;
3892
+ }
2853
3893
  // Second pass with the corrected scaling
2854
- this.chart = new StructureChart(new StringAdapter.IBCSRuleSet(), config, styles);
3894
+ this.chart = new StructureChart(new ibcsRuleSet.IBCSRuleSet(), config, styles);
2855
3895
  this.chart.setI18n(this.i18n);
2856
3896
  }
2857
3897
  async componentWillRender() {
@@ -2875,7 +3915,7 @@ const IbcsChartStructure = class {
2875
3915
  // }
2876
3916
  }
2877
3917
  prepareConfig() {
2878
- return new StructureChartComponentConfigAdapter(new StructureChartDataRowAdapter(), new Order.OrderAdapter(new StringAdapter.StringAdapter()), new StringAdapter.StringAdapter(), new DataFormatDigits.DataFormatDigitsAdapter(), this.data).adapt({
3918
+ return new StructureChartComponentConfigAdapter(new StructureChartDataRowAdapter(), new Order.OrderAdapter(new ibcsRuleSet.StringAdapter()), new ibcsRuleSet.StringAdapter(), new DataFormatDigits.DataFormatDigitsAdapter(), this.data).adapt({
2879
3919
  data: this.data,
2880
3920
  scenarios: this.scenarios,
2881
3921
  variances: this.variances,
@@ -2901,4 +3941,8 @@ const IbcsChartStructure = class {
2901
3941
  };
2902
3942
  IbcsChartStructure.style = bnChartStructureCss();
2903
3943
 
3944
+ exports.bn_chart_structure = Chart;
3945
+ exports.bn_context = Context;
3946
+ exports.bn_datasource = Datasource;
3947
+ exports.bn_page = Page;
2904
3948
  exports.ibcs_chart_structure = IbcsChartStructure;