@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
@@ -2,10 +2,10 @@
2
2
 
3
3
  var index = require('./index-CDKG4xmO.js');
4
4
  var withHasError = require('./withHasError-Cl2gTQzA.js');
5
- var contextProtocol = require('./context-protocol-Op7uUwN3.js');
5
+ var contextProtocol = require('./context-protocol-Cn5PL928.js');
6
6
  var withBodyObserver = require('./withBodyObserver-BKUE_ypL.js');
7
- var withStyled = require('./withStyled-C2kmGAK3.js');
8
- var scaling = require('./scaling-57N4Cxb_.js');
7
+ var withStyled = require('./withStyled-Dx3uRw9g.js');
8
+ var scaling = require('./scaling-DM2UILdF.js');
9
9
 
10
10
  const bnAssetCss = () => `:host{display:none}`;
11
11
 
@@ -1914,6 +1914,8 @@ const Chart = class {
1914
1914
  this.pixelPerUnitGroupMap = new Map();
1915
1915
  this._autoScaleGuard = false;
1916
1916
  this._lastObservedWidth = 0;
1917
+ this._settleTimer = null;
1918
+ this._lastAppliedHeight = 0;
1917
1919
  withStyled.withStyled(this);
1918
1920
  withHasError.withComponentStatus(this);
1919
1921
  scaling.withDataset(this, (name, _data) => {
@@ -2043,17 +2045,53 @@ const Chart = class {
2043
2045
  index.forceUpdate(this);
2044
2046
  });
2045
2047
  });
2048
+ this.settleParentHeight();
2049
+ }
2050
+ /**
2051
+ * The initial renders can measure mid-hydration, before ancestor CSS
2052
+ * (fixed page height, overflow) is applied, so the height used for
2053
+ * auto-fit may be a transient value — and the resize observer above
2054
+ * deliberately ignores height changes. Re-measure on a short backoff
2055
+ * schedule and re-render when the measurement no longer matches the
2056
+ * height the last render actually used (_lastAppliedHeight, recorded
2057
+ * in prepareDimension). The schedule is finite, so this cannot feed a
2058
+ * render loop.
2059
+ */
2060
+ settleParentHeight() {
2061
+ const delays = [150, 400, 1000, 2500];
2062
+ const check = () => {
2063
+ this._settleTimer = null;
2064
+ if (!this.element.isConnected)
2065
+ return;
2066
+ const { height } = scaling.getParentDimensions(this.element);
2067
+ // 8px threshold: hydration corrections are large (hundreds of px);
2068
+ // small jitter must not cause re-renders, because every re-render
2069
+ // gives the width-overflow font scaler a chance to ratchet down.
2070
+ if (height > 0 && Math.abs(height - this._lastAppliedHeight) > 8 && !this._autoScaleGuard) {
2071
+ index.forceUpdate(this);
2072
+ }
2073
+ const next = delays.shift();
2074
+ if (next !== undefined) {
2075
+ this._settleTimer = setTimeout(check, next);
2076
+ }
2077
+ };
2078
+ this._settleTimer = setTimeout(check, delays.shift());
2046
2079
  }
2047
2080
  disconnectedCallback() {
2048
2081
  var _a;
2049
2082
  (_a = this.layoutObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
2050
2083
  this.layoutObserver = null;
2084
+ if (this._settleTimer != null) {
2085
+ clearTimeout(this._settleTimer);
2086
+ this._settleTimer = null;
2087
+ }
2051
2088
  }
2052
2089
  prepareDimension() {
2053
2090
  const parent = scaling.getParentDimensions(this.element);
2054
2091
  const scenariosList = this.prepareScenarios();
2055
2092
  const variancesList = this.prepareVariances();
2056
2093
  this.canvasWidthSegmented = parent.width / (scenariosList.length + variancesList.length || 1);
2094
+ this._lastAppliedHeight = parent.height;
2057
2095
  return { width: this.canvasWidthSegmented, height: parent.height };
2058
2096
  }
2059
2097
  prepareScenarios() {
@@ -2457,7 +2495,7 @@ const Chart = class {
2457
2495
  scenariosArray = [...scenariosArray, ...variancesArray];
2458
2496
  }
2459
2497
  const fontStyles = this.getFontStyles();
2460
- return (index.h(index.Host, { key: 'fbef96ebdfa241564095c6def748082bfec0e6a4', style: fontStyles }, index.h("div", { key: '77d3168f126a779db1e0fbeed2f8a220a2f36792', class: "container" }, scenariosArray.map(this.chartTemplate))));
2498
+ return (index.h(index.Host, { key: '8c90dcaacd6b4e1b64b1fb4a8aefe1345086e7e6', style: fontStyles }, index.h("div", { key: 'c0209d2fd9fcf5ee60c3f17697c7bcbf1b445fec', class: "container" }, scenariosArray.map(this.chartTemplate))));
2461
2499
  }
2462
2500
  get element() { return index.getElement(this); }
2463
2501
  static get watchers() { return {
@@ -3299,7 +3337,7 @@ const Dataset = class {
3299
3337
  }
3300
3338
  // --- Leaving URL mode → clean up ---
3301
3339
  if (this.currentUrl !== null) {
3302
- this.clearPolling();
3340
+ this.cancelInFlight();
3303
3341
  this.currentUrl = null;
3304
3342
  }
3305
3343
  let contentHash;
@@ -3417,7 +3455,7 @@ const Dataset = class {
3417
3455
  }
3418
3456
  disconnectedCallback() {
3419
3457
  var _a, _b;
3420
- this.clearPolling();
3458
+ this.cancelInFlight();
3421
3459
  if (((_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db) && this.name) {
3422
3460
  const db = this.stores.db.db;
3423
3461
  try {
@@ -3438,10 +3476,14 @@ const Dataset = class {
3438
3476
  }
3439
3477
  }
3440
3478
  /**
3441
- * Returns `true` if the text starts with `http://` or `https://`.
3479
+ * Returns `true` if the text is a fetchable URL: an absolute `http(s)://`
3480
+ * URL, or a same-origin path starting with `/` (but not `//`, which is a
3481
+ * protocol-relative URL we treat as inline-mode escape).
3442
3482
  */
3443
3483
  isUrl(text) {
3444
- return text.startsWith("http://") || text.startsWith("https://");
3484
+ if (text.startsWith("http://") || text.startsWith("https://"))
3485
+ return true;
3486
+ return text.startsWith("/") && !text.startsWith("//");
3445
3487
  }
3446
3488
  /**
3447
3489
  * Fetches JSON from the given URL and stores the result as the dataset.
@@ -3471,19 +3513,26 @@ const Dataset = class {
3471
3513
  this.publish([]);
3472
3514
  }
3473
3515
  }
3474
- /** Stops the polling timer and cancels any in-flight fetch. */
3475
- clearPolling() {
3476
- var _a;
3516
+ /** Stops the polling timer (does NOT touch any in-flight fetch). */
3517
+ clearPollTimer() {
3477
3518
  if (this.pollTimerId !== null) {
3478
3519
  clearInterval(this.pollTimerId);
3479
3520
  this.pollTimerId = null;
3480
3521
  }
3522
+ }
3523
+ /** Stops the polling timer AND cancels any in-flight fetch. Use only when
3524
+ * leaving URL mode entirely (disconnect or body changed to inline). */
3525
+ cancelInFlight() {
3526
+ var _a;
3527
+ this.clearPollTimer();
3481
3528
  (_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
3482
3529
  this.abortController = null;
3483
3530
  }
3484
- /** Starts (or restarts) the polling timer if in URL mode with a positive interval. */
3531
+ /** Starts (or restarts) the polling timer if in URL mode with a positive
3532
+ * interval. Does NOT abort the kick-off fetch issued by the caller — it
3533
+ * only resets the interval timer. */
3485
3534
  startPolling() {
3486
- this.clearPolling();
3535
+ this.clearPollTimer();
3487
3536
  if (this.currentUrl && this.interval > 0) {
3488
3537
  this.pollTimerId = setInterval(() => {
3489
3538
  if (this.currentUrl) {
@@ -3493,7 +3542,7 @@ const Dataset = class {
3493
3542
  }
3494
3543
  }
3495
3544
  render() {
3496
- return index.h(index.Host, { key: 'fa02248ff99fc299f0ed7c7feae63063d071685a' });
3545
+ return index.h(index.Host, { key: 'a02f22a7f78c3bd2512e013ff729487c471ba9bf' });
3497
3546
  }
3498
3547
  get element() { return index.getElement(this); }
3499
3548
  static get watchers() { return {
@@ -3550,7 +3599,7 @@ const Datasource = class {
3550
3599
  }
3551
3600
  // --- Leaving URL mode → clean up ---
3552
3601
  if (this.currentUrl !== null) {
3553
- this.clearPolling();
3602
+ this.cancelInFlight();
3554
3603
  this.currentUrl = null;
3555
3604
  }
3556
3605
  // --- Inline JSON / compressed mode ---
@@ -3594,7 +3643,7 @@ const Datasource = class {
3594
3643
  }
3595
3644
  disconnectedCallback() {
3596
3645
  var _a, _b;
3597
- this.clearPolling();
3646
+ this.cancelInFlight();
3598
3647
  const db = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db;
3599
3648
  if (db && this.name) {
3600
3649
  if (db.tables[this.name] != null) {
@@ -3609,10 +3658,14 @@ const Datasource = class {
3609
3658
  }
3610
3659
  }
3611
3660
  /**
3612
- * Returns `true` if the text starts with `http://` or `https://`.
3661
+ * Returns `true` if the text is a fetchable URL: an absolute `http(s)://`
3662
+ * URL, or a same-origin path starting with `/` (but not `//`, which is a
3663
+ * protocol-relative URL we treat as inline-mode escape).
3613
3664
  */
3614
3665
  isUrl(text) {
3615
- return text.startsWith("http://") || text.startsWith("https://");
3666
+ if (text.startsWith("http://") || text.startsWith("https://"))
3667
+ return true;
3668
+ return text.startsWith("/") && !text.startsWith("//");
3616
3669
  }
3617
3670
  /**
3618
3671
  * Fetches JSON from the given URL and stores the result.
@@ -3636,19 +3689,26 @@ const Datasource = class {
3636
3689
  this.publish([]);
3637
3690
  }
3638
3691
  }
3639
- /** Stops the polling timer and cancels any in-flight fetch. */
3640
- clearPolling() {
3641
- var _a;
3692
+ /** Stops the polling timer (does NOT touch any in-flight fetch). */
3693
+ clearPollTimer() {
3642
3694
  if (this.pollTimerId !== null) {
3643
3695
  clearInterval(this.pollTimerId);
3644
3696
  this.pollTimerId = null;
3645
3697
  }
3698
+ }
3699
+ /** Stops the polling timer AND cancels any in-flight fetch. Use only when
3700
+ * leaving URL mode entirely (disconnect or body changed to inline). */
3701
+ cancelInFlight() {
3702
+ var _a;
3703
+ this.clearPollTimer();
3646
3704
  (_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
3647
3705
  this.abortController = null;
3648
3706
  }
3649
- /** Starts (or restarts) the polling timer if in URL mode with a positive interval. */
3707
+ /** Starts (or restarts) the polling timer if in URL mode with a positive
3708
+ * interval. Does NOT abort the kick-off fetch issued by the caller — it
3709
+ * only resets the interval timer. */
3650
3710
  startPolling() {
3651
- this.clearPolling();
3711
+ this.clearPollTimer();
3652
3712
  if (this.currentUrl && this.interval > 0) {
3653
3713
  this.pollTimerId = setInterval(() => {
3654
3714
  if (this.currentUrl) {
@@ -3658,7 +3718,7 @@ const Datasource = class {
3658
3718
  }
3659
3719
  }
3660
3720
  render() {
3661
- return index.h(index.Host, { key: '4c79b32d893865fe7c62118d4186b8175294636f' });
3721
+ return index.h(index.Host, { key: '2af6ade861fa900974deeb1b6bcc4520997a4180' });
3662
3722
  }
3663
3723
  get element() { return index.getElement(this); }
3664
3724
  static get watchers() { return {
@@ -3722,7 +3782,7 @@ const Footer$1 = class Footer {
3722
3782
  };
3723
3783
  Footer$1.style = bnFooterCss();
3724
3784
 
3725
- const bnLayoutCardCss = () => `:host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.cardtitle{display:inline-flex}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}`;
3785
+ const bnLayoutCardCss = () => `:host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.cardtitle{display:inline-flex}::slotted(*){flex:1 1 auto;min-width:0}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}`;
3726
3786
 
3727
3787
  const LayoutCard = class {
3728
3788
  constructor(hostRef) {
@@ -3898,11 +3958,14 @@ const LayoutCard = class {
3898
3958
  return "minmax(0, 1fr)";
3899
3959
  return this.calculateFractions(matches[0]);
3900
3960
  }
3901
- getGridTemplateRows(name) {
3961
+ getRowCount(name) {
3902
3962
  const template = this.getTemplatePattern(name);
3903
3963
  const pattern = /"[\w\d\s.]+"/g;
3904
3964
  const matches = template.match(pattern);
3905
- const rowCount = matches ? matches.length : 1;
3965
+ return matches ? matches.length : 1;
3966
+ }
3967
+ getGridTemplateRows(name) {
3968
+ const rowCount = this.getRowCount(name);
3906
3969
  if (this.cardFitToContent) {
3907
3970
  return Array(rowCount).fill("auto").join(" ");
3908
3971
  }
@@ -3996,13 +4059,13 @@ const LayoutCard = class {
3996
4059
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
3997
4060
  return (
3998
4061
  // @ts-ignore
3999
- index.h("bn-card", { key: 'c39b6a8cf843b7b8d9b380215a3553288acd3647', styles: this.styles, class: this.setCardClass() }, index.h("div", { key: '3206bff73cb01fad7223e3fd889e015992e535c6', class: "cardtitle" }, index.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 !== "" ? (index.h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), index.h("bn-body", { key: 'f56b1b70127cd2173e425cf723dbea2b62037d88' }, index.h("div", { key: 'e5766b5b28dd1d14fdbaf721baf72668502fcbec', style: style }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: 'bafb89f89c89aaf0e31fa754f0e834330b031627', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
4062
+ index.h("bn-card", { key: '513dd28a363a379adda77f55ea1de0f144589096', styles: this.styles, class: this.setCardClass() }, index.h("div", { key: '3d354cd83db250d243cfaf8de4abe4c7bfd2ec5b', class: "cardtitle" }, index.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 !== "" ? (index.h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), index.h("bn-body", { key: '69179e29f6ee21589352af938d7fe508a42d26ce' }, index.h("div", { key: '15c232a8887f01c86b0d977cb2f4fa1fb7b5fd53', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: '9f04fc230ea3a419c308a36ab03cb77b58d950f1', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
4000
4063
  }
4001
4064
  get element() { return index.getElement(this); }
4002
4065
  };
4003
4066
  LayoutCard.style = bnLayoutCardCss();
4004
4067
 
4005
- const bnLayoutPageCss = () => `:host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;overflow:hidden}`;
4068
+ const bnLayoutPageCss = () => `:host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;overflow:hidden}::slotted(*){flex:1 1 auto;min-width:0}`;
4006
4069
 
4007
4070
  const LayoutPage = class {
4008
4071
  constructor(hostRef) {
@@ -4148,11 +4211,14 @@ const LayoutPage = class {
4148
4211
  gap: this.pageGridGap + "px",
4149
4212
  };
4150
4213
  }
4151
- getGridTemplateRows(name) {
4214
+ getRowCount(name) {
4152
4215
  const template = this.getTemplateAreas(name);
4153
4216
  const pattern = /"[\w\d\s.]+"/g;
4154
4217
  const matches = template.match(pattern);
4155
- const rowCount = matches ? matches.length : 1;
4218
+ return matches ? matches.length : 1;
4219
+ }
4220
+ getGridTemplateRows(name) {
4221
+ const rowCount = this.getRowCount(name);
4156
4222
  if (this.pageFitToContent) {
4157
4223
  return Array(rowCount).fill("auto").join(" ");
4158
4224
  }
@@ -4246,7 +4312,7 @@ const LayoutPage = class {
4246
4312
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
4247
4313
  return (
4248
4314
  // @ts-ignore
4249
- index.h("bn-page", { key: '958dbce3b000c62d287f6263fed495523786e28d', styles: this.styles, format: this.pageFormat, orientation: this.pageOrientation }, index.h("bn-message", { key: 'cdb559c63a0466ccaa1cd807d027dd127e3b3efe', text: this.messageText, image: this.messageImage }), index.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 }), index.h("bn-body", { key: '93c9f7b2c345c8bc6fdb20d35fa406ee919379eb' }, index.h("div", { key: '64e4db5a7b6265bcd73b700227b5f033c99facdc', style: style }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: 'f7b69e9fcfbdde742a2d547f81c50dd78a3ed02f', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber })));
4315
+ index.h("bn-page", { key: 'ff44575cdb898cb284bd5cd2cefbe3fa30557ad7', styles: this.styles, format: this.pageFormat, orientation: this.pageOrientation }, index.h("bn-message", { key: '76282ce0765669b72a96135f5bbd08296b267c99', text: this.messageText, image: this.messageImage }), index.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 }), index.h("bn-body", { key: 'f85e7bd896773f867d32d8cfeb6ab71e534db5b2' }, index.h("div", { key: '8ed820659c9482129670c6d00690ab8d7560dbfc', style: style, "data-bn-fit-content": this.pageFitToContent ? String(this.getRowCount(this.pageLayout)) : null }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: 'd796066a1c561d5966882ee3642ebe1ee591e0be', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber })));
4250
4316
  }
4251
4317
  get element() { return index.getElement(this); }
4252
4318
  };
@@ -4739,6 +4805,17 @@ const Table$1 = class Table {
4739
4805
  * ```
4740
4806
  */
4741
4807
  this.columnthereof = null;
4808
+ /**
4809
+ * Stringified JSON object defining custom columns computed from dataset fields.<br />
4810
+ * Keys are column labels, values are aggregate expressions over the rows that
4811
+ * make up each table row.<br /><br />
4812
+ * Functions: ```set // first // last // min // max // avg // sum // lit```<br />
4813
+ * Fields can be standard dataset fields (e.g. ```ac1```) or custom fields
4814
+ * prefixed with ```_``` (e.g. ```_leiter```); ```lit``` takes a constant value.<br /><br />
4815
+ * example:<br />
4816
+ * ```{"Verkaufsleiter": "set(_leiter)", "Umsatz gesamt": "sum(ac1)"}```
4817
+ */
4818
+ this.tableAttributes = "";
4742
4819
  this._autoScaleGuard = false;
4743
4820
  withStyled.withStyled(this);
4744
4821
  withHasError.withComponentStatus(this);
@@ -5077,6 +5154,20 @@ const Table$1 = class Table {
5077
5154
  this.errors.remove(errId);
5078
5155
  }
5079
5156
  }
5157
+ validateTableAttributes(newValue) {
5158
+ const errId = "ERR_attributes";
5159
+ const invalidElements = withStyled.validateAttributesJsonStr(newValue);
5160
+ if (invalidElements.length > 0) {
5161
+ this.errors.addOrReplace({
5162
+ id: errId,
5163
+ type: "warning",
5164
+ message: "attributes: invalid value(s) '" + JSON.stringify(invalidElements) + "' are not supported.",
5165
+ });
5166
+ }
5167
+ else {
5168
+ this.errors.remove(errId);
5169
+ }
5170
+ }
5080
5171
  componentWillLoad() {
5081
5172
  this.validateScenario(this.scenarios);
5082
5173
  this.validateVariances(this.variances);
@@ -5095,6 +5186,7 @@ const Table$1 = class Table {
5095
5186
  this.validateMeasureType(this.measureType);
5096
5187
  this.validateMeasureScale(this.measureScale);
5097
5188
  this.validateColumnThereOf(this.columnthereof);
5189
+ this.validateTableAttributes(this.tableAttributes);
5098
5190
  this.validateShowMeasureScale(this.showMeasureScale);
5099
5191
  this.validateBarColumns(this.barColumns);
5100
5192
  this.validateBarColumnWidth(this.barColumnWidth);
@@ -5243,7 +5335,7 @@ const Table$1 = class Table {
5243
5335
  return formatDigits;
5244
5336
  }
5245
5337
  prepareScenarios() {
5246
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5338
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k;
5247
5339
  const inheritedScenarios = this.resolveInherited("scenarios", this.scenarios);
5248
5340
  const inheritedVariances = this.resolveInherited("variances", this.variances);
5249
5341
  if (inheritedScenarios !== undefined || inheritedVariances !== undefined) {
@@ -5282,7 +5374,7 @@ const Table$1 = class Table {
5282
5374
  }
5283
5375
  let scenarios = [];
5284
5376
  if (isAuto || withStyled.isBlankInput(this.scenarios)) {
5285
- if (((_f = (_e = this.datasetMeta) === null || _e === void 0 ? void 0 : _e.availableScenarios) === null || _f === void 0 ? void 0 : _f.length) > 0) {
5377
+ if (((_g = (_f = this.datasetMeta) === null || _f === void 0 ? void 0 : _f.availableScenarios) === null || _g === void 0 ? void 0 : _g.length) > 0) {
5286
5378
  if (!isAuto) {
5287
5379
  this.errors.addOrReplace({
5288
5380
  id: "AUTO_scenarios",
@@ -5298,10 +5390,10 @@ const Table$1 = class Table {
5298
5390
  }
5299
5391
  else {
5300
5392
  this.errors.remove("AUTO_scenarios");
5301
- scenarios = scenarios.concat((_g = this.scenarios) === null || _g === void 0 ? void 0 : _g.split(","));
5393
+ scenarios = scenarios.concat((_h = this.scenarios) === null || _h === void 0 ? void 0 : _h.split(","));
5302
5394
  }
5303
- if (((_h = this.variances) === null || _h === void 0 ? void 0 : _h.trim().length) > 0) {
5304
- scenarios = scenarios.concat((_j = this.variances) === null || _j === void 0 ? void 0 : _j.split(","));
5395
+ if (((_j = this.variances) === null || _j === void 0 ? void 0 : _j.trim().length) > 0) {
5396
+ scenarios = scenarios.concat((_k = this.variances) === null || _k === void 0 ? void 0 : _k.split(","));
5305
5397
  }
5306
5398
  return scenarios.map((entry) => entry.trim());
5307
5399
  }
@@ -5345,6 +5437,24 @@ const Table$1 = class Table {
5345
5437
  }
5346
5438
  return map;
5347
5439
  }
5440
+ prepareAttributes() {
5441
+ if (this.tableAttributes == null || this.tableAttributes.trim() === "") {
5442
+ return [];
5443
+ }
5444
+ try {
5445
+ const parsedString = JSON.parse(this.tableAttributes);
5446
+ if (parsedString === null || typeof parsedString !== "object" || parsedString instanceof Array) {
5447
+ return [];
5448
+ }
5449
+ return Object.entries(parsedString)
5450
+ .map(([label, expression], index) => typeof expression === "string" ? withStyled.parseTableAttributeExpression(label, `attr_${index}`, expression) : null)
5451
+ .filter((attribute) => attribute !== null);
5452
+ }
5453
+ catch (_e) {
5454
+ // invalid JSON already reported by validateTableAttributes
5455
+ return [];
5456
+ }
5457
+ }
5348
5458
  prepareTableTitle() {
5349
5459
  if (this.tableTitle === "" || this.tableTitle == null) {
5350
5460
  return "SUM_TOTAL";
@@ -5462,7 +5572,7 @@ const Table$1 = class Table {
5462
5572
  render() {
5463
5573
  const fontStyles = this.getFontStyles();
5464
5574
  const effectiveFactor = this.getEffectiveScaleFactor();
5465
- return (index.h(index.Host, { key: '469aa0d5b00e111af96d33764640fa92eb5ed5cc', style: fontStyles }, index.h("div", { key: 'f02443601b7e644c243b48ad09af411a8460b659' }, index.h("ibcs-table", { key: '242ee74a5715c83a267e3f02daab09b9baca0c57', tableName: this.datasetName, dataVersion: this.dataVersion, "table-title": this.prepareTableTitle(), scenarios: this.prepareScenarios(), "scenarios-data-format": this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), type: this.prepareTableType(), "category-width": this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), "i18n-mode": this.prepareI18nMode(), "measure-scale": this.prepareMeasureScale(), "measure-type": this.prepareMeasureType(), "measure-unit": this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), scaleFactor: effectiveFactor }))));
5575
+ return (index.h(index.Host, { key: 'ed9804ea731fbaa0ec730c0392bcd18bb0ac278a', style: fontStyles }, index.h("div", { key: '011a543cca60ec8c871db6a6280999047437ce98' }, index.h("ibcs-table", { key: '4b7d717c3a7c9ed4c44b90dc66b4b8e6c9359cb0', tableName: this.datasetName, dataVersion: this.dataVersion, "table-title": this.prepareTableTitle(), scenarios: this.prepareScenarios(), "scenarios-data-format": this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), "category-width": this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), "i18n-mode": this.prepareI18nMode(), "measure-scale": this.prepareMeasureScale(), "measure-type": this.prepareMeasureType(), "measure-unit": this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), scaleFactor: effectiveFactor }))));
5466
5576
  }
5467
5577
  get element() { return index.getElement(this); }
5468
5578
  static get watchers() { return {
@@ -5534,6 +5644,9 @@ const Table$1 = class Table {
5534
5644
  }],
5535
5645
  "columnthereof": [{
5536
5646
  "validateColumnThereOf": 0
5647
+ }],
5648
+ "tableAttributes": [{
5649
+ "validateTableAttributes": 0
5537
5650
  }]
5538
5651
  }; }
5539
5652
  };
@@ -13585,7 +13698,7 @@ makeMorphable();
13585
13698
  */
13586
13699
  let ElementPositions$1 = class ElementPositions {
13587
13700
  // private smallestDataPoint: DataPoint;
13588
- constructor(padding, scaleFactors, fontSize, numberOfColumns, leftSideLengthSync, titleLength, leftSideWidth, categoryWidth) {
13701
+ constructor(padding, scaleFactors, fontSize, numberOfColumns, leftSideLengthSync, titleLength, leftSideWidth, categoryWidth, hasStackedHeaders = false) {
13589
13702
  this.categoryPosition = { x: 0, y: 0 };
13590
13703
  this.spacings = {
13591
13704
  scenarioOffset: 0,
@@ -13615,6 +13728,7 @@ let ElementPositions$1 = class ElementPositions {
13615
13728
  this.numberOfColumns = numberOfColumns;
13616
13729
  this.leftSideLengthSync = leftSideLengthSync;
13617
13730
  this.topSideLabelHeight = titleLength > 0 ? this.fontSize : 0;
13731
+ this.hasStackedHeaders = hasStackedHeaders;
13618
13732
  this.leftSideLabelLength = this.calculateSideLabelLength(titleLength, leftSideWidth, categoryWidth);
13619
13733
  this.calculateSpacings();
13620
13734
  this.calculateCategoryPosition();
@@ -13643,7 +13757,10 @@ let ElementPositions$1 = class ElementPositions {
13643
13757
  return this.axisPosition.x;
13644
13758
  }
13645
13759
  getAxisTitlePositionY() {
13646
- return this.axisPosition.y - this.spacings.labelToAxis;
13760
+ return this.axisPosition.y - this.spacings.labelToAxis - this.getTopLabelOverhang();
13761
+ }
13762
+ getStackedHeaderPositionY() {
13763
+ return this.getBarCenterPositionY(0) - this.spacings.barWidth * 0.5 - this.spacings.scenarioLabelToBar;
13647
13764
  }
13648
13765
  getNeedleWidth() {
13649
13766
  return this.spacings.needleWidth;
@@ -13699,7 +13816,12 @@ let ElementPositions$1 = class ElementPositions {
13699
13816
  }
13700
13817
  getScenarioLabelPositionOffsetY(isPrimaryBar) {
13701
13818
  if (isPrimaryBar) {
13702
- return this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar;
13819
+ // The label belongs to the last bar, but the axis line runs past that bar's
13820
+ // center by (categoryWidth - scenarioOffset); place the label below the axis
13821
+ // end so the line does not strike through it.
13822
+ const belowBar = this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar;
13823
+ const belowAxisEnd = this.spacings.categoryWidth - this.spacings.scenarioOffset + this.spacings.labelToAxis;
13824
+ return Math.max(belowBar, belowAxisEnd);
13703
13825
  }
13704
13826
  return -(this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar);
13705
13827
  }
@@ -13761,7 +13883,40 @@ let ElementPositions$1 = class ElementPositions {
13761
13883
  this.calculateAxisPosition();
13762
13884
  }
13763
13885
  getAxisTitleOffset() {
13764
- return this.topSideLabelHeight;
13886
+ // Title height plus the gap to the labels that can stick out above the first bar
13887
+ return this.topSideLabelHeight + this.spacings.labelToAxis + this.getTopLabelOverhang();
13888
+ }
13889
+ getTopLabelOverhang() {
13890
+ return this.hasStackedHeaders ? this.getStackedHeaderOverhang() : this.getTopScenarioLabelOverhang();
13891
+ }
13892
+ /**
13893
+ * How far the stacked-segment header row (anchored just above the first bar)
13894
+ * reaches above the axis start. The title is moved up by this amount so the
13895
+ * header row sits between title and bars without overlapping either.
13896
+ */
13897
+ getStackedHeaderOverhang() {
13898
+ return Math.max(0, this.fontSize +
13899
+ this.spacings.scenarioLabelToBar +
13900
+ this.spacings.barWidth * 0.5 -
13901
+ (this.spacings.categoryWidth * 0.5 + this.spacings.scenarioOffset));
13902
+ }
13903
+ /**
13904
+ * How far the scenario labels above the first bar (secondary bar label) or
13905
+ * above the first marker (primary marker label) reach above the axis start.
13906
+ * The title is moved up by this amount so it does not overlap them.
13907
+ */
13908
+ getTopScenarioLabelOverhang() {
13909
+ const barLabelOverhang = this.fontSize +
13910
+ this.spacings.barWidth * 0.5 +
13911
+ this.spacings.scenarioLabelToBar -
13912
+ this.spacings.categoryWidth * 0.5;
13913
+ const markerLabelOverhang = this.fontSize +
13914
+ this.spacings.markerWidth * 0.5 +
13915
+ this.spacings.scenarioLabelToBar +
13916
+ this.spacings.markerOffset +
13917
+ this.spacings.barWidth * 0.5 -
13918
+ (this.spacings.categoryWidth * 0.5 + this.spacings.scenarioOffset);
13919
+ return Math.max(0, barLabelOverhang, markerLabelOverhang);
13765
13920
  }
13766
13921
  calculateSideLabelLength(titleLength, leftSideWidth, categoryWidth) {
13767
13922
  if (this.leftSideLengthSync) {
@@ -15680,6 +15835,7 @@ class StructureChart {
15680
15835
  this.measureUnit = "";
15681
15836
  this.dataFormatDigits = { percent: 2, decimal: 1 };
15682
15837
  this.stackConfig = null;
15838
+ this.scenarioPropOrder = [];
15683
15839
  this.overflowConfig = null;
15684
15840
  this.highestStackedTotal = 0;
15685
15841
  this.fromExpr = "";
@@ -15702,7 +15858,7 @@ class StructureChart {
15702
15858
  if (this.titleLength > leftSideWidth) {
15703
15859
  leftSideWidth = this.titleLength;
15704
15860
  }
15705
- return new ElementPositions$1(new Padding$2(this.styles.padding), this.styles.scaleFactors, this.styles.fontStyles.size, this.dataModel.length, this.leftSideOffsetForHorizontalSync, this.titleLength, leftSideWidth, categoryWidth);
15861
+ return new ElementPositions$1(new Padding$2(this.styles.padding), this.styles.scaleFactors, this.styles.fontStyles.size, this.dataModel.length, this.leftSideOffsetForHorizontalSync, this.titleLength, leftSideWidth, categoryWidth, !!this.stackConfig && this.variancesDataModel.length === 0);
15706
15862
  }
15707
15863
  setStyles(newStyle) {
15708
15864
  this.styles = newStyle;
@@ -15710,16 +15866,17 @@ class StructureChart {
15710
15866
  setConfig(config) {
15711
15867
  var _a;
15712
15868
  this.state = FactoryState$2.DIRTY;
15713
- this.sortScenariosbyVisualisationRules(config);
15869
+ this.scenarioPropOrder = [...config.scenarios];
15870
+ const scenarios = this.sortScenariosbyVisualisationRules(config.scenarios);
15714
15871
  this.hideCategories = config.hideCategories || false;
15715
15872
  this.limit = config.limit;
15716
15873
  this.pixelPerUnit = config.pixelPerUnit || 1;
15717
15874
  this.pixelPerPercentage = config.pixelPerPercentage || 100;
15718
15875
  this.setSource(config.filter);
15719
- this.dataModel = this.populateModel(config.scenarios, config.level, config.sortOrder);
15876
+ this.dataModel = this.populateModel(scenarios, config.level, config.sortOrder);
15720
15877
  // Populate per-dimension stack segments when stacking by a data dimension
15721
15878
  if (config.stackConfig && config.stackConfig.by !== withStyled.StackBy.SCENARIOS) {
15722
- this.populateDimensionStackSegments(config.scenarios, config.stackConfig, config.level);
15879
+ this.populateDimensionStackSegments(scenarios, config.stackConfig, config.level);
15723
15880
  }
15724
15881
  this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
15725
15882
  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);
@@ -15735,9 +15892,10 @@ class StructureChart {
15735
15892
  this.highestStackedTotal = this.findHighestStackedRowTotal(this.dataModel);
15736
15893
  this.updatePosition();
15737
15894
  }
15738
- sortScenariosbyVisualisationRules(config) {
15895
+ /** Returns a new array; the input keeps the `scenarios` prop order (the config is reused across rebuilds). */
15896
+ sortScenariosbyVisualisationRules(scenarios) {
15739
15897
  const self = this;
15740
- config.scenarios
15898
+ return [...scenarios]
15741
15899
  .sort((n1, n2) => {
15742
15900
  return self.ruleSet.getScenarioSorIndex(n1) - self.ruleSet.getScenarioSorIndex(n2);
15743
15901
  })
@@ -15854,8 +16012,10 @@ class StructureChart {
15854
16012
  return width;
15855
16013
  }
15856
16014
  getAllocatedCanvasHeight() {
15857
- return ((this.dataModel.length + 1) * this.position.spacings.categoryWidth +
15858
- this.styles.padding.top +
16015
+ // Axis end plus the scenario label hanging below it (see getScenarioLabelPositionOffsetY)
16016
+ return (this.position.getAxisEndPositionY() +
16017
+ this.position.spacings.labelToAxis +
16018
+ this.position.fontSize +
15859
16019
  this.styles.padding.bottom);
15860
16020
  }
15861
16021
  patternToString() {
@@ -16275,6 +16435,17 @@ class StructureChart {
16275
16435
  });
16276
16436
  return barsGroup;
16277
16437
  }
16438
+ /** Restore the original `scenarios` prop order for stacked segments (IBCS sort reorders the slots). */
16439
+ sortSegmentsByPropOrder(segments) {
16440
+ if (this.scenarioPropOrder.length === 0)
16441
+ return;
16442
+ const order = this.scenarioPropOrder;
16443
+ segments.sort((a, b) => {
16444
+ const ia = order.indexOf(a.scenario);
16445
+ const ib = order.indexOf(b.scenario);
16446
+ return (ia === -1 ? order.length : ia) - (ib === -1 ? order.length : ib);
16447
+ });
16448
+ }
16278
16449
  /**
16279
16450
  * Draw stacked horizontal bars. Supports stacking by scenario or by data dimension.
16280
16451
  * When stacking by scenario with multiple scenario types (e.g. ac+pl),
@@ -16296,6 +16467,7 @@ class StructureChart {
16296
16467
  segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
16297
16468
  }
16298
16469
  }
16470
+ this.sortSegmentsByPropOrder(segments);
16299
16471
  }
16300
16472
  else {
16301
16473
  const dp = elements["scenario1"];
@@ -16401,7 +16573,7 @@ class StructureChart {
16401
16573
  orderedSegs.sort((a, b) => b.value - a.value);
16402
16574
  const total = orderedSegs.reduce((sum, s) => sum + Math.abs(s.value), 0);
16403
16575
  const axisX = this.position.getBarPositionX();
16404
- const headerY = this.position.getAxisTitlePositionY();
16576
+ const headerY = this.position.getStackedHeaderPositionY();
16405
16577
  let cumulativePixels = 0;
16406
16578
  orderedSegs.forEach((seg) => {
16407
16579
  const pixelPerUnit = seg.dataPoint.pixelPerUnit;
@@ -16430,9 +16602,10 @@ class StructureChart {
16430
16602
  }
16431
16603
  if (segments.length === 0)
16432
16604
  return;
16605
+ this.sortSegmentsByPropOrder(segments);
16433
16606
  const prefixes = new Set(segments.map((s) => getScenarioPrefix(s.scenario)));
16434
16607
  const axisX = this.position.getBarPositionX();
16435
- const headerY = this.position.getAxisTitlePositionY();
16608
+ const headerY = this.position.getStackedHeaderPositionY();
16436
16609
  if (prefixes.size > 1) {
16437
16610
  // Overlay mode: one header per group, centered on group's bar extent
16438
16611
  const groupMap = new Map();
@@ -19612,6 +19785,7 @@ class TimeChart {
19612
19785
  this.chartMode = withStyled.ChartMode.BAR;
19613
19786
  this.maxBars = 28;
19614
19787
  this.stackConfig = null;
19788
+ this.scenarioPropOrder = [];
19615
19789
  this.lineFullWidth = true;
19616
19790
  this.availableWidth = 0;
19617
19791
  this.overflowConfig = null;
@@ -19623,7 +19797,7 @@ class TimeChart {
19623
19797
  this.styles = styles;
19624
19798
  this.availableWidth = availableWidth;
19625
19799
  this.setConfig(config);
19626
- this.position = this.createElementPosition(config.scenarios);
19800
+ this.position = this.createElementPosition(this.lastScenarios);
19627
19801
  }
19628
19802
  updatePosition(scenarios) {
19629
19803
  this.position = this.createElementPosition(scenarios);
@@ -19693,7 +19867,8 @@ class TimeChart {
19693
19867
  setConfig(config) {
19694
19868
  var _a;
19695
19869
  this.state = FactoryState$1.DIRTY;
19696
- this.sortScenariosbyVisualisationRules(config);
19870
+ this.scenarioPropOrder = [...config.scenarios];
19871
+ const scenarios = this.sortScenariosbyVisualisationRules(config.scenarios);
19697
19872
  this.setSource(config.filter);
19698
19873
  this.hideAxisLabels = config.hideAxisLabels || false;
19699
19874
  this.pixelPerUnit = config.pixelPerUnit;
@@ -19701,7 +19876,7 @@ class TimeChart {
19701
19876
  this.axisLabelsMode = config.axisLabelsMode;
19702
19877
  this.intervalSpanLimit = config.intervalSpanLimit;
19703
19878
  this.dateInterval = this.findDateInterval(config.dateInterval);
19704
- this.dataModel = this.populateModel(config.scenarios, this.dateInterval, config.level, config.sortOrder);
19879
+ this.dataModel = this.populateModel(scenarios, this.dateInterval, config.level, config.sortOrder);
19705
19880
  this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
19706
19881
  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);
19707
19882
  this.smallestDataPointValue = this.findSmallestDataPointValue(this.dataModel);
@@ -19719,8 +19894,8 @@ class TimeChart {
19719
19894
  this.maxBars = config.maxBars;
19720
19895
  this.stackConfig = config.stackConfig;
19721
19896
  this.lineFullWidth = config.lineFullWidth;
19722
- this.lastScenarios = config.scenarios;
19723
- this.updatePosition(config.scenarios);
19897
+ this.lastScenarios = scenarios;
19898
+ this.updatePosition(scenarios);
19724
19899
  }
19725
19900
  getFooter() {
19726
19901
  if (this.measureScale.value === 1 && this.measureUnit === "") {
@@ -19728,9 +19903,10 @@ class TimeChart {
19728
19903
  }
19729
19904
  return Formatter.translateScenarioLabel("in", this.i18n) + " " + this.measureScale.prefix + this.measureUnit;
19730
19905
  }
19731
- sortScenariosbyVisualisationRules(config) {
19906
+ /** Returns a new array; the input keeps the `scenarios` prop order (the config is reused across rebuilds). */
19907
+ sortScenariosbyVisualisationRules(scenarios) {
19732
19908
  const self = this;
19733
- config.scenarios
19909
+ return [...scenarios]
19734
19910
  .sort((n1, n2) => {
19735
19911
  return self.ruleSet.getScenarioSorIndex(n1) - self.ruleSet.getScenarioSorIndex(n2);
19736
19912
  })
@@ -20534,6 +20710,17 @@ class TimeChart {
20534
20710
  };
20535
20711
  return columnGroup;
20536
20712
  }
20713
+ /** Restore the original `scenarios` prop order for stacked segments (IBCS sort reorders the slots). */
20714
+ sortSegmentsByPropOrder(segments) {
20715
+ if (this.scenarioPropOrder.length === 0)
20716
+ return;
20717
+ const order = this.scenarioPropOrder;
20718
+ segments.sort((a, b) => {
20719
+ const ia = order.indexOf(a.scenario);
20720
+ const ib = order.indexOf(b.scenario);
20721
+ return (ia === -1 ? order.length : ia) - (ib === -1 ? order.length : ib);
20722
+ });
20723
+ }
20537
20724
  /**
20538
20725
  * Draw stacked bar columns. Supports stacking by scenario or by data dimension.
20539
20726
  * When stacking by scenario with multiple scenario types (e.g. ac+pl),
@@ -20555,6 +20742,7 @@ class TimeChart {
20555
20742
  segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
20556
20743
  }
20557
20744
  }
20745
+ this.sortSegmentsByPropOrder(segments);
20558
20746
  }
20559
20747
  else {
20560
20748
  const dp = elements["scenario1"];
@@ -20654,12 +20842,14 @@ class TimeChart {
20654
20842
  }
20655
20843
  if (segments.length === 0)
20656
20844
  return;
20845
+ this.sortSegmentsByPropOrder(segments);
20657
20846
  const prefixes = new Set(segments.map((s) => getScenarioPrefix(s.scenario)));
20658
20847
  const axisY = this.position.getColumnPositionY();
20659
20848
  const xBase = this.position.getColumnCenterPositionX(0) - this.position.getColumnWidth() / 2;
20660
20849
  const labelX = xBase - this.position.spacings.labelToColumn;
20661
20850
  if (prefixes.size > 1) {
20662
- // Overlay mode: one header per group, centered vertically on group's column height
20851
+ // Overlay mode: one header per group — front group centered on its bar,
20852
+ // back groups aligned with their bar's top edge
20663
20853
  const groupMap = new Map();
20664
20854
  for (const seg of segments) {
20665
20855
  const prefix = getScenarioPrefix(seg.scenario);
@@ -20677,11 +20867,15 @@ class TimeChart {
20677
20867
  for (const [prefix, segs] of groupMap) {
20678
20868
  groups.push({ prefix, segments: segs });
20679
20869
  }
20680
- groups.forEach((group) => {
20870
+ groups.forEach((group, groupIdx) => {
20681
20871
  const groupTotal = group.segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
20682
20872
  const pixelPerUnit = group.segments[0].dataPoint.pixelPerUnit;
20683
20873
  const groupPixelHeight = this.stackConfig.mode === withStyled.StackMode.RELATIVE ? pixelPerUnit : groupTotal * pixelPerUnit;
20684
- const centerY = axisY - groupPixelHeight / 2;
20874
+ // The front-most group (drawn last, e.g. AC) is fully visible, so its
20875
+ // label is centered on the bar. Back groups are mostly hidden behind it
20876
+ // and only peek out at the top, so their labels align with the bar's top edge.
20877
+ const isFrontGroup = groupIdx === groups.length - 1;
20878
+ const centerY = isFrontGroup ? axisY - groupPixelHeight / 2 : axisY - groupPixelHeight;
20685
20879
  const labelText = this.i18n.get(group.prefix + "1") || group.prefix.toUpperCase();
20686
20880
  new Label(headerGroup, labelX, centerY, "STACK_HEADER", labelText, this.styles, HookLocation.Center, HookLocation.Right).forceStringTypeDraw();
20687
20881
  });
@@ -20740,6 +20934,15 @@ class TimeChart {
20740
20934
  activeLayers.push(key);
20741
20935
  }
20742
20936
  }
20937
+ if (isScenarioStack && this.scenarioPropOrder.length > 0) {
20938
+ const order = this.scenarioPropOrder;
20939
+ activeLayers.sort((a, b) => {
20940
+ var _a, _b, _c, _d;
20941
+ const ia = order.indexOf((_b = (_a = dataModel[0][a]) === null || _a === void 0 ? void 0 : _a.scenario) !== null && _b !== void 0 ? _b : "");
20942
+ const ib = order.indexOf((_d = (_c = dataModel[0][b]) === null || _c === void 0 ? void 0 : _c.scenario) !== null && _d !== void 0 ? _d : "");
20943
+ return (ia === -1 ? order.length : ia) - (ib === -1 ? order.length : ib);
20944
+ });
20945
+ }
20743
20946
  // Compute cumulative values
20744
20947
  for (let layerIdx = 0; layerIdx < activeLayers.length; layerIdx++) {
20745
20948
  const key = activeLayers[layerIdx];
@@ -21795,6 +21998,7 @@ class DataQuery {
21795
21998
  .map((s) => this.translateScenarioSQL(s, true, this.config.type))
21796
21999
  .toString();
21797
22000
  const relativeScenarios = this.getRelativeScenarios();
22001
+ const attributesSQL = this.config.attributes.map((attribute) => this.translateAttributeSQL(attribute)).toString();
21798
22002
  const groups = new QueryGroups(this.config);
21799
22003
  const groupsAggregated = this.config.grouped ? [QueryColumnNames.ROWGROUP, QueryColumnNames.ROWGROUPINDEX] : [];
21800
22004
  let order = ["", ""];
@@ -21831,7 +22035,7 @@ class DataQuery {
21831
22035
  queryLimitSection = `LIMIT ${this.config.limit}`;
21832
22036
  }
21833
22037
  this.createGroupHeaderRow(rowGroupEntry, queries);
21834
- this.createDataRow(queries, rowGroupEntry, groups, scenarios, queryWhereSection, order, queryLimitSection);
22038
+ this.createDataRow(queries, rowGroupEntry, groups, scenarios, attributesSQL, queryWhereSection, order, queryLimitSection);
21835
22039
  this.createRestRow(rowGroupEntry, queries, groups, scenarios, queryWhereSection, order);
21836
22040
  this.createGroupSumRow(queries, sumGroupQueries, rowGroupEntry, scenariosSUMQuery, order);
21837
22041
  });
@@ -21846,7 +22050,7 @@ class DataQuery {
21846
22050
  }
21847
22051
  });
21848
22052
  this.detectNaNCells(this.config.scenarios, res);
21849
- this.createThereOfDrillRows(scenarios, order, res);
22053
+ this.createThereOfDrillRows(scenarios, attributesSQL, order, res);
21850
22054
  this.createPartOfDrillRows(scenarios, order, sumGroupQueries, res);
21851
22055
  this.createThereOfDrillColumns(this.config.categoryThereOf, res);
21852
22056
  this.calculateColumnGroupRest(res, this.config.categoryThereOf);
@@ -21934,14 +22138,14 @@ class DataQuery {
21934
22138
  }
21935
22139
  }
21936
22140
  /** Generates the main data rows for a single row group, applying GROUP BY, ORDER, and LIMIT. */
21937
- createDataRow(querys, rowGroupEntry, groups, scenarios, queryWhereSection, order, queryLimitSection) {
22141
+ createDataRow(querys, rowGroupEntry, groups, scenarios, attributes, queryWhereSection, order, queryLimitSection) {
21938
22142
  // Generates DataRows
21939
22143
  querys.push(`SELECT ROWNUM() AS ${QueryColumnNames.ROWNR},
21940
22144
  ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
21941
22145
  'ENTRY' as ${QueryColumnNames.TYPE},
21942
22146
  '${rowGroupEntry.rowGroup || "NO_GROUP"}' as ${QueryColumnNames.ROWGROUP},
21943
22147
  '${QueryColumnNames.CATEGORYINDEX}',
21944
- ${groups} ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
22148
+ ${groups} ${scenarios.length > 0 ? ",".concat(scenarios) : ""} ${attributes.length > 0 ? ",".concat(attributes) : ""}
21945
22149
  FROM ${this.fromExpr} ${queryWhereSection}
21946
22150
  GROUP BY ${groups}
21947
22151
  ORDER BY ${order[0]} ${queryLimitSection}`);
@@ -22087,7 +22291,7 @@ class DataQuery {
22087
22291
  * beneath their parent category row. Each thereof config entry produces a
22088
22292
  * filtered/grouped SQL query whose results are spliced into the result set.
22089
22293
  */
22090
- createThereOfDrillRows(scenarios, order, res) {
22294
+ createThereOfDrillRows(scenarios, attributes, order, res) {
22091
22295
  // adds drill rows if setup in config
22092
22296
  // if there of is set drilldown row is displayed with absolute numbers,
22093
22297
  // if part of is also not null a relative percenatage based of the selected basis is displayed
@@ -22122,7 +22326,7 @@ class DataQuery {
22122
22326
  ${QueryColumnNames.CATEGORY},
22123
22327
  ${QueryColumnNames.SUBCATEGORY},
22124
22328
  ${QueryColumnNames.ROWGROUP} as ${QueryColumnNames.ROWGROUP},
22125
- ${scenarios}
22329
+ ${scenarios} ${attributes.length > 0 ? ",".concat(attributes) : ""}
22126
22330
  FROM ${this.fromExpr}
22127
22331
  WHERE ${fromString}
22128
22332
  GROUP BY ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}
@@ -22248,6 +22452,45 @@ class DataQuery {
22248
22452
  }
22249
22453
  return `SUM(${scenario} * transformOperator(operation)) as ${scenario}, COUNT(ISNULL(${scenario})) as ${scenario}_cnt`;
22250
22454
  }
22455
+ /**
22456
+ * Translates an attribute definition into a SQL aggregate expression aliased
22457
+ * to the attribute's safe column alias (`attr_N`).
22458
+ *
22459
+ * `sum`/`avg` on scenario fields respect the row operation sign via
22460
+ * `transformOperator`, consistent with {@link translateScenarioSQL}; for
22461
+ * OPT/OPTNOTOTAL types the sign is already baked into the data.
22462
+ */
22463
+ translateAttributeSQL(attribute) {
22464
+ const field = `[${attribute.arg}]`;
22465
+ const isScenarioField = /^(ac|pp|fc|pl)[1-4]$/.test(attribute.arg);
22466
+ const useOperator = isScenarioField && this.config.type !== TableType$2.OPT && this.config.type !== TableType$2.OPTNOTOTAL;
22467
+ switch (attribute.fn) {
22468
+ case "set":
22469
+ return `SETAGG(${field}) as ${attribute.alias}`;
22470
+ case "first":
22471
+ return `FIRST(${field}) as ${attribute.alias}`;
22472
+ case "last":
22473
+ return `LAST(${field}) as ${attribute.alias}`;
22474
+ case "min":
22475
+ return `MIN(${field}) as ${attribute.alias}`;
22476
+ case "max":
22477
+ return `MAX(${field}) as ${attribute.alias}`;
22478
+ case "avg":
22479
+ return useOperator
22480
+ ? `AVG(${field} * transformOperator(operation)) as ${attribute.alias}`
22481
+ : `AVG(${field}) as ${attribute.alias}`;
22482
+ case "sum":
22483
+ return useOperator
22484
+ ? `SUM(${field} * transformOperator(operation)) as ${attribute.alias}`
22485
+ : `SUM(${field}) as ${attribute.alias}`;
22486
+ case "lit":
22487
+ return `${this.sqlLiteral(attribute.arg)} as ${attribute.alias}`;
22488
+ }
22489
+ }
22490
+ /** Emits a raw lit() argument as a SQL literal: numeric when parseable, quoted string otherwise. */
22491
+ sqlLiteral(raw) {
22492
+ return raw !== "" && !Number.isNaN(Number(raw)) ? raw : `'${raw.replace(/'/g, "''")}'`;
22493
+ }
22251
22494
  /**
22252
22495
  * generates Tuple
22253
22496
  * [0] orderby string example: category asc
@@ -22520,6 +22763,7 @@ class DataQuery {
22520
22763
  class TableDataSetFactory {
22521
22764
  constructor() {
22522
22765
  this.normalizedHeader = [];
22766
+ this.attributesByAlias = new Map();
22523
22767
  }
22524
22768
  /**
22525
22769
  * Creates Tableheader based on the configured scenarios (in config)
@@ -22529,13 +22773,17 @@ class TableDataSetFactory {
22529
22773
  * visualise grouping.
22530
22774
  * finally a seperator header row is created for the header underlining (border)
22531
22775
  */
22532
- createHeader(type, scenarios, i18n, measureScale, measureUnit, showMeasureScale) {
22776
+ createHeader(type, scenarios, i18n, measureScale, measureUnit, showMeasureScale, attributes = []) {
22533
22777
  const header = [];
22534
- this.normalizedHeader = this.normalizeHeader(type, scenarios);
22778
+ this.attributesByAlias = new Map(attributes.map((attribute) => [attribute.alias, attribute]));
22779
+ this.normalizedHeader = this.normalizeHeader(type, scenarios, attributes);
22535
22780
  const headerRow = new TableRow(0, 0, TableRowType.HEADER);
22536
22781
  const separatorRow = new TableRow(1, 0, TableRowType.SEPERATORLINE);
22537
22782
  for (const scenario of this.normalizedHeader) {
22538
- headerRow.createElement(Formatter.translateScenarioLabel(scenario.name, i18n), scenario.type, this.createColumnType(scenario), null, this.setHeaderPrefix(scenario, i18n, measureScale, measureUnit, showMeasureScale), null, null, null, null);
22783
+ const attribute = this.attributesByAlias.get(scenario.name);
22784
+ headerRow.createElement(attribute
22785
+ ? i18n.get(attribute.label) || attribute.label
22786
+ : Formatter.translateScenarioLabel(scenario.name, i18n), scenario.type, this.createColumnType(scenario), null, this.setHeaderPrefix(scenario, i18n, measureScale, measureUnit, showMeasureScale), null, null, null, null);
22539
22787
  separatorRow.createElement(null, scenario.type, this.createColumnType(scenario), null, null, null, null, null, null);
22540
22788
  }
22541
22789
  header.push(headerRow);
@@ -22560,7 +22808,7 @@ class TableDataSetFactory {
22560
22808
  * depending of table type operation column is used (OPT) or not (SUM | LIST)
22561
22809
  * in addition the headers are sorted based on the ruleset and duplicates are removed
22562
22810
  */
22563
- normalizeHeader(type, scenarios) {
22811
+ normalizeHeader(type, scenarios, attributes) {
22564
22812
  let header = [
22565
22813
  {
22566
22814
  name: QueryColumnNames.CATEGORY,
@@ -22585,8 +22833,15 @@ class TableDataSetFactory {
22585
22833
  },
22586
22834
  ];
22587
22835
  }
22836
+ // attribute columns sit between the category column and the scenario columns
22837
+ const attributeColumns = attributes.map((attribute) => ({
22838
+ name: attribute.alias,
22839
+ group: attribute.alias,
22840
+ type: attribute.alias,
22841
+ order: undefined,
22842
+ }));
22588
22843
  // NOTE: scenarios are already sorted in setConfig
22589
- return [...header, ...scenarios];
22844
+ return [...header, ...attributeColumns, ...scenarios];
22590
22845
  }
22591
22846
  /**
22592
22847
  * Creates table data colelction,
@@ -22758,6 +23013,10 @@ class TableDataSetFactory {
22758
23013
  * @param subCategory
22759
23014
  */
22760
23015
  translateSumCellLabel(i18nMode, i18n, value, rowGroup, subCategory, type, scenario) {
23016
+ if (this.attributesByAlias.has(scenario)) {
23017
+ // attribute values render verbatim; rows without the column (e.g. SUM) stay blank
23018
+ return value;
23019
+ }
22761
23020
  if (Number.isNaN(Number(value)) === false) {
22762
23021
  return value;
22763
23022
  }
@@ -22815,6 +23074,9 @@ class TableDataSetFactory {
22815
23074
  * @param value
22816
23075
  */
22817
23076
  translateScenarioCSS(scenario, value) {
23077
+ if (this.attributesByAlias.has(scenario)) {
23078
+ return "attribute";
23079
+ }
22818
23080
  const scenarios = new VarianceScenario(scenario);
22819
23081
  let prefix = "pos";
22820
23082
  if (value < 0) {
@@ -22829,6 +23091,10 @@ class TableDataSetFactory {
22829
23091
  if (scenario === "category") {
22830
23092
  return "";
22831
23093
  }
23094
+ const attribute = this.attributesByAlias.get(scenario);
23095
+ if (attribute) {
23096
+ return attribute.isNumeric ? "decimal" : "";
23097
+ }
22832
23098
  let unitType;
22833
23099
  const scenarios = new VarianceScenario(scenario);
22834
23100
  if (scenariosUnitType === withStyled.DataFormat.PERCENT) {
@@ -23010,14 +23276,14 @@ class Table {
23010
23276
  this.rowCount = 0;
23011
23277
  }
23012
23278
  const normalizedScenarios = this.normalizeScenarios(this.config.scenarios, this.config.categoryThereOf, this.config.sortOrder);
23013
- this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale);
23279
+ this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale, this.config.attributes);
23014
23280
  this.bodyRows =
23015
23281
  this.rowCount === 0 ? [] : this.dataSetFactory.createBodyRows(this.config, this.i18n, this.db, this.fromExpr);
23016
23282
  this.state = FactoryState$3.UP_TO_DATE;
23017
23283
  }
23018
23284
  update() {
23019
23285
  const normalizedScenarios = this.normalizeScenarios(this.config.scenarios, this.config.categoryThereOf, this.config.sortOrder);
23020
- this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale);
23286
+ this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale, this.config.attributes);
23021
23287
  this.bodyRows =
23022
23288
  this.rowCount === 0 || !this.fromExpr
23023
23289
  ? []
@@ -23103,6 +23369,8 @@ class TableComponentConfig {
23103
23369
  this.categoryThereOf = new Map();
23104
23370
  /** Percentage-of-total sub-row definitions. */
23105
23371
  this.partOf = [];
23372
+ /** Custom columns computed from dataset fields via aggregate expressions (see bn-table `attributes` prop). */
23373
+ this.attributes = [];
23106
23374
  this.sortOrder = new withStyled.OrderAdapter(new StringAdapter()).default();
23107
23375
  /** Table aggregation mode: LIST (flat), SUM (with totals), OPT (with optional totals), etc. */
23108
23376
  this.type = TableType$2.LIST;
@@ -23166,6 +23434,9 @@ class TableComponentConfigAdapter {
23166
23434
  if (withStyled.CompareUtil.isArray(data.partOf)) {
23167
23435
  config.partOf = withStyled.AdapterUtils.adaptArray(data.partOf, this.tableDrillGroupAdapter);
23168
23436
  }
23437
+ if (withStyled.CompareUtil.isArray(data.attributes)) {
23438
+ config.attributes = data.attributes;
23439
+ }
23169
23440
  if (withStyled.CompareUtil.isExisting(data.order)) {
23170
23441
  config.sortOrder = this.orderAdapter.adapt(data.order);
23171
23442
  }
@@ -23273,6 +23544,7 @@ const IbcsTable = class {
23273
23544
  direction: OrderDirection.ASC,
23274
23545
  };
23275
23546
  this.categorythereof = new Map();
23547
+ this.attributeColumns = [];
23276
23548
  this.type = TableType$2.LIST;
23277
23549
  this.categoryWidth = withStyled.TableCategoryWidth.INF;
23278
23550
  this.dataFormatDigits = { percent: 2, decimal: 1 };
@@ -23329,6 +23601,7 @@ const IbcsTable = class {
23329
23601
  thereOf: this.thereof,
23330
23602
  partOf: this.partof,
23331
23603
  categoryThereOf: this.categorythereof,
23604
+ attributes: this.attributeColumns,
23332
23605
  order: this.order,
23333
23606
  type: this.type,
23334
23607
  limit: this.limit,