@bino-bi/bn-template-engine 1.0.0-alpha.13 → 1.0.0-alpha.15

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.
Files changed (93) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-637e3b8f.entry.js → p-19f49fbc.entry.js} +1 -1
  3. package/dist/bn-template-engine/p-209b3fd9.entry.js +1 -0
  4. package/dist/bn-template-engine/{p-67eae33e.entry.js → p-3465fcdc.entry.js} +1 -1
  5. package/dist/bn-template-engine/{p-82023539.entry.js → p-67746414.entry.js} +1 -1
  6. package/dist/bn-template-engine/p-BPDZcex5.js +1 -0
  7. package/dist/bn-template-engine/{p-DHheVOfP.js → p-Tx6omDWp.js} +1 -1
  8. package/dist/bn-template-engine/{p-52097456.entry.js → p-d724ab88.entry.js} +1 -1
  9. package/dist/bn-template-engine/p-efd3b67a.entry.js +1 -0
  10. package/dist/bn-template-engine/{p-46699464.entry.js → p-ff659485.entry.js} +1 -1
  11. package/dist/bn-template-engine/p-z9bPNFYF.js +1 -0
  12. package/dist/cjs/bn-asset_21.cjs.entry.js +348 -75
  13. package/dist/cjs/bn-grid.cjs.entry.js +2 -2
  14. package/dist/cjs/bn-image.cjs.entry.js +2 -2
  15. package/dist/cjs/bn-internationalization.cjs.entry.js +1 -1
  16. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  17. package/dist/cjs/bn-text.cjs.entry.js +3 -3
  18. package/dist/cjs/bn-tree.cjs.entry.js +2 -2
  19. package/dist/cjs/{context-protocol-Op7uUwN3.js → context-protocol-Cn5PL928.js} +14 -0
  20. package/dist/cjs/editor-companion.cjs.entry.js +1 -1
  21. package/dist/cjs/loader.cjs.js +1 -1
  22. package/dist/cjs/{scaling-57N4Cxb_.js → scaling-DM2UILdF.js} +58 -17
  23. package/dist/cjs/{withStyled-C2kmGAK3.js → withStyled-Dx3uRw9g.js} +72 -1
  24. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +28 -10
  25. package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +46 -4
  26. package/dist/collection/components/bn-chart-time/bn-chart-time.js +39 -1
  27. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +40 -10
  28. package/dist/collection/components/bn-dataset/bn-dataset.js +25 -13
  29. package/dist/collection/components/bn-datasource/bn-datasource.js +23 -12
  30. package/dist/collection/components/bn-layout-card/bn-layout-card.css +5 -0
  31. package/dist/collection/components/bn-layout-card/bn-layout-card.js +6 -3
  32. package/dist/collection/components/bn-layout-page/bn-layout-page.css +5 -0
  33. package/dist/collection/components/bn-layout-page/bn-layout-page.js +6 -3
  34. package/dist/collection/components/bn-table/bn-table.js +75 -7
  35. package/dist/collection/components/bn-table/ibcs-table.js +27 -0
  36. package/dist/collection/components/bn-table/utils/Table.js +2 -2
  37. package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +28 -5
  38. package/dist/collection/components/bn-table/utils/helper/DataQuery.js +46 -6
  39. package/dist/collection/components/bn-table/utils/model/TableAttribute.js +46 -0
  40. package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +5 -0
  41. package/dist/collection/context/scopedDb.js +14 -0
  42. package/dist/collection/utils/parentDimensions.js +57 -16
  43. package/dist/collection/utils/validate.js +23 -0
  44. package/dist/components/DateStringFactory.js +1 -1
  45. package/dist/components/Order.js +1 -1
  46. package/dist/components/bn-chart-structure.js +1 -1
  47. package/dist/components/bn-chart-time.js +1 -1
  48. package/dist/components/bn-dataset.js +1 -1
  49. package/dist/components/bn-datasource.js +1 -1
  50. package/dist/components/bn-layout-card.js +1 -1
  51. package/dist/components/bn-layout-page.js +1 -1
  52. package/dist/components/bn-table.js +1 -1
  53. package/dist/components/bn-title2.js +1 -1
  54. package/dist/components/context-protocol.js +1 -1
  55. package/dist/components/ibcs-chart-structure2.js +1 -1
  56. package/dist/components/ibcs-chart-time2.js +1 -1
  57. package/dist/components/ibcs-table2.js +1 -1
  58. package/dist/components/ibcs-title2.js +1 -1
  59. package/dist/components/scaling.js +1 -1
  60. package/dist/components/validate.js +1 -1
  61. package/dist/esm/bn-asset_21.entry.js +348 -75
  62. package/dist/esm/bn-grid.entry.js +2 -2
  63. package/dist/esm/bn-image.entry.js +2 -2
  64. package/dist/esm/bn-internationalization.entry.js +1 -1
  65. package/dist/esm/bn-template-engine.js +1 -1
  66. package/dist/esm/bn-text.entry.js +3 -3
  67. package/dist/esm/bn-tree.entry.js +2 -2
  68. package/dist/esm/{context-protocol-BDhzNbeD.js → context-protocol-BB-4Onmw.js} +14 -0
  69. package/dist/esm/editor-companion.entry.js +1 -1
  70. package/dist/esm/loader.js +1 -1
  71. package/dist/esm/{scaling-La1Ow72h.js → scaling-h4KcBet3.js} +58 -17
  72. package/dist/esm/{withStyled-Bl9cSoRW.js → withStyled-BBvU2f-A.js} +71 -2
  73. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +4 -0
  74. package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +16 -1
  75. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +13 -0
  76. package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +4 -0
  77. package/dist/types/components/bn-dataset/bn-dataset.d.ts +15 -7
  78. package/dist/types/components/bn-datasource/bn-datasource.d.ts +13 -6
  79. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +1 -0
  80. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +1 -0
  81. package/dist/types/components/bn-table/bn-table.d.ts +13 -0
  82. package/dist/types/components/bn-table/ibcs-table.d.ts +2 -0
  83. package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +3 -1
  84. package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +11 -0
  85. package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +22 -0
  86. package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +3 -0
  87. package/dist/types/components.d.ts +45 -20
  88. package/dist/types/utils/validate.d.ts +6 -0
  89. package/package.json +1 -1
  90. package/dist/bn-template-engine/p-3c827826.entry.js +0 -1
  91. package/dist/bn-template-engine/p-BVFHvEXF.js +0 -1
  92. package/dist/bn-template-engine/p-CQnZV3JG.js +0 -1
  93. 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
- return this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar;
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
- return this.topSideLabelHeight;
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: 'fbef96ebdfa241564095c6def748082bfec0e6a4', style: fontStyles }, h("div", { key: '77d3168f126a779db1e0fbeed2f8a220a2f36792', class: "container" }, scenariosArray.map(this.chartTemplate))));
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(config.scenarios);
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.sortScenariosbyVisualisationRules(config);
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(config.scenarios, this.dateInterval, config.level, config.sortOrder);
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 = config.scenarios;
193
- this.updatePosition(config.scenarios);
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
- sortScenariosbyVisualisationRules(config) {
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
- config.scenarios
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, centered vertically on group's column height
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
- const centerY = axisY - groupPixelHeight / 2;
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];
@@ -14,9 +14,10 @@ import { computeContentHash, decodeCompressedContent } from "../../utils/content
14
14
  * 1. **SQL** (default) — AlaSQL query against referenced `datasources`.
15
15
  * 2. **Static JSON** — set `static="true"` to bypass SQL and write the
16
16
  * parsed body directly to the `datasets` store.
17
- * 3. **URL** — place an `http://` or `https://` URL in the body to fetch
18
- * JSON from a remote endpoint and write it to the `datasets` store.
19
- * Set the `interval` prop (in seconds) to enable periodic re-fetching.
17
+ * 3. **URL** — place an `http://`/`https://` URL or a same-origin path
18
+ * starting with `/` in the body to fetch JSON from an HTTP endpoint and
19
+ * write it to the `datasets` store. Set the `interval` prop (in seconds)
20
+ * to enable periodic re-fetching.
20
21
  */
21
22
  export class Dataset {
22
23
  constructor() {
@@ -74,7 +75,7 @@ export class Dataset {
74
75
  }
75
76
  // --- Leaving URL mode → clean up ---
76
77
  if (this.currentUrl !== null) {
77
- this.clearPolling();
78
+ this.cancelInFlight();
78
79
  this.currentUrl = null;
79
80
  }
80
81
  let contentHash;
@@ -192,7 +193,7 @@ export class Dataset {
192
193
  }
193
194
  disconnectedCallback() {
194
195
  var _a, _b;
195
- this.clearPolling();
196
+ this.cancelInFlight();
196
197
  if (((_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db) && this.name) {
197
198
  const db = this.stores.db.db;
198
199
  try {
@@ -213,10 +214,14 @@ export class Dataset {
213
214
  }
214
215
  }
215
216
  /**
216
- * Returns `true` if the text starts with `http://` or `https://`.
217
+ * Returns `true` if the text is a fetchable URL: an absolute `http(s)://`
218
+ * URL, or a same-origin path starting with `/` (but not `//`, which is a
219
+ * protocol-relative URL we treat as inline-mode escape).
217
220
  */
218
221
  isUrl(text) {
219
- return text.startsWith("http://") || text.startsWith("https://");
222
+ if (text.startsWith("http://") || text.startsWith("https://"))
223
+ return true;
224
+ return text.startsWith("/") && !text.startsWith("//");
220
225
  }
221
226
  /**
222
227
  * Fetches JSON from the given URL and stores the result as the dataset.
@@ -246,19 +251,26 @@ export class Dataset {
246
251
  this.publish([]);
247
252
  }
248
253
  }
249
- /** Stops the polling timer and cancels any in-flight fetch. */
250
- clearPolling() {
251
- var _a;
254
+ /** Stops the polling timer (does NOT touch any in-flight fetch). */
255
+ clearPollTimer() {
252
256
  if (this.pollTimerId !== null) {
253
257
  clearInterval(this.pollTimerId);
254
258
  this.pollTimerId = null;
255
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();
256
266
  (_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
257
267
  this.abortController = null;
258
268
  }
259
- /** Starts (or restarts) the polling timer if in URL mode with a positive interval. */
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. */
260
272
  startPolling() {
261
- this.clearPolling();
273
+ this.clearPollTimer();
262
274
  if (this.currentUrl && this.interval > 0) {
263
275
  this.pollTimerId = setInterval(() => {
264
276
  if (this.currentUrl) {
@@ -268,7 +280,7 @@ export class Dataset {
268
280
  }
269
281
  }
270
282
  render() {
271
- return h(Host, { key: 'fa02248ff99fc299f0ed7c7feae63063d071685a' });
283
+ return h(Host, { key: 'a02f22a7f78c3bd2512e013ff729487c471ba9bf' });
272
284
  }
273
285
  static get is() { return "bn-dataset"; }
274
286
  static get originalStyleUrls() {
@@ -10,8 +10,8 @@ import { computeContentHash, decodeCompressedContent } from "../../utils/content
10
10
  * Data can be provided in three ways:
11
11
  * 1. **Inline JSON** — Place JSON text inside the element body (default).
12
12
  * 2. **Compressed payload** — Set `raw="false"` and provide `<hash>:<base64_gzip>` format.
13
- * 3. **URL** — Place an `http://` or `https://` URL in the body to fetch JSON
14
- * from a remote endpoint.
13
+ * 3. **URL** — Place an `http://`/`https://` URL or a same-origin path
14
+ * starting with `/` in the body to fetch JSON from an HTTP endpoint.
15
15
  *
16
16
  * In URL mode the component fetches JSON from the URL. Set the `interval`
17
17
  * prop (in seconds) to enable periodic re-fetching (polling).
@@ -59,7 +59,7 @@ export class Datasource {
59
59
  }
60
60
  // --- Leaving URL mode → clean up ---
61
61
  if (this.currentUrl !== null) {
62
- this.clearPolling();
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.clearPolling();
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) {
@@ -118,10 +118,14 @@ export class Datasource {
118
118
  }
119
119
  }
120
120
  /**
121
- * Returns `true` if the text starts with `http://` or `https://`.
121
+ * Returns `true` if the text is a fetchable URL: an absolute `http(s)://`
122
+ * URL, or a same-origin path starting with `/` (but not `//`, which is a
123
+ * protocol-relative URL we treat as inline-mode escape).
122
124
  */
123
125
  isUrl(text) {
124
- return text.startsWith("http://") || text.startsWith("https://");
126
+ if (text.startsWith("http://") || text.startsWith("https://"))
127
+ return true;
128
+ return text.startsWith("/") && !text.startsWith("//");
125
129
  }
126
130
  /**
127
131
  * Fetches JSON from the given URL and stores the result.
@@ -145,19 +149,26 @@ export class Datasource {
145
149
  this.publish([]);
146
150
  }
147
151
  }
148
- /** Stops the polling timer and cancels any in-flight fetch. */
149
- clearPolling() {
150
- var _a;
152
+ /** Stops the polling timer (does NOT touch any in-flight fetch). */
153
+ clearPollTimer() {
151
154
  if (this.pollTimerId !== null) {
152
155
  clearInterval(this.pollTimerId);
153
156
  this.pollTimerId = null;
154
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();
155
164
  (_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
156
165
  this.abortController = null;
157
166
  }
158
- /** Starts (or restarts) the polling timer if in URL mode with a positive interval. */
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. */
159
170
  startPolling() {
160
- this.clearPolling();
171
+ this.clearPollTimer();
161
172
  if (this.currentUrl && this.interval > 0) {
162
173
  this.pollTimerId = setInterval(() => {
163
174
  if (this.currentUrl) {
@@ -167,7 +178,7 @@ export class Datasource {
167
178
  }
168
179
  }
169
180
  render() {
170
- return h(Host, { key: '4c79b32d893865fe7c62118d4186b8175294636f' });
181
+ return h(Host, { key: '2af6ade861fa900974deeb1b6bcc4520997a4180' });
171
182
  }
172
183
  static get is() { return "bn-datasource"; }
173
184
  static get originalStyleUrls() {
@@ -14,6 +14,11 @@
14
14
  display: inline-flex;
15
15
  }
16
16
 
17
+ ::slotted(*) {
18
+ flex: 1 1 auto;
19
+ min-width: 0;
20
+ }
21
+
17
22
  .image {
18
23
  margin-right: 0.5em;
19
24
  margin-top: 0.5em;
@@ -175,11 +175,14 @@ export class LayoutCard {
175
175
  return "minmax(0, 1fr)";
176
176
  return this.calculateFractions(matches[0]);
177
177
  }
178
- getGridTemplateRows(name) {
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
- const rowCount = matches ? matches.length : 1;
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
  }
@@ -273,7 +276,7 @@ export class LayoutCard {
273
276
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
274
277
  return (
275
278
  // @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" })));
279
+ h("bn-card", { key: '513dd28a363a379adda77f55ea1de0f144589096', styles: this.styles, class: this.setCardClass() }, h("div", { key: '3d354cd83db250d243cfaf8de4abe4c7bfd2ec5b', class: "cardtitle" }, h("bn-title", { key: 'b8dfc27dfe59b8344139e09611bbbe80ab5d5cd1', 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: '69179e29f6ee21589352af938d7fe508a42d26ce' }, h("div", { key: '15c232a8887f01c86b0d977cb2f4fa1fb7b5fd53', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), h("bn-footer", { key: '9f04fc230ea3a419c308a36ab03cb77b58d950f1', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
277
280
  }
278
281
  static get is() { return "bn-layout-card"; }
279
282
  static get encapsulation() { return "shadow"; }
@@ -5,4 +5,9 @@
5
5
  font-size: var(--bn-font-size, 13.3333px);
6
6
  display: block;
7
7
  overflow: hidden;
8
+ }
9
+
10
+ ::slotted(*) {
11
+ flex: 1 1 auto;
12
+ min-width: 0;
8
13
  }
@@ -143,11 +143,14 @@ export class LayoutPage {
143
143
  gap: this.pageGridGap + "px",
144
144
  };
145
145
  }
146
- getGridTemplateRows(name) {
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
- const rowCount = matches ? matches.length : 1;
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
  }
@@ -241,7 +244,7 @@ export class LayoutPage {
241
244
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
242
245
  return (
243
246
  // @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 })));
247
+ h("bn-page", { key: 'ff44575cdb898cb284bd5cd2cefbe3fa30557ad7', styles: this.styles, format: this.pageFormat, orientation: this.pageOrientation }, h("bn-message", { key: '76282ce0765669b72a96135f5bbd08296b267c99', text: this.messageText, image: this.messageImage }), h("bn-title", { key: '2493351a6d031f0a015197c83e876969a99647c3', 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: 'f85e7bd896773f867d32d8cfeb6ab71e534db5b2' }, h("div", { key: '8ed820659c9482129670c6d00690ab8d7560dbfc', style: style, "data-bn-fit-content": this.pageFitToContent ? String(this.getRowCount(this.pageLayout)) : null }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'd796066a1c561d5966882ee3642ebe1ee591e0be', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber })));
245
248
  }
246
249
  static get is() { return "bn-layout-page"; }
247
250
  static get encapsulation() { return "shadow"; }