@bino-bi/bn-template-engine 1.0.0-next.21 → 1.0.0-next.23

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 (164) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-28d5c266.entry.js → p-0a49cf00.entry.js} +1 -1
  3. package/dist/bn-template-engine/{p-b9e94127.entry.js → p-22b8d044.entry.js} +1 -1
  4. package/dist/bn-template-engine/{p-6c7f0076.entry.js → p-251bb53d.entry.js} +1 -1
  5. package/dist/bn-template-engine/p-2aed639e.entry.js +1 -0
  6. package/dist/bn-template-engine/{p-7e9dbc93.entry.js → p-4616b879.entry.js} +1 -1
  7. package/dist/bn-template-engine/{p-99477a27.entry.js → p-629edcca.entry.js} +1 -1
  8. package/dist/bn-template-engine/p-686d8e44.entry.js +1 -0
  9. package/dist/bn-template-engine/{p-a4ea9a79.entry.js → p-68aa61cc.entry.js} +1 -1
  10. package/dist/bn-template-engine/{p-DwYUTvvI.js → p-B5x8M8OC.js} +1 -1
  11. package/dist/bn-template-engine/{p-fFtEvsY-.js → p-BGrnfif3.js} +1 -1
  12. package/dist/bn-template-engine/{p-6lOdN-fB.js → p-BVfLus3u.js} +1 -1
  13. package/dist/bn-template-engine/{p-CJThzFZm.js → p-BcZ5GQZ8.js} +1 -1
  14. package/dist/bn-template-engine/{p-CYE0I1Mx.js → p-Bca5V28_.js} +1 -1
  15. package/dist/bn-template-engine/p-C5UYpZUU.js +2 -0
  16. package/dist/bn-template-engine/{p-BgIpdpfH.js → p-C7T4DAAW.js} +1 -1
  17. package/dist/bn-template-engine/p-CDo04UEU.js +1 -0
  18. package/dist/bn-template-engine/p-CTrNbSXN.js +1 -0
  19. package/dist/bn-template-engine/{p-C5uvAEKI.js → p-CbciPY-M.js} +1 -1
  20. package/dist/bn-template-engine/{p-BpWWgN6k.js → p-CuR4S456.js} +1 -1
  21. package/dist/bn-template-engine/p-DWtTjg0f.js +1 -0
  22. package/dist/bn-template-engine/{p-eEfqksk-.js → p-DdqXNsKP.js} +1 -1
  23. package/dist/bn-template-engine/{p-B4JfKvVT.js → p-DtLI_CzV.js} +1 -1
  24. package/dist/bn-template-engine/p-UtNHLX1j.js +1 -0
  25. package/dist/bn-template-engine/{p-ba912130.entry.js → p-aecb5de3.entry.js} +1 -1
  26. package/dist/bn-template-engine/{p-687032d5.entry.js → p-ba43d46e.entry.js} +1 -1
  27. package/dist/bn-template-engine/{p-6077155f.entry.js → p-c476e7bb.entry.js} +1 -1
  28. package/dist/bn-template-engine/{p-2d3ea756.entry.js → p-d7c670ec.entry.js} +1 -1
  29. package/dist/bn-template-engine/{p-a1380d7c.entry.js → p-e4a584a8.entry.js} +1 -1
  30. package/dist/bn-template-engine/{p-de29986f.entry.js → p-f12fb09b.entry.js} +1 -1
  31. package/dist/bn-template-engine/p-f9a721bb.entry.js +1 -0
  32. package/dist/cjs/{AxisConfig-D7CAyPLO.js → AxisConfig-DmP4U3JM.js} +1 -1
  33. package/dist/cjs/{LabelCollisionManager-DkdQ9Xdg.js → LabelCollisionManager-Cet3WPm0.js} +2 -2
  34. package/dist/cjs/{Order-IPfAP0q8.js → Order-DlKLywO_.js} +1 -1
  35. package/dist/cjs/{SVGStyle-BD8jApd4.js → SVGStyle-D78RaNnj.js} +2 -2
  36. package/dist/cjs/{SVGVariancesStyleGroup-BaWzR951.js → SVGVariancesStyleGroup-XvNAnYYA.js} +1 -1
  37. package/dist/cjs/{VarianceMeasure-BBWTgv2e.js → VarianceMeasure-BfZLlICl.js} +4 -4
  38. package/dist/cjs/{XYChartDataRow-BoR0CTfl.js → XYChartDataRow-B0NNOqxB.js} +4 -4
  39. package/dist/cjs/bn-asset_21.cjs.entry.js +1052 -314
  40. package/dist/cjs/bn-chart-bubble.cjs.entry.js +25 -15
  41. package/dist/cjs/bn-chart-bullet.cjs.entry.js +9 -9
  42. package/dist/cjs/bn-chart-scatter.cjs.entry.js +9 -9
  43. package/dist/cjs/bn-grid.cjs.entry.js +6 -6
  44. package/dist/cjs/bn-image.cjs.entry.js +6 -6
  45. package/dist/cjs/bn-internationalization.cjs.entry.js +4 -4
  46. package/dist/cjs/bn-ruleset.cjs.entry.js +4 -4
  47. package/dist/cjs/bn-template-engine.cjs.js +3 -3
  48. package/dist/cjs/bn-template.cjs.entry.js +2 -2
  49. package/dist/cjs/bn-text.cjs.entry.js +7 -7
  50. package/dist/cjs/bn-tree.cjs.entry.js +6 -6
  51. package/dist/cjs/{context-protocol-BBhT9B52.js → context-protocol-DeLmu5s2.js} +1 -1
  52. package/dist/cjs/editor-companion.cjs.entry.js +2 -2
  53. package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +6 -6
  54. package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +6 -6
  55. package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +6 -6
  56. package/dist/cjs/{index-CDKG4xmO.js → index-C1Z9vO7z.js} +61 -19
  57. package/dist/cjs/{layoutObserver-DUYYkDMQ.js → layoutObserver-CrzQQGpv.js} +5 -5
  58. package/dist/cjs/loader.cjs.js +2 -2
  59. package/dist/cjs/{scaling-BIJQ2NV1.js → scaling-JAU6IJnR.js} +85 -3
  60. package/dist/cjs/{withBodyObserver-BKUE_ypL.js → withBodyObserver-DJO98AJ-.js} +2 -2
  61. package/dist/cjs/{withHasError-Cl2gTQzA.js → withHasError-BdDmiOXM.js} +1 -1
  62. package/dist/cjs/{withScalingGroup-D5clRvRe.js → withScalingGroup-Bu5gatHT.js} +3 -3
  63. package/dist/cjs/{withStyled-Cm9dWQhu.js → withStyled-50UepUwV.js} +8 -8
  64. package/dist/collection/collection-manifest.json +1 -1
  65. package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +15 -5
  66. package/dist/collection/components/bn-chart-structure/bn-chart-structure.css +6 -0
  67. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +149 -57
  68. package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +135 -28
  69. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +30 -19
  70. package/dist/collection/components/bn-chart-time/bn-chart-time.js +186 -49
  71. package/dist/collection/components/bn-chart-time/ibcs-chart-time.css +9 -3
  72. package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +141 -22
  73. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +36 -0
  74. package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +76 -19
  75. package/dist/collection/components/bn-table/bn-table.js +121 -49
  76. package/dist/collection/components/bn-table/ibcs-table.js +83 -42
  77. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +20 -34
  78. package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +4 -5
  79. package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +89 -0
  80. package/dist/collection/utils/autoFit.js +63 -0
  81. package/dist/collection/utils/constants.js +3 -3
  82. package/dist/collection/utils/dataAnalyzer.js +17 -8
  83. package/dist/collection/utils/scaling.js +79 -0
  84. package/dist/collection/utils/validate.js +3 -3
  85. package/dist/components/DataFormatDigits.js +1 -1
  86. package/dist/components/autoFit.js +1 -0
  87. package/dist/components/bn-chart-bubble.js +1 -1
  88. package/dist/components/bn-chart-bullet.js +1 -1
  89. package/dist/components/bn-chart-scatter.js +1 -1
  90. package/dist/components/bn-chart-structure.js +1 -1
  91. package/dist/components/bn-chart-time.js +1 -1
  92. package/dist/components/bn-grid.js +1 -1
  93. package/dist/components/bn-scaling-group.js +1 -1
  94. package/dist/components/bn-table.js +1 -1
  95. package/dist/components/bn-text.js +1 -1
  96. package/dist/components/bn-tree.js +1 -1
  97. package/dist/components/ibcs-chart-structure2.js +1 -1
  98. package/dist/components/ibcs-chart-time2.js +1 -1
  99. package/dist/components/ibcs-table2.js +1 -1
  100. package/dist/components/scaling.js +1 -0
  101. package/dist/components/validate.js +1 -1
  102. package/dist/components/withDataset.js +1 -1
  103. package/dist/components/withStyled.js +1 -1
  104. package/dist/esm/{AxisConfig-ByIP5J-9.js → AxisConfig-Cjy_RANi.js} +1 -1
  105. package/dist/esm/{LabelCollisionManager-DaNiDiM9.js → LabelCollisionManager-B_NUM9yq.js} +2 -2
  106. package/dist/esm/{Order-BQeJE_yi.js → Order-B-aF6Rwn.js} +1 -1
  107. package/dist/esm/{SVGStyle-BwBlY3Km.js → SVGStyle-8FfAtUF-.js} +2 -2
  108. package/dist/esm/{SVGVariancesStyleGroup-BpGW4CvN.js → SVGVariancesStyleGroup-DD4mIOjT.js} +1 -1
  109. package/dist/esm/{VarianceMeasure-CE3N8Bea.js → VarianceMeasure-DLOuIIJ7.js} +4 -4
  110. package/dist/esm/{XYChartDataRow-DeMI1JKU.js → XYChartDataRow-CKfILBFG.js} +4 -4
  111. package/dist/esm/bn-asset_21.entry.js +1052 -314
  112. package/dist/esm/bn-chart-bubble.entry.js +25 -15
  113. package/dist/esm/bn-chart-bullet.entry.js +9 -9
  114. package/dist/esm/bn-chart-scatter.entry.js +9 -9
  115. package/dist/esm/bn-grid.entry.js +6 -6
  116. package/dist/esm/bn-image.entry.js +6 -6
  117. package/dist/esm/bn-internationalization.entry.js +4 -4
  118. package/dist/esm/bn-ruleset.entry.js +4 -4
  119. package/dist/esm/bn-template-engine.js +4 -4
  120. package/dist/esm/bn-template.entry.js +2 -2
  121. package/dist/esm/bn-text.entry.js +7 -7
  122. package/dist/esm/bn-tree.entry.js +6 -6
  123. package/dist/esm/{context-protocol-d8MHrEo8.js → context-protocol-BoEL0caI.js} +1 -1
  124. package/dist/esm/editor-companion.entry.js +2 -2
  125. package/dist/esm/ibcs-chart-bubble.entry.js +6 -6
  126. package/dist/esm/ibcs-chart-bullet.entry.js +6 -6
  127. package/dist/esm/ibcs-chart-scatter.entry.js +6 -6
  128. package/dist/esm/{index-B_d-jp99.js → index-C5UYpZUU.js} +61 -19
  129. package/dist/esm/{layoutObserver-BJBEyhNf.js → layoutObserver-cgIXg2sg.js} +5 -5
  130. package/dist/esm/loader.js +3 -3
  131. package/dist/esm/{scaling-BGnpSN1j.js → scaling-CxyNpMQM.js} +83 -4
  132. package/dist/esm/{withBodyObserver-IokS6fHD.js → withBodyObserver-Cb9ZC5_J.js} +2 -2
  133. package/dist/esm/{withHasError-DW_vMDUp.js → withHasError-Bh1Viz52.js} +1 -1
  134. package/dist/esm/{withScalingGroup-CC3UcvC5.js → withScalingGroup-Yv9nGGe1.js} +3 -3
  135. package/dist/esm/{withStyled-2l5Tx3cf.js → withStyled-By9Jd-Oy.js} +8 -8
  136. package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +5 -2
  137. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +47 -19
  138. package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +17 -3
  139. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +11 -3
  140. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +52 -18
  141. package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +18 -3
  142. package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +12 -0
  143. package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +28 -8
  144. package/dist/types/components/bn-table/bn-table.d.ts +45 -19
  145. package/dist/types/components/bn-table/ibcs-table.d.ts +23 -6
  146. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +9 -1
  147. package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +51 -0
  148. package/dist/types/components.d.ts +91 -55
  149. package/dist/types/stencil-public-runtime.d.ts +1 -0
  150. package/dist/types/utils/autoFit.d.ts +79 -0
  151. package/dist/types/utils/constants.d.ts +3 -3
  152. package/dist/types/utils/dataAnalyzer.d.ts +5 -1
  153. package/dist/types/utils/scaling.d.ts +63 -0
  154. package/dist/types/utils/validate.d.ts +2 -2
  155. package/package.json +1 -1
  156. package/readme.md +2 -0
  157. package/dist/bn-template-engine/p-2fba7c99.entry.js +0 -1
  158. package/dist/bn-template-engine/p-A8xyE4b1.js +0 -1
  159. package/dist/bn-template-engine/p-B_d-jp99.js +0 -2
  160. package/dist/bn-template-engine/p-BjBz5cSL.js +0 -1
  161. package/dist/bn-template-engine/p-C8Q0lsaU.js +0 -1
  162. package/dist/bn-template-engine/p-C9i1Xsib.js +0 -1
  163. package/dist/bn-template-engine/p-a8291de2.entry.js +0 -1
  164. package/dist/bn-template-engine/p-b5274369.entry.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { forceUpdate, h, Host, writeTask } from "@stencil/core";
2
- import { isBlankInput, isTableBarColumnWidth, isTableCategoryWidth, isValidBoolean, isValidDataFormat, isValidDateFormat, isValidDirection, isValidInteger, isValidMeasureScale, isValidMeasureType, isValidNumber, isValidTableType, validateAttributesJsonStr, validateBarColumnsList, validateColumnThereOfJsonStr, validateOrderList, validatePartOfJsonStr, validateScenarioList, validateThereOfJsonStr, validateVariancesList, } from "../../utils/validate";
2
+ import { isBlankInput, isTableBarColumnWidth, isTableCategoryWidth, isValidBoolean, isValidDataFormat, isValidDateFormat, isValidDirection, isValidInteger, isValidMeasureScale, isValidMeasureType, isValidTableType, validateAttributesJsonStr, validateBarColumnsList, validateColumnThereOfJsonStr, validateOrderList, validatePartOfJsonStr, validateScenarioList, validateThereOfJsonStr, validateVariancesList, } from "../../utils/validate";
3
3
  import withDataset from "../../utils/withDataset";
4
4
  import withComponentStatus from "../../utils/withComponentStatus";
5
5
  import withScalingGroup from "../../utils/withScalingGroup";
@@ -11,7 +11,7 @@ import withRuleSet from "../../utils/withRuleSet";
11
11
  import withHasError from "../../utils/withHasError";
12
12
  import withInheritedProps, { isInheritedValue } from "../../utils/withInheritedProps";
13
13
  import { getParentDimensions } from "../../utils/parentDimensions";
14
- import { parseScaling } from "../../utils/scaling";
14
+ import { formatScalingValue, parseScaling, resolveScalingValue } from "../../utils/scaling";
15
15
  import { observeParentResize } from "../../utils/layoutObserver";
16
16
  import { BAR_COLUMN_WIDTH_EM, DataFormat, I18nMode, MeasureType, TableBarColumnWidth, TableCategoryWidth, } from "../../utils/constants";
17
17
  import { TableType } from "./utils/model";
@@ -73,38 +73,50 @@ export class Table {
73
73
  */
74
74
  this.measureUnit = "";
75
75
  /**
76
- * Set width of bar chart columns. Controls the max bar/pin width in pixels.
76
+ * Set the total width of bar chart columns, in em of the table font — the same
77
+ * unit and vocabulary as ```categoryWidth```, so ```bar-column-width="w15"```
78
+ * renders exactly as wide as ```category-width="w15"```. The bar/pin drawing
79
+ * area is that width minus the value-label gutters.
77
80
  * <br /><br />
78
81
  * values:<br />
79
82
  * ``` w5 // w10 // w15 // w20 // w25 // w30 // w40 // w60 // w80 // w100 ```
80
83
  */
81
84
  this.barColumnWidth = "w10";
82
85
  /**
83
- * Pixels per unit for absolute variance bar charts (ΔPY).
84
- * Controls bar width: barWidth = value × unitScaling.
86
+ * Data units displayed per 1 em of bar length for absolute variance bar
87
+ * charts (ΔPY) — map-scale semantics: a larger value means smaller bars.
85
88
  * Bars exceeding barColumnWidth are shown with an arrow indicator.
86
- * <br /><br />
87
- * Accepts a number, `"auto"`, or a `<bn-scaling-group>` name for synchronized scaling.
88
- * <br /><br />
89
- * Default: 0.01
90
89
  *
91
- * @example unit-scaling="0.01"
90
+ * | Value | Behavior |
91
+ * |------------------|----------------------------------------------------------------|
92
+ * | `"auto"` | Auto-fit the largest bar to the bar column width |
93
+ * | `"250000"`, `"1M"` | Units per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |
94
+ * | group name | References a `<bn-scaling-group>` for synchronized scaling |
95
+ * | invalid / unknown | Auto-fit + `AUTO_unitScaling` warning |
96
+ *
97
+ * Default: `"100"` (1 em of bar represents 100 units)
98
+ *
99
+ * @example unit-scaling="1M"
92
100
  * @example unit-scaling="revenue-scale"
93
101
  */
94
- this.unitScaling = 0.01;
102
+ this.unitScaling = "100";
95
103
  /**
96
- * Scaling for relative variance pin charts (ΔPY%).
97
- * <br /><br />
98
- * Accepts a number, `"auto"`, or a `<bn-scaling-group>` name for synchronized scaling.
99
- * <br /><br />
100
- * Example: 0.5 means 100% = 50 pixels width.
101
- * <br /><br />
102
- * Default: 0.5
104
+ * Percentage points displayed per 1 em of pin length for relative variance
105
+ * pin charts (ΔPY%) — a larger value means shorter pins.
106
+ *
107
+ * | Value | Behavior |
108
+ * |------------------|----------------------------------------------------------------|
109
+ * | `"auto"` | Auto-fit the largest pin to the pin area |
110
+ * | `"10"`, `"2.5"` | Percentage points per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |
111
+ * | group name | References a `<bn-scaling-group>` for synchronized scaling |
112
+ * | invalid / unknown | Auto-fit + `AUTO_percentageScaling` warning |
103
113
  *
104
- * @example percentage-scaling="0.5"
114
+ * Default: `"2"` (a +2 % variance pin is 1 em long)
115
+ *
116
+ * @example percentage-scaling="10"
105
117
  * @example percentage-scaling="pct-scale"
106
118
  */
107
- this.percentageScaling = 0.5;
119
+ this.percentageScaling = "2";
108
120
  // Global scaling groups map - can be populated externally for shared scaling across components
109
121
  this.pixelPerUnitGroupMap = new Map();
110
122
  /**
@@ -218,7 +230,7 @@ export class Table {
218
230
  * original value.
219
231
  * <br /><br />
220
232
  * values: <br />
221
- * ```_ // k // M // G // T // P // E // Z // Y // m // μ // n // p // P // f // a // z // y // GREATEST // LEAST```
233
+ * ```_ // k // M // G // T // P // E // Z // Y // m // my (μ) // n // p // f // a // z // y // GREATEST // LEAST```
222
234
  * <br /><br />
223
235
  * SiPrefix overview:
224
236
  * ``` "Y": 1E+24,```<br />
@@ -231,7 +243,7 @@ export class Table {
231
243
  * ``` "k": 1000,```<br />
232
244
  * <br />
233
245
  * ``` "m": 0.001,```<br />
234
- * ``` "μ": 0.000001,```<br />
246
+ * ``` "my" (μ): 0.000001,```<br />
235
247
  * ``` "n": 0.000000001,```<br />
236
248
  * ``` "p": 0.000000000001,```<br />
237
249
  * ``` "f": 0.000000000000001,```<br />
@@ -257,10 +269,13 @@ export class Table {
257
269
  */
258
270
  this.dataFormatDigitsPercent = 2;
259
271
  /**
260
- * Set width of category column. <br />
272
+ * Set width of category column, in em of the table font. <br />
261
273
  * If INF is selected the columns scaling to the min space they need
262
274
  * seperatly.
263
275
  * <br /><br />
276
+ * The column is fixed at this width; a category label too long to fit is
277
+ * truncated with an ellipsis.
278
+ * <br /><br />
264
279
  * values:<br />
265
280
  * ``` w5 // w10 // w15 // w20 // w25 // w50 // inf ```
266
281
  */
@@ -303,6 +318,39 @@ export class Table {
303
318
  */
304
319
  this.tableAttributes = "";
305
320
  this._autoScaleGuard = false;
321
+ this.autoUnitWarningActive = false;
322
+ this.autoPctWarningActive = false;
323
+ /**
324
+ * Receives the auto-fitted scaling values from the inner ibcs-table
325
+ * (em per unit / em per percentage point) and surfaces them in the AUTO_*
326
+ * warnings, converted back to the attribute's units-per-em form so users
327
+ * can copy them into a bn-scaling-group.
328
+ */
329
+ this.handleAutoScalingReport = (report) => {
330
+ const changed = (next, last) => last === undefined || Math.abs(next - last) > Math.abs(next) * 1e-3;
331
+ if (report.unit !== undefined && report.unit > 0 && this.autoUnitWarningActive) {
332
+ const unitsPerEm = 1 / report.unit;
333
+ if (changed(unitsPerEm, this.lastReportedUnitsPerEm)) {
334
+ this.lastReportedUnitsPerEm = unitsPerEm;
335
+ this.errors.addOrReplace({
336
+ id: "AUTO_unitScaling",
337
+ type: "warning",
338
+ message: `unit-scaling: invalid value "${this.unitScaling}" — auto-fitted to 1 em ≈ ${formatScalingValue(unitsPerEm)} units.`,
339
+ });
340
+ }
341
+ }
342
+ if (report.percentage !== undefined && report.percentage > 0 && this.autoPctWarningActive) {
343
+ const ppPerEm = 1 / report.percentage;
344
+ if (changed(ppPerEm, this.lastReportedPpPerEm)) {
345
+ this.lastReportedPpPerEm = ppPerEm;
346
+ this.errors.addOrReplace({
347
+ id: "AUTO_percentageScaling",
348
+ type: "warning",
349
+ message: `percentage-scaling: invalid value "${this.percentageScaling}" — auto-fitted to 1 em ≈ ${formatScalingValue(ppPerEm)} percentage points.`,
350
+ });
351
+ }
352
+ }
353
+ };
306
354
  withStyled(this);
307
355
  withComponentStatus(this);
308
356
  this.errors = withHasError(this);
@@ -397,8 +445,7 @@ export class Table {
397
445
  }
398
446
  validateUnitScaling(newValue) {
399
447
  const errId = "ERR_unitScaling";
400
- const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
401
- if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
448
+ if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
402
449
  this.errors.addOrReplace({
403
450
  id: errId,
404
451
  type: "warning",
@@ -411,8 +458,7 @@ export class Table {
411
458
  }
412
459
  validatePercentageScaling(newValue) {
413
460
  const errId = "ERR_percentageScaling";
414
- const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
415
- if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
461
+ if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
416
462
  this.errors.addOrReplace({
417
463
  id: errId,
418
464
  type: "warning",
@@ -1047,24 +1093,50 @@ export class Table {
1047
1093
  return this.barColumns.split(",").map((col) => col.trim());
1048
1094
  }
1049
1095
  prepareUnitScaling() {
1050
- var _a;
1051
- if (this.pixelPerUnitGroupMap.has(this.unitScaling)) {
1052
- return this.pixelPerUnitGroupMap.get(this.unitScaling);
1053
- }
1054
- if (((_a = this.unitScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
1096
+ const resolved = resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
1097
+ if (resolved.kind === "value") {
1098
+ this.errors.remove("AUTO_unitScaling");
1099
+ this.autoUnitWarningActive = false;
1100
+ this.lastReportedUnitsPerEm = undefined;
1101
+ // Inner ibcs-table expects em per unit; the attribute is units per em.
1102
+ return 1 / resolved.value;
1103
+ }
1104
+ if (resolved.kind === "auto") {
1105
+ this.errors.remove("AUTO_unitScaling");
1106
+ this.autoUnitWarningActive = false;
1107
+ this.lastReportedUnitsPerEm = undefined;
1055
1108
  return 0;
1056
1109
  }
1057
- return Number(this.unitScaling);
1110
+ this.autoUnitWarningActive = true;
1111
+ this.errors.addOrReplace({
1112
+ id: "AUTO_unitScaling",
1113
+ type: "warning",
1114
+ message: `unit-scaling: invalid value "${resolved.raw}" — auto-fitting to the bar column width.`,
1115
+ });
1116
+ return 0;
1058
1117
  }
1059
1118
  preparePercentageScaling() {
1060
- var _a;
1061
- if (this.pixelPerUnitGroupMap.has(this.percentageScaling)) {
1062
- return this.pixelPerUnitGroupMap.get(this.percentageScaling);
1063
- }
1064
- if (((_a = this.percentageScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
1119
+ const resolved = resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
1120
+ if (resolved.kind === "value") {
1121
+ this.errors.remove("AUTO_percentageScaling");
1122
+ this.autoPctWarningActive = false;
1123
+ this.lastReportedPpPerEm = undefined;
1124
+ // Inner ibcs-table expects em per percentage point.
1125
+ return 1 / resolved.value;
1126
+ }
1127
+ if (resolved.kind === "auto") {
1128
+ this.errors.remove("AUTO_percentageScaling");
1129
+ this.autoPctWarningActive = false;
1130
+ this.lastReportedPpPerEm = undefined;
1065
1131
  return 0;
1066
1132
  }
1067
- return Number(this.percentageScaling);
1133
+ this.autoPctWarningActive = true;
1134
+ this.errors.addOrReplace({
1135
+ id: "AUTO_percentageScaling",
1136
+ type: "warning",
1137
+ message: `percentage-scaling: invalid value "${resolved.raw}" — auto-fitting to the pin area.`,
1138
+ });
1139
+ return 0;
1068
1140
  }
1069
1141
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1070
1142
  getDataStructure() {
@@ -1127,7 +1199,7 @@ export class Table {
1127
1199
  render() {
1128
1200
  const fontStyles = this.getFontStyles();
1129
1201
  const effectiveFactor = this.getEffectiveScaleFactor();
1130
- return (h(Host, { key: '71fe0e81888c25970edcaab0803cbdbd3b73d1fd', style: fontStyles }, h("div", { key: '5afa87ac3a8b4d5864bb34acb8a4e84de12261ea' }, h("ibcs-table", { key: '8a276ca87e342f8c3b3aac76c9915681c4b2a005', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
1202
+ return (h(Host, { key: '7960f554ac93c0fb6a09cf47f886827fff1aea84', style: fontStyles }, h("div", { key: 'e9f328144ab89bbde8c47111f7ce7de7a6c882db' }, h("ibcs-table", { key: 'a06695fad28dc30967784006c151abd47d2efd77', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
1131
1203
  }
1132
1204
  static get is() { return "bn-table"; }
1133
1205
  static get encapsulation() { return "shadow"; }
@@ -1332,7 +1404,7 @@ export class Table {
1332
1404
  "optional": false,
1333
1405
  "docs": {
1334
1406
  "tags": [],
1335
- "text": "Set width of bar chart columns. Controls the max bar/pin width in pixels.\n<br /><br />\nvalues:<br />\n``` w5 // w10 // w15 // w20 // w25 // w30 // w40 // w60 // w80 // w100 ```"
1407
+ "text": "Set the total width of bar chart columns, in em of the table font \u2014 the same\nunit and vocabulary as ```categoryWidth```, so ```bar-column-width=\"w15\"```\nrenders exactly as wide as ```category-width=\"w15\"```. The bar/pin drawing\narea is that width minus the value-label gutters.\n<br /><br />\nvalues:<br />\n``` w5 // w10 // w15 // w20 // w25 // w30 // w40 // w60 // w80 // w100 ```"
1336
1408
  },
1337
1409
  "getter": false,
1338
1410
  "setter": false,
@@ -1353,18 +1425,18 @@ export class Table {
1353
1425
  "docs": {
1354
1426
  "tags": [{
1355
1427
  "name": "example",
1356
- "text": "unit-scaling=\"0.01\""
1428
+ "text": "unit-scaling=\"1M\""
1357
1429
  }, {
1358
1430
  "name": "example",
1359
1431
  "text": "unit-scaling=\"revenue-scale\""
1360
1432
  }],
1361
- "text": "Pixels per unit for absolute variance bar charts (\u0394PY).\nControls bar width: barWidth = value \u00D7 unitScaling.\nBars exceeding barColumnWidth are shown with an arrow indicator.\n<br /><br />\nAccepts a number, `\"auto\"`, or a `<bn-scaling-group>` name for synchronized scaling.\n<br /><br />\nDefault: 0.01"
1433
+ "text": "Data units displayed per 1 em of bar length for absolute variance bar\ncharts (\u0394PY) \u2014 map-scale semantics: a larger value means smaller bars.\nBars exceeding barColumnWidth are shown with an arrow indicator.\n\n| Value | Behavior |\n|------------------|----------------------------------------------------------------|\n| `\"auto\"` | Auto-fit the largest bar to the bar column width |\n| `\"250000\"`, `\"1M\"` | Units per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |\n| invalid / unknown | Auto-fit + `AUTO_unitScaling` warning |\n\nDefault: `\"100\"` (1 em of bar represents 100 units)"
1362
1434
  },
1363
1435
  "getter": false,
1364
1436
  "setter": false,
1365
1437
  "reflect": false,
1366
1438
  "attribute": "unit-scaling",
1367
- "defaultValue": "0.01"
1439
+ "defaultValue": "\"100\""
1368
1440
  },
1369
1441
  "percentageScaling": {
1370
1442
  "type": "any",
@@ -1379,18 +1451,18 @@ export class Table {
1379
1451
  "docs": {
1380
1452
  "tags": [{
1381
1453
  "name": "example",
1382
- "text": "percentage-scaling=\"0.5\""
1454
+ "text": "percentage-scaling=\"10\""
1383
1455
  }, {
1384
1456
  "name": "example",
1385
1457
  "text": "percentage-scaling=\"pct-scale\""
1386
1458
  }],
1387
- "text": "Scaling for relative variance pin charts (\u0394PY%).\n<br /><br />\nAccepts a number, `\"auto\"`, or a `<bn-scaling-group>` name for synchronized scaling.\n<br /><br />\nExample: 0.5 means 100% = 50 pixels width.\n<br /><br />\nDefault: 0.5"
1459
+ "text": "Percentage points displayed per 1 em of pin length for relative variance\npin charts (\u0394PY%) \u2014 a larger value means shorter pins.\n\n| Value | Behavior |\n|------------------|----------------------------------------------------------------|\n| `\"auto\"` | Auto-fit the largest pin to the pin area |\n| `\"10\"`, `\"2.5\"` | Percentage points per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |\n| invalid / unknown | Auto-fit + `AUTO_percentageScaling` warning |\n\nDefault: `\"2\"` (a +2 % variance pin is 1 em long)"
1388
1460
  },
1389
1461
  "getter": false,
1390
1462
  "setter": false,
1391
1463
  "reflect": false,
1392
1464
  "attribute": "percentage-scaling",
1393
- "defaultValue": "0.5"
1465
+ "defaultValue": "\"2\""
1394
1466
  },
1395
1467
  "dataFormat": {
1396
1468
  "type": "string",
@@ -1624,7 +1696,7 @@ export class Table {
1624
1696
  "optional": false,
1625
1697
  "docs": {
1626
1698
  "tags": [],
1627
- "text": "Sets the SiPrefix of the Mesaurements and converts the\noriginal value.\n<br /><br />\nvalues: <br />\n```_ // k // M // G // T // P // E // Z // Y // m // \u03BC // n // p // P // f // a // z // y // GREATEST // LEAST```\n<br /><br />\nSiPrefix overview:\n``` \"Y\": 1E+24,```<br />\n``` \"Z\": 1E+21,```<br />\n``` \"E\": 1E+18,```<br />\n``` \"P\": 1E+15,```<br />\n``` \"T\": 1E+12,```<br />\n``` \"G\": 1000000000,```<br />\n``` \"M\": 1000000,```<br />\n``` \"k\": 1000,```<br />\n<br />\n``` \"m\": 0.001,```<br />\n``` \"\u03BC\": 0.000001,```<br />\n``` \"n\": 0.000000001,```<br />\n``` \"p\": 0.000000000001,```<br />\n``` \"f\": 0.000000000000001,```<br />\n``` \"a\": 0.000000000000000001,```<br />\n``` \"z\": 0.000000000000000000001,```<br />\n``` \"y\": 0.000000000000000000000001,```<br />\n<br /><br />\nSpecial modes:\n```GREATEST``` seaches for the bigest (farest to zero) Value in the dataset and sets this value to SiPrefix<br />\n```LEAST``` searches for smallest (closest to zero) Value in the dataset and sets this value to SiPrefix<br />\n<br /><br />\n```_``` is the value for no SiPrefix the value is displayed as in the dataset stored."
1699
+ "text": "Sets the SiPrefix of the Mesaurements and converts the\noriginal value.\n<br /><br />\nvalues: <br />\n```_ // k // M // G // T // P // E // Z // Y // m // my (\u03BC) // n // p // f // a // z // y // GREATEST // LEAST```\n<br /><br />\nSiPrefix overview:\n``` \"Y\": 1E+24,```<br />\n``` \"Z\": 1E+21,```<br />\n``` \"E\": 1E+18,```<br />\n``` \"P\": 1E+15,```<br />\n``` \"T\": 1E+12,```<br />\n``` \"G\": 1000000000,```<br />\n``` \"M\": 1000000,```<br />\n``` \"k\": 1000,```<br />\n<br />\n``` \"m\": 0.001,```<br />\n``` \"my\" (\u03BC): 0.000001,```<br />\n``` \"n\": 0.000000001,```<br />\n``` \"p\": 0.000000000001,```<br />\n``` \"f\": 0.000000000000001,```<br />\n``` \"a\": 0.000000000000000001,```<br />\n``` \"z\": 0.000000000000000000001,```<br />\n``` \"y\": 0.000000000000000000000001,```<br />\n<br /><br />\nSpecial modes:\n```GREATEST``` seaches for the bigest (farest to zero) Value in the dataset and sets this value to SiPrefix<br />\n```LEAST``` searches for smallest (closest to zero) Value in the dataset and sets this value to SiPrefix<br />\n<br /><br />\n```_``` is the value for no SiPrefix the value is displayed as in the dataset stored."
1628
1700
  },
1629
1701
  "getter": false,
1630
1702
  "setter": false,
@@ -1684,7 +1756,7 @@ export class Table {
1684
1756
  "optional": false,
1685
1757
  "docs": {
1686
1758
  "tags": [],
1687
- "text": "Set width of category column. <br />\nIf INF is selected the columns scaling to the min space they need\nseperatly.\n<br /><br />\nvalues:<br />\n``` w5 // w10 // w15 // w20 // w25 // w50 // inf ```"
1759
+ "text": "Set width of category column, in em of the table font. <br />\nIf INF is selected the columns scaling to the min space they need\nseperatly.\n<br /><br />\nThe column is fixed at this width; a category label too long to fit is\ntruncated with an ellipsis.\n<br /><br />\nvalues:<br />\n``` w5 // w10 // w15 // w20 // w25 // w50 // inf ```"
1688
1760
  },
1689
1761
  "getter": false,
1690
1762
  "setter": false,
@@ -12,6 +12,7 @@ import { CellBarChart } from "./utils/elements/CellBarChart";
12
12
  import { WaterfallBar } from "./utils/elements/WaterfallBar";
13
13
  import withComponentStyle from "../../utils/withComponentStyle";
14
14
  import { getStores } from "../../context/context-protocol";
15
+ import { absoluteBarGeometry, BAR_LABEL_FONT_RATIO, relativePinGeometry } from "./utils/helper/barColumnGeometry";
15
16
  /**
16
17
  * Internal rendering engine for `bn-table`.
17
18
  *
@@ -63,6 +64,10 @@ export class IbcsTable {
63
64
  this.filter = "";
64
65
  this.barColumns = [];
65
66
  this.interval = "none";
67
+ /**
68
+ * Total width of a bar chart column, in em of the table font — the same unit
69
+ * `categoryWidth` uses, so the two render at the same width for the same value.
70
+ */
66
71
  this.barColumnMaxWidth = 30;
67
72
  this.unitScaling = 0.01;
68
73
  this.percentageScaling = 0.5;
@@ -81,7 +86,7 @@ export class IbcsTable {
81
86
  }
82
87
  return (h("table", null, h("thead", null, this.table.getHeader().map((row) => (h("tr", { class: row.cssStyle }, row.getCells().map((cell) => (h("th", { colSpan: cell.colSpan, class: cell.cssStyle }, cell.getAsHeaderList().map((line, i, arr) => (h("span", null, i === arr.length - 1 ? (h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (h("span", null, line, cell.drawPrefix(), h("br", null))))))))))))), h("tbody", null, this.table.getBody().map((row) => (h("tr", { class: row.cssStyle }, row === null || row === void 0 ? void 0 : row.getCells().map((cell) => (h("td", { colSpan: cell.colSpan, class: cell.type ? `${cell.cssStyle} ${cell.type}` : cell.cssStyle }, cell.prefix != null ? (h("span", { class: cell.cssStyle + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
83
88
  cell.columnStats &&
84
- (cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, maxBarWidth: this.barColumnMaxWidth, styles: this.barChartStyles, waterfall: cell.waterfall })) : (h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, maxBarWidth: this.barColumnMaxWidth, styles: this.barChartStyles }))) : (cell.draw(this.componentDataFormatDigits)))))))))));
89
+ (cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles, waterfall: cell.waterfall })) : (h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles }))) : (cell.draw(this.componentDataFormatDigits)))))))))));
85
90
  };
86
91
  return h(Host, null, helper());
87
92
  }
@@ -135,8 +140,19 @@ export class IbcsTable {
135
140
  * Scenario styles (ac, pp, fc, pl) use barStyles for IBCS-compliant grayscale coloring.
136
141
  */
137
142
  prepareBarChartStyles() {
143
+ var _a;
144
+ const autoUnit = !(this.unitScaling > 0);
145
+ const autoPercent = !(this.percentageScaling > 0);
146
+ const resolvedUnit = autoUnit ? this.autoUnitScaling() : this.unitScaling;
147
+ const resolvedPercent = autoPercent ? this.autoPercentageScaling() : this.percentageScaling;
148
+ if (autoUnit || autoPercent) {
149
+ (_a = this.reportAutoScaling) === null || _a === void 0 ? void 0 : _a.call(this, {
150
+ unit: autoUnit ? resolvedUnit : undefined,
151
+ percentage: autoPercent ? resolvedPercent : undefined,
152
+ });
153
+ }
138
154
  return this.componentStyle(($) => {
139
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
155
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
140
156
  const varianceStyles = (_a = $["bn-chart-time"]) === null || _a === void 0 ? void 0 : _a["varianceStyles"];
141
157
  const barStyles = (_b = $["bn-chart-time"]) === null || _b === void 0 ? void 0 : _b["barStyles"];
142
158
  // Default variance styles with fillpattern
@@ -189,26 +205,32 @@ export class IbcsTable {
189
205
  },
190
206
  /* eslint-enable @typescript-eslint/no-explicit-any */
191
207
  fontColor: ((_z = $["global"]) === null || _z === void 0 ? void 0 : _z["fontColor"]) || "#000000",
192
- fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) * 0.85 * this.scaleFactor,
193
- fontFamily: ((_1 = $["global"]) === null || _1 === void 0 ? void 0 : _1["fontFamily"]) || "'Noto Sans', sans-serif",
194
- unitScaling: this.unitScaling > 0 ? this.unitScaling : this.autoUnitScaling(),
195
- percentageScaling: this.percentageScaling > 0 ? this.percentageScaling : this.autoPercentageScaling(),
208
+ fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) * BAR_LABEL_FONT_RATIO * this.scaleFactor,
209
+ emPx: (((_1 = $["global"]) === null || _1 === void 0 ? void 0 : _1["fontSizePx"]) || 13.3333) * this.scaleFactor,
210
+ fontFamily: ((_2 = $["global"]) === null || _2 === void 0 ? void 0 : _2["fontFamily"]) || "'Noto Sans', sans-serif",
211
+ unitScaling: resolvedUnit,
212
+ percentageScaling: resolvedPercent,
196
213
  scaleFactor: this.scaleFactor,
197
214
  };
198
215
  });
199
216
  }
217
+ /** The table's true em in px — the unit `.category-wN` and the bar columns share. */
218
+ emPx() {
219
+ return this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; }) * this.scaleFactor;
220
+ }
200
221
  /**
201
222
  * Auto-calculate unitScaling so the largest absolute variance bar
202
- * fills ~80% of the bar column width.
223
+ * fills ~80% of its side of the bar area, without tripping the overdrive break.
203
224
  */
204
225
  autoUnitScaling() {
205
- const fs = this.componentStyle(($) => { var _a; return (((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333) * 0.85 * this.scaleFactor; });
206
- const maxBarWidthPx = this.barColumnMaxWidth * fs;
207
- const targetWidth = maxBarWidthPx * 0.8;
208
- const absMax = this.getMaxAbsValue();
226
+ const emPx = this.emPx();
227
+ const fs = emPx * BAR_LABEL_FONT_RATIO;
228
+ const { absMax, hasNeg, hasPos } = this.getAbsBarColumnStats();
209
229
  if (absMax <= 0 || fs <= 0) {
210
230
  return 0.01;
211
231
  }
232
+ const { maxBarWidth, cutWidth } = absoluteBarGeometry(this.barColumnMaxWidth, emPx, hasNeg, hasPos);
233
+ const targetWidth = Math.min(maxBarWidth * 0.8, cutWidth);
212
234
  return targetWidth / (absMax * fs);
213
235
  }
214
236
  /**
@@ -216,52 +238,47 @@ export class IbcsTable {
216
238
  * fills ~80% of the pin area.
217
239
  */
218
240
  autoPercentageScaling() {
219
- const fs = this.componentStyle(($) => { var _a; return (((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333) * 0.85 * this.scaleFactor; });
220
- const maxPinLength = Math.round(this.barColumnMaxWidth * 0.67 * fs);
221
- const targetLength = maxPinLength * 0.8;
222
- const maxPct = this.getMaxRelativeValue();
241
+ const emPx = this.emPx();
242
+ const fs = emPx * BAR_LABEL_FONT_RATIO;
243
+ const { absMax: maxPct, hasNeg, hasPos } = this.getRelativeBarColumnStats();
223
244
  if (maxPct <= 0 || fs <= 0) {
224
245
  return 0.5;
225
246
  }
226
- return targetLength / (maxPct * fs);
247
+ const { maxPinLength } = relativePinGeometry(this.barColumnMaxWidth, emPx, hasNeg, hasPos);
248
+ return (maxPinLength * 0.8) / (maxPct * fs);
227
249
  }
228
250
  /**
229
- * Find the maximum absolute value across all absolute variance columns (d_*) in the table body.
251
+ * Maximum value and sign coverage across all absolute variance columns (d_*) in the table body.
252
+ * Sign coverage decides how much of the column the bar area gets (see barColumnGeometry.ts);
253
+ * OR-ing it across columns keeps the single shared scaling inside the narrowest bar area.
230
254
  */
231
- getMaxAbsValue() {
232
- if (!this.table)
233
- return 0;
234
- let max = 0;
235
- for (const row of this.table.getBody()) {
236
- if (row.type === TableRowType.SUM)
237
- continue;
238
- for (const cell of row.getCells()) {
239
- // waterfall cells scale independently and must not skew variance auto-scaling
240
- if (cell.isBarChart && cell.columnStats && !cell.key.startsWith("dr") && !cell.waterfall) {
241
- max = Math.max(max, cell.columnStats.absMax);
242
- }
243
- }
244
- }
245
- return max;
255
+ getAbsBarColumnStats() {
256
+ // waterfall cells scale independently and must not skew variance auto-scaling
257
+ return this.collectBarColumnStats((cell) => !cell.key.startsWith("dr") && !cell.waterfall, 1);
246
258
  }
247
259
  /**
248
- * Find the maximum percentage value across all relative variance columns (dr_*) in the table body.
249
- * Values are stored as decimals (e.g. 0.2 = 20%), returned as percentage (20).
260
+ * Same for the relative variance columns (dr_*). Values are stored as decimals
261
+ * (e.g. 0.2 = 20%), returned as percentage (20).
250
262
  */
251
- getMaxRelativeValue() {
263
+ getRelativeBarColumnStats() {
264
+ return this.collectBarColumnStats((cell) => cell.key.startsWith("dr"), 100);
265
+ }
266
+ collectBarColumnStats(accept, valueFactor) {
267
+ const stats = { absMax: 0, hasNeg: false, hasPos: false };
252
268
  if (!this.table)
253
- return 0;
254
- let max = 0;
269
+ return stats;
255
270
  for (const row of this.table.getBody()) {
256
271
  if (row.type === TableRowType.SUM)
257
272
  continue;
258
273
  for (const cell of row.getCells()) {
259
- if (cell.isBarChart && cell.columnStats && cell.key.startsWith("dr")) {
260
- max = Math.max(max, cell.columnStats.absMax * 100);
261
- }
274
+ if (!cell.isBarChart || !cell.columnStats || !accept(cell))
275
+ continue;
276
+ stats.absMax = Math.max(stats.absMax, cell.columnStats.absMax * valueFactor);
277
+ stats.hasNeg = stats.hasNeg || cell.columnStats.min < 0;
278
+ stats.hasPos = stats.hasPos || cell.columnStats.max > 0;
262
279
  }
263
280
  }
264
- return max;
281
+ return stats;
265
282
  }
266
283
  static get is() { return "ibcs-table"; }
267
284
  static get encapsulation() { return "shadow"; }
@@ -898,7 +915,7 @@ export class IbcsTable {
898
915
  "optional": false,
899
916
  "docs": {
900
917
  "tags": [],
901
- "text": ""
918
+ "text": "Total width of a bar chart column, in em of the table font \u2014 the same unit\n`categoryWidth` uses, so the two render at the same width for the same value."
902
919
  },
903
920
  "getter": false,
904
921
  "setter": false,
@@ -946,6 +963,30 @@ export class IbcsTable {
946
963
  "attribute": "percentage-scaling",
947
964
  "defaultValue": "0.5"
948
965
  },
966
+ "reportAutoScaling": {
967
+ "type": "unknown",
968
+ "mutable": false,
969
+ "complexType": {
970
+ "original": "(report: AutoScalingReport) => void",
971
+ "resolved": "(report: AutoScalingReport) => void",
972
+ "references": {
973
+ "AutoScalingReport": {
974
+ "location": "import",
975
+ "path": "../../utils/scaling",
976
+ "id": "src/utils/scaling.ts::AutoScalingReport",
977
+ "referenceLocation": "AutoScalingReport"
978
+ }
979
+ }
980
+ },
981
+ "required": false,
982
+ "optional": true,
983
+ "docs": {
984
+ "tags": [],
985
+ "text": "Internal wrapper channel: called with the auto-fitted scaling values\n(em per unit / em per percentage point) whenever one of them was\nauto-resolved, so the outer `bn-table` can surface them in its AUTO_*\nwarnings. Not for end users."
986
+ },
987
+ "getter": false,
988
+ "setter": false
989
+ },
949
990
  "scaleFactor": {
950
991
  "type": "number",
951
992
  "mutable": false,