@bino-bi/bn-template-engine 1.0.0-next.42 → 1.0.0-next.43

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 (33) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-3836531f.entry.js → p-ddf6cd92.entry.js} +1 -1
  3. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +118 -25
  4. package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.css +65 -2
  5. package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +50 -3
  6. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +55 -17
  7. package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +2 -4
  8. package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +8 -1
  9. package/dist/collection/utils/layoutState/baseline.js +5 -1
  10. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  11. package/dist/components/bn-chart-bubble.js +1 -1
  12. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  13. package/dist/components/bn-chart-bullet.js +1 -1
  14. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  15. package/dist/components/bn-chart-scatter.js +1 -1
  16. package/dist/components/bn-chart-structure.js +1 -1
  17. package/dist/components/bn-chart-time.js +1 -1
  18. package/dist/components/bn-table-renderer.js +1 -1
  19. package/dist/components/bn-table.js +1 -1
  20. package/dist/components/p-AwH1w8Mu.js +1 -0
  21. package/dist/components/{p-CUSAlS2o.js → p-BfUdaxZ9.js} +1 -1
  22. package/dist/components/{p-ChaSU4fh.js → p-C2ycO60j.js} +1 -1
  23. package/dist/components/{p-chnyMHJT.js → p-CyfGkLMh.js} +1 -1
  24. package/dist/components/p-DX9_keF-.js +1 -0
  25. package/dist/components/{p-DM4Up10X.js → p-DnDL1pPc.js} +1 -1
  26. package/dist/components/p-JofGXz75.js +1 -0
  27. package/dist/esm/bn-annotation-layer_30.entry.js +118 -25
  28. package/dist/types/components/bn-table/bn-table-renderer/bn-table-renderer.d.ts +11 -0
  29. package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +6 -1
  30. package/package.json +1 -1
  31. package/dist/components/p-B2L2q2Ks.js +0 -1
  32. package/dist/components/p-Bn7J1pgl.js +0 -1
  33. package/dist/components/p-XFZYX7DZ.js +0 -1
@@ -833,7 +833,11 @@ function readTableBaseline(table, host) {
833
833
  const isRowHeader = (cell) => cell.classList.contains("category") || cell.classList.contains("operation");
834
834
  const valueCell = cells.some(isRowHeader) ? cells.find((cell) => !isRowHeader(cell)) : cells[1];
835
835
  if (valueCell) {
836
- baseline.x = round2(frame.toLocal(valueCell.getBoundingClientRect()).x);
836
+ // a block gap is a transparent left border: the column starts after it
837
+ const gap = valueCell.classList.contains("block-start") && typeof getComputedStyle === "function"
838
+ ? parseFloat(getComputedStyle(valueCell).borderLeftWidth) || 0
839
+ : 0;
840
+ baseline.x = round2(frame.toLocal(valueCell.getBoundingClientRect()).x + gap);
837
841
  }
838
842
  return baseline;
839
843
  }
@@ -28437,7 +28441,14 @@ const OVERDRIVE_FRACTION = 0.15;
28437
28441
  /** Width of the axis of a variance bar or pin, in em: near the 0.3em scenario marker in the header. */
28438
28442
  const VARIANCE_AXIS_EM = 0.25;
28439
28443
  /** Side of the square pin head, in px before scaleFactor. */
28440
- const PIN_HEAD_SIZE = 10;
28444
+ const PIN_HEAD_SIZE = 8;
28445
+ /** Height of a bar in svg heights: IBCS leaves almost half the row free. */
28446
+ const BAR_HEIGHT_RATIO = 0.6;
28447
+ /** Top edge and height of a bar centred in an svg of the given height. */
28448
+ function barBox(height) {
28449
+ const barHeight = height * BAR_HEIGHT_RATIO;
28450
+ return { barY: (height - barHeight) / 2, barHeight };
28451
+ }
28441
28452
  /**
28442
28453
  * Advance widths in em, the larger of Noto Sans and Arial. The engine ships no font, so a
28443
28454
  * wider fallback (DejaVu Sans, Verdana) is possible: LABEL_WIDTH_MARGIN and the cell
@@ -28710,23 +28721,57 @@ const PIN_BAND_PAD = 0.2;
28710
28721
  function getPatternId(prefix, color) {
28711
28722
  return `pattern-${prefix}-${color.replace("#", "")}`;
28712
28723
  }
28724
+ /** The hatching of a pin head: light lines on the dark colour of the scenario, as IBCS draws it. */
28725
+ function getHeadPatternId(slot, color) {
28726
+ return getPatternId(`head-${slot}`, color);
28727
+ }
28713
28728
  /**
28714
28729
  * Renders SVG pattern definitions for hatched fills
28715
28730
  */
28716
28731
  const PatternDefs = ({ styles }) => {
28717
28732
  const s = styles.scaleFactor;
28718
- const patternSize = 6 * s;
28733
+ const size = 3 * s;
28719
28734
  const patterns = [
28720
- { id: getPatternId("pos", styles.positive.stroke), stroke: styles.positive.stroke, fill: styles.positive.fill },
28721
- { id: getPatternId("neg", styles.negative.stroke), stroke: styles.negative.stroke, fill: styles.negative.fill },
28722
- { id: getPatternId("neu", styles.neutral.stroke), stroke: styles.neutral.stroke, fill: styles.neutral.fill },
28723
- ...["ac", "pp", "fc", "pl"].map((type) => ({
28724
- id: getPatternId(type, styles.scenarios[type].stroke),
28725
- stroke: styles.scenarios[type].stroke,
28726
- fill: styles.scenarios[type].fill,
28727
- })),
28735
+ {
28736
+ id: getPatternId("pos", styles.positive.stroke),
28737
+ line: styles.positive.stroke,
28738
+ background: "#ffffff",
28739
+ lineWidth: 1,
28740
+ },
28741
+ {
28742
+ id: getPatternId("neg", styles.negative.stroke),
28743
+ line: styles.negative.stroke,
28744
+ background: "#ffffff",
28745
+ lineWidth: 1,
28746
+ },
28747
+ {
28748
+ id: getPatternId("neu", styles.neutral.stroke),
28749
+ line: styles.neutral.stroke,
28750
+ background: "#ffffff",
28751
+ lineWidth: 1,
28752
+ },
28753
+ ...["ac", "pp", "fc", "pl"].flatMap((type) => [
28754
+ {
28755
+ id: getPatternId(type, styles.scenarios[type].stroke),
28756
+ line: styles.scenarios[type].stroke,
28757
+ background: "#ffffff",
28758
+ lineWidth: 1,
28759
+ },
28760
+ {
28761
+ id: getHeadPatternId(type, styles.scenarios[type].stroke),
28762
+ line: "#ffffff",
28763
+ background: styles.scenarios[type].stroke,
28764
+ lineWidth: 0.6,
28765
+ },
28766
+ ]),
28767
+ ];
28768
+ // the diagonal of the tile and its two ends in the next tiles, so the lines join without notches
28769
+ const diagonals = [
28770
+ [0, size, size, 0],
28771
+ [-s, s, s, -s],
28772
+ [size - s, size + s, size + s, size - s],
28728
28773
  ];
28729
- return (index.h("defs", null, patterns.map((p) => (index.h("pattern", { id: p.id, patternUnits: "userSpaceOnUse", width: patternSize, height: patternSize }, index.h("rect", { width: patternSize, height: patternSize, fill: "#ffffff" }), index.h("line", { x1: "0", y1: patternSize, x2: patternSize, y2: "0", stroke: p.stroke, "stroke-width": 1.5 * s }))))));
28774
+ return (index.h("defs", null, patterns.map((p) => (index.h("pattern", { id: p.id, patternUnits: "userSpaceOnUse", width: size, height: size }, index.h("rect", { width: size, height: size, fill: p.background }), diagonals.map(([x1, y1, x2, y2]) => (index.h("line", { x1: x1, y1: y1, x2: x2, y2: y2, stroke: p.line, "stroke-width": p.lineWidth * s }))))))));
28730
28775
  };
28731
28776
  /** Longest relative label that keeps all percent digits; a longer one drops digits so its gutter does not eat the pins. */
28732
28777
  const PIN_LABEL_CHARS = 7;
@@ -28828,8 +28873,10 @@ const VarianceAxis = ({ x, height, look, styles }) => {
28828
28873
  const { reference, referenceSlot } = look;
28829
28874
  let lines;
28830
28875
  if (reference.fillpattern === "outlined") {
28831
- const offset = width / 2 - 0.5 * s;
28832
- lines = [x - offset, x + offset].map((lineX) => (index.h("line", { x1: lineX, y1: 0, x2: lineX, y2: height, stroke: reference.stroke, "stroke-width": 1 * s })));
28876
+ // two lines with a gap of their width, together as wide as a solid axis
28877
+ const lineWidth = width / 3;
28878
+ const offset = (width - lineWidth) / 2;
28879
+ lines = [x - offset, x + offset].map((lineX) => (index.h("line", { x1: lineX, y1: 0, x2: lineX, y2: height, stroke: reference.stroke, "stroke-width": lineWidth })));
28833
28880
  }
28834
28881
  else if (reference.fillpattern === "hatched") {
28835
28882
  lines = (index.h("line", { x1: x, y1: 0, x2: x, y2: height, stroke: reference.stroke, "stroke-width": width, "stroke-dasharray": `${2 * s}` }));
@@ -28957,9 +29004,7 @@ const AbsoluteVarianceBar = (props) => {
28957
29004
  const maxOverflow = Math.max(0, maxScaledWidth - cutWidth);
28958
29005
  const overflowAmount = Math.max(0, scaledWidth - cutWidth);
28959
29006
  const overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
28960
- const padding = 2 * s;
28961
- const barHeight = height - padding * 2;
28962
- const barY = padding;
29007
+ const { barY, barHeight } = barBox(height);
28963
29008
  // Get style based on column type (scenario vs variance)
28964
29009
  const look = getVarianceLook(scenario, styles);
28965
29010
  const sentimentStyle = getBarStyle(scenario, value, isPositiveGood, styles);
@@ -29041,7 +29086,11 @@ const RelativeVariancePin = (props) => {
29041
29086
  const labelX = labelOnShaft
29042
29087
  ? bandX + bandWidth / 2
29043
29088
  : (isExtreme ? tipX : pinEndX + direction * (headSize / 2)) + direction * labelGap;
29044
- return (index.h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, index.h(PatternDefs, { styles: styles }), isExtreme ? (index.h("polygon", { points: `${tipX},${centerY} ${arrowBaseX},${centerY - arrowSize / 2} ${arrowBaseX},${centerY + arrowSize / 2}`, fill: barStyle.fill })) : (index.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 })), index.h("line", { x1: axisX, y1: centerY, x2: isExtreme ? arrowBaseX : pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": PIN_LINE_WIDTH * s }), labelOnShaft && (index.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" })), look ? (index.h(VarianceAxis, { x: axisX, height: height, look: look, styles: styles })) : (index.h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s })), index.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)));
29089
+ return (index.h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, index.h(PatternDefs, { styles: styles }), isExtreme ? (index.h("polygon", { points: `${tipX},${centerY} ${arrowBaseX},${centerY - arrowSize / 2} ${arrowBaseX},${centerY + arrowSize / 2}`, fill: barStyle.fill })) : (index.h("rect", { x: pinEndX - headSize / 2, y: centerY - headSize / 2, width: headSize, height: headSize, fill: headStyle.fillpattern === "outlined"
29090
+ ? "#ffffff"
29091
+ : headStyle.fillpattern === "hatched"
29092
+ ? `url(#${getHeadPatternId((_b = look === null || look === void 0 ? void 0 : look.minuendSlot) !== null && _b !== void 0 ? _b : "ac", headStyle.stroke)})`
29093
+ : headStyle.fill, stroke: headStyle.stroke, "stroke-width": 1 * s })), index.h("line", { x1: axisX, y1: centerY, x2: isExtreme ? arrowBaseX : pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": PIN_LINE_WIDTH * s }), labelOnShaft && (index.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" })), look ? (index.h(VarianceAxis, { x: axisX, height: height, look: look, styles: styles })) : (index.h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s })), index.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)));
29045
29094
  };
29046
29095
  /**
29047
29096
  * CellBarChart - Renders IBCS-compliant variance bar charts.
@@ -29104,9 +29153,7 @@ const WaterfallBar = (props) => {
29104
29153
  const { totalWidth, labelAreaLeft, barAreaWidth, labelGap } = geometry !== null && geometry !== void 0 ? geometry : waterfallGeometry(columnWidthEm, styles.emPx);
29105
29154
  const pxPerUnit = barAreaWidth / range;
29106
29155
  const xOf = (coordinate) => labelAreaLeft + (coordinate - waterfall.min) * pxPerUnit;
29107
- const padding = 2 * s;
29108
- const barHeight = height - padding * 2;
29109
- const barY = padding;
29156
+ const { barY, barHeight } = barBox(height);
29110
29157
  const axisX = xOf(0);
29111
29158
  const startX = xOf(waterfall.start);
29112
29159
  const endX = xOf(waterfall.end);
@@ -31780,8 +31827,10 @@ class TableDrillGroupAdapter {
31780
31827
  }
31781
31828
  }
31782
31829
 
31783
- const bnTableRendererCss = () => `:host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral,td.zero{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}th.intervalGroup{border-bottom:0.1em solid black;text-align:center;font-weight:bold}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal,td.percentpoint{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.ofit-above td[class^=category]{padding-left:1em}tr.ofit-sum td{border-top:0.1em solid black;font-weight:bold}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.variance-waterfall){overflow:visible}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}tr.ofit td:has(.cell-bar-chart),tr.partof td:has(.cell-bar-chart),tr.share td:has(.cell-bar-chart){padding:0 0.4166666667em}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}`;
31830
+ const bnTableRendererCss = () => `:host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral,td.zero{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.barColumn{text-align:center}td.block-start,th.block-start{border-left:var(--bn-block-gap, 0) solid transparent;clip-path:inset(-100em -100em -100em var(--bn-block-gap, 0))}.category-w100.block-start{min-width:calc(100em + var(--bn-block-gap, 0px));max-width:calc(100em + var(--bn-block-gap, 0px))}.category-w50.block-start{min-width:calc(50em + var(--bn-block-gap, 0px));max-width:calc(50em + var(--bn-block-gap, 0px))}.category-w25.block-start{min-width:calc(25em + var(--bn-block-gap, 0px));max-width:calc(25em + var(--bn-block-gap, 0px))}.category-w20.block-start{min-width:calc(20em + var(--bn-block-gap, 0px));max-width:calc(20em + var(--bn-block-gap, 0px))}.category-w15.block-start{min-width:calc(15em + var(--bn-block-gap, 0px));max-width:calc(15em + var(--bn-block-gap, 0px))}.category-w10.block-start{min-width:calc(10em + var(--bn-block-gap, 0px));max-width:calc(10em + var(--bn-block-gap, 0px))}.category-w5.block-start{min-width:calc(5em + var(--bn-block-gap, 0px));max-width:calc(5em + var(--bn-block-gap, 0px))}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}th.intervalGroup{border-bottom:0.1em solid black;text-align:center}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal,td.percentpoint{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}table.grouped-list tr.sum td{padding-bottom:1em}tr.ofit-above td[class^=category]{padding-left:1em}tr.ofit-sum td{border-top:0.1em solid black;font-weight:bold}tr.sum td.pos_pos,tr.sum td.pos_neg,tr.sum td.neg_pos,tr.sum td.neg_neg,tr.ofit-sum td.pos_pos,tr.ofit-sum td.pos_neg,tr.ofit-sum td.neg_pos,tr.ofit-sum td.neg_neg{color:inherit}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em solid #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.variance-waterfall){overflow:visible}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}tr.ofit td:has(.cell-bar-chart),tr.partof td:has(.cell-bar-chart),tr.share td:has(.cell-bar-chart){padding:0 0.4166666667em}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}`;
31784
31831
 
31832
+ /** Extra gap before the first column of a block, in table em. */
31833
+ const BLOCK_GAP_EM = 0.6;
31785
31834
  const BnTableRenderer = class {
31786
31835
  constructor(hostRef) {
31787
31836
  index.registerInstance(this, hostRef);
@@ -31871,6 +31920,7 @@ const BnTableRenderer = class {
31871
31920
  /** @internal */
31872
31921
  this.scaleFactor = 1;
31873
31922
  this.componentDataFormatDigits = new DataFormatDigits();
31923
+ this.blockStarts = new Set();
31874
31924
  this.barColumnLayouts = new Map();
31875
31925
  this.waterfallGeometries = new Map();
31876
31926
  // labels measured in the fallback font are too narrow or too wide once the web font is there: lay out again
@@ -32006,9 +32056,10 @@ const BnTableRenderer = class {
32006
32056
  return index.h("div", { class: "empty-state" }, errorMsg);
32007
32057
  }
32008
32058
  const locale = (_d = (_c = (_b = this.stores) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.locale;
32009
- return (index.h("table", null, index.h("thead", null, this.table.getHeader().map((row) => (index.h("tr", { class: row.cssStyle }, row.getCells().map((cell) => (index.h("th", { colSpan: cell.colSpan, class: cell.cssStyle }, cell.getAsHeaderList().map((line, i, arr) => (index.h("span", null, i === arr.length - 1 ? (index.h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (index.h("span", null, line, cell.drawPrefix(), index.h("br", null))))))))))))), index.h("tbody", null, this.table.getBody().map((row) => (index.h("tr", Object.assign({ class: row.cssStyle }, dataPointAttributes(row.key, "element")), row === null || row === void 0 ? void 0 : row.getCells().map((cell) => {
32059
+ return (index.h("table", { class: { "grouped-list": this.groupedList() }, style: { "--bn-block-gap": `${BLOCK_GAP_EM * this.emPx()}px` } }, index.h("thead", null, this.table.getHeader().map((row) => (index.h("tr", { class: row.cssStyle }, row.getCells().map((cell, i, cells) => (index.h("th", { colSpan: cell.colSpan, class: `${cell.cssStyle}${this.isBarColumn(cell.key) ? " barColumn" : ""}${this.blockStartClass(cells, i)}` }, cell.getAsHeaderList().map((line, i, arr) => (index.h("span", null, i === arr.length - 1 ? (index.h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (index.h("span", null, line, cell.drawPrefix(), index.h("br", null))))))))))))), index.h("tbody", null, this.table.getBody().map((row) => (index.h("tr", Object.assign({ class: row.cssStyle }, dataPointAttributes(row.key, "element")), row === null || row === void 0 ? void 0 : row.getCells().map((cell, i, cells) => {
32010
32060
  var _a, _b, _c, _d, _e;
32011
- return (index.h("td", Object.assign({ colSpan: cell.colSpan, class: cell.type ? `${this.cellClass(cell, locale)} ${cell.type}` : cell.cssStyle }, (row.key && cell.value != null && cell.value !== "" && cell.value !== "-"
32061
+ return (index.h("td", Object.assign({ colSpan: cell.colSpan, class: (cell.type ? `${this.cellClass(cell, locale)} ${cell.type}` : cell.cssStyle) +
32062
+ this.blockStartClass(cells, i) }, (row.key && cell.value != null && cell.value !== "" && cell.value !== "-"
32012
32063
  ? dataPointAttributes(Object.assign(Object.assign({}, row.key), { date: cell.date, scenario: cell.key }), "element")
32013
32064
  : {})), cell.prefix != null ? (index.h("span", { class: this.cellClass(cell, locale) + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
32014
32065
  cell.columnStats &&
@@ -32072,10 +32123,50 @@ const BnTableRenderer = class {
32072
32123
  (_l = this.errors) === null || _l === void 0 ? void 0 : _l.remove(id);
32073
32124
  }
32074
32125
  }
32126
+ this.blockStarts = this.collectBlockStarts();
32075
32127
  this.barColumnLayouts = this.collectBarColumnLayouts();
32076
32128
  this.waterfallGeometries = this.collectWaterfallGeometries();
32077
32129
  this.barChartStyles = this.prepareBarChartStyles();
32078
32130
  }
32131
+ /**
32132
+ * The columns that start a block: the row header, the scenarios of one interval bucket
32133
+ * and each pair of variances are blocks. IBCS sets them apart by a wider gap.
32134
+ */
32135
+ collectBlockStarts() {
32136
+ const starts = new Set();
32137
+ if (!this.table || this.table.hasNoData())
32138
+ return starts;
32139
+ const blockOf = (column) => {
32140
+ var _a;
32141
+ const variance = new VarianceScenario(column.type);
32142
+ const kind = variance.isValid
32143
+ ? `${variance.base}_${variance.delta}`
32144
+ : /^(ac|pp|fc|pl)\d/i.test(column.type)
32145
+ ? "scenario"
32146
+ : "rowheader";
32147
+ return `${(_a = column.bucket) !== null && _a !== void 0 ? _a : ""}|${kind}`;
32148
+ };
32149
+ const blocks = this.table.getColumns().map(blockOf);
32150
+ blocks.forEach((block, i) => {
32151
+ if (i > 0 && block !== blocks[i - 1])
32152
+ starts.add(i);
32153
+ });
32154
+ return starts;
32155
+ }
32156
+ /** " block-start" for the cell whose first column starts a block. A cell can span columns. */
32157
+ blockStartClass(cells, index) {
32158
+ let column = 0;
32159
+ for (let i = 0; i < index; i++)
32160
+ column += cells[i].colSpan;
32161
+ return this.blockStarts.has(column) ? " block-start" : "";
32162
+ }
32163
+ /** A grouped table that is no calculation scheme: its groups stand further apart. */
32164
+ groupedList() {
32165
+ return this.grouped === true && this.type !== withStyled.TableType.OPT && this.type !== withStyled.TableType.OPTNOTOTAL;
32166
+ }
32167
+ isBarColumn(key) {
32168
+ return this.barColumns.includes(key);
32169
+ }
32079
32170
  /** The classes of a number cell. A variance that prints as zero loses its sign and its sentiment color. */
32080
32171
  cellClass(cell, locale) {
32081
32172
  if (cell.direction === undefined || !cell.roundsToZero(this.componentDataFormatDigits, locale)) {
@@ -32327,7 +32418,9 @@ const BnTableRenderer = class {
32327
32418
  */
32328
32419
  connectorReach(row) {
32329
32420
  const emPx = this.emPx();
32330
- return { top: 0.1 * emPx, bottom: row.type === withStyled.TableRowType.SUM ? 0.5 * emPx : 0 };
32421
+ // tr.sum td { padding-bottom }, larger in a grouped list
32422
+ const sumPadding = this.groupedList() ? 1 : 0.5;
32423
+ return { top: 0.1 * emPx, bottom: row.type === withStyled.TableRowType.SUM ? sumPadding * emPx : 0 };
32331
32424
  }
32332
32425
  /**
32333
32426
  * Geometry of every waterfall column from the measured labels of all cells that draw a
@@ -190,6 +190,53 @@ td.share {
190
190
  font-style: italic;
191
191
  }
192
192
 
193
+ /* the header of a bar or pin column stands over the middle of the column */
194
+ th.barColumn {
195
+ text-align: center;
196
+ }
197
+
198
+ /* the first column of a block: a wider gap, in which no row line and no header line is drawn */
199
+ td.block-start,
200
+ th.block-start {
201
+ border-left: var(--bn-block-gap, 0) solid transparent;
202
+ clip-path: inset(-100em -100em -100em var(--bn-block-gap, 0));
203
+ }
204
+
205
+ .category-w100.block-start {
206
+ min-width: calc(100em + var(--bn-block-gap, 0px));
207
+ max-width: calc(100em + var(--bn-block-gap, 0px));
208
+ }
209
+
210
+ .category-w50.block-start {
211
+ min-width: calc(50em + var(--bn-block-gap, 0px));
212
+ max-width: calc(50em + var(--bn-block-gap, 0px));
213
+ }
214
+
215
+ .category-w25.block-start {
216
+ min-width: calc(25em + var(--bn-block-gap, 0px));
217
+ max-width: calc(25em + var(--bn-block-gap, 0px));
218
+ }
219
+
220
+ .category-w20.block-start {
221
+ min-width: calc(20em + var(--bn-block-gap, 0px));
222
+ max-width: calc(20em + var(--bn-block-gap, 0px));
223
+ }
224
+
225
+ .category-w15.block-start {
226
+ min-width: calc(15em + var(--bn-block-gap, 0px));
227
+ max-width: calc(15em + var(--bn-block-gap, 0px));
228
+ }
229
+
230
+ .category-w10.block-start {
231
+ min-width: calc(10em + var(--bn-block-gap, 0px));
232
+ max-width: calc(10em + var(--bn-block-gap, 0px));
233
+ }
234
+
235
+ .category-w5.block-start {
236
+ min-width: calc(5em + var(--bn-block-gap, 0px));
237
+ max-width: calc(5em + var(--bn-block-gap, 0px));
238
+ }
239
+
193
240
  th.filler {
194
241
  border-bottom: 0em solid black;
195
242
  text-align: right;
@@ -216,7 +263,6 @@ th.headerlabel {
216
263
  th.intervalGroup {
217
264
  border-bottom: 0.1em solid black;
218
265
  text-align: center;
219
- font-weight: bold;
220
266
  }
221
267
 
222
268
  td.variance:after {
@@ -312,6 +358,11 @@ tr.sum td {
312
358
  padding-bottom: 0.5em;
313
359
  }
314
360
 
361
+ /* the groups of a grouped list stand further apart than the results of a calculation scheme */
362
+ table.grouped-list tr.sum td {
363
+ padding-bottom: 1em;
364
+ }
365
+
315
366
  /* thereof rows printed above their parent: normal rows with an indented label, the parent closes them like a subtotal */
316
367
  tr.ofit-above td[class^=category] {
317
368
  padding-left: 1em;
@@ -322,6 +373,18 @@ tr.ofit-sum td {
322
373
  font-weight: bold;
323
374
  }
324
375
 
376
+ /* IBCS prints the variances of a result row in black */
377
+ tr.sum td.pos_pos,
378
+ tr.sum td.pos_neg,
379
+ tr.sum td.neg_pos,
380
+ tr.sum td.neg_neg,
381
+ tr.ofit-sum td.pos_pos,
382
+ tr.ofit-sum td.pos_neg,
383
+ tr.ofit-sum td.neg_pos,
384
+ tr.ofit-sum td.neg_neg {
385
+ color: inherit;
386
+ }
387
+
325
388
  tr.groupheader td {
326
389
  border-top: 0em dotted #ddd;
327
390
  padding-top: 0.5em;
@@ -345,7 +408,7 @@ th.end-group {
345
408
  td {
346
409
  box-sizing: border-box;
347
410
  -webkit-box-sizing: border-box;
348
- border-top: 0.1em dashed #ddd;
411
+ border-top: 0.1em solid #ddd;
349
412
  padding-left: 0.5em;
350
413
  white-space: nowrap;
351
414
  overflow: hidden;
@@ -18,6 +18,9 @@ import { sourceExpr } from "../../../context/scopedDb";
18
18
  import { absoluteBarGeometry, BAR_LABEL_FONT_RATIO, labelWidth, PIN_HEAD_SIZE, pinLabelsFit, relativePinGeometry, waterfallGeometry, } from "../utils/helper/barColumnGeometry";
19
19
  import { NOT_AVAILABLE } from "../../../utils/relativeVariance";
20
20
  import { normalizeFillPattern } from "../../../utils/model/styles/SVGStyle";
21
+ import { VarianceScenario } from "../../../utils/model/VarianceScenario";
22
+ /** Extra gap before the first column of a block, in table em. */
23
+ const BLOCK_GAP_EM = 0.6;
21
24
  /**
22
25
  * Internal rendering engine for `bn-table`.
23
26
  *
@@ -116,6 +119,7 @@ export class BnTableRenderer {
116
119
  /** @internal */
117
120
  this.scaleFactor = 1;
118
121
  this.componentDataFormatDigits = new DataFormatDigits();
122
+ this.blockStarts = new Set();
119
123
  this.barColumnLayouts = new Map();
120
124
  this.waterfallGeometries = new Map();
121
125
  // labels measured in the fallback font are too narrow or too wide once the web font is there: lay out again
@@ -251,9 +255,10 @@ export class BnTableRenderer {
251
255
  return h("div", { class: "empty-state" }, errorMsg);
252
256
  }
253
257
  const locale = (_d = (_c = (_b = this.stores) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.state) === null || _d === void 0 ? void 0 : _d.locale;
254
- 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", Object.assign({ class: row.cssStyle }, dataPointAttributes(row.key, "element")), row === null || row === void 0 ? void 0 : row.getCells().map((cell) => {
258
+ return (h("table", { class: { "grouped-list": this.groupedList() }, style: { "--bn-block-gap": `${BLOCK_GAP_EM * this.emPx()}px` } }, h("thead", null, this.table.getHeader().map((row) => (h("tr", { class: row.cssStyle }, row.getCells().map((cell, i, cells) => (h("th", { colSpan: cell.colSpan, class: `${cell.cssStyle}${this.isBarColumn(cell.key) ? " barColumn" : ""}${this.blockStartClass(cells, i)}` }, 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", Object.assign({ class: row.cssStyle }, dataPointAttributes(row.key, "element")), row === null || row === void 0 ? void 0 : row.getCells().map((cell, i, cells) => {
255
259
  var _a, _b, _c, _d, _e;
256
- return (h("td", Object.assign({ colSpan: cell.colSpan, class: cell.type ? `${this.cellClass(cell, locale)} ${cell.type}` : cell.cssStyle }, (row.key && cell.value != null && cell.value !== "" && cell.value !== "-"
260
+ return (h("td", Object.assign({ colSpan: cell.colSpan, class: (cell.type ? `${this.cellClass(cell, locale)} ${cell.type}` : cell.cssStyle) +
261
+ this.blockStartClass(cells, i) }, (row.key && cell.value != null && cell.value !== "" && cell.value !== "-"
257
262
  ? dataPointAttributes(Object.assign(Object.assign({}, row.key), { date: cell.date, scenario: cell.key }), "element")
258
263
  : {})), cell.prefix != null ? (h("span", { class: this.cellClass(cell, locale) + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
259
264
  cell.columnStats &&
@@ -317,10 +322,50 @@ export class BnTableRenderer {
317
322
  (_l = this.errors) === null || _l === void 0 ? void 0 : _l.remove(id);
318
323
  }
319
324
  }
325
+ this.blockStarts = this.collectBlockStarts();
320
326
  this.barColumnLayouts = this.collectBarColumnLayouts();
321
327
  this.waterfallGeometries = this.collectWaterfallGeometries();
322
328
  this.barChartStyles = this.prepareBarChartStyles();
323
329
  }
330
+ /**
331
+ * The columns that start a block: the row header, the scenarios of one interval bucket
332
+ * and each pair of variances are blocks. IBCS sets them apart by a wider gap.
333
+ */
334
+ collectBlockStarts() {
335
+ const starts = new Set();
336
+ if (!this.table || this.table.hasNoData())
337
+ return starts;
338
+ const blockOf = (column) => {
339
+ var _a;
340
+ const variance = new VarianceScenario(column.type);
341
+ const kind = variance.isValid
342
+ ? `${variance.base}_${variance.delta}`
343
+ : /^(ac|pp|fc|pl)\d/i.test(column.type)
344
+ ? "scenario"
345
+ : "rowheader";
346
+ return `${(_a = column.bucket) !== null && _a !== void 0 ? _a : ""}|${kind}`;
347
+ };
348
+ const blocks = this.table.getColumns().map(blockOf);
349
+ blocks.forEach((block, i) => {
350
+ if (i > 0 && block !== blocks[i - 1])
351
+ starts.add(i);
352
+ });
353
+ return starts;
354
+ }
355
+ /** " block-start" for the cell whose first column starts a block. A cell can span columns. */
356
+ blockStartClass(cells, index) {
357
+ let column = 0;
358
+ for (let i = 0; i < index; i++)
359
+ column += cells[i].colSpan;
360
+ return this.blockStarts.has(column) ? " block-start" : "";
361
+ }
362
+ /** A grouped table that is no calculation scheme: its groups stand further apart. */
363
+ groupedList() {
364
+ return this.grouped === true && this.type !== TableType.OPT && this.type !== TableType.OPTNOTOTAL;
365
+ }
366
+ isBarColumn(key) {
367
+ return this.barColumns.includes(key);
368
+ }
324
369
  /** The classes of a number cell. A variance that prints as zero loses its sign and its sentiment color. */
325
370
  cellClass(cell, locale) {
326
371
  if (cell.direction === undefined || !cell.roundsToZero(this.componentDataFormatDigits, locale)) {
@@ -572,7 +617,9 @@ export class BnTableRenderer {
572
617
  */
573
618
  connectorReach(row) {
574
619
  const emPx = this.emPx();
575
- return { top: 0.1 * emPx, bottom: row.type === TableRowType.SUM ? 0.5 * emPx : 0 };
620
+ // tr.sum td { padding-bottom }, larger in a grouped list
621
+ const sumPadding = this.groupedList() ? 1 : 0.5;
622
+ return { top: 0.1 * emPx, bottom: row.type === TableRowType.SUM ? sumPadding * emPx : 0 };
576
623
  }
577
624
  /**
578
625
  * Geometry of every waterfall column from the measured labels of all cells that draw a
@@ -1,7 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { Formatter } from "../../../../utils";
3
3
  import { VarianceScenario } from "../../../../utils/model/VarianceScenario";
4
- import { absoluteBarGeometry, BAR_LABEL_FONT_RATIO, labelWidth, PIN_HEAD_SIZE, relativePinGeometry, VARIANCE_AXIS_EM, } from "../helper/barColumnGeometry";
4
+ import { absoluteBarGeometry, BAR_LABEL_FONT_RATIO, barBox, labelWidth, PIN_HEAD_SIZE, relativePinGeometry, VARIANCE_AXIS_EM, } from "../helper/barColumnGeometry";
5
5
  /** Matches SYSTEM_STYLE_DEFAULTS.global.fontSizePx; only used when `styles` is omitted. */
6
6
  const DEFAULT_EM_PX = 13.3333;
7
7
  // Default fallback colors (should come from componentStyle)
@@ -36,23 +36,57 @@ const PIN_BAND_PAD = 0.2;
36
36
  function getPatternId(prefix, color) {
37
37
  return `pattern-${prefix}-${color.replace("#", "")}`;
38
38
  }
39
+ /** The hatching of a pin head: light lines on the dark colour of the scenario, as IBCS draws it. */
40
+ function getHeadPatternId(slot, color) {
41
+ return getPatternId(`head-${slot}`, color);
42
+ }
39
43
  /**
40
44
  * Renders SVG pattern definitions for hatched fills
41
45
  */
42
46
  export const PatternDefs = ({ styles }) => {
43
47
  const s = styles.scaleFactor;
44
- const patternSize = 6 * s;
48
+ const size = 3 * s;
45
49
  const patterns = [
46
- { id: getPatternId("pos", styles.positive.stroke), stroke: styles.positive.stroke, fill: styles.positive.fill },
47
- { id: getPatternId("neg", styles.negative.stroke), stroke: styles.negative.stroke, fill: styles.negative.fill },
48
- { id: getPatternId("neu", styles.neutral.stroke), stroke: styles.neutral.stroke, fill: styles.neutral.fill },
49
- ...["ac", "pp", "fc", "pl"].map((type) => ({
50
- id: getPatternId(type, styles.scenarios[type].stroke),
51
- stroke: styles.scenarios[type].stroke,
52
- fill: styles.scenarios[type].fill,
53
- })),
50
+ {
51
+ id: getPatternId("pos", styles.positive.stroke),
52
+ line: styles.positive.stroke,
53
+ background: "#ffffff",
54
+ lineWidth: 1,
55
+ },
56
+ {
57
+ id: getPatternId("neg", styles.negative.stroke),
58
+ line: styles.negative.stroke,
59
+ background: "#ffffff",
60
+ lineWidth: 1,
61
+ },
62
+ {
63
+ id: getPatternId("neu", styles.neutral.stroke),
64
+ line: styles.neutral.stroke,
65
+ background: "#ffffff",
66
+ lineWidth: 1,
67
+ },
68
+ ...["ac", "pp", "fc", "pl"].flatMap((type) => [
69
+ {
70
+ id: getPatternId(type, styles.scenarios[type].stroke),
71
+ line: styles.scenarios[type].stroke,
72
+ background: "#ffffff",
73
+ lineWidth: 1,
74
+ },
75
+ {
76
+ id: getHeadPatternId(type, styles.scenarios[type].stroke),
77
+ line: "#ffffff",
78
+ background: styles.scenarios[type].stroke,
79
+ lineWidth: 0.6,
80
+ },
81
+ ]),
82
+ ];
83
+ // the diagonal of the tile and its two ends in the next tiles, so the lines join without notches
84
+ const diagonals = [
85
+ [0, size, size, 0],
86
+ [-s, s, s, -s],
87
+ [size - s, size + s, size + s, size - s],
54
88
  ];
55
- return (h("defs", null, patterns.map((p) => (h("pattern", { id: p.id, patternUnits: "userSpaceOnUse", width: patternSize, height: patternSize }, h("rect", { width: patternSize, height: patternSize, fill: "#ffffff" }), h("line", { x1: "0", y1: patternSize, x2: patternSize, y2: "0", stroke: p.stroke, "stroke-width": 1.5 * s }))))));
89
+ return (h("defs", null, patterns.map((p) => (h("pattern", { id: p.id, patternUnits: "userSpaceOnUse", width: size, height: size }, h("rect", { width: size, height: size, fill: p.background }), diagonals.map(([x1, y1, x2, y2]) => (h("line", { x1: x1, y1: y1, x2: x2, y2: y2, stroke: p.line, "stroke-width": p.lineWidth * s }))))))));
56
90
  };
57
91
  /** Longest relative label that keeps all percent digits; a longer one drops digits so its gutter does not eat the pins. */
58
92
  const PIN_LABEL_CHARS = 7;
@@ -154,8 +188,10 @@ export const VarianceAxis = ({ x, height, look, styles }) => {
154
188
  const { reference, referenceSlot } = look;
155
189
  let lines;
156
190
  if (reference.fillpattern === "outlined") {
157
- const offset = width / 2 - 0.5 * s;
158
- lines = [x - offset, x + offset].map((lineX) => (h("line", { x1: lineX, y1: 0, x2: lineX, y2: height, stroke: reference.stroke, "stroke-width": 1 * s })));
191
+ // two lines with a gap of their width, together as wide as a solid axis
192
+ const lineWidth = width / 3;
193
+ const offset = (width - lineWidth) / 2;
194
+ lines = [x - offset, x + offset].map((lineX) => (h("line", { x1: lineX, y1: 0, x2: lineX, y2: height, stroke: reference.stroke, "stroke-width": lineWidth })));
159
195
  }
160
196
  else if (reference.fillpattern === "hatched") {
161
197
  lines = (h("line", { x1: x, y1: 0, x2: x, y2: height, stroke: reference.stroke, "stroke-width": width, "stroke-dasharray": `${2 * s}` }));
@@ -283,9 +319,7 @@ const AbsoluteVarianceBar = (props) => {
283
319
  const maxOverflow = Math.max(0, maxScaledWidth - cutWidth);
284
320
  const overflowAmount = Math.max(0, scaledWidth - cutWidth);
285
321
  const overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
286
- const padding = 2 * s;
287
- const barHeight = height - padding * 2;
288
- const barY = padding;
322
+ const { barY, barHeight } = barBox(height);
289
323
  // Get style based on column type (scenario vs variance)
290
324
  const look = getVarianceLook(scenario, styles);
291
325
  const sentimentStyle = getBarStyle(scenario, value, isPositiveGood, styles);
@@ -367,7 +401,11 @@ const RelativeVariancePin = (props) => {
367
401
  const labelX = labelOnShaft
368
402
  ? bandX + bandWidth / 2
369
403
  : (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 }), 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 })), h("line", { x1: axisX, y1: centerY, x2: isExtreme ? arrowBaseX : pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": PIN_LINE_WIDTH * 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" })), 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("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)));
404
+ return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, h(PatternDefs, { styles: styles }), 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"
405
+ ? "#ffffff"
406
+ : headStyle.fillpattern === "hatched"
407
+ ? `url(#${getHeadPatternId((_b = look === null || look === void 0 ? void 0 : look.minuendSlot) !== null && _b !== void 0 ? _b : "ac", headStyle.stroke)})`
408
+ : headStyle.fill, stroke: headStyle.stroke, "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 }), 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" })), 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("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)));
371
409
  };
372
410
  /**
373
411
  * CellBarChart - Renders IBCS-compliant variance bar charts.
@@ -1,6 +1,6 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { AXIS_COLOR, DEFAULT_STYLES, formatValue, getBarFill, getBarStroke, getBarStyle, getScenarioType, getVarianceLook, PatternDefs, VarianceAxis, } from "./CellBarChart";
3
- import { labelWidth, VARIANCE_AXIS_EM, waterfallGeometry } from "../helper/barColumnGeometry";
3
+ import { barBox, labelWidth, VARIANCE_AXIS_EM, waterfallGeometry, } from "../helper/barColumnGeometry";
4
4
  /**
5
5
  * Label text of a waterfall bar. Scenario values carry no variance sentiment: unsigned per
6
6
  * IBCS. A variance keeps its sign (`signed`).
@@ -42,9 +42,7 @@ export const WaterfallBar = (props) => {
42
42
  const { totalWidth, labelAreaLeft, barAreaWidth, labelGap } = geometry !== null && geometry !== void 0 ? geometry : waterfallGeometry(columnWidthEm, styles.emPx);
43
43
  const pxPerUnit = barAreaWidth / range;
44
44
  const xOf = (coordinate) => labelAreaLeft + (coordinate - waterfall.min) * pxPerUnit;
45
- const padding = 2 * s;
46
- const barHeight = height - padding * 2;
47
- const barY = padding;
45
+ const { barY, barHeight } = barBox(height);
48
46
  const axisX = xOf(0);
49
47
  const startX = xOf(waterfall.start);
50
48
  const endX = xOf(waterfall.end);
@@ -35,7 +35,14 @@ const OVERDRIVE_FRACTION = 0.15;
35
35
  /** Width of the axis of a variance bar or pin, in em: near the 0.3em scenario marker in the header. */
36
36
  export const VARIANCE_AXIS_EM = 0.25;
37
37
  /** Side of the square pin head, in px before scaleFactor. */
38
- export const PIN_HEAD_SIZE = 10;
38
+ export const PIN_HEAD_SIZE = 8;
39
+ /** Height of a bar in svg heights: IBCS leaves almost half the row free. */
40
+ const BAR_HEIGHT_RATIO = 0.6;
41
+ /** Top edge and height of a bar centred in an svg of the given height. */
42
+ export function barBox(height) {
43
+ const barHeight = height * BAR_HEIGHT_RATIO;
44
+ return { barY: (height - barHeight) / 2, barHeight };
45
+ }
39
46
  /**
40
47
  * Advance widths in em, the larger of Noto Sans and Arial. The engine ships no font, so a
41
48
  * wider fallback (DejaVu Sans, Verdana) is possible: LABEL_WIDTH_MARGIN and the cell
@@ -62,7 +62,11 @@ export function readTableBaseline(table, host) {
62
62
  const isRowHeader = (cell) => cell.classList.contains("category") || cell.classList.contains("operation");
63
63
  const valueCell = cells.some(isRowHeader) ? cells.find((cell) => !isRowHeader(cell)) : cells[1];
64
64
  if (valueCell) {
65
- baseline.x = round2(frame.toLocal(valueCell.getBoundingClientRect()).x);
65
+ // a block gap is a transparent left border: the column starts after it
66
+ const gap = valueCell.classList.contains("block-start") && typeof getComputedStyle === "function"
67
+ ? parseFloat(getComputedStyle(valueCell).borderLeftWidth) || 0
68
+ : 0;
69
+ baseline.x = round2(frame.toLocal(valueCell.getBoundingClientRect()).x + gap);
66
70
  }
67
71
  return baseline;
68
72
  }
@@ -1 +1 @@
1
- import{B as o,d as p}from"./p-DM4Up10X.js";const s=o,r=p;export{s as BnChartBubbleRenderer,r as defineCustomElement}
1
+ import{B as o,d as p}from"./p-DnDL1pPc.js";const s=o,r=p;export{s as BnChartBubbleRenderer,r as defineCustomElement}