@bino-bi/bn-template-engine 1.0.0-next.39 → 1.0.0-next.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/{p-9a61f59d.entry.js → p-8b28c9bd.entry.js} +1 -1
- package/dist/bn-template-engine/{p-DyupX-Z-.js → p-BjozxTTW.js} +1 -1
- package/dist/bn-template-engine/p-EcC0qLtU.js +1 -0
- package/dist/bn-template-engine/{p-eea538f1.entry.js → p-a4b76176.entry.js} +1 -1
- package/dist/bn-template-engine/p-aa0fd797.entry.js +1 -0
- package/dist/bn-template-engine/{p-93b8387f.entry.js → p-ce764078.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +785 -378
- package/dist/cjs/bn-grid.cjs.entry.js +1 -1
- package/dist/cjs/bn-image.cjs.entry.js +1 -1
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{withStyled-DfE0aW7D.js → withStyled-BZb6snOx.js} +74 -0
- package/dist/cjs/{withTranslation-0gkn9xoC.js → withTranslation-FxXGUB3H.js} +1 -1
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +4 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +3 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +3 -1
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.css +22 -1
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +156 -11
- package/dist/collection/components/bn-table/bn-table.js +134 -5
- package/dist/collection/components/bn-table/utils/elements/Cell.js +10 -1
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +25 -10
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +50 -12
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +44 -14
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +63 -2
- package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +123 -11
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +57 -9
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +16 -1
- package/dist/collection/components/bn-table/utils/model/index.js +6 -0
- package/dist/collection/utils/validate.js +4 -0
- 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.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-renderer.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-page.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/p-1B_s8oPY.js +1 -0
- package/dist/components/{p-BqUB56k1.js → p-B4L069XF.js} +1 -1
- package/dist/components/p-BC4MwlnX.js +1 -0
- package/dist/components/p-BZXiWkDS.js +1 -0
- package/dist/components/p-BiSytXUy.js +1 -0
- package/dist/components/p-Bn7J1pgl.js +1 -0
- package/dist/components/{p-BmOWXYHF.js → p-CEf5X8MZ.js} +1 -1
- package/dist/components/{p-Cyf5ZEXs.js → p-CUSAlS2o.js} +1 -1
- package/dist/components/p-CvEdUq8i.js +1 -0
- package/dist/components/{p-OquycEMA.js → p-D40Am1Ap.js} +1 -1
- package/dist/components/{p-B4Cf0cVi.js → p-DM4Up10X.js} +1 -1
- package/dist/components/{p-Bo_R7f_T.js → p-DwuXVo2h.js} +1 -1
- package/dist/components/{p-DTmqMQpw.js → p-Y9bth2Y_.js} +1 -1
- package/dist/components/{p-BU_53KVT.js → p-xIWChKGS.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +903 -496
- package/dist/esm/bn-grid.entry.js +1 -1
- package/dist/esm/bn-image.entry.js +1 -1
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{withStyled-CIoJ86RM.js → withStyled-CzzXg64f.js} +77 -4
- package/dist/esm/{withTranslation-BX9T3dfm.js → withTranslation-Daq2JXkv.js} +1 -1
- package/dist/types/components/bn-table/bn-table-renderer/bn-table-renderer.d.ts +20 -1
- package/dist/types/components/bn-table/bn-table.d.ts +49 -1
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +3 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +26 -0
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +22 -2
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +13 -0
- package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +30 -2
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +24 -4
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +7 -1
- package/dist/types/components/bn-table/utils/model/index.d.ts +5 -0
- package/dist/types/components.d.ts +49 -4
- package/dist/types/utils/validate.d.ts +1 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-8c84d57e.entry.js +0 -1
- package/dist/bn-template-engine/p-BVU4bIsi.js +0 -1
- package/dist/components/p-BsJOvfIg.js +0 -1
- package/dist/components/p-DCPLGEs_.js +0 -1
- package/dist/components/p-DT04Cka0.js +0 -1
- package/dist/components/p-Dm6EAaJ9.js +0 -1
- package/dist/components/p-dRPJiQB6.js +0 -1
- package/dist/components/p-tkB96Ena.js +0 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DGis1BzT.js');
|
|
4
4
|
var withHasError = require('./withHasError-BkBrsCpI.js');
|
|
5
|
-
var withStyled = require('./withStyled-
|
|
6
|
-
var withTranslation = require('./withTranslation-
|
|
5
|
+
var withStyled = require('./withStyled-BZb6snOx.js');
|
|
6
|
+
var withTranslation = require('./withTranslation-FxXGUB3H.js');
|
|
7
7
|
var withBodyObserver = require('./withBodyObserver-S-FGHpAX.js');
|
|
8
8
|
var localFrame = require('./localFrame-U3Qs0psw.js');
|
|
9
9
|
var index$1 = require('./index.cjs.js');
|
|
@@ -9570,7 +9570,9 @@ let Label$1 = class Label {
|
|
|
9570
9570
|
type = "decimal";
|
|
9571
9571
|
}
|
|
9572
9572
|
valueStr = Formatter.number(Number(value), type, digits, digitsMin, scale, this.styles.locale);
|
|
9573
|
-
|
|
9573
|
+
// a value that rounds to zero prints without a sign
|
|
9574
|
+
const zeroStr = Formatter.number(0, type, digits, digitsMin, scale, this.styles.locale);
|
|
9575
|
+
if (this.isVarianceLabel && Number(this.value) > 0 && valueStr !== zeroStr) {
|
|
9574
9576
|
prefix = "+";
|
|
9575
9577
|
}
|
|
9576
9578
|
}
|
|
@@ -15600,11 +15602,11 @@ let CustomPattern$1 = class CustomPattern {
|
|
|
15600
15602
|
}
|
|
15601
15603
|
};
|
|
15602
15604
|
|
|
15603
|
-
var FactoryState$
|
|
15605
|
+
var FactoryState$2;
|
|
15604
15606
|
(function (FactoryState) {
|
|
15605
15607
|
FactoryState[FactoryState["UP_TO_DATE"] = 0] = "UP_TO_DATE";
|
|
15606
15608
|
FactoryState[FactoryState["DIRTY"] = 1] = "DIRTY";
|
|
15607
|
-
})(FactoryState$
|
|
15609
|
+
})(FactoryState$2 || (FactoryState$2 = {}));
|
|
15608
15610
|
var VarianceType$1;
|
|
15609
15611
|
(function (VarianceType) {
|
|
15610
15612
|
VarianceType["RELATIVE"] = "dr";
|
|
@@ -16262,12 +16264,12 @@ var Scenario$1;
|
|
|
16262
16264
|
Scenario["NEU"] = "neu";
|
|
16263
16265
|
})(Scenario$1 || (Scenario$1 = {}));
|
|
16264
16266
|
/** Chart-internal table aggregation modes. */
|
|
16265
|
-
var TableType$
|
|
16267
|
+
var TableType$1;
|
|
16266
16268
|
(function (TableType) {
|
|
16267
16269
|
TableType["LIST"] = "LIST";
|
|
16268
16270
|
TableType["SUM"] = "SUM";
|
|
16269
16271
|
TableType["OPT"] = "OPT";
|
|
16270
|
-
})(TableType$
|
|
16272
|
+
})(TableType$1 || (TableType$1 = {}));
|
|
16271
16273
|
|
|
16272
16274
|
// import {Formatter} from "../../../../utils";
|
|
16273
16275
|
// import {StructureChartStyle} from "../model";
|
|
@@ -16370,7 +16372,9 @@ class Label {
|
|
|
16370
16372
|
if (Number(this.value) < 0) {
|
|
16371
16373
|
labelAnchor = "end";
|
|
16372
16374
|
}
|
|
16373
|
-
|
|
16375
|
+
// a value that rounds to zero prints without a sign
|
|
16376
|
+
const zeroStr = Formatter.number(0, type, digits, digitsMin, scale, this.styles.locale);
|
|
16377
|
+
if (this.isVarianceLabel && Number(this.value) > 0 && valueStr !== zeroStr) {
|
|
16374
16378
|
prefix = "+";
|
|
16375
16379
|
}
|
|
16376
16380
|
}
|
|
@@ -17410,7 +17414,7 @@ class StructureChart {
|
|
|
17410
17414
|
this.hideCategories = false;
|
|
17411
17415
|
this.axisScenario = Scenario$1.AC1;
|
|
17412
17416
|
this.CSS_CATEGORIES = "categories";
|
|
17413
|
-
this.state = FactoryState$
|
|
17417
|
+
this.state = FactoryState$2.DIRTY;
|
|
17414
17418
|
this.titleLength = 0;
|
|
17415
17419
|
this.leftSideOffsetForHorizontalSync = 0;
|
|
17416
17420
|
this.limit = 0;
|
|
@@ -17454,7 +17458,7 @@ class StructureChart {
|
|
|
17454
17458
|
}
|
|
17455
17459
|
setConfig(config) {
|
|
17456
17460
|
var _a, _b;
|
|
17457
|
-
this.state = FactoryState$
|
|
17461
|
+
this.state = FactoryState$2.DIRTY;
|
|
17458
17462
|
this.scenarioPropOrder = [...config.scenarios];
|
|
17459
17463
|
const scenarios = this.sortScenariosbyVisualisationRules(config.scenarios);
|
|
17460
17464
|
this.hideCategories = config.hideCategories || false;
|
|
@@ -17527,7 +17531,7 @@ class StructureChart {
|
|
|
17527
17531
|
this.title = this.configTitle || Formatter.translateScenarioLabel((_a = this.configVariances) === null || _a === void 0 ? void 0 : _a.toString(), this.i18n);
|
|
17528
17532
|
}
|
|
17529
17533
|
createI18n(i18n) {
|
|
17530
|
-
this.state = FactoryState$
|
|
17534
|
+
this.state = FactoryState$2.DIRTY;
|
|
17531
17535
|
const defaultI18n = new Map([
|
|
17532
17536
|
["SEPARATOR_WS", ", "],
|
|
17533
17537
|
["in", "in"],
|
|
@@ -17568,7 +17572,7 @@ class StructureChart {
|
|
|
17568
17572
|
*/
|
|
17569
17573
|
setSource(filter) {
|
|
17570
17574
|
var _a, _b;
|
|
17571
|
-
this.state = FactoryState$
|
|
17575
|
+
this.state = FactoryState$2.DIRTY;
|
|
17572
17576
|
this.queryError = undefined;
|
|
17573
17577
|
// "" while the source is not registered yet: no data, and no error
|
|
17574
17578
|
this.fromExpr = withHasError.sourceExpr(this.db, this.tableName, filter);
|
|
@@ -17694,8 +17698,8 @@ class StructureChart {
|
|
|
17694
17698
|
draw(svgContainer) {
|
|
17695
17699
|
this.cleanSVGforRedraw(svgContainer);
|
|
17696
17700
|
this.applyFontToContainer(svgContainer);
|
|
17697
|
-
if (this.state === FactoryState$
|
|
17698
|
-
this.state = FactoryState$
|
|
17701
|
+
if (this.state === FactoryState$2.DIRTY) {
|
|
17702
|
+
this.state = FactoryState$2.UP_TO_DATE;
|
|
17699
17703
|
}
|
|
17700
17704
|
if (this.variancesDataModel && this.variancesDataModel.length > 0) {
|
|
17701
17705
|
this.drawVarianceScenario(this.variancesDataModel, svgContainer);
|
|
@@ -18112,7 +18116,10 @@ class StructureChart {
|
|
|
18112
18116
|
}
|
|
18113
18117
|
calculatePercentageTextBoxWidth(value) {
|
|
18114
18118
|
let signWidth = 0;
|
|
18115
|
-
|
|
18119
|
+
// like the label: no sign for a value that rounds to zero
|
|
18120
|
+
const digits = this.dataFormatDigits.percent;
|
|
18121
|
+
const percent = (v) => Formatter.number(v, "percent", digits, digits, 1, this.styles.locale);
|
|
18122
|
+
if (value > 0 && percent(value) !== percent(0)) {
|
|
18116
18123
|
signWidth += CalculateSize("+", {
|
|
18117
18124
|
font: this.styles.fontStyles.font,
|
|
18118
18125
|
fontSize: this.styles.fontStyles.size + "px",
|
|
@@ -20733,12 +20740,12 @@ var Scenario;
|
|
|
20733
20740
|
Scenario["NEU"] = "neu";
|
|
20734
20741
|
})(Scenario || (Scenario = {}));
|
|
20735
20742
|
/** Chart-internal table aggregation modes. */
|
|
20736
|
-
var TableType
|
|
20743
|
+
var TableType;
|
|
20737
20744
|
(function (TableType) {
|
|
20738
20745
|
TableType["LIST"] = "LIST";
|
|
20739
20746
|
TableType["SUM"] = "SUM";
|
|
20740
20747
|
TableType["OPT"] = "OPT";
|
|
20741
|
-
})(TableType
|
|
20748
|
+
})(TableType || (TableType = {}));
|
|
20742
20749
|
|
|
20743
20750
|
/**
|
|
20744
20751
|
* Renders the horizontal baseline axis for a time chart.
|
|
@@ -22133,11 +22140,11 @@ function drawAttached(container, drawFn) {
|
|
|
22133
22140
|
/** Above this many periods between the first and the last date, gaps are not filled with empty periods. */
|
|
22134
22141
|
const MAX_GAP_FILLED_PERIODS = 10000;
|
|
22135
22142
|
/** Tracks whether the internal data model needs to be regenerated. */
|
|
22136
|
-
var FactoryState$
|
|
22143
|
+
var FactoryState$1;
|
|
22137
22144
|
(function (FactoryState) {
|
|
22138
22145
|
FactoryState[FactoryState["UP_TO_DATE"] = 0] = "UP_TO_DATE";
|
|
22139
22146
|
FactoryState[FactoryState["DIRTY"] = 1] = "DIRTY";
|
|
22140
|
-
})(FactoryState$
|
|
22147
|
+
})(FactoryState$1 || (FactoryState$1 = {}));
|
|
22141
22148
|
/** Classifies how a data model entry should be rendered: as an absolute or relative variance, or as a regular scenario. */
|
|
22142
22149
|
var VarianceType;
|
|
22143
22150
|
(function (VarianceType) {
|
|
@@ -22187,7 +22194,7 @@ class TimeChart {
|
|
|
22187
22194
|
this.rowCount = 0;
|
|
22188
22195
|
this.axisCategoryArea = { width: 0, height: 0 };
|
|
22189
22196
|
this.scenariosArea = { width: 0, height: 0 };
|
|
22190
|
-
this.state = FactoryState$
|
|
22197
|
+
this.state = FactoryState$1.DIRTY;
|
|
22191
22198
|
this.i18n = new Map();
|
|
22192
22199
|
this.leftSideOffsetForHorizontalSync = -1;
|
|
22193
22200
|
this.dateInterval = withStyled.DateDistance.DAY;
|
|
@@ -22286,7 +22293,7 @@ class TimeChart {
|
|
|
22286
22293
|
}
|
|
22287
22294
|
setConfig(config) {
|
|
22288
22295
|
var _a;
|
|
22289
|
-
this.state = FactoryState$
|
|
22296
|
+
this.state = FactoryState$1.DIRTY;
|
|
22290
22297
|
// Must precede setSource/populateModel: the locale is baked into the
|
|
22291
22298
|
// normalizeDate() SQL as well as into the axis date labels.
|
|
22292
22299
|
this.locale = config.locale;
|
|
@@ -22380,7 +22387,7 @@ class TimeChart {
|
|
|
22380
22387
|
*/
|
|
22381
22388
|
setSource(filter) {
|
|
22382
22389
|
var _a, _b;
|
|
22383
|
-
this.state = FactoryState$
|
|
22390
|
+
this.state = FactoryState$1.DIRTY;
|
|
22384
22391
|
this.queryError = undefined;
|
|
22385
22392
|
// "" while the source is not registered yet: no data, and no error
|
|
22386
22393
|
this.fromExpr = withHasError.sourceExpr(this.db, this.tableName, filter);
|
|
@@ -22524,8 +22531,8 @@ class TimeChart {
|
|
|
22524
22531
|
draw(svgContainer) {
|
|
22525
22532
|
this.cleanSVGforRedraw(svgContainer);
|
|
22526
22533
|
this.applyFontToContainer(svgContainer);
|
|
22527
|
-
if (this.state === FactoryState$
|
|
22528
|
-
this.state = FactoryState$
|
|
22534
|
+
if (this.state === FactoryState$1.DIRTY) {
|
|
22535
|
+
this.state = FactoryState$1.UP_TO_DATE;
|
|
22529
22536
|
}
|
|
22530
22537
|
if (this.isVarianceChart()) {
|
|
22531
22538
|
this.drawVarianceScenario(this.variancesDataModel, svgContainer);
|
|
@@ -22591,7 +22598,7 @@ class TimeChart {
|
|
|
22591
22598
|
}
|
|
22592
22599
|
}
|
|
22593
22600
|
createI18n(i18n) {
|
|
22594
|
-
this.state = FactoryState$
|
|
22601
|
+
this.state = FactoryState$1.DIRTY;
|
|
22595
22602
|
const defaultI18n = new Map([
|
|
22596
22603
|
["SEPARATOR_WS", ", "],
|
|
22597
22604
|
["in", "in"],
|
|
@@ -26549,70 +26556,6 @@ const ScalingGroup = class {
|
|
|
26549
26556
|
};
|
|
26550
26557
|
ScalingGroup.style = bnScalingGroupCss();
|
|
26551
26558
|
|
|
26552
|
-
/** Sentinel value indicating all groups should be included. */
|
|
26553
|
-
var GroupSelection;
|
|
26554
|
-
(function (GroupSelection) {
|
|
26555
|
-
GroupSelection[GroupSelection["ALL"] = -1] = "ALL";
|
|
26556
|
-
})(GroupSelection || (GroupSelection = {}));
|
|
26557
|
-
/**
|
|
26558
|
-
* Tracks whether a factory's output is current or needs recalculation.
|
|
26559
|
-
* Used to avoid redundant re-rendering when underlying data has not changed.
|
|
26560
|
-
*/
|
|
26561
|
-
var FactoryState$1;
|
|
26562
|
-
(function (FactoryState) {
|
|
26563
|
-
/** Output matches the current input data. */
|
|
26564
|
-
FactoryState[FactoryState["UP_TO_DATE"] = 0] = "UP_TO_DATE";
|
|
26565
|
-
/** Input data has changed; output needs to be regenerated. */
|
|
26566
|
-
FactoryState[FactoryState["DIRTY"] = 1] = "DIRTY";
|
|
26567
|
-
})(FactoryState$1 || (FactoryState$1 = {}));
|
|
26568
|
-
/**
|
|
26569
|
-
* Table aggregation modes controlling how rows are grouped and totalled.
|
|
26570
|
-
*
|
|
26571
|
-
* - `LIST` -- Flat list with no aggregation.
|
|
26572
|
-
* - `SUM` -- Grouped rows with sum totals per group and a grand total.
|
|
26573
|
-
* - `SUMNOTOTAL` -- Grouped rows with group sums but no grand total row.
|
|
26574
|
-
* - `OPT` -- Operation-aware aggregation (respects the +/- operation field).
|
|
26575
|
-
* - `OPTNOTOTAL` -- Operation-aware aggregation without a grand total row.
|
|
26576
|
-
*/
|
|
26577
|
-
var TableType;
|
|
26578
|
-
(function (TableType) {
|
|
26579
|
-
TableType["LIST"] = "list";
|
|
26580
|
-
TableType["SUM"] = "sum";
|
|
26581
|
-
TableType["SUMNOTOTAL"] = "sumnototal";
|
|
26582
|
-
TableType["OPT"] = "opt";
|
|
26583
|
-
TableType["OPTNOTOTAL"] = "optnototal";
|
|
26584
|
-
})(TableType || (TableType = {}));
|
|
26585
|
-
var OrderDirection;
|
|
26586
|
-
(function (OrderDirection) {
|
|
26587
|
-
OrderDirection["ASC"] = "asc";
|
|
26588
|
-
OrderDirection["DESC"] = "desc";
|
|
26589
|
-
})(OrderDirection || (OrderDirection = {}));
|
|
26590
|
-
/**
|
|
26591
|
-
* Discriminator for rendered table rows, controlling visual styling and behavior.
|
|
26592
|
-
*
|
|
26593
|
-
* - `HEADER` -- Column header row.
|
|
26594
|
-
* - `GROUPHEAD` -- Group title row (rendered when `grouped` is true).
|
|
26595
|
-
* - `SEPERATORLINE` -- Visual divider between groups.
|
|
26596
|
-
* - `SUM` -- Grand total row.
|
|
26597
|
-
* - `GROUPSUM` -- Sub-total row for a single group.
|
|
26598
|
-
* - `DRILLELEMENT` -- "Thereof" drill-down sub-row.
|
|
26599
|
-
* - `STANDARD` -- Normal data row.
|
|
26600
|
-
* - `PARTELEMENT` -- "Part of" percentage row.
|
|
26601
|
-
* - `ENTRY` -- Generic entry row.
|
|
26602
|
-
*/
|
|
26603
|
-
var TableRowType;
|
|
26604
|
-
(function (TableRowType) {
|
|
26605
|
-
TableRowType["HEADER"] = "HEADER";
|
|
26606
|
-
TableRowType["GROUPHEAD"] = "GROUPHEAD";
|
|
26607
|
-
TableRowType["SEPERATORLINE"] = "SEPERATORLINE";
|
|
26608
|
-
TableRowType["SUM"] = "SUM";
|
|
26609
|
-
TableRowType["GROUPSUM"] = "GROUP_SUM";
|
|
26610
|
-
TableRowType["DRILLELEMENT"] = "DRILLELEMENT";
|
|
26611
|
-
TableRowType["STANDARD"] = "STANDARD";
|
|
26612
|
-
TableRowType["PARTELEMENT"] = "PARTELEMENT";
|
|
26613
|
-
TableRowType["ENTRY"] = "ENTRY";
|
|
26614
|
-
})(TableRowType || (TableRowType = {}));
|
|
26615
|
-
|
|
26616
26559
|
/** `interval` value deactivating the feature. */
|
|
26617
26560
|
const INTERVAL_NONE = "none";
|
|
26618
26561
|
/** `interval` value grouping by the dataset's `setname` column. */
|
|
@@ -26825,7 +26768,7 @@ const Table$1 = class Table {
|
|
|
26825
26768
|
/**
|
|
26826
26769
|
* Data units displayed per 1 em of bar length for absolute variance bar
|
|
26827
26770
|
* charts (ΔPY) - map-scale semantics: a larger value means smaller bars.
|
|
26828
|
-
* Bars exceeding barColumnWidth are
|
|
26771
|
+
* Bars exceeding barColumnWidth are cut with a zigzag break.
|
|
26829
26772
|
*
|
|
26830
26773
|
* | Value | Behavior |
|
|
26831
26774
|
* |------------------|----------------------------------------------------------------|
|
|
@@ -26893,6 +26836,37 @@ const Table$1 = class Table {
|
|
|
26893
26836
|
*
|
|
26894
26837
|
*/
|
|
26895
26838
|
this.showGroupTitle = true;
|
|
26839
|
+
/**
|
|
26840
|
+
* Turns the sum row of each (row-)group into a running result: the sum of all
|
|
26841
|
+
* rows from the first group down to its own group, with the matching absolute
|
|
26842
|
+
* and relative variances. Use it for a calculation scheme such as an income
|
|
26843
|
+
* statement, where each `rowGroup` ends in a result.
|
|
26844
|
+
* <br /><br />
|
|
26845
|
+
* Needs `grouped` and a type with group sums (```sum // opt // sumnototal // optnototal```).
|
|
26846
|
+
* The total row of ```sum``` and ```opt``` stays and repeats the last running
|
|
26847
|
+
* result, so ```sumnototal``` or ```optnototal``` is the usual choice.
|
|
26848
|
+
* `partof` shares still refer to the sum of their own group.
|
|
26849
|
+
* Not supported together with `columnthereof`: there it has no effect.
|
|
26850
|
+
* <br /><br />
|
|
26851
|
+
* values: <br />
|
|
26852
|
+
* ```true // false```
|
|
26853
|
+
*/
|
|
26854
|
+
this.runningSum = false;
|
|
26855
|
+
/**
|
|
26856
|
+
* Draws every absolute variance column (d_*) listed in ```barColumns``` as a
|
|
26857
|
+
* variance waterfall down the rows instead of single bars from the axis.
|
|
26858
|
+
* A row starts where the row above ended; on ```opt``` and ```optnototal```
|
|
26859
|
+
* tables a "-" row with a positive variance moves to the left. Sum rows are
|
|
26860
|
+
* bars from the axis. Thin lines join the bars. Each row group starts at the
|
|
26861
|
+
* axis again, with ```runningSum``` the walk goes on from the sum row.
|
|
26862
|
+
* The column scales to fit the whole walk (unit-scaling does not apply).
|
|
26863
|
+
* Relative variance columns (dr_*) stay pins.
|
|
26864
|
+
* Has no effect together with ```interval``` or ```columnthereof```.
|
|
26865
|
+
* <br /><br />
|
|
26866
|
+
* values: <br />
|
|
26867
|
+
* ```true // false```
|
|
26868
|
+
*/
|
|
26869
|
+
this.varianceWaterfall = false;
|
|
26896
26870
|
/**
|
|
26897
26871
|
* Set the table type
|
|
26898
26872
|
* <br /><br />
|
|
@@ -26920,6 +26894,21 @@ const Table$1 = class Table {
|
|
|
26920
26894
|
* ```[{"rowGroup": "Umsatz", "category": "Applications", "subCategory": "Applications-A"}]```
|
|
26921
26895
|
*/
|
|
26922
26896
|
this.thereof = "[]";
|
|
26897
|
+
/**
|
|
26898
|
+
* Position of the `thereof` rows relative to their parent row.
|
|
26899
|
+
* <br /><br />
|
|
26900
|
+
* ```below``` (default) prints them below the parent, small and italic, with
|
|
26901
|
+
* the thereof label. ```above``` prints them before the parent in normal
|
|
26902
|
+
* size with an indented label, and the parent row looks like a subtotal
|
|
26903
|
+
* (bold, with a line above it). The parent keeps its operation sign and its
|
|
26904
|
+
* value, so a parent of `-` rows reads like "- Operating expenses".
|
|
26905
|
+
* With ```above``` list all subcategories of the parent (`"subCategory": ""`):
|
|
26906
|
+
* with only some of them the parent looks like a subtotal that does not add up.
|
|
26907
|
+
* <br /><br />
|
|
26908
|
+
* values: <br />
|
|
26909
|
+
* ```below // above```
|
|
26910
|
+
*/
|
|
26911
|
+
this.thereofPosition = "below";
|
|
26923
26912
|
/**
|
|
26924
26913
|
* JSON array of part-of objects with the keys `rowGroup` and `category`
|
|
26925
26914
|
* (both strings, both required).
|
|
@@ -27308,6 +27297,19 @@ const Table$1 = class Table {
|
|
|
27308
27297
|
this.errors.remove(errId);
|
|
27309
27298
|
}
|
|
27310
27299
|
}
|
|
27300
|
+
validateThereofPosition(newValue) {
|
|
27301
|
+
const errId = "WARN_thereofPosition";
|
|
27302
|
+
if (withStyled.isBlankInput(newValue) || withStyled.isValidThereofPosition(newValue)) {
|
|
27303
|
+
this.errors.remove(errId);
|
|
27304
|
+
}
|
|
27305
|
+
else {
|
|
27306
|
+
this.errors.addOrReplace({
|
|
27307
|
+
id: errId,
|
|
27308
|
+
type: "warning",
|
|
27309
|
+
message: "thereofPosition: invalid value '" + newValue + "' is not supported.",
|
|
27310
|
+
});
|
|
27311
|
+
}
|
|
27312
|
+
}
|
|
27311
27313
|
validatePartOf(newValue) {
|
|
27312
27314
|
const errId = "WARN_partof";
|
|
27313
27315
|
const invalidElements = withStyled.validatePartOfJsonStr(newValue);
|
|
@@ -27485,6 +27487,7 @@ const Table$1 = class Table {
|
|
|
27485
27487
|
this.validateType(this.type);
|
|
27486
27488
|
this.validateLimit(this.limit);
|
|
27487
27489
|
this.validateThereOf(this.thereof);
|
|
27490
|
+
this.validateThereofPosition(this.thereofPosition);
|
|
27488
27491
|
this.validatePartOf(this.partof);
|
|
27489
27492
|
this.validateOrderDirection(this.orderDirection);
|
|
27490
27493
|
this.validateOrderList(this.order);
|
|
@@ -27628,9 +27631,15 @@ const Table$1 = class Table {
|
|
|
27628
27631
|
prepareShowGroupTitle() {
|
|
27629
27632
|
return this.showGroupTitle;
|
|
27630
27633
|
}
|
|
27634
|
+
prepareThereofPosition() {
|
|
27635
|
+
var _a;
|
|
27636
|
+
return ((_a = this.thereofPosition) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === withStyled.ThereofPosition.ABOVE
|
|
27637
|
+
? withStyled.ThereofPosition.ABOVE
|
|
27638
|
+
: withStyled.ThereofPosition.BELOW;
|
|
27639
|
+
}
|
|
27631
27640
|
prepareTableType() {
|
|
27632
27641
|
var _a;
|
|
27633
|
-
return TableType[(_a = this.type) === null || _a === void 0 ? void 0 : _a.toUpperCase()];
|
|
27642
|
+
return withStyled.TableType[(_a = this.type) === null || _a === void 0 ? void 0 : _a.toUpperCase()];
|
|
27634
27643
|
}
|
|
27635
27644
|
prepareLimit() {
|
|
27636
27645
|
return Math.floor(Number(this.limit) || 0);
|
|
@@ -28137,7 +28146,7 @@ const Table$1 = class Table {
|
|
|
28137
28146
|
render() {
|
|
28138
28147
|
const fontStyles = this.getFontStyles();
|
|
28139
28148
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
28140
|
-
return (index.h(index.Host, { key: '
|
|
28149
|
+
return (index.h(index.Host, { key: '2af1b7f31952cd0ba32e0a069ce143d3402b4a77', style: fontStyles }, index.h("div", { key: 'b78ad13abb48a43c1da0aec4727372a482c39701' }, index.h("bn-table-renderer", { key: 'ab0132a3b57953379f6d8f5f19a18f95a14cc326', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), runningSum: this.runningSum, varianceWaterfall: this.varianceWaterfall, thereof: this.prepareThereOf(), thereofPosition: this.prepareThereofPosition(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), categoryIntervalPosition: this.prepareCategoryIntervalPosition(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, errors: this.errors, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
|
|
28141
28150
|
}
|
|
28142
28151
|
get element() { return index.getElement(this); }
|
|
28143
28152
|
static get watchers() { return {
|
|
@@ -28177,6 +28186,9 @@ const Table$1 = class Table {
|
|
|
28177
28186
|
"thereof": [{
|
|
28178
28187
|
"validateThereOf": 0
|
|
28179
28188
|
}],
|
|
28189
|
+
"thereofPosition": [{
|
|
28190
|
+
"validateThereofPosition": 0
|
|
28191
|
+
}],
|
|
28180
28192
|
"partof": [{
|
|
28181
28193
|
"validatePartOf": 0
|
|
28182
28194
|
}],
|
|
@@ -28258,7 +28270,16 @@ class Cell {
|
|
|
28258
28270
|
return result;
|
|
28259
28271
|
}
|
|
28260
28272
|
draw(dataFormatDigits, locale) {
|
|
28261
|
-
|
|
28273
|
+
return this.format(this.value, dataFormatDigits, locale);
|
|
28274
|
+
}
|
|
28275
|
+
/** True when the cell prints a number that is zero at the displayed digits. */
|
|
28276
|
+
roundsToZero(dataFormatDigits, locale) {
|
|
28277
|
+
return (typeof this.value === "number" &&
|
|
28278
|
+
!!this.type &&
|
|
28279
|
+
this.draw(dataFormatDigits, locale) === this.format(0, dataFormatDigits, locale));
|
|
28280
|
+
}
|
|
28281
|
+
format(value, dataFormatDigits, locale) {
|
|
28282
|
+
let cellValue = value;
|
|
28262
28283
|
if (cellValue === "undefined" || cellValue === undefined || cellValue == null) {
|
|
28263
28284
|
return "";
|
|
28264
28285
|
}
|
|
@@ -28315,22 +28336,22 @@ class TableRow {
|
|
|
28315
28336
|
}
|
|
28316
28337
|
initCssStyle() {
|
|
28317
28338
|
switch (this.type) {
|
|
28318
|
-
case TableRowType.HEADER: {
|
|
28339
|
+
case withStyled.TableRowType.HEADER: {
|
|
28319
28340
|
return "groupheader";
|
|
28320
28341
|
}
|
|
28321
|
-
case TableRowType.SEPERATORLINE: {
|
|
28342
|
+
case withStyled.TableRowType.SEPERATORLINE: {
|
|
28322
28343
|
return "";
|
|
28323
28344
|
}
|
|
28324
|
-
case TableRowType.DRILLELEMENT: {
|
|
28345
|
+
case withStyled.TableRowType.DRILLELEMENT: {
|
|
28325
28346
|
return "ofit";
|
|
28326
28347
|
}
|
|
28327
|
-
case TableRowType.PARTELEMENT: {
|
|
28348
|
+
case withStyled.TableRowType.PARTELEMENT: {
|
|
28328
28349
|
return "partof";
|
|
28329
28350
|
}
|
|
28330
|
-
case TableRowType.STANDARD: {
|
|
28351
|
+
case withStyled.TableRowType.STANDARD: {
|
|
28331
28352
|
return "";
|
|
28332
28353
|
}
|
|
28333
|
-
case TableRowType.SUM: {
|
|
28354
|
+
case withStyled.TableRowType.SUM: {
|
|
28334
28355
|
return "sum";
|
|
28335
28356
|
}
|
|
28336
28357
|
default: {
|
|
@@ -28346,13 +28367,13 @@ class TableRow {
|
|
|
28346
28367
|
if (scenario === "category" && categoryWidth != null) {
|
|
28347
28368
|
cssStyle = `category-${categoryWidth.toString()}`;
|
|
28348
28369
|
}
|
|
28349
|
-
if (this.type === TableRowType.HEADER) {
|
|
28370
|
+
if (this.type === withStyled.TableRowType.HEADER) {
|
|
28350
28371
|
cssStyle = "headerlabel";
|
|
28351
28372
|
}
|
|
28352
|
-
else if (this.type === TableRowType.SEPERATORLINE) {
|
|
28373
|
+
else if (this.type === withStyled.TableRowType.SEPERATORLINE) {
|
|
28353
28374
|
cssStyle = cellStyle !== null && cellStyle !== void 0 ? cellStyle : scenario;
|
|
28354
28375
|
}
|
|
28355
|
-
if (this.type === TableRowType.PARTELEMENT) {
|
|
28376
|
+
if (this.type === withStyled.TableRowType.PARTELEMENT) {
|
|
28356
28377
|
if (cellType === "percent") {
|
|
28357
28378
|
value = "-";
|
|
28358
28379
|
}
|
|
@@ -28463,24 +28484,27 @@ function labelMeasureContext() {
|
|
|
28463
28484
|
}
|
|
28464
28485
|
return measureContext;
|
|
28465
28486
|
}
|
|
28487
|
+
/** Bold digits of a font can be wider than the regular ones the glyph table lists. */
|
|
28488
|
+
const BOLD_WIDTH_MARGIN = 1.08;
|
|
28466
28489
|
/**
|
|
28467
28490
|
* Rendered width of a value label in px, measured with the font the SVG text uses. Falls
|
|
28468
28491
|
* back to estimateLabelWidth where no canvas can measure.
|
|
28469
28492
|
*/
|
|
28470
|
-
function labelWidth(text, fontSize, fontFamily, italic) {
|
|
28493
|
+
function labelWidth(text, fontSize, fontFamily, italic, bold = false) {
|
|
28494
|
+
const estimate = () => estimateLabelWidth(text, fontSize) * (bold ? BOLD_WIDTH_MARGIN : 1);
|
|
28471
28495
|
const ctx = labelMeasureContext();
|
|
28472
28496
|
if (ctx) {
|
|
28473
28497
|
// the canvas ignores a font it cannot parse and keeps the last one: the sentinel shows that
|
|
28474
28498
|
ctx.font = FONT_SENTINEL;
|
|
28475
28499
|
const sentinel = ctx.font;
|
|
28476
|
-
ctx.font = `${italic ? "italic " : ""}${fontSize}px ${fontFamily}`;
|
|
28500
|
+
ctx.font = `${italic ? "italic " : ""}${bold ? "bold " : ""}${fontSize}px ${fontFamily}`;
|
|
28477
28501
|
if (ctx.font === sentinel)
|
|
28478
|
-
return
|
|
28502
|
+
return estimate();
|
|
28479
28503
|
const width = ctx.measureText(text).width;
|
|
28480
28504
|
if (Number.isFinite(width) && (width > 0 || text === ""))
|
|
28481
28505
|
return width + MEASURE_PAD * fontSize;
|
|
28482
28506
|
}
|
|
28483
|
-
return
|
|
28507
|
+
return estimate();
|
|
28484
28508
|
}
|
|
28485
28509
|
/** The SVG fills the cell's content box: the requested column width minus the cell padding. */
|
|
28486
28510
|
function contentWidth(widthEm, emPx) {
|
|
@@ -28596,14 +28620,59 @@ function relativePinGeometry(widthEm, emPx, labels, headSize, reach) {
|
|
|
28596
28620
|
labelGap,
|
|
28597
28621
|
};
|
|
28598
28622
|
}
|
|
28599
|
-
|
|
28623
|
+
/**
|
|
28624
|
+
* Without `column` both sides get the fixed gutter. With it each side gets the room its
|
|
28625
|
+
* labels need beyond the bar area at the scale of the bars. The bar area keeps at least
|
|
28626
|
+
* half the width: only gutters that need more shrink, and a side that fits the fixed
|
|
28627
|
+
* gutter keeps its room then.
|
|
28628
|
+
*/
|
|
28629
|
+
function waterfallGeometry(widthEm, emPx, column) {
|
|
28600
28630
|
const totalWidth = contentWidth(widthEm, emPx);
|
|
28601
|
-
const
|
|
28631
|
+
const labelGap = LABEL_GAP_EM * emPx;
|
|
28632
|
+
const fixed = Math.min(BAR_LABEL_EM * emPx, totalWidth / 4);
|
|
28633
|
+
let left = fixed;
|
|
28634
|
+
let right = fixed;
|
|
28635
|
+
const range = column ? column.max - column.min : 0;
|
|
28636
|
+
if (column && range > 0) {
|
|
28637
|
+
// what the labels of one side stick out of the bar area at the given scale
|
|
28638
|
+
const room = (pointsLeft, pxPerUnit) => Math.max(0, ...column.labels
|
|
28639
|
+
.filter((label) => label.pointsLeft === pointsLeft)
|
|
28640
|
+
.map((label) => label.width + labelGap - (pointsLeft ? label.end - column.min : column.max - label.end) * pxPerUnit));
|
|
28641
|
+
left = room(true, 0);
|
|
28642
|
+
right = room(false, 0);
|
|
28643
|
+
const budget = totalWidth / 2;
|
|
28644
|
+
// a label needs less room the further its bar ends from the edge; a smaller gutter only widens the scale.
|
|
28645
|
+
// One pass is enough for gutters that fit; more passes only while they take more than half the width.
|
|
28646
|
+
for (let pass = 0; pass < 8; pass++) {
|
|
28647
|
+
const pxPerUnit = Math.max(0, totalWidth - left - right) / range;
|
|
28648
|
+
const nextLeft = Math.min(left, room(true, pxPerUnit));
|
|
28649
|
+
const nextRight = Math.min(right, room(false, pxPerUnit));
|
|
28650
|
+
const settled = nextLeft + nextRight <= budget || (nextLeft === left && nextRight === right);
|
|
28651
|
+
left = nextLeft;
|
|
28652
|
+
right = nextRight;
|
|
28653
|
+
if (settled)
|
|
28654
|
+
break;
|
|
28655
|
+
}
|
|
28656
|
+
if (left + right > budget) {
|
|
28657
|
+
if (Math.min(left, right) > fixed) {
|
|
28658
|
+
const shrink = budget / (left + right);
|
|
28659
|
+
left *= shrink;
|
|
28660
|
+
right *= shrink;
|
|
28661
|
+
}
|
|
28662
|
+
else if (left <= right) {
|
|
28663
|
+
right = budget - left;
|
|
28664
|
+
}
|
|
28665
|
+
else {
|
|
28666
|
+
left = budget - right;
|
|
28667
|
+
}
|
|
28668
|
+
}
|
|
28669
|
+
}
|
|
28602
28670
|
return {
|
|
28603
28671
|
totalWidth,
|
|
28604
|
-
|
|
28605
|
-
|
|
28606
|
-
|
|
28672
|
+
labelAreaLeft: left,
|
|
28673
|
+
labelAreaRight: right,
|
|
28674
|
+
barAreaWidth: totalWidth - left - right,
|
|
28675
|
+
labelGap,
|
|
28607
28676
|
};
|
|
28608
28677
|
}
|
|
28609
28678
|
|
|
@@ -28631,6 +28700,10 @@ const DEFAULT_STYLES = {
|
|
|
28631
28700
|
const AXIS_COLOR = "#666666";
|
|
28632
28701
|
/** Width of the pin line, in px before scaleFactor. */
|
|
28633
28702
|
const PIN_LINE_WIDTH = 3;
|
|
28703
|
+
/** Arrow head of a cut pin, in sides of the square pin head: IBCS draws it a bit larger. */
|
|
28704
|
+
const PIN_ARROW_RATIO = 1.2;
|
|
28705
|
+
/** Padding of the light band under the label on a cut pin, in label font sizes. */
|
|
28706
|
+
const PIN_BAND_PAD = 0.2;
|
|
28634
28707
|
/**
|
|
28635
28708
|
* Creates a unique pattern ID for the SVG defs
|
|
28636
28709
|
*/
|
|
@@ -28865,11 +28938,11 @@ function renderZigzagBreak(breakX, breakGap, yTop, barHeight, s) {
|
|
|
28865
28938
|
* exactly `columnWidthEm` em - see barColumnGeometry.ts.
|
|
28866
28939
|
*/
|
|
28867
28940
|
const AbsoluteVarianceBar = (props) => {
|
|
28868
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, decimalDigits, columnWidthEm = 10, labelWidths, sideMax, styles = DEFAULT_STYLES, } = props;
|
|
28941
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, decimalDigits, columnWidthEm = 10, labelWidths, sideMax, bold, styles = DEFAULT_STYLES, } = props;
|
|
28869
28942
|
const s = styles.scaleFactor;
|
|
28870
28943
|
const fs = styles.fontSize;
|
|
28871
28944
|
const displayValue = formattedValue || formatValue(value, false, measureScale, locale, 0, true, decimalDigits);
|
|
28872
|
-
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, labelWidth(displayValue, fs, styles.fontFamily, false));
|
|
28945
|
+
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, labelWidth(displayValue, fs, styles.fontFamily, false, bold));
|
|
28873
28946
|
const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
|
|
28874
28947
|
const { neg = Math.max(0, -columnStats.min), pos = Math.max(0, columnStats.max) } = sideMax !== null && sideMax !== void 0 ? sideMax : {};
|
|
28875
28948
|
const geometry = absoluteBarGeometry(columnWidthEm, styles.emPx, sides, { neg, pos });
|
|
@@ -28922,7 +28995,8 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
28922
28995
|
* Renders a relative variance pin chart (dr_ prefix).
|
|
28923
28996
|
* Line from the axis in the sentiment colour, ending in a square head in the look of the
|
|
28924
28997
|
* minuend, with the value label beside the head like an absolute bar label. A pin beyond
|
|
28925
|
-
* the pin area is cut and ends in an arrow
|
|
28998
|
+
* the pin area is cut and ends in an arrow. Its label stands on the line behind the arrow
|
|
28999
|
+
* head, on a light band, or after the arrow tip when the line is too short for it.
|
|
28926
29000
|
*
|
|
28927
29001
|
* Layout: [left label area][pin area with axis][right label area], summing to exactly
|
|
28928
29002
|
* `columnWidthEm` em - see barColumnGeometry.ts.
|
|
@@ -28930,13 +29004,14 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
28930
29004
|
*/
|
|
28931
29005
|
const RelativeVariancePin = (props) => {
|
|
28932
29006
|
var _a, _b;
|
|
28933
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, percentDigits, percentSign, columnWidthEm = 10, labelWidths, sideMax, styles = DEFAULT_STYLES, } = props;
|
|
29007
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, percentDigits, percentSign, columnWidthEm = 10, labelWidths, sideMax, bold, styles = DEFAULT_STYLES, } = props;
|
|
28934
29008
|
const s = styles.scaleFactor;
|
|
28935
29009
|
const fs = styles.fontSize;
|
|
28936
29010
|
const headSize = PIN_HEAD_SIZE * s;
|
|
28937
29011
|
const pinPx = 100 * styles.percentageScaling * fs;
|
|
28938
29012
|
const displayValue = formattedValue || formatValue(value, true, measureScale, locale, percentDigits, percentSign);
|
|
28939
|
-
const
|
|
29013
|
+
const ownWidth = labelWidth(displayValue, fs, styles.fontFamily, true, bold);
|
|
29014
|
+
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, ownWidth);
|
|
28940
29015
|
const { neg = Math.max(0, -columnStats.min), pos = Math.max(0, columnStats.max) } = sideMax !== null && sideMax !== void 0 ? sideMax : {};
|
|
28941
29016
|
const { totalWidth, negPinLength, posPinLength, axisX, labelGap } = relativePinGeometry(columnWidthEm, styles.emPx, sides, headSize, { neg: neg * pinPx, pos: pos * pinPx });
|
|
28942
29017
|
const centerY = height / 2;
|
|
@@ -28955,9 +29030,18 @@ const RelativeVariancePin = (props) => {
|
|
|
28955
29030
|
const headStyle = (_a = look === null || look === void 0 ? void 0 : look.minuend) !== null && _a !== void 0 ? _a : styles.scenarios.ac;
|
|
28956
29031
|
// the arrow tip lands on the outer edge of a full-length head, so the label after it stays in the cell
|
|
28957
29032
|
const tipX = axisX + direction * (maxPinLength + headSize / 2);
|
|
28958
|
-
const
|
|
28959
|
-
const
|
|
28960
|
-
|
|
29033
|
+
const arrowSize = PIN_ARROW_RATIO * headSize;
|
|
29034
|
+
const arrowBaseX = tipX - direction * arrowSize;
|
|
29035
|
+
// the band keeps a pad of full line to the arrow head and to the axis, else the label goes after the tip
|
|
29036
|
+
const bandPad = PIN_BAND_PAD * fs;
|
|
29037
|
+
const bandWidth = ownWidth + 2 * bandPad;
|
|
29038
|
+
const shaftLength = Math.abs(arrowBaseX - axisX) - (VARIANCE_AXIS_EM * styles.emPx) / 2;
|
|
29039
|
+
const labelOnShaft = isExtreme && shaftLength >= bandWidth + 2 * bandPad;
|
|
29040
|
+
const bandX = arrowBaseX - direction * (bandPad + bandWidth / 2) - bandWidth / 2;
|
|
29041
|
+
const labelX = labelOnShaft
|
|
29042
|
+
? bandX + bandWidth / 2
|
|
29043
|
+
: (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 }), 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("line", { x1: axisX, y1: centerY, x2: isExtreme ? arrowBaseX : pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": PIN_LINE_WIDTH * s }), 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 })), 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" })), 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)));
|
|
28961
29045
|
};
|
|
28962
29046
|
/**
|
|
28963
29047
|
* CellBarChart - Renders IBCS-compliant variance bar charts.
|
|
@@ -28979,6 +29063,14 @@ const CellBarChart = (props) => {
|
|
|
28979
29063
|
return index.h(AbsoluteVarianceBar, Object.assign({}, props));
|
|
28980
29064
|
};
|
|
28981
29065
|
|
|
29066
|
+
/**
|
|
29067
|
+
* Label text of a waterfall bar. Scenario values carry no variance sentiment: unsigned per
|
|
29068
|
+
* IBCS. A variance keeps its sign (`signed`).
|
|
29069
|
+
*/
|
|
29070
|
+
function waterfallLabelText(value, kind, measureScale, locale, decimalDigits, signed = false) {
|
|
29071
|
+
const text = formatValue(value, kind === "partof", measureScale, locale, 0, true, decimalDigits);
|
|
29072
|
+
return signed ? text : text.replace(/^\+/, "");
|
|
29073
|
+
}
|
|
28982
29074
|
/**
|
|
28983
29075
|
* Renders one row of an IBCS waterfall for a scenario bar column.
|
|
28984
29076
|
*
|
|
@@ -28991,19 +29083,27 @@ const CellBarChart = (props) => {
|
|
|
28991
29083
|
* Layout: [left label area][bar area][right label area]
|
|
28992
29084
|
* The value label sits at the bar's free end (right of rightward bars,
|
|
28993
29085
|
* left of leftward bars). thereof/partof rows additionally get dashed
|
|
28994
|
-
* guides marking their parent bar's extent.
|
|
29086
|
+
* guides marking their parent bar's extent. A guide or axis line that would
|
|
29087
|
+
* run through the label is left out in that row.
|
|
29088
|
+
*
|
|
29089
|
+
* An absolute variance column is drawn as a variance waterfall: the bar in the color of
|
|
29090
|
+
* the sentiment and the pattern of the minuend, the axis in the look of the reference
|
|
29091
|
+
* scenario in every row, a signed label, and thin connectors to the rows above and below
|
|
29092
|
+
* in place of the dashed guides. The axis and the connectors join the rows, so where one
|
|
29093
|
+
* meets the label it is only interrupted over the height of the text.
|
|
28995
29094
|
*/
|
|
28996
29095
|
const WaterfallBar = (props) => {
|
|
28997
|
-
|
|
29096
|
+
var _a;
|
|
29097
|
+
const { value, scenario, height, isPositiveGood, measureScale, locale, decimalDigits, columnWidthEm = 10, styles = DEFAULT_STYLES, waterfall, geometry, bold, connectorReach = { top: 0, bottom: 0 }, } = props;
|
|
28998
29098
|
const s = styles.scaleFactor;
|
|
28999
29099
|
const fs = styles.fontSize;
|
|
29000
29100
|
const range = waterfall.max - waterfall.min;
|
|
29001
29101
|
if (value === null || value === undefined || isNaN(value) || range <= 0) {
|
|
29002
29102
|
return (index.h("span", { class: "bar-chart-empty", style: { color: styles.fontColor, fontStyle: "italic" } }, "-"));
|
|
29003
29103
|
}
|
|
29004
|
-
const { totalWidth,
|
|
29104
|
+
const { totalWidth, labelAreaLeft, barAreaWidth, labelGap } = geometry !== null && geometry !== void 0 ? geometry : waterfallGeometry(columnWidthEm, styles.emPx);
|
|
29005
29105
|
const pxPerUnit = barAreaWidth / range;
|
|
29006
|
-
const xOf = (coordinate) =>
|
|
29106
|
+
const xOf = (coordinate) => labelAreaLeft + (coordinate - waterfall.min) * pxPerUnit;
|
|
29007
29107
|
const padding = 2 * s;
|
|
29008
29108
|
const barHeight = height - padding * 2;
|
|
29009
29109
|
const barY = padding;
|
|
@@ -29012,15 +29112,37 @@ const WaterfallBar = (props) => {
|
|
|
29012
29112
|
const endX = xOf(waterfall.end);
|
|
29013
29113
|
const barX = Math.min(startX, endX);
|
|
29014
29114
|
const barWidth = Math.abs(endX - startX);
|
|
29015
|
-
|
|
29016
|
-
const
|
|
29017
|
-
const
|
|
29018
|
-
|
|
29019
|
-
const
|
|
29115
|
+
// null for a scenario column, which ignores the sentiment
|
|
29116
|
+
const look = getVarianceLook(scenario, styles);
|
|
29117
|
+
const sentimentStyle = getBarStyle(scenario, value, isPositiveGood, styles);
|
|
29118
|
+
const minuendPattern = look === null || look === void 0 ? void 0 : look.minuend.fillpattern;
|
|
29119
|
+
const barStyle = minuendPattern === "hatched" || minuendPattern === "outlined"
|
|
29120
|
+
? Object.assign(Object.assign({}, sentimentStyle), { fillpattern: minuendPattern }) : sentimentStyle;
|
|
29121
|
+
const patternPrefix = look ? (sentimentStyle === styles.positive ? "pos" : "neg") : getScenarioType(scenario);
|
|
29122
|
+
const fillValue = getBarFill(barStyle, patternPrefix);
|
|
29123
|
+
const { stroke: barStroke, strokeWidth: barStrokeWidth } = look && barStyle.fillpattern === "hatched" ? { stroke: barStyle.stroke, strokeWidth: 1 } : getBarStroke(barStyle);
|
|
29124
|
+
const displayValue = waterfallLabelText(value, waterfall.kind, measureScale, locale, decimalDigits, look !== null);
|
|
29020
29125
|
const pointsLeft = endX < startX;
|
|
29021
29126
|
const labelX = pointsLeft ? barX - labelGap : barX + barWidth + labelGap;
|
|
29022
29127
|
const labelAnchor = pointsLeft ? "end" : "start";
|
|
29023
|
-
|
|
29128
|
+
// a line through the label makes it unreadable, so the row drops it
|
|
29129
|
+
const labelSize = labelWidth(displayValue, fs, styles.fontFamily, false, bold);
|
|
29130
|
+
const labelPad = labelGap / 2;
|
|
29131
|
+
const labelFrom = (pointsLeft ? labelX - labelSize : labelX) - labelPad;
|
|
29132
|
+
const labelTo = (pointsLeft ? labelX : labelX + labelSize) + labelPad;
|
|
29133
|
+
const meetsLabel = (x) => x > labelFrom && x < labelTo;
|
|
29134
|
+
const parentEndX = waterfall.parentEnd !== undefined ? xOf(waterfall.parentEnd) : undefined;
|
|
29135
|
+
// the parts of a vertical line of a variance waterfall that stay clear of the label text
|
|
29136
|
+
const labelTop = height / 2 - fs / 2;
|
|
29137
|
+
const labelBottom = height / 2 + fs / 2;
|
|
29138
|
+
const clearOfLabel = (x, y1, y2, halfWidth = 0) => x + halfWidth > labelFrom && x - halfWidth < labelTo
|
|
29139
|
+
? [[y1, Math.min(y2, labelTop)], [Math.max(y1, labelBottom), y2]].filter(([from, to]) => to > from)
|
|
29140
|
+
: [[y1, y2]];
|
|
29141
|
+
const axisTop = -connectorReach.top;
|
|
29142
|
+
const axisBottom = height + connectorReach.bottom;
|
|
29143
|
+
return (index.h("svg", { width: totalWidth, height: height, class: `cell-bar-chart waterfall-bar${look ? " variance-waterfall" : ""}`, style: { overflow: "visible" } }, index.h(PatternDefs, { styles: styles }), !look && !meetsLabel(axisX) && (index.h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s })), waterfall.parentStart !== undefined && waterfall.parentEnd !== undefined && (index.h("line", { x1: xOf(waterfall.parentStart), y1: 0, x2: xOf(waterfall.parentStart), y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s, "stroke-dasharray": `${2 * s},${2 * s}` })), waterfall.parentStart !== undefined && parentEndX !== undefined && !meetsLabel(parentEndX) && (index.h("line", { x1: parentEndX, y1: 0, x2: parentEndX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s, "stroke-dasharray": `${2 * s},${2 * s}` })), (_a = waterfall.connectors) === null || _a === void 0 ? void 0 :
|
|
29144
|
+
_a.map(({ at, part }) => clearOfLabel(xOf(at), part === "bottom" ? barY + barHeight : axisTop, part === "top" ? barY : axisBottom).map(([y1, y2]) => (index.h("line", { class: "waterfall-connector", x1: xOf(at), y1: y1, x2: xOf(at), y2: y2, stroke: AXIS_COLOR, "stroke-width": 1 * s })))), barWidth > 0 && (index.h("rect", { x: barX, y: barY, width: barWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), look &&
|
|
29145
|
+
clearOfLabel(axisX, axisTop, axisBottom, (VARIANCE_AXIS_EM * styles.emPx) / 2).map(([y1, y2]) => (index.h("g", { transform: `translate(0,${y1})` }, index.h(VarianceAxis, { x: axisX, height: y2 - y1, look: look, styles: styles })))), index.h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": labelAnchor, fill: styles.fontColor, "font-size": fs, "font-family": styles.fontFamily }, displayValue)));
|
|
29024
29146
|
};
|
|
29025
29147
|
|
|
29026
29148
|
/** '', null and a missing rowGroup are one group. */
|
|
@@ -29038,7 +29160,7 @@ const BLANK_SAFE_ROWGROUP = `IFNULL(${QueryColumnNames.ROWGROUP}, '')`;
|
|
|
29038
29160
|
class QueryGroups {
|
|
29039
29161
|
constructor(config) {
|
|
29040
29162
|
this.groups = [QueryColumnNames.CATEGORY, QueryColumnNames.CATEGORYINDEX];
|
|
29041
|
-
if (TableType.OPT === config.type || TableType.OPTNOTOTAL === config.type) {
|
|
29163
|
+
if (withStyled.TableType.OPT === config.type || withStyled.TableType.OPTNOTOTAL === config.type) {
|
|
29042
29164
|
this.groups.unshift(QueryColumnNames.OPERATION);
|
|
29043
29165
|
}
|
|
29044
29166
|
if (config.grouped) {
|
|
@@ -29062,6 +29184,292 @@ class QueryGroups {
|
|
|
29062
29184
|
}
|
|
29063
29185
|
}
|
|
29064
29186
|
|
|
29187
|
+
function sameCoordinate(a, b) {
|
|
29188
|
+
return Math.abs(a - b) <= 1e-9 * Math.max(1, Math.abs(a), Math.abs(b));
|
|
29189
|
+
}
|
|
29190
|
+
/**
|
|
29191
|
+
* Sets the connectors of a variance walk in print order. A null unit is a printed row
|
|
29192
|
+
* without a bar. Two rows are joined only where the walk goes on: a group that restarts
|
|
29193
|
+
* at zero gets no line from the sum row above it.
|
|
29194
|
+
*/
|
|
29195
|
+
function connectWalk(units, thereofAbove) {
|
|
29196
|
+
const add = (bar, at, part) => {
|
|
29197
|
+
var _a;
|
|
29198
|
+
bar.connectors = [...((_a = bar.connectors) !== null && _a !== void 0 ? _a : []), { at, part }];
|
|
29199
|
+
};
|
|
29200
|
+
const link = (from, between, to, at) => {
|
|
29201
|
+
add(from, at, "bottom");
|
|
29202
|
+
between.forEach((bar) => add(bar, at, "through"));
|
|
29203
|
+
add(to, at, "top");
|
|
29204
|
+
};
|
|
29205
|
+
let previous = null;
|
|
29206
|
+
for (const unit of units) {
|
|
29207
|
+
if (unit === null) {
|
|
29208
|
+
previous = null;
|
|
29209
|
+
continue;
|
|
29210
|
+
}
|
|
29211
|
+
const { main, children } = unit;
|
|
29212
|
+
const entry = main.kind === "anchor" ? main.end : main.start;
|
|
29213
|
+
if (previous && !unit.gapAbove && sameCoordinate(previous.main.end, entry)) {
|
|
29214
|
+
// the line runs beside the thereof rows printed between the two rows
|
|
29215
|
+
link(previous.main, thereofAbove ? children : previous.children, main, entry);
|
|
29216
|
+
}
|
|
29217
|
+
if (!unit.gapAbove && !unit.gapBelow) {
|
|
29218
|
+
children.forEach((child, index) => {
|
|
29219
|
+
if (index > 0)
|
|
29220
|
+
link(children[index - 1], [], child, child.start);
|
|
29221
|
+
});
|
|
29222
|
+
if (children.length > 0) {
|
|
29223
|
+
const last = children[children.length - 1];
|
|
29224
|
+
if (!thereofAbove) {
|
|
29225
|
+
link(main, [], children[0], main.start);
|
|
29226
|
+
}
|
|
29227
|
+
else if (sameCoordinate(last.end, main.end)) {
|
|
29228
|
+
link(last, [], main, main.end);
|
|
29229
|
+
}
|
|
29230
|
+
}
|
|
29231
|
+
}
|
|
29232
|
+
previous = unit.gapBelow ? null : unit;
|
|
29233
|
+
}
|
|
29234
|
+
}
|
|
29235
|
+
/**
|
|
29236
|
+
* Waterfall geometry per raw result row and column, keyed by row identity
|
|
29237
|
+
* (the factory iterates the same row objects the calculator walked).
|
|
29238
|
+
*/
|
|
29239
|
+
class WaterfallResult {
|
|
29240
|
+
constructor() {
|
|
29241
|
+
this.geometry = new Map();
|
|
29242
|
+
this.columns = new Set();
|
|
29243
|
+
}
|
|
29244
|
+
set(row, column, data) {
|
|
29245
|
+
let columns = this.geometry.get(row);
|
|
29246
|
+
if (!columns) {
|
|
29247
|
+
columns = new Map();
|
|
29248
|
+
this.geometry.set(row, columns);
|
|
29249
|
+
}
|
|
29250
|
+
columns.set(column, data);
|
|
29251
|
+
this.columns.add(column);
|
|
29252
|
+
}
|
|
29253
|
+
get(row, column) {
|
|
29254
|
+
var _a;
|
|
29255
|
+
return (_a = this.geometry.get(row)) === null || _a === void 0 ? void 0 : _a.get(column);
|
|
29256
|
+
}
|
|
29257
|
+
/** True when the column has waterfall bars, also for a row of it that got none. */
|
|
29258
|
+
has(column) {
|
|
29259
|
+
return this.columns.has(column);
|
|
29260
|
+
}
|
|
29261
|
+
}
|
|
29262
|
+
/** True when the result contains grouping structure (sum, subtotal, or drill rows). */
|
|
29263
|
+
function hasGroupingStructure(queryData) {
|
|
29264
|
+
for (const groupData of queryData) {
|
|
29265
|
+
for (const row of groupData) {
|
|
29266
|
+
const type = row[QueryColumnNames.TYPE];
|
|
29267
|
+
if (type === withStyled.TableRowType.SUM ||
|
|
29268
|
+
type === withStyled.TableRowType.GROUPSUM ||
|
|
29269
|
+
type === withStyled.TableRowType.DRILLELEMENT ||
|
|
29270
|
+
type === withStyled.TableRowType.PARTELEMENT) {
|
|
29271
|
+
return true;
|
|
29272
|
+
}
|
|
29273
|
+
}
|
|
29274
|
+
}
|
|
29275
|
+
return false;
|
|
29276
|
+
}
|
|
29277
|
+
/**
|
|
29278
|
+
* Alias of the signed sum of a bar column on the generated REST row of an OPT table. The
|
|
29279
|
+
* row prints the unsigned sum of the rows it folds, the walk needs the signed one.
|
|
29280
|
+
*/
|
|
29281
|
+
function restSignedAlias(column) {
|
|
29282
|
+
return `${column}__signed`;
|
|
29283
|
+
}
|
|
29284
|
+
/** Sign of an OPT entry row; the generated REST row has `restOperation` in place of `operation`. */
|
|
29285
|
+
function operationSign(row) {
|
|
29286
|
+
var _a;
|
|
29287
|
+
return ((_a = row[QueryColumnNames.OPERATION]) !== null && _a !== void 0 ? _a : row.restOperation) === "-" ? -1 : 1;
|
|
29288
|
+
}
|
|
29289
|
+
/**
|
|
29290
|
+
* Signed waterfall contribution of a row for one column.
|
|
29291
|
+
*
|
|
29292
|
+
* Non-OPT table types aggregate `SUM(scn * transformOperator(operation))`, so ENTRY
|
|
29293
|
+
* values arrive already signed. OPT types aggregate plain `SUM(scn)` with the sign
|
|
29294
|
+
* carried in the visible operation column, so the sign is applied here. A REST row that
|
|
29295
|
+
* folds "+" and "-" rows has no single sign, it brings its signed sum. Sum rows are
|
|
29296
|
+
* fully signed in both modes.
|
|
29297
|
+
*/
|
|
29298
|
+
function signedValue(row, column, tableType) {
|
|
29299
|
+
const raw = row[column];
|
|
29300
|
+
if (raw === null || raw === undefined) {
|
|
29301
|
+
return null;
|
|
29302
|
+
}
|
|
29303
|
+
const value = Number(raw);
|
|
29304
|
+
if (isNaN(value)) {
|
|
29305
|
+
return null;
|
|
29306
|
+
}
|
|
29307
|
+
const isOpt = tableType === withStyled.TableType.OPT || tableType === withStyled.TableType.OPTNOTOTAL;
|
|
29308
|
+
if (isOpt && row[QueryColumnNames.TYPE] === withStyled.TableRowType.ENTRY) {
|
|
29309
|
+
const signed = row[restSignedAlias(column)];
|
|
29310
|
+
return typeof signed === "number" ? signed : operationSign(row) * value;
|
|
29311
|
+
}
|
|
29312
|
+
return value;
|
|
29313
|
+
}
|
|
29314
|
+
/**
|
|
29315
|
+
* Computes waterfall bar geometry for the given scenario columns by walking the
|
|
29316
|
+
* segmented query result once per column in display order.
|
|
29317
|
+
*
|
|
29318
|
+
* - ENTRY rows (incl. REST) cascade from the running total by their signed value.
|
|
29319
|
+
* The REST row of an OPT table takes the sign of `restOperation`, or its signed sum.
|
|
29320
|
+
* - SUM / GROUP_SUM rows anchor at zero. A SUM row resets the running total to its
|
|
29321
|
+
* value, a GROUP_SUM row resets it to zero.
|
|
29322
|
+
* - DRILLELEMENT (thereof) rows form a sub-cascade from their parent bar's start in
|
|
29323
|
+
* the parent's direction; the running total is untouched.
|
|
29324
|
+
* - PARTELEMENT (partof) rows cascade a `share * parent width` segment the same way.
|
|
29325
|
+
* Note: the share denominator is the group sum (or SUM_TOTAL when ungrouped) per
|
|
29326
|
+
* `createPartOfDrillRows`, not literally the parent row's value.
|
|
29327
|
+
* - GROUPHEAD rows get no bar and restart the running total at zero: every row group
|
|
29328
|
+
* is its own cascade that ends at its GROUP_SUM.
|
|
29329
|
+
* - With `runningSum` a GROUP_SUM row holds the result of all groups so far, so the
|
|
29330
|
+
* cascade goes on from its value and no GROUPHEAD restarts it.
|
|
29331
|
+
* - NaN rows get no bar; a NaN parent orphans its drill children.
|
|
29332
|
+
*
|
|
29333
|
+
* An absolute variance column walks the same way with three differences: a thereof row
|
|
29334
|
+
* steps by its signed value times the operation sign of its parent, so its siblings can
|
|
29335
|
+
* go both ways and leave the parent bar; a partof row gets no bar; and the bars carry
|
|
29336
|
+
* connectors to the rows printed above and below.
|
|
29337
|
+
*
|
|
29338
|
+
* @param queryData - Segmented result rows from DataQuery.execute().
|
|
29339
|
+
* @param columns - Plain scenario (ac1..pl4) or absolute variance column keys; no `##` composite keys.
|
|
29340
|
+
* @param tableType - Table aggregation mode, needed for OPT sign handling.
|
|
29341
|
+
* @param runningSum - True when the GROUP_SUM rows are running results.
|
|
29342
|
+
* @param thereofAbove - True when thereof rows are printed above their parent; only the connectors depend on it.
|
|
29343
|
+
*/
|
|
29344
|
+
function computeWaterfall(queryData, columns, tableType, runningSum = false, thereofAbove = false) {
|
|
29345
|
+
const result = new WaterfallResult();
|
|
29346
|
+
const isOpt = tableType === withStyled.TableType.OPT || tableType === withStyled.TableType.OPTNOTOTAL;
|
|
29347
|
+
for (const column of columns) {
|
|
29348
|
+
const variance = new VarianceScenario(column).isValid;
|
|
29349
|
+
let running = 0;
|
|
29350
|
+
let lastParent;
|
|
29351
|
+
let subCursor = 0;
|
|
29352
|
+
const emitted = [];
|
|
29353
|
+
const units = [];
|
|
29354
|
+
let unit = null;
|
|
29355
|
+
const emit = (row, data) => {
|
|
29356
|
+
emitted.push(data);
|
|
29357
|
+
result.set(row, column, data);
|
|
29358
|
+
return data;
|
|
29359
|
+
};
|
|
29360
|
+
const startUnit = (main) => {
|
|
29361
|
+
unit = main && { main, children: [], gapAbove: false, gapBelow: false };
|
|
29362
|
+
units.push(unit);
|
|
29363
|
+
};
|
|
29364
|
+
for (const groupData of queryData) {
|
|
29365
|
+
for (const row of groupData) {
|
|
29366
|
+
const type = row[QueryColumnNames.TYPE];
|
|
29367
|
+
if (type === withStyled.TableRowType.GROUPHEAD) {
|
|
29368
|
+
// a group sum only totals its own rows, so the cascade must not carry over
|
|
29369
|
+
if (!runningSum) {
|
|
29370
|
+
running = 0;
|
|
29371
|
+
}
|
|
29372
|
+
lastParent = undefined;
|
|
29373
|
+
startUnit(null);
|
|
29374
|
+
continue;
|
|
29375
|
+
}
|
|
29376
|
+
const value = signedValue(row, column, tableType);
|
|
29377
|
+
if (type === withStyled.TableRowType.ENTRY) {
|
|
29378
|
+
if (value === null) {
|
|
29379
|
+
lastParent = undefined;
|
|
29380
|
+
startUnit(null);
|
|
29381
|
+
continue;
|
|
29382
|
+
}
|
|
29383
|
+
startUnit(emit(row, { start: running, end: running + value, min: 0, max: 0, kind: "cascade" }));
|
|
29384
|
+
// thereof values of an OPT table are unsigned like the entries, so they take the sign of the parent
|
|
29385
|
+
const sign = isOpt ? operationSign(row) : 1;
|
|
29386
|
+
lastParent = { start: running, end: running + value, sign };
|
|
29387
|
+
subCursor = lastParent.start;
|
|
29388
|
+
running += value;
|
|
29389
|
+
}
|
|
29390
|
+
else if (type === withStyled.TableRowType.SUM || type === withStyled.TableRowType.GROUPSUM) {
|
|
29391
|
+
if (value === null) {
|
|
29392
|
+
lastParent = undefined;
|
|
29393
|
+
startUnit(null);
|
|
29394
|
+
continue;
|
|
29395
|
+
}
|
|
29396
|
+
startUnit(emit(row, { start: 0, end: value, min: 0, max: 0, kind: "anchor" }));
|
|
29397
|
+
lastParent = { start: 0, end: value, sign: 1 };
|
|
29398
|
+
subCursor = 0;
|
|
29399
|
+
// a group sum closes its group (there may be no GROUPHEAD row when the title is hidden)
|
|
29400
|
+
running = type === withStyled.TableRowType.GROUPSUM && !runningSum ? 0 : value;
|
|
29401
|
+
}
|
|
29402
|
+
else if (variance && (type === withStyled.TableRowType.DRILLELEMENT || type === withStyled.TableRowType.PARTELEMENT)) {
|
|
29403
|
+
if (type === withStyled.TableRowType.DRILLELEMENT && value !== null && lastParent !== undefined && unit) {
|
|
29404
|
+
const end = subCursor + lastParent.sign * value;
|
|
29405
|
+
unit.children.push(emit(row, { start: subCursor, end, min: 0, max: 0, kind: "thereof" }));
|
|
29406
|
+
subCursor = end;
|
|
29407
|
+
}
|
|
29408
|
+
else if (unit) {
|
|
29409
|
+
// only thereof rows move above the parent
|
|
29410
|
+
if (thereofAbove && type === withStyled.TableRowType.DRILLELEMENT)
|
|
29411
|
+
unit.gapAbove = true;
|
|
29412
|
+
else
|
|
29413
|
+
unit.gapBelow = true;
|
|
29414
|
+
}
|
|
29415
|
+
}
|
|
29416
|
+
else if (type === withStyled.TableRowType.DRILLELEMENT) {
|
|
29417
|
+
if (value === null || lastParent === undefined) {
|
|
29418
|
+
continue;
|
|
29419
|
+
}
|
|
29420
|
+
const direction = Math.sign(lastParent.end - lastParent.start) || 1;
|
|
29421
|
+
const end = subCursor + direction * Math.abs(value);
|
|
29422
|
+
emit(row, {
|
|
29423
|
+
start: subCursor,
|
|
29424
|
+
end,
|
|
29425
|
+
min: 0,
|
|
29426
|
+
max: 0,
|
|
29427
|
+
kind: "thereof",
|
|
29428
|
+
parentStart: lastParent.start,
|
|
29429
|
+
parentEnd: lastParent.end,
|
|
29430
|
+
});
|
|
29431
|
+
subCursor = end;
|
|
29432
|
+
}
|
|
29433
|
+
else if (type === withStyled.TableRowType.PARTELEMENT) {
|
|
29434
|
+
if (value === null || lastParent === undefined) {
|
|
29435
|
+
continue;
|
|
29436
|
+
}
|
|
29437
|
+
const end = subCursor + value * (lastParent.end - lastParent.start);
|
|
29438
|
+
emit(row, {
|
|
29439
|
+
start: subCursor,
|
|
29440
|
+
end,
|
|
29441
|
+
min: 0,
|
|
29442
|
+
max: 0,
|
|
29443
|
+
kind: "partof",
|
|
29444
|
+
parentStart: lastParent.start,
|
|
29445
|
+
parentEnd: lastParent.end,
|
|
29446
|
+
});
|
|
29447
|
+
subCursor = end;
|
|
29448
|
+
}
|
|
29449
|
+
}
|
|
29450
|
+
}
|
|
29451
|
+
if (variance) {
|
|
29452
|
+
connectWalk(units, thereofAbove);
|
|
29453
|
+
}
|
|
29454
|
+
// All rows of a column share one coordinate system including zero
|
|
29455
|
+
let min = 0;
|
|
29456
|
+
let max = 0;
|
|
29457
|
+
for (const data of emitted) {
|
|
29458
|
+
min = Math.min(min, data.start, data.end);
|
|
29459
|
+
max = Math.max(max, data.start, data.end);
|
|
29460
|
+
}
|
|
29461
|
+
for (const data of emitted) {
|
|
29462
|
+
data.min = min;
|
|
29463
|
+
data.max = max;
|
|
29464
|
+
}
|
|
29465
|
+
}
|
|
29466
|
+
return result;
|
|
29467
|
+
}
|
|
29468
|
+
|
|
29469
|
+
/** Adds a group sum to a running result; it stays missing as long as no group had a value. */
|
|
29470
|
+
function addGroupSum(running, value) {
|
|
29471
|
+
return running == null && value == null ? value : (running !== null && running !== void 0 ? running : 0) + (value !== null && value !== void 0 ? value : 0);
|
|
29472
|
+
}
|
|
29065
29473
|
/**
|
|
29066
29474
|
* AlaSQL-based query builder that produces the complete table result set for bn-table.
|
|
29067
29475
|
*
|
|
@@ -29177,6 +29585,9 @@ class DataQuery {
|
|
|
29177
29585
|
this.createTotalSumRow(queries, sumGroupQueries, scenariosSUMQuery);
|
|
29178
29586
|
// executes main queries
|
|
29179
29587
|
queries.forEach((query) => res.push(this.exec(query)));
|
|
29588
|
+
if (this.hasRunningSum()) {
|
|
29589
|
+
this.accumulateGroupSums(res, [...new Set(this.exctractScenarioNames(scenariosSUMQuery))]);
|
|
29590
|
+
}
|
|
29180
29591
|
this.detectNaNCells(this.config.scenarios, res);
|
|
29181
29592
|
this.createThereOfDrillRows(scenarios, attributesSQL, order, res);
|
|
29182
29593
|
this.createPartOfDrillRows(scenarios, order, sumGroupQueries, res);
|
|
@@ -29221,7 +29632,7 @@ class DataQuery {
|
|
|
29221
29632
|
* value by the corresponding group sum to produce a percentage.
|
|
29222
29633
|
*/
|
|
29223
29634
|
createPartOfDrillRows(scenarios, order, sumGroupQueries, res) {
|
|
29224
|
-
if (this.config.partOf == null || this.config.partOf.length === 0 || this.config.type === TableType.LIST) {
|
|
29635
|
+
if (this.config.partOf == null || this.config.partOf.length === 0 || this.config.type === withStyled.TableType.LIST) {
|
|
29225
29636
|
return;
|
|
29226
29637
|
}
|
|
29227
29638
|
const drillQueries = this.createPartOfQuery(scenarios, order);
|
|
@@ -29267,8 +29678,13 @@ class DataQuery {
|
|
|
29267
29678
|
.map((name) => `SUM(${name}) as ${name}`)
|
|
29268
29679
|
.join(", ");
|
|
29269
29680
|
// a REST row of only "-" rows counts as "-" for the op sentiment; not named operation, so it stays hidden
|
|
29270
|
-
|
|
29271
|
-
|
|
29681
|
+
// the row prints the unsigned sum; the walk of a waterfall needs the signed sum of its bar columns
|
|
29682
|
+
const restSigned = this.exctractScenarioNames(scenarios)
|
|
29683
|
+
.filter((name) => { var _a; return (_a = this.config.barColumns) === null || _a === void 0 ? void 0 : _a.includes(name); })
|
|
29684
|
+
.map((name) => `, SUM(${name} * transformOperator(operation)) as ${restSignedAlias(name)}`)
|
|
29685
|
+
.join("");
|
|
29686
|
+
const restOperation = withStyled.TableType.OPT === this.config.type || withStyled.TableType.OPTNOTOTAL === this.config.type
|
|
29687
|
+
? `, CASE WHEN MAX(transformOperator(operation)) = -1 THEN '-' ELSE '+' END as restOperation${restSigned}`
|
|
29272
29688
|
: "";
|
|
29273
29689
|
querys.push(`SELECT ${QueryColumnNames.ROWNR}, 1 as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, 'NO_GROUP' as ${QueryColumnNames.ROWGROUP}, ${this.bind(String((_a = rowGroupEntry.rowGroup) !== null && _a !== void 0 ? _a : ""))} as restRowGroup, 'REST' as ${QueryColumnNames.CATEGORY}${restOperation} ${restScenarios.length > 0 ? ", " + restScenarios : ""} FROM` +
|
|
29274
29690
|
` (SELECT ROWNUM() AS ${QueryColumnNames.ROWNR}, ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, ${this.bind(String(rowGroupEntry.rowGroup || "NO_GROUP"))} as ${QueryColumnNames.ROWGROUP}, ${groups.select()} ${scenarios.length > 0 ? ",".concat(scenarios) : ""}${this.sortSelect} FROM ${this.fromExpr} ${queryWhereSection} GROUP BY ${groups} ORDER BY ${order[0]})` +
|
|
@@ -29305,10 +29721,38 @@ class DataQuery {
|
|
|
29305
29721
|
}
|
|
29306
29722
|
}
|
|
29307
29723
|
hasGroupSum() {
|
|
29308
|
-
return (TableType.SUM === this.config.type ||
|
|
29309
|
-
TableType.SUMNOTOTAL === this.config.type ||
|
|
29310
|
-
TableType.OPT === this.config.type ||
|
|
29311
|
-
TableType.OPTNOTOTAL === this.config.type);
|
|
29724
|
+
return (withStyled.TableType.SUM === this.config.type ||
|
|
29725
|
+
withStyled.TableType.SUMNOTOTAL === this.config.type ||
|
|
29726
|
+
withStyled.TableType.OPT === this.config.type ||
|
|
29727
|
+
withStyled.TableType.OPTNOTOTAL === this.config.type);
|
|
29728
|
+
}
|
|
29729
|
+
/**
|
|
29730
|
+
* True when the group sum rows are running results: only a grouped table with group sum
|
|
29731
|
+
* rows has them. Column drill values of the group sum rows are not accumulated, so
|
|
29732
|
+
* `runningSum` is off with columnthereof.
|
|
29733
|
+
*/
|
|
29734
|
+
hasRunningSum() {
|
|
29735
|
+
return (this.config.runningSum && this.config.grouped && this.hasGroupSum() && this.config.categoryThereOf.size === 0);
|
|
29736
|
+
}
|
|
29737
|
+
/**
|
|
29738
|
+
* Turns the GROUP_SUM rows into running results: each one gets the raw aliases of all
|
|
29739
|
+
* group sums before it added (scenarios, `_cnt`, variances and `dr_*` denominators).
|
|
29740
|
+
* Runs before the NaN step and the relative variance division, where all of them are sums.
|
|
29741
|
+
* A missing value stays missing until a group brings a real one.
|
|
29742
|
+
*/
|
|
29743
|
+
accumulateGroupSums(res, aliases) {
|
|
29744
|
+
const running = {};
|
|
29745
|
+
for (const segment of res) {
|
|
29746
|
+
for (const row of segment) {
|
|
29747
|
+
if (row[QueryColumnNames.TYPE] !== "GROUP_SUM") {
|
|
29748
|
+
continue;
|
|
29749
|
+
}
|
|
29750
|
+
for (const alias of aliases) {
|
|
29751
|
+
running[alias] = addGroupSum(running[alias], row[alias]);
|
|
29752
|
+
row[alias] = running[alias];
|
|
29753
|
+
}
|
|
29754
|
+
}
|
|
29755
|
+
}
|
|
29312
29756
|
}
|
|
29313
29757
|
/** Generates a GROUP_SUM row that aggregates all entries within a single row group. */
|
|
29314
29758
|
createGroupSumRow(querys, groupSumQuery, rowGroupEntry, scenariosSUMQuery, queryWhereSection, order) {
|
|
@@ -29334,7 +29778,7 @@ class DataQuery {
|
|
|
29334
29778
|
/** Generates a total SUM row across all groups (only for SUM / OPT table types). */
|
|
29335
29779
|
createTotalSumRow(querys, sumGroupQueries, scenariosSUMQuery) {
|
|
29336
29780
|
var _a;
|
|
29337
|
-
if (TableType.SUM === this.config.type || TableType.OPT === this.config.type) {
|
|
29781
|
+
if (withStyled.TableType.SUM === this.config.type || withStyled.TableType.OPT === this.config.type) {
|
|
29338
29782
|
// An empty label falls back to the SUM_TOTAL key, which tableDataSetFactory
|
|
29339
29783
|
// resolves to the IBCS total symbol (❖).
|
|
29340
29784
|
const label = ((_a = this.config.title) === null || _a === void 0 ? void 0 : _a.trim()) || "SUM_TOTAL";
|
|
@@ -29586,13 +30030,13 @@ class DataQuery {
|
|
|
29586
30030
|
const entryAliases = [...new Set(this.exctractScenarioNames(scenarios))];
|
|
29587
30031
|
const relativeScenarios = this.getRelativeScenarios();
|
|
29588
30032
|
const groups = new QueryGroups(this.config);
|
|
29589
|
-
const isOpt = TableType.OPT === this.config.type || TableType.OPTNOTOTAL === this.config.type;
|
|
30033
|
+
const isOpt = withStyled.TableType.OPT === this.config.type || withStyled.TableType.OPTNOTOTAL === this.config.type;
|
|
29590
30034
|
const isSumTypeGrouped = this.config.grouped &&
|
|
29591
|
-
(TableType.SUM === this.config.type ||
|
|
29592
|
-
TableType.SUMNOTOTAL === this.config.type ||
|
|
29593
|
-
TableType.OPT === this.config.type ||
|
|
29594
|
-
TableType.OPTNOTOTAL === this.config.type);
|
|
29595
|
-
const hasPartOfActive = this.checkConfigForPartOf() && this.config.type !== TableType.LIST;
|
|
30035
|
+
(withStyled.TableType.SUM === this.config.type ||
|
|
30036
|
+
withStyled.TableType.SUMNOTOTAL === this.config.type ||
|
|
30037
|
+
withStyled.TableType.OPT === this.config.type ||
|
|
30038
|
+
withStyled.TableType.OPTNOTOTAL === this.config.type);
|
|
30039
|
+
const hasPartOfActive = this.checkConfigForPartOf() && this.config.type !== withStyled.TableType.LIST;
|
|
29596
30040
|
const exec = (query) => this.exec(query);
|
|
29597
30041
|
// mirrors detectNaNCells + calculateRelativeVariances for a single bucket row
|
|
29598
30042
|
const finalizeBucketRow = (row) => {
|
|
@@ -29691,7 +30135,27 @@ class DataQuery {
|
|
|
29691
30135
|
: [];
|
|
29692
30136
|
const groupTotalsByKey = new Map();
|
|
29693
30137
|
groupTotalRowsRaw.forEach((row) => groupTotalsByKey.set(`${row.rowGroup}${separator}${coerceBucketKey(row.__interval)}`, row));
|
|
29694
|
-
if (isSumTypeGrouped) {
|
|
30138
|
+
if (isSumTypeGrouped && this.hasRunningSum()) {
|
|
30139
|
+
// per bucket, each group sum row gets the totals of all groups up to its own
|
|
30140
|
+
const sumAliases = [...new Set(this.exctractScenarioNames(scenariosSUMQuery))];
|
|
30141
|
+
const groupSumRows = res.flat().filter((row) => row.type === "GROUP_SUM");
|
|
30142
|
+
for (const bucketKey of new Set(groupTotalRowsRaw.map((row) => coerceBucketKey(row.__interval)))) {
|
|
30143
|
+
let running;
|
|
30144
|
+
for (const row of groupSumRows) {
|
|
30145
|
+
const totalRow = groupTotalsByKey.get(`${row.rowGroup}${separator}${bucketKey}`);
|
|
30146
|
+
if (totalRow) {
|
|
30147
|
+
running !== null && running !== void 0 ? running : (running = {});
|
|
30148
|
+
for (const alias of sumAliases) {
|
|
30149
|
+
running[alias] = addGroupSum(running[alias], totalRow[alias]);
|
|
30150
|
+
}
|
|
30151
|
+
}
|
|
30152
|
+
if (running) {
|
|
30153
|
+
writeBucketValues(row, finalizeBucketRow(Object.assign({}, running)), bucketKey);
|
|
30154
|
+
}
|
|
30155
|
+
}
|
|
30156
|
+
}
|
|
30157
|
+
}
|
|
30158
|
+
else if (isSumTypeGrouped) {
|
|
29695
30159
|
for (const totalRow of groupTotalRowsRaw) {
|
|
29696
30160
|
const bucketKey = coerceBucketKey(totalRow.__interval);
|
|
29697
30161
|
const finalized = finalizeBucketRow(Object.assign({}, totalRow));
|
|
@@ -29704,7 +30168,7 @@ class DataQuery {
|
|
|
29704
30168
|
}
|
|
29705
30169
|
}
|
|
29706
30170
|
}
|
|
29707
|
-
const hasTotalSumRow = TableType.SUM === this.config.type || TableType.OPT === this.config.type;
|
|
30171
|
+
const hasTotalSumRow = withStyled.TableType.SUM === this.config.type || withStyled.TableType.OPT === this.config.type;
|
|
29708
30172
|
const sumTotalRowsRaw = hasTotalSumRow || (hasPartOfActive && !this.config.grouped)
|
|
29709
30173
|
? exec(`SELECT __interval ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
29710
30174
|
FROM ${bucketSource}
|
|
@@ -29844,7 +30308,7 @@ class DataQuery {
|
|
|
29844
30308
|
*/
|
|
29845
30309
|
translateScenarioSQL(scenario, isSumRow, type) {
|
|
29846
30310
|
const scenarios = new VarianceScenario(scenario);
|
|
29847
|
-
if (TableType.OPT === type || TableType.OPTNOTOTAL === type) {
|
|
30311
|
+
if (withStyled.TableType.OPT === type || withStyled.TableType.OPTNOTOTAL === type) {
|
|
29848
30312
|
if (scenarios.isValid) {
|
|
29849
30313
|
// sum rows show signed scenario values, so their variances must be signed too
|
|
29850
30314
|
const sign = isSumRow ? " * transformOperator(operation)" : "";
|
|
@@ -29884,7 +30348,7 @@ class DataQuery {
|
|
|
29884
30348
|
translateAttributeSQL(attribute) {
|
|
29885
30349
|
const field = `[${attribute.arg}]`;
|
|
29886
30350
|
const isScenarioField = /^(ac|pp|fc|pl)[1-4]$/.test(attribute.arg);
|
|
29887
|
-
const useOperator = isScenarioField && this.config.type !== TableType.OPT && this.config.type !== TableType.OPTNOTOTAL;
|
|
30351
|
+
const useOperator = isScenarioField && this.config.type !== withStyled.TableType.OPT && this.config.type !== withStyled.TableType.OPTNOTOTAL;
|
|
29888
30352
|
switch (attribute.fn) {
|
|
29889
30353
|
case "set":
|
|
29890
30354
|
return `SETAGG(${field}) as ${attribute.alias}`;
|
|
@@ -29935,7 +30399,7 @@ class DataQuery {
|
|
|
29935
30399
|
* @param orderComponent
|
|
29936
30400
|
*/
|
|
29937
30401
|
createOrderString(orderComponent) {
|
|
29938
|
-
const inverse = OrderDirection.ASC === orderComponent.direction ? OrderDirection.DESC : OrderDirection.ASC;
|
|
30402
|
+
const inverse = withStyled.OrderDirection$1.ASC === orderComponent.direction ? withStyled.OrderDirection$1.DESC : withStyled.OrderDirection$1.ASC;
|
|
29939
30403
|
const sortKeys = new Map();
|
|
29940
30404
|
orderComponent.hierarchy.forEach((column, i) => {
|
|
29941
30405
|
const token = withStyled.parseOrderToken(column);
|
|
@@ -29966,7 +30430,7 @@ class DataQuery {
|
|
|
29966
30430
|
* `__sortnull<i>` is 1 when the cell has no value: no data, or a relative variance with a zero reference.
|
|
29967
30431
|
*/
|
|
29968
30432
|
translateSortKeySQL(token, bucket, i) {
|
|
29969
|
-
const isOpt = TableType.OPT === this.config.type || TableType.OPTNOTOTAL === this.config.type;
|
|
30433
|
+
const isOpt = withStyled.TableType.OPT === this.config.type || withStyled.TableType.OPTNOTOTAL === this.config.type;
|
|
29970
30434
|
const sign = isOpt ? "" : " * transformOperator(operation)";
|
|
29971
30435
|
const inBucket = bucket === undefined ? "" : `TRIM(CAST(${intervalBucketSQL(INTERVAL_SETNAME)} AS STRING)) = ${this.bind(bucket)}`;
|
|
29972
30436
|
const value = (x) => `SUM(${inBucket ? `(CASE WHEN ${inBucket} THEN ${x} ELSE 0 END)` : x}${sign})`;
|
|
@@ -30237,177 +30701,6 @@ class DataQuery {
|
|
|
30237
30701
|
}
|
|
30238
30702
|
}
|
|
30239
30703
|
|
|
30240
|
-
/**
|
|
30241
|
-
* Waterfall geometry per raw result row and column, keyed by row identity
|
|
30242
|
-
* (the factory iterates the same row objects the calculator walked).
|
|
30243
|
-
*/
|
|
30244
|
-
class WaterfallResult {
|
|
30245
|
-
constructor() {
|
|
30246
|
-
this.geometry = new Map();
|
|
30247
|
-
}
|
|
30248
|
-
set(row, column, data) {
|
|
30249
|
-
let columns = this.geometry.get(row);
|
|
30250
|
-
if (!columns) {
|
|
30251
|
-
columns = new Map();
|
|
30252
|
-
this.geometry.set(row, columns);
|
|
30253
|
-
}
|
|
30254
|
-
columns.set(column, data);
|
|
30255
|
-
}
|
|
30256
|
-
get(row, column) {
|
|
30257
|
-
var _a;
|
|
30258
|
-
return (_a = this.geometry.get(row)) === null || _a === void 0 ? void 0 : _a.get(column);
|
|
30259
|
-
}
|
|
30260
|
-
}
|
|
30261
|
-
/** True when the result contains grouping structure (sum, subtotal, or drill rows). */
|
|
30262
|
-
function hasGroupingStructure(queryData) {
|
|
30263
|
-
for (const groupData of queryData) {
|
|
30264
|
-
for (const row of groupData) {
|
|
30265
|
-
const type = row[QueryColumnNames.TYPE];
|
|
30266
|
-
if (type === TableRowType.SUM ||
|
|
30267
|
-
type === TableRowType.GROUPSUM ||
|
|
30268
|
-
type === TableRowType.DRILLELEMENT ||
|
|
30269
|
-
type === TableRowType.PARTELEMENT) {
|
|
30270
|
-
return true;
|
|
30271
|
-
}
|
|
30272
|
-
}
|
|
30273
|
-
}
|
|
30274
|
-
return false;
|
|
30275
|
-
}
|
|
30276
|
-
/**
|
|
30277
|
-
* Signed waterfall contribution of a row for one column.
|
|
30278
|
-
*
|
|
30279
|
-
* Non-OPT table types aggregate `SUM(scn * transformOperator(operation))`, so ENTRY
|
|
30280
|
-
* values arrive already signed. OPT types aggregate plain `SUM(scn)` with the sign
|
|
30281
|
-
* carried in the visible operation column, so the sign is applied here. Sum rows are
|
|
30282
|
-
* fully signed in both modes.
|
|
30283
|
-
*/
|
|
30284
|
-
function signedValue(row, column, tableType) {
|
|
30285
|
-
const raw = row[column];
|
|
30286
|
-
if (raw === null || raw === undefined) {
|
|
30287
|
-
return null;
|
|
30288
|
-
}
|
|
30289
|
-
const value = Number(raw);
|
|
30290
|
-
if (isNaN(value)) {
|
|
30291
|
-
return null;
|
|
30292
|
-
}
|
|
30293
|
-
const isOpt = tableType === TableType.OPT || tableType === TableType.OPTNOTOTAL;
|
|
30294
|
-
if (isOpt && row[QueryColumnNames.TYPE] === TableRowType.ENTRY && row[QueryColumnNames.OPERATION] === "-") {
|
|
30295
|
-
return -value;
|
|
30296
|
-
}
|
|
30297
|
-
return value;
|
|
30298
|
-
}
|
|
30299
|
-
/**
|
|
30300
|
-
* Computes waterfall bar geometry for the given scenario columns by walking the
|
|
30301
|
-
* segmented query result once per column in display order.
|
|
30302
|
-
*
|
|
30303
|
-
* - ENTRY rows (incl. REST) cascade from the running total by their signed value.
|
|
30304
|
-
* - SUM / GROUP_SUM rows anchor at zero. A SUM row resets the running total to its
|
|
30305
|
-
* value, a GROUP_SUM row resets it to zero.
|
|
30306
|
-
* - DRILLELEMENT (thereof) rows form a sub-cascade from their parent bar's start in
|
|
30307
|
-
* the parent's direction; the running total is untouched.
|
|
30308
|
-
* - PARTELEMENT (partof) rows cascade a `share * parent width` segment the same way.
|
|
30309
|
-
* Note: the share denominator is the group sum (or SUM_TOTAL when ungrouped) per
|
|
30310
|
-
* `createPartOfDrillRows`, not literally the parent row's value.
|
|
30311
|
-
* - GROUPHEAD rows get no bar and restart the running total at zero: every row group
|
|
30312
|
-
* is its own cascade that ends at its GROUP_SUM.
|
|
30313
|
-
* - NaN rows get no bar; a NaN parent orphans its drill children.
|
|
30314
|
-
*
|
|
30315
|
-
* @param queryData - Segmented result rows from DataQuery.execute().
|
|
30316
|
-
* @param columns - Plain scenario column keys (ac1..pl4); no `##` composite keys.
|
|
30317
|
-
* @param tableType - Table aggregation mode, needed for OPT sign handling.
|
|
30318
|
-
*/
|
|
30319
|
-
function computeWaterfall(queryData, columns, tableType) {
|
|
30320
|
-
const result = new WaterfallResult();
|
|
30321
|
-
for (const column of columns) {
|
|
30322
|
-
let running = 0;
|
|
30323
|
-
let lastParent;
|
|
30324
|
-
let subCursor = 0;
|
|
30325
|
-
const emitted = [];
|
|
30326
|
-
const emit = (row, data) => {
|
|
30327
|
-
emitted.push(data);
|
|
30328
|
-
result.set(row, column, data);
|
|
30329
|
-
};
|
|
30330
|
-
for (const groupData of queryData) {
|
|
30331
|
-
for (const row of groupData) {
|
|
30332
|
-
const type = row[QueryColumnNames.TYPE];
|
|
30333
|
-
if (type === TableRowType.GROUPHEAD) {
|
|
30334
|
-
// a group sum only totals its own rows, so the cascade must not carry over
|
|
30335
|
-
running = 0;
|
|
30336
|
-
lastParent = undefined;
|
|
30337
|
-
continue;
|
|
30338
|
-
}
|
|
30339
|
-
const value = signedValue(row, column, tableType);
|
|
30340
|
-
if (type === TableRowType.ENTRY) {
|
|
30341
|
-
if (value === null) {
|
|
30342
|
-
lastParent = undefined;
|
|
30343
|
-
continue;
|
|
30344
|
-
}
|
|
30345
|
-
emit(row, { start: running, end: running + value, min: 0, max: 0, kind: "cascade" });
|
|
30346
|
-
lastParent = { start: running, end: running + value };
|
|
30347
|
-
subCursor = lastParent.start;
|
|
30348
|
-
running += value;
|
|
30349
|
-
}
|
|
30350
|
-
else if (type === TableRowType.SUM || type === TableRowType.GROUPSUM) {
|
|
30351
|
-
if (value === null) {
|
|
30352
|
-
lastParent = undefined;
|
|
30353
|
-
continue;
|
|
30354
|
-
}
|
|
30355
|
-
emit(row, { start: 0, end: value, min: 0, max: 0, kind: "anchor" });
|
|
30356
|
-
lastParent = { start: 0, end: value };
|
|
30357
|
-
subCursor = 0;
|
|
30358
|
-
// a group sum closes its group (there may be no GROUPHEAD row when the title is hidden)
|
|
30359
|
-
running = type === TableRowType.GROUPSUM ? 0 : value;
|
|
30360
|
-
}
|
|
30361
|
-
else if (type === TableRowType.DRILLELEMENT) {
|
|
30362
|
-
if (value === null || lastParent === undefined) {
|
|
30363
|
-
continue;
|
|
30364
|
-
}
|
|
30365
|
-
const direction = Math.sign(lastParent.end - lastParent.start) || 1;
|
|
30366
|
-
const end = subCursor + direction * Math.abs(value);
|
|
30367
|
-
emit(row, {
|
|
30368
|
-
start: subCursor,
|
|
30369
|
-
end,
|
|
30370
|
-
min: 0,
|
|
30371
|
-
max: 0,
|
|
30372
|
-
kind: "thereof",
|
|
30373
|
-
parentStart: lastParent.start,
|
|
30374
|
-
parentEnd: lastParent.end,
|
|
30375
|
-
});
|
|
30376
|
-
subCursor = end;
|
|
30377
|
-
}
|
|
30378
|
-
else if (type === TableRowType.PARTELEMENT) {
|
|
30379
|
-
if (value === null || lastParent === undefined) {
|
|
30380
|
-
continue;
|
|
30381
|
-
}
|
|
30382
|
-
const end = subCursor + value * (lastParent.end - lastParent.start);
|
|
30383
|
-
emit(row, {
|
|
30384
|
-
start: subCursor,
|
|
30385
|
-
end,
|
|
30386
|
-
min: 0,
|
|
30387
|
-
max: 0,
|
|
30388
|
-
kind: "partof",
|
|
30389
|
-
parentStart: lastParent.start,
|
|
30390
|
-
parentEnd: lastParent.end,
|
|
30391
|
-
});
|
|
30392
|
-
subCursor = end;
|
|
30393
|
-
}
|
|
30394
|
-
}
|
|
30395
|
-
}
|
|
30396
|
-
// All rows of a column share one coordinate system including zero
|
|
30397
|
-
let min = 0;
|
|
30398
|
-
let max = 0;
|
|
30399
|
-
for (const data of emitted) {
|
|
30400
|
-
min = Math.min(min, data.start, data.end);
|
|
30401
|
-
max = Math.max(max, data.start, data.end);
|
|
30402
|
-
}
|
|
30403
|
-
for (const data of emitted) {
|
|
30404
|
-
data.min = min;
|
|
30405
|
-
data.max = max;
|
|
30406
|
-
}
|
|
30407
|
-
}
|
|
30408
|
-
return result;
|
|
30409
|
-
}
|
|
30410
|
-
|
|
30411
30704
|
/**
|
|
30412
30705
|
* Transforms raw query results into structured TableRow collections for header and body.
|
|
30413
30706
|
*
|
|
@@ -30458,8 +30751,8 @@ class TableDataSetFactory {
|
|
|
30458
30751
|
if (hasIntervalColumns) {
|
|
30459
30752
|
header.push(this.createIntervalBandRow());
|
|
30460
30753
|
}
|
|
30461
|
-
const headerRow = new TableRow(hasIntervalColumns ? 1 : 0, 0, TableRowType.HEADER);
|
|
30462
|
-
const separatorRow = new TableRow(hasIntervalColumns ? 2 : 1, 0, TableRowType.SEPERATORLINE);
|
|
30754
|
+
const headerRow = new TableRow(hasIntervalColumns ? 1 : 0, 0, withStyled.TableRowType.HEADER);
|
|
30755
|
+
const separatorRow = new TableRow(hasIntervalColumns ? 2 : 1, 0, withStyled.TableRowType.SEPERATORLINE);
|
|
30463
30756
|
for (const scenario of this.normalizedHeader) {
|
|
30464
30757
|
const attribute = this.attributesByAlias.get(scenario.name);
|
|
30465
30758
|
headerRow.createElement(attribute
|
|
@@ -30478,7 +30771,7 @@ class TableDataSetFactory {
|
|
|
30478
30771
|
* consecutive columns of the same bucket is spanned by one label cell.
|
|
30479
30772
|
*/
|
|
30480
30773
|
createIntervalBandRow() {
|
|
30481
|
-
const bandRow = new TableRow(0, 0, TableRowType.HEADER);
|
|
30774
|
+
const bandRow = new TableRow(0, 0, withStyled.TableRowType.HEADER);
|
|
30482
30775
|
let index = 0;
|
|
30483
30776
|
while (index < this.normalizedHeader.length) {
|
|
30484
30777
|
const column = this.normalizedHeader[index];
|
|
@@ -30527,7 +30820,7 @@ class TableDataSetFactory {
|
|
|
30527
30820
|
order: undefined,
|
|
30528
30821
|
},
|
|
30529
30822
|
];
|
|
30530
|
-
if (TableType.OPT === type || TableType.OPTNOTOTAL === type) {
|
|
30823
|
+
if (withStyled.TableType.OPT === type || withStyled.TableType.OPTNOTOTAL === type) {
|
|
30531
30824
|
header = [
|
|
30532
30825
|
{
|
|
30533
30826
|
name: QueryColumnNames.OPERATION,
|
|
@@ -30569,25 +30862,29 @@ class TableDataSetFactory {
|
|
|
30569
30862
|
let iGroupIndex = -1; // index used in detailRow JSON to count the current group
|
|
30570
30863
|
const dataQuery = new DataQuery(config, i18n);
|
|
30571
30864
|
this.dateBuckets = isDateInterval(config.interval);
|
|
30572
|
-
this.unsignedEntries = TableType.OPT === config.type || TableType.OPTNOTOTAL === config.type;
|
|
30865
|
+
this.unsignedEntries = withStyled.TableType.OPT === config.type || withStyled.TableType.OPTNOTOTAL === config.type;
|
|
30573
30866
|
const queryData = dataQuery.execute(db, fromExpr); // collection of all query results
|
|
30574
30867
|
this.hasBlankRowGroup = dataQuery.hasBlankRowGroup;
|
|
30575
30868
|
// Calculate column statistics for bar columns
|
|
30576
30869
|
const columnStatsMap = this.calculateColumnStatistics(queryData, config.barColumns, config.interval !== INTERVAL_NONE);
|
|
30577
|
-
// Scenario bar columns render as a waterfall when grouping structure is present
|
|
30870
|
+
// Scenario bar columns render as a waterfall when grouping structure is present,
|
|
30871
|
+
// absolute variance bar columns when varianceWaterfall is set;
|
|
30578
30872
|
// interval/columnthereof composite columns are excluded and render as today
|
|
30579
|
-
const
|
|
30580
|
-
const
|
|
30581
|
-
|
|
30582
|
-
|
|
30583
|
-
hasGroupingStructure(queryData)
|
|
30584
|
-
?
|
|
30873
|
+
const thereOfAbove = config.thereOfPosition === withStyled.ThereofPosition.ABOVE;
|
|
30874
|
+
const barColumns = (_a = config.barColumns) !== null && _a !== void 0 ? _a : [];
|
|
30875
|
+
const scenarioColumns = barColumns.filter((column) => column.toUpperCase().trim() in withStyled.Scenarios);
|
|
30876
|
+
const waterfallColumns = [
|
|
30877
|
+
...(scenarioColumns.length > 0 && hasGroupingStructure(queryData) ? scenarioColumns : []),
|
|
30878
|
+
...(config.varianceWaterfall ? barColumns.filter((column) => new VarianceScenario(column).type === "d") : []),
|
|
30879
|
+
];
|
|
30880
|
+
const waterfallResult = waterfallColumns.length > 0 && config.interval === INTERVAL_NONE && config.categoryThereOf.size === 0
|
|
30881
|
+
? computeWaterfall(queryData, waterfallColumns, config.type, dataQuery.hasRunningSum(), thereOfAbove)
|
|
30585
30882
|
: undefined;
|
|
30586
30883
|
for (const groupData of queryData) {
|
|
30587
30884
|
// groupData is a collection of dataRows, each group base on a query and represents a 'row' group
|
|
30588
30885
|
iGroupIndex += 1;
|
|
30589
30886
|
const iRowIndex = -1;
|
|
30590
|
-
bodyRows.push(...this.createRow(config.i18n, i18n, config.scenariosUnitType, groupData, iGroupIndex, iRowIndex, config.categoryWidth, config.measureScale, config.barColumns, columnStatsMap, waterfallResult));
|
|
30887
|
+
bodyRows.push(...this.createRow(config.i18n, i18n, config.scenariosUnitType, groupData, iGroupIndex, iRowIndex, config.categoryWidth, config.measureScale, config.barColumns, columnStatsMap, waterfallResult, thereOfAbove));
|
|
30591
30888
|
}
|
|
30592
30889
|
return bodyRows;
|
|
30593
30890
|
}
|
|
@@ -30610,7 +30907,7 @@ class TableDataSetFactory {
|
|
|
30610
30907
|
for (const row of groupData) {
|
|
30611
30908
|
// sum rows draw no bar (a waterfall takes its extent from WaterfallBarData), so they must not stretch the scale
|
|
30612
30909
|
const type = row[QueryColumnNames.TYPE];
|
|
30613
|
-
if (type === TableRowType.SUM || type === TableRowType.GROUPSUM)
|
|
30910
|
+
if (type === withStyled.TableRowType.SUM || type === withStyled.TableRowType.GROUPSUM)
|
|
30614
30911
|
continue;
|
|
30615
30912
|
for (const column of barColumns) {
|
|
30616
30913
|
// with an active interval the rendered values live under the
|
|
@@ -30698,9 +30995,12 @@ class TableDataSetFactory {
|
|
|
30698
30995
|
* @param barColumns
|
|
30699
30996
|
* @param columnStatsMap
|
|
30700
30997
|
*/
|
|
30701
|
-
createRow(i18nMode, i18n, scenariosUnitType, groupData, iGroupIndex, iRowIndex, categoryWidth, measureScale, barColumns, columnStatsMap, waterfallResult) {
|
|
30998
|
+
createRow(i18nMode, i18n, scenariosUnitType, groupData, iGroupIndex, iRowIndex, categoryWidth, measureScale, barColumns, columnStatsMap, waterfallResult, thereOfAbove = false) {
|
|
30702
30999
|
var _a, _b, _c;
|
|
30703
31000
|
const result = [];
|
|
31001
|
+
// the last entry row and its index in result: the parent of the thereof rows that follow it
|
|
31002
|
+
let parentIndex = -1;
|
|
31003
|
+
let parent;
|
|
30704
31004
|
// thereof and partof rows have no operation, they take the one of the row above
|
|
30705
31005
|
let operation;
|
|
30706
31006
|
for (const rawDataRow of groupData) {
|
|
@@ -30712,20 +31012,31 @@ class TableDataSetFactory {
|
|
|
30712
31012
|
const type = rawDataRow[QueryColumnNames.TYPE];
|
|
30713
31013
|
const isSecondElement = rawDataRow[QueryColumnNames.ROWNR] >= 2;
|
|
30714
31014
|
operation = ((_b = (_a = rawDataRow.operation) !== null && _a !== void 0 ? _a : rawDataRow.restOperation) !== null && _b !== void 0 ? _b : operation);
|
|
31015
|
+
// a thereof row moves above the entry row before it only when that row is its parent
|
|
31016
|
+
const moved = thereOfAbove &&
|
|
31017
|
+
type === withStyled.TableRowType.DRILLELEMENT &&
|
|
31018
|
+
parent !== undefined &&
|
|
31019
|
+
parent[QueryColumnNames.CATEGORY] === rawDataRow[QueryColumnNames.CATEGORY] &&
|
|
31020
|
+
(parent[QueryColumnNames.ROWGROUP] === "NO_GROUP" || parent[QueryColumnNames.ROWGROUP] === rowGroup);
|
|
30715
31021
|
const detailsRow = this.createDetailRow(type, iRowIndex, iGroupIndex, groupData.length);
|
|
30716
31022
|
detailsRow.key = this.rowKey(rawDataRow);
|
|
30717
31023
|
for (const scenario of this.normalizedHeader) {
|
|
30718
31024
|
const value = this.getRawDataRowElement(rawDataRow, scenario);
|
|
30719
|
-
const
|
|
30720
|
-
const columnStats = isBarChart ? columnStatsMap === null || columnStatsMap === void 0 ? void 0 : columnStatsMap.get(scenario.type) : undefined;
|
|
31025
|
+
const isBarColumn = (_c = barColumns === null || barColumns === void 0 ? void 0 : barColumns.includes(scenario.type)) !== null && _c !== void 0 ? _c : false;
|
|
30721
31026
|
// waterfall geometry only exists for plain scenario columns (no ## composites)
|
|
30722
|
-
const waterfall =
|
|
31027
|
+
const waterfall = isBarColumn &&
|
|
30723
31028
|
scenario.bucket === undefined &&
|
|
30724
31029
|
scenario.name === scenario.group &&
|
|
30725
31030
|
scenario.name === scenario.type
|
|
30726
31031
|
? waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.get(rawDataRow, scenario.type)
|
|
30727
31032
|
: undefined;
|
|
30728
|
-
|
|
31033
|
+
// a share of a variance has no place in the walk of a variance waterfall: the row prints the number
|
|
31034
|
+
const isBarChart = isBarColumn &&
|
|
31035
|
+
!(type === withStyled.TableRowType.PARTELEMENT &&
|
|
31036
|
+
new VarianceScenario(scenario.type).isValid &&
|
|
31037
|
+
(waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.has(scenario.type)));
|
|
31038
|
+
const columnStats = isBarChart ? columnStatsMap === null || columnStatsMap === void 0 ? void 0 : columnStatsMap.get(scenario.type) : undefined;
|
|
31039
|
+
detailsRow.createElement(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);
|
|
30729
31040
|
const cell = detailsRow.elements[detailsRow.elements.length - 1];
|
|
30730
31041
|
if (this.dateBuckets && scenario.bucket !== undefined) {
|
|
30731
31042
|
cell.date = pointDate(scenario.bucket);
|
|
@@ -30735,6 +31046,18 @@ class TableDataSetFactory {
|
|
|
30735
31046
|
cell.direction = this.resolveDirection(varianceScenario, operation);
|
|
30736
31047
|
}
|
|
30737
31048
|
}
|
|
31049
|
+
// moved only here: the operation above and the waterfall geometry both rely on the parent coming first
|
|
31050
|
+
if (moved) {
|
|
31051
|
+
detailsRow.cssStyle = "ofit-above";
|
|
31052
|
+
result[parentIndex].cssStyle = "ofit-sum";
|
|
31053
|
+
result.splice(parentIndex, 0, detailsRow);
|
|
31054
|
+
parentIndex += 1;
|
|
31055
|
+
continue;
|
|
31056
|
+
}
|
|
31057
|
+
if (type === withStyled.TableRowType.ENTRY) {
|
|
31058
|
+
parentIndex = result.length;
|
|
31059
|
+
parent = rawDataRow;
|
|
31060
|
+
}
|
|
30738
31061
|
result.push(detailsRow);
|
|
30739
31062
|
}
|
|
30740
31063
|
return result;
|
|
@@ -30744,13 +31067,13 @@ class TableDataSetFactory {
|
|
|
30744
31067
|
var _a;
|
|
30745
31068
|
const rowGroup = row.restRowGroup != null ? row.restRowGroup : row.rowGroup === "NO_GROUP" ? undefined : row.rowGroup;
|
|
30746
31069
|
switch (row.type) {
|
|
30747
|
-
case TableRowType.ENTRY:
|
|
31070
|
+
case withStyled.TableRowType.ENTRY:
|
|
30748
31071
|
return { rowGroup, category: row.category, subCategory: row.subCategory };
|
|
30749
|
-
case TableRowType.DRILLELEMENT:
|
|
31072
|
+
case withStyled.TableRowType.DRILLELEMENT:
|
|
30750
31073
|
return { rowGroup, category: row.category, subCategory: (_a = row.rawSubCategory) !== null && _a !== void 0 ? _a : row.subCategory };
|
|
30751
|
-
case TableRowType.GROUPSUM:
|
|
31074
|
+
case withStyled.TableRowType.GROUPSUM:
|
|
30752
31075
|
return { rowGroup, row: "subtotal" };
|
|
30753
|
-
case TableRowType.SUM:
|
|
31076
|
+
case withStyled.TableRowType.SUM:
|
|
30754
31077
|
return { row: "total" };
|
|
30755
31078
|
default:
|
|
30756
31079
|
return undefined;
|
|
@@ -30781,18 +31104,18 @@ class TableDataSetFactory {
|
|
|
30781
31104
|
*/
|
|
30782
31105
|
createDetailRow(type, rowIndex, groupIndex, maxIndex) {
|
|
30783
31106
|
switch (type) {
|
|
30784
|
-
case TableRowType.GROUPHEAD:
|
|
30785
|
-
return new TableRow(rowIndex, groupIndex, TableRowType.HEADER);
|
|
30786
|
-
case TableRowType.SUM:
|
|
30787
|
-
return new TableRow(maxIndex + 2, groupIndex, TableRowType.SUM);
|
|
30788
|
-
case TableRowType.GROUPSUM:
|
|
30789
|
-
return new TableRow(maxIndex + 2, groupIndex, TableRowType.SUM);
|
|
30790
|
-
case TableRowType.DRILLELEMENT:
|
|
30791
|
-
return new TableRow(maxIndex + 2, groupIndex, TableRowType.DRILLELEMENT);
|
|
30792
|
-
case TableRowType.PARTELEMENT:
|
|
30793
|
-
return new TableRow(maxIndex + 2, groupIndex, TableRowType.PARTELEMENT);
|
|
31107
|
+
case withStyled.TableRowType.GROUPHEAD:
|
|
31108
|
+
return new TableRow(rowIndex, groupIndex, withStyled.TableRowType.HEADER);
|
|
31109
|
+
case withStyled.TableRowType.SUM:
|
|
31110
|
+
return new TableRow(maxIndex + 2, groupIndex, withStyled.TableRowType.SUM);
|
|
31111
|
+
case withStyled.TableRowType.GROUPSUM:
|
|
31112
|
+
return new TableRow(maxIndex + 2, groupIndex, withStyled.TableRowType.SUM);
|
|
31113
|
+
case withStyled.TableRowType.DRILLELEMENT:
|
|
31114
|
+
return new TableRow(maxIndex + 2, groupIndex, withStyled.TableRowType.DRILLELEMENT);
|
|
31115
|
+
case withStyled.TableRowType.PARTELEMENT:
|
|
31116
|
+
return new TableRow(maxIndex + 2, groupIndex, withStyled.TableRowType.PARTELEMENT);
|
|
30794
31117
|
default:
|
|
30795
|
-
return new TableRow(rowIndex, groupIndex, TableRowType.STANDARD);
|
|
31118
|
+
return new TableRow(rowIndex, groupIndex, withStyled.TableRowType.STANDARD);
|
|
30796
31119
|
}
|
|
30797
31120
|
}
|
|
30798
31121
|
/**
|
|
@@ -31039,11 +31362,11 @@ class Table {
|
|
|
31039
31362
|
["ibcssymbol_delta_generic_relative", "Δ({%})%"],
|
|
31040
31363
|
["SUM_TOTAL", "❖"],
|
|
31041
31364
|
]);
|
|
31042
|
-
this.state = FactoryState
|
|
31365
|
+
this.state = withStyled.FactoryState.DIRTY; // mark dataSet for update
|
|
31043
31366
|
return new Map([...defaultI18n, ...(i18n || new Map())]);
|
|
31044
31367
|
}
|
|
31045
31368
|
initConfig(config) {
|
|
31046
|
-
this.state = FactoryState
|
|
31369
|
+
this.state = withStyled.FactoryState.DIRTY; // mark dataSet for update
|
|
31047
31370
|
const tmpConfig = config;
|
|
31048
31371
|
// sorting scenario order based on Ruleset
|
|
31049
31372
|
const self = this;
|
|
@@ -31078,7 +31401,7 @@ class Table {
|
|
|
31078
31401
|
*/
|
|
31079
31402
|
setSource(tableName, filter) {
|
|
31080
31403
|
var _a, _b;
|
|
31081
|
-
this.state = FactoryState
|
|
31404
|
+
this.state = withStyled.FactoryState.DIRTY;
|
|
31082
31405
|
// "" while the source is not registered (e.g. the datasource has not loaded yet): treated as empty
|
|
31083
31406
|
this.fromExpr = withHasError.sourceExpr(this.db, tableName, filter);
|
|
31084
31407
|
if (!this.fromExpr) {
|
|
@@ -31099,16 +31422,16 @@ class Table {
|
|
|
31099
31422
|
this.rowCount === 0 || !this.fromExpr
|
|
31100
31423
|
? []
|
|
31101
31424
|
: this.dataSetFactory.createBodyRows(this.config, this.i18n, this.db, this.fromExpr);
|
|
31102
|
-
this.state = FactoryState
|
|
31425
|
+
this.state = withStyled.FactoryState.UP_TO_DATE;
|
|
31103
31426
|
}
|
|
31104
31427
|
getHeader() {
|
|
31105
|
-
if (this.state === FactoryState
|
|
31428
|
+
if (this.state === withStyled.FactoryState.DIRTY) {
|
|
31106
31429
|
this.update();
|
|
31107
31430
|
}
|
|
31108
31431
|
return this.headerRows;
|
|
31109
31432
|
}
|
|
31110
31433
|
getBody() {
|
|
31111
|
-
if (this.state === FactoryState
|
|
31434
|
+
if (this.state === withStyled.FactoryState.DIRTY) {
|
|
31112
31435
|
this.update();
|
|
31113
31436
|
}
|
|
31114
31437
|
return this.bodyRows;
|
|
@@ -31118,7 +31441,7 @@ class Table {
|
|
|
31118
31441
|
* With `categoryIntervalPosition` the first interval buckets come before the category/operation column.
|
|
31119
31442
|
*/
|
|
31120
31443
|
getColumns() {
|
|
31121
|
-
if (this.state === FactoryState
|
|
31444
|
+
if (this.state === withStyled.FactoryState.DIRTY) {
|
|
31122
31445
|
this.update();
|
|
31123
31446
|
}
|
|
31124
31447
|
return this.dataSetFactory.getNormalizedHeader();
|
|
@@ -31202,7 +31525,7 @@ class Table {
|
|
|
31202
31525
|
/** Warning for an order `@bucket` that cannot apply, once the body was built; undefined when all apply. */
|
|
31203
31526
|
orderBucketWarning() {
|
|
31204
31527
|
var _a, _b;
|
|
31205
|
-
if (this.hasNoData() || this.state !== FactoryState
|
|
31528
|
+
if (this.hasNoData() || this.state !== withStyled.FactoryState.UP_TO_DATE) {
|
|
31206
31529
|
return undefined;
|
|
31207
31530
|
}
|
|
31208
31531
|
const buckets = ((_b = (_a = this.config.sortOrder) === null || _a === void 0 ? void 0 : _a.hierarchy) !== null && _b !== void 0 ? _b : [])
|
|
@@ -31225,7 +31548,7 @@ class Table {
|
|
|
31225
31548
|
/** Warning for a `categoryIntervalPosition` that cannot apply, once the body was built; undefined when it applies. */
|
|
31226
31549
|
categoryIntervalPositionWarning() {
|
|
31227
31550
|
const position = this.categoryIntervalPosition();
|
|
31228
|
-
if (position <= 0 || this.hasNoData() || this.state !== FactoryState
|
|
31551
|
+
if (position <= 0 || this.hasNoData() || this.state !== withStyled.FactoryState.UP_TO_DATE) {
|
|
31229
31552
|
return undefined;
|
|
31230
31553
|
}
|
|
31231
31554
|
const groups = this.intervalBuckets.length;
|
|
@@ -31273,8 +31596,14 @@ class TableComponentConfig {
|
|
|
31273
31596
|
/** When true, rows are visually grouped by rowGroup. */
|
|
31274
31597
|
this.grouped = false;
|
|
31275
31598
|
this.showGroupTitle = true;
|
|
31599
|
+
/** When true, each group sum row holds the running result of all groups up to its own (see bn-table `runningSum` prop). */
|
|
31600
|
+
this.runningSum = false;
|
|
31601
|
+
/** When true, absolute variance bar columns are drawn as a waterfall (see bn-table `varianceWaterfall` prop). */
|
|
31602
|
+
this.varianceWaterfall = false;
|
|
31276
31603
|
/** Drill-down sub-row definitions -- "thereof" breakdowns within a category. */
|
|
31277
31604
|
this.thereOf = [];
|
|
31605
|
+
/** Thereof rows below or above their parent row (see bn-table `thereofPosition` prop). */
|
|
31606
|
+
this.thereOfPosition = withStyled.ThereofPosition.BELOW;
|
|
31278
31607
|
/** Column-level drill-down using `##` separator in category names. */
|
|
31279
31608
|
this.categoryThereOf = new Map();
|
|
31280
31609
|
/** Percentage-of-total sub-row definitions. */
|
|
@@ -31283,7 +31612,7 @@ class TableComponentConfig {
|
|
|
31283
31612
|
this.attributes = [];
|
|
31284
31613
|
this.sortOrder = new withStyled.OrderAdapter(new StringAdapter()).default();
|
|
31285
31614
|
/** Table aggregation mode: LIST (flat), SUM (with totals), OPT (with optional totals), etc. */
|
|
31286
|
-
this.type = TableType.LIST;
|
|
31615
|
+
this.type = withStyled.TableType.LIST;
|
|
31287
31616
|
/** Maximum rows to display; 0 means unlimited. */
|
|
31288
31617
|
this.limit = 0;
|
|
31289
31618
|
this.i18n = withStyled.I18nMode.ALL;
|
|
@@ -31339,6 +31668,15 @@ class TableComponentConfigAdapter {
|
|
|
31339
31668
|
if (withStyled.CompareUtil.isBoolean(data.showGroupTitle)) {
|
|
31340
31669
|
config.showGroupTitle = data.showGroupTitle;
|
|
31341
31670
|
}
|
|
31671
|
+
if (withStyled.CompareUtil.isBoolean(data.runningSum)) {
|
|
31672
|
+
config.runningSum = data.runningSum;
|
|
31673
|
+
}
|
|
31674
|
+
if (withStyled.CompareUtil.isBoolean(data.varianceWaterfall)) {
|
|
31675
|
+
config.varianceWaterfall = data.varianceWaterfall;
|
|
31676
|
+
}
|
|
31677
|
+
if (data.thereOfPosition === withStyled.ThereofPosition.ABOVE) {
|
|
31678
|
+
config.thereOfPosition = withStyled.ThereofPosition.ABOVE;
|
|
31679
|
+
}
|
|
31342
31680
|
if (withStyled.CompareUtil.isBoolean(data.showMeasureScale)) {
|
|
31343
31681
|
config.showMeasureScale = data.showMeasureScale;
|
|
31344
31682
|
}
|
|
@@ -31442,7 +31780,7 @@ class TableDrillGroupAdapter {
|
|
|
31442
31780
|
}
|
|
31443
31781
|
}
|
|
31444
31782
|
|
|
31445
|
-
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{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.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(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}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}`;
|
|
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(.variance-waterfall){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}`;
|
|
31446
31784
|
|
|
31447
31785
|
const BnTableRenderer = class {
|
|
31448
31786
|
constructor(hostRef) {
|
|
@@ -31476,20 +31814,26 @@ const BnTableRenderer = class {
|
|
|
31476
31814
|
/** @internal */
|
|
31477
31815
|
this.showGroupTitle = true;
|
|
31478
31816
|
/** @internal */
|
|
31817
|
+
this.runningSum = false;
|
|
31818
|
+
/** @internal */
|
|
31819
|
+
this.varianceWaterfall = false;
|
|
31820
|
+
/** @internal */
|
|
31479
31821
|
this.thereof = [];
|
|
31480
31822
|
/** @internal */
|
|
31823
|
+
this.thereofPosition = withStyled.ThereofPosition.BELOW;
|
|
31824
|
+
/** @internal */
|
|
31481
31825
|
this.partof = [];
|
|
31482
31826
|
/** @internal */
|
|
31483
31827
|
this.order = {
|
|
31484
31828
|
hierarchy: [],
|
|
31485
|
-
direction: OrderDirection.ASC,
|
|
31829
|
+
direction: withStyled.OrderDirection$1.ASC,
|
|
31486
31830
|
};
|
|
31487
31831
|
/** @internal */
|
|
31488
31832
|
this.categorythereof = new Map();
|
|
31489
31833
|
/** @internal */
|
|
31490
31834
|
this.attributeColumns = [];
|
|
31491
31835
|
/** @internal */
|
|
31492
|
-
this.type = TableType.LIST;
|
|
31836
|
+
this.type = withStyled.TableType.LIST;
|
|
31493
31837
|
/** @internal */
|
|
31494
31838
|
this.categoryWidth = withStyled.TableCategoryWidth.INF;
|
|
31495
31839
|
/** @internal */
|
|
@@ -31528,9 +31872,10 @@ const BnTableRenderer = class {
|
|
|
31528
31872
|
this.scaleFactor = 1;
|
|
31529
31873
|
this.componentDataFormatDigits = new DataFormatDigits();
|
|
31530
31874
|
this.barColumnLayouts = new Map();
|
|
31875
|
+
this.waterfallGeometries = new Map();
|
|
31531
31876
|
// labels measured in the fallback font are too narrow or too wide once the web font is there: lay out again
|
|
31532
31877
|
this.relayout = () => {
|
|
31533
|
-
if (this.barColumnLayouts.size > 0)
|
|
31878
|
+
if (this.barColumnLayouts.size > 0 || this.waterfallGeometries.size > 0)
|
|
31534
31879
|
index.forceUpdate(this);
|
|
31535
31880
|
};
|
|
31536
31881
|
withHasError.withComponentStatus(this);
|
|
@@ -31663,14 +32008,16 @@ const BnTableRenderer = class {
|
|
|
31663
32008
|
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;
|
|
31664
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) => {
|
|
31665
32010
|
var _a, _b, _c, _d, _e;
|
|
31666
|
-
return (index.h("td", Object.assign({ colSpan: cell.colSpan, class: cell.type ? `${cell
|
|
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 !== "-"
|
|
31667
32012
|
? dataPointAttributes(Object.assign(Object.assign({}, row.key), { date: cell.date, scenario: cell.key }), "element")
|
|
31668
|
-
: {})), cell.prefix != null ? (index.h("span", { class: cell
|
|
32013
|
+
: {})), cell.prefix != null ? (index.h("span", { class: this.cellClass(cell, locale) + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
|
|
31669
32014
|
cell.columnStats &&
|
|
31670
32015
|
cell.value !== withStyled.NOT_AVAILABLE &&
|
|
31671
32016
|
// an untitled group head is only a gap between list groups, a bar cell would print "-" in it
|
|
31672
|
-
(this.showGroupTitle || row.type !== TableRowType.HEADER) &&
|
|
31673
|
-
(cell.waterfall !== undefined || row.type !== TableRowType.SUM)
|
|
32017
|
+
(this.showGroupTitle || row.type !== withStyled.TableRowType.HEADER) &&
|
|
32018
|
+
(cell.waterfall !== undefined || row.type !== withStyled.TableRowType.SUM) &&
|
|
32019
|
+
// a variance walk where every step is zero has no extent: the rows print their zero
|
|
32020
|
+
!(cell.direction !== undefined && cell.waterfall && cell.waterfall.max === cell.waterfall.min) ? (cell.waterfall !== undefined ? (index.h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.direction === "pos", measureScale: barLabelMeasureScale(cell), locale: locale, decimalDigits: barLabelDigits(cell, this.componentDataFormatDigits), columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles, waterfall: cell.waterfall, geometry: this.waterfallGeometries.get(cell.key), bold: isBoldRow(row), connectorReach: this.connectorReach(row) })) : (index.h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.direction === "pos", measureScale: barLabelMeasureScale(cell), locale: locale, decimalDigits: barLabelDigits(cell, this.componentDataFormatDigits), percentDigits: (_b = (_a = this.barColumnLayouts.get(cell.key)) === null || _a === void 0 ? void 0 : _a.percentDigits) !== null && _b !== void 0 ? _b : this.componentDataFormatDigits.percent, percentSign: (_c = this.barColumnLayouts.get(cell.key)) === null || _c === void 0 ? void 0 : _c.percentSign, columnWidthEm: this.barColumnMaxWidth, labelWidths: (_d = this.barColumnLayouts.get(cell.key)) === null || _d === void 0 ? void 0 : _d.labels, sideMax: (_e = this.barColumnLayouts.get(cell.key)) === null || _e === void 0 ? void 0 : _e.sideMax, bold: isBoldRow(row), styles: this.barChartStyles }))) : (cell.draw(this.componentDataFormatDigits, locale))));
|
|
31674
32021
|
})))))));
|
|
31675
32022
|
};
|
|
31676
32023
|
return index.h(index.Host, { class: { "no-data": ((_a = this.table) === null || _a === void 0 ? void 0 : _a.hasNoData()) === true } }, helper());
|
|
@@ -31726,8 +32073,16 @@ const BnTableRenderer = class {
|
|
|
31726
32073
|
}
|
|
31727
32074
|
}
|
|
31728
32075
|
this.barColumnLayouts = this.collectBarColumnLayouts();
|
|
32076
|
+
this.waterfallGeometries = this.collectWaterfallGeometries();
|
|
31729
32077
|
this.barChartStyles = this.prepareBarChartStyles();
|
|
31730
32078
|
}
|
|
32079
|
+
/** The classes of a number cell. A variance that prints as zero loses its sign and its sentiment color. */
|
|
32080
|
+
cellClass(cell, locale) {
|
|
32081
|
+
if (cell.direction === undefined || !cell.roundsToZero(this.componentDataFormatDigits, locale)) {
|
|
32082
|
+
return cell.cssStyle;
|
|
32083
|
+
}
|
|
32084
|
+
return cell.cssStyle.replace(/^(pos|neg)_\w+/, "zero");
|
|
32085
|
+
}
|
|
31731
32086
|
prepareConfig(db) {
|
|
31732
32087
|
var _a, _b, _c;
|
|
31733
32088
|
const fromExpr = withHasError.sourceExpr(db, this.tableName, this.filter);
|
|
@@ -31741,7 +32096,10 @@ const BnTableRenderer = class {
|
|
|
31741
32096
|
scenariosUnitType: this.scenariosDataFormat,
|
|
31742
32097
|
grouped: this.grouped,
|
|
31743
32098
|
showGroupTitle: this.showGroupTitle,
|
|
32099
|
+
runningSum: this.runningSum,
|
|
32100
|
+
varianceWaterfall: this.varianceWaterfall,
|
|
31744
32101
|
thereOf: this.thereof,
|
|
32102
|
+
thereOfPosition: this.thereofPosition,
|
|
31745
32103
|
partOf: this.partof,
|
|
31746
32104
|
categoryThereOf: this.categorythereof,
|
|
31747
32105
|
attributes: this.attributeColumns,
|
|
@@ -31904,9 +32262,10 @@ const BnTableRenderer = class {
|
|
|
31904
32262
|
const layouts = new Map();
|
|
31905
32263
|
if (!this.table || this.table.hasNoData())
|
|
31906
32264
|
return layouts;
|
|
32265
|
+
// a cell with the weight its row prints in
|
|
31907
32266
|
const cellsByKey = new Map();
|
|
31908
32267
|
for (const row of this.table.getBody()) {
|
|
31909
|
-
if (row.type === TableRowType.SUM)
|
|
32268
|
+
if (row.type === withStyled.TableRowType.SUM)
|
|
31910
32269
|
continue;
|
|
31911
32270
|
for (const cell of row.getCells()) {
|
|
31912
32271
|
// waterfall cells scale independently
|
|
@@ -31914,7 +32273,7 @@ const BnTableRenderer = class {
|
|
|
31914
32273
|
continue;
|
|
31915
32274
|
if (typeof cell.value !== "number" || isNaN(cell.value))
|
|
31916
32275
|
continue;
|
|
31917
|
-
cellsByKey.set(cell.key, [...((_a = cellsByKey.get(cell.key)) !== null && _a !== void 0 ? _a : []), cell]);
|
|
32276
|
+
cellsByKey.set(cell.key, [...((_a = cellsByKey.get(cell.key)) !== null && _a !== void 0 ? _a : []), { cell, bold: isBoldRow(row) }]);
|
|
31918
32277
|
}
|
|
31919
32278
|
}
|
|
31920
32279
|
const emPx = this.emPx();
|
|
@@ -31924,7 +32283,7 @@ const BnTableRenderer = class {
|
|
|
31924
32283
|
const fontFamily = this.labelFontFamily();
|
|
31925
32284
|
for (const [key, cells] of cellsByKey) {
|
|
31926
32285
|
const isRelative = key.startsWith("dr");
|
|
31927
|
-
const values = cells.map((cell) => cell.value);
|
|
32286
|
+
const values = cells.map(({ cell }) => cell.value);
|
|
31928
32287
|
const measure = (percentDigits, percentSign) => {
|
|
31929
32288
|
var _a;
|
|
31930
32289
|
const labels = {
|
|
@@ -31932,11 +32291,11 @@ const BnTableRenderer = class {
|
|
|
31932
32291
|
pos: values.some((value) => value > 0) ? 0 : undefined,
|
|
31933
32292
|
};
|
|
31934
32293
|
const zeroPositive = zeroOnPositiveSide(labels);
|
|
31935
|
-
for (const cell of cells) {
|
|
32294
|
+
for (const { cell, bold } of cells) {
|
|
31936
32295
|
const value = cell.value;
|
|
31937
32296
|
const side = value > 0 || (value === 0 && zeroPositive) ? "pos" : "neg";
|
|
31938
32297
|
const text = formatValue(value, isRelative, barLabelMeasureScale(cell), locale, percentDigits, percentSign, barLabelDigits(cell, this.componentDataFormatDigits));
|
|
31939
|
-
labels[side] = Math.max((_a = labels[side]) !== null && _a !== void 0 ? _a : 0, labelWidth(text, fs, fontFamily, isRelative));
|
|
32298
|
+
labels[side] = Math.max((_a = labels[side]) !== null && _a !== void 0 ? _a : 0, labelWidth(text, fs, fontFamily, isRelative, bold));
|
|
31940
32299
|
}
|
|
31941
32300
|
return labels;
|
|
31942
32301
|
};
|
|
@@ -31962,8 +32321,56 @@ const BnTableRenderer = class {
|
|
|
31962
32321
|
}
|
|
31963
32322
|
return layouts;
|
|
31964
32323
|
}
|
|
32324
|
+
/**
|
|
32325
|
+
* What a variance waterfall connector crosses outside the bar svg: the border of its own
|
|
32326
|
+
* row above, the padding of a sum row below.
|
|
32327
|
+
*/
|
|
32328
|
+
connectorReach(row) {
|
|
32329
|
+
const emPx = this.emPx();
|
|
32330
|
+
return { top: 0.1 * emPx, bottom: row.type === withStyled.TableRowType.SUM ? 0.5 * emPx : 0 };
|
|
32331
|
+
}
|
|
32332
|
+
/**
|
|
32333
|
+
* Geometry of every waterfall column from the measured labels of all cells that draw a
|
|
32334
|
+
* bar, sum rows included: each side gets the room its labels need.
|
|
32335
|
+
*/
|
|
32336
|
+
collectWaterfallGeometries() {
|
|
32337
|
+
var _a, _b, _c, _d;
|
|
32338
|
+
const geometries = new Map();
|
|
32339
|
+
if (!this.table || this.table.hasNoData())
|
|
32340
|
+
return geometries;
|
|
32341
|
+
const emPx = this.emPx();
|
|
32342
|
+
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
32343
|
+
const locale = (_c = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.locale;
|
|
32344
|
+
const fontFamily = this.labelFontFamily();
|
|
32345
|
+
const columns = new Map();
|
|
32346
|
+
for (const row of this.table.getBody()) {
|
|
32347
|
+
for (const cell of row.getCells()) {
|
|
32348
|
+
if (!cell.isBarChart || !cell.columnStats || cell.waterfall === undefined)
|
|
32349
|
+
continue;
|
|
32350
|
+
if (typeof cell.value !== "number" || isNaN(cell.value))
|
|
32351
|
+
continue;
|
|
32352
|
+
const { start, end, min, max, kind } = cell.waterfall;
|
|
32353
|
+
const text = waterfallLabelText(cell.value, kind, barLabelMeasureScale(cell), locale, barLabelDigits(cell, this.componentDataFormatDigits), cell.direction !== undefined);
|
|
32354
|
+
const column = (_d = columns.get(cell.key)) !== null && _d !== void 0 ? _d : { min, max, labels: [] };
|
|
32355
|
+
column.labels.push({
|
|
32356
|
+
end,
|
|
32357
|
+
pointsLeft: end < start,
|
|
32358
|
+
width: labelWidth(text, fs, fontFamily, false, isBoldRow(row)),
|
|
32359
|
+
});
|
|
32360
|
+
columns.set(cell.key, column);
|
|
32361
|
+
}
|
|
32362
|
+
}
|
|
32363
|
+
for (const [key, column] of columns) {
|
|
32364
|
+
geometries.set(key, waterfallGeometry(this.barColumnMaxWidth, emPx, column));
|
|
32365
|
+
}
|
|
32366
|
+
return geometries;
|
|
32367
|
+
}
|
|
31965
32368
|
get element() { return index.getElement(this); }
|
|
31966
32369
|
};
|
|
32370
|
+
/** Sum rows and the parent of thereof rows printed above it are bold. */
|
|
32371
|
+
function isBoldRow(row) {
|
|
32372
|
+
return row.type === withStyled.TableRowType.SUM || row.cssStyle === "ofit-sum";
|
|
32373
|
+
}
|
|
31967
32374
|
/** Percentage points: the fraction times 100, no measure scale. */
|
|
31968
32375
|
function barLabelMeasureScale(cell) {
|
|
31969
32376
|
return cell.type === "percentpoint" ? 0.01 : cell.measureScale;
|