@bino-bi/bn-template-engine 1.0.0-alpha.9 → 1.0.0-next.19

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 (391) hide show
  1. package/LICENSE +203 -21
  2. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  3. package/dist/bn-template-engine/p-19bbac66.entry.js +1 -0
  4. package/dist/bn-template-engine/p-209351c9.entry.js +1 -0
  5. package/dist/bn-template-engine/p-22d0fb7a.entry.js +1 -0
  6. package/dist/bn-template-engine/p-2e6dc267.entry.js +1 -0
  7. package/dist/bn-template-engine/p-485d23d7.entry.js +1 -0
  8. package/dist/bn-template-engine/p-74c5a95d.entry.js +1 -0
  9. package/dist/bn-template-engine/p-7bdc0e28.entry.js +1 -0
  10. package/dist/bn-template-engine/p-83c71b16.entry.js +1 -0
  11. package/dist/bn-template-engine/p-90806e7a.entry.js +1 -0
  12. package/dist/bn-template-engine/p-9879c9b2.entry.js +1 -0
  13. package/dist/bn-template-engine/p-BA48JiHe.js +1 -0
  14. package/dist/bn-template-engine/p-BWKdb9ym.js +1 -0
  15. package/dist/bn-template-engine/p-BZV1b5VH.js +1 -0
  16. package/dist/bn-template-engine/p-Bdfxd_Ke.js +1 -0
  17. package/dist/bn-template-engine/p-BjBz5cSL.js +1 -0
  18. package/dist/bn-template-engine/p-BqhIhYr1.js +1 -0
  19. package/dist/bn-template-engine/p-C0Pwqx-O.js +1 -0
  20. package/dist/bn-template-engine/p-CiudZRQr.js +1 -0
  21. package/dist/bn-template-engine/p-DTuaq8Pj.js +1 -0
  22. package/dist/bn-template-engine/p-DY7YYmpa.js +1 -0
  23. package/dist/bn-template-engine/p-Dg9OcXAO.js +1 -0
  24. package/dist/bn-template-engine/p-DsTzlzxQ.js +1 -0
  25. package/dist/bn-template-engine/p-X6CxL6W-.js +1 -0
  26. package/dist/bn-template-engine/p-a8291de2.entry.js +1 -0
  27. package/dist/bn-template-engine/p-aakBGfzL.js +1 -0
  28. package/dist/bn-template-engine/p-b25455a7.entry.js +1 -0
  29. package/dist/bn-template-engine/p-e96da91f.entry.js +1 -0
  30. package/dist/bn-template-engine/p-eca8e2e2.entry.js +1 -0
  31. package/dist/bn-template-engine/p-f9dfd120.entry.js +1 -0
  32. package/dist/bn-template-engine/p-rdqTC0_5.js +1 -0
  33. package/dist/cjs/AxisConfig-VnVelfSV.js +233 -0
  34. package/dist/cjs/LabelCollisionManager-nfD5P__k.js +412 -0
  35. package/dist/cjs/NumericScale-BAyYXpKL.js +107 -0
  36. package/dist/cjs/Order-DobBozQC.js +87 -0
  37. package/dist/cjs/SVGStyle-BQOmGWLX.js +8209 -0
  38. package/dist/cjs/SVGVariancesStyleGroup-DCGfHrqh.js +50 -0
  39. package/dist/cjs/VarianceMeasure-NY9yhiNV.js +372 -0
  40. package/dist/cjs/XYChartDataRow-B7OKrAcC.js +829 -0
  41. package/dist/cjs/bn-asset_21.cjs.entry.js +16047 -0
  42. package/dist/cjs/bn-chart-bubble.cjs.entry.js +762 -0
  43. package/dist/cjs/bn-chart-bullet.cjs.entry.js +785 -0
  44. package/dist/cjs/bn-chart-scatter.cjs.entry.js +658 -0
  45. package/dist/cjs/bn-grid.cjs.entry.js +5 -3
  46. package/dist/cjs/bn-image.cjs.entry.js +5 -3
  47. package/dist/cjs/bn-internationalization.cjs.entry.js +10 -8
  48. package/dist/cjs/bn-ruleset.cjs.entry.js +41 -0
  49. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  50. package/dist/cjs/bn-template.cjs.entry.js +1 -1
  51. package/dist/cjs/bn-text.cjs.entry.js +8 -79
  52. package/dist/cjs/bn-tree.cjs.entry.js +4 -2
  53. package/dist/cjs/context-protocol-BDrMkhc4.js +9499 -0
  54. package/dist/cjs/editor-companion.cjs.entry.js +13 -6
  55. package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +624 -0
  56. package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +673 -0
  57. package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +667 -0
  58. package/dist/cjs/layoutObserver-o03YUfn_.js +199 -0
  59. package/dist/cjs/loader.cjs.js +1 -1
  60. package/dist/cjs/sanitizeHtml-LuZr1IMd.js +85 -0
  61. package/dist/cjs/scaling-DKZyjWj5.js +587 -0
  62. package/dist/cjs/{withBodyObserver-D7BKWN2N.js → withBodyObserver-BKUE_ypL.js} +12 -7
  63. package/dist/cjs/withScalingGroup-BmcRlWBs.js +73 -0
  64. package/dist/cjs/withStyled-CRiC9fzc.js +1137 -0
  65. package/dist/collection/collection-manifest.json +9 -1
  66. package/dist/collection/components/bn-body/bn-body.css +1 -0
  67. package/dist/collection/components/bn-card/bn-card.css +2 -0
  68. package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.css +10 -0
  69. package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +1110 -0
  70. package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.css +9 -0
  71. package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.js +653 -0
  72. package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +472 -0
  73. package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.css +10 -0
  74. package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +1014 -0
  75. package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.css +9 -0
  76. package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +538 -0
  77. package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +440 -0
  78. package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +132 -0
  79. package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +89 -0
  80. package/dist/collection/components/bn-chart-bullet/utils/model/index.js +2 -0
  81. package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.css +10 -0
  82. package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +965 -0
  83. package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.css +9 -0
  84. package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.js +580 -0
  85. package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +409 -0
  86. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +125 -42
  87. package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +103 -36
  88. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +82 -58
  89. package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +46 -4
  90. package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +5 -4
  91. package/dist/collection/components/bn-chart-time/bn-chart-time.css +1 -1
  92. package/dist/collection/components/bn-chart-time/bn-chart-time.js +160 -43
  93. package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +94 -31
  94. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +132 -74
  95. package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -3
  96. package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +5 -4
  97. package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +2 -0
  98. package/dist/collection/components/bn-component-style/bn-component-style.js +1 -1
  99. package/dist/collection/components/bn-context/bn-context.js +1 -1
  100. package/dist/collection/components/bn-dataset/bn-dataset.js +226 -23
  101. package/dist/collection/components/bn-datasource/bn-datasource.js +163 -12
  102. package/dist/collection/components/bn-footer/bn-footer.js +1 -1
  103. package/dist/collection/components/bn-grid/bn-grid.js +1 -1
  104. package/dist/collection/components/bn-image/bn-image.js +1 -1
  105. package/dist/collection/components/bn-internationalization/bn-internationalization.js +10 -7
  106. package/dist/collection/components/bn-layout-card/bn-layout-card.css +8 -3
  107. package/dist/collection/components/bn-layout-card/bn-layout-card.js +98 -35
  108. package/dist/collection/components/bn-layout-page/bn-layout-page.css +5 -3
  109. package/dist/collection/components/bn-layout-page/bn-layout-page.js +98 -25
  110. package/dist/collection/components/bn-message/bn-message.css +6 -2
  111. package/dist/collection/components/bn-message/bn-message.js +3 -2
  112. package/dist/collection/components/bn-page/bn-page.js +1 -1
  113. package/dist/collection/components/bn-ruleset/bn-ruleset.css +3 -0
  114. package/dist/collection/components/bn-ruleset/bn-ruleset.js +68 -0
  115. package/dist/collection/components/bn-scaling-group/bn-scaling-group.css +3 -0
  116. package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +136 -0
  117. package/dist/collection/components/bn-table/bn-table.js +317 -61
  118. package/dist/collection/components/bn-table/ibcs-table.css +8 -0
  119. package/dist/collection/components/bn-table/ibcs-table.js +161 -32
  120. package/dist/collection/components/bn-table/utils/Table.js +72 -28
  121. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +13 -8
  122. package/dist/collection/components/bn-table/utils/elements/TableRow.js +3 -2
  123. package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +47 -0
  124. package/dist/collection/components/bn-table/utils/elements/index.js +1 -0
  125. package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +117 -22
  126. package/dist/collection/components/bn-table/utils/helper/DataQuery.js +380 -50
  127. package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +140 -0
  128. package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +4 -9
  129. package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +166 -0
  130. package/dist/collection/components/bn-table/utils/helper/index.js +2 -0
  131. package/dist/collection/components/bn-table/utils/model/TableAttribute.js +46 -0
  132. package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +20 -4
  133. package/dist/collection/components/bn-template/bn-template.js +1 -1
  134. package/dist/collection/components/bn-text/bn-text.js +2 -75
  135. package/dist/collection/components/bn-title/bn-title.js +27 -3
  136. package/dist/collection/components/bn-title/ibcs-title/ibcs-title.css +4 -0
  137. package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +29 -6
  138. package/dist/collection/components/bn-title/ibcs-title/utils/Title.js +3 -0
  139. package/dist/collection/components/editor-companion/editor-companion.js +12 -5
  140. package/dist/collection/context/scopedDb.js +127 -0
  141. package/dist/collection/stores/componentStyles.js +67 -0
  142. package/dist/collection/stores/createScopedStores.js +11 -5
  143. package/dist/collection/stores/internationalization.js +68 -0
  144. package/dist/collection/stores/ruleSets.js +46 -0
  145. package/dist/collection/utils/constants.js +5 -0
  146. package/dist/collection/utils/dataAnalyzer.js +14 -8
  147. package/dist/collection/utils/ibcsRuleSet.js +14 -26
  148. package/dist/collection/utils/layoutObserver.js +88 -0
  149. package/dist/collection/utils/parentDimensions.js +71 -15
  150. package/dist/collection/utils/sanitizeHtml.js +81 -0
  151. package/dist/collection/utils/validate.js +47 -0
  152. package/dist/collection/utils/withBodyObserver.js +12 -7
  153. package/dist/collection/utils/withComponentStyle.js +3 -5
  154. package/dist/collection/utils/withDataset.js +43 -39
  155. package/dist/collection/utils/withDatasource.js +28 -18
  156. package/dist/collection/utils/withInheritedProps.js +26 -1
  157. package/dist/collection/utils/withRuleSet.js +105 -0
  158. package/dist/collection/utils/withScalingGroup.js +69 -0
  159. package/dist/collection/utils/withTranslation.js +50 -14
  160. package/dist/collection/utils/xy/FacetGrid.js +36 -0
  161. package/dist/collection/utils/xy/IsoCurves.js +156 -0
  162. package/dist/collection/utils/xy/NumericScale.js +103 -0
  163. package/dist/collection/utils/xy/PointLabeler.js +96 -0
  164. package/dist/collection/utils/xy/RadiusScale.js +42 -0
  165. package/dist/collection/utils/xy/SeriesPalette.js +80 -0
  166. package/dist/collection/utils/xy/VarianceMeasure.js +76 -0
  167. package/dist/collection/utils/xy/XYFrame.js +120 -0
  168. package/dist/collection/utils/xy/XYLegend.js +107 -0
  169. package/dist/collection/utils/xy/model/AxisConfig.js +221 -0
  170. package/dist/collection/utils/xy/model/ScaleFactorsXYChart.js +69 -0
  171. package/dist/collection/utils/xy/model/XYChartDataRow.js +0 -0
  172. package/dist/collection/utils/xy/model/XYChartStyle.js +52 -0
  173. package/dist/components/AxisConfig.js +1 -0
  174. package/dist/components/CompareUtil.js +1 -0
  175. package/dist/components/DataFormatDigits.js +1 -1
  176. package/dist/components/DateStringFactory.js +1 -1
  177. package/dist/components/LabelCollisionManager.js +1 -0
  178. package/dist/components/NumericScale.js +1 -0
  179. package/dist/components/Order.js +1 -1
  180. package/dist/components/SVGVariancesStyleGroup.js +1 -1
  181. package/dist/components/SiPrefix.js +1 -0
  182. package/dist/components/StringAdapter.js +1 -0
  183. package/dist/components/VarianceMeasure.js +1 -0
  184. package/dist/components/XYChartDataRow.js +1 -0
  185. package/dist/components/bn-body2.js +1 -1
  186. package/dist/components/bn-card2.js +1 -1
  187. package/dist/components/bn-chart-bubble.d.ts +11 -0
  188. package/dist/components/bn-chart-bubble.js +1 -0
  189. package/dist/components/bn-chart-bullet.d.ts +11 -0
  190. package/dist/components/bn-chart-bullet.js +1 -0
  191. package/dist/components/bn-chart-scatter.d.ts +11 -0
  192. package/dist/components/bn-chart-scatter.js +1 -0
  193. package/dist/components/bn-chart-structure.js +1 -1
  194. package/dist/components/bn-chart-time.js +1 -1
  195. package/dist/components/bn-component-style.js +1 -1
  196. package/dist/components/bn-context.js +1 -1
  197. package/dist/components/bn-dataset.js +1 -1
  198. package/dist/components/bn-datasource.js +1 -1
  199. package/dist/components/bn-footer2.js +1 -1
  200. package/dist/components/bn-grid.js +1 -1
  201. package/dist/components/bn-image.js +1 -1
  202. package/dist/components/bn-internationalization.js +1 -1
  203. package/dist/components/bn-layout-card.js +1 -1
  204. package/dist/components/bn-layout-page.js +1 -1
  205. package/dist/components/bn-message2.js +1 -1
  206. package/dist/components/bn-page2.js +1 -1
  207. package/dist/components/bn-ruleset.d.ts +11 -0
  208. package/dist/components/bn-ruleset.js +1 -0
  209. package/dist/components/bn-scaling-group.d.ts +11 -0
  210. package/dist/components/bn-scaling-group.js +1 -0
  211. package/dist/components/bn-table.js +1 -1
  212. package/dist/components/bn-template.js +1 -1
  213. package/dist/components/bn-text.js +1 -1
  214. package/dist/components/bn-title2.js +1 -1
  215. package/dist/components/bn-tree.js +1 -1
  216. package/dist/components/context-protocol.js +1 -1
  217. package/dist/components/editor-companion.js +1 -1
  218. package/dist/components/formatter.js +1 -0
  219. package/dist/components/ibcs-chart-bubble.d.ts +11 -0
  220. package/dist/components/ibcs-chart-bubble.js +1 -0
  221. package/dist/components/ibcs-chart-bubble2.js +1 -0
  222. package/dist/components/ibcs-chart-bullet.d.ts +11 -0
  223. package/dist/components/ibcs-chart-bullet.js +1 -0
  224. package/dist/components/ibcs-chart-bullet2.js +1 -0
  225. package/dist/components/ibcs-chart-scatter.d.ts +11 -0
  226. package/dist/components/ibcs-chart-scatter.js +1 -0
  227. package/dist/components/ibcs-chart-scatter2.js +1 -0
  228. package/dist/components/ibcs-chart-structure2.js +1 -1
  229. package/dist/components/ibcs-chart-time2.js +1 -1
  230. package/dist/components/ibcs-table2.js +1 -1
  231. package/dist/components/ibcs-title2.js +1 -1
  232. package/dist/components/layoutObserver.js +1 -0
  233. package/dist/components/luxon.js +1 -0
  234. package/dist/components/main.js +1 -0
  235. package/dist/components/merge.js +1 -0
  236. package/dist/components/sanitizeHtml.js +1 -0
  237. package/dist/components/stackColors.js +1 -0
  238. package/dist/components/validate.js +1 -1
  239. package/dist/components/withBodyObserver.js +1 -1
  240. package/dist/components/withComponentStyle.js +1 -1
  241. package/dist/components/withDataset.js +1 -0
  242. package/dist/components/withRuleSet.js +1 -0
  243. package/dist/components/withScalingGroup.js +1 -0
  244. package/dist/components/withStyled.js +1 -1
  245. package/dist/components/withTranslation.js +1 -1
  246. package/dist/esm/AxisConfig-C_zWCKlL.js +224 -0
  247. package/dist/esm/LabelCollisionManager-8swVQHKA.js +404 -0
  248. package/dist/esm/NumericScale-DsTzlzxQ.js +105 -0
  249. package/dist/esm/Order-BPeWfygb.js +83 -0
  250. package/dist/esm/SVGStyle-BxEDw9zh.js +8199 -0
  251. package/dist/esm/SVGVariancesStyleGroup-DRQYvSDD.js +48 -0
  252. package/dist/esm/VarianceMeasure-DnwNKspZ.js +364 -0
  253. package/dist/esm/XYChartDataRow-DeV4r-Wm.js +820 -0
  254. package/dist/esm/bn-asset_21.entry.js +16025 -0
  255. package/dist/esm/bn-chart-bubble.entry.js +760 -0
  256. package/dist/esm/bn-chart-bullet.entry.js +783 -0
  257. package/dist/esm/bn-chart-scatter.entry.js +656 -0
  258. package/dist/esm/bn-grid.entry.js +5 -3
  259. package/dist/esm/bn-image.entry.js +5 -3
  260. package/dist/esm/bn-internationalization.entry.js +10 -8
  261. package/dist/esm/bn-ruleset.entry.js +39 -0
  262. package/dist/esm/bn-template-engine.js +1 -1
  263. package/dist/esm/bn-template.entry.js +1 -1
  264. package/dist/esm/bn-text.entry.js +7 -78
  265. package/dist/esm/bn-tree.entry.js +4 -2
  266. package/dist/esm/context-protocol-1Yj1uKvh.js +9484 -0
  267. package/dist/esm/editor-companion.entry.js +13 -6
  268. package/dist/esm/ibcs-chart-bubble.entry.js +622 -0
  269. package/dist/esm/ibcs-chart-bullet.entry.js +671 -0
  270. package/dist/esm/ibcs-chart-scatter.entry.js +665 -0
  271. package/dist/esm/layoutObserver-BG5dOBYH.js +196 -0
  272. package/dist/esm/loader.js +1 -1
  273. package/dist/esm/sanitizeHtml-BA48JiHe.js +83 -0
  274. package/dist/esm/scaling-CeSRcRl1.js +579 -0
  275. package/dist/esm/{withBodyObserver-AFk2wwHT.js → withBodyObserver-IokS6fHD.js} +12 -7
  276. package/dist/esm/withScalingGroup-Br70pAv9.js +71 -0
  277. package/dist/esm/withStyled-Br2DGTPs.js +1104 -0
  278. package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +193 -0
  279. package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +58 -0
  280. package/dist/types/components/bn-chart-bubble/utils/BubbleChart.d.ts +91 -0
  281. package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +172 -0
  282. package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +52 -0
  283. package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +91 -0
  284. package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +70 -0
  285. package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +43 -0
  286. package/dist/types/components/bn-chart-bullet/utils/model/index.d.ts +2 -0
  287. package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +172 -0
  288. package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +53 -0
  289. package/dist/types/components/bn-chart-scatter/utils/ScatterChart.d.ts +66 -0
  290. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +19 -5
  291. package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +13 -6
  292. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +16 -12
  293. package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +16 -1
  294. package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +5 -3
  295. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +53 -13
  296. package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +13 -6
  297. package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +16 -12
  298. package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +5 -3
  299. package/dist/types/components/bn-dataset/bn-dataset.d.ts +47 -5
  300. package/dist/types/components/bn-datasource/bn-datasource.d.ts +53 -6
  301. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +35 -8
  302. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +32 -1
  303. package/dist/types/components/bn-message/bn-message.d.ts +5 -2
  304. package/dist/types/components/bn-ruleset/bn-ruleset.d.ts +8 -0
  305. package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +37 -0
  306. package/dist/types/components/bn-table/bn-table.d.ts +74 -12
  307. package/dist/types/components/bn-table/ibcs-table.d.ts +27 -4
  308. package/dist/types/components/bn-table/utils/Table.d.ts +16 -6
  309. package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -0
  310. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +33 -0
  311. package/dist/types/components/bn-table/utils/elements/TableRow.d.ts +2 -1
  312. package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +21 -0
  313. package/dist/types/components/bn-table/utils/elements/index.d.ts +1 -0
  314. package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +17 -9
  315. package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +35 -3
  316. package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +37 -0
  317. package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +4 -5
  318. package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +55 -0
  319. package/dist/types/components/bn-table/utils/helper/index.d.ts +2 -0
  320. package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +22 -0
  321. package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +12 -3
  322. package/dist/types/components/bn-table/utils/model/index.d.ts +21 -0
  323. package/dist/types/components/bn-title/bn-title.d.ts +11 -1
  324. package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +2 -0
  325. package/dist/types/components/bn-title/ibcs-title/utils/Title.d.ts +1 -0
  326. package/dist/types/components/editor-companion/editor-companion.d.ts +2 -0
  327. package/dist/types/components.d.ts +1691 -120
  328. package/dist/types/context/context-protocol.d.ts +7 -3
  329. package/dist/types/context/scopedDb.d.ts +37 -0
  330. package/dist/types/stores/componentStyles.d.ts +41 -0
  331. package/dist/types/stores/createScopedStores.d.ts +4 -2
  332. package/dist/types/stores/ruleSets.d.ts +40 -0
  333. package/dist/types/utils/DateStringFactory.d.ts +1 -1
  334. package/dist/types/utils/constants.d.ts +5 -0
  335. package/dist/types/utils/dataAnalyzer.d.ts +2 -1
  336. package/dist/types/utils/ibcsRuleSet.d.ts +6 -1
  337. package/dist/types/utils/layoutObserver.d.ts +27 -0
  338. package/dist/types/utils/model/ChartStyles.d.ts +2 -1
  339. package/dist/types/utils/parentDimensions.d.ts +1 -1
  340. package/dist/types/utils/sanitizeHtml.d.ts +6 -0
  341. package/dist/types/utils/validate.d.ts +18 -0
  342. package/dist/types/utils/withDataset.d.ts +6 -2
  343. package/dist/types/utils/withDatasource.d.ts +3 -3
  344. package/dist/types/utils/withInheritedProps.d.ts +19 -0
  345. package/dist/types/utils/withRuleSet.d.ts +24 -0
  346. package/dist/types/utils/withScalingGroup.d.ts +14 -0
  347. package/dist/types/utils/withTranslation.d.ts +12 -4
  348. package/dist/types/utils/xy/FacetGrid.d.ts +27 -0
  349. package/dist/types/utils/xy/IsoCurves.d.ts +46 -0
  350. package/dist/types/utils/xy/NumericScale.d.ts +41 -0
  351. package/dist/types/utils/xy/PointLabeler.d.ts +58 -0
  352. package/dist/types/utils/xy/RadiusScale.d.ts +26 -0
  353. package/dist/types/utils/xy/SeriesPalette.d.ts +59 -0
  354. package/dist/types/utils/xy/VarianceMeasure.d.ts +37 -0
  355. package/dist/types/utils/xy/XYFrame.d.ts +44 -0
  356. package/dist/types/utils/xy/XYLegend.d.ts +43 -0
  357. package/dist/types/utils/xy/model/AxisConfig.d.ts +96 -0
  358. package/dist/types/utils/xy/model/ScaleFactorsXYChart.d.ts +36 -0
  359. package/dist/types/utils/xy/model/XYChartDataRow.d.ts +157 -0
  360. package/dist/types/utils/xy/model/XYChartStyle.d.ts +31 -0
  361. package/package.json +5 -4
  362. package/readme.md +9 -5
  363. package/dist/bn-template-engine/p-3141c4a2.entry.js +0 -1
  364. package/dist/bn-template-engine/p-67538176.entry.js +0 -1
  365. package/dist/bn-template-engine/p-916296a5.entry.js +0 -1
  366. package/dist/bn-template-engine/p-96006b06.entry.js +0 -1
  367. package/dist/bn-template-engine/p-Ck-NYtot.js +0 -1
  368. package/dist/bn-template-engine/p-CnDq0oVa.js +0 -1
  369. package/dist/bn-template-engine/p-DSXNgKLa.js +0 -1
  370. package/dist/bn-template-engine/p-bc711fb0.entry.js +0 -1
  371. package/dist/bn-template-engine/p-c86395b8.entry.js +0 -1
  372. package/dist/bn-template-engine/p-e6f646b1.entry.js +0 -1
  373. package/dist/bn-template-engine/p-f41d9242.entry.js +0 -1
  374. package/dist/bn-template-engine/p-gFbbuhtl.js +0 -1
  375. package/dist/cjs/bn-asset_20.cjs.entry.js +0 -23547
  376. package/dist/cjs/context-protocol-ohYzcb5F.js +0 -663
  377. package/dist/cjs/scaling-CIAClQR5.js +0 -314
  378. package/dist/cjs/withStyled-qd94SSb4.js +0 -9535
  379. package/dist/collection/stores/datasets.js +0 -14
  380. package/dist/collection/stores/datasources.js +0 -14
  381. package/dist/components/_commonjsHelpers.js +0 -1
  382. package/dist/components/alasql.min.js +0 -1
  383. package/dist/components/ibcsRuleSet.js +0 -1
  384. package/dist/components/scaling.js +0 -1
  385. package/dist/components/withInheritedProps.js +0 -1
  386. package/dist/esm/bn-asset_20.entry.js +0 -23526
  387. package/dist/esm/context-protocol-DdbSplvE.js +0 -656
  388. package/dist/esm/scaling-DGKKkuL9.js +0 -309
  389. package/dist/esm/withStyled-BIkqU2w4.js +0 -9501
  390. package/dist/types/stores/datasets.d.ts +0 -14
  391. package/dist/types/stores/datasources.d.ts +0 -14
@@ -3,13 +3,16 @@ import { isBlankInput, isValidBoolean, isValidDirection, isValidInteger, isValid
3
3
  import withDataset from "../../utils/withDataset";
4
4
  import withComponentStatus from "../../utils/withComponentStatus";
5
5
  import withTranslation from "../../utils/withTranslation";
6
+ import withScalingGroup from "../../utils/withScalingGroup";
6
7
  import { globalLabelKeys } from "../../stores/internationalization";
7
8
  import { withStyled } from "../../utils/styled/withStyled";
8
9
  import withComponentStyle from "../../utils/withComponentStyle";
10
+ import withRuleSet from "../../utils/withRuleSet";
9
11
  import withHasError from "../../utils/withHasError";
10
12
  import withInheritedProps, { isInheritedValue } from "../../utils/withInheritedProps";
11
13
  import { getParentDimensions } from "../../utils/parentDimensions";
12
14
  import { parseScaling } from "../../utils/scaling";
15
+ import { observeParentResize } from "../../utils/layoutObserver";
13
16
  import { AggregationLevel, StackBy, StackMode, StackOrder } from "../../utils/constants";
14
17
  import { OrderColumn, OrderDirection } from "../../utils/model/Order";
15
18
  /**
@@ -75,7 +78,8 @@ export class Chart {
75
78
  }
76
79
  validatePercentageScaling(newValue) {
77
80
  const errId = "ERR_percentageScaling";
78
- if (!isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
81
+ const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
82
+ if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
79
83
  this.errors.addOrReplace({
80
84
  id: errId,
81
85
  type: "warning",
@@ -218,9 +222,15 @@ export class Chart {
218
222
  }
219
223
  }
220
224
  constructor() {
221
- this.data = [];
225
+ /** Active dataset name (the last subscribed dataset to fire `onUpdate`). */
226
+ this.datasetName = "";
227
+ /** Bumped on every data update so Stencil re-renders even when the name is unchanged. */
228
+ this.dataVersion = 0;
222
229
  this.datasetMeta = null;
223
230
  this.appliedScaleFactor = 1;
231
+ this.layoutObserver = null;
232
+ /** Last parent height seen, used to suppress ResizeObserver noise. */
233
+ this._lastScaledParentHeight = 0;
224
234
  /**
225
235
  * Title displayed above the chart. When empty, the title is derived
226
236
  * from the variance scenario labels (if variances are configured).
@@ -314,19 +324,21 @@ export class Chart {
314
324
  * @example stack='{"by":"dimensions","mode":"relative"}'
315
325
  */
316
326
  this.stack = "";
317
- this.scenariosArray = [""];
318
327
  this.pixelPerUnitGroupMap = new Map();
319
328
  this._autoScaleGuard = false;
320
329
  withStyled(this);
321
330
  withComponentStatus(this);
322
- withDataset(this, (_name, data) => {
323
- this.data = (data || []);
331
+ withDataset(this, (name, _data) => {
332
+ this.datasetName = (name === null || name === void 0 ? void 0 : name.startsWith("$")) ? name.substring(1) : name || "";
333
+ this.dataVersion = this.dataVersion + 1;
324
334
  }, (_name, meta) => {
325
335
  this.datasetMeta = meta;
326
336
  });
327
337
  this.chartTemplate = this.chartTemplate.bind(this);
328
338
  this.errors = withHasError(this);
339
+ withScalingGroup(this);
329
340
  this.componentStyle = withComponentStyle(this);
341
+ this.ruleSetConfig = withRuleSet(this);
330
342
  this.t = withTranslation(this).t;
331
343
  this.resolveInherited = withInheritedProps(this, [
332
344
  { propName: "scenarios", ancestorAttr: "title-scenarios" },
@@ -350,7 +362,6 @@ export class Chart {
350
362
  this.validateScaling(this.scale);
351
363
  }
352
364
  componentDidRender() {
353
- var _a, _b;
354
365
  const { mode } = parseScaling(this.scale);
355
366
  if (mode !== "auto" && mode !== "empty") {
356
367
  this._autoScaleGuard = false;
@@ -368,24 +379,34 @@ export class Chart {
368
379
  this.checkWidthOverflow();
369
380
  return;
370
381
  }
371
- // Measure at base (unscaled) font size to get true content height
382
+ // Record height so the ResizeObserver callback can tell
383
+ // whether the container genuinely resized or just reflowed.
384
+ this._lastScaledParentHeight = parentHeight;
372
385
  const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
373
- host.style.setProperty("--bn-font-size", `${baseFontSize}px`);
374
- // Reading scrollHeight forces a synchronous reflow at base size
375
- const div = (_a = host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".container");
376
- const unscaledHeight = (_b = div === null || div === void 0 ? void 0 : div.scrollHeight) !== null && _b !== void 0 ? _b : host.scrollHeight;
377
- if (unscaledHeight <= parentHeight + 1) {
386
+ // The chart host is display:inline-block — it sizes to its content.
387
+ // scrollHeight gives the actual rendered height at the current factor.
388
+ const currentHeight = host.scrollHeight;
389
+ const currentFactor = this.appliedScaleFactor;
390
+ // Primary check: does the content ACTUALLY fit at the current factor?
391
+ // This avoids oscillation from non-linear SVG scaling where the
392
+ // divide-by-factor estimate overshoots.
393
+ if (currentHeight <= parentHeight + 1) {
394
+ // Content fits. Don't reset to factor 1 — the content only fits
395
+ // BECAUSE of the current factor. Resetting would cause oscillation.
378
396
  this.errors.remove("AUTO_scale");
379
- if (this.appliedScaleFactor !== 1) {
380
- this._autoScaleGuard = true;
381
- writeTask(() => {
382
- this.appliedScaleFactor = 1;
383
- });
384
- }
385
397
  this.checkWidthOverflow();
386
398
  return;
387
399
  }
388
- const computedFactor = (parentHeight - 1) / unscaledHeight;
400
+ // Content overflows. Compute a new factor based on the ratio of
401
+ // parent to current content height, scaled by the current factor.
402
+ const computedFactor = Math.max(0.3, (currentFactor * (parentHeight - 1)) / currentHeight);
403
+ // Only apply if the change is significant (> 1% of current factor).
404
+ // SVG charts have non-linear scaling so we use a wider tolerance
405
+ // than tables to avoid oscillation from sub-pixel rounding.
406
+ if (Math.abs(computedFactor - currentFactor) < 0.01) {
407
+ this.checkWidthOverflow();
408
+ return;
409
+ }
389
410
  host.style.setProperty("--bn-font-size", `${baseFontSize * computedFactor}px`);
390
411
  if (mode === "empty") {
391
412
  this.errors.addOrReplace({
@@ -397,27 +418,46 @@ export class Chart {
397
418
  else {
398
419
  this.errors.remove("AUTO_scale");
399
420
  }
400
- if (Math.abs(computedFactor - this.appliedScaleFactor) > 0.001) {
401
- this._autoScaleGuard = true;
402
- writeTask(() => {
403
- this.appliedScaleFactor = computedFactor;
404
- });
405
- }
421
+ this._autoScaleGuard = true;
422
+ writeTask(() => {
423
+ this.appliedScaleFactor = computedFactor;
424
+ });
406
425
  this.checkWidthOverflow();
407
426
  }
408
427
  componentDidLoad() {
409
- // If the initial parentDimensions measurement returned 0 (common inside
410
- // cards/slots whose width isn't known before first paint), defer re-check
411
- // to a requestAnimationFrame so the browser has completed at least one
412
- // full layout pass before we re-measure.
413
- if (this.canvasWidthSegmented <= 0) {
428
+ // Observe the parent container for size changes so auto-scaling
429
+ // reacts to genuine container resizes (window resize, card relayout).
430
+ // Only trigger a re-render when the parent height actually changed
431
+ // compared to what auto-scaling last measured — this prevents the
432
+ // ResizeObserver's initial fire (and content-reflow noise) from
433
+ // creating an infinite auto-scale loop.
434
+ this.layoutObserver = observeParentResize(this.element, () => {
435
+ if (this._autoScaleGuard)
436
+ return;
437
+ const { height } = getParentDimensions(this.element);
438
+ // Only react to HEIGHT changes — structure chart scales by height.
439
+ // Width changes are handled separately via checkWidthOverflow.
440
+ if (height > 0 && Math.abs(height - this._lastScaledParentHeight) > 2) {
441
+ this._lastScaledParentHeight = height;
442
+ forceUpdate(this);
443
+ }
444
+ });
445
+ // Double-rAF guarantees the browser has completed at least one full
446
+ // paint cycle so all nested shadow DOM layouts are finalized.
447
+ requestAnimationFrame(() => {
414
448
  requestAnimationFrame(() => {
415
- const { width } = getParentDimensions(this.element);
416
- if (width > 0) {
417
- forceUpdate(this);
418
- }
449
+ if (this._autoScaleGuard)
450
+ return;
451
+ const { height } = getParentDimensions(this.element);
452
+ this._lastScaledParentHeight = height;
453
+ forceUpdate(this);
419
454
  });
420
- }
455
+ });
456
+ }
457
+ disconnectedCallback() {
458
+ var _a;
459
+ (_a = this.layoutObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
460
+ this.layoutObserver = null;
421
461
  }
422
462
  /**
423
463
  * Emits an error when a custom unit-scaling value causes the chart to exceed its container width.
@@ -447,7 +487,9 @@ export class Chart {
447
487
  }
448
488
  prepareDimension() {
449
489
  const parent = getParentDimensions(this.element);
450
- this.canvasWidthSegmented = parent.width / this.scenariosArray.length;
490
+ const variancesList = this.prepareVariances();
491
+ const segmentCount = 1 + variancesList.length;
492
+ this.canvasWidthSegmented = parent.width / segmentCount;
451
493
  return { width: this.canvasWidthSegmented, height: parent.height };
452
494
  }
453
495
  prepareScenarios() {
@@ -523,10 +565,25 @@ export class Chart {
523
565
  return 0;
524
566
  }
525
567
  preparePixelPerPercentage() {
568
+ var _a;
526
569
  if (this.pixelPerUnitGroupMap.has(this.percentageScaling)) {
527
570
  return this.pixelPerUnitGroupMap.get(this.percentageScaling);
528
571
  }
529
- return Number(this.percentageScaling) * 100;
572
+ if (((_a = this.percentageScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
573
+ this.errors.remove("AUTO_percentageScaling");
574
+ return 0;
575
+ }
576
+ const numeric = Number(this.percentageScaling);
577
+ if (!isNaN(numeric) && numeric > 0) {
578
+ this.errors.remove("AUTO_percentageScaling");
579
+ return numeric * 100;
580
+ }
581
+ this.errors.addOrReplace({
582
+ id: "AUTO_percentageScaling",
583
+ type: "warning",
584
+ message: `percentage-scaling: not set, auto-calculated to fit available space.`,
585
+ });
586
+ return 0;
530
587
  }
531
588
  prepareLevel() {
532
589
  var _a, _b, _c;
@@ -740,7 +797,7 @@ export class Chart {
740
797
  const scenarios = this.prepareScenarios();
741
798
  // Dimension stacking uses only the first scenario
742
799
  const effectiveScenarios = (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
743
- return (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() }));
800
+ return (h("ibcs-chart-structure", { tableName: this.datasetName, dataVersion: this.dataVersion, 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(), ruleSetConfig: this.ruleSetConfig() }));
744
801
  }
745
802
  getEffectiveScaleFactor() {
746
803
  const { mode, factor } = parseScaling(this.scale);
@@ -770,7 +827,7 @@ export class Chart {
770
827
  scenariosArray = [...scenariosArray, ...variancesArray];
771
828
  }
772
829
  const fontStyles = this.getFontStyles();
773
- return (h(Host, { key: 'e74f31b521664a59111304c6f5df3b4ec568e34e', style: fontStyles }, h("div", { key: '8c65b4db7868346e8db983553ad6e1ab8e2c656c', class: "container" }, scenariosArray.map(this.chartTemplate))));
830
+ return (h(Host, { key: 'dd704d2ab46ee7a34213eab0188671e3df4ca592', style: fontStyles }, h("div", { key: '71c53b1dbd77e68a46e63fdf252cd11efb6a79a6', class: "container" }, scenariosArray.map(this.chartTemplate))));
774
831
  }
775
832
  static get is() { return "bn-chart-structure"; }
776
833
  static get encapsulation() { return "shadow"; }
@@ -809,6 +866,25 @@ export class Chart {
809
866
  "attribute": "chart-title",
810
867
  "defaultValue": "\"\""
811
868
  },
869
+ "ruleset": {
870
+ "type": "string",
871
+ "mutable": false,
872
+ "complexType": {
873
+ "original": "string",
874
+ "resolved": "string",
875
+ "references": {}
876
+ },
877
+ "required": false,
878
+ "optional": true,
879
+ "docs": {
880
+ "tags": [],
881
+ "text": "Name of a registered IBCS rule set (see `bn-ruleset`) used for scenario\nordering. Supports `\"inherited-closest\"` / `\"inherited-page\"` to take\nover the value from an ancestor `bn-layout-card` / `bn-layout-page`."
882
+ },
883
+ "getter": false,
884
+ "setter": false,
885
+ "reflect": true,
886
+ "attribute": "ruleset"
887
+ },
812
888
  "filter": {
813
889
  "type": "string",
814
890
  "mutable": false,
@@ -896,8 +972,11 @@ export class Chart {
896
972
  }, {
897
973
  "name": "example",
898
974
  "text": "unit-scaling=\"0.05\""
975
+ }, {
976
+ "name": "example",
977
+ "text": "unit-scaling=\"revenue-scale\""
899
978
  }],
900
- "text": "Controls horizontal bar scaling (pixels per data unit).\n\n| Value | Behavior |\n|----------------|-----------------------------------------------------------------|\n| `\"auto\"` | Auto-fit bars to fill the available container width (no warning) |\n| not set / `\"\"` | Same as auto, but emits `AUTO_unitScaling` warning |\n| `\"0.03\"`, `1` | Explicit pixels-per-unit value; bars scale proportionally |\n| group name | References a shared scaling group for synchronized charts |\n\nWhen using a custom value that causes the chart to exceed its container,\na `WARN_overflow` error is emitted."
979
+ "text": "Controls horizontal bar scaling (pixels per data unit).\n\n| Value | Behavior |\n|----------------|-----------------------------------------------------------------|\n| `\"auto\"` | Auto-fit bars to fill the available container width (no warning) |\n| not set / `\"\"` | Same as auto, but emits `AUTO_unitScaling` warning |\n| `\"0.03\"`, `1` | Explicit pixels-per-unit value; bars scale proportionally |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |\n\nWhen using a custom value that causes the chart to exceed its container,\na `WARN_overflow` error is emitted."
901
980
  },
902
981
  "getter": false,
903
982
  "setter": false,
@@ -918,8 +997,11 @@ export class Chart {
918
997
  "tags": [{
919
998
  "name": "example",
920
999
  "text": "percentage-scaling=\"50\""
1000
+ }, {
1001
+ "name": "example",
1002
+ "text": "percentage-scaling=\"pct-scale\""
921
1003
  }],
922
- "text": "Controls scaling of relative variance bars (pixels per percentage point).\n\n| Value | Behavior |\n|----------------|---------------------------------------------------------------|\n| `\"auto\"` | Auto-fit to available width |\n| not set / `\"\"` | Same as auto with warning |\n| `\"50\"`, `1.5` | Explicit pixels-per-percentage-point value |\n| group name | References a shared scaling group for synchronized charts |"
1004
+ "text": "Controls scaling of relative variance bars (pixels per percentage point).\n\n| Value | Behavior |\n|----------------|---------------------------------------------------------------|\n| `\"auto\"` | Auto-fit to available width |\n| not set / `\"\"` | Same as auto with warning |\n| `\"50\"`, `1.5` | Explicit pixels-per-percentage-point value |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |"
923
1005
  },
924
1006
  "getter": false,
925
1007
  "setter": false,
@@ -1177,7 +1259,8 @@ export class Chart {
1177
1259
  }
1178
1260
  static get states() {
1179
1261
  return {
1180
- "data": {},
1262
+ "datasetName": {},
1263
+ "dataVersion": {},
1181
1264
  "datasetMeta": {},
1182
1265
  "appliedScaleFactor": {}
1183
1266
  };
@@ -1,9 +1,11 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  import { StructureChart } from "./utils/StructureChart";
3
3
  import { CustomPattern } from "./utils/helper";
4
- import { StructureChartComponentConfigAdapter, } from "./utils/model";
4
+ import { StructureChartComponentConfigAdapter } from "./utils/model";
5
5
  import { StructureChartDataRowAdapter } from "./utils/model";
6
6
  import { ScaleFactorsStructureChartAdapter } from "./utils/model";
7
+ import { getStores } from "../../context/context-protocol";
8
+ import { buildFromExpr } from "../../context/scopedDb";
7
9
  //import { FontStyleAdapter } from "../../utils/model/styles/FontStyle";
8
10
  //import { SVGStyleGroupAdapter } from "../../utils/model/styles/SVGStyleGroup";
9
11
  //import { SVGVariancesStyleGroupAdapter } from "../../utils/model/styles/SVGVariancesStyleGroup";
@@ -24,7 +26,10 @@ import { SVGVariancesStyleGroupAdapter } from "../../utils/model/styles/SVGVaria
24
26
  //import { DataFormatDigitsAdapter } from "../../utils/model/DataFormatDigits";
25
27
  export class IbcsChartStructure {
26
28
  constructor() {
27
- this.data = [];
29
+ /** Name of the dataset (table or view in the shared alasql database). */
30
+ this.tableName = "";
31
+ /** Bumped by `bn-chart-structure` when the dataset changes; triggers re-render. */
32
+ this.dataVersion = 0;
28
33
  this.chartTitle = "";
29
34
  this.scenarios = [];
30
35
  this.variances = [];
@@ -46,6 +51,11 @@ export class IbcsChartStructure {
46
51
  this.stackConfig = null;
47
52
  this.parentDimensions = { width: 0, height: 0 };
48
53
  }
54
+ getDb() {
55
+ if (!this.stores)
56
+ this.stores = getStores(this.element);
57
+ return this.stores.db.db;
58
+ }
49
59
  render() {
50
60
  var _a, _b, _c;
51
61
  if (this.chart === undefined) {
@@ -59,9 +69,10 @@ export class IbcsChartStructure {
59
69
  }
60
70
  async componentWillLoad() {
61
71
  var _a;
72
+ const db = this.getDb();
62
73
  const config = this.prepareConfig();
63
74
  const styles = this.prepareStyle();
64
- this.chart = new StructureChart(new IBCSRuleSet(), config, styles);
75
+ this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
65
76
  this.chart.setI18n(this.i18n);
66
77
  this.autoFitScaling(config, styles);
67
78
  this.chart.setAvailableWidth(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
@@ -77,6 +88,7 @@ export class IbcsChartStructure {
77
88
  const styles = this.prepareStyle();
78
89
  this.chart.setI18n(this.i18n);
79
90
  this.chart.setStyles(styles);
91
+ this.chart.setRuleSet(new IBCSRuleSet(this.ruleSetConfig));
80
92
  this.chart.setConfig(config);
81
93
  this.autoFitScaling(config, styles);
82
94
  this.chart.setAvailableWidth(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
@@ -84,26 +96,36 @@ export class IbcsChartStructure {
84
96
  this.chart.setPattern("fc", this.pattern.getFCPolygonPattern());
85
97
  }
86
98
  /**
87
- * Two-pass auto-fit: only when pixelPerUnit is 0 (auto mode).
88
- * Explicit values are never overridden — the outer component warns
89
- * about overflow via componentDidRender.
99
+ * Two-pass auto-fit for pixelPerUnit and/or pixelPerPercentage.
100
+ * When either is 0 (auto mode), renders a measurement pass at 1,
101
+ * computes the ratio to fit the available width, and rebuilds.
90
102
  * Structure charts grow horizontally, so we fit to width.
103
+ * Explicit (> 0) values are never overridden.
91
104
  */
92
105
  autoFitScaling(config, styles) {
93
106
  var _a;
94
- if (config.pixelPerUnit > 0) {
95
- return; // Explicit value — respect it, do not override
107
+ const autoUnit = config.pixelPerUnit <= 0;
108
+ const autoPercent = config.pixelPerPercentage <= 0;
109
+ if (!autoUnit && !autoPercent) {
110
+ return; // Both explicit — nothing to auto-fit
96
111
  }
97
112
  const targetWidth = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width;
113
+ const db = this.getDb();
98
114
  if (!targetWidth || targetWidth <= 0) {
99
- config.pixelPerUnit = 1;
100
- this.chart = new StructureChart(new IBCSRuleSet(), config, styles);
115
+ if (autoUnit)
116
+ config.pixelPerUnit = 1;
117
+ if (autoPercent)
118
+ config.pixelPerPercentage = 50;
119
+ this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
101
120
  this.chart.setI18n(this.i18n);
102
121
  return;
103
122
  }
104
- // First pass with pixelPerUnit=1 to measure total width and bar extent
105
- config.pixelPerUnit = 1;
106
- this.chart = new StructureChart(new IBCSRuleSet(), config, styles);
123
+ // First pass: set auto values to 1 and measure total width + bar extent
124
+ if (autoUnit)
125
+ config.pixelPerUnit = 1;
126
+ if (autoPercent)
127
+ config.pixelPerPercentage = 1;
128
+ this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
107
129
  this.chart.setI18n(this.i18n);
108
130
  this.chart.toString();
109
131
  const svgWidth = this.chart.getAllocatedCanvasWidth();
@@ -114,16 +136,21 @@ export class IbcsChartStructure {
114
136
  // totalWidth(ppu) = fixedWidth + maxBarValue * ppu
115
137
  // Solving for ppu: ppu = (targetWidth - fixedWidth) / maxBarValue
116
138
  const maxBarValue = this.chart.getMaxBarValue();
117
- if (maxBarValue > 0) {
118
- const fixedWidth = svgWidth - maxBarValue; // at ppu=1, barExtent = maxBarValue * 1
119
- config.pixelPerUnit = Math.max(0.001, (targetWidth - fixedWidth) / maxBarValue);
139
+ if (autoUnit) {
140
+ if (maxBarValue > 0) {
141
+ const fixedWidth = svgWidth - maxBarValue; // at ppu=1, barExtent = maxBarValue * 1
142
+ config.pixelPerUnit = Math.max(0.001, (targetWidth - fixedWidth) / maxBarValue);
143
+ }
144
+ else {
145
+ config.pixelPerUnit = (targetWidth * 0.9) / svgWidth;
146
+ }
120
147
  }
121
- else {
122
- // Fallback (e.g. relative variance charts)
123
- config.pixelPerUnit = (targetWidth * 0.9) / svgWidth;
148
+ if (autoPercent) {
149
+ // Same ratio approach: scale percentage bars to fill ~90% of width
150
+ config.pixelPerPercentage = (targetWidth * 0.9) / svgWidth;
124
151
  }
125
152
  // Second pass with the corrected scaling
126
- this.chart = new StructureChart(new IBCSRuleSet(), config, styles);
153
+ this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
127
154
  this.chart.setI18n(this.i18n);
128
155
  }
129
156
  async componentWillRender() {
@@ -147,8 +174,9 @@ export class IbcsChartStructure {
147
174
  // }
148
175
  }
149
176
  prepareConfig() {
150
- return new StructureChartComponentConfigAdapter(new StructureChartDataRowAdapter(), new OrderAdapter(new StringAdapter()), new StringAdapter(), new DataFormatDigitsAdapter(), this.data).adapt({
151
- data: this.data,
177
+ const db = this.getDb();
178
+ const fromExpr = this.tableName ? buildFromExpr(this.tableName, this.filter) : "";
179
+ return new StructureChartComponentConfigAdapter(new StructureChartDataRowAdapter(), new OrderAdapter(new StringAdapter()), new StringAdapter(), new DataFormatDigitsAdapter(), db, fromExpr).adapt({
152
180
  scenarios: this.scenarios,
153
181
  variances: this.variances,
154
182
  title: this.chartTitle,
@@ -183,30 +211,45 @@ export class IbcsChartStructure {
183
211
  }
184
212
  static get properties() {
185
213
  return {
186
- "data": {
187
- "type": "unknown",
214
+ "tableName": {
215
+ "type": "string",
188
216
  "mutable": false,
189
217
  "complexType": {
190
- "original": "StructureChartDataRow[]",
191
- "resolved": "StructureChartDataRow[]",
192
- "references": {
193
- "StructureChartDataRow": {
194
- "location": "import",
195
- "path": "./utils/model",
196
- "id": "src/components/bn-chart-structure/utils/model/index.ts::StructureChartDataRow",
197
- "referenceLocation": "StructureChartDataRow"
198
- }
199
- }
218
+ "original": "string",
219
+ "resolved": "string",
220
+ "references": {}
200
221
  },
201
222
  "required": false,
202
223
  "optional": false,
203
224
  "docs": {
204
225
  "tags": [],
205
- "text": ""
226
+ "text": "Name of the dataset (table or view in the shared alasql database)."
206
227
  },
207
228
  "getter": false,
208
229
  "setter": false,
209
- "defaultValue": "[]"
230
+ "reflect": false,
231
+ "attribute": "table-name",
232
+ "defaultValue": "\"\""
233
+ },
234
+ "dataVersion": {
235
+ "type": "number",
236
+ "mutable": false,
237
+ "complexType": {
238
+ "original": "number",
239
+ "resolved": "number",
240
+ "references": {}
241
+ },
242
+ "required": false,
243
+ "optional": false,
244
+ "docs": {
245
+ "tags": [],
246
+ "text": "Bumped by `bn-chart-structure` when the dataset changes; triggers re-render."
247
+ },
248
+ "getter": false,
249
+ "setter": false,
250
+ "reflect": false,
251
+ "attribute": "data-version",
252
+ "defaultValue": "0"
210
253
  },
211
254
  "chartTitle": {
212
255
  "type": "string",
@@ -597,6 +640,30 @@ export class IbcsChartStructure {
597
640
  "getter": false,
598
641
  "setter": false,
599
642
  "defaultValue": "{ width: 0, height: 0 }"
643
+ },
644
+ "ruleSetConfig": {
645
+ "type": "unknown",
646
+ "mutable": false,
647
+ "complexType": {
648
+ "original": "RuleSetConfig",
649
+ "resolved": "RuleSetConfig",
650
+ "references": {
651
+ "RuleSetConfig": {
652
+ "location": "import",
653
+ "path": "../../stores/ruleSets",
654
+ "id": "src/stores/ruleSets.ts::RuleSetConfig",
655
+ "referenceLocation": "RuleSetConfig"
656
+ }
657
+ }
658
+ },
659
+ "required": false,
660
+ "optional": true,
661
+ "docs": {
662
+ "tags": [],
663
+ "text": ""
664
+ },
665
+ "getter": false,
666
+ "setter": false
600
667
  }
601
668
  };
602
669
  }