@bino-bi/bn-template-engine 1.0.0-next.38 → 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 +1067 -515
- 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 +192 -12
- package/dist/collection/components/bn-table/bn-table.js +222 -8
- package/dist/collection/components/bn-table/utils/Table.js +33 -2
- 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 +59 -21
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +63 -2
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +30 -6
- 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 +21 -1
- package/dist/collection/components/bn-table/utils/model/index.js +6 -0
- package/dist/collection/utils/layoutState/baseline.js +6 -5
- 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-renderer.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-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-BhEdmPjm.js → p-CUSAlS2o.js} +1 -1
- package/dist/components/p-ChaSU4fh.js +1 -0
- package/dist/components/p-CvEdUq8i.js +1 -0
- package/dist/components/{p-OquycEMA.js → p-D40Am1Ap.js} +1 -1
- package/dist/components/{p-CQVAHG6w.js → p-DM4Up10X.js} +1 -1
- package/dist/components/{p-Bo_R7f_T.js → p-DwuXVo2h.js} +1 -1
- package/dist/components/{p-t4xPltK2.js → p-XFZYX7DZ.js} +1 -1
- package/dist/components/{p-DTmqMQpw.js → p-Y9bth2Y_.js} +1 -1
- package/dist/components/{p-C_6KHDYv.js → p-chnyMHJT.js} +1 -1
- package/dist/components/{p-BU_53KVT.js → p-xIWChKGS.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +1037 -485
- 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 +22 -1
- package/dist/types/components/bn-table/bn-table.d.ts +72 -1
- package/dist/types/components/bn-table/utils/Table.d.ts +11 -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/factories/tableDataSetFactory.d.ts +7 -4
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +13 -0
- package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +7 -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 +9 -1
- package/dist/types/components/bn-table/utils/model/index.d.ts +5 -0
- package/dist/types/components.d.ts +66 -6
- package/dist/types/utils/layoutState/baseline.d.ts +4 -2
- package/dist/types/utils/validate.d.ts +1 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-BVU4bIsi.js +0 -1
- package/dist/bn-template-engine/p-e15ccc4a.entry.js +0 -1
- package/dist/components/p--HIZm_2v.js +0 -1
- package/dist/components/p-C-KX1_tw.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-sar8m7th.js +0 -1
- package/dist/components/p-tkB96Ena.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forceUpdate, h, Host } from "@stencil/core";
|
|
2
|
-
import { OrderDirection, TableRowType, TableType } from "../utils/model";
|
|
2
|
+
import { OrderDirection, TableRowType, TableType, ThereofPosition } from "../utils/model";
|
|
3
3
|
import { dataPointAttributes, measure, measureContent, measureSign, readLayoutPoint, } from "../../../utils/layoutState";
|
|
4
4
|
import { Table } from "../utils/Table";
|
|
5
5
|
import { TableComponentConfigAdapter } from "../utils/model/TableComponentConfig";
|
|
@@ -10,12 +10,12 @@ import { IBCSRuleSet, stylesBySlot } from "../../../utils/ibcsRuleSet";
|
|
|
10
10
|
import { DataFormatDigits, DataFormatDigitsAdapter } from "../../../utils/model/DataFormatDigits";
|
|
11
11
|
import { OrderAdapter } from "../../../utils/model/Order";
|
|
12
12
|
import { CellBarChart, formatValue, zeroOnPositiveSide, } from "../utils/elements/CellBarChart";
|
|
13
|
-
import { WaterfallBar } from "../utils/elements/WaterfallBar";
|
|
13
|
+
import { WaterfallBar, waterfallLabelText } from "../utils/elements/WaterfallBar";
|
|
14
14
|
import withComponentStatus from "../../../utils/withComponentStatus";
|
|
15
15
|
import withComponentStyle from "../../../utils/withComponentStyle";
|
|
16
16
|
import { getStores } from "../../../context/context-protocol";
|
|
17
17
|
import { sourceExpr } from "../../../context/scopedDb";
|
|
18
|
-
import { absoluteBarGeometry, BAR_LABEL_FONT_RATIO, labelWidth, PIN_HEAD_SIZE, pinLabelsFit, relativePinGeometry, } from "../utils/helper/barColumnGeometry";
|
|
18
|
+
import { absoluteBarGeometry, BAR_LABEL_FONT_RATIO, labelWidth, PIN_HEAD_SIZE, pinLabelsFit, relativePinGeometry, waterfallGeometry, } from "../utils/helper/barColumnGeometry";
|
|
19
19
|
import { NOT_AVAILABLE } from "../../../utils/relativeVariance";
|
|
20
20
|
import { normalizeFillPattern } from "../../../utils/model/styles/SVGStyle";
|
|
21
21
|
/**
|
|
@@ -59,8 +59,14 @@ export class BnTableRenderer {
|
|
|
59
59
|
/** @internal */
|
|
60
60
|
this.showGroupTitle = true;
|
|
61
61
|
/** @internal */
|
|
62
|
+
this.runningSum = false;
|
|
63
|
+
/** @internal */
|
|
64
|
+
this.varianceWaterfall = false;
|
|
65
|
+
/** @internal */
|
|
62
66
|
this.thereof = [];
|
|
63
67
|
/** @internal */
|
|
68
|
+
this.thereofPosition = ThereofPosition.BELOW;
|
|
69
|
+
/** @internal */
|
|
64
70
|
this.partof = [];
|
|
65
71
|
/** @internal */
|
|
66
72
|
this.order = {
|
|
@@ -95,6 +101,8 @@ export class BnTableRenderer {
|
|
|
95
101
|
this.barColumns = [];
|
|
96
102
|
/** @internal */
|
|
97
103
|
this.interval = "none";
|
|
104
|
+
/** @internal */
|
|
105
|
+
this.categoryIntervalPosition = 0;
|
|
98
106
|
/**
|
|
99
107
|
* Total width of a bar chart column, in em of the table font - the same unit
|
|
100
108
|
* `categoryWidth` uses, so the two render at the same width for the same value.
|
|
@@ -109,9 +117,10 @@ export class BnTableRenderer {
|
|
|
109
117
|
this.scaleFactor = 1;
|
|
110
118
|
this.componentDataFormatDigits = new DataFormatDigits();
|
|
111
119
|
this.barColumnLayouts = new Map();
|
|
120
|
+
this.waterfallGeometries = new Map();
|
|
112
121
|
// labels measured in the fallback font are too narrow or too wide once the web font is there: lay out again
|
|
113
122
|
this.relayout = () => {
|
|
114
|
-
if (this.barColumnLayouts.size > 0)
|
|
123
|
+
if (this.barColumnLayouts.size > 0 || this.waterfallGeometries.size > 0)
|
|
115
124
|
forceUpdate(this);
|
|
116
125
|
};
|
|
117
126
|
withComponentStatus(this);
|
|
@@ -244,20 +253,22 @@ export class BnTableRenderer {
|
|
|
244
253
|
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;
|
|
245
254
|
return (h("table", null, h("thead", null, this.table.getHeader().map((row) => (h("tr", { class: row.cssStyle }, row.getCells().map((cell) => (h("th", { colSpan: cell.colSpan, class: cell.cssStyle }, cell.getAsHeaderList().map((line, i, arr) => (h("span", null, i === arr.length - 1 ? (h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (h("span", null, line, cell.drawPrefix(), h("br", null))))))))))))), h("tbody", null, this.table.getBody().map((row) => (h("tr", Object.assign({ class: row.cssStyle }, dataPointAttributes(row.key, "element")), row === null || row === void 0 ? void 0 : row.getCells().map((cell) => {
|
|
246
255
|
var _a, _b, _c, _d, _e;
|
|
247
|
-
return (h("td", Object.assign({ colSpan: cell.colSpan, class: cell.type ? `${cell
|
|
256
|
+
return (h("td", Object.assign({ colSpan: cell.colSpan, class: cell.type ? `${this.cellClass(cell, locale)} ${cell.type}` : cell.cssStyle }, (row.key && cell.value != null && cell.value !== "" && cell.value !== "-"
|
|
248
257
|
? dataPointAttributes(Object.assign(Object.assign({}, row.key), { date: cell.date, scenario: cell.key }), "element")
|
|
249
|
-
: {})), cell.prefix != null ? (h("span", { class: cell
|
|
258
|
+
: {})), cell.prefix != null ? (h("span", { class: this.cellClass(cell, locale) + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
|
|
250
259
|
cell.columnStats &&
|
|
251
260
|
cell.value !== NOT_AVAILABLE &&
|
|
252
261
|
// an untitled group head is only a gap between list groups, a bar cell would print "-" in it
|
|
253
262
|
(this.showGroupTitle || row.type !== TableRowType.HEADER) &&
|
|
254
|
-
(cell.waterfall !== undefined || row.type !== TableRowType.SUM)
|
|
263
|
+
(cell.waterfall !== undefined || row.type !== TableRowType.SUM) &&
|
|
264
|
+
// a variance walk where every step is zero has no extent: the rows print their zero
|
|
265
|
+
!(cell.direction !== undefined && cell.waterfall && cell.waterfall.max === cell.waterfall.min) ? (cell.waterfall !== undefined ? (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) })) : (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))));
|
|
255
266
|
})))))));
|
|
256
267
|
};
|
|
257
268
|
return h(Host, { class: { "no-data": ((_a = this.table) === null || _a === void 0 ? void 0 : _a.hasNoData()) === true } }, helper());
|
|
258
269
|
}
|
|
259
270
|
componentWillRender() {
|
|
260
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
271
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
261
272
|
if (!this.stores)
|
|
262
273
|
this.stores = getStores(this.element);
|
|
263
274
|
const db = this.stores.db.db;
|
|
@@ -297,9 +308,26 @@ export class BnTableRenderer {
|
|
|
297
308
|
else {
|
|
298
309
|
(_h = this.errors) === null || _h === void 0 ? void 0 : _h.remove("WARN_orderBucket");
|
|
299
310
|
}
|
|
311
|
+
const positionWarning = (_j = this.table) === null || _j === void 0 ? void 0 : _j.categoryIntervalPositionWarning();
|
|
312
|
+
for (const id of ["WARN_categoryIntervalPositionNoInterval", "WARN_categoryIntervalPositionRange"]) {
|
|
313
|
+
if ((positionWarning === null || positionWarning === void 0 ? void 0 : positionWarning.id) === id) {
|
|
314
|
+
(_k = this.errors) === null || _k === void 0 ? void 0 : _k.addOrReplace({ id, type: "warning", message: positionWarning.message });
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
(_l = this.errors) === null || _l === void 0 ? void 0 : _l.remove(id);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
300
320
|
this.barColumnLayouts = this.collectBarColumnLayouts();
|
|
321
|
+
this.waterfallGeometries = this.collectWaterfallGeometries();
|
|
301
322
|
this.barChartStyles = this.prepareBarChartStyles();
|
|
302
323
|
}
|
|
324
|
+
/** The classes of a number cell. A variance that prints as zero loses its sign and its sentiment color. */
|
|
325
|
+
cellClass(cell, locale) {
|
|
326
|
+
if (cell.direction === undefined || !cell.roundsToZero(this.componentDataFormatDigits, locale)) {
|
|
327
|
+
return cell.cssStyle;
|
|
328
|
+
}
|
|
329
|
+
return cell.cssStyle.replace(/^(pos|neg)_\w+/, "zero");
|
|
330
|
+
}
|
|
303
331
|
prepareConfig(db) {
|
|
304
332
|
var _a, _b, _c;
|
|
305
333
|
const fromExpr = sourceExpr(db, this.tableName, this.filter);
|
|
@@ -313,7 +341,10 @@ export class BnTableRenderer {
|
|
|
313
341
|
scenariosUnitType: this.scenariosDataFormat,
|
|
314
342
|
grouped: this.grouped,
|
|
315
343
|
showGroupTitle: this.showGroupTitle,
|
|
344
|
+
runningSum: this.runningSum,
|
|
345
|
+
varianceWaterfall: this.varianceWaterfall,
|
|
316
346
|
thereOf: this.thereof,
|
|
347
|
+
thereOfPosition: this.thereofPosition,
|
|
317
348
|
partOf: this.partof,
|
|
318
349
|
categoryThereOf: this.categorythereof,
|
|
319
350
|
attributes: this.attributeColumns,
|
|
@@ -329,6 +360,7 @@ export class BnTableRenderer {
|
|
|
329
360
|
filter: this.filter,
|
|
330
361
|
barColumns: this.barColumns,
|
|
331
362
|
interval: this.interval,
|
|
363
|
+
categoryIntervalPosition: this.categoryIntervalPosition,
|
|
332
364
|
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) || "de",
|
|
333
365
|
});
|
|
334
366
|
return config;
|
|
@@ -475,6 +507,7 @@ export class BnTableRenderer {
|
|
|
475
507
|
const layouts = new Map();
|
|
476
508
|
if (!this.table || this.table.hasNoData())
|
|
477
509
|
return layouts;
|
|
510
|
+
// a cell with the weight its row prints in
|
|
478
511
|
const cellsByKey = new Map();
|
|
479
512
|
for (const row of this.table.getBody()) {
|
|
480
513
|
if (row.type === TableRowType.SUM)
|
|
@@ -485,7 +518,7 @@ export class BnTableRenderer {
|
|
|
485
518
|
continue;
|
|
486
519
|
if (typeof cell.value !== "number" || isNaN(cell.value))
|
|
487
520
|
continue;
|
|
488
|
-
cellsByKey.set(cell.key, [...((_a = cellsByKey.get(cell.key)) !== null && _a !== void 0 ? _a : []), cell]);
|
|
521
|
+
cellsByKey.set(cell.key, [...((_a = cellsByKey.get(cell.key)) !== null && _a !== void 0 ? _a : []), { cell, bold: isBoldRow(row) }]);
|
|
489
522
|
}
|
|
490
523
|
}
|
|
491
524
|
const emPx = this.emPx();
|
|
@@ -495,7 +528,7 @@ export class BnTableRenderer {
|
|
|
495
528
|
const fontFamily = this.labelFontFamily();
|
|
496
529
|
for (const [key, cells] of cellsByKey) {
|
|
497
530
|
const isRelative = key.startsWith("dr");
|
|
498
|
-
const values = cells.map((cell) => cell.value);
|
|
531
|
+
const values = cells.map(({ cell }) => cell.value);
|
|
499
532
|
const measure = (percentDigits, percentSign) => {
|
|
500
533
|
var _a;
|
|
501
534
|
const labels = {
|
|
@@ -503,11 +536,11 @@ export class BnTableRenderer {
|
|
|
503
536
|
pos: values.some((value) => value > 0) ? 0 : undefined,
|
|
504
537
|
};
|
|
505
538
|
const zeroPositive = zeroOnPositiveSide(labels);
|
|
506
|
-
for (const cell of cells) {
|
|
539
|
+
for (const { cell, bold } of cells) {
|
|
507
540
|
const value = cell.value;
|
|
508
541
|
const side = value > 0 || (value === 0 && zeroPositive) ? "pos" : "neg";
|
|
509
542
|
const text = formatValue(value, isRelative, barLabelMeasureScale(cell), locale, percentDigits, percentSign, barLabelDigits(cell, this.componentDataFormatDigits));
|
|
510
|
-
labels[side] = Math.max((_a = labels[side]) !== null && _a !== void 0 ? _a : 0, labelWidth(text, fs, fontFamily, isRelative));
|
|
543
|
+
labels[side] = Math.max((_a = labels[side]) !== null && _a !== void 0 ? _a : 0, labelWidth(text, fs, fontFamily, isRelative, bold));
|
|
511
544
|
}
|
|
512
545
|
return labels;
|
|
513
546
|
};
|
|
@@ -533,6 +566,50 @@ export class BnTableRenderer {
|
|
|
533
566
|
}
|
|
534
567
|
return layouts;
|
|
535
568
|
}
|
|
569
|
+
/**
|
|
570
|
+
* What a variance waterfall connector crosses outside the bar svg: the border of its own
|
|
571
|
+
* row above, the padding of a sum row below.
|
|
572
|
+
*/
|
|
573
|
+
connectorReach(row) {
|
|
574
|
+
const emPx = this.emPx();
|
|
575
|
+
return { top: 0.1 * emPx, bottom: row.type === TableRowType.SUM ? 0.5 * emPx : 0 };
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Geometry of every waterfall column from the measured labels of all cells that draw a
|
|
579
|
+
* bar, sum rows included: each side gets the room its labels need.
|
|
580
|
+
*/
|
|
581
|
+
collectWaterfallGeometries() {
|
|
582
|
+
var _a, _b, _c, _d;
|
|
583
|
+
const geometries = new Map();
|
|
584
|
+
if (!this.table || this.table.hasNoData())
|
|
585
|
+
return geometries;
|
|
586
|
+
const emPx = this.emPx();
|
|
587
|
+
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
588
|
+
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;
|
|
589
|
+
const fontFamily = this.labelFontFamily();
|
|
590
|
+
const columns = new Map();
|
|
591
|
+
for (const row of this.table.getBody()) {
|
|
592
|
+
for (const cell of row.getCells()) {
|
|
593
|
+
if (!cell.isBarChart || !cell.columnStats || cell.waterfall === undefined)
|
|
594
|
+
continue;
|
|
595
|
+
if (typeof cell.value !== "number" || isNaN(cell.value))
|
|
596
|
+
continue;
|
|
597
|
+
const { start, end, min, max, kind } = cell.waterfall;
|
|
598
|
+
const text = waterfallLabelText(cell.value, kind, barLabelMeasureScale(cell), locale, barLabelDigits(cell, this.componentDataFormatDigits), cell.direction !== undefined);
|
|
599
|
+
const column = (_d = columns.get(cell.key)) !== null && _d !== void 0 ? _d : { min, max, labels: [] };
|
|
600
|
+
column.labels.push({
|
|
601
|
+
end,
|
|
602
|
+
pointsLeft: end < start,
|
|
603
|
+
width: labelWidth(text, fs, fontFamily, false, isBoldRow(row)),
|
|
604
|
+
});
|
|
605
|
+
columns.set(cell.key, column);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
for (const [key, column] of columns) {
|
|
609
|
+
geometries.set(key, waterfallGeometry(this.barColumnMaxWidth, emPx, column));
|
|
610
|
+
}
|
|
611
|
+
return geometries;
|
|
612
|
+
}
|
|
536
613
|
static get is() { return "bn-table-renderer"; }
|
|
537
614
|
static get encapsulation() { return "shadow"; }
|
|
538
615
|
static get originalStyleUrls() {
|
|
@@ -758,6 +835,52 @@ export class BnTableRenderer {
|
|
|
758
835
|
"attribute": "show-group-title",
|
|
759
836
|
"defaultValue": "true"
|
|
760
837
|
},
|
|
838
|
+
"runningSum": {
|
|
839
|
+
"type": "boolean",
|
|
840
|
+
"mutable": false,
|
|
841
|
+
"complexType": {
|
|
842
|
+
"original": "boolean",
|
|
843
|
+
"resolved": "boolean",
|
|
844
|
+
"references": {}
|
|
845
|
+
},
|
|
846
|
+
"required": false,
|
|
847
|
+
"optional": false,
|
|
848
|
+
"docs": {
|
|
849
|
+
"tags": [{
|
|
850
|
+
"name": "internal",
|
|
851
|
+
"text": undefined
|
|
852
|
+
}],
|
|
853
|
+
"text": ""
|
|
854
|
+
},
|
|
855
|
+
"getter": false,
|
|
856
|
+
"setter": false,
|
|
857
|
+
"reflect": false,
|
|
858
|
+
"attribute": "running-sum",
|
|
859
|
+
"defaultValue": "false"
|
|
860
|
+
},
|
|
861
|
+
"varianceWaterfall": {
|
|
862
|
+
"type": "boolean",
|
|
863
|
+
"mutable": false,
|
|
864
|
+
"complexType": {
|
|
865
|
+
"original": "boolean",
|
|
866
|
+
"resolved": "boolean",
|
|
867
|
+
"references": {}
|
|
868
|
+
},
|
|
869
|
+
"required": false,
|
|
870
|
+
"optional": false,
|
|
871
|
+
"docs": {
|
|
872
|
+
"tags": [{
|
|
873
|
+
"name": "internal",
|
|
874
|
+
"text": undefined
|
|
875
|
+
}],
|
|
876
|
+
"text": ""
|
|
877
|
+
},
|
|
878
|
+
"getter": false,
|
|
879
|
+
"setter": false,
|
|
880
|
+
"reflect": false,
|
|
881
|
+
"attribute": "variance-waterfall",
|
|
882
|
+
"defaultValue": "false"
|
|
883
|
+
},
|
|
761
884
|
"thereof": {
|
|
762
885
|
"type": "unknown",
|
|
763
886
|
"mutable": false,
|
|
@@ -786,6 +909,36 @@ export class BnTableRenderer {
|
|
|
786
909
|
"setter": false,
|
|
787
910
|
"defaultValue": "[]"
|
|
788
911
|
},
|
|
912
|
+
"thereofPosition": {
|
|
913
|
+
"type": "string",
|
|
914
|
+
"mutable": false,
|
|
915
|
+
"complexType": {
|
|
916
|
+
"original": "ThereofPosition",
|
|
917
|
+
"resolved": "ThereofPosition.ABOVE | ThereofPosition.BELOW",
|
|
918
|
+
"references": {
|
|
919
|
+
"ThereofPosition": {
|
|
920
|
+
"location": "import",
|
|
921
|
+
"path": "../utils/model",
|
|
922
|
+
"id": "src/components/bn-table/utils/model/index.ts::ThereofPosition",
|
|
923
|
+
"referenceLocation": "ThereofPosition"
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
"required": false,
|
|
928
|
+
"optional": false,
|
|
929
|
+
"docs": {
|
|
930
|
+
"tags": [{
|
|
931
|
+
"name": "internal",
|
|
932
|
+
"text": undefined
|
|
933
|
+
}],
|
|
934
|
+
"text": ""
|
|
935
|
+
},
|
|
936
|
+
"getter": false,
|
|
937
|
+
"setter": false,
|
|
938
|
+
"reflect": false,
|
|
939
|
+
"attribute": "thereof-position",
|
|
940
|
+
"defaultValue": "ThereofPosition.BELOW"
|
|
941
|
+
},
|
|
789
942
|
"partof": {
|
|
790
943
|
"type": "unknown",
|
|
791
944
|
"mutable": false,
|
|
@@ -1237,6 +1390,29 @@ export class BnTableRenderer {
|
|
|
1237
1390
|
"attribute": "interval",
|
|
1238
1391
|
"defaultValue": "\"none\""
|
|
1239
1392
|
},
|
|
1393
|
+
"categoryIntervalPosition": {
|
|
1394
|
+
"type": "number",
|
|
1395
|
+
"mutable": false,
|
|
1396
|
+
"complexType": {
|
|
1397
|
+
"original": "number",
|
|
1398
|
+
"resolved": "number",
|
|
1399
|
+
"references": {}
|
|
1400
|
+
},
|
|
1401
|
+
"required": false,
|
|
1402
|
+
"optional": false,
|
|
1403
|
+
"docs": {
|
|
1404
|
+
"tags": [{
|
|
1405
|
+
"name": "internal",
|
|
1406
|
+
"text": undefined
|
|
1407
|
+
}],
|
|
1408
|
+
"text": ""
|
|
1409
|
+
},
|
|
1410
|
+
"getter": false,
|
|
1411
|
+
"setter": false,
|
|
1412
|
+
"reflect": false,
|
|
1413
|
+
"attribute": "category-interval-position",
|
|
1414
|
+
"defaultValue": "0"
|
|
1415
|
+
},
|
|
1240
1416
|
"barColumnMaxWidth": {
|
|
1241
1417
|
"type": "number",
|
|
1242
1418
|
"mutable": false,
|
|
@@ -1460,6 +1636,10 @@ export class BnTableRenderer {
|
|
|
1460
1636
|
}
|
|
1461
1637
|
static get elementRef() { return "element"; }
|
|
1462
1638
|
}
|
|
1639
|
+
/** Sum rows and the parent of thereof rows printed above it are bold. */
|
|
1640
|
+
function isBoldRow(row) {
|
|
1641
|
+
return row.type === TableRowType.SUM || row.cssStyle === "ofit-sum";
|
|
1642
|
+
}
|
|
1463
1643
|
/** Percentage points: the fraction times 100, no measure scale. */
|
|
1464
1644
|
function barLabelMeasureScale(cell) {
|
|
1465
1645
|
return cell.type === "percentpoint" ? 0.01 : cell.measureScale;
|