@bino-bi/bn-template-engine 1.0.0-next.37 → 1.0.0-next.39
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-f74760d7.entry.js → p-8c84d57e.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +271 -57
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +56 -6
- package/dist/collection/components/bn-table/bn-table.js +93 -5
- package/dist/collection/components/bn-table/utils/Table.js +33 -2
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +15 -7
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +2 -2
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +15 -7
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +24 -10
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +30 -6
- package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +9 -3
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +31 -8
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +5 -0
- package/dist/collection/utils/layoutState/baseline.js +6 -5
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet-renderer.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/{p-CQVAHG6w.js → p-B4Cf0cVi.js} +1 -1
- package/dist/components/{p-C-KX1_tw.js → p-BsJOvfIg.js} +1 -1
- package/dist/components/p-ChaSU4fh.js +1 -0
- package/dist/components/{p-BhEdmPjm.js → p-Cyf5ZEXs.js} +1 -1
- package/dist/components/{p-t4xPltK2.js → p-XFZYX7DZ.js} +1 -1
- package/dist/components/{p-C_6KHDYv.js → p-chnyMHJT.js} +1 -1
- package/dist/components/p-dRPJiQB6.js +1 -0
- package/dist/esm/bn-annotation-layer_30.entry.js +271 -57
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/bn-table/bn-table-renderer/bn-table-renderer.d.ts +2 -0
- package/dist/types/components/bn-table/bn-table.d.ts +26 -0
- package/dist/types/components/bn-table/utils/Table.d.ts +11 -1
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +5 -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 +1 -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 +5 -2
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +15 -6
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +2 -0
- package/dist/types/components.d.ts +19 -4
- package/dist/types/utils/layoutState/baseline.d.ts +4 -2
- package/package.json +1 -1
- package/dist/components/p-CHQ67u2G.js +0 -1
- package/dist/components/p-sar8m7th.js +0 -1
|
@@ -808,8 +808,10 @@ function readChartBaseline(host, innerTag) {
|
|
|
808
808
|
}
|
|
809
809
|
/**
|
|
810
810
|
* Baseline of a rendered `<table>`, in the layout px of `host`: y is the
|
|
811
|
-
* bottom of the header, x the left edge of the first value column
|
|
812
|
-
*
|
|
811
|
+
* bottom of the header, x the left edge of the first value column of the last
|
|
812
|
+
* header row, else of the first body row. That is the first cell that is not
|
|
813
|
+
* the operation or the category column. Interval groups can stand left of the
|
|
814
|
+
* category column, then it is the first cell of the row.
|
|
813
815
|
*/
|
|
814
816
|
function readTableBaseline(table, host) {
|
|
815
817
|
var _a;
|
|
@@ -825,10 +827,9 @@ function readTableBaseline(table, host) {
|
|
|
825
827
|
const rows = (section) => section ? Array.from(section.children).filter((child) => child.localName === "tr") : [];
|
|
826
828
|
const headerRows = rows(thead);
|
|
827
829
|
const row = (_a = headerRows[headerRows.length - 1]) !== null && _a !== void 0 ? _a : rows(table.querySelector("tbody"))[0];
|
|
828
|
-
// an operation column can come before the category column (table type opt)
|
|
829
830
|
const cells = row ? Array.from(row.children) : [];
|
|
830
|
-
const
|
|
831
|
-
const valueCell = cells
|
|
831
|
+
const isRowHeader = (cell) => cell.classList.contains("category") || cell.classList.contains("operation");
|
|
832
|
+
const valueCell = cells.some(isRowHeader) ? cells.find((cell) => !isRowHeader(cell)) : cells[1];
|
|
832
833
|
if (valueCell) {
|
|
833
834
|
baseline.x = round2(frame.toLocal(valueCell.getBoundingClientRect()).x);
|
|
834
835
|
}
|
|
@@ -26632,6 +26633,16 @@ function intervalBucketSQL(interval) {
|
|
|
26632
26633
|
}
|
|
26633
26634
|
return `normalizeDate([date], '${interval}')`;
|
|
26634
26635
|
}
|
|
26636
|
+
/** SQL expression reading the optional `setnameIndex` column, tolerant like `setname`. */
|
|
26637
|
+
const SETNAME_INDEX_SQL = "COALESCE([setnameIndex],[setNameIndex])";
|
|
26638
|
+
/** A raw `setnameIndex` value as a number; undefined when it is blank or not numeric. */
|
|
26639
|
+
function coerceSetnameIndex(value) {
|
|
26640
|
+
if (typeof value === "string" ? value.trim() === "" : typeof value !== "number") {
|
|
26641
|
+
return undefined;
|
|
26642
|
+
}
|
|
26643
|
+
const index = Number(value);
|
|
26644
|
+
return Number.isFinite(index) ? index : undefined;
|
|
26645
|
+
}
|
|
26635
26646
|
/** Coerces a raw bucket value (luxon DateTime, string, millis) to a stable string key. */
|
|
26636
26647
|
function coerceBucketKey(value) {
|
|
26637
26648
|
if (value == null) {
|
|
@@ -26678,22 +26689,36 @@ function resolveIntervalGranularity(db, fromExpr, interval) {
|
|
|
26678
26689
|
* Date buckets are sorted chronologically ascending and labeled locale-aware;
|
|
26679
26690
|
* setname buckets keep their order of first appearance in the data, blank
|
|
26680
26691
|
* setnames are collected in a trailing-position "-" bucket where they occur.
|
|
26692
|
+
* When rows carry a numeric `setnameIndex`, the setname buckets are sorted
|
|
26693
|
+
* ascending by the smallest index of each setname. Buckets without an index
|
|
26694
|
+
* follow, and ties keep the order of first appearance.
|
|
26681
26695
|
*/
|
|
26682
26696
|
function queryIntervalBuckets(db, fromExpr, interval, locale) {
|
|
26683
|
-
const rows = db.exec(`SELECT ${intervalBucketSQL(interval)} as __interval FROM ${fromExpr}`);
|
|
26684
26697
|
if (interval === INTERVAL_SETNAME) {
|
|
26698
|
+
const setRows = db.exec(`SELECT ${intervalBucketSQL(interval)} as __interval, ${SETNAME_INDEX_SQL} as __index FROM ${fromExpr}`);
|
|
26685
26699
|
const seen = new Set();
|
|
26700
|
+
const indexes = new Map();
|
|
26686
26701
|
const buckets = [];
|
|
26687
|
-
for (const row of
|
|
26702
|
+
for (const row of setRows) {
|
|
26688
26703
|
const key = coerceBucketKey(row.__interval);
|
|
26689
|
-
if (seen.has(key)) {
|
|
26690
|
-
|
|
26704
|
+
if (!seen.has(key)) {
|
|
26705
|
+
seen.add(key);
|
|
26706
|
+
buckets.push({ key, label: key.length === 0 ? BLANK_BUCKET_LABEL : key });
|
|
26691
26707
|
}
|
|
26692
|
-
|
|
26693
|
-
|
|
26708
|
+
const index = coerceSetnameIndex(row.__index);
|
|
26709
|
+
const known = indexes.get(key);
|
|
26710
|
+
if (index !== undefined && (known === undefined || index < known)) {
|
|
26711
|
+
indexes.set(key, index);
|
|
26712
|
+
}
|
|
26713
|
+
}
|
|
26714
|
+
// without any index the order of first appearance stays as it is
|
|
26715
|
+
if (indexes.size > 0) {
|
|
26716
|
+
const rank = (bucket) => { var _a; return (_a = indexes.get(bucket.key)) !== null && _a !== void 0 ? _a : Number.POSITIVE_INFINITY; };
|
|
26717
|
+
buckets.sort((a, b) => (rank(a) === rank(b) ? 0 : rank(a) < rank(b) ? -1 : 1));
|
|
26694
26718
|
}
|
|
26695
26719
|
return buckets;
|
|
26696
26720
|
}
|
|
26721
|
+
const rows = db.exec(`SELECT ${intervalBucketSQL(interval)} as __interval FROM ${fromExpr}`);
|
|
26697
26722
|
const seen = new Set();
|
|
26698
26723
|
const dates = [];
|
|
26699
26724
|
for (const row of rows) {
|
|
@@ -26768,6 +26793,8 @@ const Table$1 = class Table {
|
|
|
26768
26793
|
this.appliedScaleFactor = 1;
|
|
26769
26794
|
/** True when the active dataset contains rows with a blank `setname` (relevant for `interval='setname'`). */
|
|
26770
26795
|
this.hasBlankSetnames = false;
|
|
26796
|
+
/** True when the active dataset contains rows with a `setnameIndex` but a blank `setname`. */
|
|
26797
|
+
this.hasSetnameIndexWithoutSetname = false;
|
|
26771
26798
|
/**
|
|
26772
26799
|
* Label of the grand-total row at the bottom of the table. Only rendered for
|
|
26773
26800
|
* `type="sum"` and `type="opt"`; the other table types have no total row.
|
|
@@ -26917,6 +26944,9 @@ const Table$1 = class Table {
|
|
|
26917
26944
|
* inside each group, the groups keep their rowgroupindex order. With a variance or `@`, rows without data
|
|
26918
26945
|
* (and a relative variance with a zero reference) sort last.
|
|
26919
26946
|
* <br /><br />
|
|
26947
|
+
* A data row with the category `REST` is the rest row of its group: sorted by a scenario or variance it stays
|
|
26948
|
+
* the last row of the group. Its label comes from the `REST` translation.
|
|
26949
|
+
* <br /><br />
|
|
26920
26950
|
* When set to ```auto```, order is detected from the dataset silently.
|
|
26921
26951
|
*/
|
|
26922
26952
|
this.order = "category";
|
|
@@ -27013,8 +27043,27 @@ const Table$1 = class Table {
|
|
|
27013
27043
|
* raise a warning and are grouped under `-`. Date values bucket rows by the
|
|
27014
27044
|
* `date` column; ```auto``` detects the granularity from the date span.
|
|
27015
27045
|
* Cannot be combined with `columnthereof`.
|
|
27046
|
+
* <br /><br />
|
|
27047
|
+
* Date groups are shown in chronological order. Setname groups are shown in
|
|
27048
|
+
* order of first appearance in the dataset. When the rows carry the optional
|
|
27049
|
+
* numeric column `setnameIndex`, the setname groups are sorted ascending by
|
|
27050
|
+
* it: the smallest index of a setname counts, groups without an index come
|
|
27051
|
+
* last.
|
|
27016
27052
|
*/
|
|
27017
27053
|
this.interval = "none";
|
|
27054
|
+
/**
|
|
27055
|
+
* Number of interval groups that stand left of the category column. Needs
|
|
27056
|
+
* an active `interval`.
|
|
27057
|
+
* <br /><br />
|
|
27058
|
+
* ```0``` (default) keeps the category column first. ```1``` puts one
|
|
27059
|
+
* interval group left of it and the rest right. The number of interval
|
|
27060
|
+
* groups puts the category column last. A greater value raises a warning
|
|
27061
|
+
* and is used as the number of groups.
|
|
27062
|
+
* <br /><br />
|
|
27063
|
+
* The operation column and the `attributes` columns move with the category
|
|
27064
|
+
* column.
|
|
27065
|
+
*/
|
|
27066
|
+
this.categoryIntervalPosition = 0;
|
|
27018
27067
|
/**
|
|
27019
27068
|
* Stringified JSON object defining custom columns computed from dataset fields.<br />
|
|
27020
27069
|
* Keys are column labels, values are aggregate expressions over the rows that
|
|
@@ -27080,6 +27129,13 @@ const Table$1 = class Table {
|
|
|
27080
27129
|
this.dataVersion = this.dataVersion + 1;
|
|
27081
27130
|
this.hasBlankSetnames =
|
|
27082
27131
|
Array.isArray(data) && data.some((row) => { var _a; return isBlankInput(((_a = row === null || row === void 0 ? void 0 : row.setname) !== null && _a !== void 0 ? _a : row === null || row === void 0 ? void 0 : row.setName)); });
|
|
27132
|
+
this.hasSetnameIndexWithoutSetname =
|
|
27133
|
+
Array.isArray(data) &&
|
|
27134
|
+
data.some((row) => {
|
|
27135
|
+
var _a, _b;
|
|
27136
|
+
return coerceSetnameIndex((_a = row === null || row === void 0 ? void 0 : row.setnameIndex) !== null && _a !== void 0 ? _a : row === null || row === void 0 ? void 0 : row.setNameIndex) !== undefined &&
|
|
27137
|
+
isBlankInput(((_b = row === null || row === void 0 ? void 0 : row.setname) !== null && _b !== void 0 ? _b : row === null || row === void 0 ? void 0 : row.setName));
|
|
27138
|
+
});
|
|
27083
27139
|
}, (_name, meta) => {
|
|
27084
27140
|
this.datasetMeta = meta;
|
|
27085
27141
|
});
|
|
@@ -27392,6 +27448,19 @@ const Table$1 = class Table {
|
|
|
27392
27448
|
});
|
|
27393
27449
|
}
|
|
27394
27450
|
}
|
|
27451
|
+
validateCategoryIntervalPosition(newValue) {
|
|
27452
|
+
const errId = "WARN_categoryIntervalPosition";
|
|
27453
|
+
if (isBlankInput(newValue) || (isValidInteger(newValue) && Number(newValue) >= 0)) {
|
|
27454
|
+
this.errors.remove(errId);
|
|
27455
|
+
}
|
|
27456
|
+
else {
|
|
27457
|
+
this.errors.addOrReplace({
|
|
27458
|
+
id: errId,
|
|
27459
|
+
type: "warning",
|
|
27460
|
+
message: "categoryIntervalPosition: invalid value '" + newValue + "' is not supported.",
|
|
27461
|
+
});
|
|
27462
|
+
}
|
|
27463
|
+
}
|
|
27395
27464
|
validateTableAttributes(newValue) {
|
|
27396
27465
|
const errId = "WARN_attributes";
|
|
27397
27466
|
const invalidElements = validateAttributesJsonStr(newValue);
|
|
@@ -27424,6 +27493,7 @@ const Table$1 = class Table {
|
|
|
27424
27493
|
this.validateMeasureScale(this.measureScale);
|
|
27425
27494
|
this.validateColumnThereOf(this.columnthereof);
|
|
27426
27495
|
this.validateInterval(this.interval);
|
|
27496
|
+
this.validateCategoryIntervalPosition(this.categoryIntervalPosition);
|
|
27427
27497
|
this.validateTableAttributes(this.tableAttributes);
|
|
27428
27498
|
this.validateBarColumns(this.barColumns);
|
|
27429
27499
|
this.validateBarColumnWidth(this.barColumnWidth);
|
|
@@ -27740,6 +27810,7 @@ const Table$1 = class Table {
|
|
|
27740
27810
|
const conflictErrId = "WARN_intervalConflict";
|
|
27741
27811
|
const noDateErrId = "WARN_intervalNoDate";
|
|
27742
27812
|
const setnameErrId = "WARN_intervalSetname";
|
|
27813
|
+
const setnameIndexErrId = "WARN_intervalSetnameIndex";
|
|
27743
27814
|
const interval = isBlankInput(this.interval) ? INTERVAL_NONE : this.interval.trim().toLowerCase();
|
|
27744
27815
|
const isValid = interval === INTERVAL_NONE || interval === INTERVAL_SETNAME || isValidDateFormat(interval);
|
|
27745
27816
|
// invalid values are already reported by validateInterval
|
|
@@ -27747,6 +27818,7 @@ const Table$1 = class Table {
|
|
|
27747
27818
|
this.errors.remove(conflictErrId);
|
|
27748
27819
|
this.errors.remove(noDateErrId);
|
|
27749
27820
|
this.errors.remove(setnameErrId);
|
|
27821
|
+
this.errors.remove(setnameIndexErrId);
|
|
27750
27822
|
return INTERVAL_NONE;
|
|
27751
27823
|
}
|
|
27752
27824
|
if (this.columnthereof != null && this.columnthereof.trim() !== "") {
|
|
@@ -27757,6 +27829,7 @@ const Table$1 = class Table {
|
|
|
27757
27829
|
});
|
|
27758
27830
|
this.errors.remove(noDateErrId);
|
|
27759
27831
|
this.errors.remove(setnameErrId);
|
|
27832
|
+
this.errors.remove(setnameIndexErrId);
|
|
27760
27833
|
return INTERVAL_NONE;
|
|
27761
27834
|
}
|
|
27762
27835
|
this.errors.remove(conflictErrId);
|
|
@@ -27771,10 +27844,21 @@ const Table$1 = class Table {
|
|
|
27771
27844
|
else {
|
|
27772
27845
|
this.errors.remove(setnameErrId);
|
|
27773
27846
|
}
|
|
27847
|
+
if (this.hasSetnameIndexWithoutSetname) {
|
|
27848
|
+
this.errors.addOrReplace({
|
|
27849
|
+
id: setnameIndexErrId,
|
|
27850
|
+
type: "warning",
|
|
27851
|
+
message: "interval: rows with setnameIndex but blank setname found, setnameIndex needs setname.",
|
|
27852
|
+
});
|
|
27853
|
+
}
|
|
27854
|
+
else {
|
|
27855
|
+
this.errors.remove(setnameIndexErrId);
|
|
27856
|
+
}
|
|
27774
27857
|
this.errors.remove(noDateErrId);
|
|
27775
27858
|
return INTERVAL_SETNAME;
|
|
27776
27859
|
}
|
|
27777
27860
|
this.errors.remove(setnameErrId);
|
|
27861
|
+
this.errors.remove(setnameIndexErrId);
|
|
27778
27862
|
if (this.datasetMeta && !((_a = this.datasetMeta.dateRange) === null || _a === void 0 ? void 0 : _a.hasData)) {
|
|
27779
27863
|
this.errors.addOrReplace({
|
|
27780
27864
|
id: noDateErrId,
|
|
@@ -27786,6 +27870,10 @@ const Table$1 = class Table {
|
|
|
27786
27870
|
this.errors.remove(noDateErrId);
|
|
27787
27871
|
return interval;
|
|
27788
27872
|
}
|
|
27873
|
+
prepareCategoryIntervalPosition() {
|
|
27874
|
+
const position = Number(this.categoryIntervalPosition);
|
|
27875
|
+
return Number.isInteger(position) && position > 0 ? position : 0;
|
|
27876
|
+
}
|
|
27789
27877
|
prepareAttributes() {
|
|
27790
27878
|
if (this.tableAttributes == null || this.tableAttributes.trim() === "") {
|
|
27791
27879
|
return [];
|
|
@@ -27891,6 +27979,7 @@ const Table$1 = class Table {
|
|
|
27891
27979
|
const dataSetStructure = {
|
|
27892
27980
|
ITableDataRow: {
|
|
27893
27981
|
setName: { type: "string", isOptional: false, description: "" },
|
|
27982
|
+
setNameIndex: { type: "number", isOptional: true, description: "" },
|
|
27894
27983
|
date: { type: "string", isOptional: false, description: "" },
|
|
27895
27984
|
operation: { type: "string", isOptional: false, description: "" },
|
|
27896
27985
|
rowGroup: { type: "string", isOptional: false, description: "" },
|
|
@@ -28046,7 +28135,7 @@ const Table$1 = class Table {
|
|
|
28046
28135
|
render() {
|
|
28047
28136
|
const fontStyles = this.getFontStyles();
|
|
28048
28137
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
28049
|
-
return (h(Host, { key: '
|
|
28138
|
+
return (h(Host, { key: '9c4b7d3df45c425ab5d6f1443a3a067220d3a451', style: fontStyles }, h("div", { key: 'b0332096da43ca9d5c139da7f18abdcb89356c37' }, h("bn-table-renderer", { key: 'f9ae1288c299bf3e5a5d1da5161fd9c663472e76', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), 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 }))));
|
|
28050
28139
|
}
|
|
28051
28140
|
get element() { return getElement(this); }
|
|
28052
28141
|
static get watchers() { return {
|
|
@@ -28116,6 +28205,9 @@ const Table$1 = class Table {
|
|
|
28116
28205
|
"interval": [{
|
|
28117
28206
|
"validateInterval": 0
|
|
28118
28207
|
}],
|
|
28208
|
+
"categoryIntervalPosition": [{
|
|
28209
|
+
"validateCategoryIntervalPosition": 0
|
|
28210
|
+
}],
|
|
28119
28211
|
"tableAttributes": [{
|
|
28120
28212
|
"validateTableAttributes": 0
|
|
28121
28213
|
}]
|
|
@@ -28421,20 +28513,43 @@ function pinLabelsFit(widthEm, emPx, labels, headSize) {
|
|
|
28421
28513
|
const { sides, neg, pos } = sideNeeds(labels, headSize / 2, LABEL_GAP_EM * emPx);
|
|
28422
28514
|
return neg + pos + sides * minExtent(totalWidth, emPx, sides) <= totalWidth + 1e-6;
|
|
28423
28515
|
}
|
|
28424
|
-
function
|
|
28425
|
-
const totalWidth = contentWidth(widthEm, emPx);
|
|
28426
|
-
const labelGap = LABEL_GAP_EM * emPx;
|
|
28427
|
-
// a variance bar starts at the outer edge of the thick axis
|
|
28428
|
-
const { extent: maxBarWidth, axisX } = splitSides(totalWidth, labels, (VARIANCE_AXIS_EM * emPx) / 2, labelGap);
|
|
28429
|
-
const breakGap = Math.min(BREAK_GAP_EM * emPx, maxBarWidth * 0.2);
|
|
28516
|
+
function barSide(maxBarWidth, breakGap) {
|
|
28430
28517
|
const overdriveZoneWidth = maxBarWidth * OVERDRIVE_FRACTION;
|
|
28431
28518
|
return {
|
|
28432
|
-
totalWidth,
|
|
28433
28519
|
maxBarWidth,
|
|
28434
|
-
axisX,
|
|
28435
28520
|
breakGap,
|
|
28436
28521
|
overdriveZoneWidth,
|
|
28437
28522
|
cutWidth: Math.max(0, maxBarWidth - breakGap - overdriveZoneWidth),
|
|
28523
|
+
};
|
|
28524
|
+
}
|
|
28525
|
+
/**
|
|
28526
|
+
* `sideMax` is the largest absolute value per side of the axis. With it, the bar room is
|
|
28527
|
+
* split so the uncut bar length of each side is in that ratio: the axis sits where the
|
|
28528
|
+
* values need it, at any scale. Without it, both sides get the same extent.
|
|
28529
|
+
*/
|
|
28530
|
+
function absoluteBarGeometry(widthEm, emPx, labels, sideMax) {
|
|
28531
|
+
var _a, _b;
|
|
28532
|
+
const totalWidth = contentWidth(widthEm, emPx);
|
|
28533
|
+
const labelGap = LABEL_GAP_EM * emPx;
|
|
28534
|
+
// a variance bar starts at the outer edge of the thick axis
|
|
28535
|
+
const { extent, axisX } = splitSides(totalWidth, labels, (VARIANCE_AXIS_EM * emPx) / 2, labelGap);
|
|
28536
|
+
const breakGap = Math.min(BREAK_GAP_EM * emPx, extent * 0.2);
|
|
28537
|
+
const hasNeg = labels.neg !== undefined;
|
|
28538
|
+
const hasPos = labels.pos !== undefined || !hasNeg;
|
|
28539
|
+
let neg = hasNeg ? extent : 0;
|
|
28540
|
+
const maxNeg = Math.max(0, (_a = sideMax === null || sideMax === void 0 ? void 0 : sideMax.neg) !== null && _a !== void 0 ? _a : 0);
|
|
28541
|
+
const maxPos = Math.max(0, (_b = sideMax === null || sideMax === void 0 ? void 0 : sideMax.pos) !== null && _b !== void 0 ? _b : 0);
|
|
28542
|
+
if (hasNeg && hasPos && maxNeg + maxPos > 0) {
|
|
28543
|
+
// every side keeps its break gap and overdrive stub, only the uncut length follows the values
|
|
28544
|
+
const uncut = 2 * extent * (1 - OVERDRIVE_FRACTION) - 2 * breakGap;
|
|
28545
|
+
neg = (breakGap + (uncut * maxNeg) / (maxNeg + maxPos)) / (1 - OVERDRIVE_FRACTION);
|
|
28546
|
+
}
|
|
28547
|
+
const pos = hasPos ? (hasNeg ? 2 * extent - neg : extent) : 0;
|
|
28548
|
+
return {
|
|
28549
|
+
totalWidth,
|
|
28550
|
+
neg: barSide(neg, breakGap),
|
|
28551
|
+
pos: barSide(pos, breakGap),
|
|
28552
|
+
axisX: hasNeg ? axisX - extent + neg : 0,
|
|
28438
28553
|
labelGap,
|
|
28439
28554
|
};
|
|
28440
28555
|
}
|
|
@@ -28541,9 +28656,10 @@ const PatternDefs = ({ styles }) => {
|
|
|
28541
28656
|
/** Longest relative label that keeps all percent digits; a longer one drops digits so its gutter does not eat the pins. */
|
|
28542
28657
|
const PIN_LABEL_CHARS = 7;
|
|
28543
28658
|
/**
|
|
28544
|
-
* Formats a
|
|
28659
|
+
* Formats a bar or pin label. An absolute value with `decimalDigits` prints like a number
|
|
28660
|
+
* cell, without them it takes an SI suffix.
|
|
28545
28661
|
*/
|
|
28546
|
-
function formatValue(value, isRelative, measureScale = 1, locale, percentDigits = 0, percentSign = true) {
|
|
28662
|
+
function formatValue(value, isRelative, measureScale = 1, locale, percentDigits = 0, percentSign = true, decimalDigits) {
|
|
28547
28663
|
// IBCS prints a value that rounds to zero without a sign
|
|
28548
28664
|
const signed = (text, zero) => (value > 0 && text !== zero ? "+" : "") + text;
|
|
28549
28665
|
if (isRelative) {
|
|
@@ -28561,6 +28677,10 @@ function formatValue(value, isRelative, measureScale = 1, locale, percentDigits
|
|
|
28561
28677
|
}
|
|
28562
28678
|
// Absolute variance - apply measure scale and use SI prefixes
|
|
28563
28679
|
const scaledValue = value / measureScale;
|
|
28680
|
+
if (decimalDigits !== undefined) {
|
|
28681
|
+
const number = (v) => Formatter.number(v, "decimal", decimalDigits, decimalDigits, 1, locale);
|
|
28682
|
+
return signed(number(scaledValue), number(0));
|
|
28683
|
+
}
|
|
28564
28684
|
const absValue = Math.abs(scaledValue);
|
|
28565
28685
|
let unit = 1;
|
|
28566
28686
|
let suffix = "";
|
|
@@ -28743,25 +28863,28 @@ function renderZigzagBreak(breakX, breakGap, yTop, barHeight, s) {
|
|
|
28743
28863
|
* exactly `columnWidthEm` em - see barColumnGeometry.ts.
|
|
28744
28864
|
*/
|
|
28745
28865
|
const AbsoluteVarianceBar = (props) => {
|
|
28746
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, columnWidthEm = 10, labelWidths, styles = DEFAULT_STYLES, } = props;
|
|
28866
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, locale, decimalDigits, columnWidthEm = 10, labelWidths, sideMax, styles = DEFAULT_STYLES, } = props;
|
|
28747
28867
|
const s = styles.scaleFactor;
|
|
28748
28868
|
const fs = styles.fontSize;
|
|
28749
|
-
const displayValue = formattedValue || formatValue(value, false, measureScale, locale);
|
|
28869
|
+
const displayValue = formattedValue || formatValue(value, false, measureScale, locale, 0, true, decimalDigits);
|
|
28750
28870
|
const sides = labelWidths !== null && labelWidths !== void 0 ? labelWidths : ownLabelWidths(columnStats, labelWidth(displayValue, fs, styles.fontFamily, false));
|
|
28751
|
-
const
|
|
28871
|
+
const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
|
|
28872
|
+
const { neg = Math.max(0, -columnStats.min), pos = Math.max(0, columnStats.max) } = sideMax !== null && sideMax !== void 0 ? sideMax : {};
|
|
28873
|
+
const geometry = absoluteBarGeometry(columnWidthEm, styles.emPx, sides, { neg, pos });
|
|
28874
|
+
const { totalWidth, axisX, labelGap } = geometry;
|
|
28875
|
+
const { breakGap, overdriveZoneWidth, cutWidth } = isPositive ? geometry.pos : geometry.neg;
|
|
28752
28876
|
// Direct unit scaling via fontSize
|
|
28753
28877
|
const scaledWidth = Math.abs(value) * styles.unitScaling * fs;
|
|
28754
28878
|
// auto scaling puts the largest bar on the cut, float rounding must not turn it into an overdrive bar
|
|
28755
28879
|
const isExtreme = scaledWidth - cutWidth > 1e-6;
|
|
28756
28880
|
// Compute proportional overdrive width across the column
|
|
28757
|
-
const maxScaledWidth =
|
|
28881
|
+
const maxScaledWidth = (isPositive ? pos : neg) * styles.unitScaling * fs;
|
|
28758
28882
|
const maxOverflow = Math.max(0, maxScaledWidth - cutWidth);
|
|
28759
28883
|
const overflowAmount = Math.max(0, scaledWidth - cutWidth);
|
|
28760
28884
|
const overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
|
|
28761
28885
|
const padding = 2 * s;
|
|
28762
28886
|
const barHeight = height - padding * 2;
|
|
28763
28887
|
const barY = padding;
|
|
28764
|
-
const isPositive = value > 0 || (value === 0 && zeroOnPositiveSide(sides));
|
|
28765
28888
|
// Get style based on column type (scenario vs variance)
|
|
28766
28889
|
const look = getVarianceLook(scenario, styles);
|
|
28767
28890
|
const sentimentStyle = getBarStyle(scenario, value, isPositiveGood, styles);
|
|
@@ -28869,7 +28992,7 @@ const CellBarChart = (props) => {
|
|
|
28869
28992
|
* guides marking their parent bar's extent.
|
|
28870
28993
|
*/
|
|
28871
28994
|
const WaterfallBar = (props) => {
|
|
28872
|
-
const { value, scenario, height, measureScale, locale, columnWidthEm = 10, styles = DEFAULT_STYLES, waterfall, } = props;
|
|
28995
|
+
const { value, scenario, height, measureScale, locale, decimalDigits, columnWidthEm = 10, styles = DEFAULT_STYLES, waterfall, } = props;
|
|
28873
28996
|
const s = styles.scaleFactor;
|
|
28874
28997
|
const fs = styles.fontSize;
|
|
28875
28998
|
const range = waterfall.max - waterfall.min;
|
|
@@ -28891,7 +29014,7 @@ const WaterfallBar = (props) => {
|
|
|
28891
29014
|
const fillValue = getBarFill(barStyle, getScenarioType(scenario));
|
|
28892
29015
|
const { stroke: barStroke, strokeWidth: barStrokeWidth } = getBarStroke(barStyle);
|
|
28893
29016
|
// Scenario values carry no variance sentiment - labels are unsigned per IBCS
|
|
28894
|
-
const displayValue = formatValue(value, waterfall.kind === "partof", measureScale, locale).replace(/^\+/, "");
|
|
29017
|
+
const displayValue = formatValue(value, waterfall.kind === "partof", measureScale, locale, 0, true, decimalDigits).replace(/^\+/, "");
|
|
28895
29018
|
const pointsLeft = endX < startX;
|
|
28896
29019
|
const labelX = pointsLeft ? barX - labelGap : barX + barWidth + labelGap;
|
|
28897
29020
|
const labelAnchor = pointsLeft ? "end" : "start";
|
|
@@ -29166,7 +29289,8 @@ class DataQuery {
|
|
|
29166
29289
|
/** Generates a GROUPHEAD row used as a visual header when row grouping is active. */
|
|
29167
29290
|
createGroupHeaderRow(rowGroupEntry, querys) {
|
|
29168
29291
|
// Generates GroupHeader Row
|
|
29169
|
-
|
|
29292
|
+
// Without a title the group sum row alone closes the group; only a list has no sum row and keeps the head as gap
|
|
29293
|
+
if (true === this.config.grouped && (this.config.showGroupTitle || !this.hasGroupSum())) {
|
|
29170
29294
|
const rowGroup = this.bind(String(rowGroupEntry.rowGroup));
|
|
29171
29295
|
const title = rowGroupEntry.rowGroup === "" ? this.bind(BLANK_BUCKET_LABEL) : rowGroup;
|
|
29172
29296
|
const groupTitle = this.config.showGroupTitle ? `,${title} as ${QueryColumnNames.CATEGORY}` : "";
|
|
@@ -29178,14 +29302,16 @@ class DataQuery {
|
|
|
29178
29302
|
GROUP BY '1'`);
|
|
29179
29303
|
}
|
|
29180
29304
|
}
|
|
29305
|
+
hasGroupSum() {
|
|
29306
|
+
return (TableType.SUM === this.config.type ||
|
|
29307
|
+
TableType.SUMNOTOTAL === this.config.type ||
|
|
29308
|
+
TableType.OPT === this.config.type ||
|
|
29309
|
+
TableType.OPTNOTOTAL === this.config.type);
|
|
29310
|
+
}
|
|
29181
29311
|
/** Generates a GROUP_SUM row that aggregates all entries within a single row group. */
|
|
29182
29312
|
createGroupSumRow(querys, groupSumQuery, rowGroupEntry, scenariosSUMQuery, queryWhereSection, order) {
|
|
29183
29313
|
// Generates SUM Row; sumsup all rows of group
|
|
29184
|
-
if (true === this.config.grouped &&
|
|
29185
|
-
(TableType.SUM === this.config.type ||
|
|
29186
|
-
TableType.SUMNOTOTAL === this.config.type ||
|
|
29187
|
-
TableType.OPT === this.config.type ||
|
|
29188
|
-
TableType.OPTNOTOTAL === this.config.type)) {
|
|
29314
|
+
if (true === this.config.grouped && this.hasGroupSum()) {
|
|
29189
29315
|
const rowGroup = this.bind(String(rowGroupEntry.rowGroup));
|
|
29190
29316
|
querys.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
29191
29317
|
'=' as ${QueryColumnNames.OPERATION},
|
|
@@ -29493,17 +29619,19 @@ class DataQuery {
|
|
|
29493
29619
|
const entryRowsRaw = exec(`SELECT ${groups.select()}, __interval ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
29494
29620
|
FROM ${bucketSource}
|
|
29495
29621
|
GROUP BY ${groups}, __interval`);
|
|
29622
|
+
// only the generated REST row has restRowGroup; a data row with the category REST keeps its own values
|
|
29623
|
+
const isGeneratedRest = (row) => row.type === "ENTRY" && row.restRowGroup != null;
|
|
29496
29624
|
// REST rows first: the math needs the raw (not yet finalized) entry aliases
|
|
29497
29625
|
if (this.config.limit > 0) {
|
|
29498
29626
|
for (let segmentIndex = 0; segmentIndex < res.length; segmentIndex++) {
|
|
29499
|
-
const restRow = res[segmentIndex].find(
|
|
29627
|
+
const restRow = res[segmentIndex].find(isGeneratedRest);
|
|
29500
29628
|
if (!restRow) {
|
|
29501
29629
|
continue;
|
|
29502
29630
|
}
|
|
29503
29631
|
// nearest preceding segment holding the displayed ENTRY rows
|
|
29504
29632
|
let entrySegment;
|
|
29505
29633
|
for (let i = segmentIndex - 1; i >= 0 && !entrySegment; i--) {
|
|
29506
|
-
const candidate = res[i].filter((row) => row.type === "ENTRY" && row
|
|
29634
|
+
const candidate = res[i].filter((row) => row.type === "ENTRY" && !isGeneratedRest(row));
|
|
29507
29635
|
if (candidate.length > 0) {
|
|
29508
29636
|
entrySegment = candidate;
|
|
29509
29637
|
}
|
|
@@ -29541,7 +29669,7 @@ class DataQuery {
|
|
|
29541
29669
|
finalizeBucketRow(entryRow);
|
|
29542
29670
|
for (const segment of res) {
|
|
29543
29671
|
for (const row of segment) {
|
|
29544
|
-
if (row.type !== "ENTRY" || row
|
|
29672
|
+
if (row.type !== "ENTRY" || isGeneratedRest(row) || row.category !== entryRow.category) {
|
|
29545
29673
|
continue;
|
|
29546
29674
|
}
|
|
29547
29675
|
if (this.config.grouped && row.rowGroup !== entryRow.rowGroup) {
|
|
@@ -29815,11 +29943,20 @@ class DataQuery {
|
|
|
29815
29943
|
}
|
|
29816
29944
|
});
|
|
29817
29945
|
this.sortSelect = [...sortKeys.values()].map((key) => `, ${key}`).join("");
|
|
29946
|
+
// a data row with the reserved category REST stays last in its group when the rows are sorted by value
|
|
29947
|
+
const sortsByValue = orderComponent.hierarchy.some((column) => {
|
|
29948
|
+
var _a;
|
|
29949
|
+
const kind = (_a = parseOrderToken(column)) === null || _a === void 0 ? void 0 : _a.kind;
|
|
29950
|
+
return kind === "scenario" || kind === "variance";
|
|
29951
|
+
});
|
|
29952
|
+
if (sortsByValue) {
|
|
29953
|
+
this.sortSelect += `, CASE WHEN ${QueryColumnNames.CATEGORY} = 'REST' THEN 1 ELSE 0 END as __sortrest`;
|
|
29954
|
+
}
|
|
29818
29955
|
// rows without a value sort last in both directions
|
|
29819
29956
|
const orderBy = (column, i, direction) => sortKeys.has(i) ? `__sortnull${i} asc, __sort${i} ${direction}` : `${column} ${direction}`;
|
|
29820
29957
|
const base = orderComponent.hierarchy.map((column, i) => orderBy(column, i, orderComponent.direction)).toString();
|
|
29821
29958
|
const inverted = orderComponent.hierarchy.map((column, i) => orderBy(column, i, inverse)).toString();
|
|
29822
|
-
return [base, inverted];
|
|
29959
|
+
return sortsByValue ? [`__sortrest asc, ${base}`, `__sortrest desc, ${inverted}`] : [base, inverted];
|
|
29823
29960
|
}
|
|
29824
29961
|
/**
|
|
29825
29962
|
* Sort key `__sort<i>` of a scenario or variance order token, as printed in an entry cell
|
|
@@ -30162,13 +30299,16 @@ function signedValue(row, column, tableType) {
|
|
|
30162
30299
|
* segmented query result once per column in display order.
|
|
30163
30300
|
*
|
|
30164
30301
|
* - ENTRY rows (incl. REST) cascade from the running total by their signed value.
|
|
30165
|
-
* - SUM / GROUP_SUM rows anchor at zero
|
|
30302
|
+
* - SUM / GROUP_SUM rows anchor at zero. A SUM row resets the running total to its
|
|
30303
|
+
* value, a GROUP_SUM row resets it to zero.
|
|
30166
30304
|
* - DRILLELEMENT (thereof) rows form a sub-cascade from their parent bar's start in
|
|
30167
30305
|
* the parent's direction; the running total is untouched.
|
|
30168
30306
|
* - PARTELEMENT (partof) rows cascade a `share * parent width` segment the same way.
|
|
30169
30307
|
* Note: the share denominator is the group sum (or SUM_TOTAL when ungrouped) per
|
|
30170
30308
|
* `createPartOfDrillRows`, not literally the parent row's value.
|
|
30171
|
-
* - GROUPHEAD
|
|
30309
|
+
* - GROUPHEAD rows get no bar and restart the running total at zero: every row group
|
|
30310
|
+
* is its own cascade that ends at its GROUP_SUM.
|
|
30311
|
+
* - NaN rows get no bar; a NaN parent orphans its drill children.
|
|
30172
30312
|
*
|
|
30173
30313
|
* @param queryData - Segmented result rows from DataQuery.execute().
|
|
30174
30314
|
* @param columns - Plain scenario column keys (ac1..pl4); no `##` composite keys.
|
|
@@ -30189,6 +30329,8 @@ function computeWaterfall(queryData, columns, tableType) {
|
|
|
30189
30329
|
for (const row of groupData) {
|
|
30190
30330
|
const type = row[QueryColumnNames.TYPE];
|
|
30191
30331
|
if (type === TableRowType.GROUPHEAD) {
|
|
30332
|
+
// a group sum only totals its own rows, so the cascade must not carry over
|
|
30333
|
+
running = 0;
|
|
30192
30334
|
lastParent = undefined;
|
|
30193
30335
|
continue;
|
|
30194
30336
|
}
|
|
@@ -30211,7 +30353,8 @@ function computeWaterfall(queryData, columns, tableType) {
|
|
|
30211
30353
|
emit(row, { start: 0, end: value, min: 0, max: 0, kind: "anchor" });
|
|
30212
30354
|
lastParent = { start: 0, end: value };
|
|
30213
30355
|
subCursor = 0;
|
|
30214
|
-
|
|
30356
|
+
// a group sum closes its group (there may be no GROUPHEAD row when the title is hidden)
|
|
30357
|
+
running = type === TableRowType.GROUPSUM ? 0 : value;
|
|
30215
30358
|
}
|
|
30216
30359
|
else if (type === TableRowType.DRILLELEMENT) {
|
|
30217
30360
|
if (value === null || lastParent === undefined) {
|
|
@@ -30266,7 +30409,7 @@ function computeWaterfall(queryData, columns, tableType) {
|
|
|
30266
30409
|
/**
|
|
30267
30410
|
* Transforms raw query results into structured TableRow collections for header and body.
|
|
30268
30411
|
*
|
|
30269
|
-
* Header normalization:
|
|
30412
|
+
* Header normalization: adds the fixed columns (operation, category) to the configured
|
|
30270
30413
|
* scenarios, then translates labels via i18n and adds separator rows for IBCS-style borders.
|
|
30271
30414
|
*
|
|
30272
30415
|
* Body row creation: iterates DataQuery results grouped by rowGroup, creates detail rows
|
|
@@ -30293,7 +30436,7 @@ class TableDataSetFactory {
|
|
|
30293
30436
|
}
|
|
30294
30437
|
return styleSlot(this.ruleSet.getScenarioColorIndex(type)) + type.slice(2);
|
|
30295
30438
|
}
|
|
30296
|
-
/** Effective column list (category/operation + attributes + scenarios × buckets), set by createHeader(). */
|
|
30439
|
+
/** Effective column list (category/operation + attributes + scenarios × buckets) in render order, set by createHeader(). */
|
|
30297
30440
|
getNormalizedHeader() {
|
|
30298
30441
|
return this.normalizedHeader;
|
|
30299
30442
|
}
|
|
@@ -30305,10 +30448,10 @@ class TableDataSetFactory {
|
|
|
30305
30448
|
* visualise grouping.
|
|
30306
30449
|
* finally a seperator header row is created for the header underlining (border)
|
|
30307
30450
|
*/
|
|
30308
|
-
createHeader(type, scenarios, i18n, measureScale, measureUnit, showMeasureScale, attributes = []) {
|
|
30451
|
+
createHeader(type, scenarios, i18n, measureScale, measureUnit, showMeasureScale, attributes = [], leadingScenarioColumns = 0) {
|
|
30309
30452
|
const header = [];
|
|
30310
30453
|
this.attributesByAlias = new Map(attributes.map((attribute) => [attribute.alias, attribute]));
|
|
30311
|
-
this.normalizedHeader = this.normalizeHeader(type, scenarios, attributes);
|
|
30454
|
+
this.normalizedHeader = this.normalizeHeader(type, scenarios, attributes, leadingScenarioColumns);
|
|
30312
30455
|
const hasIntervalColumns = this.normalizedHeader.some((column) => column.bucket !== undefined);
|
|
30313
30456
|
if (hasIntervalColumns) {
|
|
30314
30457
|
header.push(this.createIntervalBandRow());
|
|
@@ -30328,7 +30471,7 @@ class TableDataSetFactory {
|
|
|
30328
30471
|
}
|
|
30329
30472
|
/**
|
|
30330
30473
|
* Creates the spanning interval band row (e.g. `2023 | 2024 | 2025`) rendered
|
|
30331
|
-
* above the scenario label row.
|
|
30474
|
+
* above the scenario label row. Non-interval columns (category,
|
|
30332
30475
|
* operation, attributes) receive borderless filler cells; each run of
|
|
30333
30476
|
* consecutive columns of the same bucket is spanned by one label cell.
|
|
30334
30477
|
*/
|
|
@@ -30369,8 +30512,11 @@ class TableDataSetFactory {
|
|
|
30369
30512
|
* configured scenarios.
|
|
30370
30513
|
* depending of table type operation column is used (OPT) or not (SUM | LIST)
|
|
30371
30514
|
* in addition the headers are sorted based on the ruleset and duplicates are removed
|
|
30515
|
+
*
|
|
30516
|
+
* operation, category and the attribute columns are the row header block. It moves
|
|
30517
|
+
* as one unit: `leadingScenarioColumns` scenario columns stand left of it.
|
|
30372
30518
|
*/
|
|
30373
|
-
normalizeHeader(type, scenarios, attributes) {
|
|
30519
|
+
normalizeHeader(type, scenarios, attributes, leadingScenarioColumns = 0) {
|
|
30374
30520
|
let header = [
|
|
30375
30521
|
{
|
|
30376
30522
|
name: QueryColumnNames.CATEGORY,
|
|
@@ -30403,7 +30549,12 @@ class TableDataSetFactory {
|
|
|
30403
30549
|
order: undefined,
|
|
30404
30550
|
}));
|
|
30405
30551
|
// NOTE: scenarios are already sorted in setConfig
|
|
30406
|
-
return [
|
|
30552
|
+
return [
|
|
30553
|
+
...scenarios.slice(0, leadingScenarioColumns),
|
|
30554
|
+
...header,
|
|
30555
|
+
...attributeColumns,
|
|
30556
|
+
...scenarios.slice(leadingScenarioColumns),
|
|
30557
|
+
];
|
|
30407
30558
|
}
|
|
30408
30559
|
/**
|
|
30409
30560
|
* Creates table data colelction,
|
|
@@ -30939,7 +31090,9 @@ class Table {
|
|
|
30939
31090
|
update() {
|
|
30940
31091
|
this.prepareIntervalBuckets();
|
|
30941
31092
|
const normalizedScenarios = this.normalizeScenarios(this.config.scenarios, this.config.categoryThereOf, this.config.sortOrder, this.intervalBuckets);
|
|
30942
|
-
this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale, this.config.attributes
|
|
31093
|
+
this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale, this.config.attributes,
|
|
31094
|
+
// every interval group has one column per scenario
|
|
31095
|
+
Math.min(this.categoryIntervalPosition(), this.intervalBuckets.length) * this.config.scenarios.length);
|
|
30943
31096
|
this.bodyRows =
|
|
30944
31097
|
this.rowCount === 0 || !this.fromExpr
|
|
30945
31098
|
? []
|
|
@@ -30958,7 +31111,10 @@ class Table {
|
|
|
30958
31111
|
}
|
|
30959
31112
|
return this.bodyRows;
|
|
30960
31113
|
}
|
|
30961
|
-
/**
|
|
31114
|
+
/**
|
|
31115
|
+
* Effective column definitions in render order: category/operation + attributes + scenarios × interval buckets.
|
|
31116
|
+
* With `categoryIntervalPosition` the first interval buckets come before the category/operation column.
|
|
31117
|
+
*/
|
|
30962
31118
|
getColumns() {
|
|
30963
31119
|
if (this.state === FactoryState$1.DIRTY) {
|
|
30964
31120
|
this.update();
|
|
@@ -31059,6 +31215,32 @@ class Table {
|
|
|
31059
31215
|
const unknown = buckets.find((bucket) => !this.intervalBuckets.some((b) => b.key === bucket));
|
|
31060
31216
|
return unknown === undefined ? undefined : `order: setname '${unknown}' not found, the rows are not sorted by it.`;
|
|
31061
31217
|
}
|
|
31218
|
+
/** The configured `categoryIntervalPosition`; anything but a positive integer counts as 0. */
|
|
31219
|
+
categoryIntervalPosition() {
|
|
31220
|
+
const position = this.config.categoryIntervalPosition;
|
|
31221
|
+
return Number.isInteger(position) && position > 0 ? position : 0;
|
|
31222
|
+
}
|
|
31223
|
+
/** Warning for a `categoryIntervalPosition` that cannot apply, once the body was built; undefined when it applies. */
|
|
31224
|
+
categoryIntervalPositionWarning() {
|
|
31225
|
+
const position = this.categoryIntervalPosition();
|
|
31226
|
+
if (position <= 0 || this.hasNoData() || this.state !== FactoryState$1.UP_TO_DATE) {
|
|
31227
|
+
return undefined;
|
|
31228
|
+
}
|
|
31229
|
+
const groups = this.intervalBuckets.length;
|
|
31230
|
+
if (groups === 0) {
|
|
31231
|
+
return {
|
|
31232
|
+
id: "WARN_categoryIntervalPositionNoInterval",
|
|
31233
|
+
message: "categoryIntervalPosition: needs an active interval, the value is ignored.",
|
|
31234
|
+
};
|
|
31235
|
+
}
|
|
31236
|
+
if (position > groups) {
|
|
31237
|
+
return {
|
|
31238
|
+
id: "WARN_categoryIntervalPositionRange",
|
|
31239
|
+
message: `categoryIntervalPosition: '${position}' is greater than the number of interval groups, ${groups} is used.`,
|
|
31240
|
+
};
|
|
31241
|
+
}
|
|
31242
|
+
return undefined;
|
|
31243
|
+
}
|
|
31062
31244
|
/** True once the body was built and the grouped table has rows with a blank rowGroup. */
|
|
31063
31245
|
hasBlankRowGroup() {
|
|
31064
31246
|
return this.dataSetFactory.hasBlankRowGroup;
|
|
@@ -31118,6 +31300,8 @@ class TableComponentConfig {
|
|
|
31118
31300
|
this.barColumns = [];
|
|
31119
31301
|
/** Interval column grouping: "none", "setname" or a DateDistance value (see bn-table `interval` prop). */
|
|
31120
31302
|
this.interval = "none";
|
|
31303
|
+
/** Number of interval groups left of the row header block (see bn-table `categoryIntervalPosition` prop). */
|
|
31304
|
+
this.categoryIntervalPosition = 0;
|
|
31121
31305
|
/** Locale used for interval bucket labels. */
|
|
31122
31306
|
this.locale = "de";
|
|
31123
31307
|
}
|
|
@@ -31201,6 +31385,9 @@ class TableComponentConfigAdapter {
|
|
|
31201
31385
|
if (CompareUtil.isString(data.interval)) {
|
|
31202
31386
|
config.interval = data.interval;
|
|
31203
31387
|
}
|
|
31388
|
+
if (CompareUtil.isNumber(data.categoryIntervalPosition)) {
|
|
31389
|
+
config.categoryIntervalPosition = data.categoryIntervalPosition;
|
|
31390
|
+
}
|
|
31204
31391
|
if (CompareUtil.isString(data.locale)) {
|
|
31205
31392
|
config.locale = data.locale;
|
|
31206
31393
|
}
|
|
@@ -31323,6 +31510,8 @@ const BnTableRenderer = class {
|
|
|
31323
31510
|
this.barColumns = [];
|
|
31324
31511
|
/** @internal */
|
|
31325
31512
|
this.interval = "none";
|
|
31513
|
+
/** @internal */
|
|
31514
|
+
this.categoryIntervalPosition = 0;
|
|
31326
31515
|
/**
|
|
31327
31516
|
* Total width of a bar chart column, in em of the table font - the same unit
|
|
31328
31517
|
* `categoryWidth` uses, so the two render at the same width for the same value.
|
|
@@ -31477,13 +31666,15 @@ const BnTableRenderer = class {
|
|
|
31477
31666
|
: {})), cell.prefix != null ? (h("span", { class: cell.cssStyle + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
|
|
31478
31667
|
cell.columnStats &&
|
|
31479
31668
|
cell.value !== NOT_AVAILABLE &&
|
|
31480
|
-
|
|
31669
|
+
// an untitled group head is only a gap between list groups, a bar cell would print "-" in it
|
|
31670
|
+
(this.showGroupTitle || row.type !== TableRowType.HEADER) &&
|
|
31671
|
+
(cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (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: cell.measureScale, locale: locale, decimalDigits: barLabelDigits(cell, this.componentDataFormatDigits), columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles, waterfall: cell.waterfall })) : (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, styles: this.barChartStyles }))) : (cell.draw(this.componentDataFormatDigits, locale))));
|
|
31481
31672
|
})))))));
|
|
31482
31673
|
};
|
|
31483
31674
|
return h(Host, { class: { "no-data": ((_a = this.table) === null || _a === void 0 ? void 0 : _a.hasNoData()) === true } }, helper());
|
|
31484
31675
|
}
|
|
31485
31676
|
componentWillRender() {
|
|
31486
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
31677
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
31487
31678
|
if (!this.stores)
|
|
31488
31679
|
this.stores = getStores(this.element);
|
|
31489
31680
|
const db = this.stores.db.db;
|
|
@@ -31523,6 +31714,15 @@ const BnTableRenderer = class {
|
|
|
31523
31714
|
else {
|
|
31524
31715
|
(_h = this.errors) === null || _h === void 0 ? void 0 : _h.remove("WARN_orderBucket");
|
|
31525
31716
|
}
|
|
31717
|
+
const positionWarning = (_j = this.table) === null || _j === void 0 ? void 0 : _j.categoryIntervalPositionWarning();
|
|
31718
|
+
for (const id of ["WARN_categoryIntervalPositionNoInterval", "WARN_categoryIntervalPositionRange"]) {
|
|
31719
|
+
if ((positionWarning === null || positionWarning === void 0 ? void 0 : positionWarning.id) === id) {
|
|
31720
|
+
(_k = this.errors) === null || _k === void 0 ? void 0 : _k.addOrReplace({ id, type: "warning", message: positionWarning.message });
|
|
31721
|
+
}
|
|
31722
|
+
else {
|
|
31723
|
+
(_l = this.errors) === null || _l === void 0 ? void 0 : _l.remove(id);
|
|
31724
|
+
}
|
|
31725
|
+
}
|
|
31526
31726
|
this.barColumnLayouts = this.collectBarColumnLayouts();
|
|
31527
31727
|
this.barChartStyles = this.prepareBarChartStyles();
|
|
31528
31728
|
}
|
|
@@ -31555,6 +31755,7 @@ const BnTableRenderer = class {
|
|
|
31555
31755
|
filter: this.filter,
|
|
31556
31756
|
barColumns: this.barColumns,
|
|
31557
31757
|
interval: this.interval,
|
|
31758
|
+
categoryIntervalPosition: this.categoryIntervalPosition,
|
|
31558
31759
|
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",
|
|
31559
31760
|
});
|
|
31560
31761
|
return config;
|
|
@@ -31653,14 +31854,21 @@ const BnTableRenderer = class {
|
|
|
31653
31854
|
* One scaling for all columns, so it is the smallest that fits every column.
|
|
31654
31855
|
*/
|
|
31655
31856
|
autoUnitScaling() {
|
|
31857
|
+
var _a;
|
|
31656
31858
|
const emPx = this.emPx();
|
|
31657
31859
|
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
31658
31860
|
let scaling = Infinity;
|
|
31659
|
-
for (const { isRelative, absMax, labels } of this.barColumnLayouts.values()) {
|
|
31861
|
+
for (const { isRelative, absMax, labels, sideMax } of this.barColumnLayouts.values()) {
|
|
31660
31862
|
if (isRelative || absMax <= 0)
|
|
31661
31863
|
continue;
|
|
31662
|
-
const
|
|
31663
|
-
|
|
31864
|
+
const geometry = absoluteBarGeometry(this.barColumnMaxWidth, emPx, labels, sideMax);
|
|
31865
|
+
for (const side of ["neg", "pos"]) {
|
|
31866
|
+
const max = (_a = sideMax[side]) !== null && _a !== void 0 ? _a : 0;
|
|
31867
|
+
if (max <= 0)
|
|
31868
|
+
continue;
|
|
31869
|
+
const { maxBarWidth, cutWidth } = geometry[side];
|
|
31870
|
+
scaling = Math.min(scaling, Math.min(maxBarWidth * 0.8, cutWidth) / (max * fs));
|
|
31871
|
+
}
|
|
31664
31872
|
}
|
|
31665
31873
|
return Number.isFinite(scaling) && fs > 0 ? scaling : 0.01;
|
|
31666
31874
|
}
|
|
@@ -31725,7 +31933,7 @@ const BnTableRenderer = class {
|
|
|
31725
31933
|
for (const cell of cells) {
|
|
31726
31934
|
const value = cell.value;
|
|
31727
31935
|
const side = value > 0 || (value === 0 && zeroPositive) ? "pos" : "neg";
|
|
31728
|
-
const text = formatValue(value, isRelative, barLabelMeasureScale(cell), locale, percentDigits, percentSign);
|
|
31936
|
+
const text = formatValue(value, isRelative, barLabelMeasureScale(cell), locale, percentDigits, percentSign, barLabelDigits(cell, this.componentDataFormatDigits));
|
|
31729
31937
|
labels[side] = Math.max((_a = labels[side]) !== null && _a !== void 0 ? _a : 0, labelWidth(text, fs, fontFamily, isRelative));
|
|
31730
31938
|
}
|
|
31731
31939
|
return labels;
|
|
@@ -31758,6 +31966,12 @@ const BnTableRenderer = class {
|
|
|
31758
31966
|
function barLabelMeasureScale(cell) {
|
|
31759
31967
|
return cell.type === "percentpoint" ? 0.01 : cell.measureScale;
|
|
31760
31968
|
}
|
|
31969
|
+
/** Fraction digits of the number cells of the column, so an absolute bar label prints like them. */
|
|
31970
|
+
function barLabelDigits(cell, digits) {
|
|
31971
|
+
if (cell.type === "percentpoint")
|
|
31972
|
+
return digits.percent;
|
|
31973
|
+
return cell.type === "decimal" ? digits.decimal : undefined;
|
|
31974
|
+
}
|
|
31761
31975
|
BnTableRenderer.style = bnTableRendererCss();
|
|
31762
31976
|
|
|
31763
31977
|
const bnTitleCss = () => `:host{padding:0.5em;margin-bottom:0.5em;box-sizing:border-box;-webkit-box-sizing:border-box;width:100%;display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}`;
|