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

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 (32) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-9721a5bb.entry.js +1 -0
  3. package/dist/bn-template-engine/p-9cee22fa.entry.js +1 -0
  4. package/dist/bn-template-engine/p-Dnkv5rt8.js +1 -0
  5. package/dist/bn-template-engine/p-f6ecb265.entry.js +1 -0
  6. package/dist/cjs/bn-asset_16.cjs.entry.js +104 -23
  7. package/dist/cjs/bn-chart-time.cjs.entry.js +44 -8
  8. package/dist/cjs/bn-layout-card.cjs.entry.js +32 -1
  9. package/dist/cjs/withInheritedProps-BH2KNER3.js +157 -0
  10. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +46 -10
  11. package/dist/collection/components/bn-chart-time/bn-chart-time.js +44 -8
  12. package/dist/collection/components/bn-layout-card/bn-layout-card.js +32 -1
  13. package/dist/collection/components/bn-table/bn-table.js +59 -13
  14. package/dist/collection/utils/withInheritedProps.js +152 -0
  15. package/dist/components/bn-chart-structure.js +1 -1
  16. package/dist/components/bn-chart-time.js +1 -1
  17. package/dist/components/bn-layout-card.js +1 -1
  18. package/dist/components/bn-table.js +1 -1
  19. package/dist/components/withInheritedProps.js +1 -0
  20. package/dist/esm/bn-asset_16.entry.js +104 -23
  21. package/dist/esm/bn-chart-time.entry.js +44 -8
  22. package/dist/esm/bn-layout-card.entry.js +32 -1
  23. package/dist/esm/withInheritedProps-BlXDxhHK.js +154 -0
  24. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +1 -0
  25. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +1 -0
  26. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +8 -0
  27. package/dist/types/components/bn-table/bn-table.d.ts +1 -0
  28. package/dist/types/utils/withInheritedProps.d.ts +38 -0
  29. package/package.json +1 -1
  30. package/dist/bn-template-engine/p-06946f44.entry.js +0 -1
  31. package/dist/bn-template-engine/p-98cf512f.entry.js +0 -1
  32. package/dist/bn-template-engine/p-e6b24f15.entry.js +0 -1
@@ -6,6 +6,7 @@ import { w as withHasError, r as runIfExisits } from './withHasError-B3QX2emi.js
6
6
  import { w as withComponentStyle } from './withComponentStyle-D3VWOsto.js';
7
7
  import { v as validateScenarioList, a as validateVariancesList, i as isValidNumber, c as isValidLevel, d as validateOrderList, e as isValidDirection, b as isValidInteger, j as isValidBoolean, k as isValidMeasureScale, g as validateStackConfig, w as withStyled, l as isBlankInput, m as murmur2, n as isTableBarColumnWidth, o as isValidDataFormat, p as isValidTableType, q as validateThereOfJsonStr, r as validatePartOfJsonStr, s as isValidMeasureType, t as isTableCategoryWidth, u as validateColumnThereOfJsonStr, x as validateMeasureList, y as isValidDate, f as isValidDateFormat, z as isValidDateLink } from './withStyled-CE3_3taP.js';
8
8
  import { w as withDataset, a as withTranslation, g as getParentDimensions, p as parseScaling } from './scaling-BOcjT8M0.js';
9
+ import { i as isInheritedValue, w as withInheritedProps } from './withInheritedProps-BlXDxhHK.js';
9
10
  import { f as AggregationLevel, O as OrderDirection$1, a as OrderColumn, S as StackBy, b as StackOrder, c as StackMode, g as DataFormat, I as I18nMode, i as TableCategoryWidth, M as MeasureType, B as BAR_COLUMN_WIDTH_EM, T as TableBarColumnWidth, j as DateLink, D as DateDistance, l as DateTime, n as AdapterUtils, k as CompareUtil, o as OrderAdapter, m as DateStringFactory } from './Order-sRO-lj7X.js';
10
11
  import { b as alasql, S as Svg, D as DataAnalyzer, e as StringAdapter, a as SiPrefix, g as getContrastTextColor, I as IBCSRuleSet, c as getScenarioPrefix, d as IBCS_LAYER_ORDER, f as DataFormatDigitsAdapter, F as FontStyleAdapter, h as SVGStyleGroupAdapter, i as SVGStyleAdapter, j as SVGVariancesStyleGroupAdapter, P as PaddingAdapter, k as DataFormatDigits } from './SVGVariancesStyleGroup-DOIT-zvI.js';
11
12
  import { F as Formatter, C as CalculateSize, V as VarianceScenario, Q as QueryColumnNames } from './formatter-BDh7GfC5.js';
@@ -73,8 +74,12 @@ const bnChartStructureCss$1 = () => `:host{display:inline-block;position:relativ
73
74
 
74
75
  const Chart = class {
75
76
  validateScenario(newValue) {
76
- const invalidScenarios = validateScenarioList(newValue);
77
77
  const errId = "ERR_scenarios";
78
+ if (isInheritedValue(newValue)) {
79
+ this.errors.remove(errId);
80
+ return;
81
+ }
82
+ const invalidScenarios = validateScenarioList(newValue);
78
83
  if (invalidScenarios.length > 0) {
79
84
  this.errors.addOrReplace({
80
85
  id: errId,
@@ -88,6 +93,10 @@ const Chart = class {
88
93
  }
89
94
  validateVariances(newValue) {
90
95
  const errIdVar = "ERR_variances";
96
+ if (isInheritedValue(newValue)) {
97
+ this.errors.remove(errIdVar);
98
+ return;
99
+ }
91
100
  const invalidVariances = validateVariancesList(newValue);
92
101
  if (invalidVariances.length > 0) {
93
102
  this.errors.addOrReplace({
@@ -140,8 +149,12 @@ const Chart = class {
140
149
  }
141
150
  }
142
151
  validateOrderList(newValue) {
143
- const invalidElements = validateOrderList(newValue);
144
152
  const errId = "ERR_order";
153
+ if (isInheritedValue(newValue)) {
154
+ this.errors.remove(errId);
155
+ return;
156
+ }
157
+ const invalidElements = validateOrderList(newValue);
145
158
  if (invalidElements.length > 0) {
146
159
  this.errors.addOrReplace({
147
160
  id: errId,
@@ -155,6 +168,10 @@ const Chart = class {
155
168
  }
156
169
  validateOrderDirection(newValue) {
157
170
  const errId = "ERR_orderDirection";
171
+ if (isInheritedValue(newValue)) {
172
+ this.errors.remove(errId);
173
+ return;
174
+ }
158
175
  if (!isValidDirection(newValue)) {
159
176
  this.errors.addOrReplace({
160
177
  id: errId,
@@ -361,6 +378,12 @@ const Chart = class {
361
378
  this.errors = withHasError(this);
362
379
  this.componentStyle = withComponentStyle(this);
363
380
  this.t = withTranslation(this).t;
381
+ this.resolveInherited = withInheritedProps(this, [
382
+ { propName: "scenarios", ancestorAttr: "title-scenarios" },
383
+ { propName: "variances", ancestorAttr: "title-variances" },
384
+ { propName: "order", ancestorAttr: "title-order" },
385
+ { propName: "orderDirection", ancestorAttr: "title-order-direction" },
386
+ ]);
364
387
  }
365
388
  componentWillLoad() {
366
389
  this.validateScenario(this.scenarios);
@@ -461,6 +484,11 @@ const Chart = class {
461
484
  }
462
485
  prepareScenarios() {
463
486
  var _a, _b, _c, _d;
487
+ const inherited = this.resolveInherited("scenarios", this.scenarios);
488
+ if (inherited !== undefined) {
489
+ this.errors.remove("AUTO_scenarios");
490
+ return inherited.split(",").map((entry) => entry.trim());
491
+ }
464
492
  const isAuto = ((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
465
493
  if (isBlankInput(this.scenarios) || isAuto) {
466
494
  if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
@@ -483,6 +511,10 @@ const Chart = class {
483
511
  }
484
512
  prepareVariances() {
485
513
  var _a;
514
+ const inherited = this.resolveInherited("variances", this.variances);
515
+ if (inherited !== undefined) {
516
+ return inherited.split(",").map((entry) => entry.trim());
517
+ }
486
518
  if (isBlankInput(this.variances)) {
487
519
  return [];
488
520
  }
@@ -551,11 +583,15 @@ const Chart = class {
551
583
  return AggregationLevel[(_c = this.level) === null || _c === void 0 ? void 0 : _c.toUpperCase()];
552
584
  }
553
585
  prepareOrder() {
554
- var _a, _b, _c;
555
- const isAuto = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
586
+ var _a;
587
+ const inheritedOrder = this.resolveInherited("order", this.order);
588
+ const inheritedDirection = this.resolveInherited("orderDirection", this.orderDirection);
589
+ const effectiveOrder = inheritedOrder !== null && inheritedOrder !== void 0 ? inheritedOrder : this.order;
590
+ const effectiveDirection = inheritedDirection !== null && inheritedDirection !== void 0 ? inheritedDirection : this.orderDirection;
591
+ const isAuto = (effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.trim().toLowerCase()) === "auto";
556
592
  let orderStr;
557
- if (isBlankInput(this.order) || isAuto) {
558
- if ((_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.suggestedOrder) {
593
+ if (isBlankInput(effectiveOrder) || isAuto) {
594
+ if ((_a = this.datasetMeta) === null || _a === void 0 ? void 0 : _a.suggestedOrder) {
559
595
  if (!isAuto) {
560
596
  this.errors.addOrReplace({
561
597
  id: "AUTO_order",
@@ -569,16 +605,16 @@ const Chart = class {
569
605
  orderStr = this.datasetMeta.suggestedOrder;
570
606
  }
571
607
  else {
572
- orderStr = this.order;
608
+ orderStr = effectiveOrder;
573
609
  }
574
610
  }
575
611
  else {
576
612
  this.errors.remove("AUTO_order");
577
- orderStr = this.order;
613
+ orderStr = effectiveOrder;
578
614
  }
579
615
  const tableOrder = {
580
616
  hierarchy: orderStr === null || orderStr === void 0 ? void 0 : orderStr.split(",").map((entry) => OrderColumn[entry === null || entry === void 0 ? void 0 : entry.toUpperCase()]),
581
- direction: OrderDirection$1[(_c = this.orderDirection) === null || _c === void 0 ? void 0 : _c.toUpperCase()],
617
+ direction: OrderDirection$1[effectiveDirection === null || effectiveDirection === void 0 ? void 0 : effectiveDirection.toUpperCase()],
582
618
  };
583
619
  return tableOrder;
584
620
  }
@@ -766,7 +802,7 @@ const Chart = class {
766
802
  scenariosArray = [...scenariosArray, ...variancesArray];
767
803
  }
768
804
  const fontStyles = this.getFontStyles();
769
- return (h(Host, { key: '570fb741ddf481be0f3055d346314ad39a455361', style: fontStyles }, h("div", { key: 'e84cfe2e00dd2f960f038844e00449431efa6ce0', class: "container" }, scenariosArray.map(this.chartTemplate))));
805
+ return (h(Host, { key: '528b1d9607de916cb2ed06a2f2bac2acdc85da30', style: fontStyles }, h("div", { key: 'e5454756d03fc081e843dee241c52695212da4e3', class: "container" }, scenariosArray.map(this.chartTemplate))));
770
806
  }
771
807
  get element() { return getElement(this); }
772
808
  static get watchers() { return {
@@ -2372,9 +2408,19 @@ const Table$1 = class Table {
2372
2408
  this.datasetMeta = meta;
2373
2409
  });
2374
2410
  this.t = withTranslation(this).t;
2411
+ this.resolveInherited = withInheritedProps(this, [
2412
+ { propName: "scenarios", ancestorAttr: "title-scenarios" },
2413
+ { propName: "variances", ancestorAttr: "title-variances" },
2414
+ { propName: "order", ancestorAttr: "title-order" },
2415
+ { propName: "orderDirection", ancestorAttr: "title-order-direction" },
2416
+ ]);
2375
2417
  }
2376
2418
  validateScenario(newValue) {
2377
2419
  const errId = "ERR_scenarios";
2420
+ if (isInheritedValue(newValue)) {
2421
+ this.errors.remove(errId);
2422
+ return;
2423
+ }
2378
2424
  const invalidScenarios = validateScenarioList(newValue);
2379
2425
  if (invalidScenarios.length > 0) {
2380
2426
  this.errors.addOrReplace({
@@ -2389,6 +2435,10 @@ const Table$1 = class Table {
2389
2435
  }
2390
2436
  validateVariances(newValue) {
2391
2437
  const errId = "ERR_variances";
2438
+ if (isInheritedValue(newValue)) {
2439
+ this.errors.remove(errId);
2440
+ return;
2441
+ }
2392
2442
  const invalidVariances = validateVariancesList(newValue);
2393
2443
  if (invalidVariances.length > 0) {
2394
2444
  this.errors.addOrReplace({
@@ -2566,6 +2616,10 @@ const Table$1 = class Table {
2566
2616
  }
2567
2617
  validateOrderList(newValue) {
2568
2618
  const errId = "ERR_order";
2619
+ if (isInheritedValue(newValue)) {
2620
+ this.errors.remove(errId);
2621
+ return;
2622
+ }
2569
2623
  const invalidElements = validateOrderList(newValue);
2570
2624
  if (invalidElements.length > 0) {
2571
2625
  this.errors.addOrReplace({
@@ -2580,6 +2634,10 @@ const Table$1 = class Table {
2580
2634
  }
2581
2635
  validateOrderDirection(newValue) {
2582
2636
  const errId = "ERR_orderDirection";
2637
+ if (isInheritedValue(newValue)) {
2638
+ this.errors.remove(errId);
2639
+ return;
2640
+ }
2583
2641
  if (!isValidDirection(newValue)) {
2584
2642
  this.errors.addOrReplace({
2585
2643
  id: errId,
@@ -2787,15 +2845,19 @@ const Table$1 = class Table {
2787
2845
  return JSON.parse(this.partof);
2788
2846
  }
2789
2847
  prepareOrder() {
2790
- var _a, _b, _c;
2791
- const isAuto = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
2792
- let orderStr = this.order;
2793
- if (isAuto && ((_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.suggestedOrder)) {
2848
+ var _a;
2849
+ const inheritedOrder = this.resolveInherited("order", this.order);
2850
+ const inheritedDirection = this.resolveInherited("orderDirection", this.orderDirection);
2851
+ const effectiveOrder = inheritedOrder !== null && inheritedOrder !== void 0 ? inheritedOrder : this.order;
2852
+ const effectiveDirection = inheritedDirection !== null && inheritedDirection !== void 0 ? inheritedDirection : this.orderDirection;
2853
+ const isAuto = (effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.trim().toLowerCase()) === "auto";
2854
+ let orderStr = effectiveOrder;
2855
+ if (isAuto && ((_a = this.datasetMeta) === null || _a === void 0 ? void 0 : _a.suggestedOrder)) {
2794
2856
  orderStr = this.datasetMeta.suggestedOrder;
2795
2857
  }
2796
2858
  const tableOrder = {
2797
2859
  hierarchy: orderStr.split(",").map((entry) => OrderColumn[entry === null || entry === void 0 ? void 0 : entry.toUpperCase()]),
2798
- direction: OrderDirection$1[(_c = this.orderDirection) === null || _c === void 0 ? void 0 : _c.toUpperCase()],
2860
+ direction: OrderDirection$1[effectiveDirection === null || effectiveDirection === void 0 ? void 0 : effectiveDirection.toUpperCase()],
2799
2861
  };
2800
2862
  return tableOrder;
2801
2863
  }
@@ -2818,10 +2880,29 @@ const Table$1 = class Table {
2818
2880
  return formatDigits;
2819
2881
  }
2820
2882
  prepareScenarios() {
2821
- var _a, _b, _c, _d, _e, _f, _g, _h;
2822
- const isAuto = ((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
2883
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2884
+ const inheritedScenarios = this.resolveInherited("scenarios", this.scenarios);
2885
+ const inheritedVariances = this.resolveInherited("variances", this.variances);
2886
+ if (inheritedScenarios !== undefined || inheritedVariances !== undefined) {
2887
+ this.errors.remove("AUTO_scenarios");
2888
+ let scenarios = [];
2889
+ if (inheritedScenarios !== undefined) {
2890
+ scenarios = scenarios.concat(inheritedScenarios.split(","));
2891
+ }
2892
+ else if (!isBlankInput(this.scenarios)) {
2893
+ scenarios = scenarios.concat(this.scenarios.split(","));
2894
+ }
2895
+ if (inheritedVariances !== undefined) {
2896
+ scenarios = scenarios.concat(inheritedVariances.split(","));
2897
+ }
2898
+ else if (((_a = this.variances) === null || _a === void 0 ? void 0 : _a.trim().length) > 0) {
2899
+ scenarios = scenarios.concat(this.variances.split(","));
2900
+ }
2901
+ return scenarios.map((entry) => entry.trim());
2902
+ }
2903
+ const isAuto = ((_b = this.scenarios) === null || _b === void 0 ? void 0 : _b.trim().toLowerCase()) === "auto";
2823
2904
  if ((isBlankInput(this.scenarios) || isAuto) && isBlankInput(this.variances)) {
2824
- if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
2905
+ if (((_d = (_c = this.datasetMeta) === null || _c === void 0 ? void 0 : _c.availableScenarios) === null || _d === void 0 ? void 0 : _d.length) > 0) {
2825
2906
  if (!isAuto) {
2826
2907
  this.errors.addOrReplace({
2827
2908
  id: "AUTO_scenarios",
@@ -2838,7 +2919,7 @@ const Table$1 = class Table {
2838
2919
  }
2839
2920
  let scenarios = [];
2840
2921
  if (isAuto || isBlankInput(this.scenarios)) {
2841
- if (((_e = (_d = this.datasetMeta) === null || _d === void 0 ? void 0 : _d.availableScenarios) === null || _e === void 0 ? void 0 : _e.length) > 0) {
2922
+ if (((_f = (_e = this.datasetMeta) === null || _e === void 0 ? void 0 : _e.availableScenarios) === null || _f === void 0 ? void 0 : _f.length) > 0) {
2842
2923
  if (!isAuto) {
2843
2924
  this.errors.addOrReplace({
2844
2925
  id: "AUTO_scenarios",
@@ -2854,10 +2935,10 @@ const Table$1 = class Table {
2854
2935
  }
2855
2936
  else {
2856
2937
  this.errors.remove("AUTO_scenarios");
2857
- scenarios = scenarios.concat((_f = this.scenarios) === null || _f === void 0 ? void 0 : _f.split(","));
2938
+ scenarios = scenarios.concat((_g = this.scenarios) === null || _g === void 0 ? void 0 : _g.split(","));
2858
2939
  }
2859
- if (((_g = this.variances) === null || _g === void 0 ? void 0 : _g.trim().length) > 0) {
2860
- scenarios = scenarios.concat((_h = this.variances) === null || _h === void 0 ? void 0 : _h.split(","));
2940
+ if (((_h = this.variances) === null || _h === void 0 ? void 0 : _h.trim().length) > 0) {
2941
+ scenarios = scenarios.concat((_j = this.variances) === null || _j === void 0 ? void 0 : _j.split(","));
2861
2942
  }
2862
2943
  return scenarios.map((entry) => entry.trim());
2863
2944
  }
@@ -3010,7 +3091,7 @@ const Table$1 = class Table {
3010
3091
  render() {
3011
3092
  const fontStyles = this.getFontStyles();
3012
3093
  const effectiveFactor = this.getEffectiveScaleFactor();
3013
- return (h(Host, { key: '3690ce4fee5e38012a2f956035110cc3e2500b39', style: fontStyles }, h("div", { key: 'e6481956a6873beefb15ea7369a7352d2662c1a2' }, h("ibcs-table", { key: '3260517d31fa04294c8df293a6fefd88b129f7b6', 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 }))));
3094
+ 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 }))));
3014
3095
  }
3015
3096
  get element() { return getElement(this); }
3016
3097
  static get watchers() { return {
@@ -5,6 +5,7 @@ import { w as withComponentStatus } from './withComponentStatus-DodoSXe-.js';
5
5
  import { g as globalLabelKeys } from './context-protocol-2peaD4y8.js';
6
6
  import { w as withComponentStyle } from './withComponentStyle-D3VWOsto.js';
7
7
  import { w as withHasError } from './withHasError-B3QX2emi.js';
8
+ import { i as isInheritedValue, w as withInheritedProps } from './withInheritedProps-BlXDxhHK.js';
8
9
  import { O as OrderDirection, a as OrderColumn, D as DateDistance, A as AxisLabelsMode, S as StackBy, b as StackOrder, c as StackMode, C as ChartMode } from './Order-sRO-lj7X.js';
9
10
  import { F as Formatter } from './formatter-BDh7GfC5.js';
10
11
 
@@ -21,8 +22,12 @@ var AggregationLevel;
21
22
  })(AggregationLevel || (AggregationLevel = {}));
22
23
  const Chart = class {
23
24
  validateScenario(newValue) {
24
- const invalidScenarios = validateScenarioList(newValue);
25
25
  const errId = "ERR_scenarios";
26
+ if (isInheritedValue(newValue)) {
27
+ this.errors.remove(errId);
28
+ return;
29
+ }
30
+ const invalidScenarios = validateScenarioList(newValue);
26
31
  if (invalidScenarios.length > 0) {
27
32
  this.errors.addOrReplace({
28
33
  id: errId,
@@ -36,6 +41,10 @@ const Chart = class {
36
41
  }
37
42
  validateVariances(newValue) {
38
43
  const errIdVar = "ERR_variances";
44
+ if (isInheritedValue(newValue)) {
45
+ this.errors.remove(errIdVar);
46
+ return;
47
+ }
39
48
  const invalidVariances = validateVariancesList(newValue);
40
49
  if (invalidVariances.length > 0) {
41
50
  this.errors.addOrReplace({
@@ -115,6 +124,10 @@ const Chart = class {
115
124
  }
116
125
  validateOrderList(newValue) {
117
126
  const errId = "ERR_order";
127
+ if (isInheritedValue(newValue)) {
128
+ this.errors.remove(errId);
129
+ return;
130
+ }
118
131
  const invalidElements = validateOrderList(newValue);
119
132
  if (invalidElements.length > 0) {
120
133
  this.errors.addOrReplace({
@@ -129,6 +142,10 @@ const Chart = class {
129
142
  }
130
143
  validateOrderDirection(newValue) {
131
144
  const errId = "ERR_orderDirection";
145
+ if (isInheritedValue(newValue)) {
146
+ this.errors.remove(errId);
147
+ return;
148
+ }
132
149
  if (!isValidDirection(newValue)) {
133
150
  this.errors.addOrReplace({
134
151
  id: errId,
@@ -456,6 +473,12 @@ const Chart = class {
456
473
  this.errors = withHasError(this);
457
474
  this.componentStyle = withComponentStyle(this);
458
475
  this.t = withTranslation(this).t;
476
+ this.resolveInherited = withInheritedProps(this, [
477
+ { propName: "scenarios", ancestorAttr: "title-scenarios" },
478
+ { propName: "variances", ancestorAttr: "title-variances" },
479
+ { propName: "order", ancestorAttr: "title-order" },
480
+ { propName: "orderDirection", ancestorAttr: "title-order-direction" },
481
+ ]);
459
482
  }
460
483
  componentWillLoad() {
461
484
  this.validateScenario(this.scenarios);
@@ -548,6 +571,11 @@ const Chart = class {
548
571
  }
549
572
  prepareScenarios() {
550
573
  var _a, _b, _c, _d;
574
+ const inherited = this.resolveInherited("scenarios", this.scenarios);
575
+ if (inherited !== undefined) {
576
+ this.errors.remove("AUTO_scenarios");
577
+ return inherited.split(",").map((entry) => entry.trim());
578
+ }
551
579
  const isAuto = ((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
552
580
  if (isBlankInput(this.scenarios) || isAuto) {
553
581
  if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
@@ -576,6 +604,10 @@ const Chart = class {
576
604
  }
577
605
  prepareVariances() {
578
606
  var _a;
607
+ const inherited = this.resolveInherited("variances", this.variances);
608
+ if (inherited !== undefined) {
609
+ return inherited.split(",").map((entry) => entry.trim());
610
+ }
579
611
  if (isBlankInput(this.variances)) {
580
612
  return [];
581
613
  }
@@ -644,12 +676,16 @@ const Chart = class {
644
676
  return AggregationLevel[(_c = this.level) === null || _c === void 0 ? void 0 : _c.toUpperCase()];
645
677
  }
646
678
  prepareOrder() {
647
- var _a, _b, _c, _d, _e, _f;
679
+ var _a, _b, _c;
680
+ const inheritedOrder = this.resolveInherited("order", this.order);
681
+ const inheritedDirection = this.resolveInherited("orderDirection", this.orderDirection);
682
+ const effectiveOrder = inheritedOrder !== null && inheritedOrder !== void 0 ? inheritedOrder : this.order;
683
+ const effectiveDirection = inheritedDirection !== null && inheritedDirection !== void 0 ? inheritedDirection : this.orderDirection;
648
684
  const isLevelAuto = isBlankInput(this.level) || ((_a = this.level) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
649
685
  let entryValue = isLevelAuto && ((_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.suggestedLevel) ? this.datasetMeta.suggestedLevel : this.level;
650
- const isOrderAuto = ((_c = this.order) === null || _c === void 0 ? void 0 : _c.trim().toLowerCase()) === "auto";
651
- if (isBlankInput(this.order) || isOrderAuto) {
652
- if ((_d = this.datasetMeta) === null || _d === void 0 ? void 0 : _d.suggestedLevel) {
686
+ const isOrderAuto = (effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.trim().toLowerCase()) === "auto";
687
+ if (isBlankInput(effectiveOrder) || isOrderAuto) {
688
+ if ((_c = this.datasetMeta) === null || _c === void 0 ? void 0 : _c.suggestedLevel) {
653
689
  if (!isOrderAuto) {
654
690
  this.errors.addOrReplace({
655
691
  id: "AUTO_order",
@@ -664,13 +700,13 @@ const Chart = class {
664
700
  }
665
701
  else {
666
702
  this.errors.remove("AUTO_order");
667
- if (((_e = this.order) === null || _e === void 0 ? void 0 : _e.toLocaleLowerCase()) === "levelindex") {
703
+ if ((effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.toLocaleLowerCase()) === "levelindex") {
668
704
  entryValue += "Index";
669
705
  }
670
706
  }
671
707
  const tableOrder = {
672
708
  hierarchy: [OrderColumn[entryValue === null || entryValue === void 0 ? void 0 : entryValue.toUpperCase()]],
673
- direction: OrderDirection[(_f = this.orderDirection) === null || _f === void 0 ? void 0 : _f.toUpperCase()],
709
+ direction: OrderDirection[effectiveDirection === null || effectiveDirection === void 0 ? void 0 : effectiveDirection.toUpperCase()],
674
710
  };
675
711
  return tableOrder;
676
712
  }
@@ -919,7 +955,7 @@ const Chart = class {
919
955
  scenariosArray = [...scenariosArray, ...variancesArray];
920
956
  }
921
957
  const fontStyles = this.getFontStyles();
922
- return (h(Host, { key: 'ecbf96e2d037a7dad9b3380bcc28b6e010ac867c', style: fontStyles }, h("div", { key: 'c556b86aac629e59c601986650d1a4857a2ee068', class: "container" }, scenariosArray.map(this.chartTemplate))));
958
+ return (h(Host, { key: 'd0625657fc6ddbacf7ad5c4cede189cc321109e1', style: fontStyles }, h("div", { key: '393a0c8b00028b3edd08d6e199ffe55014251a5d', class: "container" }, scenariosArray.map(this.chartTemplate))));
923
959
  }
924
960
  get element() { return getElement(this); }
925
961
  static get watchers() { return {
@@ -1,6 +1,7 @@
1
1
  import { r as registerInstance, h, F as Fragment, g as getElement } from './index-JNHhIe7t.js';
2
2
  import { a as getStores } from './context-protocol-2peaD4y8.js';
3
3
  import { w as withHasError } from './withHasError-B3QX2emi.js';
4
+ import { w as withInheritedProps } from './withInheritedProps-BlXDxhHK.js';
4
5
 
5
6
  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:block;flex-direction:column;overflow:hidden;float:left;clear:left}.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}`;
6
7
 
@@ -128,9 +129,18 @@ const LayoutCard = class {
128
129
  ["gold4", '"a b c c" "d d c c"'],
129
130
  ]);
130
131
  this.errors = withHasError(this);
132
+ this.resolveInherited = withInheritedProps(this, [
133
+ { propName: "titleScenarios", ancestorAttr: "title-scenarios" },
134
+ { propName: "titleVariances", ancestorAttr: "title-variances" },
135
+ { propName: "titleOrder", ancestorAttr: "title-order" },
136
+ { propName: "titleOrderDirection", ancestorAttr: "title-order-direction" },
137
+ ]);
131
138
  }
132
139
  connectedCallback() {
133
140
  this.stores = getStores(this.element);
141
+ // Reflect resolved inherited values to host attributes so child vis
142
+ // components can read them during their own DOM traversal.
143
+ this.reflectInheritedAttrs();
134
144
  }
135
145
  getCommonStyles() {
136
146
  let height = "100%";
@@ -221,6 +231,26 @@ const LayoutCard = class {
221
231
  }
222
232
  return "card_box";
223
233
  }
234
+ /**
235
+ * When the card itself inherits a title prop from a page, write the
236
+ * resolved value back to the host element's attribute so that child
237
+ * vis components (bn-table, bn-chart-*) performing their own DOM walk
238
+ * read the actual value instead of the literal "inherited-page" keyword.
239
+ */
240
+ reflectInheritedAttrs() {
241
+ const mappings = [
242
+ { prop: "titleScenarios", attr: "title-scenarios" },
243
+ { prop: "titleVariances", attr: "title-variances" },
244
+ { prop: "titleOrder", attr: "title-order" },
245
+ { prop: "titleOrderDirection", attr: "title-order-direction" },
246
+ ];
247
+ for (const { prop, attr } of mappings) {
248
+ const resolved = this.resolveInherited(prop, this[prop]);
249
+ if (resolved !== undefined) {
250
+ this.element.setAttribute(attr, resolved);
251
+ }
252
+ }
253
+ }
224
254
  prepareTitleImage(value) {
225
255
  if (value == null || value === "") {
226
256
  return "";
@@ -233,11 +263,12 @@ const LayoutCard = class {
233
263
  return assetsState[value] || value;
234
264
  }
235
265
  render() {
266
+ var _a, _b, _c, _d;
236
267
  const style = this.getLayoutStyle();
237
268
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
238
269
  return (
239
270
  // @ts-ignore
240
- h("bn-card", { key: 'e920b128510046289f0960c19abb1eadb2751204', styles: this.styles, class: this.setCardClass() }, h("div", { key: 'de7b2ed78aade1a7c2d0a8a69cd1f7b47eef2414', class: "cardtitle" }, h("bn-title", { key: '72fd36fe7e0bc2d628825b69114b81e04669143d', 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 }), this.titleImage != null && this.titleImage !== "" ? (h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), h("bn-body", { key: '1d3a6da80bcaab5ab2d9442edd548bc408f10563' }, h("div", { key: 'e24cfa54735c0b401e34825a8da7327555c120c5', style: style }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'c2307c5dcb8058d49465fbafa7d5aaa6e5dc4488', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
271
+ 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" })));
241
272
  }
242
273
  get element() { return getElement(this); }
243
274
  };
@@ -0,0 +1,154 @@
1
+ import { g as getElement, f as forceUpdate } from './index-JNHhIe7t.js';
2
+ import { r as runIfExisits } from './withHasError-B3QX2emi.js';
3
+
4
+ /**
5
+ * Reserved prop values that activate inheritance from ancestor layout
6
+ * components (`bn-layout-card` or `bn-layout-page`).
7
+ */
8
+ const INHERITED_CLOSEST = "inherited-closest";
9
+ const INHERITED_PAGE = "inherited-page";
10
+ /** Tags that qualify as inheritance ancestors. */
11
+ const ANCESTOR_CARD = "bn-layout-card";
12
+ const ANCESTOR_PAGE = "bn-layout-page";
13
+ /**
14
+ * Returns `true` when `value` is one of the recognised inheritance keywords.
15
+ */
16
+ function isInheritedValue(value) {
17
+ return value === INHERITED_CLOSEST || value === INHERITED_PAGE;
18
+ }
19
+ /**
20
+ * Walks up the DOM tree (crossing shadow boundaries) to find the nearest
21
+ * ancestor layout component.
22
+ *
23
+ * - `"inherited-closest"` matches the first `bn-layout-card` or `bn-layout-page`.
24
+ * - `"inherited-page"` skips cards and matches only `bn-layout-page`.
25
+ *
26
+ * Uses the same traversal pattern as `findContextElement` in
27
+ * `context-protocol.ts`.
28
+ */
29
+ function findAncestor(element, mode) {
30
+ let current = element.parentNode;
31
+ while (current) {
32
+ if (current instanceof HTMLElement) {
33
+ const tag = current.nodeName.toLowerCase();
34
+ if (mode === INHERITED_PAGE) {
35
+ if (tag === ANCESTOR_PAGE)
36
+ return current;
37
+ }
38
+ else {
39
+ if (tag === ANCESTOR_CARD || tag === ANCESTOR_PAGE)
40
+ return current;
41
+ }
42
+ }
43
+ if (current.parentNode) {
44
+ current = current.parentNode;
45
+ }
46
+ else if (current instanceof ShadowRoot) {
47
+ current = current.host;
48
+ }
49
+ else {
50
+ break;
51
+ }
52
+ }
53
+ return undefined;
54
+ }
55
+ /**
56
+ * Mixin that enables property inheritance from ancestor layout components.
57
+ *
58
+ * When a component sets a prop to `"inherited-closest"` or `"inherited-page"`,
59
+ * this mixin resolves the actual value by walking up the DOM to find the
60
+ * nearest `bn-layout-card` / `bn-layout-page` and reading the corresponding
61
+ * HTML attribute. A `MutationObserver` watches the ancestor for attribute
62
+ * changes, triggering a re-render when inherited values update.
63
+ *
64
+ * Follows the same decorator-style pattern as `withComponentStyle`.
65
+ *
66
+ * @param component The Stencil component instance
67
+ * @param mappings Array of prop-to-attribute mappings
68
+ * @returns A resolver function used inside `prepare*()` methods
69
+ */
70
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
+ const withInheritedProps = (component, mappings) => {
72
+ /** Resolved values keyed by propName. */
73
+ const resolved = new Map();
74
+ /** Observer watching the ancestor element's attributes. */
75
+ let observer = null;
76
+ /** The ancestor element currently being observed. */
77
+ let ancestorEl;
78
+ /**
79
+ * For each mapping whose prop is an inheritance keyword, walk the DOM once
80
+ * and read the corresponding attribute from the ancestor.
81
+ */
82
+ const resolveAll = () => {
83
+ const element = getElement(component);
84
+ resolved.clear();
85
+ // Determine which attrs to watch on which ancestor
86
+ const attrsToWatch = [];
87
+ for (const mapping of mappings) {
88
+ const value = component[mapping.propName];
89
+ if (typeof value !== "string" || !isInheritedValue(value))
90
+ continue;
91
+ // Find ancestor (re-use the first one found for the same mode)
92
+ if (!ancestorEl) {
93
+ ancestorEl = findAncestor(element, value);
94
+ }
95
+ if (!ancestorEl)
96
+ continue;
97
+ const attrValue = ancestorEl.getAttribute(mapping.ancestorAttr);
98
+ if (attrValue != null) {
99
+ resolved.set(mapping.propName, attrValue);
100
+ }
101
+ attrsToWatch.push(mapping.ancestorAttr);
102
+ }
103
+ // Set up MutationObserver on the ancestor
104
+ if (ancestorEl && attrsToWatch.length > 0) {
105
+ observer = new MutationObserver(() => {
106
+ // Re-read all inherited attributes from the ancestor
107
+ for (const mapping of mappings) {
108
+ if (!isInheritedValue(component[mapping.propName]))
109
+ continue;
110
+ const attrValue = ancestorEl.getAttribute(mapping.ancestorAttr);
111
+ if (attrValue != null) {
112
+ resolved.set(mapping.propName, attrValue);
113
+ }
114
+ else {
115
+ resolved.delete(mapping.propName);
116
+ }
117
+ }
118
+ forceUpdate(component);
119
+ });
120
+ observer.observe(ancestorEl, {
121
+ attributes: true,
122
+ attributeFilter: attrsToWatch,
123
+ });
124
+ }
125
+ };
126
+ const connectedCallback = component["connectedCallback"];
127
+ component["connectedCallback"] = () => {
128
+ resolveAll();
129
+ runIfExisits(connectedCallback, component);
130
+ };
131
+ const disconnectedCallback = component["disconnectedCallback"];
132
+ component["disconnectedCallback"] = () => {
133
+ if (observer) {
134
+ observer.disconnect();
135
+ observer = null;
136
+ }
137
+ ancestorEl = undefined;
138
+ resolved.clear();
139
+ runIfExisits(disconnectedCallback, component);
140
+ };
141
+ /**
142
+ * Resolver: returns the inherited value for the given prop, or `undefined`
143
+ * when the prop is not using inheritance (so the caller falls through to
144
+ * its normal logic).
145
+ */
146
+ const resolve = (propName, currentValue) => {
147
+ if (!isInheritedValue(currentValue))
148
+ return undefined;
149
+ return resolved.get(propName);
150
+ };
151
+ return resolve;
152
+ };
153
+
154
+ export { isInheritedValue as i, withInheritedProps as w };
@@ -18,6 +18,7 @@ export declare class Chart {
18
18
  private readonly t;
19
19
  private readonly componentStyle;
20
20
  private readonly errors;
21
+ private readonly resolveInherited;
21
22
  /**
22
23
  * Title displayed above the chart. When empty, the title is derived
23
24
  * from the variance scenario labels (if variances are configured).
@@ -18,6 +18,7 @@ export declare class Chart {
18
18
  private readonly t;
19
19
  private readonly componentStyle;
20
20
  private readonly errors;
21
+ private readonly resolveInherited;
21
22
  /**
22
23
  * Custom chart title
23
24
  */