@bino-bi/bn-template-engine 1.0.0-next.50 → 1.0.0-next.52

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 (110) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-2de524d0.entry.js → p-150bdb68.entry.js} +1 -1
  3. package/dist/bn-template-engine/p-4d99f1bb.entry.js +1 -0
  4. package/dist/bn-template-engine/{p-Bxa4pX1M.js → p-Bvunba5p.js} +1 -1
  5. package/dist/bn-template-engine/p-NxJ6P79y.js +1 -0
  6. package/dist/bn-template-engine/{p-8fc90dc8.entry.js → p-b75a4b52.entry.js} +1 -1
  7. package/dist/bn-template-engine/{p-510d2ee6.entry.js → p-fdf42a77.entry.js} +1 -1
  8. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +1114 -63
  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-pkdctrK9.js → withStyled-BISQLGLe.js} +9 -0
  15. package/dist/cjs/{withTranslation-BIzTNYZM.js → withTranslation-B7T30EVU.js} +1 -1
  16. package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +109 -11
  17. package/dist/collection/components/bn-annotation-layer/utils/marks.js +126 -4
  18. package/dist/collection/components/bn-annotation-layer/utils/matchPoint.js +2 -1
  19. package/dist/collection/components/bn-chart-structure/bn-chart-structure-renderer/bn-chart-structure-renderer.js +133 -0
  20. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +258 -2
  21. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +549 -27
  22. package/dist/collection/components/bn-chart-structure/utils/elements/Bar.js +9 -1
  23. package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +12 -0
  24. package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +6 -0
  25. package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +23 -8
  26. package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +22 -3
  27. package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +23 -0
  28. package/dist/collection/components/bn-context/bn-context.js +68 -1
  29. package/dist/collection/components/bn-layout-card/bn-layout-card.js +62 -2
  30. package/dist/collection/utils/formatter.js +13 -2
  31. package/dist/collection/utils/validate.js +9 -0
  32. package/dist/components/bn-annotation-layer.js +1 -1
  33. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  34. package/dist/components/bn-chart-bubble.js +1 -1
  35. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  36. package/dist/components/bn-chart-bullet.js +1 -1
  37. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  38. package/dist/components/bn-chart-scatter.js +1 -1
  39. package/dist/components/bn-chart-structure-renderer.js +1 -1
  40. package/dist/components/bn-chart-structure.js +1 -1
  41. package/dist/components/bn-chart-time-renderer.js +1 -1
  42. package/dist/components/bn-chart-time.js +1 -1
  43. package/dist/components/bn-context.js +1 -1
  44. package/dist/components/bn-grid.js +1 -1
  45. package/dist/components/bn-image.js +1 -1
  46. package/dist/components/bn-layout-card.js +1 -1
  47. package/dist/components/bn-layout-page.js +1 -1
  48. package/dist/components/bn-page.js +1 -1
  49. package/dist/components/bn-table-renderer.js +1 -1
  50. package/dist/components/bn-table.js +1 -1
  51. package/dist/components/bn-text.js +1 -1
  52. package/dist/components/bn-title-renderer.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-BOwmXBm-.js +1 -0
  56. package/dist/components/p-Bs5V6Ibu.js +1 -0
  57. package/dist/components/{p-CVfmhtEW.js → p-CU9CdEBF.js} +1 -1
  58. package/dist/components/{p-Cc0gaLwp.js → p-CZSp0rSS.js} +1 -1
  59. package/dist/components/p-CcfvGlBq.js +1 -0
  60. package/dist/components/p-CiljAoC5.js +1 -0
  61. package/dist/components/p-D0v9GMIf.js +1 -0
  62. package/dist/components/{p-DBj1Yd3M.js → p-D65TnLS9.js} +1 -1
  63. package/dist/components/p-DKcw-1ot.js +1 -0
  64. package/dist/components/{p-k7heRDPP.js → p-DLmQ_mi7.js} +1 -1
  65. package/dist/components/p-DOKqRsAu.js +1 -0
  66. package/dist/components/p-LHIKI9Dp.js +1 -0
  67. package/dist/components/{p-Blre9f28.js → p-NdDdfez6.js} +1 -1
  68. package/dist/components/p-Zz3fAPcH.js +1 -0
  69. package/dist/components/{p-y12CmIFS.js → p-dSUX43yf.js} +1 -1
  70. package/dist/components/p-iJP2X4dc.js +1 -0
  71. package/dist/components/p-jEqo8YD5.js +1 -0
  72. package/dist/esm/bn-annotation-layer_30.entry.js +1114 -63
  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-B62R20Zx.js → withStyled-CrTxIZ0Q.js} +9 -0
  79. package/dist/esm/{withTranslation-BEseMLQ6.js → withTranslation-BtSJmx1J.js} +1 -1
  80. package/dist/schemas/stack.schema.json +21 -1
  81. package/dist/types/components/bn-annotation-layer/utils/marks.d.ts +53 -0
  82. package/dist/types/components/bn-annotation-layer/utils/matchPoint.d.ts +2 -0
  83. package/dist/types/components/bn-chart-structure/bn-chart-structure-renderer/bn-chart-structure-renderer.d.ts +11 -1
  84. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +49 -0
  85. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +52 -0
  86. package/dist/types/components/bn-chart-structure/utils/elements/Bar.d.ts +2 -0
  87. package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +4 -0
  88. package/dist/types/components/bn-chart-structure/utils/elements/Needle.d.ts +2 -0
  89. package/dist/types/components/bn-chart-structure/utils/elements/StackedBar.d.ts +13 -1
  90. package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +15 -1
  91. package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +23 -0
  92. package/dist/types/components/bn-context/bn-context.d.ts +12 -0
  93. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +12 -0
  94. package/dist/types/components.d.ts +113 -2
  95. package/dist/types/schemas.d.ts +7 -1
  96. package/dist/types/utils/annotations.d.ts +1 -1
  97. package/dist/types/utils/formatter.d.ts +5 -0
  98. package/package.json +1 -1
  99. package/dist/bn-template-engine/p-BFl7OwcC.js +0 -1
  100. package/dist/bn-template-engine/p-c1d679af.entry.js +0 -1
  101. package/dist/components/p-B11cXOLy.js +0 -1
  102. package/dist/components/p-BVNOmHh4.js +0 -1
  103. package/dist/components/p-CHhxQoF9.js +0 -1
  104. package/dist/components/p-CO6bgquz.js +0 -1
  105. package/dist/components/p-CmvpJzLd.js +0 -1
  106. package/dist/components/p-CuUfiEu0.js +0 -1
  107. package/dist/components/p-DHloMyxV.js +0 -1
  108. package/dist/components/p-Dd1QOWDV.js +0 -1
  109. package/dist/components/p-HVN8BNWN.js +0 -1
  110. package/dist/components/p-x0W2_FAX.js +0 -1
@@ -75,6 +75,12 @@ export class Bar {
75
75
  (_a = this.label) === null || _a === void 0 ? void 0 : _a.setToRelativeVarianceLabel();
76
76
  return this;
77
77
  }
78
+ /** Prints the value in bold: the bar of a sum row. */
79
+ emphasize() {
80
+ var _a;
81
+ (_a = this.label) === null || _a === void 0 ? void 0 : _a.setEmphasis(true, false);
82
+ return this;
83
+ }
78
84
  updateLabelGroup(newGroup) {
79
85
  var _a;
80
86
  if (this.isEmpty() || newGroup == null) {
@@ -84,7 +90,7 @@ export class Bar {
84
90
  return this;
85
91
  }
86
92
  draw(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
87
- var _a, _b;
93
+ var _a, _b, _c;
88
94
  if (this.isEmpty() || this.dataPoint.getScenario() == null) {
89
95
  return this;
90
96
  }
@@ -104,6 +110,8 @@ export class Bar {
104
110
  }
105
111
  (_a = this.scenarioGroup) === null || _a === void 0 ? void 0 : _a.attr(dataPointAttributes(this.dataPoint.key));
106
112
  (_b = this.barGroup) === null || _b === void 0 ? void 0 : _b.attr(dataPointAttributes(this.dataPoint.key, "element"));
113
+ if (!this.isVarianceBar)
114
+ (_c = this.barGroup) === null || _c === void 0 ? void 0 : _c.attr("data-bn-value", this.dataPoint.value);
107
115
  if (this.barGroup != null) {
108
116
  if (this.isOverflowing && this.overflowConfig) {
109
117
  this.drawOverdriveBar(fillStyle, strokeStyle);
@@ -32,6 +32,8 @@ export class Label {
32
32
  this.group = null;
33
33
  this.segmentFillColor = null;
34
34
  this.maxWidth = null;
35
+ this.bold = false;
36
+ this.italic = false;
35
37
  this.ID_SCENARIOLABEL = "Label";
36
38
  this.CSS_CATEGORIES = "categories";
37
39
  this.pointPart = "label";
@@ -60,6 +62,12 @@ export class Label {
60
62
  this.segmentFillColor = color;
61
63
  return this;
62
64
  }
65
+ /** Bold for a sum row, italic for a rest row. */
66
+ setEmphasis(bold, italic) {
67
+ this.bold = bold;
68
+ this.italic = italic;
69
+ return this;
70
+ }
63
71
  setMaxWidth(width) {
64
72
  this.maxWidth = width;
65
73
  return this;
@@ -115,6 +123,10 @@ export class Label {
115
123
  }
116
124
  // @ts-ignore
117
125
  const text = label.text(prefix + valueStr);
126
+ if (this.bold)
127
+ text.font({ weight: "bold" });
128
+ if (this.italic)
129
+ text.font({ style: "italic" });
118
130
  text.move(this.x, this.y);
119
131
  // One bbox() per label, not two: svg.js caches nothing, and on a detached
120
132
  // tree each call clones the subtree into the document to measure it.
@@ -49,6 +49,12 @@ export class Needle {
49
49
  this.label.setToRelativeVarianceLabel().setPoint(dataPoint.key);
50
50
  }
51
51
  }
52
+ /** Prints the value in bold: the bar of a sum row. */
53
+ emphasize() {
54
+ var _a;
55
+ (_a = this.label) === null || _a === void 0 ? void 0 : _a.setEmphasis(true, false);
56
+ return this;
57
+ }
52
58
  updateLabelGroup(newGroup) {
53
59
  var _a;
54
60
  if (this.isEmpty() || newGroup == null) {
@@ -7,7 +7,7 @@ import { dataPointAttributes } from "../../../../utils/layoutState/dataPoint";
7
7
  * Renders a single horizontal stacked bar segment for the structure chart.
8
8
  */
9
9
  export class StackedBar {
10
- constructor(position, styles, dataPoint, index, segment, _segmentLabel, segmentIndex, stackMode, stack, _isScenarioStack, parentGroup) {
10
+ constructor(position, styles, dataPoint, index, segment, _segmentLabel, segmentIndex, stackMode, stack, _isScenarioStack, parentGroup, options = {}) {
11
11
  this.hasData = false;
12
12
  this.position = position;
13
13
  this.styles = styles;
@@ -17,6 +17,7 @@ export class StackedBar {
17
17
  this.segmentIndex = segmentIndex;
18
18
  this.stackMode = stackMode;
19
19
  this.stack = stack;
20
+ this.options = options;
20
21
  this.group = parentGroup;
21
22
  this.barGroup = parentGroup.group().id(`stacked_bar_${index}_seg_${segmentIndex}`);
22
23
  if ((dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.isEmpty()) !== true && dataPoint.value != null) {
@@ -24,6 +25,7 @@ export class StackedBar {
24
25
  }
25
26
  }
26
27
  draw(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
28
+ var _a;
27
29
  // a segment without a value (NaN) keeps its place in the stack, so the colours stay, but draws nothing
28
30
  if (!this.hasData || !Number.isFinite(this.dataPoint.value)) {
29
31
  return;
@@ -31,7 +33,7 @@ export class StackedBar {
31
33
  const value = this.dataPoint.value;
32
34
  const pixelPerUnit = this.dataPoint.pixelPerUnit;
33
35
  const axisX = this.position.getBarPositionX();
34
- const barWidth = this.position.getBarWidth();
36
+ const barWidth = this.position.getBarWidthAt(this.index);
35
37
  // a negative segment ends left of its start: the rect begins at the edge that is further left
36
38
  const segmentLength = Math.abs(this.segment.end - this.segment.start) * pixelPerUnit;
37
39
  const xPos = axisX + Math.min(this.segment.start, this.segment.end) * pixelPerUnit;
@@ -41,16 +43,24 @@ export class StackedBar {
41
43
  const fillStyle = { color: fillColor };
42
44
  const strokeStyle = { color: fillColor, width: 0.5 };
43
45
  this.barGroup.attr(dataPointAttributes(this.dataPoint.key, "element"));
46
+ this.barGroup.attr("data-bn-value", value);
44
47
  this.barGroup.rect(Math.max(segmentLength, 0.5), barWidth).fill(fillStyle).stroke(strokeStyle).cy(yPos).x(xPos);
45
48
  // Draw segment value label centered on bar if wide enough
46
- const LABEL_PADDING = 6;
47
- const availableWidth = segmentLength - LABEL_PADDING;
49
+ // 6 px at the base font of 16 px, less with a smaller font
50
+ const labelPadding = Math.min(6, this.styles.fontStyles.size * 0.375);
51
+ const availableWidth = segmentLength - labelPadding;
52
+ const { bold = false, italic = false } = this.options;
53
+ const relative = this.stackMode === StackMode.RELATIVE || this.stackMode === StackMode.ABSOLUTE_RELATIVE;
54
+ const labelKind = this.stackMode === StackMode.RELATIVE ? ((_a = this.options.label) !== null && _a !== void 0 ? _a : "share") : "share";
48
55
  if (availableWidth > 0) {
49
56
  const labelX = xPos + segmentLength / 2;
50
- if (this.stackMode === StackMode.RELATIVE || this.stackMode === StackMode.ABSOLUTE_RELATIVE) {
51
- const labelValue = Formatter.number(this.segment.share, "percent", dataFormatDigits.percent, dataFormatDigits.percent, 1, this.styles.locale);
57
+ if (relative && labelKind !== "value") {
58
+ const labelValue = labelKind === "plain-share"
59
+ ? Formatter.number(this.segment.share * 100, "decimal", dataFormatDigits.percent, dataFormatDigits.percent, 1, this.styles.locale)
60
+ : Formatter.number(this.segment.share, "percent", dataFormatDigits.percent, dataFormatDigits.percent, 1, this.styles.locale);
52
61
  new Label(this.group, labelX, yPos, "STACK_SEG", labelValue, this.styles, HookLocation.Center, HookLocation.Center)
53
62
  .setSegmentFill(fillColor)
63
+ .setEmphasis(bold, italic)
54
64
  .setMaxWidth(availableWidth)
55
65
  .setPoint(this.dataPoint.key)
56
66
  .draw();
@@ -59,6 +69,7 @@ export class StackedBar {
59
69
  // Pass raw numeric value - Label.draw() formats with measureScale
60
70
  new Label(this.group, labelX, yPos, "STACK_SEG", value, this.styles, HookLocation.Center, HookLocation.Center)
61
71
  .setSegmentFill(fillColor)
72
+ .setEmphasis(bold, italic)
62
73
  .setMaxWidth(availableWidth)
63
74
  .setPoint(this.dataPoint.key)
64
75
  .draw(dataFormatDigits, measureScale);
@@ -66,7 +77,8 @@ export class StackedBar {
66
77
  }
67
78
  }
68
79
  drawTotalLabel(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix(), key) {
69
- if (this.stackMode === StackMode.RELATIVE) {
80
+ var _a, _b;
81
+ if (this.stackMode === StackMode.RELATIVE && !this.options.total) {
70
82
  return;
71
83
  }
72
84
  // like a plain bar: the label of a negative total sits left of the negative side
@@ -75,6 +87,9 @@ export class StackedBar {
75
87
  const labelX = this.position.getLabelPositionX(end * this.dataPoint.pixelPerUnit);
76
88
  const yPos = this.position.getBarPositionY(this.index, true);
77
89
  const label = new Label(this.group, labelX, yPos, "STACK_TOTAL", this.stack.total, this.styles, HookLocation.Center, isNegative ? HookLocation.Right : HookLocation.Left);
78
- label.setPoint(key, "total").draw(dataFormatDigits, measureScale);
90
+ label
91
+ .setEmphasis((_a = this.options.bold) !== null && _a !== void 0 ? _a : false, (_b = this.options.italic) !== null && _b !== void 0 ? _b : false)
92
+ .setPoint(key, "total")
93
+ .draw(dataFormatDigits, measureScale);
79
94
  }
80
95
  }
@@ -15,7 +15,7 @@
15
15
  */
16
16
  export class ElementPositions {
17
17
  // private smallestDataPoint: DataPoint;
18
- constructor(padding, scaleFactors, fontSize, numberOfColumns, leftSideLengthSync, titleLength, leftSideWidth, categoryWidth, hasStackedHeaders = false) {
18
+ constructor(padding, scaleFactors, fontSize, numberOfColumns, leftSideLengthSync, titleLength, leftSideWidth, categoryWidth, hasStackedHeaders = false, rows = null) {
19
19
  this.categoryPosition = { x: 0, y: 0 };
20
20
  this.spacings = {
21
21
  scenarioOffset: 0,
@@ -46,6 +46,7 @@ export class ElementPositions {
46
46
  this.leftSideLengthSync = leftSideLengthSync;
47
47
  this.topSideLabelHeight = titleLength > 0 ? this.fontSize : 0;
48
48
  this.hasStackedHeaders = hasStackedHeaders;
49
+ this.rows = rows;
49
50
  this.leftSideLabelLength = this.calculateSideLabelLength(titleLength, leftSideWidth, categoryWidth);
50
51
  this.calculateSpacings();
51
52
  this.calculateCategoryPosition();
@@ -55,8 +56,22 @@ export class ElementPositions {
55
56
  return this.axisPosition.x;
56
57
  }
57
58
  getBarCenterPositionY(index) {
59
+ if (this.rows && index < this.rows.start.length) {
60
+ const middle = this.rows.start[index] + this.rows.weight[index] / 2;
61
+ return this.getAxisPositionY() + this.spacings.scenarioOffset + middle * this.spacings.categoryWidth;
62
+ }
58
63
  return this.categoryPosition.y + this.spacings.scenarioOffset + index * this.spacings.categoryWidth;
59
64
  }
65
+ /** Upper edge of the room of a row. */
66
+ getRowTopPositionY(index) {
67
+ const start = this.rows && index < this.rows.start.length ? this.rows.start[index] : index;
68
+ return this.getAxisPositionY() + this.spacings.scenarioOffset + start * this.spacings.categoryWidth;
69
+ }
70
+ /** Thickness of the bar of a row. Rows have one thickness unless the chart sets a row layout. */
71
+ getBarWidthAt(index) {
72
+ const weight = this.rows && index < this.rows.weight.length ? this.rows.weight[index] : 1;
73
+ return this.spacings.barWidth * weight;
74
+ }
60
75
  getBarPositionY(index, isPrimaryMarker) {
61
76
  if (isPrimaryMarker) {
62
77
  return this.getBarCenterPositionY(index);
@@ -77,7 +92,7 @@ export class ElementPositions {
77
92
  return this.axisPosition.y - this.spacings.labelToAxis - this.getTopLabelOverhang();
78
93
  }
79
94
  getStackedHeaderPositionY() {
80
- return this.getBarCenterPositionY(0) - this.spacings.barWidth * 0.5 - this.spacings.scenarioLabelToBar;
95
+ return this.getBarCenterPositionY(0) - this.getBarWidthAt(0) * 0.5 - this.spacings.scenarioLabelToBar;
81
96
  }
82
97
  getNeedleWidth() {
83
98
  return this.spacings.needleWidth;
@@ -129,14 +144,18 @@ export class ElementPositions {
129
144
  return this.spacings.scenarioOffset; // this.categoryOffset;
130
145
  }
131
146
  getAxisEndPositionY() {
132
- return this.getAxisPositionY() + (this.numberOfColumns + 1 / 2) * this.spacings.categoryWidth;
147
+ const rows = this.rows ? this.rows.total : this.numberOfColumns;
148
+ return this.getAxisPositionY() + (rows + 1 / 2) * this.spacings.categoryWidth;
133
149
  }
134
150
  getScenarioLabelPositionOffsetY(isPrimaryBar) {
151
+ var _a;
135
152
  if (isPrimaryBar) {
136
153
  // The label belongs to the last bar, but the axis line runs past that bar's
137
154
  // center by (categoryWidth - scenarioOffset); place the label below the axis
138
155
  // end so the line does not strike through it.
139
156
  const belowBar = this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar;
157
+ if ((_a = this.rows) === null || _a === void 0 ? void 0 : _a.nameBelowBar)
158
+ return belowBar;
140
159
  const belowAxisEnd = this.spacings.categoryWidth - this.spacings.scenarioOffset + this.spacings.labelToAxis;
141
160
  return Math.max(belowBar, belowAxisEnd);
142
161
  }
@@ -36,6 +36,14 @@ export class StructureChartComponentConfig {
36
36
  this.showMeasureScale = true;
37
37
  this.dataFormatDigits = { decimal: 1, percent: 2 };
38
38
  this.stackConfig = null;
39
+ this.sums = "none";
40
+ /** Label of the row over all rows. Empty: the `SUM_TOTAL` text. */
41
+ this.sumTitle = "";
42
+ /** The name of the scenario stands above the first bar and not below the last one. */
43
+ this.scenarioLabelTop = false;
44
+ this.referenceLine = null;
45
+ /** Values of the level column whose row is printed in italics. */
46
+ this.italicCategories = [];
39
47
  }
40
48
  }
41
49
  /**
@@ -100,6 +108,21 @@ export class StructureChartComponentConfigAdapter {
100
108
  if (CompareUtil.isExisting(data.stackConfig)) {
101
109
  config.stackConfig = data.stackConfig;
102
110
  }
111
+ if (CompareUtil.isString(data.sums) && ["groups", "total", "all"].includes(data.sums)) {
112
+ config.sums = data.sums;
113
+ }
114
+ if (CompareUtil.isString(data.sumTitle)) {
115
+ config.sumTitle = data.sumTitle;
116
+ }
117
+ if (CompareUtil.isBoolean(data.scenarioLabelTop)) {
118
+ config.scenarioLabelTop = data.scenarioLabelTop;
119
+ }
120
+ if (CompareUtil.isExisting(data.referenceLine)) {
121
+ config.referenceLine = data.referenceLine;
122
+ }
123
+ if (CompareUtil.isArray(data.italicCategories)) {
124
+ config.italicCategories = AdapterUtils.adaptArray(data.italicCategories, this.stringAdapter);
125
+ }
103
126
  return config;
104
127
  }
105
128
  default() {
@@ -1,3 +1,4 @@
1
+ import { Formatter } from "../../utils/formatter";
1
2
  import { h, Host, forceUpdate } from "@stencil/core";
2
3
  import { getOrCreateStores } from "../../context/context-protocol";
3
4
  import { LAYOUT_STATE_VERSION, assignIds, buildGenericState, resolveOwnIdentity, toLayoutRect, } from "../../utils/layoutState";
@@ -37,12 +38,41 @@ const VISUAL_SELECTOR = "bn-annotation-layer, bn-annotation-list, bn-body, bn-ca
37
38
  "bn-text, bn-title, bn-tree";
38
39
  export class Context {
39
40
  constructor() {
41
+ /**
42
+ * Group separator of every number in the document, in place of the one of
43
+ * the locale: `thin-space`, `space`, `none`, or the separator itself. It
44
+ * holds for the whole page, also for a context that does not set it.
45
+ *
46
+ * @default "" (the separator of the locale)
47
+ * @example group-separator="thin-space"
48
+ */
49
+ this.groupSeparator = "";
50
+ this.setsGroupSeparator = false;
40
51
  /** The page numbers this context wrote. A number that is not in here was set by the author and is left alone. */
41
52
  this.assignedPageNumbers = new WeakMap();
42
53
  this.notationSubscriptions = [];
43
54
  withComponentStatus(this);
44
55
  this.errors = withHasError(this);
45
56
  }
57
+ watchGroupSeparator(newValue) {
58
+ var _a;
59
+ const before = Formatter.groupSeparator;
60
+ this.setGroupSeparator(newValue);
61
+ // the numbers are drawn with the old separator: what follows the locale draws again
62
+ const state = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.context.state;
63
+ if (state && Formatter.groupSeparator !== before) {
64
+ const locale = state.locale;
65
+ state.locale = "";
66
+ state.locale = locale;
67
+ }
68
+ }
69
+ setGroupSeparator(newValue) {
70
+ var _a;
71
+ const named = { "thin-space": "\u2009", space: "\u00a0", none: "" };
72
+ // no value: the separator of the locale
73
+ Formatter.groupSeparator = newValue ? ((_a = named[newValue]) !== null && _a !== void 0 ? _a : newValue) : null;
74
+ this.setsGroupSeparator = !!newValue;
75
+ }
46
76
  setLocale(newValue) {
47
77
  this.stores.context.state.locale = newValue;
48
78
  }
@@ -54,6 +84,9 @@ export class Context {
54
84
  if (this.locale) {
55
85
  this.stores.context.state.locale = this.locale;
56
86
  }
87
+ if (this.groupSeparator) {
88
+ this.setGroupSeparator(this.groupSeparator);
89
+ }
57
90
  // a removed scaling group is a "set" too: its entry is set to undefined
58
91
  const notify = () => this.bnNotationChange.emit();
59
92
  this.notationSubscriptions = [
@@ -72,6 +105,11 @@ export class Context {
72
105
  }
73
106
  disconnectedCallback() {
74
107
  var _a, _b;
108
+ // only the context that set it takes it back
109
+ if (this.setsGroupSeparator) {
110
+ Formatter.groupSeparator = null;
111
+ this.setsGroupSeparator = false;
112
+ }
75
113
  this.notationSubscriptions.forEach((unsubscribe) => unsubscribe());
76
114
  this.notationSubscriptions = [];
77
115
  (_a = this.pageObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
@@ -224,7 +262,7 @@ export class Context {
224
262
  componentWillUpdate() { }
225
263
  componentDidUpdate() { }
226
264
  render() {
227
- return (h(Host, { key: 'e2c985d07c329d796c37804f492907f0f49366d2' }, h("slot", { key: '90c11954a1a9365bc46ddacb2a3b8f72bbc4e523' })));
265
+ return (h(Host, { key: '30cd6749c3af25eb4f287ee2771aff0858f4368d' }, h("slot", { key: 'ea8bab237f0103f3e3e259ff660004af9a30f982' })));
228
266
  }
229
267
  static get is() { return "bn-context"; }
230
268
  static get encapsulation() { return "shadow"; }
@@ -296,6 +334,32 @@ export class Context {
296
334
  "setter": false,
297
335
  "reflect": true,
298
336
  "attribute": "render-orientation"
337
+ },
338
+ "groupSeparator": {
339
+ "type": "string",
340
+ "mutable": false,
341
+ "complexType": {
342
+ "original": "string",
343
+ "resolved": "string",
344
+ "references": {}
345
+ },
346
+ "required": false,
347
+ "optional": false,
348
+ "docs": {
349
+ "tags": [{
350
+ "name": "default",
351
+ "text": "\"\" (the separator of the locale)"
352
+ }, {
353
+ "name": "example",
354
+ "text": "group-separator=\"thin-space\""
355
+ }],
356
+ "text": "Group separator of every number in the document, in place of the one of\nthe locale: `thin-space`, `space`, `none`, or the separator itself. It\nholds for the whole page, also for a context that does not set it."
357
+ },
358
+ "getter": false,
359
+ "setter": false,
360
+ "reflect": false,
361
+ "attribute": "group-separator",
362
+ "defaultValue": "\"\""
299
363
  }
300
364
  };
301
365
  }
@@ -414,6 +478,9 @@ export class Context {
414
478
  static get elementRef() { return "element"; }
415
479
  static get watchers() {
416
480
  return [{
481
+ "propName": "groupSeparator",
482
+ "methodName": "watchGroupSeparator"
483
+ }, {
417
484
  "propName": "locale",
418
485
  "methodName": "setLocale"
419
486
  }];
@@ -97,6 +97,16 @@ export class LayoutCard {
97
97
  * card-custom-template='"a a" "b c"'></bn-layout-card>
98
98
  */
99
99
  this.cardCustomTemplate = '"a b" "c d"';
100
+ /**
101
+ * Puts the child after the last slot of the template on top of the grid,
102
+ * in the cells this CSS `grid-area` names by line numbers:
103
+ * `row-start / column-start / row-end / column-end`. Use it for a text or a
104
+ * comment list in the free part of a chart.
105
+ *
106
+ * @default "" (no overlay)
107
+ * @example card-overlay-area="4 / 3 / 7 / 5"
108
+ */
109
+ this.cardOverlayArea = "";
100
110
  /**
101
111
  * Gap between grid cells in pixels.
102
112
  */
@@ -177,7 +187,20 @@ export class LayoutCard {
177
187
  const items = this.createDivAreaStyles(slotNames);
178
188
  return (h(Fragment, null, items.map((value, index) => {
179
189
  return (h("div", { style: value }, h("slot", { name: "card-slot-" + index })));
180
- })));
190
+ }), this.overlayArea() ? (h("div", { style: { display: "flex", overflow: "hidden", "grid-area": this.overlayArea(), "z-index": "1" } }, h("slot", { name: "card-slot-" + items.length }))) : null));
191
+ }
192
+ /** The overlay area when it is four line numbers inside the grid of the layout, else nothing. */
193
+ overlayArea() {
194
+ var _a, _b;
195
+ const area = ((_a = this.cardOverlayArea) !== null && _a !== void 0 ? _a : "").trim();
196
+ if (!/^\d+(\s*\/\s*\d+){3}$/.test(area))
197
+ return undefined;
198
+ const [rowStart, columnStart, rowEnd, columnEnd] = area.split("/").map((line) => Number(line.trim()));
199
+ const rows = this.getRowCount(this.cardLayout);
200
+ const columns = ((_b = templateRows(this.getTemplatePattern(this.cardLayout))[0]) === null || _b === void 0 ? void 0 : _b.length) || 1;
201
+ // a line outside the template would add rows or columns to the grid
202
+ const inside = rowStart >= 1 && columnStart >= 1 && rowEnd <= rows + 1 && columnEnd <= columns + 1;
203
+ return inside && rowStart < rowEnd && columnStart < columnEnd ? area : undefined;
181
204
  }
182
205
  extractSlotNames(styleElement) {
183
206
  return templateSlotNames(styleElement);
@@ -186,6 +209,7 @@ export class LayoutCard {
186
209
  return templateAreas(name, this.cardCustomTemplate);
187
210
  }
188
211
  componentWillRender() {
212
+ var _a;
189
213
  const problem = this.cardLayout === CUSTOM_TEMPLATE ? templateProblem(this.cardCustomTemplate) : undefined;
190
214
  if (problem) {
191
215
  this.errors.addOrReplace({
@@ -197,6 +221,16 @@ export class LayoutCard {
197
221
  else {
198
222
  this.errors.remove("WARN_cardCustomTemplate");
199
223
  }
224
+ if (((_a = this.cardOverlayArea) !== null && _a !== void 0 ? _a : "").trim() !== "" && !this.overlayArea()) {
225
+ this.errors.addOrReplace({
226
+ id: "WARN_cardOverlayArea",
227
+ type: "warning",
228
+ message: `cardOverlayArea: '${this.cardOverlayArea}' is not 'row-start / column-start / row-end / column-end' in line numbers of the layout.`,
229
+ });
230
+ }
231
+ else {
232
+ this.errors.remove("WARN_cardOverlayArea");
233
+ }
200
234
  }
201
235
  setCardClass() {
202
236
  if (this.cardShowBorder === true) {
@@ -223,7 +257,7 @@ export class LayoutCard {
223
257
  var _a;
224
258
  const style = this.getLayoutStyle();
225
259
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
226
- return (h("bn-card", { key: '3db479047905de01ac517491f2d68a9bd0a3a576', styles: this.styles, "selected-style": this.selectedStyle, class: this.setCardClass() }, h("div", { key: 'fd9948acd84ce55badf87a7e03d733d1e75a1bea', class: "cardtitle" }, h("bn-title", { key: '21200c96fb03d403fa616b093d753ea4b746c6f2', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : this.titleNamespace, ruleset: this.titleProp("ruleset"), "title-font-size": this.componentStyle(($) => { var _a; return (_a = $ === null || $ === void 0 ? void 0 : $["bn-layout-card"]) === null || _a === void 0 ? void 0 : _a.titleFontSize; }), "business-unit": this.titleBusinessUnit, scenarios: this.titleProp("titleScenarios"), variances: this.titleProp("titleVariances"), order: this.titleProp("titleOrder"), "order-direction": this.titleProp("titleOrderDirection"), measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), this.titleImage != null && this.titleImage !== "" ? (h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), h("bn-body", { key: 'c5b1957822ff216d33084154afdf6deb3e4426cc' }, h("div", { key: 'bc17f6f73825894641f775137eaefd5059a25cf6', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'cfbeba76eaf11358e92002d309cafae19d2525e2', text: this.footerText, "page-number": "0", "display-page-number": "false" })));
260
+ return (h("bn-card", { key: 'ef0b6da39a573f162c096c21803e4d647b2817c2', styles: this.styles, "selected-style": this.selectedStyle, class: this.setCardClass() }, h("div", { key: '9116df8c88198ebc922dc91d5f45a032a81d37d1', class: "cardtitle" }, h("bn-title", { key: '6d9645d5229c3bf32ef944c1f296a55dbe4b3bee', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : this.titleNamespace, ruleset: this.titleProp("ruleset"), "title-font-size": this.componentStyle(($) => { var _a; return (_a = $ === null || $ === void 0 ? void 0 : $["bn-layout-card"]) === null || _a === void 0 ? void 0 : _a.titleFontSize; }), "business-unit": this.titleBusinessUnit, scenarios: this.titleProp("titleScenarios"), variances: this.titleProp("titleVariances"), order: this.titleProp("titleOrder"), "order-direction": this.titleProp("titleOrderDirection"), measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), this.titleImage != null && this.titleImage !== "" ? (h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), h("bn-body", { key: '65803497adad305f02874acf441867e9ba200945' }, h("div", { key: '61a57b87b0ffb76c238b2e2facb7d5b855d5dc10', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), h("bn-footer", { key: '8589da921d0f8dac8e9a2af23315ded3a3ee3d51', text: this.footerText, "page-number": "0", "display-page-number": "false" })));
227
261
  }
228
262
  static get is() { return "bn-layout-card"; }
229
263
  static get encapsulation() { return "shadow"; }
@@ -627,6 +661,32 @@ export class LayoutCard {
627
661
  "attribute": "card-custom-template",
628
662
  "defaultValue": "'\"a b\" \"c d\"'"
629
663
  },
664
+ "cardOverlayArea": {
665
+ "type": "string",
666
+ "mutable": false,
667
+ "complexType": {
668
+ "original": "string",
669
+ "resolved": "string",
670
+ "references": {}
671
+ },
672
+ "required": false,
673
+ "optional": false,
674
+ "docs": {
675
+ "tags": [{
676
+ "name": "default",
677
+ "text": "\"\" (no overlay)"
678
+ }, {
679
+ "name": "example",
680
+ "text": "card-overlay-area=\"4 / 3 / 7 / 5\""
681
+ }],
682
+ "text": "Puts the child after the last slot of the template on top of the grid,\nin the cells this CSS `grid-area` names by line numbers:\n`row-start / column-start / row-end / column-end`. Use it for a text or a\ncomment list in the free part of a chart."
683
+ },
684
+ "getter": false,
685
+ "setter": false,
686
+ "reflect": false,
687
+ "attribute": "card-overlay-area",
688
+ "defaultValue": "\"\""
689
+ },
630
690
  "cardGridGap": {
631
691
  "type": "string",
632
692
  "mutable": false,
@@ -33,9 +33,15 @@ export class Formatter {
33
33
  }
34
34
  this.formats.set(key, format);
35
35
  }
36
- const text = format.format(value / scale);
36
+ const print = (number) => this.groupSeparator === null
37
+ ? format.format(number)
38
+ : format
39
+ .formatToParts(number)
40
+ .map((part) => (part.type === "group" ? this.groupSeparator : part.value))
41
+ .join("");
42
+ const text = print(value / scale);
37
43
  // a small negative that rounds to zero would print "-0"
38
- return (text === format.format(-0) ? format.format(0) : text).replace(/\s+(%)/g, "$1");
44
+ return (text === print(-0) ? print(0) : text).replace(/\s+(%)/g, "$1");
39
45
  }
40
46
  /**
41
47
  * Translates a technical scenario identifier into a human-readable IBCS label.
@@ -93,3 +99,8 @@ export class Formatter {
93
99
  }
94
100
  /** One formatter per locale, style and digits: building one per cell is slow. */
95
101
  Formatter.formats = new Map();
102
+ /**
103
+ * Replaces the group separator of the locale in every number, for example by a thin
104
+ * space. Null: the separator of the locale. One setting for the page: `bn-context` sets it.
105
+ */
106
+ Formatter.groupSeparator = null;
@@ -373,6 +373,15 @@ export function validateStackConfig(value) {
373
373
  if (config.hasOwnProperty("percentMark") && typeof config.percentMark !== "boolean") {
374
374
  errors.push("stack: 'percentMark' must be true or false");
375
375
  }
376
+ if (config.hasOwnProperty("labels") && !["share", "value"].includes(config.labels)) {
377
+ errors.push("stack: 'labels' must be one of: share, value");
378
+ }
379
+ if (config.hasOwnProperty("totalTitle") && typeof config.totalTitle !== "string") {
380
+ errors.push("stack: 'totalTitle' must be a text");
381
+ }
382
+ if (config.hasOwnProperty("thickness") && !["equal", "total"].includes(config.thickness)) {
383
+ errors.push("stack: 'thickness' must be one of: equal, total");
384
+ }
376
385
  return errors;
377
386
  }
378
387
  catch (_e) {