@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
@@ -8,6 +8,7 @@ var withHasError = require('./withHasError-B8gHkfV2.js');
8
8
  var withComponentStyle = require('./withComponentStyle-ClSJfCku.js');
9
9
  var withStyled = require('./withStyled-9tG024gQ.js');
10
10
  var scaling = require('./scaling-BidPsO53.js');
11
+ var withInheritedProps = require('./withInheritedProps-BH2KNER3.js');
11
12
  var Order = require('./Order-BGx39pS5.js');
12
13
  var SVGVariancesStyleGroup = require('./SVGVariancesStyleGroup-BqAdPYtL.js');
13
14
  var formatter = require('./formatter-4XCS0d2B.js');
@@ -75,8 +76,12 @@ const bnChartStructureCss$1 = () => `:host{display:inline-block;position:relativ
75
76
 
76
77
  const Chart = class {
77
78
  validateScenario(newValue) {
78
- const invalidScenarios = withStyled.validateScenarioList(newValue);
79
79
  const errId = "ERR_scenarios";
80
+ if (withInheritedProps.isInheritedValue(newValue)) {
81
+ this.errors.remove(errId);
82
+ return;
83
+ }
84
+ const invalidScenarios = withStyled.validateScenarioList(newValue);
80
85
  if (invalidScenarios.length > 0) {
81
86
  this.errors.addOrReplace({
82
87
  id: errId,
@@ -90,6 +95,10 @@ const Chart = class {
90
95
  }
91
96
  validateVariances(newValue) {
92
97
  const errIdVar = "ERR_variances";
98
+ if (withInheritedProps.isInheritedValue(newValue)) {
99
+ this.errors.remove(errIdVar);
100
+ return;
101
+ }
93
102
  const invalidVariances = withStyled.validateVariancesList(newValue);
94
103
  if (invalidVariances.length > 0) {
95
104
  this.errors.addOrReplace({
@@ -142,8 +151,12 @@ const Chart = class {
142
151
  }
143
152
  }
144
153
  validateOrderList(newValue) {
145
- const invalidElements = withStyled.validateOrderList(newValue);
146
154
  const errId = "ERR_order";
155
+ if (withInheritedProps.isInheritedValue(newValue)) {
156
+ this.errors.remove(errId);
157
+ return;
158
+ }
159
+ const invalidElements = withStyled.validateOrderList(newValue);
147
160
  if (invalidElements.length > 0) {
148
161
  this.errors.addOrReplace({
149
162
  id: errId,
@@ -157,6 +170,10 @@ const Chart = class {
157
170
  }
158
171
  validateOrderDirection(newValue) {
159
172
  const errId = "ERR_orderDirection";
173
+ if (withInheritedProps.isInheritedValue(newValue)) {
174
+ this.errors.remove(errId);
175
+ return;
176
+ }
160
177
  if (!withStyled.isValidDirection(newValue)) {
161
178
  this.errors.addOrReplace({
162
179
  id: errId,
@@ -363,6 +380,12 @@ const Chart = class {
363
380
  this.errors = withHasError.withHasError(this);
364
381
  this.componentStyle = withComponentStyle.withComponentStyle(this);
365
382
  this.t = scaling.withTranslation(this).t;
383
+ this.resolveInherited = withInheritedProps.withInheritedProps(this, [
384
+ { propName: "scenarios", ancestorAttr: "title-scenarios" },
385
+ { propName: "variances", ancestorAttr: "title-variances" },
386
+ { propName: "order", ancestorAttr: "title-order" },
387
+ { propName: "orderDirection", ancestorAttr: "title-order-direction" },
388
+ ]);
366
389
  }
367
390
  componentWillLoad() {
368
391
  this.validateScenario(this.scenarios);
@@ -463,6 +486,11 @@ const Chart = class {
463
486
  }
464
487
  prepareScenarios() {
465
488
  var _a, _b, _c, _d;
489
+ const inherited = this.resolveInherited("scenarios", this.scenarios);
490
+ if (inherited !== undefined) {
491
+ this.errors.remove("AUTO_scenarios");
492
+ return inherited.split(",").map((entry) => entry.trim());
493
+ }
466
494
  const isAuto = ((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
467
495
  if (withStyled.isBlankInput(this.scenarios) || isAuto) {
468
496
  if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
@@ -485,6 +513,10 @@ const Chart = class {
485
513
  }
486
514
  prepareVariances() {
487
515
  var _a;
516
+ const inherited = this.resolveInherited("variances", this.variances);
517
+ if (inherited !== undefined) {
518
+ return inherited.split(",").map((entry) => entry.trim());
519
+ }
488
520
  if (withStyled.isBlankInput(this.variances)) {
489
521
  return [];
490
522
  }
@@ -553,11 +585,15 @@ const Chart = class {
553
585
  return Order.AggregationLevel[(_c = this.level) === null || _c === void 0 ? void 0 : _c.toUpperCase()];
554
586
  }
555
587
  prepareOrder() {
556
- var _a, _b, _c;
557
- const isAuto = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
588
+ var _a;
589
+ const inheritedOrder = this.resolveInherited("order", this.order);
590
+ const inheritedDirection = this.resolveInherited("orderDirection", this.orderDirection);
591
+ const effectiveOrder = inheritedOrder !== null && inheritedOrder !== void 0 ? inheritedOrder : this.order;
592
+ const effectiveDirection = inheritedDirection !== null && inheritedDirection !== void 0 ? inheritedDirection : this.orderDirection;
593
+ const isAuto = (effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.trim().toLowerCase()) === "auto";
558
594
  let orderStr;
559
- if (withStyled.isBlankInput(this.order) || isAuto) {
560
- if ((_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.suggestedOrder) {
595
+ if (withStyled.isBlankInput(effectiveOrder) || isAuto) {
596
+ if ((_a = this.datasetMeta) === null || _a === void 0 ? void 0 : _a.suggestedOrder) {
561
597
  if (!isAuto) {
562
598
  this.errors.addOrReplace({
563
599
  id: "AUTO_order",
@@ -571,16 +607,16 @@ const Chart = class {
571
607
  orderStr = this.datasetMeta.suggestedOrder;
572
608
  }
573
609
  else {
574
- orderStr = this.order;
610
+ orderStr = effectiveOrder;
575
611
  }
576
612
  }
577
613
  else {
578
614
  this.errors.remove("AUTO_order");
579
- orderStr = this.order;
615
+ orderStr = effectiveOrder;
580
616
  }
581
617
  const tableOrder = {
582
618
  hierarchy: orderStr === null || orderStr === void 0 ? void 0 : orderStr.split(",").map((entry) => Order.OrderColumn[entry === null || entry === void 0 ? void 0 : entry.toUpperCase()]),
583
- direction: Order.OrderDirection[(_c = this.orderDirection) === null || _c === void 0 ? void 0 : _c.toUpperCase()],
619
+ direction: Order.OrderDirection[effectiveDirection === null || effectiveDirection === void 0 ? void 0 : effectiveDirection.toUpperCase()],
584
620
  };
585
621
  return tableOrder;
586
622
  }
@@ -768,7 +804,7 @@ const Chart = class {
768
804
  scenariosArray = [...scenariosArray, ...variancesArray];
769
805
  }
770
806
  const fontStyles = this.getFontStyles();
771
- return (index.h(index.Host, { key: '570fb741ddf481be0f3055d346314ad39a455361', style: fontStyles }, index.h("div", { key: 'e84cfe2e00dd2f960f038844e00449431efa6ce0', class: "container" }, scenariosArray.map(this.chartTemplate))));
807
+ return (index.h(index.Host, { key: '528b1d9607de916cb2ed06a2f2bac2acdc85da30', style: fontStyles }, index.h("div", { key: 'e5454756d03fc081e843dee241c52695212da4e3', class: "container" }, scenariosArray.map(this.chartTemplate))));
772
808
  }
773
809
  get element() { return index.getElement(this); }
774
810
  static get watchers() { return {
@@ -2374,9 +2410,19 @@ const Table$1 = class Table {
2374
2410
  this.datasetMeta = meta;
2375
2411
  });
2376
2412
  this.t = scaling.withTranslation(this).t;
2413
+ this.resolveInherited = withInheritedProps.withInheritedProps(this, [
2414
+ { propName: "scenarios", ancestorAttr: "title-scenarios" },
2415
+ { propName: "variances", ancestorAttr: "title-variances" },
2416
+ { propName: "order", ancestorAttr: "title-order" },
2417
+ { propName: "orderDirection", ancestorAttr: "title-order-direction" },
2418
+ ]);
2377
2419
  }
2378
2420
  validateScenario(newValue) {
2379
2421
  const errId = "ERR_scenarios";
2422
+ if (withInheritedProps.isInheritedValue(newValue)) {
2423
+ this.errors.remove(errId);
2424
+ return;
2425
+ }
2380
2426
  const invalidScenarios = withStyled.validateScenarioList(newValue);
2381
2427
  if (invalidScenarios.length > 0) {
2382
2428
  this.errors.addOrReplace({
@@ -2391,6 +2437,10 @@ const Table$1 = class Table {
2391
2437
  }
2392
2438
  validateVariances(newValue) {
2393
2439
  const errId = "ERR_variances";
2440
+ if (withInheritedProps.isInheritedValue(newValue)) {
2441
+ this.errors.remove(errId);
2442
+ return;
2443
+ }
2394
2444
  const invalidVariances = withStyled.validateVariancesList(newValue);
2395
2445
  if (invalidVariances.length > 0) {
2396
2446
  this.errors.addOrReplace({
@@ -2568,6 +2618,10 @@ const Table$1 = class Table {
2568
2618
  }
2569
2619
  validateOrderList(newValue) {
2570
2620
  const errId = "ERR_order";
2621
+ if (withInheritedProps.isInheritedValue(newValue)) {
2622
+ this.errors.remove(errId);
2623
+ return;
2624
+ }
2571
2625
  const invalidElements = withStyled.validateOrderList(newValue);
2572
2626
  if (invalidElements.length > 0) {
2573
2627
  this.errors.addOrReplace({
@@ -2582,6 +2636,10 @@ const Table$1 = class Table {
2582
2636
  }
2583
2637
  validateOrderDirection(newValue) {
2584
2638
  const errId = "ERR_orderDirection";
2639
+ if (withInheritedProps.isInheritedValue(newValue)) {
2640
+ this.errors.remove(errId);
2641
+ return;
2642
+ }
2585
2643
  if (!withStyled.isValidDirection(newValue)) {
2586
2644
  this.errors.addOrReplace({
2587
2645
  id: errId,
@@ -2789,15 +2847,19 @@ const Table$1 = class Table {
2789
2847
  return JSON.parse(this.partof);
2790
2848
  }
2791
2849
  prepareOrder() {
2792
- var _a, _b, _c;
2793
- const isAuto = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
2794
- let orderStr = this.order;
2795
- if (isAuto && ((_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.suggestedOrder)) {
2850
+ var _a;
2851
+ const inheritedOrder = this.resolveInherited("order", this.order);
2852
+ const inheritedDirection = this.resolveInherited("orderDirection", this.orderDirection);
2853
+ const effectiveOrder = inheritedOrder !== null && inheritedOrder !== void 0 ? inheritedOrder : this.order;
2854
+ const effectiveDirection = inheritedDirection !== null && inheritedDirection !== void 0 ? inheritedDirection : this.orderDirection;
2855
+ const isAuto = (effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.trim().toLowerCase()) === "auto";
2856
+ let orderStr = effectiveOrder;
2857
+ if (isAuto && ((_a = this.datasetMeta) === null || _a === void 0 ? void 0 : _a.suggestedOrder)) {
2796
2858
  orderStr = this.datasetMeta.suggestedOrder;
2797
2859
  }
2798
2860
  const tableOrder = {
2799
2861
  hierarchy: orderStr.split(",").map((entry) => Order.OrderColumn[entry === null || entry === void 0 ? void 0 : entry.toUpperCase()]),
2800
- direction: Order.OrderDirection[(_c = this.orderDirection) === null || _c === void 0 ? void 0 : _c.toUpperCase()],
2862
+ direction: Order.OrderDirection[effectiveDirection === null || effectiveDirection === void 0 ? void 0 : effectiveDirection.toUpperCase()],
2801
2863
  };
2802
2864
  return tableOrder;
2803
2865
  }
@@ -2820,10 +2882,29 @@ const Table$1 = class Table {
2820
2882
  return formatDigits;
2821
2883
  }
2822
2884
  prepareScenarios() {
2823
- var _a, _b, _c, _d, _e, _f, _g, _h;
2824
- const isAuto = ((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
2885
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2886
+ const inheritedScenarios = this.resolveInherited("scenarios", this.scenarios);
2887
+ const inheritedVariances = this.resolveInherited("variances", this.variances);
2888
+ if (inheritedScenarios !== undefined || inheritedVariances !== undefined) {
2889
+ this.errors.remove("AUTO_scenarios");
2890
+ let scenarios = [];
2891
+ if (inheritedScenarios !== undefined) {
2892
+ scenarios = scenarios.concat(inheritedScenarios.split(","));
2893
+ }
2894
+ else if (!withStyled.isBlankInput(this.scenarios)) {
2895
+ scenarios = scenarios.concat(this.scenarios.split(","));
2896
+ }
2897
+ if (inheritedVariances !== undefined) {
2898
+ scenarios = scenarios.concat(inheritedVariances.split(","));
2899
+ }
2900
+ else if (((_a = this.variances) === null || _a === void 0 ? void 0 : _a.trim().length) > 0) {
2901
+ scenarios = scenarios.concat(this.variances.split(","));
2902
+ }
2903
+ return scenarios.map((entry) => entry.trim());
2904
+ }
2905
+ const isAuto = ((_b = this.scenarios) === null || _b === void 0 ? void 0 : _b.trim().toLowerCase()) === "auto";
2825
2906
  if ((withStyled.isBlankInput(this.scenarios) || isAuto) && withStyled.isBlankInput(this.variances)) {
2826
- if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
2907
+ if (((_d = (_c = this.datasetMeta) === null || _c === void 0 ? void 0 : _c.availableScenarios) === null || _d === void 0 ? void 0 : _d.length) > 0) {
2827
2908
  if (!isAuto) {
2828
2909
  this.errors.addOrReplace({
2829
2910
  id: "AUTO_scenarios",
@@ -2840,7 +2921,7 @@ const Table$1 = class Table {
2840
2921
  }
2841
2922
  let scenarios = [];
2842
2923
  if (isAuto || withStyled.isBlankInput(this.scenarios)) {
2843
- if (((_e = (_d = this.datasetMeta) === null || _d === void 0 ? void 0 : _d.availableScenarios) === null || _e === void 0 ? void 0 : _e.length) > 0) {
2924
+ if (((_f = (_e = this.datasetMeta) === null || _e === void 0 ? void 0 : _e.availableScenarios) === null || _f === void 0 ? void 0 : _f.length) > 0) {
2844
2925
  if (!isAuto) {
2845
2926
  this.errors.addOrReplace({
2846
2927
  id: "AUTO_scenarios",
@@ -2856,10 +2937,10 @@ const Table$1 = class Table {
2856
2937
  }
2857
2938
  else {
2858
2939
  this.errors.remove("AUTO_scenarios");
2859
- scenarios = scenarios.concat((_f = this.scenarios) === null || _f === void 0 ? void 0 : _f.split(","));
2940
+ scenarios = scenarios.concat((_g = this.scenarios) === null || _g === void 0 ? void 0 : _g.split(","));
2860
2941
  }
2861
- if (((_g = this.variances) === null || _g === void 0 ? void 0 : _g.trim().length) > 0) {
2862
- scenarios = scenarios.concat((_h = this.variances) === null || _h === void 0 ? void 0 : _h.split(","));
2942
+ if (((_h = this.variances) === null || _h === void 0 ? void 0 : _h.trim().length) > 0) {
2943
+ scenarios = scenarios.concat((_j = this.variances) === null || _j === void 0 ? void 0 : _j.split(","));
2863
2944
  }
2864
2945
  return scenarios.map((entry) => entry.trim());
2865
2946
  }
@@ -3012,7 +3093,7 @@ const Table$1 = class Table {
3012
3093
  render() {
3013
3094
  const fontStyles = this.getFontStyles();
3014
3095
  const effectiveFactor = this.getEffectiveScaleFactor();
3015
- return (index.h(index.Host, { key: '3690ce4fee5e38012a2f956035110cc3e2500b39', style: fontStyles }, index.h("div", { key: 'e6481956a6873beefb15ea7369a7352d2662c1a2' }, index.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 }))));
3096
+ return (index.h(index.Host, { key: '90572dbaa427d46b526c5a04fd04b94882fcb519', style: fontStyles }, index.h("div", { key: '947d9a31764fd0def10d902901f300c2a526dc55' }, index.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 }))));
3016
3097
  }
3017
3098
  get element() { return index.getElement(this); }
3018
3099
  static get watchers() { return {
@@ -7,6 +7,7 @@ var withComponentStatus = require('./withComponentStatus-_x4LQZ0N.js');
7
7
  var contextProtocol = require('./context-protocol-DRQWrwsA.js');
8
8
  var withComponentStyle = require('./withComponentStyle-ClSJfCku.js');
9
9
  var withHasError = require('./withHasError-B8gHkfV2.js');
10
+ var withInheritedProps = require('./withInheritedProps-BH2KNER3.js');
10
11
  var Order = require('./Order-BGx39pS5.js');
11
12
  var formatter = require('./formatter-4XCS0d2B.js');
12
13
 
@@ -23,8 +24,12 @@ var AggregationLevel;
23
24
  })(AggregationLevel || (AggregationLevel = {}));
24
25
  const Chart = class {
25
26
  validateScenario(newValue) {
26
- const invalidScenarios = withStyled.validateScenarioList(newValue);
27
27
  const errId = "ERR_scenarios";
28
+ if (withInheritedProps.isInheritedValue(newValue)) {
29
+ this.errors.remove(errId);
30
+ return;
31
+ }
32
+ const invalidScenarios = withStyled.validateScenarioList(newValue);
28
33
  if (invalidScenarios.length > 0) {
29
34
  this.errors.addOrReplace({
30
35
  id: errId,
@@ -38,6 +43,10 @@ const Chart = class {
38
43
  }
39
44
  validateVariances(newValue) {
40
45
  const errIdVar = "ERR_variances";
46
+ if (withInheritedProps.isInheritedValue(newValue)) {
47
+ this.errors.remove(errIdVar);
48
+ return;
49
+ }
41
50
  const invalidVariances = withStyled.validateVariancesList(newValue);
42
51
  if (invalidVariances.length > 0) {
43
52
  this.errors.addOrReplace({
@@ -117,6 +126,10 @@ const Chart = class {
117
126
  }
118
127
  validateOrderList(newValue) {
119
128
  const errId = "ERR_order";
129
+ if (withInheritedProps.isInheritedValue(newValue)) {
130
+ this.errors.remove(errId);
131
+ return;
132
+ }
120
133
  const invalidElements = withStyled.validateOrderList(newValue);
121
134
  if (invalidElements.length > 0) {
122
135
  this.errors.addOrReplace({
@@ -131,6 +144,10 @@ const Chart = class {
131
144
  }
132
145
  validateOrderDirection(newValue) {
133
146
  const errId = "ERR_orderDirection";
147
+ if (withInheritedProps.isInheritedValue(newValue)) {
148
+ this.errors.remove(errId);
149
+ return;
150
+ }
134
151
  if (!withStyled.isValidDirection(newValue)) {
135
152
  this.errors.addOrReplace({
136
153
  id: errId,
@@ -458,6 +475,12 @@ const Chart = class {
458
475
  this.errors = withHasError.withHasError(this);
459
476
  this.componentStyle = withComponentStyle.withComponentStyle(this);
460
477
  this.t = scaling.withTranslation(this).t;
478
+ this.resolveInherited = withInheritedProps.withInheritedProps(this, [
479
+ { propName: "scenarios", ancestorAttr: "title-scenarios" },
480
+ { propName: "variances", ancestorAttr: "title-variances" },
481
+ { propName: "order", ancestorAttr: "title-order" },
482
+ { propName: "orderDirection", ancestorAttr: "title-order-direction" },
483
+ ]);
461
484
  }
462
485
  componentWillLoad() {
463
486
  this.validateScenario(this.scenarios);
@@ -550,6 +573,11 @@ const Chart = class {
550
573
  }
551
574
  prepareScenarios() {
552
575
  var _a, _b, _c, _d;
576
+ const inherited = this.resolveInherited("scenarios", this.scenarios);
577
+ if (inherited !== undefined) {
578
+ this.errors.remove("AUTO_scenarios");
579
+ return inherited.split(",").map((entry) => entry.trim());
580
+ }
553
581
  const isAuto = ((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
554
582
  if (withStyled.isBlankInput(this.scenarios) || isAuto) {
555
583
  if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
@@ -578,6 +606,10 @@ const Chart = class {
578
606
  }
579
607
  prepareVariances() {
580
608
  var _a;
609
+ const inherited = this.resolveInherited("variances", this.variances);
610
+ if (inherited !== undefined) {
611
+ return inherited.split(",").map((entry) => entry.trim());
612
+ }
581
613
  if (withStyled.isBlankInput(this.variances)) {
582
614
  return [];
583
615
  }
@@ -646,12 +678,16 @@ const Chart = class {
646
678
  return AggregationLevel[(_c = this.level) === null || _c === void 0 ? void 0 : _c.toUpperCase()];
647
679
  }
648
680
  prepareOrder() {
649
- var _a, _b, _c, _d, _e, _f;
681
+ var _a, _b, _c;
682
+ const inheritedOrder = this.resolveInherited("order", this.order);
683
+ const inheritedDirection = this.resolveInherited("orderDirection", this.orderDirection);
684
+ const effectiveOrder = inheritedOrder !== null && inheritedOrder !== void 0 ? inheritedOrder : this.order;
685
+ const effectiveDirection = inheritedDirection !== null && inheritedDirection !== void 0 ? inheritedDirection : this.orderDirection;
650
686
  const isLevelAuto = withStyled.isBlankInput(this.level) || ((_a = this.level) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
651
687
  let entryValue = isLevelAuto && ((_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.suggestedLevel) ? this.datasetMeta.suggestedLevel : this.level;
652
- const isOrderAuto = ((_c = this.order) === null || _c === void 0 ? void 0 : _c.trim().toLowerCase()) === "auto";
653
- if (withStyled.isBlankInput(this.order) || isOrderAuto) {
654
- if ((_d = this.datasetMeta) === null || _d === void 0 ? void 0 : _d.suggestedLevel) {
688
+ const isOrderAuto = (effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.trim().toLowerCase()) === "auto";
689
+ if (withStyled.isBlankInput(effectiveOrder) || isOrderAuto) {
690
+ if ((_c = this.datasetMeta) === null || _c === void 0 ? void 0 : _c.suggestedLevel) {
655
691
  if (!isOrderAuto) {
656
692
  this.errors.addOrReplace({
657
693
  id: "AUTO_order",
@@ -666,13 +702,13 @@ const Chart = class {
666
702
  }
667
703
  else {
668
704
  this.errors.remove("AUTO_order");
669
- if (((_e = this.order) === null || _e === void 0 ? void 0 : _e.toLocaleLowerCase()) === "levelindex") {
705
+ if ((effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.toLocaleLowerCase()) === "levelindex") {
670
706
  entryValue += "Index";
671
707
  }
672
708
  }
673
709
  const tableOrder = {
674
710
  hierarchy: [Order.OrderColumn[entryValue === null || entryValue === void 0 ? void 0 : entryValue.toUpperCase()]],
675
- direction: Order.OrderDirection[(_f = this.orderDirection) === null || _f === void 0 ? void 0 : _f.toUpperCase()],
711
+ direction: Order.OrderDirection[effectiveDirection === null || effectiveDirection === void 0 ? void 0 : effectiveDirection.toUpperCase()],
676
712
  };
677
713
  return tableOrder;
678
714
  }
@@ -921,7 +957,7 @@ const Chart = class {
921
957
  scenariosArray = [...scenariosArray, ...variancesArray];
922
958
  }
923
959
  const fontStyles = this.getFontStyles();
924
- return (index.h(index.Host, { key: 'ecbf96e2d037a7dad9b3380bcc28b6e010ac867c', style: fontStyles }, index.h("div", { key: 'c556b86aac629e59c601986650d1a4857a2ee068', class: "container" }, scenariosArray.map(this.chartTemplate))));
960
+ return (index.h(index.Host, { key: 'd0625657fc6ddbacf7ad5c4cede189cc321109e1', style: fontStyles }, index.h("div", { key: '393a0c8b00028b3edd08d6e199ffe55014251a5d', class: "container" }, scenariosArray.map(this.chartTemplate))));
925
961
  }
926
962
  get element() { return index.getElement(this); }
927
963
  static get watchers() { return {
@@ -3,6 +3,7 @@
3
3
  var index = require('./index-Cjw0q6gP.js');
4
4
  var contextProtocol = require('./context-protocol-DRQWrwsA.js');
5
5
  var withHasError = require('./withHasError-B8gHkfV2.js');
6
+ var withInheritedProps = require('./withInheritedProps-BH2KNER3.js');
6
7
 
7
8
  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}`;
8
9
 
@@ -130,9 +131,18 @@ const LayoutCard = class {
130
131
  ["gold4", '"a b c c" "d d c c"'],
131
132
  ]);
132
133
  this.errors = withHasError.withHasError(this);
134
+ this.resolveInherited = withInheritedProps.withInheritedProps(this, [
135
+ { propName: "titleScenarios", ancestorAttr: "title-scenarios" },
136
+ { propName: "titleVariances", ancestorAttr: "title-variances" },
137
+ { propName: "titleOrder", ancestorAttr: "title-order" },
138
+ { propName: "titleOrderDirection", ancestorAttr: "title-order-direction" },
139
+ ]);
133
140
  }
134
141
  connectedCallback() {
135
142
  this.stores = contextProtocol.getStores(this.element);
143
+ // Reflect resolved inherited values to host attributes so child vis
144
+ // components can read them during their own DOM traversal.
145
+ this.reflectInheritedAttrs();
136
146
  }
137
147
  getCommonStyles() {
138
148
  let height = "100%";
@@ -223,6 +233,26 @@ const LayoutCard = class {
223
233
  }
224
234
  return "card_box";
225
235
  }
236
+ /**
237
+ * When the card itself inherits a title prop from a page, write the
238
+ * resolved value back to the host element's attribute so that child
239
+ * vis components (bn-table, bn-chart-*) performing their own DOM walk
240
+ * read the actual value instead of the literal "inherited-page" keyword.
241
+ */
242
+ reflectInheritedAttrs() {
243
+ const mappings = [
244
+ { prop: "titleScenarios", attr: "title-scenarios" },
245
+ { prop: "titleVariances", attr: "title-variances" },
246
+ { prop: "titleOrder", attr: "title-order" },
247
+ { prop: "titleOrderDirection", attr: "title-order-direction" },
248
+ ];
249
+ for (const { prop, attr } of mappings) {
250
+ const resolved = this.resolveInherited(prop, this[prop]);
251
+ if (resolved !== undefined) {
252
+ this.element.setAttribute(attr, resolved);
253
+ }
254
+ }
255
+ }
226
256
  prepareTitleImage(value) {
227
257
  if (value == null || value === "") {
228
258
  return "";
@@ -235,11 +265,12 @@ const LayoutCard = class {
235
265
  return assetsState[value] || value;
236
266
  }
237
267
  render() {
268
+ var _a, _b, _c, _d;
238
269
  const style = this.getLayoutStyle();
239
270
  const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
240
271
  return (
241
272
  // @ts-ignore
242
- index.h("bn-card", { key: 'e920b128510046289f0960c19abb1eadb2751204', styles: this.styles, class: this.setCardClass() }, index.h("div", { key: 'de7b2ed78aade1a7c2d0a8a69cd1f7b47eef2414', class: "cardtitle" }, index.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 !== "" ? (index.h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), index.h("bn-body", { key: '1d3a6da80bcaab5ab2d9442edd548bc408f10563' }, index.h("div", { key: 'e24cfa54735c0b401e34825a8da7327555c120c5', style: style }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: 'c2307c5dcb8058d49465fbafa7d5aaa6e5dc4488', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
273
+ index.h("bn-card", { key: '1dfcca605e2780bdfbb0108a5f34ff1259ecd666', styles: this.styles, class: this.setCardClass() }, index.h("div", { key: '7bdf2d4d7ddc82af78fe932a2af866b3b17d8b4d', class: "cardtitle" }, index.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 !== "" ? (index.h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), index.h("bn-body", { key: '9743d34c350907dfe0561444cd548d5884224f3a' }, index.h("div", { key: 'a622ae652dfefaac4a86d1f71a05fe776a811430', style: style }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: 'ebffcd673c94d7666fe6b46216792784f3dfb988', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
243
274
  }
244
275
  get element() { return index.getElement(this); }
245
276
  };
@@ -0,0 +1,157 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-Cjw0q6gP.js');
4
+ var withHasError = require('./withHasError-B8gHkfV2.js');
5
+
6
+ /**
7
+ * Reserved prop values that activate inheritance from ancestor layout
8
+ * components (`bn-layout-card` or `bn-layout-page`).
9
+ */
10
+ const INHERITED_CLOSEST = "inherited-closest";
11
+ const INHERITED_PAGE = "inherited-page";
12
+ /** Tags that qualify as inheritance ancestors. */
13
+ const ANCESTOR_CARD = "bn-layout-card";
14
+ const ANCESTOR_PAGE = "bn-layout-page";
15
+ /**
16
+ * Returns `true` when `value` is one of the recognised inheritance keywords.
17
+ */
18
+ function isInheritedValue(value) {
19
+ return value === INHERITED_CLOSEST || value === INHERITED_PAGE;
20
+ }
21
+ /**
22
+ * Walks up the DOM tree (crossing shadow boundaries) to find the nearest
23
+ * ancestor layout component.
24
+ *
25
+ * - `"inherited-closest"` matches the first `bn-layout-card` or `bn-layout-page`.
26
+ * - `"inherited-page"` skips cards and matches only `bn-layout-page`.
27
+ *
28
+ * Uses the same traversal pattern as `findContextElement` in
29
+ * `context-protocol.ts`.
30
+ */
31
+ function findAncestor(element, mode) {
32
+ let current = element.parentNode;
33
+ while (current) {
34
+ if (current instanceof HTMLElement) {
35
+ const tag = current.nodeName.toLowerCase();
36
+ if (mode === INHERITED_PAGE) {
37
+ if (tag === ANCESTOR_PAGE)
38
+ return current;
39
+ }
40
+ else {
41
+ if (tag === ANCESTOR_CARD || tag === ANCESTOR_PAGE)
42
+ return current;
43
+ }
44
+ }
45
+ if (current.parentNode) {
46
+ current = current.parentNode;
47
+ }
48
+ else if (current instanceof ShadowRoot) {
49
+ current = current.host;
50
+ }
51
+ else {
52
+ break;
53
+ }
54
+ }
55
+ return undefined;
56
+ }
57
+ /**
58
+ * Mixin that enables property inheritance from ancestor layout components.
59
+ *
60
+ * When a component sets a prop to `"inherited-closest"` or `"inherited-page"`,
61
+ * this mixin resolves the actual value by walking up the DOM to find the
62
+ * nearest `bn-layout-card` / `bn-layout-page` and reading the corresponding
63
+ * HTML attribute. A `MutationObserver` watches the ancestor for attribute
64
+ * changes, triggering a re-render when inherited values update.
65
+ *
66
+ * Follows the same decorator-style pattern as `withComponentStyle`.
67
+ *
68
+ * @param component The Stencil component instance
69
+ * @param mappings Array of prop-to-attribute mappings
70
+ * @returns A resolver function used inside `prepare*()` methods
71
+ */
72
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
+ const withInheritedProps = (component, mappings) => {
74
+ /** Resolved values keyed by propName. */
75
+ const resolved = new Map();
76
+ /** Observer watching the ancestor element's attributes. */
77
+ let observer = null;
78
+ /** The ancestor element currently being observed. */
79
+ let ancestorEl;
80
+ /**
81
+ * For each mapping whose prop is an inheritance keyword, walk the DOM once
82
+ * and read the corresponding attribute from the ancestor.
83
+ */
84
+ const resolveAll = () => {
85
+ const element = index.getElement(component);
86
+ resolved.clear();
87
+ // Determine which attrs to watch on which ancestor
88
+ const attrsToWatch = [];
89
+ for (const mapping of mappings) {
90
+ const value = component[mapping.propName];
91
+ if (typeof value !== "string" || !isInheritedValue(value))
92
+ continue;
93
+ // Find ancestor (re-use the first one found for the same mode)
94
+ if (!ancestorEl) {
95
+ ancestorEl = findAncestor(element, value);
96
+ }
97
+ if (!ancestorEl)
98
+ continue;
99
+ const attrValue = ancestorEl.getAttribute(mapping.ancestorAttr);
100
+ if (attrValue != null) {
101
+ resolved.set(mapping.propName, attrValue);
102
+ }
103
+ attrsToWatch.push(mapping.ancestorAttr);
104
+ }
105
+ // Set up MutationObserver on the ancestor
106
+ if (ancestorEl && attrsToWatch.length > 0) {
107
+ observer = new MutationObserver(() => {
108
+ // Re-read all inherited attributes from the ancestor
109
+ for (const mapping of mappings) {
110
+ if (!isInheritedValue(component[mapping.propName]))
111
+ continue;
112
+ const attrValue = ancestorEl.getAttribute(mapping.ancestorAttr);
113
+ if (attrValue != null) {
114
+ resolved.set(mapping.propName, attrValue);
115
+ }
116
+ else {
117
+ resolved.delete(mapping.propName);
118
+ }
119
+ }
120
+ index.forceUpdate(component);
121
+ });
122
+ observer.observe(ancestorEl, {
123
+ attributes: true,
124
+ attributeFilter: attrsToWatch,
125
+ });
126
+ }
127
+ };
128
+ const connectedCallback = component["connectedCallback"];
129
+ component["connectedCallback"] = () => {
130
+ resolveAll();
131
+ withHasError.runIfExisits(connectedCallback, component);
132
+ };
133
+ const disconnectedCallback = component["disconnectedCallback"];
134
+ component["disconnectedCallback"] = () => {
135
+ if (observer) {
136
+ observer.disconnect();
137
+ observer = null;
138
+ }
139
+ ancestorEl = undefined;
140
+ resolved.clear();
141
+ withHasError.runIfExisits(disconnectedCallback, component);
142
+ };
143
+ /**
144
+ * Resolver: returns the inherited value for the given prop, or `undefined`
145
+ * when the prop is not using inheritance (so the caller falls through to
146
+ * its normal logic).
147
+ */
148
+ const resolve = (propName, currentValue) => {
149
+ if (!isInheritedValue(currentValue))
150
+ return undefined;
151
+ return resolved.get(propName);
152
+ };
153
+ return resolve;
154
+ };
155
+
156
+ exports.isInheritedValue = isInheritedValue;
157
+ exports.withInheritedProps = withInheritedProps;