@bino-bi/bn-template-engine 1.0.0-next.42 → 1.0.0-next.44
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.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/{p-3836531f.entry.js → p-3c4af59a.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +190 -64
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.css +74 -2
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +50 -3
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +55 -17
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +15 -5
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +2 -4
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +8 -6
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +50 -28
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +8 -1
- package/dist/collection/utils/layoutState/baseline.js +5 -1
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet-renderer.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/p-AwH1w8Mu.js +1 -0
- package/dist/components/p-B2bvM2Ig.js +1 -0
- package/dist/components/{p-CUSAlS2o.js → p-BfUdaxZ9.js} +1 -1
- package/dist/components/{p-ChaSU4fh.js → p-C2ycO60j.js} +1 -1
- package/dist/components/{p-chnyMHJT.js → p-CyfGkLMh.js} +1 -1
- package/dist/components/{p-DM4Up10X.js → p-DnDL1pPc.js} +1 -1
- package/dist/components/p-JofGXz75.js +1 -0
- package/dist/esm/bn-annotation-layer_30.entry.js +190 -64
- package/dist/types/components/bn-table/bn-table-renderer/bn-table-renderer.d.ts +11 -0
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +10 -0
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +6 -1
- package/package.json +1 -1
- package/dist/components/p-B2L2q2Ks.js +0 -1
- package/dist/components/p-Bn7J1pgl.js +0 -1
- 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
|
-
|
|
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
|
}
|
|
@@ -28374,12 +28378,21 @@ class TableRow {
|
|
|
28374
28378
|
cssStyle = cellStyle !== null && cellStyle !== void 0 ? cellStyle : scenario;
|
|
28375
28379
|
}
|
|
28376
28380
|
if (this.type === withStyled.TableRowType.PARTELEMENT) {
|
|
28377
|
-
|
|
28378
|
-
|
|
28381
|
+
const variance = new VarianceScenario(scenario);
|
|
28382
|
+
if (variance.isValid && Number.isFinite(value)) {
|
|
28383
|
+
// the change of a share: percentage points, or the relative change in percent. It has no sentiment
|
|
28384
|
+
cellType = variance.type === "d" ? "percentpoint" : "percent";
|
|
28385
|
+
cssStyle = (cellStyle !== null && cellStyle !== void 0 ? cellStyle : "").replace(/^(pos|neg)_\w+/, "$1_neu");
|
|
28379
28386
|
}
|
|
28380
|
-
|
|
28381
|
-
|
|
28382
|
-
|
|
28387
|
+
else {
|
|
28388
|
+
// a share without a total has no change either
|
|
28389
|
+
if (cellType === "percent" || variance.isValid) {
|
|
28390
|
+
value = "-";
|
|
28391
|
+
}
|
|
28392
|
+
if (scenario !== "category" && scenario !== "operation") {
|
|
28393
|
+
cellType = "percent";
|
|
28394
|
+
cssStyle = "";
|
|
28395
|
+
}
|
|
28383
28396
|
}
|
|
28384
28397
|
}
|
|
28385
28398
|
if (value === "-" || (value === withStyled.NOT_AVAILABLE && cellType === "percent")) {
|
|
@@ -28437,7 +28450,14 @@ const OVERDRIVE_FRACTION = 0.15;
|
|
|
28437
28450
|
/** Width of the axis of a variance bar or pin, in em: near the 0.3em scenario marker in the header. */
|
|
28438
28451
|
const VARIANCE_AXIS_EM = 0.25;
|
|
28439
28452
|
/** Side of the square pin head, in px before scaleFactor. */
|
|
28440
|
-
const PIN_HEAD_SIZE =
|
|
28453
|
+
const PIN_HEAD_SIZE = 8;
|
|
28454
|
+
/** Height of a bar in svg heights: IBCS leaves almost half the row free. */
|
|
28455
|
+
const BAR_HEIGHT_RATIO = 0.6;
|
|
28456
|
+
/** Top edge and height of a bar centred in an svg of the given height. */
|
|
28457
|
+
function barBox(height) {
|
|
28458
|
+
const barHeight = height * BAR_HEIGHT_RATIO;
|
|
28459
|
+
return { barY: (height - barHeight) / 2, barHeight };
|
|
28460
|
+
}
|
|
28441
28461
|
/**
|
|
28442
28462
|
* Advance widths in em, the larger of Noto Sans and Arial. The engine ships no font, so a
|
|
28443
28463
|
* wider fallback (DejaVu Sans, Verdana) is possible: LABEL_WIDTH_MARGIN and the cell
|
|
@@ -28710,23 +28730,57 @@ const PIN_BAND_PAD = 0.2;
|
|
|
28710
28730
|
function getPatternId(prefix, color) {
|
|
28711
28731
|
return `pattern-${prefix}-${color.replace("#", "")}`;
|
|
28712
28732
|
}
|
|
28733
|
+
/** The hatching of a pin head: light lines on the dark colour of the scenario, as IBCS draws it. */
|
|
28734
|
+
function getHeadPatternId(slot, color) {
|
|
28735
|
+
return getPatternId(`head-${slot}`, color);
|
|
28736
|
+
}
|
|
28713
28737
|
/**
|
|
28714
28738
|
* Renders SVG pattern definitions for hatched fills
|
|
28715
28739
|
*/
|
|
28716
28740
|
const PatternDefs = ({ styles }) => {
|
|
28717
28741
|
const s = styles.scaleFactor;
|
|
28718
|
-
const
|
|
28742
|
+
const size = 3 * s;
|
|
28719
28743
|
const patterns = [
|
|
28720
|
-
{
|
|
28721
|
-
|
|
28722
|
-
|
|
28723
|
-
|
|
28724
|
-
|
|
28725
|
-
|
|
28726
|
-
|
|
28727
|
-
|
|
28744
|
+
{
|
|
28745
|
+
id: getPatternId("pos", styles.positive.stroke),
|
|
28746
|
+
line: styles.positive.stroke,
|
|
28747
|
+
background: "#ffffff",
|
|
28748
|
+
lineWidth: 1,
|
|
28749
|
+
},
|
|
28750
|
+
{
|
|
28751
|
+
id: getPatternId("neg", styles.negative.stroke),
|
|
28752
|
+
line: styles.negative.stroke,
|
|
28753
|
+
background: "#ffffff",
|
|
28754
|
+
lineWidth: 1,
|
|
28755
|
+
},
|
|
28756
|
+
{
|
|
28757
|
+
id: getPatternId("neu", styles.neutral.stroke),
|
|
28758
|
+
line: styles.neutral.stroke,
|
|
28759
|
+
background: "#ffffff",
|
|
28760
|
+
lineWidth: 1,
|
|
28761
|
+
},
|
|
28762
|
+
...["ac", "pp", "fc", "pl"].flatMap((type) => [
|
|
28763
|
+
{
|
|
28764
|
+
id: getPatternId(type, styles.scenarios[type].stroke),
|
|
28765
|
+
line: styles.scenarios[type].stroke,
|
|
28766
|
+
background: "#ffffff",
|
|
28767
|
+
lineWidth: 1,
|
|
28768
|
+
},
|
|
28769
|
+
{
|
|
28770
|
+
id: getHeadPatternId(type, styles.scenarios[type].stroke),
|
|
28771
|
+
line: "#ffffff",
|
|
28772
|
+
background: styles.scenarios[type].stroke,
|
|
28773
|
+
lineWidth: 0.6,
|
|
28774
|
+
},
|
|
28775
|
+
]),
|
|
28776
|
+
];
|
|
28777
|
+
// the diagonal of the tile and its two ends in the next tiles, so the lines join without notches
|
|
28778
|
+
const diagonals = [
|
|
28779
|
+
[0, size, size, 0],
|
|
28780
|
+
[-s, s, s, -s],
|
|
28781
|
+
[size - s, size + s, size + s, size - s],
|
|
28728
28782
|
];
|
|
28729
|
-
return (index.h("defs", null, patterns.map((p) => (index.h("pattern", { id: p.id, patternUnits: "userSpaceOnUse", width:
|
|
28783
|
+
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
28784
|
};
|
|
28731
28785
|
/** Longest relative label that keeps all percent digits; a longer one drops digits so its gutter does not eat the pins. */
|
|
28732
28786
|
const PIN_LABEL_CHARS = 7;
|
|
@@ -28828,8 +28882,10 @@ const VarianceAxis = ({ x, height, look, styles }) => {
|
|
|
28828
28882
|
const { reference, referenceSlot } = look;
|
|
28829
28883
|
let lines;
|
|
28830
28884
|
if (reference.fillpattern === "outlined") {
|
|
28831
|
-
|
|
28832
|
-
|
|
28885
|
+
// two lines with a gap of their width, together as wide as a solid axis
|
|
28886
|
+
const lineWidth = width / 3;
|
|
28887
|
+
const offset = (width - lineWidth) / 2;
|
|
28888
|
+
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
28889
|
}
|
|
28834
28890
|
else if (reference.fillpattern === "hatched") {
|
|
28835
28891
|
lines = (index.h("line", { x1: x, y1: 0, x2: x, y2: height, stroke: reference.stroke, "stroke-width": width, "stroke-dasharray": `${2 * s}` }));
|
|
@@ -28957,9 +29013,7 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
28957
29013
|
const maxOverflow = Math.max(0, maxScaledWidth - cutWidth);
|
|
28958
29014
|
const overflowAmount = Math.max(0, scaledWidth - cutWidth);
|
|
28959
29015
|
const overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
|
|
28960
|
-
const
|
|
28961
|
-
const barHeight = height - padding * 2;
|
|
28962
|
-
const barY = padding;
|
|
29016
|
+
const { barY, barHeight } = barBox(height);
|
|
28963
29017
|
// Get style based on column type (scenario vs variance)
|
|
28964
29018
|
const look = getVarianceLook(scenario, styles);
|
|
28965
29019
|
const sentimentStyle = getBarStyle(scenario, value, isPositiveGood, styles);
|
|
@@ -29041,7 +29095,11 @@ const RelativeVariancePin = (props) => {
|
|
|
29041
29095
|
const labelX = labelOnShaft
|
|
29042
29096
|
? bandX + bandWidth / 2
|
|
29043
29097
|
: (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"
|
|
29098
|
+
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"
|
|
29099
|
+
? "#ffffff"
|
|
29100
|
+
: headStyle.fillpattern === "hatched"
|
|
29101
|
+
? `url(#${getHeadPatternId((_b = look === null || look === void 0 ? void 0 : look.minuendSlot) !== null && _b !== void 0 ? _b : "ac", headStyle.stroke)})`
|
|
29102
|
+
: 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
29103
|
};
|
|
29046
29104
|
/**
|
|
29047
29105
|
* CellBarChart - Renders IBCS-compliant variance bar charts.
|
|
@@ -29104,9 +29162,7 @@ const WaterfallBar = (props) => {
|
|
|
29104
29162
|
const { totalWidth, labelAreaLeft, barAreaWidth, labelGap } = geometry !== null && geometry !== void 0 ? geometry : waterfallGeometry(columnWidthEm, styles.emPx);
|
|
29105
29163
|
const pxPerUnit = barAreaWidth / range;
|
|
29106
29164
|
const xOf = (coordinate) => labelAreaLeft + (coordinate - waterfall.min) * pxPerUnit;
|
|
29107
|
-
const
|
|
29108
|
-
const barHeight = height - padding * 2;
|
|
29109
|
-
const barY = padding;
|
|
29165
|
+
const { barY, barHeight } = barBox(height);
|
|
29110
29166
|
const axisX = xOf(0);
|
|
29111
29167
|
const startX = xOf(waterfall.start);
|
|
29112
29168
|
const endX = xOf(waterfall.end);
|
|
@@ -29521,12 +29577,8 @@ class DataQuery {
|
|
|
29521
29577
|
const queries = [];
|
|
29522
29578
|
const sumGroupQueries = [];
|
|
29523
29579
|
const res = [];
|
|
29524
|
-
const scenarios = this.
|
|
29525
|
-
|
|
29526
|
-
.toString();
|
|
29527
|
-
const scenariosSUMQuery = this.config.scenarios
|
|
29528
|
-
.map((s) => this.translateScenarioSQL(s, true, this.config.type))
|
|
29529
|
-
.toString();
|
|
29580
|
+
const scenarios = this.scenariosSQL(false);
|
|
29581
|
+
const scenariosSUMQuery = this.scenariosSQL(true);
|
|
29530
29582
|
const relativeScenarios = this.getRelativeScenarios();
|
|
29531
29583
|
const attributesSQL = this.config.attributes.map((attribute) => this.translateAttributeSQL(attribute)).toString();
|
|
29532
29584
|
const groups = new QueryGroups(this.config);
|
|
@@ -29642,7 +29694,8 @@ class DataQuery {
|
|
|
29642
29694
|
drillQueries.forEach((query) => {
|
|
29643
29695
|
resDrill.push(...this.exec(query));
|
|
29644
29696
|
});
|
|
29645
|
-
|
|
29697
|
+
// two relative variances on one reference name its dr_* alias twice
|
|
29698
|
+
const scenarioNames = [...new Set(this.exctractScenarioNames(scenarios))];
|
|
29646
29699
|
const rowGroupSumResultRows = [];
|
|
29647
29700
|
sumGroupQueries.forEach(function (query) {
|
|
29648
29701
|
rowGroupSumResultRows.push(...db.exec(query, params));
|
|
@@ -29650,21 +29703,29 @@ class DataQuery {
|
|
|
29650
29703
|
const rowGroupSumResultMap = new Map();
|
|
29651
29704
|
rowGroupSumResultRows.forEach((row) => rowGroupSumResultMap.set(row[QueryColumnNames.ROWGROUP], row));
|
|
29652
29705
|
resDrill = this.reduceResDrillByCategoryGroups(resDrill, scenarioNames);
|
|
29653
|
-
resDrill.forEach(
|
|
29654
|
-
|
|
29655
|
-
try {
|
|
29656
|
-
drillItem[key] =
|
|
29657
|
-
drillItem[key] /
|
|
29658
|
-
rowGroupSumResultMap.get(drillItem[QueryColumnNames.ROWGROUP])[key];
|
|
29659
|
-
}
|
|
29660
|
-
catch (err) {
|
|
29661
|
-
console.error("DataQuery: partOf drill row calculation failed", key, err);
|
|
29662
|
-
drillItem[key] = Number.NaN;
|
|
29663
|
-
}
|
|
29664
|
-
});
|
|
29706
|
+
resDrill.forEach((drillItem) => {
|
|
29707
|
+
this.toShares(drillItem, rowGroupSumResultMap.get(drillItem[QueryColumnNames.ROWGROUP]), scenarioNames);
|
|
29665
29708
|
});
|
|
29666
29709
|
this.injectDrillRowsToResultRows(resDrill, res);
|
|
29667
29710
|
}
|
|
29711
|
+
/**
|
|
29712
|
+
* Turns the values of a partof row into shares of its total. A variance becomes the change of the
|
|
29713
|
+
* share (percentage points), not the share of the variance.
|
|
29714
|
+
*/
|
|
29715
|
+
toShares(part, totals, names) {
|
|
29716
|
+
var _a;
|
|
29717
|
+
const share = (key) => part[key] / (totals ? totals[key] : Number.NaN);
|
|
29718
|
+
const changes = new Map();
|
|
29719
|
+
for (const name of names) {
|
|
29720
|
+
const variance = new VarianceScenario(name);
|
|
29721
|
+
if (variance.isValid) {
|
|
29722
|
+
changes.set(name, share(variance.base) - share(variance.delta));
|
|
29723
|
+
}
|
|
29724
|
+
}
|
|
29725
|
+
for (const name of names) {
|
|
29726
|
+
part[name] = (_a = changes.get(name)) !== null && _a !== void 0 ? _a : share(name);
|
|
29727
|
+
}
|
|
29728
|
+
}
|
|
29668
29729
|
/**
|
|
29669
29730
|
* Generates a REST row that aggregates all data rows beyond the configured limit.
|
|
29670
29731
|
* Only emitted when a limit is set and the group has more rows than the limit.
|
|
@@ -30020,12 +30081,8 @@ class DataQuery {
|
|
|
30020
30081
|
}
|
|
30021
30082
|
const separator = "##";
|
|
30022
30083
|
const bucketSource = `(SELECT *, ${intervalBucketSQL(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`;
|
|
30023
|
-
const scenarios = this.
|
|
30024
|
-
|
|
30025
|
-
.toString();
|
|
30026
|
-
const scenariosSUMQuery = this.config.scenarios
|
|
30027
|
-
.map((s) => this.translateScenarioSQL(s, true, this.config.type))
|
|
30028
|
-
.toString();
|
|
30084
|
+
const scenarios = this.scenariosSQL(false);
|
|
30085
|
+
const scenariosSUMQuery = this.scenariosSQL(true);
|
|
30029
30086
|
// two relative variances on one reference name its dr_* alias twice, it must be summed once
|
|
30030
30087
|
const entryAliases = [...new Set(this.exctractScenarioNames(scenarios))];
|
|
30031
30088
|
const relativeScenarios = this.getRelativeScenarios();
|
|
@@ -30251,9 +30308,7 @@ class DataQuery {
|
|
|
30251
30308
|
const totals = this.config.grouped
|
|
30252
30309
|
? groupTotalsByKey.get(`${partRow.rowGroup}${separator}${bucketKey}`)
|
|
30253
30310
|
: sumTotalsByBucket.get(bucketKey);
|
|
30254
|
-
|
|
30255
|
-
partRow[alias] = partRow[alias] / (totals ? totals[alias] : Number.NaN);
|
|
30256
|
-
}
|
|
30311
|
+
this.toShares(partRow, totals, entryAliases);
|
|
30257
30312
|
finalizeBucketRow(partRow);
|
|
30258
30313
|
for (const segment of res) {
|
|
30259
30314
|
for (const row of segment) {
|
|
@@ -30282,6 +30337,29 @@ class DataQuery {
|
|
|
30282
30337
|
}
|
|
30283
30338
|
return whereClause + `)`;
|
|
30284
30339
|
}
|
|
30340
|
+
/**
|
|
30341
|
+
* The select list of the scenarios. A partof row needs both sides of every variance, also when they
|
|
30342
|
+
* are not shown. Those come without their `_cnt`, so the NaN detection of the other rows does not change.
|
|
30343
|
+
*/
|
|
30344
|
+
scenariosSQL(isSumRow) {
|
|
30345
|
+
const shown = this.config.scenarios;
|
|
30346
|
+
const sql = shown.map((s) => this.translateScenarioSQL(s, isSumRow, this.config.type));
|
|
30347
|
+
if (this.checkConfigForPartOf() && this.config.type !== withStyled.TableType.LIST) {
|
|
30348
|
+
const hidden = new Set();
|
|
30349
|
+
for (const scenario of shown) {
|
|
30350
|
+
const variance = new VarianceScenario(scenario);
|
|
30351
|
+
if (variance.isValid) {
|
|
30352
|
+
hidden.add(variance.base).add(variance.delta);
|
|
30353
|
+
}
|
|
30354
|
+
}
|
|
30355
|
+
for (const scenario of hidden) {
|
|
30356
|
+
if (!shown.includes(scenario)) {
|
|
30357
|
+
sql.push(this.translateScenarioSQL(scenario, isSumRow, this.config.type).split(", COUNT(")[0]);
|
|
30358
|
+
}
|
|
30359
|
+
}
|
|
30360
|
+
}
|
|
30361
|
+
return sql.toString();
|
|
30362
|
+
}
|
|
30285
30363
|
/** Collects all relative variance scenarios and maps each to its denominator column name. */
|
|
30286
30364
|
getRelativeScenarios() {
|
|
30287
30365
|
const relativeScenarios = new Map();
|
|
@@ -31030,13 +31108,15 @@ class TableDataSetFactory {
|
|
|
31030
31108
|
scenario.name === scenario.type
|
|
31031
31109
|
? waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.get(rawDataRow, scenario.type)
|
|
31032
31110
|
: undefined;
|
|
31033
|
-
|
|
31034
|
-
|
|
31035
|
-
|
|
31036
|
-
new VarianceScenario(scenario.type).isValid &&
|
|
31037
|
-
(waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.has(scenario.type)));
|
|
31111
|
+
const isShareChange = type === withStyled.TableRowType.PARTELEMENT && new VarianceScenario(scenario.type).isValid;
|
|
31112
|
+
// the change of a share is in percentage points, it has no place on the axis of the column
|
|
31113
|
+
const isBarChart = isBarColumn && !isShareChange;
|
|
31038
31114
|
const columnStats = isBarChart ? columnStatsMap === null || columnStatsMap === void 0 ? void 0 : columnStatsMap.get(scenario.type) : undefined;
|
|
31039
|
-
detailsRow.createElement(
|
|
31115
|
+
detailsRow.createElement(
|
|
31116
|
+
// percent values have no share, so there is no change of a share either
|
|
31117
|
+
isShareChange && scenariosUnitType === withStyled.DataFormat.PERCENT
|
|
31118
|
+
? "-"
|
|
31119
|
+
: this.translateSumCellLabel(i18nMode, i18n, value, groupName, subCategory, type, scenario.type), scenario.type, this.createColumnType(scenario), this.setCellType(scenario.type, scenariosUnitType), moved ? null : this.translateCellPrefix(i18n, type, scenario.type), this.translateScenarioCSS(scenario.type, value, operation), isSecondElement, categoryWidth, measureScale === null || measureScale === void 0 ? void 0 : measureScale.value, isBarChart, columnStats, 1, waterfall);
|
|
31040
31120
|
const cell = detailsRow.elements[detailsRow.elements.length - 1];
|
|
31041
31121
|
if (this.dateBuckets && scenario.bucket !== undefined) {
|
|
31042
31122
|
cell.date = pointDate(scenario.bucket);
|
|
@@ -31780,8 +31860,10 @@ class TableDrillGroupAdapter {
|
|
|
31780
31860
|
}
|
|
31781
31861
|
}
|
|
31782
31862
|
|
|
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
|
|
31863
|
+
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}tr.partof td.percentpoint{font-style:italic}tr.partof td.percentpoint:after{content:"%p"}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
31864
|
|
|
31865
|
+
/** Extra gap before the first column of a block, in table em. */
|
|
31866
|
+
const BLOCK_GAP_EM = 0.6;
|
|
31785
31867
|
const BnTableRenderer = class {
|
|
31786
31868
|
constructor(hostRef) {
|
|
31787
31869
|
index.registerInstance(this, hostRef);
|
|
@@ -31871,6 +31953,7 @@ const BnTableRenderer = class {
|
|
|
31871
31953
|
/** @internal */
|
|
31872
31954
|
this.scaleFactor = 1;
|
|
31873
31955
|
this.componentDataFormatDigits = new DataFormatDigits();
|
|
31956
|
+
this.blockStarts = new Set();
|
|
31874
31957
|
this.barColumnLayouts = new Map();
|
|
31875
31958
|
this.waterfallGeometries = new Map();
|
|
31876
31959
|
// labels measured in the fallback font are too narrow or too wide once the web font is there: lay out again
|
|
@@ -32006,9 +32089,10 @@ const BnTableRenderer = class {
|
|
|
32006
32089
|
return index.h("div", { class: "empty-state" }, errorMsg);
|
|
32007
32090
|
}
|
|
32008
32091
|
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",
|
|
32092
|
+
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
32093
|
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
|
|
32094
|
+
return (index.h("td", Object.assign({ colSpan: cell.colSpan, class: (cell.type ? `${this.cellClass(cell, locale)} ${cell.type}` : cell.cssStyle) +
|
|
32095
|
+
this.blockStartClass(cells, i) }, (row.key && cell.value != null && cell.value !== "" && cell.value !== "-"
|
|
32012
32096
|
? dataPointAttributes(Object.assign(Object.assign({}, row.key), { date: cell.date, scenario: cell.key }), "element")
|
|
32013
32097
|
: {})), cell.prefix != null ? (index.h("span", { class: this.cellClass(cell, locale) + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
|
|
32014
32098
|
cell.columnStats &&
|
|
@@ -32072,10 +32156,50 @@ const BnTableRenderer = class {
|
|
|
32072
32156
|
(_l = this.errors) === null || _l === void 0 ? void 0 : _l.remove(id);
|
|
32073
32157
|
}
|
|
32074
32158
|
}
|
|
32159
|
+
this.blockStarts = this.collectBlockStarts();
|
|
32075
32160
|
this.barColumnLayouts = this.collectBarColumnLayouts();
|
|
32076
32161
|
this.waterfallGeometries = this.collectWaterfallGeometries();
|
|
32077
32162
|
this.barChartStyles = this.prepareBarChartStyles();
|
|
32078
32163
|
}
|
|
32164
|
+
/**
|
|
32165
|
+
* The columns that start a block: the row header, the scenarios of one interval bucket
|
|
32166
|
+
* and each pair of variances are blocks. IBCS sets them apart by a wider gap.
|
|
32167
|
+
*/
|
|
32168
|
+
collectBlockStarts() {
|
|
32169
|
+
const starts = new Set();
|
|
32170
|
+
if (!this.table || this.table.hasNoData())
|
|
32171
|
+
return starts;
|
|
32172
|
+
const blockOf = (column) => {
|
|
32173
|
+
var _a;
|
|
32174
|
+
const variance = new VarianceScenario(column.type);
|
|
32175
|
+
const kind = variance.isValid
|
|
32176
|
+
? `${variance.base}_${variance.delta}`
|
|
32177
|
+
: /^(ac|pp|fc|pl)\d/i.test(column.type)
|
|
32178
|
+
? "scenario"
|
|
32179
|
+
: "rowheader";
|
|
32180
|
+
return `${(_a = column.bucket) !== null && _a !== void 0 ? _a : ""}|${kind}`;
|
|
32181
|
+
};
|
|
32182
|
+
const blocks = this.table.getColumns().map(blockOf);
|
|
32183
|
+
blocks.forEach((block, i) => {
|
|
32184
|
+
if (i > 0 && block !== blocks[i - 1])
|
|
32185
|
+
starts.add(i);
|
|
32186
|
+
});
|
|
32187
|
+
return starts;
|
|
32188
|
+
}
|
|
32189
|
+
/** " block-start" for the cell whose first column starts a block. A cell can span columns. */
|
|
32190
|
+
blockStartClass(cells, index) {
|
|
32191
|
+
let column = 0;
|
|
32192
|
+
for (let i = 0; i < index; i++)
|
|
32193
|
+
column += cells[i].colSpan;
|
|
32194
|
+
return this.blockStarts.has(column) ? " block-start" : "";
|
|
32195
|
+
}
|
|
32196
|
+
/** A grouped table that is no calculation scheme: its groups stand further apart. */
|
|
32197
|
+
groupedList() {
|
|
32198
|
+
return this.grouped === true && this.type !== withStyled.TableType.OPT && this.type !== withStyled.TableType.OPTNOTOTAL;
|
|
32199
|
+
}
|
|
32200
|
+
isBarColumn(key) {
|
|
32201
|
+
return this.barColumns.includes(key);
|
|
32202
|
+
}
|
|
32079
32203
|
/** The classes of a number cell. A variance that prints as zero loses its sign and its sentiment color. */
|
|
32080
32204
|
cellClass(cell, locale) {
|
|
32081
32205
|
if (cell.direction === undefined || !cell.roundsToZero(this.componentDataFormatDigits, locale)) {
|
|
@@ -32327,7 +32451,9 @@ const BnTableRenderer = class {
|
|
|
32327
32451
|
*/
|
|
32328
32452
|
connectorReach(row) {
|
|
32329
32453
|
const emPx = this.emPx();
|
|
32330
|
-
|
|
32454
|
+
// tr.sum td { padding-bottom }, larger in a grouped list
|
|
32455
|
+
const sumPadding = this.groupedList() ? 1 : 0.5;
|
|
32456
|
+
return { top: 0.1 * emPx, bottom: row.type === withStyled.TableRowType.SUM ? sumPadding * emPx : 0 };
|
|
32331
32457
|
}
|
|
32332
32458
|
/**
|
|
32333
32459
|
* Geometry of every waterfall column from the measured labels of all cells that draw a
|
|
@@ -183,6 +183,15 @@ tr.share td {
|
|
|
183
183
|
border-top: 0em solid black;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
/* the variance of a partof row is a change of the share, in percentage points */
|
|
187
|
+
tr.partof td.percentpoint {
|
|
188
|
+
font-style: italic;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
tr.partof td.percentpoint:after {
|
|
192
|
+
content: "%p";
|
|
193
|
+
}
|
|
194
|
+
|
|
186
195
|
th.share,
|
|
187
196
|
tr.share,
|
|
188
197
|
td.share {
|
|
@@ -190,6 +199,53 @@ td.share {
|
|
|
190
199
|
font-style: italic;
|
|
191
200
|
}
|
|
192
201
|
|
|
202
|
+
/* the header of a bar or pin column stands over the middle of the column */
|
|
203
|
+
th.barColumn {
|
|
204
|
+
text-align: center;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* the first column of a block: a wider gap, in which no row line and no header line is drawn */
|
|
208
|
+
td.block-start,
|
|
209
|
+
th.block-start {
|
|
210
|
+
border-left: var(--bn-block-gap, 0) solid transparent;
|
|
211
|
+
clip-path: inset(-100em -100em -100em var(--bn-block-gap, 0));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.category-w100.block-start {
|
|
215
|
+
min-width: calc(100em + var(--bn-block-gap, 0px));
|
|
216
|
+
max-width: calc(100em + var(--bn-block-gap, 0px));
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.category-w50.block-start {
|
|
220
|
+
min-width: calc(50em + var(--bn-block-gap, 0px));
|
|
221
|
+
max-width: calc(50em + var(--bn-block-gap, 0px));
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.category-w25.block-start {
|
|
225
|
+
min-width: calc(25em + var(--bn-block-gap, 0px));
|
|
226
|
+
max-width: calc(25em + var(--bn-block-gap, 0px));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.category-w20.block-start {
|
|
230
|
+
min-width: calc(20em + var(--bn-block-gap, 0px));
|
|
231
|
+
max-width: calc(20em + var(--bn-block-gap, 0px));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.category-w15.block-start {
|
|
235
|
+
min-width: calc(15em + var(--bn-block-gap, 0px));
|
|
236
|
+
max-width: calc(15em + var(--bn-block-gap, 0px));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.category-w10.block-start {
|
|
240
|
+
min-width: calc(10em + var(--bn-block-gap, 0px));
|
|
241
|
+
max-width: calc(10em + var(--bn-block-gap, 0px));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.category-w5.block-start {
|
|
245
|
+
min-width: calc(5em + var(--bn-block-gap, 0px));
|
|
246
|
+
max-width: calc(5em + var(--bn-block-gap, 0px));
|
|
247
|
+
}
|
|
248
|
+
|
|
193
249
|
th.filler {
|
|
194
250
|
border-bottom: 0em solid black;
|
|
195
251
|
text-align: right;
|
|
@@ -216,7 +272,6 @@ th.headerlabel {
|
|
|
216
272
|
th.intervalGroup {
|
|
217
273
|
border-bottom: 0.1em solid black;
|
|
218
274
|
text-align: center;
|
|
219
|
-
font-weight: bold;
|
|
220
275
|
}
|
|
221
276
|
|
|
222
277
|
td.variance:after {
|
|
@@ -312,6 +367,11 @@ tr.sum td {
|
|
|
312
367
|
padding-bottom: 0.5em;
|
|
313
368
|
}
|
|
314
369
|
|
|
370
|
+
/* the groups of a grouped list stand further apart than the results of a calculation scheme */
|
|
371
|
+
table.grouped-list tr.sum td {
|
|
372
|
+
padding-bottom: 1em;
|
|
373
|
+
}
|
|
374
|
+
|
|
315
375
|
/* thereof rows printed above their parent: normal rows with an indented label, the parent closes them like a subtotal */
|
|
316
376
|
tr.ofit-above td[class^=category] {
|
|
317
377
|
padding-left: 1em;
|
|
@@ -322,6 +382,18 @@ tr.ofit-sum td {
|
|
|
322
382
|
font-weight: bold;
|
|
323
383
|
}
|
|
324
384
|
|
|
385
|
+
/* IBCS prints the variances of a result row in black */
|
|
386
|
+
tr.sum td.pos_pos,
|
|
387
|
+
tr.sum td.pos_neg,
|
|
388
|
+
tr.sum td.neg_pos,
|
|
389
|
+
tr.sum td.neg_neg,
|
|
390
|
+
tr.ofit-sum td.pos_pos,
|
|
391
|
+
tr.ofit-sum td.pos_neg,
|
|
392
|
+
tr.ofit-sum td.neg_pos,
|
|
393
|
+
tr.ofit-sum td.neg_neg {
|
|
394
|
+
color: inherit;
|
|
395
|
+
}
|
|
396
|
+
|
|
325
397
|
tr.groupheader td {
|
|
326
398
|
border-top: 0em dotted #ddd;
|
|
327
399
|
padding-top: 0.5em;
|
|
@@ -345,7 +417,7 @@ th.end-group {
|
|
|
345
417
|
td {
|
|
346
418
|
box-sizing: border-box;
|
|
347
419
|
-webkit-box-sizing: border-box;
|
|
348
|
-
border-top: 0.1em
|
|
420
|
+
border-top: 0.1em solid #ddd;
|
|
349
421
|
padding-left: 0.5em;
|
|
350
422
|
white-space: nowrap;
|
|
351
423
|
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",
|
|
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
|
|
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
|
-
|
|
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
|