@bino-bi/bn-template-engine 1.0.0-alpha.14 → 1.0.0-alpha.16
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-637e3b8f.entry.js → p-19f49fbc.entry.js} +1 -1
- package/dist/bn-template-engine/{p-67eae33e.entry.js → p-3465fcdc.entry.js} +1 -1
- package/dist/bn-template-engine/{p-82023539.entry.js → p-67746414.entry.js} +1 -1
- package/dist/bn-template-engine/p-86ca2d5e.entry.js +1 -0
- package/dist/bn-template-engine/p-BPDZcex5.js +1 -0
- package/dist/bn-template-engine/{p-DHheVOfP.js → p-Tx6omDWp.js} +1 -1
- package/dist/bn-template-engine/{p-52097456.entry.js → p-d724ab88.entry.js} +1 -1
- package/dist/bn-template-engine/p-efd3b67a.entry.js +1 -0
- package/dist/bn-template-engine/{p-46699464.entry.js → p-ff659485.entry.js} +1 -1
- package/dist/bn-template-engine/p-z9bPNFYF.js +1 -0
- package/dist/cjs/bn-asset_21.cjs.entry.js +336 -75
- package/dist/cjs/bn-grid.cjs.entry.js +2 -2
- package/dist/cjs/bn-image.cjs.entry.js +2 -2
- package/dist/cjs/bn-internationalization.cjs.entry.js +1 -1
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +3 -3
- package/dist/cjs/bn-tree.cjs.entry.js +2 -2
- package/dist/cjs/{context-protocol-Op7uUwN3.js → context-protocol-Cn5PL928.js} +14 -0
- package/dist/cjs/editor-companion.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-57N4Cxb_.js → scaling-DM2UILdF.js} +58 -17
- package/dist/cjs/{withStyled-C2kmGAK3.js → withStyled-Dx3uRw9g.js} +72 -1
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +28 -10
- package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +46 -4
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +39 -1
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +40 -10
- package/dist/collection/components/bn-dataset/bn-dataset.js +15 -8
- package/dist/collection/components/bn-datasource/bn-datasource.js +15 -8
- package/dist/collection/components/bn-layout-card/bn-layout-card.css +5 -0
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +25 -5
- package/dist/collection/components/bn-layout-page/bn-layout-page.css +5 -0
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +25 -5
- package/dist/collection/components/bn-table/bn-table.js +75 -7
- package/dist/collection/components/bn-table/ibcs-table.js +27 -0
- package/dist/collection/components/bn-table/utils/Table.js +2 -2
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +28 -5
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +46 -6
- package/dist/collection/components/bn-table/utils/model/TableAttribute.js +46 -0
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +5 -0
- package/dist/collection/context/scopedDb.js +14 -0
- package/dist/collection/utils/parentDimensions.js +57 -16
- package/dist/collection/utils/validate.js +23 -0
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/Order.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-dataset.js +1 -1
- package/dist/components/bn-datasource.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-table.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/ibcs-title2.js +1 -1
- package/dist/components/scaling.js +1 -1
- package/dist/components/validate.js +1 -1
- package/dist/esm/bn-asset_21.entry.js +336 -75
- package/dist/esm/bn-grid.entry.js +2 -2
- package/dist/esm/bn-image.entry.js +2 -2
- package/dist/esm/bn-internationalization.entry.js +1 -1
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +3 -3
- package/dist/esm/bn-tree.entry.js +2 -2
- package/dist/esm/{context-protocol-BDhzNbeD.js → context-protocol-BB-4Onmw.js} +14 -0
- package/dist/esm/editor-companion.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{scaling-La1Ow72h.js → scaling-h4KcBet3.js} +58 -17
- package/dist/esm/{withStyled-Bl9cSoRW.js → withStyled-BBvU2f-A.js} +71 -2
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +4 -0
- package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +16 -1
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +13 -0
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +4 -0
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +8 -3
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +8 -3
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +7 -0
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +7 -0
- package/dist/types/components/bn-table/bn-table.d.ts +13 -0
- package/dist/types/components/bn-table/ibcs-table.d.ts +2 -0
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +3 -1
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +11 -0
- package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +22 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +3 -0
- package/dist/types/components.d.ts +39 -0
- package/dist/types/utils/validate.d.ts +6 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-6b3c47b3.entry.js +0 -1
- package/dist/bn-template-engine/p-BVFHvEXF.js +0 -1
- package/dist/bn-template-engine/p-CQnZV3JG.js +0 -1
- package/dist/bn-template-engine/p-ab3ea8cf.entry.js +0 -1
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export class ElementPositions {
|
|
17
17
|
// private smallestDataPoint: DataPoint;
|
|
18
|
-
constructor(padding, scaleFactors, fontSize, numberOfColumns, leftSideLengthSync, titleLength, leftSideWidth, categoryWidth) {
|
|
18
|
+
constructor(padding, scaleFactors, fontSize, numberOfColumns, leftSideLengthSync, titleLength, leftSideWidth, categoryWidth, hasStackedHeaders = false) {
|
|
19
19
|
this.categoryPosition = { x: 0, y: 0 };
|
|
20
20
|
this.spacings = {
|
|
21
21
|
scenarioOffset: 0,
|
|
@@ -45,6 +45,7 @@ export class ElementPositions {
|
|
|
45
45
|
this.numberOfColumns = numberOfColumns;
|
|
46
46
|
this.leftSideLengthSync = leftSideLengthSync;
|
|
47
47
|
this.topSideLabelHeight = titleLength > 0 ? this.fontSize : 0;
|
|
48
|
+
this.hasStackedHeaders = hasStackedHeaders;
|
|
48
49
|
this.leftSideLabelLength = this.calculateSideLabelLength(titleLength, leftSideWidth, categoryWidth);
|
|
49
50
|
this.calculateSpacings();
|
|
50
51
|
this.calculateCategoryPosition();
|
|
@@ -73,7 +74,10 @@ export class ElementPositions {
|
|
|
73
74
|
return this.axisPosition.x;
|
|
74
75
|
}
|
|
75
76
|
getAxisTitlePositionY() {
|
|
76
|
-
return this.axisPosition.y - this.spacings.labelToAxis;
|
|
77
|
+
return this.axisPosition.y - this.spacings.labelToAxis - this.getTopLabelOverhang();
|
|
78
|
+
}
|
|
79
|
+
getStackedHeaderPositionY() {
|
|
80
|
+
return this.getBarCenterPositionY(0) - this.spacings.barWidth * 0.5 - this.spacings.scenarioLabelToBar;
|
|
77
81
|
}
|
|
78
82
|
getNeedleWidth() {
|
|
79
83
|
return this.spacings.needleWidth;
|
|
@@ -129,7 +133,12 @@ export class ElementPositions {
|
|
|
129
133
|
}
|
|
130
134
|
getScenarioLabelPositionOffsetY(isPrimaryBar) {
|
|
131
135
|
if (isPrimaryBar) {
|
|
132
|
-
|
|
136
|
+
// The label belongs to the last bar, but the axis line runs past that bar's
|
|
137
|
+
// center by (categoryWidth - scenarioOffset); place the label below the axis
|
|
138
|
+
// end so the line does not strike through it.
|
|
139
|
+
const belowBar = this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar;
|
|
140
|
+
const belowAxisEnd = this.spacings.categoryWidth - this.spacings.scenarioOffset + this.spacings.labelToAxis;
|
|
141
|
+
return Math.max(belowBar, belowAxisEnd);
|
|
133
142
|
}
|
|
134
143
|
return -(this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar);
|
|
135
144
|
}
|
|
@@ -191,7 +200,40 @@ export class ElementPositions {
|
|
|
191
200
|
this.calculateAxisPosition();
|
|
192
201
|
}
|
|
193
202
|
getAxisTitleOffset() {
|
|
194
|
-
|
|
203
|
+
// Title height plus the gap to the labels that can stick out above the first bar
|
|
204
|
+
return this.topSideLabelHeight + this.spacings.labelToAxis + this.getTopLabelOverhang();
|
|
205
|
+
}
|
|
206
|
+
getTopLabelOverhang() {
|
|
207
|
+
return this.hasStackedHeaders ? this.getStackedHeaderOverhang() : this.getTopScenarioLabelOverhang();
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* How far the stacked-segment header row (anchored just above the first bar)
|
|
211
|
+
* reaches above the axis start. The title is moved up by this amount so the
|
|
212
|
+
* header row sits between title and bars without overlapping either.
|
|
213
|
+
*/
|
|
214
|
+
getStackedHeaderOverhang() {
|
|
215
|
+
return Math.max(0, this.fontSize +
|
|
216
|
+
this.spacings.scenarioLabelToBar +
|
|
217
|
+
this.spacings.barWidth * 0.5 -
|
|
218
|
+
(this.spacings.categoryWidth * 0.5 + this.spacings.scenarioOffset));
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* How far the scenario labels above the first bar (secondary bar label) or
|
|
222
|
+
* above the first marker (primary marker label) reach above the axis start.
|
|
223
|
+
* The title is moved up by this amount so it does not overlap them.
|
|
224
|
+
*/
|
|
225
|
+
getTopScenarioLabelOverhang() {
|
|
226
|
+
const barLabelOverhang = this.fontSize +
|
|
227
|
+
this.spacings.barWidth * 0.5 +
|
|
228
|
+
this.spacings.scenarioLabelToBar -
|
|
229
|
+
this.spacings.categoryWidth * 0.5;
|
|
230
|
+
const markerLabelOverhang = this.fontSize +
|
|
231
|
+
this.spacings.markerWidth * 0.5 +
|
|
232
|
+
this.spacings.scenarioLabelToBar +
|
|
233
|
+
this.spacings.markerOffset +
|
|
234
|
+
this.spacings.barWidth * 0.5 -
|
|
235
|
+
(this.spacings.categoryWidth * 0.5 + this.spacings.scenarioOffset);
|
|
236
|
+
return Math.max(0, barLabelOverhang, markerLabelOverhang);
|
|
195
237
|
}
|
|
196
238
|
calculateSideLabelLength(titleLength, leftSideWidth, categoryWidth) {
|
|
197
239
|
if (this.leftSideLengthSync) {
|
|
@@ -483,6 +483,8 @@ export class Chart {
|
|
|
483
483
|
this.pixelPerUnitGroupMap = new Map();
|
|
484
484
|
this._autoScaleGuard = false;
|
|
485
485
|
this._lastObservedWidth = 0;
|
|
486
|
+
this._settleTimer = null;
|
|
487
|
+
this._lastAppliedHeight = 0;
|
|
486
488
|
withStyled(this);
|
|
487
489
|
withComponentStatus(this);
|
|
488
490
|
withDataset(this, (name, _data) => {
|
|
@@ -612,17 +614,53 @@ export class Chart {
|
|
|
612
614
|
forceUpdate(this);
|
|
613
615
|
});
|
|
614
616
|
});
|
|
617
|
+
this.settleParentHeight();
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* The initial renders can measure mid-hydration, before ancestor CSS
|
|
621
|
+
* (fixed page height, overflow) is applied, so the height used for
|
|
622
|
+
* auto-fit may be a transient value — and the resize observer above
|
|
623
|
+
* deliberately ignores height changes. Re-measure on a short backoff
|
|
624
|
+
* schedule and re-render when the measurement no longer matches the
|
|
625
|
+
* height the last render actually used (_lastAppliedHeight, recorded
|
|
626
|
+
* in prepareDimension). The schedule is finite, so this cannot feed a
|
|
627
|
+
* render loop.
|
|
628
|
+
*/
|
|
629
|
+
settleParentHeight() {
|
|
630
|
+
const delays = [150, 400, 1000, 2500];
|
|
631
|
+
const check = () => {
|
|
632
|
+
this._settleTimer = null;
|
|
633
|
+
if (!this.element.isConnected)
|
|
634
|
+
return;
|
|
635
|
+
const { height } = getParentDimensions(this.element);
|
|
636
|
+
// 8px threshold: hydration corrections are large (hundreds of px);
|
|
637
|
+
// small jitter must not cause re-renders, because every re-render
|
|
638
|
+
// gives the width-overflow font scaler a chance to ratchet down.
|
|
639
|
+
if (height > 0 && Math.abs(height - this._lastAppliedHeight) > 8 && !this._autoScaleGuard) {
|
|
640
|
+
forceUpdate(this);
|
|
641
|
+
}
|
|
642
|
+
const next = delays.shift();
|
|
643
|
+
if (next !== undefined) {
|
|
644
|
+
this._settleTimer = setTimeout(check, next);
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
this._settleTimer = setTimeout(check, delays.shift());
|
|
615
648
|
}
|
|
616
649
|
disconnectedCallback() {
|
|
617
650
|
var _a;
|
|
618
651
|
(_a = this.layoutObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
619
652
|
this.layoutObserver = null;
|
|
653
|
+
if (this._settleTimer != null) {
|
|
654
|
+
clearTimeout(this._settleTimer);
|
|
655
|
+
this._settleTimer = null;
|
|
656
|
+
}
|
|
620
657
|
}
|
|
621
658
|
prepareDimension() {
|
|
622
659
|
const parent = getParentDimensions(this.element);
|
|
623
660
|
const scenariosList = this.prepareScenarios();
|
|
624
661
|
const variancesList = this.prepareVariances();
|
|
625
662
|
this.canvasWidthSegmented = parent.width / (scenariosList.length + variancesList.length || 1);
|
|
663
|
+
this._lastAppliedHeight = parent.height;
|
|
626
664
|
return { width: this.canvasWidthSegmented, height: parent.height };
|
|
627
665
|
}
|
|
628
666
|
prepareScenarios() {
|
|
@@ -1026,7 +1064,7 @@ export class Chart {
|
|
|
1026
1064
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
1027
1065
|
}
|
|
1028
1066
|
const fontStyles = this.getFontStyles();
|
|
1029
|
-
return (h(Host, { key: '
|
|
1067
|
+
return (h(Host, { key: '8c90dcaacd6b4e1b64b1fb4a8aefe1345086e7e6', style: fontStyles }, h("div", { key: 'c0209d2fd9fcf5ee60c3f17697c7bcbf1b445fec', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
1030
1068
|
}
|
|
1031
1069
|
static get is() { return "bn-chart-time"; }
|
|
1032
1070
|
static get encapsulation() { return "shadow"; }
|
|
@@ -82,6 +82,7 @@ export class TimeChart {
|
|
|
82
82
|
this.chartMode = ChartMode.BAR;
|
|
83
83
|
this.maxBars = 28;
|
|
84
84
|
this.stackConfig = null;
|
|
85
|
+
this.scenarioPropOrder = [];
|
|
85
86
|
this.lineFullWidth = true;
|
|
86
87
|
this.availableWidth = 0;
|
|
87
88
|
this.overflowConfig = null;
|
|
@@ -93,7 +94,7 @@ export class TimeChart {
|
|
|
93
94
|
this.styles = styles;
|
|
94
95
|
this.availableWidth = availableWidth;
|
|
95
96
|
this.setConfig(config);
|
|
96
|
-
this.position = this.createElementPosition(
|
|
97
|
+
this.position = this.createElementPosition(this.lastScenarios);
|
|
97
98
|
}
|
|
98
99
|
updatePosition(scenarios) {
|
|
99
100
|
this.position = this.createElementPosition(scenarios);
|
|
@@ -163,7 +164,8 @@ export class TimeChart {
|
|
|
163
164
|
setConfig(config) {
|
|
164
165
|
var _a;
|
|
165
166
|
this.state = FactoryState.DIRTY;
|
|
166
|
-
this.
|
|
167
|
+
this.scenarioPropOrder = [...config.scenarios];
|
|
168
|
+
const scenarios = this.sortScenariosbyVisualisationRules(config.scenarios);
|
|
167
169
|
this.setSource(config.filter);
|
|
168
170
|
this.hideAxisLabels = config.hideAxisLabels || false;
|
|
169
171
|
this.pixelPerUnit = config.pixelPerUnit;
|
|
@@ -171,7 +173,7 @@ export class TimeChart {
|
|
|
171
173
|
this.axisLabelsMode = config.axisLabelsMode;
|
|
172
174
|
this.intervalSpanLimit = config.intervalSpanLimit;
|
|
173
175
|
this.dateInterval = this.findDateInterval(config.dateInterval);
|
|
174
|
-
this.dataModel = this.populateModel(
|
|
176
|
+
this.dataModel = this.populateModel(scenarios, this.dateInterval, config.level, config.sortOrder);
|
|
175
177
|
this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
|
|
176
178
|
this.title = config.title || Formatter.translateScenarioLabel((_a = config === null || config === void 0 ? void 0 : config.variances) === null || _a === void 0 ? void 0 : _a.toString(), this.i18n);
|
|
177
179
|
this.smallestDataPointValue = this.findSmallestDataPointValue(this.dataModel);
|
|
@@ -189,8 +191,8 @@ export class TimeChart {
|
|
|
189
191
|
this.maxBars = config.maxBars;
|
|
190
192
|
this.stackConfig = config.stackConfig;
|
|
191
193
|
this.lineFullWidth = config.lineFullWidth;
|
|
192
|
-
this.lastScenarios =
|
|
193
|
-
this.updatePosition(
|
|
194
|
+
this.lastScenarios = scenarios;
|
|
195
|
+
this.updatePosition(scenarios);
|
|
194
196
|
}
|
|
195
197
|
getFooter() {
|
|
196
198
|
if (this.measureScale.value === 1 && this.measureUnit === "") {
|
|
@@ -198,9 +200,10 @@ export class TimeChart {
|
|
|
198
200
|
}
|
|
199
201
|
return Formatter.translateScenarioLabel("in", this.i18n) + " " + this.measureScale.prefix + this.measureUnit;
|
|
200
202
|
}
|
|
201
|
-
|
|
203
|
+
/** Returns a new array; the input keeps the `scenarios` prop order (the config is reused across rebuilds). */
|
|
204
|
+
sortScenariosbyVisualisationRules(scenarios) {
|
|
202
205
|
const self = this;
|
|
203
|
-
|
|
206
|
+
return [...scenarios]
|
|
204
207
|
.sort((n1, n2) => {
|
|
205
208
|
return self.ruleSet.getScenarioSorIndex(n1) - self.ruleSet.getScenarioSorIndex(n2);
|
|
206
209
|
})
|
|
@@ -1004,6 +1007,17 @@ export class TimeChart {
|
|
|
1004
1007
|
};
|
|
1005
1008
|
return columnGroup;
|
|
1006
1009
|
}
|
|
1010
|
+
/** Restore the original `scenarios` prop order for stacked segments (IBCS sort reorders the slots). */
|
|
1011
|
+
sortSegmentsByPropOrder(segments) {
|
|
1012
|
+
if (this.scenarioPropOrder.length === 0)
|
|
1013
|
+
return;
|
|
1014
|
+
const order = this.scenarioPropOrder;
|
|
1015
|
+
segments.sort((a, b) => {
|
|
1016
|
+
const ia = order.indexOf(a.scenario);
|
|
1017
|
+
const ib = order.indexOf(b.scenario);
|
|
1018
|
+
return (ia === -1 ? order.length : ia) - (ib === -1 ? order.length : ib);
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1007
1021
|
/**
|
|
1008
1022
|
* Draw stacked bar columns. Supports stacking by scenario or by data dimension.
|
|
1009
1023
|
* When stacking by scenario with multiple scenario types (e.g. ac+pl),
|
|
@@ -1025,6 +1039,7 @@ export class TimeChart {
|
|
|
1025
1039
|
segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
|
|
1026
1040
|
}
|
|
1027
1041
|
}
|
|
1042
|
+
this.sortSegmentsByPropOrder(segments);
|
|
1028
1043
|
}
|
|
1029
1044
|
else {
|
|
1030
1045
|
const dp = elements["scenario1"];
|
|
@@ -1124,12 +1139,14 @@ export class TimeChart {
|
|
|
1124
1139
|
}
|
|
1125
1140
|
if (segments.length === 0)
|
|
1126
1141
|
return;
|
|
1142
|
+
this.sortSegmentsByPropOrder(segments);
|
|
1127
1143
|
const prefixes = new Set(segments.map((s) => getScenarioPrefix(s.scenario)));
|
|
1128
1144
|
const axisY = this.position.getColumnPositionY();
|
|
1129
1145
|
const xBase = this.position.getColumnCenterPositionX(0) - this.position.getColumnWidth() / 2;
|
|
1130
1146
|
const labelX = xBase - this.position.spacings.labelToColumn;
|
|
1131
1147
|
if (prefixes.size > 1) {
|
|
1132
|
-
// Overlay mode: one header per group
|
|
1148
|
+
// Overlay mode: one header per group — front group centered on its bar,
|
|
1149
|
+
// back groups aligned with their bar's top edge
|
|
1133
1150
|
const groupMap = new Map();
|
|
1134
1151
|
for (const seg of segments) {
|
|
1135
1152
|
const prefix = getScenarioPrefix(seg.scenario);
|
|
@@ -1147,11 +1164,15 @@ export class TimeChart {
|
|
|
1147
1164
|
for (const [prefix, segs] of groupMap) {
|
|
1148
1165
|
groups.push({ prefix, segments: segs });
|
|
1149
1166
|
}
|
|
1150
|
-
groups.forEach((group) => {
|
|
1167
|
+
groups.forEach((group, groupIdx) => {
|
|
1151
1168
|
const groupTotal = group.segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
|
|
1152
1169
|
const pixelPerUnit = group.segments[0].dataPoint.pixelPerUnit;
|
|
1153
1170
|
const groupPixelHeight = this.stackConfig.mode === StackMode.RELATIVE ? pixelPerUnit : groupTotal * pixelPerUnit;
|
|
1154
|
-
|
|
1171
|
+
// The front-most group (drawn last, e.g. AC) is fully visible, so its
|
|
1172
|
+
// label is centered on the bar. Back groups are mostly hidden behind it
|
|
1173
|
+
// and only peek out at the top, so their labels align with the bar's top edge.
|
|
1174
|
+
const isFrontGroup = groupIdx === groups.length - 1;
|
|
1175
|
+
const centerY = isFrontGroup ? axisY - groupPixelHeight / 2 : axisY - groupPixelHeight;
|
|
1155
1176
|
const labelText = this.i18n.get(group.prefix + "1") || group.prefix.toUpperCase();
|
|
1156
1177
|
new Label(headerGroup, labelX, centerY, "STACK_HEADER", labelText, this.styles, HookLocation.Center, HookLocation.Right).forceStringTypeDraw();
|
|
1157
1178
|
});
|
|
@@ -1210,6 +1231,15 @@ export class TimeChart {
|
|
|
1210
1231
|
activeLayers.push(key);
|
|
1211
1232
|
}
|
|
1212
1233
|
}
|
|
1234
|
+
if (isScenarioStack && this.scenarioPropOrder.length > 0) {
|
|
1235
|
+
const order = this.scenarioPropOrder;
|
|
1236
|
+
activeLayers.sort((a, b) => {
|
|
1237
|
+
var _a, _b, _c, _d;
|
|
1238
|
+
const ia = order.indexOf((_b = (_a = dataModel[0][a]) === null || _a === void 0 ? void 0 : _a.scenario) !== null && _b !== void 0 ? _b : "");
|
|
1239
|
+
const ib = order.indexOf((_d = (_c = dataModel[0][b]) === null || _c === void 0 ? void 0 : _c.scenario) !== null && _d !== void 0 ? _d : "");
|
|
1240
|
+
return (ia === -1 ? order.length : ia) - (ib === -1 ? order.length : ib);
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1213
1243
|
// Compute cumulative values
|
|
1214
1244
|
for (let layerIdx = 0; layerIdx < activeLayers.length; layerIdx++) {
|
|
1215
1245
|
const key = activeLayers[layerIdx];
|
|
@@ -75,7 +75,7 @@ export class Dataset {
|
|
|
75
75
|
}
|
|
76
76
|
// --- Leaving URL mode → clean up ---
|
|
77
77
|
if (this.currentUrl !== null) {
|
|
78
|
-
this.
|
|
78
|
+
this.cancelInFlight();
|
|
79
79
|
this.currentUrl = null;
|
|
80
80
|
}
|
|
81
81
|
let contentHash;
|
|
@@ -193,7 +193,7 @@ export class Dataset {
|
|
|
193
193
|
}
|
|
194
194
|
disconnectedCallback() {
|
|
195
195
|
var _a, _b;
|
|
196
|
-
this.
|
|
196
|
+
this.cancelInFlight();
|
|
197
197
|
if (((_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db) && this.name) {
|
|
198
198
|
const db = this.stores.db.db;
|
|
199
199
|
try {
|
|
@@ -251,19 +251,26 @@ export class Dataset {
|
|
|
251
251
|
this.publish([]);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
/** Stops the polling timer
|
|
255
|
-
|
|
256
|
-
var _a;
|
|
254
|
+
/** Stops the polling timer (does NOT touch any in-flight fetch). */
|
|
255
|
+
clearPollTimer() {
|
|
257
256
|
if (this.pollTimerId !== null) {
|
|
258
257
|
clearInterval(this.pollTimerId);
|
|
259
258
|
this.pollTimerId = null;
|
|
260
259
|
}
|
|
260
|
+
}
|
|
261
|
+
/** Stops the polling timer AND cancels any in-flight fetch. Use only when
|
|
262
|
+
* leaving URL mode entirely (disconnect or body changed to inline). */
|
|
263
|
+
cancelInFlight() {
|
|
264
|
+
var _a;
|
|
265
|
+
this.clearPollTimer();
|
|
261
266
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
262
267
|
this.abortController = null;
|
|
263
268
|
}
|
|
264
|
-
/** Starts (or restarts) the polling timer if in URL mode with a positive
|
|
269
|
+
/** Starts (or restarts) the polling timer if in URL mode with a positive
|
|
270
|
+
* interval. Does NOT abort the kick-off fetch issued by the caller — it
|
|
271
|
+
* only resets the interval timer. */
|
|
265
272
|
startPolling() {
|
|
266
|
-
this.
|
|
273
|
+
this.clearPollTimer();
|
|
267
274
|
if (this.currentUrl && this.interval > 0) {
|
|
268
275
|
this.pollTimerId = setInterval(() => {
|
|
269
276
|
if (this.currentUrl) {
|
|
@@ -273,7 +280,7 @@ export class Dataset {
|
|
|
273
280
|
}
|
|
274
281
|
}
|
|
275
282
|
render() {
|
|
276
|
-
return h(Host, { key: '
|
|
283
|
+
return h(Host, { key: 'a02f22a7f78c3bd2512e013ff729487c471ba9bf' });
|
|
277
284
|
}
|
|
278
285
|
static get is() { return "bn-dataset"; }
|
|
279
286
|
static get originalStyleUrls() {
|
|
@@ -59,7 +59,7 @@ export class Datasource {
|
|
|
59
59
|
}
|
|
60
60
|
// --- Leaving URL mode → clean up ---
|
|
61
61
|
if (this.currentUrl !== null) {
|
|
62
|
-
this.
|
|
62
|
+
this.cancelInFlight();
|
|
63
63
|
this.currentUrl = null;
|
|
64
64
|
}
|
|
65
65
|
// --- Inline JSON / compressed mode ---
|
|
@@ -103,7 +103,7 @@ export class Datasource {
|
|
|
103
103
|
}
|
|
104
104
|
disconnectedCallback() {
|
|
105
105
|
var _a, _b;
|
|
106
|
-
this.
|
|
106
|
+
this.cancelInFlight();
|
|
107
107
|
const db = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db;
|
|
108
108
|
if (db && this.name) {
|
|
109
109
|
if (db.tables[this.name] != null) {
|
|
@@ -149,19 +149,26 @@ export class Datasource {
|
|
|
149
149
|
this.publish([]);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
/** Stops the polling timer
|
|
153
|
-
|
|
154
|
-
var _a;
|
|
152
|
+
/** Stops the polling timer (does NOT touch any in-flight fetch). */
|
|
153
|
+
clearPollTimer() {
|
|
155
154
|
if (this.pollTimerId !== null) {
|
|
156
155
|
clearInterval(this.pollTimerId);
|
|
157
156
|
this.pollTimerId = null;
|
|
158
157
|
}
|
|
158
|
+
}
|
|
159
|
+
/** Stops the polling timer AND cancels any in-flight fetch. Use only when
|
|
160
|
+
* leaving URL mode entirely (disconnect or body changed to inline). */
|
|
161
|
+
cancelInFlight() {
|
|
162
|
+
var _a;
|
|
163
|
+
this.clearPollTimer();
|
|
159
164
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
160
165
|
this.abortController = null;
|
|
161
166
|
}
|
|
162
|
-
/** Starts (or restarts) the polling timer if in URL mode with a positive
|
|
167
|
+
/** Starts (or restarts) the polling timer if in URL mode with a positive
|
|
168
|
+
* interval. Does NOT abort the kick-off fetch issued by the caller — it
|
|
169
|
+
* only resets the interval timer. */
|
|
163
170
|
startPolling() {
|
|
164
|
-
this.
|
|
171
|
+
this.clearPollTimer();
|
|
165
172
|
if (this.currentUrl && this.interval > 0) {
|
|
166
173
|
this.pollTimerId = setInterval(() => {
|
|
167
174
|
if (this.currentUrl) {
|
|
@@ -171,7 +178,7 @@ export class Datasource {
|
|
|
171
178
|
}
|
|
172
179
|
}
|
|
173
180
|
render() {
|
|
174
|
-
return h(Host, { key: '
|
|
181
|
+
return h(Host, { key: '2af6ade861fa900974deeb1b6bcc4520997a4180' });
|
|
175
182
|
}
|
|
176
183
|
static get is() { return "bn-datasource"; }
|
|
177
184
|
static get originalStyleUrls() {
|
|
@@ -175,11 +175,14 @@ export class LayoutCard {
|
|
|
175
175
|
return "minmax(0, 1fr)";
|
|
176
176
|
return this.calculateFractions(matches[0]);
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
getRowCount(name) {
|
|
179
179
|
const template = this.getTemplatePattern(name);
|
|
180
180
|
const pattern = /"[\w\d\s.]+"/g;
|
|
181
181
|
const matches = template.match(pattern);
|
|
182
|
-
|
|
182
|
+
return matches ? matches.length : 1;
|
|
183
|
+
}
|
|
184
|
+
getGridTemplateRows(name) {
|
|
185
|
+
const rowCount = this.getRowCount(name);
|
|
183
186
|
if (this.cardFitToContent) {
|
|
184
187
|
return Array(rowCount).fill("auto").join(" ");
|
|
185
188
|
}
|
|
@@ -271,9 +274,7 @@ export class LayoutCard {
|
|
|
271
274
|
var _a, _b, _c, _d;
|
|
272
275
|
const style = this.getLayoutStyle();
|
|
273
276
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
274
|
-
return (
|
|
275
|
-
// @ts-ignore
|
|
276
|
-
h("bn-card", { key: 'c39b6a8cf843b7b8d9b380215a3553288acd3647', styles: this.styles, class: this.setCardClass() }, h("div", { key: '3206bff73cb01fad7223e3fd889e015992e535c6', class: "cardtitle" }, h("bn-title", { key: 'd410c817dd185a26bb7623dd3649c999516f706a', namespace: this.titleNamespace, "business-unit": this.titleBusinessUnit, scenarios: (_a = this.resolveInherited("titleScenarios", this.titleScenarios)) !== null && _a !== void 0 ? _a : this.titleScenarios, variances: (_b = this.resolveInherited("titleVariances", this.titleVariances)) !== null && _b !== void 0 ? _b : this.titleVariances, order: (_c = this.resolveInherited("titleOrder", this.titleOrder)) !== null && _c !== void 0 ? _c : this.titleOrder, "order-direction": (_d = this.resolveInherited("titleOrderDirection", this.titleOrderDirection)) !== null && _d !== void 0 ? _d : this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), this.titleImage != null && this.titleImage !== "" ? (h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), h("bn-body", { key: 'f56b1b70127cd2173e425cf723dbea2b62037d88' }, h("div", { key: 'e5766b5b28dd1d14fdbaf721baf72668502fcbec', style: style }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'bafb89f89c89aaf0e31fa754f0e834330b031627', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
|
|
277
|
+
return (h("bn-card", { key: 'f94b210638d26436a03daba89d7da43ec4dc6973', styles: this.styles, "selected-style": this.selectedStyle, class: this.setCardClass() }, h("div", { key: 'b29e3e8a32672278508e13daeb215529d6c4e0fd', class: "cardtitle" }, h("bn-title", { key: '988a77ef985bf45326af5fbdd2dd2940e0bd3e2b', namespace: this.titleNamespace, "business-unit": this.titleBusinessUnit, scenarios: (_a = this.resolveInherited("titleScenarios", this.titleScenarios)) !== null && _a !== void 0 ? _a : this.titleScenarios, variances: (_b = this.resolveInherited("titleVariances", this.titleVariances)) !== null && _b !== void 0 ? _b : this.titleVariances, order: (_c = this.resolveInherited("titleOrder", this.titleOrder)) !== null && _c !== void 0 ? _c : this.titleOrder, "order-direction": (_d = this.resolveInherited("titleOrderDirection", this.titleOrderDirection)) !== null && _d !== void 0 ? _d : this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), this.titleImage != null && this.titleImage !== "" ? (h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), h("bn-body", { key: '2391406ed78728ac6d343ee1ee20500be6f4aef3' }, h("div", { key: '97fa4d0c73a0d0b7bc4a9fda83133291d7f875e7', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), h("bn-footer", { key: '2162b61945c8e7c20602ef7e7a50dbb33ee5a6d2', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
|
|
277
278
|
}
|
|
278
279
|
static get is() { return "bn-layout-card"; }
|
|
279
280
|
static get encapsulation() { return "shadow"; }
|
|
@@ -308,6 +309,25 @@ export class LayoutCard {
|
|
|
308
309
|
"reflect": false,
|
|
309
310
|
"attribute": "styles"
|
|
310
311
|
},
|
|
312
|
+
"selectedStyle": {
|
|
313
|
+
"type": "string",
|
|
314
|
+
"mutable": false,
|
|
315
|
+
"complexType": {
|
|
316
|
+
"original": "string",
|
|
317
|
+
"resolved": "string",
|
|
318
|
+
"references": {}
|
|
319
|
+
},
|
|
320
|
+
"required": false,
|
|
321
|
+
"optional": true,
|
|
322
|
+
"docs": {
|
|
323
|
+
"tags": [],
|
|
324
|
+
"text": "Name of a registered component style (see `bn-component-style`) passed\nthrough to the inner `<bn-card>` element as its `selected-style`\nattribute."
|
|
325
|
+
},
|
|
326
|
+
"getter": false,
|
|
327
|
+
"setter": false,
|
|
328
|
+
"reflect": false,
|
|
329
|
+
"attribute": "selected-style"
|
|
330
|
+
},
|
|
311
331
|
"titleImage": {
|
|
312
332
|
"type": "string",
|
|
313
333
|
"mutable": false,
|
|
@@ -143,11 +143,14 @@ export class LayoutPage {
|
|
|
143
143
|
gap: this.pageGridGap + "px",
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
getRowCount(name) {
|
|
147
147
|
const template = this.getTemplateAreas(name);
|
|
148
148
|
const pattern = /"[\w\d\s.]+"/g;
|
|
149
149
|
const matches = template.match(pattern);
|
|
150
|
-
|
|
150
|
+
return matches ? matches.length : 1;
|
|
151
|
+
}
|
|
152
|
+
getGridTemplateRows(name) {
|
|
153
|
+
const rowCount = this.getRowCount(name);
|
|
151
154
|
if (this.pageFitToContent) {
|
|
152
155
|
return Array(rowCount).fill("auto").join(" ");
|
|
153
156
|
}
|
|
@@ -239,9 +242,7 @@ export class LayoutPage {
|
|
|
239
242
|
render() {
|
|
240
243
|
const style = this.getLayoutStyle();
|
|
241
244
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
242
|
-
return (
|
|
243
|
-
// @ts-ignore
|
|
244
|
-
h("bn-page", { key: '958dbce3b000c62d287f6263fed495523786e28d', styles: this.styles, format: this.pageFormat, orientation: this.pageOrientation }, h("bn-message", { key: 'cdb559c63a0466ccaa1cd807d027dd127e3b3efe', text: this.messageText, image: this.messageImage }), h("bn-title", { key: '48fafd3fc8be7d49df4939bd5db63908b36e523f', namespace: this.titleNamespace, "business-unit": this.titleBusinessUnit, scenarios: this.titleScenarios, variances: this.titleVariances, order: this.titleOrder, "order-direction": this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), h("bn-body", { key: '93c9f7b2c345c8bc6fdb20d35fa406ee919379eb' }, h("div", { key: '64e4db5a7b6265bcd73b700227b5f033c99facdc', style: style }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'f7b69e9fcfbdde742a2d547f81c50dd78a3ed02f', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber })));
|
|
245
|
+
return (h("bn-page", { key: 'ed0804f3f1daf9327903fd61ff633f2857119a31', styles: this.styles, "selected-style": this.selectedStyle, format: this.pageFormat, orientation: this.pageOrientation }, h("bn-message", { key: 'ccfb6dfa63b001e6fe96612ed3f8635970b6481c', text: this.messageText, image: this.messageImage }), h("bn-title", { key: '223bd6ba689c17796eb165839223164f8bb174e5', namespace: this.titleNamespace, "business-unit": this.titleBusinessUnit, scenarios: this.titleScenarios, variances: this.titleVariances, order: this.titleOrder, "order-direction": this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), h("bn-body", { key: '606f637fb9a48a83062193e7e88733c6b2f092b1' }, h("div", { key: '94aebd1b35061ec6e7ccfb4203ea4bc07ea90cbd', style: style, "data-bn-fit-content": this.pageFitToContent ? String(this.getRowCount(this.pageLayout)) : null }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'aa64d4f789c3016289b400a3ea796b1d37f9bcfc', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber })));
|
|
245
246
|
}
|
|
246
247
|
static get is() { return "bn-layout-page"; }
|
|
247
248
|
static get encapsulation() { return "shadow"; }
|
|
@@ -276,6 +277,25 @@ export class LayoutPage {
|
|
|
276
277
|
"reflect": false,
|
|
277
278
|
"attribute": "styles"
|
|
278
279
|
},
|
|
280
|
+
"selectedStyle": {
|
|
281
|
+
"type": "string",
|
|
282
|
+
"mutable": false,
|
|
283
|
+
"complexType": {
|
|
284
|
+
"original": "string",
|
|
285
|
+
"resolved": "string",
|
|
286
|
+
"references": {}
|
|
287
|
+
},
|
|
288
|
+
"required": false,
|
|
289
|
+
"optional": true,
|
|
290
|
+
"docs": {
|
|
291
|
+
"tags": [],
|
|
292
|
+
"text": "Name of a registered component style (see `bn-component-style`) passed\nthrough to the inner `<bn-page>` element as its `selected-style`\nattribute."
|
|
293
|
+
},
|
|
294
|
+
"getter": false,
|
|
295
|
+
"setter": false,
|
|
296
|
+
"reflect": false,
|
|
297
|
+
"attribute": "selected-style"
|
|
298
|
+
},
|
|
279
299
|
"messageText": {
|
|
280
300
|
"type": "string",
|
|
281
301
|
"mutable": false,
|