@bino-bi/bn-template-engine 1.0.0-alpha.7 → 1.0.0-alpha.9

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 (109) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-3141c4a2.entry.js +1 -0
  3. package/dist/bn-template-engine/p-67538176.entry.js +1 -0
  4. package/dist/bn-template-engine/p-916296a5.entry.js +1 -0
  5. package/dist/bn-template-engine/{p-1164c0b0.entry.js → p-96006b06.entry.js} +1 -1
  6. package/dist/bn-template-engine/p-B4JfKvVT.js +1 -0
  7. package/dist/bn-template-engine/{p-JNHhIe7t.js → p-B_d-jp99.js} +1 -1
  8. package/dist/bn-template-engine/p-Ck-NYtot.js +1 -0
  9. package/dist/bn-template-engine/p-CnDq0oVa.js +1 -0
  10. package/dist/bn-template-engine/p-DSXNgKLa.js +1 -0
  11. package/dist/bn-template-engine/p-bc711fb0.entry.js +1 -0
  12. package/dist/bn-template-engine/p-c86395b8.entry.js +1 -0
  13. package/dist/bn-template-engine/p-e6f646b1.entry.js +1 -0
  14. package/dist/bn-template-engine/p-f41d9242.entry.js +1 -0
  15. package/dist/bn-template-engine/{p-B0lsgVuN.js → p-gFbbuhtl.js} +1 -1
  16. package/dist/cjs/{SVGVariancesStyleGroup-BqAdPYtL.js → bn-asset_20.cjs.entry.js} +21955 -6939
  17. package/dist/cjs/bn-grid.cjs.entry.js +6 -9
  18. package/dist/cjs/bn-image.cjs.entry.js +6 -9
  19. package/dist/cjs/bn-internationalization.cjs.entry.js +5 -6
  20. package/dist/cjs/bn-template-engine.cjs.js +2 -2
  21. package/dist/cjs/bn-template.cjs.entry.js +3 -4
  22. package/dist/cjs/bn-text.cjs.entry.js +7 -10
  23. package/dist/cjs/bn-tree.cjs.entry.js +11 -10
  24. package/dist/cjs/{context-protocol-DRQWrwsA.js → context-protocol-ohYzcb5F.js} +1 -1
  25. package/dist/cjs/editor-companion.cjs.entry.js +2 -2
  26. package/dist/cjs/{index-Cjw0q6gP.js → index-CDKG4xmO.js} +1 -0
  27. package/dist/cjs/loader.cjs.js +2 -2
  28. package/dist/cjs/{scaling-BidPsO53.js → scaling-CIAClQR5.js} +3 -3
  29. package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-D7BKWN2N.js} +2 -2
  30. package/dist/cjs/{withHasError-B8gHkfV2.js → withHasError-Cl2gTQzA.js} +106 -2
  31. package/dist/cjs/{Order-BGx39pS5.js → withStyled-qd94SSb4.js} +648 -6
  32. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +24 -5
  33. package/dist/collection/components/bn-chart-time/bn-chart-time.js +24 -5
  34. package/dist/collection/components/bn-layout-card/bn-layout-card.js +12 -6
  35. package/dist/collection/components/bn-layout-page/bn-layout-page.js +12 -7
  36. package/dist/collection/components/bn-table/bn-table.js +25 -7
  37. package/dist/collection/components/bn-table/ibcs-table.js +68 -3
  38. package/dist/collection/components/bn-tree/bn-tree.js +5 -1
  39. package/dist/components/bn-chart-structure.js +1 -1
  40. package/dist/components/bn-chart-time.js +1 -1
  41. package/dist/components/bn-layout-card.js +1 -1
  42. package/dist/components/bn-layout-page.js +1 -1
  43. package/dist/components/bn-table.js +1 -1
  44. package/dist/components/bn-tree.js +1 -1
  45. package/dist/components/ibcs-table2.js +1 -1
  46. package/dist/esm/{SVGVariancesStyleGroup-DOIT-zvI.js → bn-asset_20.entry.js} +22055 -7043
  47. package/dist/esm/bn-grid.entry.js +4 -7
  48. package/dist/esm/bn-image.entry.js +4 -7
  49. package/dist/esm/bn-internationalization.entry.js +4 -5
  50. package/dist/esm/bn-template-engine.js +3 -3
  51. package/dist/esm/bn-template.entry.js +2 -3
  52. package/dist/esm/bn-text.entry.js +5 -8
  53. package/dist/esm/bn-tree.entry.js +9 -8
  54. package/dist/esm/{context-protocol-2peaD4y8.js → context-protocol-DdbSplvE.js} +2 -2
  55. package/dist/esm/editor-companion.entry.js +2 -2
  56. package/dist/esm/{index-JNHhIe7t.js → index-B_d-jp99.js} +1 -1
  57. package/dist/esm/loader.js +3 -3
  58. package/dist/esm/{scaling-BOcjT8M0.js → scaling-DGKKkuL9.js} +4 -4
  59. package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-AFk2wwHT.js} +2 -2
  60. package/dist/esm/{withHasError-B3QX2emi.js → withHasError-DW_vMDUp.js} +106 -2
  61. package/dist/esm/{Order-sRO-lj7X.js → withStyled-BIkqU2w4.js} +616 -1
  62. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +1 -0
  63. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +1 -0
  64. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +8 -2
  65. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +8 -3
  66. package/dist/types/components/bn-table/ibcs-table.d.ts +19 -0
  67. package/dist/types/components.d.ts +8 -8
  68. package/package.json +1 -1
  69. package/dist/bn-template-engine/p-0fabe296.entry.js +0 -1
  70. package/dist/bn-template-engine/p-355abdf0.entry.js +0 -1
  71. package/dist/bn-template-engine/p-79KuA4Ox.js +0 -1
  72. package/dist/bn-template-engine/p-859cc06d.entry.js +0 -1
  73. package/dist/bn-template-engine/p-8acec99e.entry.js +0 -1
  74. package/dist/bn-template-engine/p-8f490c45.entry.js +0 -1
  75. package/dist/bn-template-engine/p-9721a5bb.entry.js +0 -1
  76. package/dist/bn-template-engine/p-9a564f8f.entry.js +0 -1
  77. package/dist/bn-template-engine/p-9cee22fa.entry.js +0 -1
  78. package/dist/bn-template-engine/p-B7p8beYH.js +0 -1
  79. package/dist/bn-template-engine/p-BDh7GfC5.js +0 -1
  80. package/dist/bn-template-engine/p-BoMtoHJB.js +0 -1
  81. package/dist/bn-template-engine/p-Bs8BqBsb.js +0 -1
  82. package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
  83. package/dist/bn-template-engine/p-DG-1MR_T.js +0 -1
  84. package/dist/bn-template-engine/p-Dnkv5rt8.js +0 -1
  85. package/dist/bn-template-engine/p-bdd2b243.entry.js +0 -1
  86. package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
  87. package/dist/bn-template-engine/p-f6ecb265.entry.js +0 -1
  88. package/dist/bn-template-engine/p-sRO-lj7X.js +0 -1
  89. package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
  90. package/dist/cjs/bn-asset_16.cjs.entry.js +0 -9099
  91. package/dist/cjs/bn-card.cjs.entry.js +0 -36
  92. package/dist/cjs/bn-chart-time.cjs.entry.js +0 -1031
  93. package/dist/cjs/bn-layout-card.cjs.entry.js +0 -279
  94. package/dist/cjs/formatter-4XCS0d2B.js +0 -221
  95. package/dist/cjs/ibcs-chart-time.cjs.entry.js +0 -4137
  96. package/dist/cjs/withComponentStatus-_x4LQZ0N.js +0 -109
  97. package/dist/cjs/withComponentStyle-ClSJfCku.js +0 -128
  98. package/dist/cjs/withInheritedProps-BH2KNER3.js +0 -157
  99. package/dist/cjs/withStyled-9tG024gQ.js +0 -522
  100. package/dist/esm/bn-asset_16.entry.js +0 -9082
  101. package/dist/esm/bn-card.entry.js +0 -34
  102. package/dist/esm/bn-chart-time.entry.js +0 -1029
  103. package/dist/esm/bn-layout-card.entry.js +0 -277
  104. package/dist/esm/formatter-BDh7GfC5.js +0 -215
  105. package/dist/esm/ibcs-chart-time.entry.js +0 -4135
  106. package/dist/esm/withComponentStatus-DodoSXe-.js +0 -107
  107. package/dist/esm/withComponentStyle-D3VWOsto.js +0 -126
  108. package/dist/esm/withInheritedProps-BlXDxhHK.js +0 -154
  109. package/dist/esm/withStyled-CE3_3taP.js +0 -495
@@ -1,4 +1,4 @@
1
- import { h, Host } from "@stencil/core";
1
+ import { forceUpdate, h, Host, writeTask } from "@stencil/core";
2
2
  import { isBlankInput, isValidBoolean, isValidDirection, isValidInteger, isValidLevel, isValidMeasureScale, isValidNumber, validateOrderList, validateScenarioList, validateStackConfig, validateVariancesList, } from "../../utils/validate";
3
3
  import withDataset from "../../utils/withDataset";
4
4
  import withComponentStatus from "../../utils/withComponentStatus";
@@ -61,7 +61,8 @@ export class Chart {
61
61
  }
62
62
  validateUnitScaling(newValue) {
63
63
  const errId = "ERR_unitScaling";
64
- if (!isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
64
+ const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
65
+ if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
65
66
  this.errors.addOrReplace({
66
67
  id: errId,
67
68
  type: "warning",
@@ -377,7 +378,9 @@ export class Chart {
377
378
  this.errors.remove("AUTO_scale");
378
379
  if (this.appliedScaleFactor !== 1) {
379
380
  this._autoScaleGuard = true;
380
- this.appliedScaleFactor = 1;
381
+ writeTask(() => {
382
+ this.appliedScaleFactor = 1;
383
+ });
381
384
  }
382
385
  this.checkWidthOverflow();
383
386
  return;
@@ -396,10 +399,26 @@ export class Chart {
396
399
  }
397
400
  if (Math.abs(computedFactor - this.appliedScaleFactor) > 0.001) {
398
401
  this._autoScaleGuard = true;
399
- this.appliedScaleFactor = computedFactor;
402
+ writeTask(() => {
403
+ this.appliedScaleFactor = computedFactor;
404
+ });
400
405
  }
401
406
  this.checkWidthOverflow();
402
407
  }
408
+ componentDidLoad() {
409
+ // If the initial parentDimensions measurement returned 0 (common inside
410
+ // cards/slots whose width isn't known before first paint), defer re-check
411
+ // to a requestAnimationFrame so the browser has completed at least one
412
+ // full layout pass before we re-measure.
413
+ if (this.canvasWidthSegmented <= 0) {
414
+ requestAnimationFrame(() => {
415
+ const { width } = getParentDimensions(this.element);
416
+ if (width > 0) {
417
+ forceUpdate(this);
418
+ }
419
+ });
420
+ }
421
+ }
403
422
  /**
404
423
  * Emits an error when a custom unit-scaling value causes the chart to exceed its container width.
405
424
  * Skipped for auto/unset unit-scaling since auto-fit handles width.
@@ -751,7 +770,7 @@ export class Chart {
751
770
  scenariosArray = [...scenariosArray, ...variancesArray];
752
771
  }
753
772
  const fontStyles = this.getFontStyles();
754
- return (h(Host, { key: '528b1d9607de916cb2ed06a2f2bac2acdc85da30', style: fontStyles }, h("div", { key: 'e5454756d03fc081e843dee241c52695212da4e3', class: "container" }, scenariosArray.map(this.chartTemplate))));
773
+ return (h(Host, { key: 'e74f31b521664a59111304c6f5df3b4ec568e34e', style: fontStyles }, h("div", { key: '8c65b4db7868346e8db983553ad6e1ab8e2c656c', class: "container" }, scenariosArray.map(this.chartTemplate))));
755
774
  }
756
775
  static get is() { return "bn-chart-structure"; }
757
776
  static get encapsulation() { return "shadow"; }
@@ -1,4 +1,4 @@
1
- import { h, Host } from "@stencil/core";
1
+ import { forceUpdate, h, Host, writeTask } from "@stencil/core";
2
2
  import { isBlankInput, isValidAxisLabelsMode, isValidBoolean, isValidDateFormat, isValidDirection, isValidInteger, isValidLevel, isValidMeasureScale, isValidNumber, validateOrderList, validateScenarioList, validateStackConfig, validateVariancesList, } from "../../utils/validate";
3
3
  import withDataset from "../../utils/withDataset";
4
4
  import withComponentStatus from "../../utils/withComponentStatus";
@@ -98,7 +98,8 @@ export class Chart {
98
98
  }
99
99
  validateUnitScaling(newValue) {
100
100
  const errId = "ERR_unitScaling";
101
- if (!isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
101
+ const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
102
+ if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
102
103
  this.errors.addOrReplace({
103
104
  id: errId,
104
105
  type: "warning",
@@ -553,7 +554,9 @@ export class Chart {
553
554
  this.errors.remove("AUTO_scale");
554
555
  if (this.appliedScaleFactor !== 1) {
555
556
  this._autoScaleGuard = true;
556
- this.appliedScaleFactor = 1;
557
+ writeTask(() => {
558
+ this.appliedScaleFactor = 1;
559
+ });
557
560
  }
558
561
  return;
559
562
  }
@@ -571,7 +574,23 @@ export class Chart {
571
574
  }
572
575
  if (Math.abs(computedFactor - this.appliedScaleFactor) > 0.001) {
573
576
  this._autoScaleGuard = true;
574
- this.appliedScaleFactor = computedFactor;
577
+ writeTask(() => {
578
+ this.appliedScaleFactor = computedFactor;
579
+ });
580
+ }
581
+ }
582
+ componentDidLoad() {
583
+ // If the initial parentDimensions measurement returned 0 (common inside
584
+ // cards/slots whose width isn't known before first paint), defer re-check
585
+ // to a requestAnimationFrame so the browser has completed at least one
586
+ // full layout pass before we re-measure.
587
+ if (this.canvasWidthSegmented <= 0) {
588
+ requestAnimationFrame(() => {
589
+ const { width } = getParentDimensions(this.element);
590
+ if (width > 0) {
591
+ forceUpdate(this);
592
+ }
593
+ });
575
594
  }
576
595
  }
577
596
  prepareDimension() {
@@ -967,7 +986,7 @@ export class Chart {
967
986
  scenariosArray = [...scenariosArray, ...variancesArray];
968
987
  }
969
988
  const fontStyles = this.getFontStyles();
970
- return (h(Host, { key: 'd0625657fc6ddbacf7ad5c4cede189cc321109e1', style: fontStyles }, h("div", { key: '393a0c8b00028b3edd08d6e199ffe55014251a5d', class: "container" }, scenariosArray.map(this.chartTemplate))));
989
+ return (h(Host, { key: '7844e63a4b52baffd9d82cc5063df5623c7fd2ae', style: fontStyles }, h("div", { key: '5e1ac0a43a1e2176a122f1ac1211963a92b6e782', class: "container" }, scenariosArray.map(this.chartTemplate))));
971
990
  }
972
991
  static get is() { return "bn-chart-time"; }
973
992
  static get encapsulation() { return "shadow"; }
@@ -102,10 +102,16 @@ export class LayoutCard {
102
102
  this.cardGridGap = "0";
103
103
  /**
104
104
  * When `true`, the card shrinks to fit its content (`fit-content`)
105
- * for both width and height. When `false`, the card stretches to
106
- * fill its parent (`100%`).
105
+ * for both width and height. When `false` (default), the card stretches
106
+ * to fill its parent (`100%`).
107
+ * <br /><br />
108
+ * Use `false` (default) when the card contains components with
109
+ * auto-scaling (e.g. `unit-scaling="auto"`), because auto-scaling
110
+ * needs a fixed parent width to calculate dimensions. `fit-content`
111
+ * creates a circular dependency where the card width depends on the
112
+ * child content but the child needs the card width to render.
107
113
  */
108
- this.cardFitToContent = true;
114
+ this.cardFitToContent = false;
109
115
  /**
110
116
  * Whether to display a visible border around the card.
111
117
  */
@@ -264,7 +270,7 @@ export class LayoutCard {
264
270
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
265
271
  return (
266
272
  // @ts-ignore
267
- h("bn-card", { key: '1dfcca605e2780bdfbb0108a5f34ff1259ecd666', styles: this.styles, class: this.setCardClass() }, h("div", { key: '7bdf2d4d7ddc82af78fe932a2af866b3b17d8b4d', class: "cardtitle" }, h("bn-title", { key: '799fa36d7368bbc2bc446f01fa3a46c8e363dcd0', 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: '9743d34c350907dfe0561444cd548d5884224f3a' }, h("div", { key: 'a622ae652dfefaac4a86d1f71a05fe776a811430', style: style }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'ebffcd673c94d7666fe6b46216792784f3dfb988', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
273
+ h("bn-card", { key: 'a27b2ea13406067ff661c293af1ef1d89cfdc4f1', styles: this.styles, class: this.setCardClass() }, h("div", { key: 'a4eb313d41e4b3e267057406fd6d469129e90003', class: "cardtitle" }, h("bn-title", { key: '999442b2f789bccbb00c7dd8e75e61c3a438596d', 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: '1cf38b212c60db9e4110f8340cda992d67fec350' }, h("div", { key: 'a1ac4631dfdeee4b5b87f09c2d047c86b886144a', style: style }, this.getSlots(arrOfSlots))), h("bn-footer", { key: '4397cc9f836c0271d4469a90a2f5168c7fc3cfea', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
268
274
  }
269
275
  static get is() { return "bn-layout-card"; }
270
276
  static get encapsulation() { return "shadow"; }
@@ -641,13 +647,13 @@ export class LayoutCard {
641
647
  "optional": false,
642
648
  "docs": {
643
649
  "tags": [],
644
- "text": "When `true`, the card shrinks to fit its content (`fit-content`)\nfor both width and height. When `false`, the card stretches to\nfill its parent (`100%`)."
650
+ "text": "When `true`, the card shrinks to fit its content (`fit-content`)\nfor both width and height. When `false` (default), the card stretches\nto fill its parent (`100%`).\n<br /><br />\nUse `false` (default) when the card contains components with\nauto-scaling (e.g. `unit-scaling=\"auto\"`), because auto-scaling\nneeds a fixed parent width to calculate dimensions. `fit-content`\ncreates a circular dependency where the card width depends on the\nchild content but the child needs the card width to render."
645
651
  },
646
652
  "getter": false,
647
653
  "setter": false,
648
654
  "reflect": false,
649
655
  "attribute": "card-fit-to-content",
650
- "defaultValue": "true"
656
+ "defaultValue": "false"
651
657
  },
652
658
  "cardShowBorder": {
653
659
  "type": "boolean",
@@ -101,11 +101,16 @@ export class LayoutPage {
101
101
  this.pageGridGap = "0";
102
102
  /**
103
103
  * When `true`, the page body height shrinks to fit its content
104
- * (`fit-content`). When `false`, the body stretches to fill the
105
- * full page height (`100%`). Width is always `100%` regardless
106
- * of this setting.
104
+ * (`fit-content`). When `false` (default), the body stretches to
105
+ * fill the full page height (`100%`). Width is always `100%`
106
+ * regardless of this setting.
107
+ * <br /><br />
108
+ * Use `false` (default) when the page contains components with
109
+ * auto-scaling (e.g. `unit-scaling="auto"` or `scale="auto"`),
110
+ * because auto-scaling needs a fixed parent height to calculate
111
+ * dimensions.
107
112
  */
108
- this.pageFitToContent = true;
113
+ this.pageFitToContent = false;
109
114
  this.templateMap = new Map([
110
115
  ["split-vertical", '"a b"'],
111
116
  ["split-horizontal", '"a" "b"'],
@@ -230,7 +235,7 @@ export class LayoutPage {
230
235
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
231
236
  return (
232
237
  // @ts-ignore
233
- h("bn-page", { key: '1c262428d9e69966f3089f5018b5a71e348c31b7', styles: this.styles, format: this.pageFormat, orientation: this.pageOrientation }, h("bn-message", { key: 'c687e6d660a7301202663644f2bce0e20d148420', text: this.messageText, image: this.messageImage }), h("bn-title", { key: '6e30d548765d8b32f7ab85c6203c1af2142d55c5', 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: 'a691c212bcf2ed7c95792de989be4a5c5d30aa5f' }, h("div", { key: '150f9e5941e723f527166ef9071b721b194101fe', style: style }, this.getSlots(arrOfSlots))), h("bn-footer", { key: '9868b2deab6302fc029b6d9f9780d84269245979', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber })));
238
+ h("bn-page", { key: '39d3769df89423fae025d924e9a69ebb3742461b', styles: this.styles, format: this.pageFormat, orientation: this.pageOrientation }, h("bn-message", { key: '0a2a28f6af09d6f58799f66c75a17c02464d57b1', text: this.messageText, image: this.messageImage }), h("bn-title", { key: '63e3dedb613fc8d4b11416321d148a22cf96af84', 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: '1946d3d11bb663b3ba5faf73bfe5d1b2bd4329ac' }, h("div", { key: '7a97d5481163d44f582c8c8ec352954f4e75c1bb', style: style }, this.getSlots(arrOfSlots))), h("bn-footer", { key: '863e721cfdb44ab5860687f5fb4dc4705f83d81b', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber })));
234
239
  }
235
240
  static get is() { return "bn-layout-page"; }
236
241
  static get encapsulation() { return "shadow"; }
@@ -703,13 +708,13 @@ export class LayoutPage {
703
708
  "optional": false,
704
709
  "docs": {
705
710
  "tags": [],
706
- "text": "When `true`, the page body height shrinks to fit its content\n(`fit-content`). When `false`, the body stretches to fill the\nfull page height (`100%`). Width is always `100%` regardless\nof this setting."
711
+ "text": "When `true`, the page body height shrinks to fit its content\n(`fit-content`). When `false` (default), the body stretches to\nfill the full page height (`100%`). Width is always `100%`\nregardless of this setting.\n<br /><br />\nUse `false` (default) when the page contains components with\nauto-scaling (e.g. `unit-scaling=\"auto\"` or `scale=\"auto\"`),\nbecause auto-scaling needs a fixed parent height to calculate\ndimensions."
707
712
  },
708
713
  "getter": false,
709
714
  "setter": false,
710
715
  "reflect": false,
711
716
  "attribute": "page-fit-to-content",
712
- "defaultValue": "true"
717
+ "defaultValue": "false"
713
718
  }
714
719
  };
715
720
  }
@@ -1,4 +1,4 @@
1
- import { h, Host } from "@stencil/core";
1
+ import { h, Host, writeTask } from "@stencil/core";
2
2
  import { isBlankInput, isTableBarColumnWidth, isTableCategoryWidth, isValidBoolean, isValidDataFormat, isValidDirection, isValidInteger, isValidMeasureScale, isValidMeasureType, isValidNumber, isValidTableType, validateColumnThereOfJsonStr, validateOrderList, validatePartOfJsonStr, validateScenarioList, validateThereOfJsonStr, validateVariancesList, } from "../../utils/validate";
3
3
  import withDataset from "../../utils/withDataset";
4
4
  import withComponentStatus from "../../utils/withComponentStatus";
@@ -344,7 +344,8 @@ export class Table {
344
344
  }
345
345
  validateUnitScaling(newValue) {
346
346
  const errId = "ERR_unitScaling";
347
- if (!isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
347
+ const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
348
+ if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
348
349
  this.errors.addOrReplace({
349
350
  id: errId,
350
351
  type: "warning",
@@ -357,7 +358,8 @@ export class Table {
357
358
  }
358
359
  validatePercentageScaling(newValue) {
359
360
  const errId = "ERR_percentageScaling";
360
- if (!isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
361
+ const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
362
+ if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
361
363
  this.errors.addOrReplace({
362
364
  id: errId,
363
365
  type: "warning",
@@ -650,7 +652,11 @@ export class Table {
650
652
  if (this.appliedScaleFactor !== 1) {
651
653
  host.style.setProperty("--bn-font-size", `${baseFontSize}px`);
652
654
  this._autoScaleGuard = true;
653
- this.appliedScaleFactor = 1;
655
+ // Defer state change to avoid Stencil "changed during rendering" warning.
656
+ // The CSS var is already applied, so the visual update is immediate.
657
+ writeTask(() => {
658
+ this.appliedScaleFactor = 1;
659
+ });
654
660
  }
655
661
  return;
656
662
  }
@@ -669,10 +675,14 @@ export class Table {
669
675
  else {
670
676
  this.errors.remove("AUTO_scale");
671
677
  }
672
- // Update state so bar charts re-render at the new scale
678
+ // Defer state update to avoid Stencil "changed during rendering" warning.
679
+ // The CSS var is already applied, so the visual update is immediate;
680
+ // the deferred state change triggers a re-render for SVG bar charts.
673
681
  if (Math.abs(computedFactor - this.appliedScaleFactor) > 0.001) {
674
682
  this._autoScaleGuard = true;
675
- this.appliedScaleFactor = computedFactor;
683
+ writeTask(() => {
684
+ this.appliedScaleFactor = computedFactor;
685
+ });
676
686
  }
677
687
  }
678
688
  prepareDataFormat() {
@@ -879,15 +889,23 @@ export class Table {
879
889
  return this.barColumns.split(",").map((col) => col.trim());
880
890
  }
881
891
  prepareUnitScaling() {
892
+ var _a;
882
893
  if (this.pixelPerUnitGroupMap.has(this.unitScaling)) {
883
894
  return this.pixelPerUnitGroupMap.get(this.unitScaling);
884
895
  }
896
+ if (((_a = this.unitScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
897
+ return 0;
898
+ }
885
899
  return Number(this.unitScaling);
886
900
  }
887
901
  preparePercentageScaling() {
902
+ var _a;
888
903
  if (this.pixelPerUnitGroupMap.has(this.percentageScaling)) {
889
904
  return this.pixelPerUnitGroupMap.get(this.percentageScaling);
890
905
  }
906
+ if (((_a = this.percentageScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
907
+ return 0;
908
+ }
891
909
  return Number(this.percentageScaling);
892
910
  }
893
911
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -951,7 +969,7 @@ export class Table {
951
969
  render() {
952
970
  const fontStyles = this.getFontStyles();
953
971
  const effectiveFactor = this.getEffectiveScaleFactor();
954
- return (h(Host, { key: '90572dbaa427d46b526c5a04fd04b94882fcb519', style: fontStyles }, h("div", { key: '947d9a31764fd0def10d902901f300c2a526dc55' }, h("ibcs-table", { key: 'ef57aa654318568eb5a8356a5257a0b75bf55e3a', data: this.data, "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 }))));
972
+ return (h(Host, { key: '95a43b9087d7d5d0be75c361795ef0a5a1cb30fe', style: fontStyles }, h("div", { key: 'a905e16727e619222b478fcc4dbe0c903306c420' }, h("ibcs-table", { key: '454d019b157c730ec0b3f7cfcf16ae0e56c4a255', data: this.data, "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 }))));
955
973
  }
956
974
  static get is() { return "bn-table"; }
957
975
  static get encapsulation() { return "shadow"; }
@@ -72,9 +72,9 @@ export class IbcsTable {
72
72
  const config = this.prepareConfig();
73
73
  const data = this.prepareData();
74
74
  this.componentDataFormatDigits = new DataFormatDigitsAdapter().adapt(this.dataFormatDigits);
75
- this.barChartStyles = this.prepareBarChartStyles();
76
75
  this.table = new Table(new IBCSRuleSet(), data, config);
77
76
  this.table.setI18n(this.i18n);
77
+ this.barChartStyles = this.prepareBarChartStyles();
78
78
  }
79
79
  prepareConfig() {
80
80
  const config = new TableComponentConfigAdapter(new TableDrillGroupAdapter(), new StringAdapter(), new OrderAdapter(new StringAdapter()), this.data).adapt({
@@ -166,12 +166,77 @@ export class IbcsTable {
166
166
  fontColor: ((_z = $["global"]) === null || _z === void 0 ? void 0 : _z["fontColor"]) || "#000000",
167
167
  fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) * 0.85 * this.scaleFactor,
168
168
  fontFamily: ((_1 = $["global"]) === null || _1 === void 0 ? void 0 : _1["fontFamily"]) || "'Noto Sans', sans-serif",
169
- unitScaling: this.unitScaling,
170
- percentageScaling: this.percentageScaling,
169
+ unitScaling: this.unitScaling > 0 ? this.unitScaling : this.autoUnitScaling(),
170
+ percentageScaling: this.percentageScaling > 0 ? this.percentageScaling : this.autoPercentageScaling(),
171
171
  scaleFactor: this.scaleFactor,
172
172
  };
173
173
  });
174
174
  }
175
+ /**
176
+ * Auto-calculate unitScaling so the largest absolute variance bar
177
+ * fills ~80% of the bar column width.
178
+ */
179
+ autoUnitScaling() {
180
+ const fs = this.componentStyle(($) => { var _a; return (((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333) * 0.85 * this.scaleFactor; });
181
+ const maxBarWidthPx = this.barColumnMaxWidth * fs;
182
+ const targetWidth = maxBarWidthPx * 0.8;
183
+ const absMax = this.getMaxAbsValue();
184
+ if (absMax <= 0 || fs <= 0) {
185
+ return 0.01;
186
+ }
187
+ return targetWidth / (absMax * fs);
188
+ }
189
+ /**
190
+ * Auto-calculate percentageScaling so the largest relative variance pin
191
+ * fills ~80% of the pin area.
192
+ */
193
+ autoPercentageScaling() {
194
+ const fs = this.componentStyle(($) => { var _a; return (((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333) * 0.85 * this.scaleFactor; });
195
+ const maxPinLength = Math.round(this.barColumnMaxWidth * 0.67 * fs);
196
+ const targetLength = maxPinLength * 0.8;
197
+ const maxPct = this.getMaxRelativeValue();
198
+ if (maxPct <= 0 || fs <= 0) {
199
+ return 0.5;
200
+ }
201
+ return targetLength / (maxPct * fs);
202
+ }
203
+ /**
204
+ * Find the maximum absolute value across all absolute variance columns (d_*) in the table body.
205
+ */
206
+ getMaxAbsValue() {
207
+ if (!this.table)
208
+ return 0;
209
+ let max = 0;
210
+ for (const row of this.table.getBody()) {
211
+ if (row.type === TableRowType.SUM)
212
+ continue;
213
+ for (const cell of row.getCells()) {
214
+ if (cell.isBarChart && cell.columnStats && !cell.key.startsWith("dr")) {
215
+ max = Math.max(max, cell.columnStats.absMax);
216
+ }
217
+ }
218
+ }
219
+ return max;
220
+ }
221
+ /**
222
+ * Find the maximum percentage value across all relative variance columns (dr_*) in the table body.
223
+ * Values are stored as decimals (e.g. 0.2 = 20%), returned as percentage (20).
224
+ */
225
+ getMaxRelativeValue() {
226
+ if (!this.table)
227
+ return 0;
228
+ let max = 0;
229
+ for (const row of this.table.getBody()) {
230
+ if (row.type === TableRowType.SUM)
231
+ continue;
232
+ for (const cell of row.getCells()) {
233
+ if (cell.isBarChart && cell.columnStats && cell.key.startsWith("dr")) {
234
+ max = Math.max(max, cell.columnStats.absMax * 100);
235
+ }
236
+ }
237
+ }
238
+ return max;
239
+ }
175
240
  static get is() { return "ibcs-table"; }
176
241
  static get encapsulation() { return "shadow"; }
177
242
  static get originalStyleUrls() {
@@ -167,7 +167,11 @@ export class ChartTree {
167
167
  }
168
168
  componentDidLoad() {
169
169
  this.setupResizeObserver();
170
- this.updateNodeRects();
170
+ // Defer DOM measurement to after the browser has completed layout.
171
+ // getBoundingClientRect() can return zeros if called before first paint.
172
+ requestAnimationFrame(() => {
173
+ this.updateNodeRects();
174
+ });
171
175
  }
172
176
  disconnectedCallback() {
173
177
  if (this.resizeObserver) {
@@ -1 +1 @@
1
- import{proxyCustomElement as t,HTMLElement as e,h as i,Host as s,transformTag as a}from"@stencil/core/internal/client";import{v as r,a as n,h as o,j as l,b as c,c as h,k as d,l as p,m as u,n as v,i as m}from"./validate.js";import{w as g,g as f,p as y}from"./scaling.js";import{w as b,a as S}from"./withHasError.js";import{w}from"./withTranslation.js";import{a as O}from"./context-protocol.js";import{w as k}from"./withStyled.js";import{w as _}from"./withComponentStyle.js";import{i as x,w as R}from"./withInheritedProps.js";import{A,b as T,O as E,g as N,h as U,i as M}from"./Order.js";import{d as C}from"./ibcs-chart-structure2.js";const L=t(class extends e{validateScenario(t){const e="ERR_scenarios";if(x(t))return void this.errors.remove(e);const i=r(t);i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(e)}validateVariances(t){const e="ERR_variances";if(x(t))return void this.errors.remove(e);const i=n(t);i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(e)}validateUnitScaling(t){const e="ERR_unitScaling";o(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."})}validatePercentageScaling(t){const e="ERR_percentageScaling";o(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."})}validateLevel(t){const e="ERR_level";l(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const e="ERR_order";if(x(t))return void this.errors.remove(e);const i=c(t);i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(i)+"' are not supported."}):this.errors.remove(e)}validateOrderDirection(t){const e="ERR_orderDirection";x(t)||h(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const e="ERR_limit";d(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowCategories(t){const e="ERR_showCategories";p(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const e="ERR_measureScale";u(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const e="ERR_grouped";p(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateStack(t){const e="ERR_stack",i=v(t);i.length>0?this.errors.addOrReplace({id:e,type:"warning",message:i.join("; ")}):this.errors.remove(e)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const e=Number(t);isNaN(e)||e<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.scenariosArray=[""],this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,k(this),b(this),g(this,((t,e)=>{this.data=e||[]}),((t,e)=>{this.datasetMeta=e})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=S(this),this.componentStyle=_(this),this.t=w(this).t,this.resolveInherited=R(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var t,e;const{mode:i}=y(this.scale);if("auto"!==i&&"empty"!==i)return this._autoScaleGuard=!1,void this.checkWidthOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkWidthOverflow();const s=this.element,{height:a}=f(s);if(a<=0)return void this.checkWidthOverflow();const r=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}));s.style.setProperty("--bn-font-size",r+"px");const n=null===(t=s.shadowRoot)||void 0===t?void 0:t.querySelector(".container"),o=null!==(e=null==n?void 0:n.scrollHeight)&&void 0!==e?e:s.scrollHeight;if(o<=a+1)return this.errors.remove("AUTO_scale"),1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,this.appliedScaleFactor=1),void this.checkWidthOverflow();const l=(a-1)/o;s.style.setProperty("--bn-font-size",r*l+"px"),"empty"===i?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),Math.abs(l-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,this.appliedScaleFactor=l),this.checkWidthOverflow()}checkWidthOverflow(){var t;const e="WARN_overflow",i=((null!==(t=this.unitScaling)&&void 0!==t?t:"")+"").trim().toLowerCase();if(""===i||"auto"===i)return void this.errors.remove(e);const s=f(this.element);s.width>0&&this.element.scrollWidth>s.width+1?this.errors.addOrReplace({id:e,type:"error",message:`Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(s.width)}px). Reduce unit-scaling or set to "auto".`}):this.errors.remove(e)}prepareDimension(){const t=f(this.element);return this.canvasWidthSegmented=t.width/this.scenariosArray.length,{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,e,i,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((t=>t.trim()));const r="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());return m(this.scenarios)||r?(null===(i=null===(e=this.datasetMeta)||void 0===e?void 0:e.availableScenarios)||void 0===i?void 0:i.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){var t;const e=this.resolveInherited("variances",this.variances);return void 0!==e?e.split(",").map((t=>t.trim())):m(this.variances)?[]:null===(t=this.variances)||void 0===t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=O,e=new Map([].map((t=>[t,this.t(".".concat(t))]))),i=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...e.entries()])}preparePixelPerUnit(){var t;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(t=this.unitScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const e=Number(this.unitScaling);return!isNaN(e)&&e>0?(this.errors.remove("AUTO_unitScaling"),e):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):100*Number(this.percentageScaling)}prepareLevel(){var t,e,i;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return m(this.level)||s?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),A[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),A[null===(i=this.level)||void 0===i?void 0:i.toUpperCase()])}prepareOrder(){var t;const e=this.resolveInherited("order",this.order),i=this.resolveInherited("orderDirection",this.orderDirection),s=null!=e?e:this.order,a=null!=i?i:this.orderDirection,r="auto"===(null==s?void 0:s.trim().toLowerCase());let n;return m(s)||r?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),n=this.datasetMeta.suggestedOrder):n=s:(this.errors.remove("AUTO_order"),n=s),{hierarchy:null==n?void 0:n.split(",").map((t=>E[null==t?void 0:t.toUpperCase()])),direction:T[null==a?void 0:a.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:e["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:e["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:e["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:e["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:e["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:e["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:e["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:e["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:e["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:e["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:e["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:e["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:e["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:e["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:e["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-structure"].axisStyles,barStyles:e["bn-chart-structure"].barStyles,varianceStyles:e["bn-chart-structure"].varianceStyles,padding:e["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(m(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),e=t.by,i="WARN_stack_dimensions_scenarios";if(e===N.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:i,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(i)}else this.errors.remove(i);return{by:e,mode:t.mode||M.ABSOLUTE,order:t.order||U.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return m(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,e){const s=this.getEffectiveScaleFactor(),a=this.preparePixelPerUnit(),r=this.preparePixelPerPercentage(),n=this.prepareStackConfig(),o=this.prepareScenarios(),l=(null==n?void 0:n.by)===N.DIMENSIONS?o.slice(0,1):o;return i("ibcs-chart-structure",{data:this.data,chartTitle:this.prepareChartTitle(e),scenarios:l,variances:[t],hideCategories:this.prepareHideCategories(e),pixelPerUnit:a>0?a*s:0,pixelPerPercentage:r>0?r*s:0,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(e),stackConfig:n,parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:t,factor:e}=y(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const e=this.prepareVariances();e.length>0&&(t=[...t,...e]);const a=this.getFontStyles();return i(s,{key:"528b1d9607de916cb2ed06a2f2bac2acdc85da30",style:a},i("div",{key:"e5454756d03fc081e843dee241c52695212da4e3",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],data:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),D=L,P=function(){"undefined"!=typeof customElements&&["bn-chart-structure","ibcs-chart-structure"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(a(t))||customElements.define(a(t),L);break;case"ibcs-chart-structure":customElements.get(a(t))||C()}}))};export{D as BnChartStructure,P as defineCustomElement}
1
+ import{proxyCustomElement as t,HTMLElement as i,writeTask as e,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{v as o,a as l,h as c,j as h,b as d,c as p,k as u,l as v,m,n as g,i as f}from"./validate.js";import{w as y,g as b,p as S}from"./scaling.js";import{w,a as O}from"./withHasError.js";import{w as k}from"./withTranslation.js";import{a as _}from"./context-protocol.js";import{w as x}from"./withStyled.js";import{w as R}from"./withComponentStyle.js";import{i as A,w as T}from"./withInheritedProps.js";import{A as E,b as N,O as U,g as M,h as L,i as C}from"./Order.js";import{d as D}from"./ibcs-chart-structure2.js";const P=t(class extends i{validateScenario(t){const i="ERR_scenarios";if(A(t))return void this.errors.remove(i);const e=o(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(A(t))return void this.errors.remove(i);const e=l(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="ERR_unitScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||c(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."})}validatePercentageScaling(t){const i="ERR_percentageScaling";c(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."})}validateLevel(t){const i="ERR_level";h(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(A(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";A(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="ERR_limit";u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowCategories(t){const i="ERR_showCategories";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateStack(t){const i="ERR_stack",e=g(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.scenariosArray=[""],this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,x(this),w(this),y(this,((t,i)=>{this.data=i||[]}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=O(this),this.componentStyle=R(this),this.t=k(this).t,this.resolveInherited=T(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var t,i;const{mode:s}=S(this.scale);if("auto"!==s&&"empty"!==s)return this._autoScaleGuard=!1,void this.checkWidthOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkWidthOverflow();const a=this.element,{height:r}=b(a);if(r<=0)return void this.checkWidthOverflow();const n=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}));a.style.setProperty("--bn-font-size",n+"px");const o=null===(t=a.shadowRoot)||void 0===t?void 0:t.querySelector(".container"),l=null!==(i=null==o?void 0:o.scrollHeight)&&void 0!==i?i:a.scrollHeight;if(l<=r+1)return this.errors.remove("AUTO_scale"),1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=1}))),void this.checkWidthOverflow();const c=(r-1)/l;a.style.setProperty("--bn-font-size",n*c+"px"),"empty"===s?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+c.toFixed(3)}):this.errors.remove("AUTO_scale"),Math.abs(c-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=c}))),this.checkWidthOverflow()}componentDidLoad(){this.canvasWidthSegmented<=0&&requestAnimationFrame((()=>{const{width:t}=b(this.element);t>0&&s(this)}))}checkWidthOverflow(){var t;const i="WARN_overflow",e=((null!==(t=this.unitScaling)&&void 0!==t?t:"")+"").trim().toLowerCase();if(""===e||"auto"===e)return void this.errors.remove(i);const s=b(this.element);s.width>0&&this.element.scrollWidth>s.width+1?this.errors.addOrReplace({id:i,type:"error",message:`Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(s.width)}px). Reduce unit-scaling or set to "auto".`}):this.errors.remove(i)}prepareDimension(){const t=b(this.element);return this.canvasWidthSegmented=t.width/this.scenariosArray.length,{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((t=>t.trim()));const r="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());return f(this.scenarios)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){var t;const i=this.resolveInherited("variances",this.variances);return void 0!==i?i.split(",").map((t=>t.trim())):f(this.variances)?[]:null===(t=this.variances)||void 0===t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=_,i=new Map([].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}preparePixelPerUnit(){var t;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(t=this.unitScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const i=Number(this.unitScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_unitScaling"),i):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):100*Number(this.percentageScaling)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return f(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),E[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),E[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=this.resolveInherited("orderDirection",this.orderDirection),s=null!=i?i:this.order,a=null!=e?e:this.orderDirection,r="auto"===(null==s?void 0:s.trim().toLowerCase());let n;return f(s)||r?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),n=this.datasetMeta.suggestedOrder):n=s:(this.errors.remove("AUTO_order"),n=s),{hierarchy:null==n?void 0:n.split(",").map((t=>U[null==t?void 0:t.toUpperCase()])),direction:N[null==a?void 0:a.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(f(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===M.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||C.ABSOLUTE,order:t.order||L.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return f(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){const e=this.getEffectiveScaleFactor(),s=this.preparePixelPerUnit(),r=this.preparePixelPerPercentage(),n=this.prepareStackConfig(),o=this.prepareScenarios(),l=(null==n?void 0:n.by)===M.DIMENSIONS?o.slice(0,1):o;return a("ibcs-chart-structure",{data:this.data,chartTitle:this.prepareChartTitle(i),scenarios:l,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:s>0?s*e:0,pixelPerPercentage:r>0?r*e:0,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(i),stackConfig:n,parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:t,factor:i}=S(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"e74f31b521664a59111304c6f5df3b4ec568e34e",style:e},a("div",{key:"8c65b4db7868346e8db983553ad6e1ab8e2c656c",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],data:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),W=P,z=function(){"undefined"!=typeof customElements&&["bn-chart-structure","ibcs-chart-structure"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),P);break;case"ibcs-chart-structure":customElements.get(n(t))||D()}}))};export{W as BnChartStructure,z as defineCustomElement}