@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
|
@@ -831,7 +831,11 @@ function readTableBaseline(table, host) {
|
|
|
831
831
|
const isRowHeader = (cell) => cell.classList.contains("category") || cell.classList.contains("operation");
|
|
832
832
|
const valueCell = cells.some(isRowHeader) ? cells.find((cell) => !isRowHeader(cell)) : cells[1];
|
|
833
833
|
if (valueCell) {
|
|
834
|
-
|
|
834
|
+
// a block gap is a transparent left border: the column starts after it
|
|
835
|
+
const gap = valueCell.classList.contains("block-start") && typeof getComputedStyle === "function"
|
|
836
|
+
? parseFloat(getComputedStyle(valueCell).borderLeftWidth) || 0
|
|
837
|
+
: 0;
|
|
838
|
+
baseline.x = round2(frame.toLocal(valueCell.getBoundingClientRect()).x + gap);
|
|
835
839
|
}
|
|
836
840
|
return baseline;
|
|
837
841
|
}
|
|
@@ -28372,12 +28376,21 @@ class TableRow {
|
|
|
28372
28376
|
cssStyle = cellStyle !== null && cellStyle !== void 0 ? cellStyle : scenario;
|
|
28373
28377
|
}
|
|
28374
28378
|
if (this.type === TableRowType.PARTELEMENT) {
|
|
28375
|
-
|
|
28376
|
-
|
|
28379
|
+
const variance = new VarianceScenario(scenario);
|
|
28380
|
+
if (variance.isValid && Number.isFinite(value)) {
|
|
28381
|
+
// the change of a share: percentage points, or the relative change in percent. It has no sentiment
|
|
28382
|
+
cellType = variance.type === "d" ? "percentpoint" : "percent";
|
|
28383
|
+
cssStyle = (cellStyle !== null && cellStyle !== void 0 ? cellStyle : "").replace(/^(pos|neg)_\w+/, "$1_neu");
|
|
28377
28384
|
}
|
|
28378
|
-
|
|
28379
|
-
|
|
28380
|
-
|
|
28385
|
+
else {
|
|
28386
|
+
// a share without a total has no change either
|
|
28387
|
+
if (cellType === "percent" || variance.isValid) {
|
|
28388
|
+
value = "-";
|
|
28389
|
+
}
|
|
28390
|
+
if (scenario !== "category" && scenario !== "operation") {
|
|
28391
|
+
cellType = "percent";
|
|
28392
|
+
cssStyle = "";
|
|
28393
|
+
}
|
|
28381
28394
|
}
|
|
28382
28395
|
}
|
|
28383
28396
|
if (value === "-" || (value === NOT_AVAILABLE && cellType === "percent")) {
|
|
@@ -28435,7 +28448,14 @@ const OVERDRIVE_FRACTION = 0.15;
|
|
|
28435
28448
|
/** Width of the axis of a variance bar or pin, in em: near the 0.3em scenario marker in the header. */
|
|
28436
28449
|
const VARIANCE_AXIS_EM = 0.25;
|
|
28437
28450
|
/** Side of the square pin head, in px before scaleFactor. */
|
|
28438
|
-
const PIN_HEAD_SIZE =
|
|
28451
|
+
const PIN_HEAD_SIZE = 8;
|
|
28452
|
+
/** Height of a bar in svg heights: IBCS leaves almost half the row free. */
|
|
28453
|
+
const BAR_HEIGHT_RATIO = 0.6;
|
|
28454
|
+
/** Top edge and height of a bar centred in an svg of the given height. */
|
|
28455
|
+
function barBox(height) {
|
|
28456
|
+
const barHeight = height * BAR_HEIGHT_RATIO;
|
|
28457
|
+
return { barY: (height - barHeight) / 2, barHeight };
|
|
28458
|
+
}
|
|
28439
28459
|
/**
|
|
28440
28460
|
* Advance widths in em, the larger of Noto Sans and Arial. The engine ships no font, so a
|
|
28441
28461
|
* wider fallback (DejaVu Sans, Verdana) is possible: LABEL_WIDTH_MARGIN and the cell
|
|
@@ -28708,23 +28728,57 @@ const PIN_BAND_PAD = 0.2;
|
|
|
28708
28728
|
function getPatternId(prefix, color) {
|
|
28709
28729
|
return `pattern-${prefix}-${color.replace("#", "")}`;
|
|
28710
28730
|
}
|
|
28731
|
+
/** The hatching of a pin head: light lines on the dark colour of the scenario, as IBCS draws it. */
|
|
28732
|
+
function getHeadPatternId(slot, color) {
|
|
28733
|
+
return getPatternId(`head-${slot}`, color);
|
|
28734
|
+
}
|
|
28711
28735
|
/**
|
|
28712
28736
|
* Renders SVG pattern definitions for hatched fills
|
|
28713
28737
|
*/
|
|
28714
28738
|
const PatternDefs = ({ styles }) => {
|
|
28715
28739
|
const s = styles.scaleFactor;
|
|
28716
|
-
const
|
|
28740
|
+
const size = 3 * s;
|
|
28717
28741
|
const patterns = [
|
|
28718
|
-
{
|
|
28719
|
-
|
|
28720
|
-
|
|
28721
|
-
|
|
28722
|
-
|
|
28723
|
-
|
|
28724
|
-
|
|
28725
|
-
|
|
28742
|
+
{
|
|
28743
|
+
id: getPatternId("pos", styles.positive.stroke),
|
|
28744
|
+
line: styles.positive.stroke,
|
|
28745
|
+
background: "#ffffff",
|
|
28746
|
+
lineWidth: 1,
|
|
28747
|
+
},
|
|
28748
|
+
{
|
|
28749
|
+
id: getPatternId("neg", styles.negative.stroke),
|
|
28750
|
+
line: styles.negative.stroke,
|
|
28751
|
+
background: "#ffffff",
|
|
28752
|
+
lineWidth: 1,
|
|
28753
|
+
},
|
|
28754
|
+
{
|
|
28755
|
+
id: getPatternId("neu", styles.neutral.stroke),
|
|
28756
|
+
line: styles.neutral.stroke,
|
|
28757
|
+
background: "#ffffff",
|
|
28758
|
+
lineWidth: 1,
|
|
28759
|
+
},
|
|
28760
|
+
...["ac", "pp", "fc", "pl"].flatMap((type) => [
|
|
28761
|
+
{
|
|
28762
|
+
id: getPatternId(type, styles.scenarios[type].stroke),
|
|
28763
|
+
line: styles.scenarios[type].stroke,
|
|
28764
|
+
background: "#ffffff",
|
|
28765
|
+
lineWidth: 1,
|
|
28766
|
+
},
|
|
28767
|
+
{
|
|
28768
|
+
id: getHeadPatternId(type, styles.scenarios[type].stroke),
|
|
28769
|
+
line: "#ffffff",
|
|
28770
|
+
background: styles.scenarios[type].stroke,
|
|
28771
|
+
lineWidth: 0.6,
|
|
28772
|
+
},
|
|
28773
|
+
]),
|
|
28774
|
+
];
|
|
28775
|
+
// the diagonal of the tile and its two ends in the next tiles, so the lines join without notches
|
|
28776
|
+
const diagonals = [
|
|
28777
|
+
[0, size, size, 0],
|
|
28778
|
+
[-s, s, s, -s],
|
|
28779
|
+
[size - s, size + s, size + s, size - s],
|
|
28726
28780
|
];
|
|
28727
|
-
return (h("defs", null, patterns.map((p) => (h("pattern", { id: p.id, patternUnits: "userSpaceOnUse", width:
|
|
28781
|
+
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 }))))))));
|
|
28728
28782
|
};
|
|
28729
28783
|
/** Longest relative label that keeps all percent digits; a longer one drops digits so its gutter does not eat the pins. */
|
|
28730
28784
|
const PIN_LABEL_CHARS = 7;
|
|
@@ -28826,8 +28880,10 @@ const VarianceAxis = ({ x, height, look, styles }) => {
|
|
|
28826
28880
|
const { reference, referenceSlot } = look;
|
|
28827
28881
|
let lines;
|
|
28828
28882
|
if (reference.fillpattern === "outlined") {
|
|
28829
|
-
|
|
28830
|
-
|
|
28883
|
+
// two lines with a gap of their width, together as wide as a solid axis
|
|
28884
|
+
const lineWidth = width / 3;
|
|
28885
|
+
const offset = (width - lineWidth) / 2;
|
|
28886
|
+
lines = [x - offset, x + offset].map((lineX) => (h("line", { x1: lineX, y1: 0, x2: lineX, y2: height, stroke: reference.stroke, "stroke-width": lineWidth })));
|
|
28831
28887
|
}
|
|
28832
28888
|
else if (reference.fillpattern === "hatched") {
|
|
28833
28889
|
lines = (h("line", { x1: x, y1: 0, x2: x, y2: height, stroke: reference.stroke, "stroke-width": width, "stroke-dasharray": `${2 * s}` }));
|
|
@@ -28955,9 +29011,7 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
28955
29011
|
const maxOverflow = Math.max(0, maxScaledWidth - cutWidth);
|
|
28956
29012
|
const overflowAmount = Math.max(0, scaledWidth - cutWidth);
|
|
28957
29013
|
const overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
|
|
28958
|
-
const
|
|
28959
|
-
const barHeight = height - padding * 2;
|
|
28960
|
-
const barY = padding;
|
|
29014
|
+
const { barY, barHeight } = barBox(height);
|
|
28961
29015
|
// Get style based on column type (scenario vs variance)
|
|
28962
29016
|
const look = getVarianceLook(scenario, styles);
|
|
28963
29017
|
const sentimentStyle = getBarStyle(scenario, value, isPositiveGood, styles);
|
|
@@ -29039,7 +29093,11 @@ const RelativeVariancePin = (props) => {
|
|
|
29039
29093
|
const labelX = labelOnShaft
|
|
29040
29094
|
? bandX + bandWidth / 2
|
|
29041
29095
|
: (isExtreme ? tipX : pinEndX + direction * (headSize / 2)) + direction * labelGap;
|
|
29042
|
-
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"
|
|
29096
|
+
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"
|
|
29097
|
+
? "#ffffff"
|
|
29098
|
+
: headStyle.fillpattern === "hatched"
|
|
29099
|
+
? `url(#${getHeadPatternId((_b = look === null || look === void 0 ? void 0 : look.minuendSlot) !== null && _b !== void 0 ? _b : "ac", headStyle.stroke)})`
|
|
29100
|
+
: 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)));
|
|
29043
29101
|
};
|
|
29044
29102
|
/**
|
|
29045
29103
|
* CellBarChart - Renders IBCS-compliant variance bar charts.
|
|
@@ -29102,9 +29160,7 @@ const WaterfallBar = (props) => {
|
|
|
29102
29160
|
const { totalWidth, labelAreaLeft, barAreaWidth, labelGap } = geometry !== null && geometry !== void 0 ? geometry : waterfallGeometry(columnWidthEm, styles.emPx);
|
|
29103
29161
|
const pxPerUnit = barAreaWidth / range;
|
|
29104
29162
|
const xOf = (coordinate) => labelAreaLeft + (coordinate - waterfall.min) * pxPerUnit;
|
|
29105
|
-
const
|
|
29106
|
-
const barHeight = height - padding * 2;
|
|
29107
|
-
const barY = padding;
|
|
29163
|
+
const { barY, barHeight } = barBox(height);
|
|
29108
29164
|
const axisX = xOf(0);
|
|
29109
29165
|
const startX = xOf(waterfall.start);
|
|
29110
29166
|
const endX = xOf(waterfall.end);
|
|
@@ -29519,12 +29575,8 @@ class DataQuery {
|
|
|
29519
29575
|
const queries = [];
|
|
29520
29576
|
const sumGroupQueries = [];
|
|
29521
29577
|
const res = [];
|
|
29522
|
-
const scenarios = this.
|
|
29523
|
-
|
|
29524
|
-
.toString();
|
|
29525
|
-
const scenariosSUMQuery = this.config.scenarios
|
|
29526
|
-
.map((s) => this.translateScenarioSQL(s, true, this.config.type))
|
|
29527
|
-
.toString();
|
|
29578
|
+
const scenarios = this.scenariosSQL(false);
|
|
29579
|
+
const scenariosSUMQuery = this.scenariosSQL(true);
|
|
29528
29580
|
const relativeScenarios = this.getRelativeScenarios();
|
|
29529
29581
|
const attributesSQL = this.config.attributes.map((attribute) => this.translateAttributeSQL(attribute)).toString();
|
|
29530
29582
|
const groups = new QueryGroups(this.config);
|
|
@@ -29640,7 +29692,8 @@ class DataQuery {
|
|
|
29640
29692
|
drillQueries.forEach((query) => {
|
|
29641
29693
|
resDrill.push(...this.exec(query));
|
|
29642
29694
|
});
|
|
29643
|
-
|
|
29695
|
+
// two relative variances on one reference name its dr_* alias twice
|
|
29696
|
+
const scenarioNames = [...new Set(this.exctractScenarioNames(scenarios))];
|
|
29644
29697
|
const rowGroupSumResultRows = [];
|
|
29645
29698
|
sumGroupQueries.forEach(function (query) {
|
|
29646
29699
|
rowGroupSumResultRows.push(...db.exec(query, params));
|
|
@@ -29648,21 +29701,29 @@ class DataQuery {
|
|
|
29648
29701
|
const rowGroupSumResultMap = new Map();
|
|
29649
29702
|
rowGroupSumResultRows.forEach((row) => rowGroupSumResultMap.set(row[QueryColumnNames.ROWGROUP], row));
|
|
29650
29703
|
resDrill = this.reduceResDrillByCategoryGroups(resDrill, scenarioNames);
|
|
29651
|
-
resDrill.forEach(
|
|
29652
|
-
|
|
29653
|
-
try {
|
|
29654
|
-
drillItem[key] =
|
|
29655
|
-
drillItem[key] /
|
|
29656
|
-
rowGroupSumResultMap.get(drillItem[QueryColumnNames.ROWGROUP])[key];
|
|
29657
|
-
}
|
|
29658
|
-
catch (err) {
|
|
29659
|
-
console.error("DataQuery: partOf drill row calculation failed", key, err);
|
|
29660
|
-
drillItem[key] = Number.NaN;
|
|
29661
|
-
}
|
|
29662
|
-
});
|
|
29704
|
+
resDrill.forEach((drillItem) => {
|
|
29705
|
+
this.toShares(drillItem, rowGroupSumResultMap.get(drillItem[QueryColumnNames.ROWGROUP]), scenarioNames);
|
|
29663
29706
|
});
|
|
29664
29707
|
this.injectDrillRowsToResultRows(resDrill, res);
|
|
29665
29708
|
}
|
|
29709
|
+
/**
|
|
29710
|
+
* Turns the values of a partof row into shares of its total. A variance becomes the change of the
|
|
29711
|
+
* share (percentage points), not the share of the variance.
|
|
29712
|
+
*/
|
|
29713
|
+
toShares(part, totals, names) {
|
|
29714
|
+
var _a;
|
|
29715
|
+
const share = (key) => part[key] / (totals ? totals[key] : Number.NaN);
|
|
29716
|
+
const changes = new Map();
|
|
29717
|
+
for (const name of names) {
|
|
29718
|
+
const variance = new VarianceScenario(name);
|
|
29719
|
+
if (variance.isValid) {
|
|
29720
|
+
changes.set(name, share(variance.base) - share(variance.delta));
|
|
29721
|
+
}
|
|
29722
|
+
}
|
|
29723
|
+
for (const name of names) {
|
|
29724
|
+
part[name] = (_a = changes.get(name)) !== null && _a !== void 0 ? _a : share(name);
|
|
29725
|
+
}
|
|
29726
|
+
}
|
|
29666
29727
|
/**
|
|
29667
29728
|
* Generates a REST row that aggregates all data rows beyond the configured limit.
|
|
29668
29729
|
* Only emitted when a limit is set and the group has more rows than the limit.
|
|
@@ -30018,12 +30079,8 @@ class DataQuery {
|
|
|
30018
30079
|
}
|
|
30019
30080
|
const separator = "##";
|
|
30020
30081
|
const bucketSource = `(SELECT *, ${intervalBucketSQL(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`;
|
|
30021
|
-
const scenarios = this.
|
|
30022
|
-
|
|
30023
|
-
.toString();
|
|
30024
|
-
const scenariosSUMQuery = this.config.scenarios
|
|
30025
|
-
.map((s) => this.translateScenarioSQL(s, true, this.config.type))
|
|
30026
|
-
.toString();
|
|
30082
|
+
const scenarios = this.scenariosSQL(false);
|
|
30083
|
+
const scenariosSUMQuery = this.scenariosSQL(true);
|
|
30027
30084
|
// two relative variances on one reference name its dr_* alias twice, it must be summed once
|
|
30028
30085
|
const entryAliases = [...new Set(this.exctractScenarioNames(scenarios))];
|
|
30029
30086
|
const relativeScenarios = this.getRelativeScenarios();
|
|
@@ -30249,9 +30306,7 @@ class DataQuery {
|
|
|
30249
30306
|
const totals = this.config.grouped
|
|
30250
30307
|
? groupTotalsByKey.get(`${partRow.rowGroup}${separator}${bucketKey}`)
|
|
30251
30308
|
: sumTotalsByBucket.get(bucketKey);
|
|
30252
|
-
|
|
30253
|
-
partRow[alias] = partRow[alias] / (totals ? totals[alias] : Number.NaN);
|
|
30254
|
-
}
|
|
30309
|
+
this.toShares(partRow, totals, entryAliases);
|
|
30255
30310
|
finalizeBucketRow(partRow);
|
|
30256
30311
|
for (const segment of res) {
|
|
30257
30312
|
for (const row of segment) {
|
|
@@ -30280,6 +30335,29 @@ class DataQuery {
|
|
|
30280
30335
|
}
|
|
30281
30336
|
return whereClause + `)`;
|
|
30282
30337
|
}
|
|
30338
|
+
/**
|
|
30339
|
+
* The select list of the scenarios. A partof row needs both sides of every variance, also when they
|
|
30340
|
+
* are not shown. Those come without their `_cnt`, so the NaN detection of the other rows does not change.
|
|
30341
|
+
*/
|
|
30342
|
+
scenariosSQL(isSumRow) {
|
|
30343
|
+
const shown = this.config.scenarios;
|
|
30344
|
+
const sql = shown.map((s) => this.translateScenarioSQL(s, isSumRow, this.config.type));
|
|
30345
|
+
if (this.checkConfigForPartOf() && this.config.type !== TableType$2.LIST) {
|
|
30346
|
+
const hidden = new Set();
|
|
30347
|
+
for (const scenario of shown) {
|
|
30348
|
+
const variance = new VarianceScenario(scenario);
|
|
30349
|
+
if (variance.isValid) {
|
|
30350
|
+
hidden.add(variance.base).add(variance.delta);
|
|
30351
|
+
}
|
|
30352
|
+
}
|
|
30353
|
+
for (const scenario of hidden) {
|
|
30354
|
+
if (!shown.includes(scenario)) {
|
|
30355
|
+
sql.push(this.translateScenarioSQL(scenario, isSumRow, this.config.type).split(", COUNT(")[0]);
|
|
30356
|
+
}
|
|
30357
|
+
}
|
|
30358
|
+
}
|
|
30359
|
+
return sql.toString();
|
|
30360
|
+
}
|
|
30283
30361
|
/** Collects all relative variance scenarios and maps each to its denominator column name. */
|
|
30284
30362
|
getRelativeScenarios() {
|
|
30285
30363
|
const relativeScenarios = new Map();
|
|
@@ -31028,13 +31106,15 @@ class TableDataSetFactory {
|
|
|
31028
31106
|
scenario.name === scenario.type
|
|
31029
31107
|
? waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.get(rawDataRow, scenario.type)
|
|
31030
31108
|
: undefined;
|
|
31031
|
-
|
|
31032
|
-
|
|
31033
|
-
|
|
31034
|
-
new VarianceScenario(scenario.type).isValid &&
|
|
31035
|
-
(waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.has(scenario.type)));
|
|
31109
|
+
const isShareChange = type === TableRowType.PARTELEMENT && new VarianceScenario(scenario.type).isValid;
|
|
31110
|
+
// the change of a share is in percentage points, it has no place on the axis of the column
|
|
31111
|
+
const isBarChart = isBarColumn && !isShareChange;
|
|
31036
31112
|
const columnStats = isBarChart ? columnStatsMap === null || columnStatsMap === void 0 ? void 0 : columnStatsMap.get(scenario.type) : undefined;
|
|
31037
|
-
detailsRow.createElement(
|
|
31113
|
+
detailsRow.createElement(
|
|
31114
|
+
// percent values have no share, so there is no change of a share either
|
|
31115
|
+
isShareChange && scenariosUnitType === DataFormat.PERCENT
|
|
31116
|
+
? "-"
|
|
31117
|
+
: 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);
|
|
31038
31118
|
const cell = detailsRow.elements[detailsRow.elements.length - 1];
|
|
31039
31119
|
if (this.dateBuckets && scenario.bucket !== undefined) {
|
|
31040
31120
|
cell.date = pointDate(scenario.bucket);
|
|
@@ -31778,8 +31858,10 @@ class TableDrillGroupAdapter {
|
|
|
31778
31858
|
}
|
|
31779
31859
|
}
|
|
31780
31860
|
|
|
31781
|
-
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
|
|
31861
|
+
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}`;
|
|
31782
31862
|
|
|
31863
|
+
/** Extra gap before the first column of a block, in table em. */
|
|
31864
|
+
const BLOCK_GAP_EM = 0.6;
|
|
31783
31865
|
const BnTableRenderer = class {
|
|
31784
31866
|
constructor(hostRef) {
|
|
31785
31867
|
registerInstance(this, hostRef);
|
|
@@ -31869,6 +31951,7 @@ const BnTableRenderer = class {
|
|
|
31869
31951
|
/** @internal */
|
|
31870
31952
|
this.scaleFactor = 1;
|
|
31871
31953
|
this.componentDataFormatDigits = new DataFormatDigits();
|
|
31954
|
+
this.blockStarts = new Set();
|
|
31872
31955
|
this.barColumnLayouts = new Map();
|
|
31873
31956
|
this.waterfallGeometries = new Map();
|
|
31874
31957
|
// labels measured in the fallback font are too narrow or too wide once the web font is there: lay out again
|
|
@@ -32004,9 +32087,10 @@ const BnTableRenderer = class {
|
|
|
32004
32087
|
return h("div", { class: "empty-state" }, errorMsg);
|
|
32005
32088
|
}
|
|
32006
32089
|
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;
|
|
32007
|
-
return (h("table",
|
|
32090
|
+
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) => {
|
|
32008
32091
|
var _a, _b, _c, _d, _e;
|
|
32009
|
-
return (h("td", Object.assign({ colSpan: cell.colSpan, class: cell.type ? `${this.cellClass(cell, locale)} ${cell.type}` : cell.cssStyle
|
|
32092
|
+
return (h("td", Object.assign({ colSpan: cell.colSpan, class: (cell.type ? `${this.cellClass(cell, locale)} ${cell.type}` : cell.cssStyle) +
|
|
32093
|
+
this.blockStartClass(cells, i) }, (row.key && cell.value != null && cell.value !== "" && cell.value !== "-"
|
|
32010
32094
|
? dataPointAttributes(Object.assign(Object.assign({}, row.key), { date: cell.date, scenario: cell.key }), "element")
|
|
32011
32095
|
: {})), cell.prefix != null ? (h("span", { class: this.cellClass(cell, locale) + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
|
|
32012
32096
|
cell.columnStats &&
|
|
@@ -32070,10 +32154,50 @@ const BnTableRenderer = class {
|
|
|
32070
32154
|
(_l = this.errors) === null || _l === void 0 ? void 0 : _l.remove(id);
|
|
32071
32155
|
}
|
|
32072
32156
|
}
|
|
32157
|
+
this.blockStarts = this.collectBlockStarts();
|
|
32073
32158
|
this.barColumnLayouts = this.collectBarColumnLayouts();
|
|
32074
32159
|
this.waterfallGeometries = this.collectWaterfallGeometries();
|
|
32075
32160
|
this.barChartStyles = this.prepareBarChartStyles();
|
|
32076
32161
|
}
|
|
32162
|
+
/**
|
|
32163
|
+
* The columns that start a block: the row header, the scenarios of one interval bucket
|
|
32164
|
+
* and each pair of variances are blocks. IBCS sets them apart by a wider gap.
|
|
32165
|
+
*/
|
|
32166
|
+
collectBlockStarts() {
|
|
32167
|
+
const starts = new Set();
|
|
32168
|
+
if (!this.table || this.table.hasNoData())
|
|
32169
|
+
return starts;
|
|
32170
|
+
const blockOf = (column) => {
|
|
32171
|
+
var _a;
|
|
32172
|
+
const variance = new VarianceScenario(column.type);
|
|
32173
|
+
const kind = variance.isValid
|
|
32174
|
+
? `${variance.base}_${variance.delta}`
|
|
32175
|
+
: /^(ac|pp|fc|pl)\d/i.test(column.type)
|
|
32176
|
+
? "scenario"
|
|
32177
|
+
: "rowheader";
|
|
32178
|
+
return `${(_a = column.bucket) !== null && _a !== void 0 ? _a : ""}|${kind}`;
|
|
32179
|
+
};
|
|
32180
|
+
const blocks = this.table.getColumns().map(blockOf);
|
|
32181
|
+
blocks.forEach((block, i) => {
|
|
32182
|
+
if (i > 0 && block !== blocks[i - 1])
|
|
32183
|
+
starts.add(i);
|
|
32184
|
+
});
|
|
32185
|
+
return starts;
|
|
32186
|
+
}
|
|
32187
|
+
/** " block-start" for the cell whose first column starts a block. A cell can span columns. */
|
|
32188
|
+
blockStartClass(cells, index) {
|
|
32189
|
+
let column = 0;
|
|
32190
|
+
for (let i = 0; i < index; i++)
|
|
32191
|
+
column += cells[i].colSpan;
|
|
32192
|
+
return this.blockStarts.has(column) ? " block-start" : "";
|
|
32193
|
+
}
|
|
32194
|
+
/** A grouped table that is no calculation scheme: its groups stand further apart. */
|
|
32195
|
+
groupedList() {
|
|
32196
|
+
return this.grouped === true && this.type !== TableType$2.OPT && this.type !== TableType$2.OPTNOTOTAL;
|
|
32197
|
+
}
|
|
32198
|
+
isBarColumn(key) {
|
|
32199
|
+
return this.barColumns.includes(key);
|
|
32200
|
+
}
|
|
32077
32201
|
/** The classes of a number cell. A variance that prints as zero loses its sign and its sentiment color. */
|
|
32078
32202
|
cellClass(cell, locale) {
|
|
32079
32203
|
if (cell.direction === undefined || !cell.roundsToZero(this.componentDataFormatDigits, locale)) {
|
|
@@ -32325,7 +32449,9 @@ const BnTableRenderer = class {
|
|
|
32325
32449
|
*/
|
|
32326
32450
|
connectorReach(row) {
|
|
32327
32451
|
const emPx = this.emPx();
|
|
32328
|
-
|
|
32452
|
+
// tr.sum td { padding-bottom }, larger in a grouped list
|
|
32453
|
+
const sumPadding = this.groupedList() ? 1 : 0.5;
|
|
32454
|
+
return { top: 0.1 * emPx, bottom: row.type === TableRowType.SUM ? sumPadding * emPx : 0 };
|
|
32329
32455
|
}
|
|
32330
32456
|
/**
|
|
32331
32457
|
* Geometry of every waterfall column from the measured labels of all cells that draw a
|
|
@@ -136,6 +136,7 @@ export declare class BnTableRenderer {
|
|
|
136
136
|
private table;
|
|
137
137
|
private componentDataFormatDigits;
|
|
138
138
|
private barChartStyles;
|
|
139
|
+
private blockStarts;
|
|
139
140
|
private barColumnLayouts;
|
|
140
141
|
private waterfallGeometries;
|
|
141
142
|
private stores;
|
|
@@ -153,6 +154,16 @@ export declare class BnTableRenderer {
|
|
|
153
154
|
getLayoutDetail(origins: Origins, detail: "summary" | "full"): Promise<TableLayoutDetail>;
|
|
154
155
|
render(): any;
|
|
155
156
|
componentWillRender(): void;
|
|
157
|
+
/**
|
|
158
|
+
* The columns that start a block: the row header, the scenarios of one interval bucket
|
|
159
|
+
* and each pair of variances are blocks. IBCS sets them apart by a wider gap.
|
|
160
|
+
*/
|
|
161
|
+
private collectBlockStarts;
|
|
162
|
+
/** " block-start" for the cell whose first column starts a block. A cell can span columns. */
|
|
163
|
+
private blockStartClass;
|
|
164
|
+
/** A grouped table that is no calculation scheme: its groups stand further apart. */
|
|
165
|
+
private groupedList;
|
|
166
|
+
private isBarColumn;
|
|
156
167
|
/** The classes of a number cell. A variance that prints as zero loses its sign and its sentiment color. */
|
|
157
168
|
private cellClass;
|
|
158
169
|
private prepareConfig;
|
|
@@ -57,6 +57,11 @@ export declare class DataQuery {
|
|
|
57
57
|
* value by the corresponding group sum to produce a percentage.
|
|
58
58
|
*/
|
|
59
59
|
createPartOfDrillRows(scenarios: string, order: [string, string], sumGroupQueries: string[], res: DataQueryResultRow[][]): void;
|
|
60
|
+
/**
|
|
61
|
+
* Turns the values of a partof row into shares of its total. A variance becomes the change of the
|
|
62
|
+
* share (percentage points), not the share of the variance.
|
|
63
|
+
*/
|
|
64
|
+
private toShares;
|
|
60
65
|
/**
|
|
61
66
|
* Generates a REST row that aggregates all data rows beyond the configured limit.
|
|
62
67
|
* Only emitted when a limit is set and the group has more rows than the limit.
|
|
@@ -130,6 +135,11 @@ export declare class DataQuery {
|
|
|
130
135
|
private createIntervalColumns;
|
|
131
136
|
/** Builds the thereof filter for interval side queries (mirrors the WHERE construction in createThereOfDrillRows). */
|
|
132
137
|
private createThereOfWhereClause;
|
|
138
|
+
/**
|
|
139
|
+
* The select list of the scenarios. A partof row needs both sides of every variance, also when they
|
|
140
|
+
* are not shown. Those come without their `_cnt`, so the NaN detection of the other rows does not change.
|
|
141
|
+
*/
|
|
142
|
+
private scenariosSQL;
|
|
133
143
|
/** Collects all relative variance scenarios and maps each to its denominator column name. */
|
|
134
144
|
private getRelativeScenarios;
|
|
135
145
|
/**
|
|
@@ -17,7 +17,12 @@ export declare const BAR_LABEL_FONT_RATIO = 0.85;
|
|
|
17
17
|
/** Width of the axis of a variance bar or pin, in em: near the 0.3em scenario marker in the header. */
|
|
18
18
|
export declare const VARIANCE_AXIS_EM = 0.25;
|
|
19
19
|
/** Side of the square pin head, in px before scaleFactor. */
|
|
20
|
-
export declare const PIN_HEAD_SIZE =
|
|
20
|
+
export declare const PIN_HEAD_SIZE = 8;
|
|
21
|
+
/** Top edge and height of a bar centred in an svg of the given height. */
|
|
22
|
+
export declare function barBox(height: number): {
|
|
23
|
+
barY: number;
|
|
24
|
+
barHeight: number;
|
|
25
|
+
};
|
|
21
26
|
/** Estimated rendered width of a value label in px, with a margin for wider fonts. */
|
|
22
27
|
export declare function estimateLabelWidth(text: string, fontSize: number): number;
|
|
23
28
|
/**
|
package/package.json
CHANGED