@bino-bi/bn-template-engine 1.0.0-next.64 → 1.0.0-next.66
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-07c55f50.entry.js → p-a794c6ea.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +33 -20
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +33 -20
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/{p-B8-9TksQ.js → p-isJcvi4q.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +33 -20
- package/package.json +1 -1
|
@@ -24957,7 +24957,7 @@ class TimeChart {
|
|
|
24957
24957
|
}
|
|
24958
24958
|
/** The rows of the totals dataset, one per group, with the scenario columns added up. */
|
|
24959
24959
|
totalDatasetRows() {
|
|
24960
|
-
var _a, _b, _c, _d;
|
|
24960
|
+
var _a, _b, _c, _d, _e;
|
|
24961
24961
|
const name = (_a = this.totals) === null || _a === void 0 ? void 0 : _a.dataset;
|
|
24962
24962
|
if (!name) {
|
|
24963
24963
|
return null;
|
|
@@ -24975,18 +24975,22 @@ class TimeChart {
|
|
|
24975
24975
|
this.failQuery(e);
|
|
24976
24976
|
return rows;
|
|
24977
24977
|
}
|
|
24978
|
+
const periods = new Set(this.dataModel.map((row) => { var _a, _b, _c; return (_c = (_b = (_a = row.date) === null || _a === void 0 ? void 0 : _a.toISODate) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : ""; }));
|
|
24978
24979
|
for (const row of result) {
|
|
24979
24980
|
const date = TimeChart.parseDate(row.date);
|
|
24980
|
-
|
|
24981
|
-
|
|
24981
|
+
// a row with the date of a period of the chart belongs to the total of that period: a week can
|
|
24982
|
+
// count into another year than its first day
|
|
24983
|
+
const isPeriod = date != null && periods.has((_b = date.toISODate()) !== null && _b !== void 0 ? _b : "");
|
|
24984
|
+
const start = date ? this.totalGroupStart(date, isPeriod) : null;
|
|
24985
|
+
const key = start ? ((_c = start.toISODate()) !== null && _c !== void 0 ? _c : "") : "";
|
|
24982
24986
|
if (this.totals.by !== "all" && key === "")
|
|
24983
24987
|
continue;
|
|
24984
|
-
const sums = (
|
|
24988
|
+
const sums = (_d = rows.get(key)) !== null && _d !== void 0 ? _d : {};
|
|
24985
24989
|
for (const [column, raw] of Object.entries(row)) {
|
|
24986
24990
|
// a value can come as a text, like in the dataset of the chart
|
|
24987
24991
|
const value = typeof raw === "string" && raw.trim() !== "" ? Number(raw) : raw;
|
|
24988
24992
|
if (column !== "date" && typeof value === "number" && Number.isFinite(value)) {
|
|
24989
|
-
sums[column] = ((
|
|
24993
|
+
sums[column] = ((_e = sums[column]) !== null && _e !== void 0 ? _e : 0) + value;
|
|
24990
24994
|
}
|
|
24991
24995
|
}
|
|
24992
24996
|
rows.set(key, sums);
|
|
@@ -25170,26 +25174,35 @@ class TimeChart {
|
|
|
25170
25174
|
let delta;
|
|
25171
25175
|
const notations = new Set();
|
|
25172
25176
|
if (fromData != null) {
|
|
25173
|
-
base = 0;
|
|
25174
25177
|
const data = (_b = fromData.get(column.start ? ((_a = column.start.toISODate()) !== null && _a !== void 0 ? _a : "") : "")) !== null && _b !== void 0 ? _b : {};
|
|
25175
|
-
// the
|
|
25176
|
-
|
|
25177
|
-
|
|
25178
|
-
const
|
|
25179
|
-
|
|
25178
|
+
// the scenarios of the series can stand on either side of a variance: that side is
|
|
25179
|
+
// added up, each scenario once, the other side is the one reference of the row
|
|
25180
|
+
const series = new Set(column.scenarios);
|
|
25181
|
+
const bases = [...new Set(candidates.map((entry) => entry.variance.base))];
|
|
25182
|
+
const deltas = [...new Set(candidates.map((entry) => entry.variance.delta))];
|
|
25183
|
+
// a total needs the whole series on one side and none of it on the other: a row for a part
|
|
25184
|
+
// of the series, or one that sets parts of the series against each other, has no total
|
|
25185
|
+
const inBases = bases.filter((name) => series.has(name)).length;
|
|
25186
|
+
const inDeltas = deltas.filter((name) => series.has(name)).length;
|
|
25187
|
+
if ((inBases > 0 && inDeltas > 0) || (inBases + inDeltas > 0 && inBases + inDeltas < series.size)) {
|
|
25180
25188
|
return null;
|
|
25181
25189
|
}
|
|
25182
|
-
|
|
25183
|
-
|
|
25184
|
-
|
|
25185
|
-
|
|
25186
|
-
|
|
25187
|
-
|
|
25188
|
-
|
|
25189
|
-
|
|
25190
|
+
// a 0 is a scenario without a value in this total, as for the parts
|
|
25191
|
+
const has = (name) => Number.isFinite(data[name]) && data[name] !== 0;
|
|
25192
|
+
const side = (names) => {
|
|
25193
|
+
// of the side with the series only the series counts, of the other side the first name
|
|
25194
|
+
const ofSeries = names.filter((name) => series.has(name));
|
|
25195
|
+
const used = (ofSeries.length > 0 ? ofSeries : names.slice(0, 1)).filter(has);
|
|
25196
|
+
return used.length > 0 ? used.reduce((sum, name) => sum + data[name], 0) : null;
|
|
25197
|
+
};
|
|
25198
|
+
const baseSide = side(bases);
|
|
25199
|
+
const deltaSide = side(deltas);
|
|
25200
|
+
if (baseSide == null || deltaSide == null) {
|
|
25190
25201
|
return null;
|
|
25191
25202
|
}
|
|
25192
|
-
|
|
25203
|
+
base = baseSide;
|
|
25204
|
+
delta = deltaSide;
|
|
25205
|
+
bases.filter(has).forEach((name) => notations.add(name.slice(0, 2)));
|
|
25193
25206
|
}
|
|
25194
25207
|
else {
|
|
25195
25208
|
// the same periods as the column, so the two tell the same: with `last` the one
|
package/package.json
CHANGED