@bino-bi/bn-template-engine 1.0.0-next.38 → 1.0.0-next.40

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 (105) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-9a61f59d.entry.js → p-8b28c9bd.entry.js} +1 -1
  3. package/dist/bn-template-engine/{p-DyupX-Z-.js → p-BjozxTTW.js} +1 -1
  4. package/dist/bn-template-engine/p-EcC0qLtU.js +1 -0
  5. package/dist/bn-template-engine/{p-eea538f1.entry.js → p-a4b76176.entry.js} +1 -1
  6. package/dist/bn-template-engine/p-aa0fd797.entry.js +1 -0
  7. package/dist/bn-template-engine/{p-93b8387f.entry.js → p-ce764078.entry.js} +1 -1
  8. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +1067 -515
  9. package/dist/cjs/bn-grid.cjs.entry.js +1 -1
  10. package/dist/cjs/bn-image.cjs.entry.js +1 -1
  11. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  12. package/dist/cjs/bn-text.cjs.entry.js +2 -2
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/cjs/{withStyled-DfE0aW7D.js → withStyled-BZb6snOx.js} +74 -0
  15. package/dist/cjs/{withTranslation-0gkn9xoC.js → withTranslation-FxXGUB3H.js} +1 -1
  16. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +4 -1
  17. package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +3 -1
  18. package/dist/collection/components/bn-chart-time/utils/elements/Label.js +3 -1
  19. package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.css +22 -1
  20. package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +192 -12
  21. package/dist/collection/components/bn-table/bn-table.js +222 -8
  22. package/dist/collection/components/bn-table/utils/Table.js +33 -2
  23. package/dist/collection/components/bn-table/utils/elements/Cell.js +10 -1
  24. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +25 -10
  25. package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +50 -12
  26. package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +59 -21
  27. package/dist/collection/components/bn-table/utils/helper/DataQuery.js +63 -2
  28. package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +30 -6
  29. package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +123 -11
  30. package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +57 -9
  31. package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +21 -1
  32. package/dist/collection/components/bn-table/utils/model/index.js +6 -0
  33. package/dist/collection/utils/layoutState/baseline.js +6 -5
  34. package/dist/collection/utils/validate.js +4 -0
  35. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  36. package/dist/components/bn-chart-bubble.js +1 -1
  37. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  38. package/dist/components/bn-chart-bullet.js +1 -1
  39. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  40. package/dist/components/bn-chart-scatter.js +1 -1
  41. package/dist/components/bn-chart-structure-renderer.js +1 -1
  42. package/dist/components/bn-chart-structure.js +1 -1
  43. package/dist/components/bn-chart-time-renderer.js +1 -1
  44. package/dist/components/bn-chart-time.js +1 -1
  45. package/dist/components/bn-grid.js +1 -1
  46. package/dist/components/bn-image.js +1 -1
  47. package/dist/components/bn-layout-card.js +1 -1
  48. package/dist/components/bn-layout-page.js +1 -1
  49. package/dist/components/bn-page.js +1 -1
  50. package/dist/components/bn-table-renderer.js +1 -1
  51. package/dist/components/bn-table.js +1 -1
  52. package/dist/components/bn-text.js +1 -1
  53. package/dist/components/bn-title.js +1 -1
  54. package/dist/components/bn-tree.js +1 -1
  55. package/dist/components/p-1B_s8oPY.js +1 -0
  56. package/dist/components/{p-BqUB56k1.js → p-B4L069XF.js} +1 -1
  57. package/dist/components/p-BC4MwlnX.js +1 -0
  58. package/dist/components/p-BZXiWkDS.js +1 -0
  59. package/dist/components/p-BiSytXUy.js +1 -0
  60. package/dist/components/p-Bn7J1pgl.js +1 -0
  61. package/dist/components/{p-BmOWXYHF.js → p-CEf5X8MZ.js} +1 -1
  62. package/dist/components/{p-BhEdmPjm.js → p-CUSAlS2o.js} +1 -1
  63. package/dist/components/p-ChaSU4fh.js +1 -0
  64. package/dist/components/p-CvEdUq8i.js +1 -0
  65. package/dist/components/{p-OquycEMA.js → p-D40Am1Ap.js} +1 -1
  66. package/dist/components/{p-CQVAHG6w.js → p-DM4Up10X.js} +1 -1
  67. package/dist/components/{p-Bo_R7f_T.js → p-DwuXVo2h.js} +1 -1
  68. package/dist/components/{p-t4xPltK2.js → p-XFZYX7DZ.js} +1 -1
  69. package/dist/components/{p-DTmqMQpw.js → p-Y9bth2Y_.js} +1 -1
  70. package/dist/components/{p-C_6KHDYv.js → p-chnyMHJT.js} +1 -1
  71. package/dist/components/{p-BU_53KVT.js → p-xIWChKGS.js} +1 -1
  72. package/dist/esm/bn-annotation-layer_30.entry.js +1037 -485
  73. package/dist/esm/bn-grid.entry.js +1 -1
  74. package/dist/esm/bn-image.entry.js +1 -1
  75. package/dist/esm/bn-template-engine.js +1 -1
  76. package/dist/esm/bn-text.entry.js +2 -2
  77. package/dist/esm/loader.js +1 -1
  78. package/dist/esm/{withStyled-CIoJ86RM.js → withStyled-CzzXg64f.js} +77 -4
  79. package/dist/esm/{withTranslation-BX9T3dfm.js → withTranslation-Daq2JXkv.js} +1 -1
  80. package/dist/types/components/bn-table/bn-table-renderer/bn-table-renderer.d.ts +22 -1
  81. package/dist/types/components/bn-table/bn-table.d.ts +72 -1
  82. package/dist/types/components/bn-table/utils/Table.d.ts +11 -1
  83. package/dist/types/components/bn-table/utils/elements/Cell.d.ts +3 -0
  84. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +26 -0
  85. package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +22 -2
  86. package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +7 -4
  87. package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +13 -0
  88. package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +7 -0
  89. package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +30 -2
  90. package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +24 -4
  91. package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +9 -1
  92. package/dist/types/components/bn-table/utils/model/index.d.ts +5 -0
  93. package/dist/types/components.d.ts +66 -6
  94. package/dist/types/utils/layoutState/baseline.d.ts +4 -2
  95. package/dist/types/utils/validate.d.ts +1 -0
  96. package/package.json +1 -1
  97. package/dist/bn-template-engine/p-BVU4bIsi.js +0 -1
  98. package/dist/bn-template-engine/p-e15ccc4a.entry.js +0 -1
  99. package/dist/components/p--HIZm_2v.js +0 -1
  100. package/dist/components/p-C-KX1_tw.js +0 -1
  101. package/dist/components/p-DCPLGEs_.js +0 -1
  102. package/dist/components/p-DT04Cka0.js +0 -1
  103. package/dist/components/p-Dm6EAaJ9.js +0 -1
  104. package/dist/components/p-sar8m7th.js +0 -1
  105. package/dist/components/p-tkB96Ena.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import { forceUpdate, h, Host, writeTask } from "@stencil/core";
2
2
  import { hasInlineJs } from "../../context/scopedDb";
3
- import { isBlankInput, isTableBarColumnWidth, isTableCategoryWidth, isValidDataFormat, isValidDateFormat, isValidDirection, isValidInteger, isValidMeasureScale, isValidMeasureType, isValidTableType, validateAttributesJsonStr, validateBarColumnsList, validateColumnThereOfJsonStr, validateTableOrderList, validatePartOfJsonStr, validateScenarioList, validateThereOfJsonStr, validateVariancesList, } from "../../utils/validate";
3
+ import { isBlankInput, isTableBarColumnWidth, isTableCategoryWidth, isValidDataFormat, isValidDateFormat, isValidDirection, isValidInteger, isValidMeasureScale, isValidMeasureType, isValidTableType, isValidThereofPosition, validateAttributesJsonStr, validateBarColumnsList, validateColumnThereOfJsonStr, validateTableOrderList, validatePartOfJsonStr, validateScenarioList, validateThereOfJsonStr, validateVariancesList, } from "../../utils/validate";
4
4
  import withDataset from "../../utils/withDataset";
5
5
  import withComponentStatus from "../../utils/withComponentStatus";
6
6
  import withScalingGroup from "../../utils/withScalingGroup";
@@ -16,8 +16,8 @@ import { getParentDimensions } from "../../utils/parentDimensions";
16
16
  import { formatScalingValue, parseScaling, resolveScalingValue } from "../../utils/scaling";
17
17
  import { observeParentResize } from "../../utils/layoutObserver";
18
18
  import { BAR_COLUMN_WIDTH_EM, DataFormat, I18nMode, MeasureType, TableBarColumnWidth, TableCategoryWidth, } from "../../utils/constants";
19
- import { TableType } from "./utils/model";
20
- import { INTERVAL_NONE, INTERVAL_SETNAME } from "./utils/helper/IntervalColumns";
19
+ import { TableType, ThereofPosition } from "./utils/model";
20
+ import { coerceSetnameIndex, INTERVAL_NONE, INTERVAL_SETNAME } from "./utils/helper/IntervalColumns";
21
21
  import { parseTableAttributeExpression } from "./utils/model/TableAttribute";
22
22
  import { normalizeOrderToken, OrderDirection } from "../../utils/model/Order";
23
23
  import { LAYOUT_STATE_VERSION, measure, originsFor, readDiagnostics, readTableBaseline, resolveStandaloneId, } from "../../utils/layoutState";
@@ -61,6 +61,8 @@ export class Table {
61
61
  this.appliedScaleFactor = 1;
62
62
  /** True when the active dataset contains rows with a blank `setname` (relevant for `interval='setname'`). */
63
63
  this.hasBlankSetnames = false;
64
+ /** True when the active dataset contains rows with a `setnameIndex` but a blank `setname`. */
65
+ this.hasSetnameIndexWithoutSetname = false;
64
66
  /**
65
67
  * Label of the grand-total row at the bottom of the table. Only rendered for
66
68
  * `type="sum"` and `type="opt"`; the other table types have no total row.
@@ -89,7 +91,7 @@ export class Table {
89
91
  /**
90
92
  * Data units displayed per 1 em of bar length for absolute variance bar
91
93
  * charts (ΔPY) - map-scale semantics: a larger value means smaller bars.
92
- * Bars exceeding barColumnWidth are shown with an arrow indicator.
94
+ * Bars exceeding barColumnWidth are cut with a zigzag break.
93
95
  *
94
96
  * | Value | Behavior |
95
97
  * |------------------|----------------------------------------------------------------|
@@ -157,6 +159,37 @@ export class Table {
157
159
  *
158
160
  */
159
161
  this.showGroupTitle = true;
162
+ /**
163
+ * Turns the sum row of each (row-)group into a running result: the sum of all
164
+ * rows from the first group down to its own group, with the matching absolute
165
+ * and relative variances. Use it for a calculation scheme such as an income
166
+ * statement, where each `rowGroup` ends in a result.
167
+ * <br /><br />
168
+ * Needs `grouped` and a type with group sums (```sum // opt // sumnototal // optnototal```).
169
+ * The total row of ```sum``` and ```opt``` stays and repeats the last running
170
+ * result, so ```sumnototal``` or ```optnototal``` is the usual choice.
171
+ * `partof` shares still refer to the sum of their own group.
172
+ * Not supported together with `columnthereof`: there it has no effect.
173
+ * <br /><br />
174
+ * values: <br />
175
+ * ```true // false```
176
+ */
177
+ this.runningSum = false;
178
+ /**
179
+ * Draws every absolute variance column (d_*) listed in ```barColumns``` as a
180
+ * variance waterfall down the rows instead of single bars from the axis.
181
+ * A row starts where the row above ended; on ```opt``` and ```optnototal```
182
+ * tables a "-" row with a positive variance moves to the left. Sum rows are
183
+ * bars from the axis. Thin lines join the bars. Each row group starts at the
184
+ * axis again, with ```runningSum``` the walk goes on from the sum row.
185
+ * The column scales to fit the whole walk (unit-scaling does not apply).
186
+ * Relative variance columns (dr_*) stay pins.
187
+ * Has no effect together with ```interval``` or ```columnthereof```.
188
+ * <br /><br />
189
+ * values: <br />
190
+ * ```true // false```
191
+ */
192
+ this.varianceWaterfall = false;
160
193
  /**
161
194
  * Set the table type
162
195
  * <br /><br />
@@ -184,6 +217,21 @@ export class Table {
184
217
  * ```[{"rowGroup": "Umsatz", "category": "Applications", "subCategory": "Applications-A"}]```
185
218
  */
186
219
  this.thereof = "[]";
220
+ /**
221
+ * Position of the `thereof` rows relative to their parent row.
222
+ * <br /><br />
223
+ * ```below``` (default) prints them below the parent, small and italic, with
224
+ * the thereof label. ```above``` prints them before the parent in normal
225
+ * size with an indented label, and the parent row looks like a subtotal
226
+ * (bold, with a line above it). The parent keeps its operation sign and its
227
+ * value, so a parent of `-` rows reads like "- Operating expenses".
228
+ * With ```above``` list all subcategories of the parent (`"subCategory": ""`):
229
+ * with only some of them the parent looks like a subtotal that does not add up.
230
+ * <br /><br />
231
+ * values: <br />
232
+ * ```below // above```
233
+ */
234
+ this.thereofPosition = "below";
187
235
  /**
188
236
  * JSON array of part-of objects with the keys `rowGroup` and `category`
189
237
  * (both strings, both required).
@@ -309,8 +357,27 @@ export class Table {
309
357
  * raise a warning and are grouped under `-`. Date values bucket rows by the
310
358
  * `date` column; ```auto``` detects the granularity from the date span.
311
359
  * Cannot be combined with `columnthereof`.
360
+ * <br /><br />
361
+ * Date groups are shown in chronological order. Setname groups are shown in
362
+ * order of first appearance in the dataset. When the rows carry the optional
363
+ * numeric column `setnameIndex`, the setname groups are sorted ascending by
364
+ * it: the smallest index of a setname counts, groups without an index come
365
+ * last.
312
366
  */
313
367
  this.interval = "none";
368
+ /**
369
+ * Number of interval groups that stand left of the category column. Needs
370
+ * an active `interval`.
371
+ * <br /><br />
372
+ * ```0``` (default) keeps the category column first. ```1``` puts one
373
+ * interval group left of it and the rest right. The number of interval
374
+ * groups puts the category column last. A greater value raises a warning
375
+ * and is used as the number of groups.
376
+ * <br /><br />
377
+ * The operation column and the `attributes` columns move with the category
378
+ * column.
379
+ */
380
+ this.categoryIntervalPosition = 0;
314
381
  /**
315
382
  * Stringified JSON object defining custom columns computed from dataset fields.<br />
316
383
  * Keys are column labels, values are aggregate expressions over the rows that
@@ -376,6 +443,13 @@ export class Table {
376
443
  this.dataVersion = this.dataVersion + 1;
377
444
  this.hasBlankSetnames =
378
445
  Array.isArray(data) && data.some((row) => { var _a; return isBlankInput(((_a = row === null || row === void 0 ? void 0 : row.setname) !== null && _a !== void 0 ? _a : row === null || row === void 0 ? void 0 : row.setName)); });
446
+ this.hasSetnameIndexWithoutSetname =
447
+ Array.isArray(data) &&
448
+ data.some((row) => {
449
+ var _a, _b;
450
+ return coerceSetnameIndex((_a = row === null || row === void 0 ? void 0 : row.setnameIndex) !== null && _a !== void 0 ? _a : row === null || row === void 0 ? void 0 : row.setNameIndex) !== undefined &&
451
+ isBlankInput(((_b = row === null || row === void 0 ? void 0 : row.setname) !== null && _b !== void 0 ? _b : row === null || row === void 0 ? void 0 : row.setName));
452
+ });
379
453
  }, (_name, meta) => {
380
454
  this.datasetMeta = meta;
381
455
  });
@@ -546,6 +620,19 @@ export class Table {
546
620
  this.errors.remove(errId);
547
621
  }
548
622
  }
623
+ validateThereofPosition(newValue) {
624
+ const errId = "WARN_thereofPosition";
625
+ if (isBlankInput(newValue) || isValidThereofPosition(newValue)) {
626
+ this.errors.remove(errId);
627
+ }
628
+ else {
629
+ this.errors.addOrReplace({
630
+ id: errId,
631
+ type: "warning",
632
+ message: "thereofPosition: invalid value '" + newValue + "' is not supported.",
633
+ });
634
+ }
635
+ }
549
636
  validatePartOf(newValue) {
550
637
  const errId = "WARN_partof";
551
638
  const invalidElements = validatePartOfJsonStr(newValue);
@@ -688,6 +775,19 @@ export class Table {
688
775
  });
689
776
  }
690
777
  }
778
+ validateCategoryIntervalPosition(newValue) {
779
+ const errId = "WARN_categoryIntervalPosition";
780
+ if (isBlankInput(newValue) || (isValidInteger(newValue) && Number(newValue) >= 0)) {
781
+ this.errors.remove(errId);
782
+ }
783
+ else {
784
+ this.errors.addOrReplace({
785
+ id: errId,
786
+ type: "warning",
787
+ message: "categoryIntervalPosition: invalid value '" + newValue + "' is not supported.",
788
+ });
789
+ }
790
+ }
691
791
  validateTableAttributes(newValue) {
692
792
  const errId = "WARN_attributes";
693
793
  const invalidElements = validateAttributesJsonStr(newValue);
@@ -710,6 +810,7 @@ export class Table {
710
810
  this.validateType(this.type);
711
811
  this.validateLimit(this.limit);
712
812
  this.validateThereOf(this.thereof);
813
+ this.validateThereofPosition(this.thereofPosition);
713
814
  this.validatePartOf(this.partof);
714
815
  this.validateOrderDirection(this.orderDirection);
715
816
  this.validateOrderList(this.order);
@@ -720,6 +821,7 @@ export class Table {
720
821
  this.validateMeasureScale(this.measureScale);
721
822
  this.validateColumnThereOf(this.columnthereof);
722
823
  this.validateInterval(this.interval);
824
+ this.validateCategoryIntervalPosition(this.categoryIntervalPosition);
723
825
  this.validateTableAttributes(this.tableAttributes);
724
826
  this.validateBarColumns(this.barColumns);
725
827
  this.validateBarColumnWidth(this.barColumnWidth);
@@ -852,6 +954,12 @@ export class Table {
852
954
  prepareShowGroupTitle() {
853
955
  return this.showGroupTitle;
854
956
  }
957
+ prepareThereofPosition() {
958
+ var _a;
959
+ return ((_a = this.thereofPosition) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ThereofPosition.ABOVE
960
+ ? ThereofPosition.ABOVE
961
+ : ThereofPosition.BELOW;
962
+ }
855
963
  prepareTableType() {
856
964
  var _a;
857
965
  return TableType[(_a = this.type) === null || _a === void 0 ? void 0 : _a.toUpperCase()];
@@ -1036,6 +1144,7 @@ export class Table {
1036
1144
  const conflictErrId = "WARN_intervalConflict";
1037
1145
  const noDateErrId = "WARN_intervalNoDate";
1038
1146
  const setnameErrId = "WARN_intervalSetname";
1147
+ const setnameIndexErrId = "WARN_intervalSetnameIndex";
1039
1148
  const interval = isBlankInput(this.interval) ? INTERVAL_NONE : this.interval.trim().toLowerCase();
1040
1149
  const isValid = interval === INTERVAL_NONE || interval === INTERVAL_SETNAME || isValidDateFormat(interval);
1041
1150
  // invalid values are already reported by validateInterval
@@ -1043,6 +1152,7 @@ export class Table {
1043
1152
  this.errors.remove(conflictErrId);
1044
1153
  this.errors.remove(noDateErrId);
1045
1154
  this.errors.remove(setnameErrId);
1155
+ this.errors.remove(setnameIndexErrId);
1046
1156
  return INTERVAL_NONE;
1047
1157
  }
1048
1158
  if (this.columnthereof != null && this.columnthereof.trim() !== "") {
@@ -1053,6 +1163,7 @@ export class Table {
1053
1163
  });
1054
1164
  this.errors.remove(noDateErrId);
1055
1165
  this.errors.remove(setnameErrId);
1166
+ this.errors.remove(setnameIndexErrId);
1056
1167
  return INTERVAL_NONE;
1057
1168
  }
1058
1169
  this.errors.remove(conflictErrId);
@@ -1067,10 +1178,21 @@ export class Table {
1067
1178
  else {
1068
1179
  this.errors.remove(setnameErrId);
1069
1180
  }
1181
+ if (this.hasSetnameIndexWithoutSetname) {
1182
+ this.errors.addOrReplace({
1183
+ id: setnameIndexErrId,
1184
+ type: "warning",
1185
+ message: "interval: rows with setnameIndex but blank setname found, setnameIndex needs setname.",
1186
+ });
1187
+ }
1188
+ else {
1189
+ this.errors.remove(setnameIndexErrId);
1190
+ }
1070
1191
  this.errors.remove(noDateErrId);
1071
1192
  return INTERVAL_SETNAME;
1072
1193
  }
1073
1194
  this.errors.remove(setnameErrId);
1195
+ this.errors.remove(setnameIndexErrId);
1074
1196
  if (this.datasetMeta && !((_a = this.datasetMeta.dateRange) === null || _a === void 0 ? void 0 : _a.hasData)) {
1075
1197
  this.errors.addOrReplace({
1076
1198
  id: noDateErrId,
@@ -1082,6 +1204,10 @@ export class Table {
1082
1204
  this.errors.remove(noDateErrId);
1083
1205
  return interval;
1084
1206
  }
1207
+ prepareCategoryIntervalPosition() {
1208
+ const position = Number(this.categoryIntervalPosition);
1209
+ return Number.isInteger(position) && position > 0 ? position : 0;
1210
+ }
1085
1211
  prepareAttributes() {
1086
1212
  if (this.tableAttributes == null || this.tableAttributes.trim() === "") {
1087
1213
  return [];
@@ -1187,6 +1313,7 @@ export class Table {
1187
1313
  const dataSetStructure = {
1188
1314
  ITableDataRow: {
1189
1315
  setName: { type: "string", isOptional: false, description: "" },
1316
+ setNameIndex: { type: "number", isOptional: true, description: "" },
1190
1317
  date: { type: "string", isOptional: false, description: "" },
1191
1318
  operation: { type: "string", isOptional: false, description: "" },
1192
1319
  rowGroup: { type: "string", isOptional: false, description: "" },
@@ -1342,7 +1469,7 @@ export class Table {
1342
1469
  render() {
1343
1470
  const fontStyles = this.getFontStyles();
1344
1471
  const effectiveFactor = this.getEffectiveScaleFactor();
1345
- return (h(Host, { key: '42974a4931f678c35e5c740bf6d630966368fb4b', style: fontStyles }, h("div", { key: '2c8f99a8bd155e2c93e55e9542090d04afe22a31' }, h("bn-table-renderer", { key: 'cae9e83bf297e730f12a8a390cbf279413c40b54', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, errors: this.errors, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
1472
+ return (h(Host, { key: '2af1b7f31952cd0ba32e0a069ce143d3402b4a77', style: fontStyles }, h("div", { key: 'b78ad13abb48a43c1da0aec4727372a482c39701' }, h("bn-table-renderer", { key: 'ab0132a3b57953379f6d8f5f19a18f95a14cc326', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), runningSum: this.runningSum, varianceWaterfall: this.varianceWaterfall, thereof: this.prepareThereOf(), thereofPosition: this.prepareThereofPosition(), 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(), categoryIntervalPosition: this.prepareCategoryIntervalPosition(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, errors: this.errors, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
1346
1473
  }
1347
1474
  static get is() { return "bn-table"; }
1348
1475
  static get encapsulation() { return "shadow"; }
@@ -1611,7 +1738,7 @@ export class Table {
1611
1738
  "name": "example",
1612
1739
  "text": "unit-scaling=\"revenue-scale\""
1613
1740
  }],
1614
- "text": "Data units displayed per 1 em of bar length for absolute variance bar\ncharts (\u0394PY) - 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)"
1741
+ "text": "Data units displayed per 1 em of bar length for absolute variance bar\ncharts (\u0394PY) - map-scale semantics: a larger value means smaller bars.\nBars exceeding barColumnWidth are cut with a zigzag break.\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)"
1615
1742
  },
1616
1743
  "getter": false,
1617
1744
  "setter": false,
@@ -1725,6 +1852,46 @@ export class Table {
1725
1852
  "attribute": "show-group-title",
1726
1853
  "defaultValue": "true"
1727
1854
  },
1855
+ "runningSum": {
1856
+ "type": "boolean",
1857
+ "mutable": false,
1858
+ "complexType": {
1859
+ "original": "boolean",
1860
+ "resolved": "boolean",
1861
+ "references": {}
1862
+ },
1863
+ "required": false,
1864
+ "optional": false,
1865
+ "docs": {
1866
+ "tags": [],
1867
+ "text": "Turns the sum row of each (row-)group into a running result: the sum of all\nrows from the first group down to its own group, with the matching absolute\nand relative variances. Use it for a calculation scheme such as an income\nstatement, where each `rowGroup` ends in a result.\n<br /><br />\nNeeds `grouped` and a type with group sums (```sum // opt // sumnototal // optnototal```).\nThe total row of ```sum``` and ```opt``` stays and repeats the last running\nresult, so ```sumnototal``` or ```optnototal``` is the usual choice.\n`partof` shares still refer to the sum of their own group.\nNot supported together with `columnthereof`: there it has no effect.\n<br /><br />\nvalues: <br />\n```true // false```"
1868
+ },
1869
+ "getter": false,
1870
+ "setter": false,
1871
+ "reflect": false,
1872
+ "attribute": "running-sum",
1873
+ "defaultValue": "false"
1874
+ },
1875
+ "varianceWaterfall": {
1876
+ "type": "boolean",
1877
+ "mutable": false,
1878
+ "complexType": {
1879
+ "original": "boolean",
1880
+ "resolved": "boolean",
1881
+ "references": {}
1882
+ },
1883
+ "required": false,
1884
+ "optional": false,
1885
+ "docs": {
1886
+ "tags": [],
1887
+ "text": "Draws every absolute variance column (d_*) listed in ```barColumns``` as a\nvariance waterfall down the rows instead of single bars from the axis.\nA row starts where the row above ended; on ```opt``` and ```optnototal```\ntables a \"-\" row with a positive variance moves to the left. Sum rows are\nbars from the axis. Thin lines join the bars. Each row group starts at the\naxis again, with ```runningSum``` the walk goes on from the sum row.\nThe column scales to fit the whole walk (unit-scaling does not apply).\nRelative variance columns (dr_*) stay pins.\nHas no effect together with ```interval``` or ```columnthereof```.\n<br /><br />\nvalues: <br />\n```true // false```"
1888
+ },
1889
+ "getter": false,
1890
+ "setter": false,
1891
+ "reflect": false,
1892
+ "attribute": "variance-waterfall",
1893
+ "defaultValue": "false"
1894
+ },
1728
1895
  "type": {
1729
1896
  "type": "string",
1730
1897
  "mutable": false,
@@ -1785,6 +1952,26 @@ export class Table {
1785
1952
  "attribute": "thereof",
1786
1953
  "defaultValue": "\"[]\""
1787
1954
  },
1955
+ "thereofPosition": {
1956
+ "type": "string",
1957
+ "mutable": false,
1958
+ "complexType": {
1959
+ "original": "string",
1960
+ "resolved": "string",
1961
+ "references": {}
1962
+ },
1963
+ "required": false,
1964
+ "optional": false,
1965
+ "docs": {
1966
+ "tags": [],
1967
+ "text": "Position of the `thereof` rows relative to their parent row.\n<br /><br />\n```below``` (default) prints them below the parent, small and italic, with\nthe thereof label. ```above``` prints them before the parent in normal\nsize with an indented label, and the parent row looks like a subtotal\n(bold, with a line above it). The parent keeps its operation sign and its\nvalue, so a parent of `-` rows reads like \"- Operating expenses\".\nWith ```above``` list all subcategories of the parent (`\"subCategory\": \"\"`):\nwith only some of them the parent looks like a subtotal that does not add up.\n<br /><br />\nvalues: <br />\n```below // above```"
1968
+ },
1969
+ "getter": false,
1970
+ "setter": false,
1971
+ "reflect": false,
1972
+ "attribute": "thereof-position",
1973
+ "defaultValue": "\"below\""
1974
+ },
1788
1975
  "partof": {
1789
1976
  "type": "string",
1790
1977
  "mutable": false,
@@ -1977,7 +2164,7 @@ export class Table {
1977
2164
  "optional": false,
1978
2165
  "docs": {
1979
2166
  "tags": [],
1980
- "text": "Repeats the entire scenario/variance column block once per interval group,\nrendered under a spanning header band (e.g. `2023 | 2024 | 2025`, each with\nthe configured columns).\n<br /><br />\nvalues:<br /> ```none // setname // year // quarter // month // week // day // hour // minute // second // millisecond // auto```\n<br /><br />\n```none``` (default) deactivates the feature. ```setname``` groups by the\ndataset's `setname` column (non-date comparison); rows with a blank setname\nraise a warning and are grouped under `-`. Date values bucket rows by the\n`date` column; ```auto``` detects the granularity from the date span.\nCannot be combined with `columnthereof`."
2167
+ "text": "Repeats the entire scenario/variance column block once per interval group,\nrendered under a spanning header band (e.g. `2023 | 2024 | 2025`, each with\nthe configured columns).\n<br /><br />\nvalues:<br /> ```none // setname // year // quarter // month // week // day // hour // minute // second // millisecond // auto```\n<br /><br />\n```none``` (default) deactivates the feature. ```setname``` groups by the\ndataset's `setname` column (non-date comparison); rows with a blank setname\nraise a warning and are grouped under `-`. Date values bucket rows by the\n`date` column; ```auto``` detects the granularity from the date span.\nCannot be combined with `columnthereof`.\n<br /><br />\nDate groups are shown in chronological order. Setname groups are shown in\norder of first appearance in the dataset. When the rows carry the optional\nnumeric column `setnameIndex`, the setname groups are sorted ascending by\nit: the smallest index of a setname counts, groups without an index come\nlast."
1981
2168
  },
1982
2169
  "getter": false,
1983
2170
  "setter": false,
@@ -1985,6 +2172,26 @@ export class Table {
1985
2172
  "attribute": "interval",
1986
2173
  "defaultValue": "\"none\""
1987
2174
  },
2175
+ "categoryIntervalPosition": {
2176
+ "type": "number",
2177
+ "mutable": false,
2178
+ "complexType": {
2179
+ "original": "number",
2180
+ "resolved": "number",
2181
+ "references": {}
2182
+ },
2183
+ "required": false,
2184
+ "optional": false,
2185
+ "docs": {
2186
+ "tags": [],
2187
+ "text": "Number of interval groups that stand left of the category column. Needs\nan active `interval`.\n<br /><br />\n```0``` (default) keeps the category column first. ```1``` puts one\ninterval group left of it and the rest right. The number of interval\ngroups puts the category column last. A greater value raises a warning\nand is used as the number of groups.\n<br /><br />\nThe operation column and the `attributes` columns move with the category\ncolumn."
2188
+ },
2189
+ "getter": false,
2190
+ "setter": false,
2191
+ "reflect": false,
2192
+ "attribute": "category-interval-position",
2193
+ "defaultValue": "0"
2194
+ },
1988
2195
  "tableAttributes": {
1989
2196
  "type": "string",
1990
2197
  "mutable": false,
@@ -2013,7 +2220,8 @@ export class Table {
2013
2220
  "dataVersion": {},
2014
2221
  "datasetMeta": {},
2015
2222
  "appliedScaleFactor": {},
2016
- "hasBlankSetnames": {}
2223
+ "hasBlankSetnames": {},
2224
+ "hasSetnameIndexWithoutSetname": {}
2017
2225
  };
2018
2226
  }
2019
2227
  static get methods() {
@@ -2123,6 +2331,9 @@ export class Table {
2123
2331
  }, {
2124
2332
  "propName": "thereof",
2125
2333
  "methodName": "validateThereOf"
2334
+ }, {
2335
+ "propName": "thereofPosition",
2336
+ "methodName": "validateThereofPosition"
2126
2337
  }, {
2127
2338
  "propName": "partof",
2128
2339
  "methodName": "validatePartOf"
@@ -2153,6 +2364,9 @@ export class Table {
2153
2364
  }, {
2154
2365
  "propName": "interval",
2155
2366
  "methodName": "validateInterval"
2367
+ }, {
2368
+ "propName": "categoryIntervalPosition",
2369
+ "methodName": "validateCategoryIntervalPosition"
2156
2370
  }, {
2157
2371
  "propName": "tableAttributes",
2158
2372
  "methodName": "validateTableAttributes"
@@ -137,7 +137,9 @@ export class Table {
137
137
  update() {
138
138
  this.prepareIntervalBuckets();
139
139
  const normalizedScenarios = this.normalizeScenarios(this.config.scenarios, this.config.categoryThereOf, this.config.sortOrder, this.intervalBuckets);
140
- this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale, this.config.attributes);
140
+ this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale, this.config.attributes,
141
+ // every interval group has one column per scenario
142
+ Math.min(this.categoryIntervalPosition(), this.intervalBuckets.length) * this.config.scenarios.length);
141
143
  this.bodyRows =
142
144
  this.rowCount === 0 || !this.fromExpr
143
145
  ? []
@@ -156,7 +158,10 @@ export class Table {
156
158
  }
157
159
  return this.bodyRows;
158
160
  }
159
- /** Effective column definitions: category/operation + attributes + scenarios × interval buckets. */
161
+ /**
162
+ * Effective column definitions in render order: category/operation + attributes + scenarios × interval buckets.
163
+ * With `categoryIntervalPosition` the first interval buckets come before the category/operation column.
164
+ */
160
165
  getColumns() {
161
166
  if (this.state === FactoryState.DIRTY) {
162
167
  this.update();
@@ -257,6 +262,32 @@ export class Table {
257
262
  const unknown = buckets.find((bucket) => !this.intervalBuckets.some((b) => b.key === bucket));
258
263
  return unknown === undefined ? undefined : `order: setname '${unknown}' not found, the rows are not sorted by it.`;
259
264
  }
265
+ /** The configured `categoryIntervalPosition`; anything but a positive integer counts as 0. */
266
+ categoryIntervalPosition() {
267
+ const position = this.config.categoryIntervalPosition;
268
+ return Number.isInteger(position) && position > 0 ? position : 0;
269
+ }
270
+ /** Warning for a `categoryIntervalPosition` that cannot apply, once the body was built; undefined when it applies. */
271
+ categoryIntervalPositionWarning() {
272
+ const position = this.categoryIntervalPosition();
273
+ if (position <= 0 || this.hasNoData() || this.state !== FactoryState.UP_TO_DATE) {
274
+ return undefined;
275
+ }
276
+ const groups = this.intervalBuckets.length;
277
+ if (groups === 0) {
278
+ return {
279
+ id: "WARN_categoryIntervalPositionNoInterval",
280
+ message: "categoryIntervalPosition: needs an active interval, the value is ignored.",
281
+ };
282
+ }
283
+ if (position > groups) {
284
+ return {
285
+ id: "WARN_categoryIntervalPositionRange",
286
+ message: `categoryIntervalPosition: '${position}' is greater than the number of interval groups, ${groups} is used.`,
287
+ };
288
+ }
289
+ return undefined;
290
+ }
260
291
  /** True once the body was built and the grouped table has rows with a blank rowGroup. */
261
292
  hasBlankRowGroup() {
262
293
  return this.dataSetFactory.hasBlankRowGroup;
@@ -40,7 +40,16 @@ export class Cell {
40
40
  return result;
41
41
  }
42
42
  draw(dataFormatDigits, locale) {
43
- let cellValue = this.value;
43
+ return this.format(this.value, dataFormatDigits, locale);
44
+ }
45
+ /** True when the cell prints a number that is zero at the displayed digits. */
46
+ roundsToZero(dataFormatDigits, locale) {
47
+ return (typeof this.value === "number" &&
48
+ !!this.type &&
49
+ this.draw(dataFormatDigits, locale) === this.format(0, dataFormatDigits, locale));
50
+ }
51
+ format(value, dataFormatDigits, locale) {
52
+ let cellValue = value;
44
53
  if (cellValue === "undefined" || cellValue === undefined || cellValue == null) {
45
54
  return "";
46
55
  }
@@ -26,6 +26,10 @@ export const DEFAULT_STYLES = {
26
26
  export const AXIS_COLOR = "#666666";
27
27
  /** Width of the pin line, in px before scaleFactor. */
28
28
  const PIN_LINE_WIDTH = 3;
29
+ /** Arrow head of a cut pin, in sides of the square pin head: IBCS draws it a bit larger. */
30
+ const PIN_ARROW_RATIO = 1.2;
31
+ /** Padding of the light band under the label on a cut pin, in label font sizes. */
32
+ const PIN_BAND_PAD = 0.2;
29
33
  /**
30
34
  * Creates a unique pattern ID for the SVG defs
31
35
  */
@@ -124,7 +128,7 @@ function getScenarioStyle(scenario, styles) {
124
128
  const type = getScenarioType(scenario);
125
129
  return styles.scenarios[type];
126
130
  }
127
- function getVarianceLook(scenario, styles) {
131
+ export function getVarianceLook(scenario, styles) {
128
132
  if (isScenarioColumn(scenario))
129
133
  return null;
130
134
  const variance = new VarianceScenario(scenario);
@@ -144,7 +148,7 @@ function getVarianceLook(scenario, styles) {
144
148
  * a double line (PL, outlined) or dashed (FC, hatched). Lines only, so the bar stays the
145
149
  * one direct-child rect of the svg.
146
150
  */
147
- const VarianceAxis = ({ x, height, look, styles }) => {
151
+ export const VarianceAxis = ({ x, height, look, styles }) => {
148
152
  const s = styles.scaleFactor;
149
153
  const width = VARIANCE_AXIS_EM * styles.emPx;
150
154
  const { reference, referenceSlot } = look;
@@ -260,11 +264,11 @@ function renderZigzagBreak(breakX, breakGap, yTop, barHeight, s) {
260
264
  * exactly `columnWidthEm` em - see barColumnGeometry.ts.
261
265
  */
262
266
  const AbsoluteVarianceBar = (props) => {
263
- const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, decimalDigits, columnWidthEm = 10, labelWidths, sideMax, styles = DEFAULT_STYLES, } = props;
267
+ const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, decimalDigits, columnWidthEm = 10, labelWidths, sideMax, bold, styles = DEFAULT_STYLES, } = props;
264
268
  const s = styles.scaleFactor;
265
269
  const fs = styles.fontSize;
266
270
  const displayValue = formattedValue || formatValue(value, false, measureScale, locale, 0, true, decimalDigits);
267
- const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, labelWidth(displayValue, fs, styles.fontFamily, false));
271
+ const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, labelWidth(displayValue, fs, styles.fontFamily, false, bold));
268
272
  const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
269
273
  const { neg = Math.max(0, -columnStats.min), pos = Math.max(0, columnStats.max) } = sideMax !== null && sideMax !== void 0 ? sideMax : {};
270
274
  const geometry = absoluteBarGeometry(columnWidthEm, styles.emPx, sides, { neg, pos });
@@ -317,7 +321,8 @@ const AbsoluteVarianceBar = (props) => {
317
321
  * Renders a relative variance pin chart (dr_ prefix).
318
322
  * Line from the axis in the sentiment colour, ending in a square head in the look of the
319
323
  * minuend, with the value label beside the head like an absolute bar label. A pin beyond
320
- * the pin area is cut and ends in an arrow, its label after the arrow tip.
324
+ * the pin area is cut and ends in an arrow. Its label stands on the line behind the arrow
325
+ * head, on a light band, or after the arrow tip when the line is too short for it.
321
326
  *
322
327
  * Layout: [left label area][pin area with axis][right label area], summing to exactly
323
328
  * `columnWidthEm` em - see barColumnGeometry.ts.
@@ -325,13 +330,14 @@ const AbsoluteVarianceBar = (props) => {
325
330
  */
326
331
  const RelativeVariancePin = (props) => {
327
332
  var _a, _b;
328
- const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, percentDigits, percentSign, columnWidthEm = 10, labelWidths, sideMax, styles = DEFAULT_STYLES, } = props;
333
+ const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, percentDigits, percentSign, columnWidthEm = 10, labelWidths, sideMax, bold, styles = DEFAULT_STYLES, } = props;
329
334
  const s = styles.scaleFactor;
330
335
  const fs = styles.fontSize;
331
336
  const headSize = PIN_HEAD_SIZE * s;
332
337
  const pinPx = 100 * styles.percentageScaling * fs;
333
338
  const displayValue = formattedValue || formatValue(value, true, measureScale, locale, percentDigits, percentSign);
334
- const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, labelWidth(displayValue, fs, styles.fontFamily, true));
339
+ const ownWidth = labelWidth(displayValue, fs, styles.fontFamily, true, bold);
340
+ const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, ownWidth);
335
341
  const { neg = Math.max(0, -columnStats.min), pos = Math.max(0, columnStats.max) } = sideMax !== null && sideMax !== void 0 ? sideMax : {};
336
342
  const { totalWidth, negPinLength, posPinLength, axisX, labelGap } = relativePinGeometry(columnWidthEm, styles.emPx, sides, headSize, { neg: neg * pinPx, pos: pos * pinPx });
337
343
  const centerY = height / 2;
@@ -350,9 +356,18 @@ const RelativeVariancePin = (props) => {
350
356
  const headStyle = (_a = look === null || look === void 0 ? void 0 : look.minuend) !== null && _a !== void 0 ? _a : styles.scenarios.ac;
351
357
  // the arrow tip lands on the outer edge of a full-length head, so the label after it stays in the cell
352
358
  const tipX = axisX + direction * (maxPinLength + headSize / 2);
353
- const arrowBaseX = tipX - direction * headSize;
354
- const labelX = (isExtreme ? tipX : pinEndX + direction * (headSize / 2)) + direction * labelGap;
355
- return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, h(PatternDefs, { styles: styles }), look ? (h(VarianceAxis, { x: axisX, height: height, look: look, styles: styles })) : (h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s })), h("line", { x1: axisX, y1: centerY, x2: isExtreme ? arrowBaseX : pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": PIN_LINE_WIDTH * s }), isExtreme ? (h("polygon", { points: `${tipX},${centerY} ${arrowBaseX},${centerY - headSize / 2} ${arrowBaseX},${centerY + headSize / 2}`, fill: barStyle.fill })) : (h("rect", { x: pinEndX - headSize / 2, y: centerY - headSize / 2, width: headSize, height: headSize, fill: headStyle.fillpattern === "outlined" ? "#ffffff" : getBarFill(headStyle, (_b = look === null || look === void 0 ? void 0 : look.minuendSlot) !== null && _b !== void 0 ? _b : "ac"), stroke: headStyle.stroke, "stroke-width": 1 * s })), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": isPositive ? "start" : "end", fill: styles.fontColor, "font-size": fs, "font-style": "italic", "font-family": styles.fontFamily }, displayValue)));
359
+ const arrowSize = PIN_ARROW_RATIO * headSize;
360
+ const arrowBaseX = tipX - direction * arrowSize;
361
+ // the band keeps a pad of full line to the arrow head and to the axis, else the label goes after the tip
362
+ const bandPad = PIN_BAND_PAD * fs;
363
+ const bandWidth = ownWidth + 2 * bandPad;
364
+ const shaftLength = Math.abs(arrowBaseX - axisX) - (VARIANCE_AXIS_EM * styles.emPx) / 2;
365
+ const labelOnShaft = isExtreme && shaftLength >= bandWidth + 2 * bandPad;
366
+ const bandX = arrowBaseX - direction * (bandPad + bandWidth / 2) - bandWidth / 2;
367
+ const labelX = labelOnShaft
368
+ ? bandX + bandWidth / 2
369
+ : (isExtreme ? tipX : pinEndX + direction * (headSize / 2)) + direction * labelGap;
370
+ return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, h(PatternDefs, { styles: styles }), look ? (h(VarianceAxis, { x: axisX, height: height, look: look, styles: styles })) : (h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s })), h("line", { x1: axisX, y1: centerY, x2: isExtreme ? arrowBaseX : pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": PIN_LINE_WIDTH * s }), isExtreme ? (h("polygon", { points: `${tipX},${centerY} ${arrowBaseX},${centerY - arrowSize / 2} ${arrowBaseX},${centerY + arrowSize / 2}`, fill: barStyle.fill })) : (h("rect", { x: pinEndX - headSize / 2, y: centerY - headSize / 2, width: headSize, height: headSize, fill: headStyle.fillpattern === "outlined" ? "#ffffff" : getBarFill(headStyle, (_b = look === null || look === void 0 ? void 0 : look.minuendSlot) !== null && _b !== void 0 ? _b : "ac"), stroke: headStyle.stroke, "stroke-width": 1 * s })), labelOnShaft && (h("rect", { class: "pin-label-band", x: bandX, y: centerY - (PIN_LINE_WIDTH * s) / 2, width: bandWidth, height: PIN_LINE_WIDTH * s, fill: "#ffffff", "fill-opacity": "0.5" })), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": labelOnShaft ? "middle" : isPositive ? "start" : "end", fill: styles.fontColor, "font-size": fs, "font-style": "italic", "font-family": styles.fontFamily }, displayValue)));
356
371
  };
357
372
  /**
358
373
  * CellBarChart - Renders IBCS-compliant variance bar charts.