@bino-bi/bn-template-engine 1.0.0-alpha.6 → 1.0.0-alpha.8
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.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-0d41c5d8.entry.js +1 -0
- package/dist/bn-template-engine/p-67538176.entry.js +1 -0
- package/dist/bn-template-engine/p-825a07a8.entry.js +1 -0
- package/dist/bn-template-engine/p-916296a5.entry.js +1 -0
- package/dist/bn-template-engine/{p-1164c0b0.entry.js → p-96006b06.entry.js} +1 -1
- package/dist/bn-template-engine/p-B4JfKvVT.js +1 -0
- package/dist/bn-template-engine/{p-JNHhIe7t.js → p-B_d-jp99.js} +1 -1
- package/dist/bn-template-engine/p-Ck-NYtot.js +1 -0
- package/dist/bn-template-engine/p-CnDq0oVa.js +1 -0
- package/dist/bn-template-engine/p-DSXNgKLa.js +1 -0
- package/dist/bn-template-engine/p-bc711fb0.entry.js +1 -0
- package/dist/bn-template-engine/p-e6f646b1.entry.js +1 -0
- package/dist/bn-template-engine/p-f41d9242.entry.js +1 -0
- package/dist/bn-template-engine/{p-B0lsgVuN.js → p-gFbbuhtl.js} +1 -1
- package/dist/cjs/{SVGVariancesStyleGroup-BqAdPYtL.js → bn-asset_20.cjs.entry.js} +21948 -6938
- package/dist/cjs/bn-grid.cjs.entry.js +6 -9
- package/dist/cjs/bn-image.cjs.entry.js +6 -9
- package/dist/cjs/bn-internationalization.cjs.entry.js +5 -6
- package/dist/cjs/bn-template-engine.cjs.js +2 -2
- package/dist/cjs/bn-template.cjs.entry.js +3 -4
- package/dist/cjs/bn-text.cjs.entry.js +7 -10
- package/dist/cjs/bn-tree.cjs.entry.js +6 -9
- package/dist/cjs/{context-protocol-DRQWrwsA.js → context-protocol-ohYzcb5F.js} +1 -1
- package/dist/cjs/editor-companion.cjs.entry.js +2 -2
- package/dist/cjs/{index-Cjw0q6gP.js → index-CDKG4xmO.js} +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{scaling-BidPsO53.js → scaling-CIAClQR5.js} +3 -3
- package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-D7BKWN2N.js} +2 -2
- package/dist/cjs/{withHasError-B8gHkfV2.js → withHasError-Cl2gTQzA.js} +106 -2
- package/dist/cjs/{Order-BGx39pS5.js → withStyled-qd94SSb4.js} +648 -6
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +65 -13
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +63 -11
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +43 -6
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +12 -7
- package/dist/collection/components/bn-table/bn-table.js +83 -19
- package/dist/collection/components/bn-table/ibcs-table.js +68 -3
- package/dist/collection/utils/withInheritedProps.js +152 -0
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/withInheritedProps.js +1 -0
- package/dist/esm/{SVGVariancesStyleGroup-DOIT-zvI.js → bn-asset_20.entry.js} +22048 -7042
- package/dist/esm/bn-grid.entry.js +4 -7
- package/dist/esm/bn-image.entry.js +4 -7
- package/dist/esm/bn-internationalization.entry.js +4 -5
- package/dist/esm/bn-template-engine.js +3 -3
- package/dist/esm/bn-template.entry.js +2 -3
- package/dist/esm/bn-text.entry.js +5 -8
- package/dist/esm/bn-tree.entry.js +4 -7
- package/dist/esm/{context-protocol-2peaD4y8.js → context-protocol-DdbSplvE.js} +2 -2
- package/dist/esm/editor-companion.entry.js +2 -2
- package/dist/esm/{index-JNHhIe7t.js → index-B_d-jp99.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{scaling-BOcjT8M0.js → scaling-DGKKkuL9.js} +4 -4
- package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-AFk2wwHT.js} +2 -2
- package/dist/esm/{withHasError-B3QX2emi.js → withHasError-DW_vMDUp.js} +106 -2
- package/dist/esm/{Order-sRO-lj7X.js → withStyled-BIkqU2w4.js} +616 -1
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +2 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +2 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +16 -2
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +8 -3
- package/dist/types/components/bn-table/bn-table.d.ts +1 -0
- package/dist/types/components/bn-table/ibcs-table.d.ts +19 -0
- package/dist/types/components.d.ts +8 -8
- package/dist/types/utils/withInheritedProps.d.ts +38 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-06946f44.entry.js +0 -1
- package/dist/bn-template-engine/p-0fabe296.entry.js +0 -1
- package/dist/bn-template-engine/p-355abdf0.entry.js +0 -1
- package/dist/bn-template-engine/p-79KuA4Ox.js +0 -1
- package/dist/bn-template-engine/p-859cc06d.entry.js +0 -1
- package/dist/bn-template-engine/p-8acec99e.entry.js +0 -1
- package/dist/bn-template-engine/p-8f490c45.entry.js +0 -1
- package/dist/bn-template-engine/p-98cf512f.entry.js +0 -1
- package/dist/bn-template-engine/p-9a564f8f.entry.js +0 -1
- package/dist/bn-template-engine/p-B7p8beYH.js +0 -1
- package/dist/bn-template-engine/p-BDh7GfC5.js +0 -1
- package/dist/bn-template-engine/p-BoMtoHJB.js +0 -1
- package/dist/bn-template-engine/p-Bs8BqBsb.js +0 -1
- package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
- package/dist/bn-template-engine/p-DG-1MR_T.js +0 -1
- package/dist/bn-template-engine/p-bdd2b243.entry.js +0 -1
- package/dist/bn-template-engine/p-e6b24f15.entry.js +0 -1
- package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
- package/dist/bn-template-engine/p-sRO-lj7X.js +0 -1
- package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
- package/dist/cjs/bn-asset_16.cjs.entry.js +0 -9018
- package/dist/cjs/bn-card.cjs.entry.js +0 -36
- package/dist/cjs/bn-chart-time.cjs.entry.js +0 -995
- package/dist/cjs/bn-layout-card.cjs.entry.js +0 -248
- package/dist/cjs/formatter-4XCS0d2B.js +0 -221
- package/dist/cjs/ibcs-chart-time.cjs.entry.js +0 -4137
- package/dist/cjs/withComponentStatus-_x4LQZ0N.js +0 -109
- package/dist/cjs/withComponentStyle-ClSJfCku.js +0 -128
- package/dist/cjs/withStyled-9tG024gQ.js +0 -522
- package/dist/esm/bn-asset_16.entry.js +0 -9001
- package/dist/esm/bn-card.entry.js +0 -34
- package/dist/esm/bn-chart-time.entry.js +0 -993
- package/dist/esm/bn-layout-card.entry.js +0 -246
- package/dist/esm/formatter-BDh7GfC5.js +0 -215
- package/dist/esm/ibcs-chart-time.entry.js +0 -4135
- package/dist/esm/withComponentStatus-DodoSXe-.js +0 -107
- package/dist/esm/withComponentStyle-D3VWOsto.js +0 -126
- 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";
|
|
@@ -7,6 +7,7 @@ import { globalLabelKeys } from "../../stores/internationalization";
|
|
|
7
7
|
import { withStyled } from "../../utils/styled/withStyled";
|
|
8
8
|
import withComponentStyle from "../../utils/withComponentStyle";
|
|
9
9
|
import withHasError from "../../utils/withHasError";
|
|
10
|
+
import withInheritedProps, { isInheritedValue } from "../../utils/withInheritedProps";
|
|
10
11
|
import { getParentDimensions } from "../../utils/parentDimensions";
|
|
11
12
|
import { parseScaling } from "../../utils/scaling";
|
|
12
13
|
import { AggregationLevel, StackBy, StackMode, StackOrder } from "../../utils/constants";
|
|
@@ -23,8 +24,12 @@ import { OrderColumn, OrderDirection } from "../../utils/model/Order";
|
|
|
23
24
|
*/
|
|
24
25
|
export class Chart {
|
|
25
26
|
validateScenario(newValue) {
|
|
26
|
-
const invalidScenarios = validateScenarioList(newValue);
|
|
27
27
|
const errId = "ERR_scenarios";
|
|
28
|
+
if (isInheritedValue(newValue)) {
|
|
29
|
+
this.errors.remove(errId);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const invalidScenarios = validateScenarioList(newValue);
|
|
28
33
|
if (invalidScenarios.length > 0) {
|
|
29
34
|
this.errors.addOrReplace({
|
|
30
35
|
id: errId,
|
|
@@ -38,6 +43,10 @@ export class Chart {
|
|
|
38
43
|
}
|
|
39
44
|
validateVariances(newValue) {
|
|
40
45
|
const errIdVar = "ERR_variances";
|
|
46
|
+
if (isInheritedValue(newValue)) {
|
|
47
|
+
this.errors.remove(errIdVar);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
41
50
|
const invalidVariances = validateVariancesList(newValue);
|
|
42
51
|
if (invalidVariances.length > 0) {
|
|
43
52
|
this.errors.addOrReplace({
|
|
@@ -90,8 +99,12 @@ export class Chart {
|
|
|
90
99
|
}
|
|
91
100
|
}
|
|
92
101
|
validateOrderList(newValue) {
|
|
93
|
-
const invalidElements = validateOrderList(newValue);
|
|
94
102
|
const errId = "ERR_order";
|
|
103
|
+
if (isInheritedValue(newValue)) {
|
|
104
|
+
this.errors.remove(errId);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const invalidElements = validateOrderList(newValue);
|
|
95
108
|
if (invalidElements.length > 0) {
|
|
96
109
|
this.errors.addOrReplace({
|
|
97
110
|
id: errId,
|
|
@@ -105,6 +118,10 @@ export class Chart {
|
|
|
105
118
|
}
|
|
106
119
|
validateOrderDirection(newValue) {
|
|
107
120
|
const errId = "ERR_orderDirection";
|
|
121
|
+
if (isInheritedValue(newValue)) {
|
|
122
|
+
this.errors.remove(errId);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
108
125
|
if (!isValidDirection(newValue)) {
|
|
109
126
|
this.errors.addOrReplace({
|
|
110
127
|
id: errId,
|
|
@@ -310,6 +327,12 @@ export class Chart {
|
|
|
310
327
|
this.errors = withHasError(this);
|
|
311
328
|
this.componentStyle = withComponentStyle(this);
|
|
312
329
|
this.t = withTranslation(this).t;
|
|
330
|
+
this.resolveInherited = withInheritedProps(this, [
|
|
331
|
+
{ propName: "scenarios", ancestorAttr: "title-scenarios" },
|
|
332
|
+
{ propName: "variances", ancestorAttr: "title-variances" },
|
|
333
|
+
{ propName: "order", ancestorAttr: "title-order" },
|
|
334
|
+
{ propName: "orderDirection", ancestorAttr: "title-order-direction" },
|
|
335
|
+
]);
|
|
313
336
|
}
|
|
314
337
|
componentWillLoad() {
|
|
315
338
|
this.validateScenario(this.scenarios);
|
|
@@ -354,7 +377,9 @@ export class Chart {
|
|
|
354
377
|
this.errors.remove("AUTO_scale");
|
|
355
378
|
if (this.appliedScaleFactor !== 1) {
|
|
356
379
|
this._autoScaleGuard = true;
|
|
357
|
-
|
|
380
|
+
writeTask(() => {
|
|
381
|
+
this.appliedScaleFactor = 1;
|
|
382
|
+
});
|
|
358
383
|
}
|
|
359
384
|
this.checkWidthOverflow();
|
|
360
385
|
return;
|
|
@@ -373,10 +398,24 @@ export class Chart {
|
|
|
373
398
|
}
|
|
374
399
|
if (Math.abs(computedFactor - this.appliedScaleFactor) > 0.001) {
|
|
375
400
|
this._autoScaleGuard = true;
|
|
376
|
-
|
|
401
|
+
writeTask(() => {
|
|
402
|
+
this.appliedScaleFactor = computedFactor;
|
|
403
|
+
});
|
|
377
404
|
}
|
|
378
405
|
this.checkWidthOverflow();
|
|
379
406
|
}
|
|
407
|
+
componentDidLoad() {
|
|
408
|
+
// After the first render the DOM is committed and the browser has computed
|
|
409
|
+
// layout. If the initial parentDimensions measurement returned 0 (common
|
|
410
|
+
// inside cards/slots whose width isn't known before first paint), force a
|
|
411
|
+
// re-render so the inner ibcs-chart-structure receives correct dimensions.
|
|
412
|
+
if (this.canvasWidthSegmented <= 0) {
|
|
413
|
+
const { width } = getParentDimensions(this.element);
|
|
414
|
+
if (width > 0) {
|
|
415
|
+
forceUpdate(this);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
380
419
|
/**
|
|
381
420
|
* Emits an error when a custom unit-scaling value causes the chart to exceed its container width.
|
|
382
421
|
* Skipped for auto/unset unit-scaling since auto-fit handles width.
|
|
@@ -410,6 +449,11 @@ export class Chart {
|
|
|
410
449
|
}
|
|
411
450
|
prepareScenarios() {
|
|
412
451
|
var _a, _b, _c, _d;
|
|
452
|
+
const inherited = this.resolveInherited("scenarios", this.scenarios);
|
|
453
|
+
if (inherited !== undefined) {
|
|
454
|
+
this.errors.remove("AUTO_scenarios");
|
|
455
|
+
return inherited.split(",").map((entry) => entry.trim());
|
|
456
|
+
}
|
|
413
457
|
const isAuto = ((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
414
458
|
if (isBlankInput(this.scenarios) || isAuto) {
|
|
415
459
|
if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
@@ -432,6 +476,10 @@ export class Chart {
|
|
|
432
476
|
}
|
|
433
477
|
prepareVariances() {
|
|
434
478
|
var _a;
|
|
479
|
+
const inherited = this.resolveInherited("variances", this.variances);
|
|
480
|
+
if (inherited !== undefined) {
|
|
481
|
+
return inherited.split(",").map((entry) => entry.trim());
|
|
482
|
+
}
|
|
435
483
|
if (isBlankInput(this.variances)) {
|
|
436
484
|
return [];
|
|
437
485
|
}
|
|
@@ -500,11 +548,15 @@ export class Chart {
|
|
|
500
548
|
return AggregationLevel[(_c = this.level) === null || _c === void 0 ? void 0 : _c.toUpperCase()];
|
|
501
549
|
}
|
|
502
550
|
prepareOrder() {
|
|
503
|
-
var _a
|
|
504
|
-
const
|
|
551
|
+
var _a;
|
|
552
|
+
const inheritedOrder = this.resolveInherited("order", this.order);
|
|
553
|
+
const inheritedDirection = this.resolveInherited("orderDirection", this.orderDirection);
|
|
554
|
+
const effectiveOrder = inheritedOrder !== null && inheritedOrder !== void 0 ? inheritedOrder : this.order;
|
|
555
|
+
const effectiveDirection = inheritedDirection !== null && inheritedDirection !== void 0 ? inheritedDirection : this.orderDirection;
|
|
556
|
+
const isAuto = (effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.trim().toLowerCase()) === "auto";
|
|
505
557
|
let orderStr;
|
|
506
|
-
if (isBlankInput(
|
|
507
|
-
if ((
|
|
558
|
+
if (isBlankInput(effectiveOrder) || isAuto) {
|
|
559
|
+
if ((_a = this.datasetMeta) === null || _a === void 0 ? void 0 : _a.suggestedOrder) {
|
|
508
560
|
if (!isAuto) {
|
|
509
561
|
this.errors.addOrReplace({
|
|
510
562
|
id: "AUTO_order",
|
|
@@ -518,16 +570,16 @@ export class Chart {
|
|
|
518
570
|
orderStr = this.datasetMeta.suggestedOrder;
|
|
519
571
|
}
|
|
520
572
|
else {
|
|
521
|
-
orderStr =
|
|
573
|
+
orderStr = effectiveOrder;
|
|
522
574
|
}
|
|
523
575
|
}
|
|
524
576
|
else {
|
|
525
577
|
this.errors.remove("AUTO_order");
|
|
526
|
-
orderStr =
|
|
578
|
+
orderStr = effectiveOrder;
|
|
527
579
|
}
|
|
528
580
|
const tableOrder = {
|
|
529
581
|
hierarchy: orderStr === null || orderStr === void 0 ? void 0 : orderStr.split(",").map((entry) => OrderColumn[entry === null || entry === void 0 ? void 0 : entry.toUpperCase()]),
|
|
530
|
-
direction: OrderDirection[
|
|
582
|
+
direction: OrderDirection[effectiveDirection === null || effectiveDirection === void 0 ? void 0 : effectiveDirection.toUpperCase()],
|
|
531
583
|
};
|
|
532
584
|
return tableOrder;
|
|
533
585
|
}
|
|
@@ -715,7 +767,7 @@ export class Chart {
|
|
|
715
767
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
716
768
|
}
|
|
717
769
|
const fontStyles = this.getFontStyles();
|
|
718
|
-
return (h(Host, { key: '
|
|
770
|
+
return (h(Host, { key: '9c71155a82140c2020a830247c62d668fb10959e', style: fontStyles }, h("div", { key: '5d9402429fd36aa3b9615f13a5038bc38d825173', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
719
771
|
}
|
|
720
772
|
static get is() { return "bn-chart-structure"; }
|
|
721
773
|
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";
|
|
@@ -7,6 +7,7 @@ import { globalLabelKeys } from "../../stores/internationalization";
|
|
|
7
7
|
import { withStyled } from "../../utils/styled/withStyled";
|
|
8
8
|
import withComponentStyle from "../../utils/withComponentStyle";
|
|
9
9
|
import withHasError from "../../utils/withHasError";
|
|
10
|
+
import withInheritedProps, { isInheritedValue } from "../../utils/withInheritedProps";
|
|
10
11
|
import { getParentDimensions } from "../../utils/parentDimensions";
|
|
11
12
|
import { parseScaling } from "../../utils/scaling";
|
|
12
13
|
import { OrderColumn, OrderDirection } from "../../utils/model/Order";
|
|
@@ -34,8 +35,12 @@ var AggregationLevel;
|
|
|
34
35
|
*/
|
|
35
36
|
export class Chart {
|
|
36
37
|
validateScenario(newValue) {
|
|
37
|
-
const invalidScenarios = validateScenarioList(newValue);
|
|
38
38
|
const errId = "ERR_scenarios";
|
|
39
|
+
if (isInheritedValue(newValue)) {
|
|
40
|
+
this.errors.remove(errId);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const invalidScenarios = validateScenarioList(newValue);
|
|
39
44
|
if (invalidScenarios.length > 0) {
|
|
40
45
|
this.errors.addOrReplace({
|
|
41
46
|
id: errId,
|
|
@@ -49,6 +54,10 @@ export class Chart {
|
|
|
49
54
|
}
|
|
50
55
|
validateVariances(newValue) {
|
|
51
56
|
const errIdVar = "ERR_variances";
|
|
57
|
+
if (isInheritedValue(newValue)) {
|
|
58
|
+
this.errors.remove(errIdVar);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
52
61
|
const invalidVariances = validateVariancesList(newValue);
|
|
53
62
|
if (invalidVariances.length > 0) {
|
|
54
63
|
this.errors.addOrReplace({
|
|
@@ -128,6 +137,10 @@ export class Chart {
|
|
|
128
137
|
}
|
|
129
138
|
validateOrderList(newValue) {
|
|
130
139
|
const errId = "ERR_order";
|
|
140
|
+
if (isInheritedValue(newValue)) {
|
|
141
|
+
this.errors.remove(errId);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
131
144
|
const invalidElements = validateOrderList(newValue);
|
|
132
145
|
if (invalidElements.length > 0) {
|
|
133
146
|
this.errors.addOrReplace({
|
|
@@ -142,6 +155,10 @@ export class Chart {
|
|
|
142
155
|
}
|
|
143
156
|
validateOrderDirection(newValue) {
|
|
144
157
|
const errId = "ERR_orderDirection";
|
|
158
|
+
if (isInheritedValue(newValue)) {
|
|
159
|
+
this.errors.remove(errId);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
145
162
|
if (!isValidDirection(newValue)) {
|
|
146
163
|
this.errors.addOrReplace({
|
|
147
164
|
id: errId,
|
|
@@ -468,6 +485,12 @@ export class Chart {
|
|
|
468
485
|
this.errors = withHasError(this);
|
|
469
486
|
this.componentStyle = withComponentStyle(this);
|
|
470
487
|
this.t = withTranslation(this).t;
|
|
488
|
+
this.resolveInherited = withInheritedProps(this, [
|
|
489
|
+
{ propName: "scenarios", ancestorAttr: "title-scenarios" },
|
|
490
|
+
{ propName: "variances", ancestorAttr: "title-variances" },
|
|
491
|
+
{ propName: "order", ancestorAttr: "title-order" },
|
|
492
|
+
{ propName: "orderDirection", ancestorAttr: "title-order-direction" },
|
|
493
|
+
]);
|
|
471
494
|
}
|
|
472
495
|
componentWillLoad() {
|
|
473
496
|
this.validateScenario(this.scenarios);
|
|
@@ -530,7 +553,9 @@ export class Chart {
|
|
|
530
553
|
this.errors.remove("AUTO_scale");
|
|
531
554
|
if (this.appliedScaleFactor !== 1) {
|
|
532
555
|
this._autoScaleGuard = true;
|
|
533
|
-
|
|
556
|
+
writeTask(() => {
|
|
557
|
+
this.appliedScaleFactor = 1;
|
|
558
|
+
});
|
|
534
559
|
}
|
|
535
560
|
return;
|
|
536
561
|
}
|
|
@@ -548,7 +573,21 @@ export class Chart {
|
|
|
548
573
|
}
|
|
549
574
|
if (Math.abs(computedFactor - this.appliedScaleFactor) > 0.001) {
|
|
550
575
|
this._autoScaleGuard = true;
|
|
551
|
-
|
|
576
|
+
writeTask(() => {
|
|
577
|
+
this.appliedScaleFactor = computedFactor;
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
componentDidLoad() {
|
|
582
|
+
// After the first render the DOM is committed and the browser has computed
|
|
583
|
+
// layout. If the initial parentDimensions measurement returned 0 (common
|
|
584
|
+
// inside cards/slots whose width isn't known before first paint), force a
|
|
585
|
+
// re-render so the inner ibcs-chart-time receives correct dimensions.
|
|
586
|
+
if (this.canvasWidthSegmented <= 0) {
|
|
587
|
+
const { width } = getParentDimensions(this.element);
|
|
588
|
+
if (width > 0) {
|
|
589
|
+
forceUpdate(this);
|
|
590
|
+
}
|
|
552
591
|
}
|
|
553
592
|
}
|
|
554
593
|
prepareDimension() {
|
|
@@ -560,6 +599,11 @@ export class Chart {
|
|
|
560
599
|
}
|
|
561
600
|
prepareScenarios() {
|
|
562
601
|
var _a, _b, _c, _d;
|
|
602
|
+
const inherited = this.resolveInherited("scenarios", this.scenarios);
|
|
603
|
+
if (inherited !== undefined) {
|
|
604
|
+
this.errors.remove("AUTO_scenarios");
|
|
605
|
+
return inherited.split(",").map((entry) => entry.trim());
|
|
606
|
+
}
|
|
563
607
|
const isAuto = ((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
564
608
|
if (isBlankInput(this.scenarios) || isAuto) {
|
|
565
609
|
if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
@@ -588,6 +632,10 @@ export class Chart {
|
|
|
588
632
|
}
|
|
589
633
|
prepareVariances() {
|
|
590
634
|
var _a;
|
|
635
|
+
const inherited = this.resolveInherited("variances", this.variances);
|
|
636
|
+
if (inherited !== undefined) {
|
|
637
|
+
return inherited.split(",").map((entry) => entry.trim());
|
|
638
|
+
}
|
|
591
639
|
if (isBlankInput(this.variances)) {
|
|
592
640
|
return [];
|
|
593
641
|
}
|
|
@@ -656,12 +704,16 @@ export class Chart {
|
|
|
656
704
|
return AggregationLevel[(_c = this.level) === null || _c === void 0 ? void 0 : _c.toUpperCase()];
|
|
657
705
|
}
|
|
658
706
|
prepareOrder() {
|
|
659
|
-
var _a, _b, _c
|
|
707
|
+
var _a, _b, _c;
|
|
708
|
+
const inheritedOrder = this.resolveInherited("order", this.order);
|
|
709
|
+
const inheritedDirection = this.resolveInherited("orderDirection", this.orderDirection);
|
|
710
|
+
const effectiveOrder = inheritedOrder !== null && inheritedOrder !== void 0 ? inheritedOrder : this.order;
|
|
711
|
+
const effectiveDirection = inheritedDirection !== null && inheritedDirection !== void 0 ? inheritedDirection : this.orderDirection;
|
|
660
712
|
const isLevelAuto = isBlankInput(this.level) || ((_a = this.level) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
661
713
|
let entryValue = isLevelAuto && ((_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.suggestedLevel) ? this.datasetMeta.suggestedLevel : this.level;
|
|
662
|
-
const isOrderAuto = (
|
|
663
|
-
if (isBlankInput(
|
|
664
|
-
if ((
|
|
714
|
+
const isOrderAuto = (effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.trim().toLowerCase()) === "auto";
|
|
715
|
+
if (isBlankInput(effectiveOrder) || isOrderAuto) {
|
|
716
|
+
if ((_c = this.datasetMeta) === null || _c === void 0 ? void 0 : _c.suggestedLevel) {
|
|
665
717
|
if (!isOrderAuto) {
|
|
666
718
|
this.errors.addOrReplace({
|
|
667
719
|
id: "AUTO_order",
|
|
@@ -676,13 +728,13 @@ export class Chart {
|
|
|
676
728
|
}
|
|
677
729
|
else {
|
|
678
730
|
this.errors.remove("AUTO_order");
|
|
679
|
-
if ((
|
|
731
|
+
if ((effectiveOrder === null || effectiveOrder === void 0 ? void 0 : effectiveOrder.toLocaleLowerCase()) === "levelindex") {
|
|
680
732
|
entryValue += "Index";
|
|
681
733
|
}
|
|
682
734
|
}
|
|
683
735
|
const tableOrder = {
|
|
684
736
|
hierarchy: [OrderColumn[entryValue === null || entryValue === void 0 ? void 0 : entryValue.toUpperCase()]],
|
|
685
|
-
direction: OrderDirection[
|
|
737
|
+
direction: OrderDirection[effectiveDirection === null || effectiveDirection === void 0 ? void 0 : effectiveDirection.toUpperCase()],
|
|
686
738
|
};
|
|
687
739
|
return tableOrder;
|
|
688
740
|
}
|
|
@@ -931,7 +983,7 @@ export class Chart {
|
|
|
931
983
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
932
984
|
}
|
|
933
985
|
const fontStyles = this.getFontStyles();
|
|
934
|
-
return (h(Host, { key: '
|
|
986
|
+
return (h(Host, { key: '317b1048224d8b5ede5dc4868d2d927c9c7cfee9', style: fontStyles }, h("div", { key: '3168861fc4440ea67103140c33c4aa84ac0bf245', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
935
987
|
}
|
|
936
988
|
static get is() { return "bn-chart-time"; }
|
|
937
989
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h, Fragment } from "@stencil/core";
|
|
2
2
|
import { getStores } from "../../context/context-protocol";
|
|
3
3
|
import withHasError from "../../utils/withHasError";
|
|
4
|
+
import withInheritedProps from "../../utils/withInheritedProps";
|
|
4
5
|
export class LayoutCard {
|
|
5
6
|
constructor() {
|
|
6
7
|
/**
|
|
@@ -101,10 +102,16 @@ export class LayoutCard {
|
|
|
101
102
|
this.cardGridGap = "0";
|
|
102
103
|
/**
|
|
103
104
|
* When `true`, the card shrinks to fit its content (`fit-content`)
|
|
104
|
-
* for both width and height. When `false
|
|
105
|
-
* 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.
|
|
106
113
|
*/
|
|
107
|
-
this.cardFitToContent =
|
|
114
|
+
this.cardFitToContent = false;
|
|
108
115
|
/**
|
|
109
116
|
* Whether to display a visible border around the card.
|
|
110
117
|
*/
|
|
@@ -124,9 +131,18 @@ export class LayoutCard {
|
|
|
124
131
|
["gold4", '"a b c c" "d d c c"'],
|
|
125
132
|
]);
|
|
126
133
|
this.errors = withHasError(this);
|
|
134
|
+
this.resolveInherited = 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
|
+
]);
|
|
127
140
|
}
|
|
128
141
|
connectedCallback() {
|
|
129
142
|
this.stores = 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();
|
|
130
146
|
}
|
|
131
147
|
getCommonStyles() {
|
|
132
148
|
let height = "100%";
|
|
@@ -217,6 +233,26 @@ export class LayoutCard {
|
|
|
217
233
|
}
|
|
218
234
|
return "card_box";
|
|
219
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
|
+
}
|
|
220
256
|
prepareTitleImage(value) {
|
|
221
257
|
if (value == null || value === "") {
|
|
222
258
|
return "";
|
|
@@ -229,11 +265,12 @@ export class LayoutCard {
|
|
|
229
265
|
return assetsState[value] || value;
|
|
230
266
|
}
|
|
231
267
|
render() {
|
|
268
|
+
var _a, _b, _c, _d;
|
|
232
269
|
const style = this.getLayoutStyle();
|
|
233
270
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
234
271
|
return (
|
|
235
272
|
// @ts-ignore
|
|
236
|
-
h("bn-card", { key: '
|
|
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" })));
|
|
237
274
|
}
|
|
238
275
|
static get is() { return "bn-layout-card"; }
|
|
239
276
|
static get encapsulation() { return "shadow"; }
|
|
@@ -610,13 +647,13 @@ export class LayoutCard {
|
|
|
610
647
|
"optional": false,
|
|
611
648
|
"docs": {
|
|
612
649
|
"tags": [],
|
|
613
|
-
"text": "When `true`, the card shrinks to fit its content (`fit-content`)\nfor both width and height. When `false
|
|
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."
|
|
614
651
|
},
|
|
615
652
|
"getter": false,
|
|
616
653
|
"setter": false,
|
|
617
654
|
"reflect": false,
|
|
618
655
|
"attribute": "card-fit-to-content",
|
|
619
|
-
"defaultValue": "
|
|
656
|
+
"defaultValue": "false"
|
|
620
657
|
},
|
|
621
658
|
"cardShowBorder": {
|
|
622
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
|
|
105
|
-
* full page height (`100%`). Width is always `100%`
|
|
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 =
|
|
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: '
|
|
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
|
|
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": "
|
|
717
|
+
"defaultValue": "false"
|
|
713
718
|
}
|
|
714
719
|
};
|
|
715
720
|
}
|