@bino-bi/bn-template-engine 1.0.0-next.63 → 1.0.0-next.64
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-7b74696e.entry.js → p-07c55f50.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +24 -6
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +3 -2
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +22 -5
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/{p-C3-kXJUZ.js → p-B8-9TksQ.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +24 -6
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +1 -0
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
|
@@ -20741,6 +20741,7 @@ const Chart = class {
|
|
|
20741
20741
|
* when a forecast is in its value and outlined for a plan.
|
|
20742
20742
|
* - `dataset` - name of a dataset with one row per total (`date` and the
|
|
20743
20743
|
* scenario columns). The chart takes the values from it and computes none.
|
|
20744
|
+
* With `average` or `last` the values of a row are one column.
|
|
20744
20745
|
* - `label` - text under the column of `by: all`. The other columns take the name of their period.
|
|
20745
20746
|
* - `width` - width in widths of a period column, default 1.
|
|
20746
20747
|
*
|
|
@@ -21663,7 +21664,7 @@ const Chart = class {
|
|
|
21663
21664
|
this.errors.remove("WARN_scenarios_none");
|
|
21664
21665
|
}
|
|
21665
21666
|
const fontStyles = this.getFontStyles();
|
|
21666
|
-
return (h(Host, { key: '
|
|
21667
|
+
return (h(Host, { key: 'baa11d12a8dc2e01a487b02bcd68902890ceb85a', style: fontStyles }, h("div", { key: '40a33368366a59709c8a6c0354a6aca50445778f', class: "container" }, segments.map(this.chartTemplate))));
|
|
21667
21668
|
}
|
|
21668
21669
|
get element() { return getElement(this); }
|
|
21669
21670
|
static get watchers() { return {
|
|
@@ -24909,13 +24910,15 @@ class TimeChart {
|
|
|
24909
24910
|
return runs;
|
|
24910
24911
|
}
|
|
24911
24912
|
/** The start of the group of a date, null for one group over all periods. */
|
|
24912
|
-
totalGroupStart(date) {
|
|
24913
|
+
totalGroupStart(date, period = false) {
|
|
24913
24914
|
var _a, _b;
|
|
24914
24915
|
const by = (_b = (_a = this.totals) === null || _a === void 0 ? void 0 : _a.by) !== null && _b !== void 0 ? _b : "all";
|
|
24915
24916
|
if (by === "all" || date == null || !date.isValid) {
|
|
24916
24917
|
return null;
|
|
24917
24918
|
}
|
|
24918
|
-
|
|
24919
|
+
// a week belongs to the year, quarter or month of its Thursday, as its number does
|
|
24920
|
+
const day = period && this.dateInterval === DateDistance.WEEK && by !== "week" ? date.plus({ days: 3 }) : date;
|
|
24921
|
+
return day.startOf(by);
|
|
24919
24922
|
}
|
|
24920
24923
|
/** The name of a total column under the axis: the text of the config at the end, else the name of its period. */
|
|
24921
24924
|
totalLabel(start) {
|
|
@@ -25030,7 +25033,7 @@ class TimeChart {
|
|
|
25030
25033
|
// the groups: runs of periods with the same start
|
|
25031
25034
|
const groups = [];
|
|
25032
25035
|
this.dataModel.forEach((row, index) => {
|
|
25033
|
-
const start = this.totalGroupStart(row.date);
|
|
25036
|
+
const start = this.totalGroupStart(row.date, true);
|
|
25034
25037
|
const last = groups[groups.length - 1];
|
|
25035
25038
|
if (last != null && (start == null || (last.start != null && +last.start === +start))) {
|
|
25036
25039
|
last.to = index;
|
|
@@ -25049,6 +25052,7 @@ class TimeChart {
|
|
|
25049
25052
|
let parts = [];
|
|
25050
25053
|
let reference = null;
|
|
25051
25054
|
let counted = [];
|
|
25055
|
+
let scenarios;
|
|
25052
25056
|
if (fromData != null) {
|
|
25053
25057
|
// the values as the dataset gives them: one part per scenario of the series
|
|
25054
25058
|
const data = (_c = fromData.get(group.start ? ((_b = group.start.toISODate()) !== null && _b !== void 0 ? _b : "") : "")) !== null && _c !== void 0 ? _c : {};
|
|
@@ -25062,6 +25066,13 @@ class TimeChart {
|
|
|
25062
25066
|
if (referenceScenario != null && Number.isFinite(data[referenceScenario])) {
|
|
25063
25067
|
reference = { scenario: referenceScenario, value: data[referenceScenario] };
|
|
25064
25068
|
}
|
|
25069
|
+
scenarios = parts.map((part) => part.scenario);
|
|
25070
|
+
if (this.totals.aggregation !== "sum" && parts.length > 1 && parts.every((part) => part.value > 0)) {
|
|
25071
|
+
// an average or a last value is one column: the dataset gives the value, not its parts
|
|
25072
|
+
parts = [
|
|
25073
|
+
{ scenario: this.mixedScenario(scenarios), value: parts.reduce((sum, part) => sum + part.value, 0) },
|
|
25074
|
+
];
|
|
25075
|
+
}
|
|
25065
25076
|
}
|
|
25066
25077
|
else {
|
|
25067
25078
|
// the periods where the series has a value. The reference counts in the same periods only,
|
|
@@ -25072,6 +25083,7 @@ class TimeChart {
|
|
|
25072
25083
|
return slot != null && Number.isFinite((_a = row[slot]) === null || _a === void 0 ? void 0 : _a.value);
|
|
25073
25084
|
});
|
|
25074
25085
|
counted = used.map((row) => this.dataModel.indexOf(row));
|
|
25086
|
+
scenarios = [...new Set(used.map((row) => row[this.visibleSlot(row, followers)].scenario))];
|
|
25075
25087
|
const visible = used.map((row) => row[this.visibleSlot(row, followers)]);
|
|
25076
25088
|
// with `last` the one period that gives the value counts. A reference with a gap in
|
|
25077
25089
|
// the counted periods is no reference: half a sum would stand against a full one.
|
|
@@ -25117,7 +25129,7 @@ class TimeChart {
|
|
|
25117
25129
|
return [];
|
|
25118
25130
|
}
|
|
25119
25131
|
const total = parts.reduce((sum, part) => sum + part.value, 0);
|
|
25120
|
-
columns.push(Object.assign(Object.assign({}, group), { label: this.totalLabel(group.start), parts, total, reference, counted }));
|
|
25132
|
+
columns.push(Object.assign(Object.assign({}, group), { label: this.totalLabel(group.start), parts, total, reference, counted, scenarios }));
|
|
25121
25133
|
}
|
|
25122
25134
|
return columns;
|
|
25123
25135
|
}
|
|
@@ -25161,7 +25173,13 @@ class TimeChart {
|
|
|
25161
25173
|
base = 0;
|
|
25162
25174
|
const data = (_b = fromData.get(column.start ? ((_a = column.start.toISODate()) !== null && _a !== void 0 ? _a : "") : "")) !== null && _b !== void 0 ? _b : {};
|
|
25163
25175
|
// the bases of the row are the scenarios of the series, each counts once
|
|
25164
|
-
|
|
25176
|
+
const bases = new Set(candidates.map((entry) => entry.variance.base));
|
|
25177
|
+
// a row for a part of the series only has no total: the reference of the dataset is the one of the whole total
|
|
25178
|
+
const covered = column.scenarios.filter((scenario) => bases.has(scenario)).length;
|
|
25179
|
+
if (covered > 0 && covered < column.scenarios.length) {
|
|
25180
|
+
return null;
|
|
25181
|
+
}
|
|
25182
|
+
for (const name of bases) {
|
|
25165
25183
|
// a 0 is a scenario without a value in this total, as for the parts
|
|
25166
25184
|
if (Number.isFinite(data[name]) && data[name] !== 0) {
|
|
25167
25185
|
base += data[name];
|
|
@@ -356,6 +356,7 @@ export declare class Chart {
|
|
|
356
356
|
* when a forecast is in its value and outlined for a plan.
|
|
357
357
|
* - `dataset` - name of a dataset with one row per total (`date` and the
|
|
358
358
|
* scenario columns). The chart takes the values from it and computes none.
|
|
359
|
+
* With `average` or `last` the values of a row are one column.
|
|
359
360
|
* - `label` - text under the column of `by: all`. The other columns take the name of their period.
|
|
360
361
|
* - `width` - width in widths of a period column, default 1.
|
|
361
362
|
*
|
|
@@ -1122,7 +1122,7 @@ export namespace Components {
|
|
|
1122
1122
|
*/
|
|
1123
1123
|
"syncSpaceLeft": number;
|
|
1124
1124
|
/**
|
|
1125
|
-
* Total columns at their own scale, as JSON: `{"by":"all","aggregation":"sum","unitScaling":280,"label":"2025","width":1.6}`. - `unitScaling` - data units per em of column height, like `unit-scaling`. Required. - `by` - what a total covers. `all` (default): one column right of the last period for all periods. `year`, `quarter`, `month`, `week`: one column behind the periods of each of them, on the axis. - `aggregation` - `sum` (default), `average` or `last`. With `sum` a column stacks one part per scenario of the series: the first scenario, and with `scenario-switch` the ones that follow it. Else it is one column, hatched when a forecast is in its value and outlined for a plan. - `dataset` - name of a dataset with one row per total (`date` and the scenario columns). The chart takes the values from it and computes none. - `label` - text under the column of `by: all`. The other columns take the name of their period. - `width` - width in widths of a period column, default 1. The first other scenario is the reference behind a column. Each variance row gets the variance of each total at the scale of the row. With `scaling-indicator` a column has its own band, and with `by: all` a line links it to the band of the periods. Plain columns only: not with `stack` and not in line mode. The chart needs a fixed `unit-scaling`, and every part of a total must be positive.
|
|
1125
|
+
* Total columns at their own scale, as JSON: `{"by":"all","aggregation":"sum","unitScaling":280,"label":"2025","width":1.6}`. - `unitScaling` - data units per em of column height, like `unit-scaling`. Required. - `by` - what a total covers. `all` (default): one column right of the last period for all periods. `year`, `quarter`, `month`, `week`: one column behind the periods of each of them, on the axis. - `aggregation` - `sum` (default), `average` or `last`. With `sum` a column stacks one part per scenario of the series: the first scenario, and with `scenario-switch` the ones that follow it. Else it is one column, hatched when a forecast is in its value and outlined for a plan. - `dataset` - name of a dataset with one row per total (`date` and the scenario columns). The chart takes the values from it and computes none. With `average` or `last` the values of a row are one column. - `label` - text under the column of `by: all`. The other columns take the name of their period. - `width` - width in widths of a period column, default 1. The first other scenario is the reference behind a column. Each variance row gets the variance of each total at the scale of the row. With `scaling-indicator` a column has its own band, and with `by: all` a line links it to the band of the periods. Plain columns only: not with `stack` and not in line mode. The chart needs a fixed `unit-scaling`, and every part of a total must be positive.
|
|
1126
1126
|
* @default ""
|
|
1127
1127
|
*/
|
|
1128
1128
|
"totals": string;
|
|
@@ -3514,7 +3514,7 @@ declare namespace LocalJSX {
|
|
|
3514
3514
|
*/
|
|
3515
3515
|
"syncSpaceLeft"?: number;
|
|
3516
3516
|
/**
|
|
3517
|
-
* Total columns at their own scale, as JSON: `{"by":"all","aggregation":"sum","unitScaling":280,"label":"2025","width":1.6}`. - `unitScaling` - data units per em of column height, like `unit-scaling`. Required. - `by` - what a total covers. `all` (default): one column right of the last period for all periods. `year`, `quarter`, `month`, `week`: one column behind the periods of each of them, on the axis. - `aggregation` - `sum` (default), `average` or `last`. With `sum` a column stacks one part per scenario of the series: the first scenario, and with `scenario-switch` the ones that follow it. Else it is one column, hatched when a forecast is in its value and outlined for a plan. - `dataset` - name of a dataset with one row per total (`date` and the scenario columns). The chart takes the values from it and computes none. - `label` - text under the column of `by: all`. The other columns take the name of their period. - `width` - width in widths of a period column, default 1. The first other scenario is the reference behind a column. Each variance row gets the variance of each total at the scale of the row. With `scaling-indicator` a column has its own band, and with `by: all` a line links it to the band of the periods. Plain columns only: not with `stack` and not in line mode. The chart needs a fixed `unit-scaling`, and every part of a total must be positive.
|
|
3517
|
+
* Total columns at their own scale, as JSON: `{"by":"all","aggregation":"sum","unitScaling":280,"label":"2025","width":1.6}`. - `unitScaling` - data units per em of column height, like `unit-scaling`. Required. - `by` - what a total covers. `all` (default): one column right of the last period for all periods. `year`, `quarter`, `month`, `week`: one column behind the periods of each of them, on the axis. - `aggregation` - `sum` (default), `average` or `last`. With `sum` a column stacks one part per scenario of the series: the first scenario, and with `scenario-switch` the ones that follow it. Else it is one column, hatched when a forecast is in its value and outlined for a plan. - `dataset` - name of a dataset with one row per total (`date` and the scenario columns). The chart takes the values from it and computes none. With `average` or `last` the values of a row are one column. - `label` - text under the column of `by: all`. The other columns take the name of their period. - `width` - width in widths of a period column, default 1. The first other scenario is the reference behind a column. Each variance row gets the variance of each total at the scale of the row. With `scaling-indicator` a column has its own band, and with `by: all` a line links it to the band of the periods. Plain columns only: not with `stack` and not in line mode. The chart needs a fixed `unit-scaling`, and every part of a total must be positive.
|
|
3518
3518
|
* @default ""
|
|
3519
3519
|
*/
|
|
3520
3520
|
"totals"?: string;
|
package/package.json
CHANGED