@bino-bi/bn-template-engine 1.0.0-alpha.14 → 1.0.0-alpha.16
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-637e3b8f.entry.js → p-19f49fbc.entry.js} +1 -1
- package/dist/bn-template-engine/{p-67eae33e.entry.js → p-3465fcdc.entry.js} +1 -1
- package/dist/bn-template-engine/{p-82023539.entry.js → p-67746414.entry.js} +1 -1
- package/dist/bn-template-engine/p-86ca2d5e.entry.js +1 -0
- package/dist/bn-template-engine/p-BPDZcex5.js +1 -0
- package/dist/bn-template-engine/{p-DHheVOfP.js → p-Tx6omDWp.js} +1 -1
- package/dist/bn-template-engine/{p-52097456.entry.js → p-d724ab88.entry.js} +1 -1
- package/dist/bn-template-engine/p-efd3b67a.entry.js +1 -0
- package/dist/bn-template-engine/{p-46699464.entry.js → p-ff659485.entry.js} +1 -1
- package/dist/bn-template-engine/p-z9bPNFYF.js +1 -0
- package/dist/cjs/bn-asset_21.cjs.entry.js +336 -75
- package/dist/cjs/bn-grid.cjs.entry.js +2 -2
- package/dist/cjs/bn-image.cjs.entry.js +2 -2
- package/dist/cjs/bn-internationalization.cjs.entry.js +1 -1
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +3 -3
- package/dist/cjs/bn-tree.cjs.entry.js +2 -2
- package/dist/cjs/{context-protocol-Op7uUwN3.js → context-protocol-Cn5PL928.js} +14 -0
- package/dist/cjs/editor-companion.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-57N4Cxb_.js → scaling-DM2UILdF.js} +58 -17
- package/dist/cjs/{withStyled-C2kmGAK3.js → withStyled-Dx3uRw9g.js} +72 -1
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +28 -10
- package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +46 -4
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +39 -1
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +40 -10
- package/dist/collection/components/bn-dataset/bn-dataset.js +15 -8
- package/dist/collection/components/bn-datasource/bn-datasource.js +15 -8
- package/dist/collection/components/bn-layout-card/bn-layout-card.css +5 -0
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +25 -5
- package/dist/collection/components/bn-layout-page/bn-layout-page.css +5 -0
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +25 -5
- package/dist/collection/components/bn-table/bn-table.js +75 -7
- package/dist/collection/components/bn-table/ibcs-table.js +27 -0
- package/dist/collection/components/bn-table/utils/Table.js +2 -2
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +28 -5
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +46 -6
- package/dist/collection/components/bn-table/utils/model/TableAttribute.js +46 -0
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +5 -0
- package/dist/collection/context/scopedDb.js +14 -0
- package/dist/collection/utils/parentDimensions.js +57 -16
- package/dist/collection/utils/validate.js +23 -0
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/Order.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.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/bn-title2.js +1 -1
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/ibcs-title2.js +1 -1
- package/dist/components/scaling.js +1 -1
- package/dist/components/validate.js +1 -1
- package/dist/esm/bn-asset_21.entry.js +336 -75
- package/dist/esm/bn-grid.entry.js +2 -2
- package/dist/esm/bn-image.entry.js +2 -2
- package/dist/esm/bn-internationalization.entry.js +1 -1
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +3 -3
- package/dist/esm/bn-tree.entry.js +2 -2
- package/dist/esm/{context-protocol-BDhzNbeD.js → context-protocol-BB-4Onmw.js} +14 -0
- package/dist/esm/editor-companion.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{scaling-La1Ow72h.js → scaling-h4KcBet3.js} +58 -17
- package/dist/esm/{withStyled-Bl9cSoRW.js → withStyled-BBvU2f-A.js} +71 -2
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +4 -0
- package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +16 -1
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +13 -0
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +4 -0
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +8 -3
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +8 -3
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +7 -0
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +7 -0
- package/dist/types/components/bn-table/bn-table.d.ts +13 -0
- package/dist/types/components/bn-table/ibcs-table.d.ts +2 -0
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +3 -1
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +11 -0
- package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +22 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +3 -0
- package/dist/types/components.d.ts +39 -0
- package/dist/types/utils/validate.d.ts +6 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-6b3c47b3.entry.js +0 -1
- package/dist/bn-template-engine/p-BVFHvEXF.js +0 -1
- package/dist/bn-template-engine/p-CQnZV3JG.js +0 -1
- package/dist/bn-template-engine/p-ab3ea8cf.entry.js +0 -1
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-CDKG4xmO.js');
|
|
4
4
|
var withHasError = require('./withHasError-Cl2gTQzA.js');
|
|
5
|
-
var contextProtocol = require('./context-protocol-
|
|
5
|
+
var contextProtocol = require('./context-protocol-Cn5PL928.js');
|
|
6
6
|
var withBodyObserver = require('./withBodyObserver-BKUE_ypL.js');
|
|
7
|
-
var withStyled = require('./withStyled-
|
|
8
|
-
var scaling = require('./scaling-
|
|
7
|
+
var withStyled = require('./withStyled-Dx3uRw9g.js');
|
|
8
|
+
var scaling = require('./scaling-DM2UILdF.js');
|
|
9
9
|
|
|
10
10
|
const bnAssetCss = () => `:host{display:none}`;
|
|
11
11
|
|
|
@@ -1914,6 +1914,8 @@ const Chart = class {
|
|
|
1914
1914
|
this.pixelPerUnitGroupMap = new Map();
|
|
1915
1915
|
this._autoScaleGuard = false;
|
|
1916
1916
|
this._lastObservedWidth = 0;
|
|
1917
|
+
this._settleTimer = null;
|
|
1918
|
+
this._lastAppliedHeight = 0;
|
|
1917
1919
|
withStyled.withStyled(this);
|
|
1918
1920
|
withHasError.withComponentStatus(this);
|
|
1919
1921
|
scaling.withDataset(this, (name, _data) => {
|
|
@@ -2043,17 +2045,53 @@ const Chart = class {
|
|
|
2043
2045
|
index.forceUpdate(this);
|
|
2044
2046
|
});
|
|
2045
2047
|
});
|
|
2048
|
+
this.settleParentHeight();
|
|
2049
|
+
}
|
|
2050
|
+
/**
|
|
2051
|
+
* The initial renders can measure mid-hydration, before ancestor CSS
|
|
2052
|
+
* (fixed page height, overflow) is applied, so the height used for
|
|
2053
|
+
* auto-fit may be a transient value — and the resize observer above
|
|
2054
|
+
* deliberately ignores height changes. Re-measure on a short backoff
|
|
2055
|
+
* schedule and re-render when the measurement no longer matches the
|
|
2056
|
+
* height the last render actually used (_lastAppliedHeight, recorded
|
|
2057
|
+
* in prepareDimension). The schedule is finite, so this cannot feed a
|
|
2058
|
+
* render loop.
|
|
2059
|
+
*/
|
|
2060
|
+
settleParentHeight() {
|
|
2061
|
+
const delays = [150, 400, 1000, 2500];
|
|
2062
|
+
const check = () => {
|
|
2063
|
+
this._settleTimer = null;
|
|
2064
|
+
if (!this.element.isConnected)
|
|
2065
|
+
return;
|
|
2066
|
+
const { height } = scaling.getParentDimensions(this.element);
|
|
2067
|
+
// 8px threshold: hydration corrections are large (hundreds of px);
|
|
2068
|
+
// small jitter must not cause re-renders, because every re-render
|
|
2069
|
+
// gives the width-overflow font scaler a chance to ratchet down.
|
|
2070
|
+
if (height > 0 && Math.abs(height - this._lastAppliedHeight) > 8 && !this._autoScaleGuard) {
|
|
2071
|
+
index.forceUpdate(this);
|
|
2072
|
+
}
|
|
2073
|
+
const next = delays.shift();
|
|
2074
|
+
if (next !== undefined) {
|
|
2075
|
+
this._settleTimer = setTimeout(check, next);
|
|
2076
|
+
}
|
|
2077
|
+
};
|
|
2078
|
+
this._settleTimer = setTimeout(check, delays.shift());
|
|
2046
2079
|
}
|
|
2047
2080
|
disconnectedCallback() {
|
|
2048
2081
|
var _a;
|
|
2049
2082
|
(_a = this.layoutObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
2050
2083
|
this.layoutObserver = null;
|
|
2084
|
+
if (this._settleTimer != null) {
|
|
2085
|
+
clearTimeout(this._settleTimer);
|
|
2086
|
+
this._settleTimer = null;
|
|
2087
|
+
}
|
|
2051
2088
|
}
|
|
2052
2089
|
prepareDimension() {
|
|
2053
2090
|
const parent = scaling.getParentDimensions(this.element);
|
|
2054
2091
|
const scenariosList = this.prepareScenarios();
|
|
2055
2092
|
const variancesList = this.prepareVariances();
|
|
2056
2093
|
this.canvasWidthSegmented = parent.width / (scenariosList.length + variancesList.length || 1);
|
|
2094
|
+
this._lastAppliedHeight = parent.height;
|
|
2057
2095
|
return { width: this.canvasWidthSegmented, height: parent.height };
|
|
2058
2096
|
}
|
|
2059
2097
|
prepareScenarios() {
|
|
@@ -2457,7 +2495,7 @@ const Chart = class {
|
|
|
2457
2495
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
2458
2496
|
}
|
|
2459
2497
|
const fontStyles = this.getFontStyles();
|
|
2460
|
-
return (index.h(index.Host, { key: '
|
|
2498
|
+
return (index.h(index.Host, { key: '8c90dcaacd6b4e1b64b1fb4a8aefe1345086e7e6', style: fontStyles }, index.h("div", { key: 'c0209d2fd9fcf5ee60c3f17697c7bcbf1b445fec', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
2461
2499
|
}
|
|
2462
2500
|
get element() { return index.getElement(this); }
|
|
2463
2501
|
static get watchers() { return {
|
|
@@ -3299,7 +3337,7 @@ const Dataset = class {
|
|
|
3299
3337
|
}
|
|
3300
3338
|
// --- Leaving URL mode → clean up ---
|
|
3301
3339
|
if (this.currentUrl !== null) {
|
|
3302
|
-
this.
|
|
3340
|
+
this.cancelInFlight();
|
|
3303
3341
|
this.currentUrl = null;
|
|
3304
3342
|
}
|
|
3305
3343
|
let contentHash;
|
|
@@ -3417,7 +3455,7 @@ const Dataset = class {
|
|
|
3417
3455
|
}
|
|
3418
3456
|
disconnectedCallback() {
|
|
3419
3457
|
var _a, _b;
|
|
3420
|
-
this.
|
|
3458
|
+
this.cancelInFlight();
|
|
3421
3459
|
if (((_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db) && this.name) {
|
|
3422
3460
|
const db = this.stores.db.db;
|
|
3423
3461
|
try {
|
|
@@ -3475,19 +3513,26 @@ const Dataset = class {
|
|
|
3475
3513
|
this.publish([]);
|
|
3476
3514
|
}
|
|
3477
3515
|
}
|
|
3478
|
-
/** Stops the polling timer
|
|
3479
|
-
|
|
3480
|
-
var _a;
|
|
3516
|
+
/** Stops the polling timer (does NOT touch any in-flight fetch). */
|
|
3517
|
+
clearPollTimer() {
|
|
3481
3518
|
if (this.pollTimerId !== null) {
|
|
3482
3519
|
clearInterval(this.pollTimerId);
|
|
3483
3520
|
this.pollTimerId = null;
|
|
3484
3521
|
}
|
|
3522
|
+
}
|
|
3523
|
+
/** Stops the polling timer AND cancels any in-flight fetch. Use only when
|
|
3524
|
+
* leaving URL mode entirely (disconnect or body changed to inline). */
|
|
3525
|
+
cancelInFlight() {
|
|
3526
|
+
var _a;
|
|
3527
|
+
this.clearPollTimer();
|
|
3485
3528
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
3486
3529
|
this.abortController = null;
|
|
3487
3530
|
}
|
|
3488
|
-
/** Starts (or restarts) the polling timer if in URL mode with a positive
|
|
3531
|
+
/** Starts (or restarts) the polling timer if in URL mode with a positive
|
|
3532
|
+
* interval. Does NOT abort the kick-off fetch issued by the caller — it
|
|
3533
|
+
* only resets the interval timer. */
|
|
3489
3534
|
startPolling() {
|
|
3490
|
-
this.
|
|
3535
|
+
this.clearPollTimer();
|
|
3491
3536
|
if (this.currentUrl && this.interval > 0) {
|
|
3492
3537
|
this.pollTimerId = setInterval(() => {
|
|
3493
3538
|
if (this.currentUrl) {
|
|
@@ -3497,7 +3542,7 @@ const Dataset = class {
|
|
|
3497
3542
|
}
|
|
3498
3543
|
}
|
|
3499
3544
|
render() {
|
|
3500
|
-
return index.h(index.Host, { key: '
|
|
3545
|
+
return index.h(index.Host, { key: 'a02f22a7f78c3bd2512e013ff729487c471ba9bf' });
|
|
3501
3546
|
}
|
|
3502
3547
|
get element() { return index.getElement(this); }
|
|
3503
3548
|
static get watchers() { return {
|
|
@@ -3554,7 +3599,7 @@ const Datasource = class {
|
|
|
3554
3599
|
}
|
|
3555
3600
|
// --- Leaving URL mode → clean up ---
|
|
3556
3601
|
if (this.currentUrl !== null) {
|
|
3557
|
-
this.
|
|
3602
|
+
this.cancelInFlight();
|
|
3558
3603
|
this.currentUrl = null;
|
|
3559
3604
|
}
|
|
3560
3605
|
// --- Inline JSON / compressed mode ---
|
|
@@ -3598,7 +3643,7 @@ const Datasource = class {
|
|
|
3598
3643
|
}
|
|
3599
3644
|
disconnectedCallback() {
|
|
3600
3645
|
var _a, _b;
|
|
3601
|
-
this.
|
|
3646
|
+
this.cancelInFlight();
|
|
3602
3647
|
const db = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.db) === null || _b === void 0 ? void 0 : _b.db;
|
|
3603
3648
|
if (db && this.name) {
|
|
3604
3649
|
if (db.tables[this.name] != null) {
|
|
@@ -3644,19 +3689,26 @@ const Datasource = class {
|
|
|
3644
3689
|
this.publish([]);
|
|
3645
3690
|
}
|
|
3646
3691
|
}
|
|
3647
|
-
/** Stops the polling timer
|
|
3648
|
-
|
|
3649
|
-
var _a;
|
|
3692
|
+
/** Stops the polling timer (does NOT touch any in-flight fetch). */
|
|
3693
|
+
clearPollTimer() {
|
|
3650
3694
|
if (this.pollTimerId !== null) {
|
|
3651
3695
|
clearInterval(this.pollTimerId);
|
|
3652
3696
|
this.pollTimerId = null;
|
|
3653
3697
|
}
|
|
3698
|
+
}
|
|
3699
|
+
/** Stops the polling timer AND cancels any in-flight fetch. Use only when
|
|
3700
|
+
* leaving URL mode entirely (disconnect or body changed to inline). */
|
|
3701
|
+
cancelInFlight() {
|
|
3702
|
+
var _a;
|
|
3703
|
+
this.clearPollTimer();
|
|
3654
3704
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
3655
3705
|
this.abortController = null;
|
|
3656
3706
|
}
|
|
3657
|
-
/** Starts (or restarts) the polling timer if in URL mode with a positive
|
|
3707
|
+
/** Starts (or restarts) the polling timer if in URL mode with a positive
|
|
3708
|
+
* interval. Does NOT abort the kick-off fetch issued by the caller — it
|
|
3709
|
+
* only resets the interval timer. */
|
|
3658
3710
|
startPolling() {
|
|
3659
|
-
this.
|
|
3711
|
+
this.clearPollTimer();
|
|
3660
3712
|
if (this.currentUrl && this.interval > 0) {
|
|
3661
3713
|
this.pollTimerId = setInterval(() => {
|
|
3662
3714
|
if (this.currentUrl) {
|
|
@@ -3666,7 +3718,7 @@ const Datasource = class {
|
|
|
3666
3718
|
}
|
|
3667
3719
|
}
|
|
3668
3720
|
render() {
|
|
3669
|
-
return index.h(index.Host, { key: '
|
|
3721
|
+
return index.h(index.Host, { key: '2af6ade861fa900974deeb1b6bcc4520997a4180' });
|
|
3670
3722
|
}
|
|
3671
3723
|
get element() { return index.getElement(this); }
|
|
3672
3724
|
static get watchers() { return {
|
|
@@ -3730,7 +3782,7 @@ const Footer$1 = class Footer {
|
|
|
3730
3782
|
};
|
|
3731
3783
|
Footer$1.style = bnFooterCss();
|
|
3732
3784
|
|
|
3733
|
-
const bnLayoutCardCss = () => `:host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.cardtitle{display:inline-flex}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}`;
|
|
3785
|
+
const bnLayoutCardCss = () => `:host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.cardtitle{display:inline-flex}::slotted(*){flex:1 1 auto;min-width:0}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}`;
|
|
3734
3786
|
|
|
3735
3787
|
const LayoutCard = class {
|
|
3736
3788
|
constructor(hostRef) {
|
|
@@ -3906,11 +3958,14 @@ const LayoutCard = class {
|
|
|
3906
3958
|
return "minmax(0, 1fr)";
|
|
3907
3959
|
return this.calculateFractions(matches[0]);
|
|
3908
3960
|
}
|
|
3909
|
-
|
|
3961
|
+
getRowCount(name) {
|
|
3910
3962
|
const template = this.getTemplatePattern(name);
|
|
3911
3963
|
const pattern = /"[\w\d\s.]+"/g;
|
|
3912
3964
|
const matches = template.match(pattern);
|
|
3913
|
-
|
|
3965
|
+
return matches ? matches.length : 1;
|
|
3966
|
+
}
|
|
3967
|
+
getGridTemplateRows(name) {
|
|
3968
|
+
const rowCount = this.getRowCount(name);
|
|
3914
3969
|
if (this.cardFitToContent) {
|
|
3915
3970
|
return Array(rowCount).fill("auto").join(" ");
|
|
3916
3971
|
}
|
|
@@ -4002,15 +4057,13 @@ const LayoutCard = class {
|
|
|
4002
4057
|
var _a, _b, _c, _d;
|
|
4003
4058
|
const style = this.getLayoutStyle();
|
|
4004
4059
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
4005
|
-
return (
|
|
4006
|
-
// @ts-ignore
|
|
4007
|
-
index.h("bn-card", { key: 'c39b6a8cf843b7b8d9b380215a3553288acd3647', styles: this.styles, class: this.setCardClass() }, index.h("div", { key: '3206bff73cb01fad7223e3fd889e015992e535c6', class: "cardtitle" }, index.h("bn-title", { key: 'd410c817dd185a26bb7623dd3649c999516f706a', namespace: this.titleNamespace, "business-unit": this.titleBusinessUnit, scenarios: (_a = this.resolveInherited("titleScenarios", this.titleScenarios)) !== null && _a !== void 0 ? _a : this.titleScenarios, variances: (_b = this.resolveInherited("titleVariances", this.titleVariances)) !== null && _b !== void 0 ? _b : this.titleVariances, order: (_c = this.resolveInherited("titleOrder", this.titleOrder)) !== null && _c !== void 0 ? _c : this.titleOrder, "order-direction": (_d = this.resolveInherited("titleOrderDirection", this.titleOrderDirection)) !== null && _d !== void 0 ? _d : this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), this.titleImage != null && this.titleImage !== "" ? (index.h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), index.h("bn-body", { key: 'f56b1b70127cd2173e425cf723dbea2b62037d88' }, index.h("div", { key: 'e5766b5b28dd1d14fdbaf721baf72668502fcbec', style: style }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: 'bafb89f89c89aaf0e31fa754f0e834330b031627', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
|
|
4060
|
+
return (index.h("bn-card", { key: 'f94b210638d26436a03daba89d7da43ec4dc6973', styles: this.styles, "selected-style": this.selectedStyle, class: this.setCardClass() }, index.h("div", { key: 'b29e3e8a32672278508e13daeb215529d6c4e0fd', class: "cardtitle" }, index.h("bn-title", { key: '988a77ef985bf45326af5fbdd2dd2940e0bd3e2b', 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: '2391406ed78728ac6d343ee1ee20500be6f4aef3' }, index.h("div", { key: '97fa4d0c73a0d0b7bc4a9fda83133291d7f875e7', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: '2162b61945c8e7c20602ef7e7a50dbb33ee5a6d2', text: this.footerText, "page-number": 0, "display-page-number": "false" })));
|
|
4008
4061
|
}
|
|
4009
4062
|
get element() { return index.getElement(this); }
|
|
4010
4063
|
};
|
|
4011
4064
|
LayoutCard.style = bnLayoutCardCss();
|
|
4012
4065
|
|
|
4013
|
-
const bnLayoutPageCss = () => `:host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;overflow:hidden}`;
|
|
4066
|
+
const bnLayoutPageCss = () => `:host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:block;overflow:hidden}::slotted(*){flex:1 1 auto;min-width:0}`;
|
|
4014
4067
|
|
|
4015
4068
|
const LayoutPage = class {
|
|
4016
4069
|
constructor(hostRef) {
|
|
@@ -4156,11 +4209,14 @@ const LayoutPage = class {
|
|
|
4156
4209
|
gap: this.pageGridGap + "px",
|
|
4157
4210
|
};
|
|
4158
4211
|
}
|
|
4159
|
-
|
|
4212
|
+
getRowCount(name) {
|
|
4160
4213
|
const template = this.getTemplateAreas(name);
|
|
4161
4214
|
const pattern = /"[\w\d\s.]+"/g;
|
|
4162
4215
|
const matches = template.match(pattern);
|
|
4163
|
-
|
|
4216
|
+
return matches ? matches.length : 1;
|
|
4217
|
+
}
|
|
4218
|
+
getGridTemplateRows(name) {
|
|
4219
|
+
const rowCount = this.getRowCount(name);
|
|
4164
4220
|
if (this.pageFitToContent) {
|
|
4165
4221
|
return Array(rowCount).fill("auto").join(" ");
|
|
4166
4222
|
}
|
|
@@ -4252,9 +4308,7 @@ const LayoutPage = class {
|
|
|
4252
4308
|
render() {
|
|
4253
4309
|
const style = this.getLayoutStyle();
|
|
4254
4310
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
4255
|
-
return (
|
|
4256
|
-
// @ts-ignore
|
|
4257
|
-
index.h("bn-page", { key: '958dbce3b000c62d287f6263fed495523786e28d', styles: this.styles, format: this.pageFormat, orientation: this.pageOrientation }, index.h("bn-message", { key: 'cdb559c63a0466ccaa1cd807d027dd127e3b3efe', text: this.messageText, image: this.messageImage }), index.h("bn-title", { key: '48fafd3fc8be7d49df4939bd5db63908b36e523f', namespace: this.titleNamespace, "business-unit": this.titleBusinessUnit, scenarios: this.titleScenarios, variances: this.titleVariances, order: this.titleOrder, "order-direction": this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), index.h("bn-body", { key: '93c9f7b2c345c8bc6fdb20d35fa406ee919379eb' }, index.h("div", { key: '64e4db5a7b6265bcd73b700227b5f033c99facdc', style: style }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: 'f7b69e9fcfbdde742a2d547f81c50dd78a3ed02f', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber })));
|
|
4311
|
+
return (index.h("bn-page", { key: 'ed0804f3f1daf9327903fd61ff633f2857119a31', styles: this.styles, "selected-style": this.selectedStyle, format: this.pageFormat, orientation: this.pageOrientation }, index.h("bn-message", { key: 'ccfb6dfa63b001e6fe96612ed3f8635970b6481c', text: this.messageText, image: this.messageImage }), index.h("bn-title", { key: '223bd6ba689c17796eb165839223164f8bb174e5', namespace: this.titleNamespace, "business-unit": this.titleBusinessUnit, scenarios: this.titleScenarios, variances: this.titleVariances, order: this.titleOrder, "order-direction": this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), index.h("bn-body", { key: '606f637fb9a48a83062193e7e88733c6b2f092b1' }, index.h("div", { key: '94aebd1b35061ec6e7ccfb4203ea4bc07ea90cbd', style: style, "data-bn-fit-content": this.pageFitToContent ? String(this.getRowCount(this.pageLayout)) : null }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: 'aa64d4f789c3016289b400a3ea796b1d37f9bcfc', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber })));
|
|
4258
4312
|
}
|
|
4259
4313
|
get element() { return index.getElement(this); }
|
|
4260
4314
|
};
|
|
@@ -4747,6 +4801,17 @@ const Table$1 = class Table {
|
|
|
4747
4801
|
* ```
|
|
4748
4802
|
*/
|
|
4749
4803
|
this.columnthereof = null;
|
|
4804
|
+
/**
|
|
4805
|
+
* Stringified JSON object defining custom columns computed from dataset fields.<br />
|
|
4806
|
+
* Keys are column labels, values are aggregate expressions over the rows that
|
|
4807
|
+
* make up each table row.<br /><br />
|
|
4808
|
+
* Functions: ```set // first // last // min // max // avg // sum // lit```<br />
|
|
4809
|
+
* Fields can be standard dataset fields (e.g. ```ac1```) or custom fields
|
|
4810
|
+
* prefixed with ```_``` (e.g. ```_leiter```); ```lit``` takes a constant value.<br /><br />
|
|
4811
|
+
* example:<br />
|
|
4812
|
+
* ```{"Verkaufsleiter": "set(_leiter)", "Umsatz gesamt": "sum(ac1)"}```
|
|
4813
|
+
*/
|
|
4814
|
+
this.tableAttributes = "";
|
|
4750
4815
|
this._autoScaleGuard = false;
|
|
4751
4816
|
withStyled.withStyled(this);
|
|
4752
4817
|
withHasError.withComponentStatus(this);
|
|
@@ -5085,6 +5150,20 @@ const Table$1 = class Table {
|
|
|
5085
5150
|
this.errors.remove(errId);
|
|
5086
5151
|
}
|
|
5087
5152
|
}
|
|
5153
|
+
validateTableAttributes(newValue) {
|
|
5154
|
+
const errId = "ERR_attributes";
|
|
5155
|
+
const invalidElements = withStyled.validateAttributesJsonStr(newValue);
|
|
5156
|
+
if (invalidElements.length > 0) {
|
|
5157
|
+
this.errors.addOrReplace({
|
|
5158
|
+
id: errId,
|
|
5159
|
+
type: "warning",
|
|
5160
|
+
message: "attributes: invalid value(s) '" + JSON.stringify(invalidElements) + "' are not supported.",
|
|
5161
|
+
});
|
|
5162
|
+
}
|
|
5163
|
+
else {
|
|
5164
|
+
this.errors.remove(errId);
|
|
5165
|
+
}
|
|
5166
|
+
}
|
|
5088
5167
|
componentWillLoad() {
|
|
5089
5168
|
this.validateScenario(this.scenarios);
|
|
5090
5169
|
this.validateVariances(this.variances);
|
|
@@ -5103,6 +5182,7 @@ const Table$1 = class Table {
|
|
|
5103
5182
|
this.validateMeasureType(this.measureType);
|
|
5104
5183
|
this.validateMeasureScale(this.measureScale);
|
|
5105
5184
|
this.validateColumnThereOf(this.columnthereof);
|
|
5185
|
+
this.validateTableAttributes(this.tableAttributes);
|
|
5106
5186
|
this.validateShowMeasureScale(this.showMeasureScale);
|
|
5107
5187
|
this.validateBarColumns(this.barColumns);
|
|
5108
5188
|
this.validateBarColumnWidth(this.barColumnWidth);
|
|
@@ -5251,7 +5331,7 @@ const Table$1 = class Table {
|
|
|
5251
5331
|
return formatDigits;
|
|
5252
5332
|
}
|
|
5253
5333
|
prepareScenarios() {
|
|
5254
|
-
var _a, _b, _c, _d,
|
|
5334
|
+
var _a, _b, _c, _d, _f, _g, _h, _j, _k;
|
|
5255
5335
|
const inheritedScenarios = this.resolveInherited("scenarios", this.scenarios);
|
|
5256
5336
|
const inheritedVariances = this.resolveInherited("variances", this.variances);
|
|
5257
5337
|
if (inheritedScenarios !== undefined || inheritedVariances !== undefined) {
|
|
@@ -5290,7 +5370,7 @@ const Table$1 = class Table {
|
|
|
5290
5370
|
}
|
|
5291
5371
|
let scenarios = [];
|
|
5292
5372
|
if (isAuto || withStyled.isBlankInput(this.scenarios)) {
|
|
5293
|
-
if (((
|
|
5373
|
+
if (((_g = (_f = this.datasetMeta) === null || _f === void 0 ? void 0 : _f.availableScenarios) === null || _g === void 0 ? void 0 : _g.length) > 0) {
|
|
5294
5374
|
if (!isAuto) {
|
|
5295
5375
|
this.errors.addOrReplace({
|
|
5296
5376
|
id: "AUTO_scenarios",
|
|
@@ -5306,10 +5386,10 @@ const Table$1 = class Table {
|
|
|
5306
5386
|
}
|
|
5307
5387
|
else {
|
|
5308
5388
|
this.errors.remove("AUTO_scenarios");
|
|
5309
|
-
scenarios = scenarios.concat((
|
|
5389
|
+
scenarios = scenarios.concat((_h = this.scenarios) === null || _h === void 0 ? void 0 : _h.split(","));
|
|
5310
5390
|
}
|
|
5311
|
-
if (((
|
|
5312
|
-
scenarios = scenarios.concat((
|
|
5391
|
+
if (((_j = this.variances) === null || _j === void 0 ? void 0 : _j.trim().length) > 0) {
|
|
5392
|
+
scenarios = scenarios.concat((_k = this.variances) === null || _k === void 0 ? void 0 : _k.split(","));
|
|
5313
5393
|
}
|
|
5314
5394
|
return scenarios.map((entry) => entry.trim());
|
|
5315
5395
|
}
|
|
@@ -5353,6 +5433,24 @@ const Table$1 = class Table {
|
|
|
5353
5433
|
}
|
|
5354
5434
|
return map;
|
|
5355
5435
|
}
|
|
5436
|
+
prepareAttributes() {
|
|
5437
|
+
if (this.tableAttributes == null || this.tableAttributes.trim() === "") {
|
|
5438
|
+
return [];
|
|
5439
|
+
}
|
|
5440
|
+
try {
|
|
5441
|
+
const parsedString = JSON.parse(this.tableAttributes);
|
|
5442
|
+
if (parsedString === null || typeof parsedString !== "object" || parsedString instanceof Array) {
|
|
5443
|
+
return [];
|
|
5444
|
+
}
|
|
5445
|
+
return Object.entries(parsedString)
|
|
5446
|
+
.map(([label, expression], index) => typeof expression === "string" ? withStyled.parseTableAttributeExpression(label, `attr_${index}`, expression) : null)
|
|
5447
|
+
.filter((attribute) => attribute !== null);
|
|
5448
|
+
}
|
|
5449
|
+
catch (_e) {
|
|
5450
|
+
// invalid JSON already reported by validateTableAttributes
|
|
5451
|
+
return [];
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
5356
5454
|
prepareTableTitle() {
|
|
5357
5455
|
if (this.tableTitle === "" || this.tableTitle == null) {
|
|
5358
5456
|
return "SUM_TOTAL";
|
|
@@ -5470,7 +5568,7 @@ const Table$1 = class Table {
|
|
|
5470
5568
|
render() {
|
|
5471
5569
|
const fontStyles = this.getFontStyles();
|
|
5472
5570
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
5473
|
-
return (index.h(index.Host, { key: '
|
|
5571
|
+
return (index.h(index.Host, { key: 'ed9804ea731fbaa0ec730c0392bcd18bb0ac278a', style: fontStyles }, index.h("div", { key: '011a543cca60ec8c871db6a6280999047437ce98' }, index.h("ibcs-table", { key: '4b7d717c3a7c9ed4c44b90dc66b4b8e6c9359cb0', tableName: this.datasetName, dataVersion: this.dataVersion, "table-title": this.prepareTableTitle(), scenarios: this.prepareScenarios(), "scenarios-data-format": this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), "category-width": this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), "i18n-mode": this.prepareI18nMode(), "measure-scale": this.prepareMeasureScale(), "measure-type": this.prepareMeasureType(), "measure-unit": this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), scaleFactor: effectiveFactor }))));
|
|
5474
5572
|
}
|
|
5475
5573
|
get element() { return index.getElement(this); }
|
|
5476
5574
|
static get watchers() { return {
|
|
@@ -5542,6 +5640,9 @@ const Table$1 = class Table {
|
|
|
5542
5640
|
}],
|
|
5543
5641
|
"columnthereof": [{
|
|
5544
5642
|
"validateColumnThereOf": 0
|
|
5643
|
+
}],
|
|
5644
|
+
"tableAttributes": [{
|
|
5645
|
+
"validateTableAttributes": 0
|
|
5545
5646
|
}]
|
|
5546
5647
|
}; }
|
|
5547
5648
|
};
|
|
@@ -13593,7 +13694,7 @@ makeMorphable();
|
|
|
13593
13694
|
*/
|
|
13594
13695
|
let ElementPositions$1 = class ElementPositions {
|
|
13595
13696
|
// private smallestDataPoint: DataPoint;
|
|
13596
|
-
constructor(padding, scaleFactors, fontSize, numberOfColumns, leftSideLengthSync, titleLength, leftSideWidth, categoryWidth) {
|
|
13697
|
+
constructor(padding, scaleFactors, fontSize, numberOfColumns, leftSideLengthSync, titleLength, leftSideWidth, categoryWidth, hasStackedHeaders = false) {
|
|
13597
13698
|
this.categoryPosition = { x: 0, y: 0 };
|
|
13598
13699
|
this.spacings = {
|
|
13599
13700
|
scenarioOffset: 0,
|
|
@@ -13623,6 +13724,7 @@ let ElementPositions$1 = class ElementPositions {
|
|
|
13623
13724
|
this.numberOfColumns = numberOfColumns;
|
|
13624
13725
|
this.leftSideLengthSync = leftSideLengthSync;
|
|
13625
13726
|
this.topSideLabelHeight = titleLength > 0 ? this.fontSize : 0;
|
|
13727
|
+
this.hasStackedHeaders = hasStackedHeaders;
|
|
13626
13728
|
this.leftSideLabelLength = this.calculateSideLabelLength(titleLength, leftSideWidth, categoryWidth);
|
|
13627
13729
|
this.calculateSpacings();
|
|
13628
13730
|
this.calculateCategoryPosition();
|
|
@@ -13651,7 +13753,10 @@ let ElementPositions$1 = class ElementPositions {
|
|
|
13651
13753
|
return this.axisPosition.x;
|
|
13652
13754
|
}
|
|
13653
13755
|
getAxisTitlePositionY() {
|
|
13654
|
-
return this.axisPosition.y - this.spacings.labelToAxis;
|
|
13756
|
+
return this.axisPosition.y - this.spacings.labelToAxis - this.getTopLabelOverhang();
|
|
13757
|
+
}
|
|
13758
|
+
getStackedHeaderPositionY() {
|
|
13759
|
+
return this.getBarCenterPositionY(0) - this.spacings.barWidth * 0.5 - this.spacings.scenarioLabelToBar;
|
|
13655
13760
|
}
|
|
13656
13761
|
getNeedleWidth() {
|
|
13657
13762
|
return this.spacings.needleWidth;
|
|
@@ -13707,7 +13812,12 @@ let ElementPositions$1 = class ElementPositions {
|
|
|
13707
13812
|
}
|
|
13708
13813
|
getScenarioLabelPositionOffsetY(isPrimaryBar) {
|
|
13709
13814
|
if (isPrimaryBar) {
|
|
13710
|
-
|
|
13815
|
+
// The label belongs to the last bar, but the axis line runs past that bar's
|
|
13816
|
+
// center by (categoryWidth - scenarioOffset); place the label below the axis
|
|
13817
|
+
// end so the line does not strike through it.
|
|
13818
|
+
const belowBar = this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar;
|
|
13819
|
+
const belowAxisEnd = this.spacings.categoryWidth - this.spacings.scenarioOffset + this.spacings.labelToAxis;
|
|
13820
|
+
return Math.max(belowBar, belowAxisEnd);
|
|
13711
13821
|
}
|
|
13712
13822
|
return -(this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar);
|
|
13713
13823
|
}
|
|
@@ -13769,7 +13879,40 @@ let ElementPositions$1 = class ElementPositions {
|
|
|
13769
13879
|
this.calculateAxisPosition();
|
|
13770
13880
|
}
|
|
13771
13881
|
getAxisTitleOffset() {
|
|
13772
|
-
|
|
13882
|
+
// Title height plus the gap to the labels that can stick out above the first bar
|
|
13883
|
+
return this.topSideLabelHeight + this.spacings.labelToAxis + this.getTopLabelOverhang();
|
|
13884
|
+
}
|
|
13885
|
+
getTopLabelOverhang() {
|
|
13886
|
+
return this.hasStackedHeaders ? this.getStackedHeaderOverhang() : this.getTopScenarioLabelOverhang();
|
|
13887
|
+
}
|
|
13888
|
+
/**
|
|
13889
|
+
* How far the stacked-segment header row (anchored just above the first bar)
|
|
13890
|
+
* reaches above the axis start. The title is moved up by this amount so the
|
|
13891
|
+
* header row sits between title and bars without overlapping either.
|
|
13892
|
+
*/
|
|
13893
|
+
getStackedHeaderOverhang() {
|
|
13894
|
+
return Math.max(0, this.fontSize +
|
|
13895
|
+
this.spacings.scenarioLabelToBar +
|
|
13896
|
+
this.spacings.barWidth * 0.5 -
|
|
13897
|
+
(this.spacings.categoryWidth * 0.5 + this.spacings.scenarioOffset));
|
|
13898
|
+
}
|
|
13899
|
+
/**
|
|
13900
|
+
* How far the scenario labels above the first bar (secondary bar label) or
|
|
13901
|
+
* above the first marker (primary marker label) reach above the axis start.
|
|
13902
|
+
* The title is moved up by this amount so it does not overlap them.
|
|
13903
|
+
*/
|
|
13904
|
+
getTopScenarioLabelOverhang() {
|
|
13905
|
+
const barLabelOverhang = this.fontSize +
|
|
13906
|
+
this.spacings.barWidth * 0.5 +
|
|
13907
|
+
this.spacings.scenarioLabelToBar -
|
|
13908
|
+
this.spacings.categoryWidth * 0.5;
|
|
13909
|
+
const markerLabelOverhang = this.fontSize +
|
|
13910
|
+
this.spacings.markerWidth * 0.5 +
|
|
13911
|
+
this.spacings.scenarioLabelToBar +
|
|
13912
|
+
this.spacings.markerOffset +
|
|
13913
|
+
this.spacings.barWidth * 0.5 -
|
|
13914
|
+
(this.spacings.categoryWidth * 0.5 + this.spacings.scenarioOffset);
|
|
13915
|
+
return Math.max(0, barLabelOverhang, markerLabelOverhang);
|
|
13773
13916
|
}
|
|
13774
13917
|
calculateSideLabelLength(titleLength, leftSideWidth, categoryWidth) {
|
|
13775
13918
|
if (this.leftSideLengthSync) {
|
|
@@ -15688,6 +15831,7 @@ class StructureChart {
|
|
|
15688
15831
|
this.measureUnit = "";
|
|
15689
15832
|
this.dataFormatDigits = { percent: 2, decimal: 1 };
|
|
15690
15833
|
this.stackConfig = null;
|
|
15834
|
+
this.scenarioPropOrder = [];
|
|
15691
15835
|
this.overflowConfig = null;
|
|
15692
15836
|
this.highestStackedTotal = 0;
|
|
15693
15837
|
this.fromExpr = "";
|
|
@@ -15710,7 +15854,7 @@ class StructureChart {
|
|
|
15710
15854
|
if (this.titleLength > leftSideWidth) {
|
|
15711
15855
|
leftSideWidth = this.titleLength;
|
|
15712
15856
|
}
|
|
15713
|
-
return new ElementPositions$1(new Padding$2(this.styles.padding), this.styles.scaleFactors, this.styles.fontStyles.size, this.dataModel.length, this.leftSideOffsetForHorizontalSync, this.titleLength, leftSideWidth, categoryWidth);
|
|
15857
|
+
return new ElementPositions$1(new Padding$2(this.styles.padding), this.styles.scaleFactors, this.styles.fontStyles.size, this.dataModel.length, this.leftSideOffsetForHorizontalSync, this.titleLength, leftSideWidth, categoryWidth, !!this.stackConfig && this.variancesDataModel.length === 0);
|
|
15714
15858
|
}
|
|
15715
15859
|
setStyles(newStyle) {
|
|
15716
15860
|
this.styles = newStyle;
|
|
@@ -15718,16 +15862,17 @@ class StructureChart {
|
|
|
15718
15862
|
setConfig(config) {
|
|
15719
15863
|
var _a;
|
|
15720
15864
|
this.state = FactoryState$2.DIRTY;
|
|
15721
|
-
this.
|
|
15865
|
+
this.scenarioPropOrder = [...config.scenarios];
|
|
15866
|
+
const scenarios = this.sortScenariosbyVisualisationRules(config.scenarios);
|
|
15722
15867
|
this.hideCategories = config.hideCategories || false;
|
|
15723
15868
|
this.limit = config.limit;
|
|
15724
15869
|
this.pixelPerUnit = config.pixelPerUnit || 1;
|
|
15725
15870
|
this.pixelPerPercentage = config.pixelPerPercentage || 100;
|
|
15726
15871
|
this.setSource(config.filter);
|
|
15727
|
-
this.dataModel = this.populateModel(
|
|
15872
|
+
this.dataModel = this.populateModel(scenarios, config.level, config.sortOrder);
|
|
15728
15873
|
// Populate per-dimension stack segments when stacking by a data dimension
|
|
15729
15874
|
if (config.stackConfig && config.stackConfig.by !== withStyled.StackBy.SCENARIOS) {
|
|
15730
|
-
this.populateDimensionStackSegments(
|
|
15875
|
+
this.populateDimensionStackSegments(scenarios, config.stackConfig, config.level);
|
|
15731
15876
|
}
|
|
15732
15877
|
this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
|
|
15733
15878
|
this.title = config.title || Formatter.translateScenarioLabel((_a = config === null || config === void 0 ? void 0 : config.variances) === null || _a === void 0 ? void 0 : _a.toString(), this.i18n);
|
|
@@ -15743,9 +15888,10 @@ class StructureChart {
|
|
|
15743
15888
|
this.highestStackedTotal = this.findHighestStackedRowTotal(this.dataModel);
|
|
15744
15889
|
this.updatePosition();
|
|
15745
15890
|
}
|
|
15746
|
-
|
|
15891
|
+
/** Returns a new array; the input keeps the `scenarios` prop order (the config is reused across rebuilds). */
|
|
15892
|
+
sortScenariosbyVisualisationRules(scenarios) {
|
|
15747
15893
|
const self = this;
|
|
15748
|
-
|
|
15894
|
+
return [...scenarios]
|
|
15749
15895
|
.sort((n1, n2) => {
|
|
15750
15896
|
return self.ruleSet.getScenarioSorIndex(n1) - self.ruleSet.getScenarioSorIndex(n2);
|
|
15751
15897
|
})
|
|
@@ -15862,8 +16008,10 @@ class StructureChart {
|
|
|
15862
16008
|
return width;
|
|
15863
16009
|
}
|
|
15864
16010
|
getAllocatedCanvasHeight() {
|
|
15865
|
-
|
|
15866
|
-
|
|
16011
|
+
// Axis end plus the scenario label hanging below it (see getScenarioLabelPositionOffsetY)
|
|
16012
|
+
return (this.position.getAxisEndPositionY() +
|
|
16013
|
+
this.position.spacings.labelToAxis +
|
|
16014
|
+
this.position.fontSize +
|
|
15867
16015
|
this.styles.padding.bottom);
|
|
15868
16016
|
}
|
|
15869
16017
|
patternToString() {
|
|
@@ -16283,6 +16431,17 @@ class StructureChart {
|
|
|
16283
16431
|
});
|
|
16284
16432
|
return barsGroup;
|
|
16285
16433
|
}
|
|
16434
|
+
/** Restore the original `scenarios` prop order for stacked segments (IBCS sort reorders the slots). */
|
|
16435
|
+
sortSegmentsByPropOrder(segments) {
|
|
16436
|
+
if (this.scenarioPropOrder.length === 0)
|
|
16437
|
+
return;
|
|
16438
|
+
const order = this.scenarioPropOrder;
|
|
16439
|
+
segments.sort((a, b) => {
|
|
16440
|
+
const ia = order.indexOf(a.scenario);
|
|
16441
|
+
const ib = order.indexOf(b.scenario);
|
|
16442
|
+
return (ia === -1 ? order.length : ia) - (ib === -1 ? order.length : ib);
|
|
16443
|
+
});
|
|
16444
|
+
}
|
|
16286
16445
|
/**
|
|
16287
16446
|
* Draw stacked horizontal bars. Supports stacking by scenario or by data dimension.
|
|
16288
16447
|
* When stacking by scenario with multiple scenario types (e.g. ac+pl),
|
|
@@ -16304,6 +16463,7 @@ class StructureChart {
|
|
|
16304
16463
|
segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
|
|
16305
16464
|
}
|
|
16306
16465
|
}
|
|
16466
|
+
this.sortSegmentsByPropOrder(segments);
|
|
16307
16467
|
}
|
|
16308
16468
|
else {
|
|
16309
16469
|
const dp = elements["scenario1"];
|
|
@@ -16409,7 +16569,7 @@ class StructureChart {
|
|
|
16409
16569
|
orderedSegs.sort((a, b) => b.value - a.value);
|
|
16410
16570
|
const total = orderedSegs.reduce((sum, s) => sum + Math.abs(s.value), 0);
|
|
16411
16571
|
const axisX = this.position.getBarPositionX();
|
|
16412
|
-
const headerY = this.position.
|
|
16572
|
+
const headerY = this.position.getStackedHeaderPositionY();
|
|
16413
16573
|
let cumulativePixels = 0;
|
|
16414
16574
|
orderedSegs.forEach((seg) => {
|
|
16415
16575
|
const pixelPerUnit = seg.dataPoint.pixelPerUnit;
|
|
@@ -16438,9 +16598,10 @@ class StructureChart {
|
|
|
16438
16598
|
}
|
|
16439
16599
|
if (segments.length === 0)
|
|
16440
16600
|
return;
|
|
16601
|
+
this.sortSegmentsByPropOrder(segments);
|
|
16441
16602
|
const prefixes = new Set(segments.map((s) => getScenarioPrefix(s.scenario)));
|
|
16442
16603
|
const axisX = this.position.getBarPositionX();
|
|
16443
|
-
const headerY = this.position.
|
|
16604
|
+
const headerY = this.position.getStackedHeaderPositionY();
|
|
16444
16605
|
if (prefixes.size > 1) {
|
|
16445
16606
|
// Overlay mode: one header per group, centered on group's bar extent
|
|
16446
16607
|
const groupMap = new Map();
|
|
@@ -19620,6 +19781,7 @@ class TimeChart {
|
|
|
19620
19781
|
this.chartMode = withStyled.ChartMode.BAR;
|
|
19621
19782
|
this.maxBars = 28;
|
|
19622
19783
|
this.stackConfig = null;
|
|
19784
|
+
this.scenarioPropOrder = [];
|
|
19623
19785
|
this.lineFullWidth = true;
|
|
19624
19786
|
this.availableWidth = 0;
|
|
19625
19787
|
this.overflowConfig = null;
|
|
@@ -19631,7 +19793,7 @@ class TimeChart {
|
|
|
19631
19793
|
this.styles = styles;
|
|
19632
19794
|
this.availableWidth = availableWidth;
|
|
19633
19795
|
this.setConfig(config);
|
|
19634
|
-
this.position = this.createElementPosition(
|
|
19796
|
+
this.position = this.createElementPosition(this.lastScenarios);
|
|
19635
19797
|
}
|
|
19636
19798
|
updatePosition(scenarios) {
|
|
19637
19799
|
this.position = this.createElementPosition(scenarios);
|
|
@@ -19701,7 +19863,8 @@ class TimeChart {
|
|
|
19701
19863
|
setConfig(config) {
|
|
19702
19864
|
var _a;
|
|
19703
19865
|
this.state = FactoryState$1.DIRTY;
|
|
19704
|
-
this.
|
|
19866
|
+
this.scenarioPropOrder = [...config.scenarios];
|
|
19867
|
+
const scenarios = this.sortScenariosbyVisualisationRules(config.scenarios);
|
|
19705
19868
|
this.setSource(config.filter);
|
|
19706
19869
|
this.hideAxisLabels = config.hideAxisLabels || false;
|
|
19707
19870
|
this.pixelPerUnit = config.pixelPerUnit;
|
|
@@ -19709,7 +19872,7 @@ class TimeChart {
|
|
|
19709
19872
|
this.axisLabelsMode = config.axisLabelsMode;
|
|
19710
19873
|
this.intervalSpanLimit = config.intervalSpanLimit;
|
|
19711
19874
|
this.dateInterval = this.findDateInterval(config.dateInterval);
|
|
19712
|
-
this.dataModel = this.populateModel(
|
|
19875
|
+
this.dataModel = this.populateModel(scenarios, this.dateInterval, config.level, config.sortOrder);
|
|
19713
19876
|
this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
|
|
19714
19877
|
this.title = config.title || Formatter.translateScenarioLabel((_a = config === null || config === void 0 ? void 0 : config.variances) === null || _a === void 0 ? void 0 : _a.toString(), this.i18n);
|
|
19715
19878
|
this.smallestDataPointValue = this.findSmallestDataPointValue(this.dataModel);
|
|
@@ -19727,8 +19890,8 @@ class TimeChart {
|
|
|
19727
19890
|
this.maxBars = config.maxBars;
|
|
19728
19891
|
this.stackConfig = config.stackConfig;
|
|
19729
19892
|
this.lineFullWidth = config.lineFullWidth;
|
|
19730
|
-
this.lastScenarios =
|
|
19731
|
-
this.updatePosition(
|
|
19893
|
+
this.lastScenarios = scenarios;
|
|
19894
|
+
this.updatePosition(scenarios);
|
|
19732
19895
|
}
|
|
19733
19896
|
getFooter() {
|
|
19734
19897
|
if (this.measureScale.value === 1 && this.measureUnit === "") {
|
|
@@ -19736,9 +19899,10 @@ class TimeChart {
|
|
|
19736
19899
|
}
|
|
19737
19900
|
return Formatter.translateScenarioLabel("in", this.i18n) + " " + this.measureScale.prefix + this.measureUnit;
|
|
19738
19901
|
}
|
|
19739
|
-
|
|
19902
|
+
/** Returns a new array; the input keeps the `scenarios` prop order (the config is reused across rebuilds). */
|
|
19903
|
+
sortScenariosbyVisualisationRules(scenarios) {
|
|
19740
19904
|
const self = this;
|
|
19741
|
-
|
|
19905
|
+
return [...scenarios]
|
|
19742
19906
|
.sort((n1, n2) => {
|
|
19743
19907
|
return self.ruleSet.getScenarioSorIndex(n1) - self.ruleSet.getScenarioSorIndex(n2);
|
|
19744
19908
|
})
|
|
@@ -20542,6 +20706,17 @@ class TimeChart {
|
|
|
20542
20706
|
};
|
|
20543
20707
|
return columnGroup;
|
|
20544
20708
|
}
|
|
20709
|
+
/** Restore the original `scenarios` prop order for stacked segments (IBCS sort reorders the slots). */
|
|
20710
|
+
sortSegmentsByPropOrder(segments) {
|
|
20711
|
+
if (this.scenarioPropOrder.length === 0)
|
|
20712
|
+
return;
|
|
20713
|
+
const order = this.scenarioPropOrder;
|
|
20714
|
+
segments.sort((a, b) => {
|
|
20715
|
+
const ia = order.indexOf(a.scenario);
|
|
20716
|
+
const ib = order.indexOf(b.scenario);
|
|
20717
|
+
return (ia === -1 ? order.length : ia) - (ib === -1 ? order.length : ib);
|
|
20718
|
+
});
|
|
20719
|
+
}
|
|
20545
20720
|
/**
|
|
20546
20721
|
* Draw stacked bar columns. Supports stacking by scenario or by data dimension.
|
|
20547
20722
|
* When stacking by scenario with multiple scenario types (e.g. ac+pl),
|
|
@@ -20563,6 +20738,7 @@ class TimeChart {
|
|
|
20563
20738
|
segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
|
|
20564
20739
|
}
|
|
20565
20740
|
}
|
|
20741
|
+
this.sortSegmentsByPropOrder(segments);
|
|
20566
20742
|
}
|
|
20567
20743
|
else {
|
|
20568
20744
|
const dp = elements["scenario1"];
|
|
@@ -20662,12 +20838,14 @@ class TimeChart {
|
|
|
20662
20838
|
}
|
|
20663
20839
|
if (segments.length === 0)
|
|
20664
20840
|
return;
|
|
20841
|
+
this.sortSegmentsByPropOrder(segments);
|
|
20665
20842
|
const prefixes = new Set(segments.map((s) => getScenarioPrefix(s.scenario)));
|
|
20666
20843
|
const axisY = this.position.getColumnPositionY();
|
|
20667
20844
|
const xBase = this.position.getColumnCenterPositionX(0) - this.position.getColumnWidth() / 2;
|
|
20668
20845
|
const labelX = xBase - this.position.spacings.labelToColumn;
|
|
20669
20846
|
if (prefixes.size > 1) {
|
|
20670
|
-
// Overlay mode: one header per group
|
|
20847
|
+
// Overlay mode: one header per group — front group centered on its bar,
|
|
20848
|
+
// back groups aligned with their bar's top edge
|
|
20671
20849
|
const groupMap = new Map();
|
|
20672
20850
|
for (const seg of segments) {
|
|
20673
20851
|
const prefix = getScenarioPrefix(seg.scenario);
|
|
@@ -20685,11 +20863,15 @@ class TimeChart {
|
|
|
20685
20863
|
for (const [prefix, segs] of groupMap) {
|
|
20686
20864
|
groups.push({ prefix, segments: segs });
|
|
20687
20865
|
}
|
|
20688
|
-
groups.forEach((group) => {
|
|
20866
|
+
groups.forEach((group, groupIdx) => {
|
|
20689
20867
|
const groupTotal = group.segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
|
|
20690
20868
|
const pixelPerUnit = group.segments[0].dataPoint.pixelPerUnit;
|
|
20691
20869
|
const groupPixelHeight = this.stackConfig.mode === withStyled.StackMode.RELATIVE ? pixelPerUnit : groupTotal * pixelPerUnit;
|
|
20692
|
-
|
|
20870
|
+
// The front-most group (drawn last, e.g. AC) is fully visible, so its
|
|
20871
|
+
// label is centered on the bar. Back groups are mostly hidden behind it
|
|
20872
|
+
// and only peek out at the top, so their labels align with the bar's top edge.
|
|
20873
|
+
const isFrontGroup = groupIdx === groups.length - 1;
|
|
20874
|
+
const centerY = isFrontGroup ? axisY - groupPixelHeight / 2 : axisY - groupPixelHeight;
|
|
20693
20875
|
const labelText = this.i18n.get(group.prefix + "1") || group.prefix.toUpperCase();
|
|
20694
20876
|
new Label(headerGroup, labelX, centerY, "STACK_HEADER", labelText, this.styles, HookLocation.Center, HookLocation.Right).forceStringTypeDraw();
|
|
20695
20877
|
});
|
|
@@ -20748,6 +20930,15 @@ class TimeChart {
|
|
|
20748
20930
|
activeLayers.push(key);
|
|
20749
20931
|
}
|
|
20750
20932
|
}
|
|
20933
|
+
if (isScenarioStack && this.scenarioPropOrder.length > 0) {
|
|
20934
|
+
const order = this.scenarioPropOrder;
|
|
20935
|
+
activeLayers.sort((a, b) => {
|
|
20936
|
+
var _a, _b, _c, _d;
|
|
20937
|
+
const ia = order.indexOf((_b = (_a = dataModel[0][a]) === null || _a === void 0 ? void 0 : _a.scenario) !== null && _b !== void 0 ? _b : "");
|
|
20938
|
+
const ib = order.indexOf((_d = (_c = dataModel[0][b]) === null || _c === void 0 ? void 0 : _c.scenario) !== null && _d !== void 0 ? _d : "");
|
|
20939
|
+
return (ia === -1 ? order.length : ia) - (ib === -1 ? order.length : ib);
|
|
20940
|
+
});
|
|
20941
|
+
}
|
|
20751
20942
|
// Compute cumulative values
|
|
20752
20943
|
for (let layerIdx = 0; layerIdx < activeLayers.length; layerIdx++) {
|
|
20753
20944
|
const key = activeLayers[layerIdx];
|
|
@@ -21803,6 +21994,7 @@ class DataQuery {
|
|
|
21803
21994
|
.map((s) => this.translateScenarioSQL(s, true, this.config.type))
|
|
21804
21995
|
.toString();
|
|
21805
21996
|
const relativeScenarios = this.getRelativeScenarios();
|
|
21997
|
+
const attributesSQL = this.config.attributes.map((attribute) => this.translateAttributeSQL(attribute)).toString();
|
|
21806
21998
|
const groups = new QueryGroups(this.config);
|
|
21807
21999
|
const groupsAggregated = this.config.grouped ? [QueryColumnNames.ROWGROUP, QueryColumnNames.ROWGROUPINDEX] : [];
|
|
21808
22000
|
let order = ["", ""];
|
|
@@ -21839,7 +22031,7 @@ class DataQuery {
|
|
|
21839
22031
|
queryLimitSection = `LIMIT ${this.config.limit}`;
|
|
21840
22032
|
}
|
|
21841
22033
|
this.createGroupHeaderRow(rowGroupEntry, queries);
|
|
21842
|
-
this.createDataRow(queries, rowGroupEntry, groups, scenarios, queryWhereSection, order, queryLimitSection);
|
|
22034
|
+
this.createDataRow(queries, rowGroupEntry, groups, scenarios, attributesSQL, queryWhereSection, order, queryLimitSection);
|
|
21843
22035
|
this.createRestRow(rowGroupEntry, queries, groups, scenarios, queryWhereSection, order);
|
|
21844
22036
|
this.createGroupSumRow(queries, sumGroupQueries, rowGroupEntry, scenariosSUMQuery, order);
|
|
21845
22037
|
});
|
|
@@ -21854,7 +22046,7 @@ class DataQuery {
|
|
|
21854
22046
|
}
|
|
21855
22047
|
});
|
|
21856
22048
|
this.detectNaNCells(this.config.scenarios, res);
|
|
21857
|
-
this.createThereOfDrillRows(scenarios, order, res);
|
|
22049
|
+
this.createThereOfDrillRows(scenarios, attributesSQL, order, res);
|
|
21858
22050
|
this.createPartOfDrillRows(scenarios, order, sumGroupQueries, res);
|
|
21859
22051
|
this.createThereOfDrillColumns(this.config.categoryThereOf, res);
|
|
21860
22052
|
this.calculateColumnGroupRest(res, this.config.categoryThereOf);
|
|
@@ -21942,14 +22134,14 @@ class DataQuery {
|
|
|
21942
22134
|
}
|
|
21943
22135
|
}
|
|
21944
22136
|
/** Generates the main data rows for a single row group, applying GROUP BY, ORDER, and LIMIT. */
|
|
21945
|
-
createDataRow(querys, rowGroupEntry, groups, scenarios, queryWhereSection, order, queryLimitSection) {
|
|
22137
|
+
createDataRow(querys, rowGroupEntry, groups, scenarios, attributes, queryWhereSection, order, queryLimitSection) {
|
|
21946
22138
|
// Generates DataRows
|
|
21947
22139
|
querys.push(`SELECT ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
21948
22140
|
${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
21949
22141
|
'ENTRY' as ${QueryColumnNames.TYPE},
|
|
21950
22142
|
'${rowGroupEntry.rowGroup || "NO_GROUP"}' as ${QueryColumnNames.ROWGROUP},
|
|
21951
22143
|
'${QueryColumnNames.CATEGORYINDEX}',
|
|
21952
|
-
${groups} ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
22144
|
+
${groups} ${scenarios.length > 0 ? ",".concat(scenarios) : ""} ${attributes.length > 0 ? ",".concat(attributes) : ""}
|
|
21953
22145
|
FROM ${this.fromExpr} ${queryWhereSection}
|
|
21954
22146
|
GROUP BY ${groups}
|
|
21955
22147
|
ORDER BY ${order[0]} ${queryLimitSection}`);
|
|
@@ -22095,7 +22287,7 @@ class DataQuery {
|
|
|
22095
22287
|
* beneath their parent category row. Each thereof config entry produces a
|
|
22096
22288
|
* filtered/grouped SQL query whose results are spliced into the result set.
|
|
22097
22289
|
*/
|
|
22098
|
-
createThereOfDrillRows(scenarios, order, res) {
|
|
22290
|
+
createThereOfDrillRows(scenarios, attributes, order, res) {
|
|
22099
22291
|
// adds drill rows if setup in config
|
|
22100
22292
|
// if there of is set drilldown row is displayed with absolute numbers,
|
|
22101
22293
|
// if part of is also not null a relative percenatage based of the selected basis is displayed
|
|
@@ -22130,7 +22322,7 @@ class DataQuery {
|
|
|
22130
22322
|
${QueryColumnNames.CATEGORY},
|
|
22131
22323
|
${QueryColumnNames.SUBCATEGORY},
|
|
22132
22324
|
${QueryColumnNames.ROWGROUP} as ${QueryColumnNames.ROWGROUP},
|
|
22133
|
-
${scenarios}
|
|
22325
|
+
${scenarios} ${attributes.length > 0 ? ",".concat(attributes) : ""}
|
|
22134
22326
|
FROM ${this.fromExpr}
|
|
22135
22327
|
WHERE ${fromString}
|
|
22136
22328
|
GROUP BY ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}
|
|
@@ -22256,6 +22448,45 @@ class DataQuery {
|
|
|
22256
22448
|
}
|
|
22257
22449
|
return `SUM(${scenario} * transformOperator(operation)) as ${scenario}, COUNT(ISNULL(${scenario})) as ${scenario}_cnt`;
|
|
22258
22450
|
}
|
|
22451
|
+
/**
|
|
22452
|
+
* Translates an attribute definition into a SQL aggregate expression aliased
|
|
22453
|
+
* to the attribute's safe column alias (`attr_N`).
|
|
22454
|
+
*
|
|
22455
|
+
* `sum`/`avg` on scenario fields respect the row operation sign via
|
|
22456
|
+
* `transformOperator`, consistent with {@link translateScenarioSQL}; for
|
|
22457
|
+
* OPT/OPTNOTOTAL types the sign is already baked into the data.
|
|
22458
|
+
*/
|
|
22459
|
+
translateAttributeSQL(attribute) {
|
|
22460
|
+
const field = `[${attribute.arg}]`;
|
|
22461
|
+
const isScenarioField = /^(ac|pp|fc|pl)[1-4]$/.test(attribute.arg);
|
|
22462
|
+
const useOperator = isScenarioField && this.config.type !== TableType$2.OPT && this.config.type !== TableType$2.OPTNOTOTAL;
|
|
22463
|
+
switch (attribute.fn) {
|
|
22464
|
+
case "set":
|
|
22465
|
+
return `SETAGG(${field}) as ${attribute.alias}`;
|
|
22466
|
+
case "first":
|
|
22467
|
+
return `FIRST(${field}) as ${attribute.alias}`;
|
|
22468
|
+
case "last":
|
|
22469
|
+
return `LAST(${field}) as ${attribute.alias}`;
|
|
22470
|
+
case "min":
|
|
22471
|
+
return `MIN(${field}) as ${attribute.alias}`;
|
|
22472
|
+
case "max":
|
|
22473
|
+
return `MAX(${field}) as ${attribute.alias}`;
|
|
22474
|
+
case "avg":
|
|
22475
|
+
return useOperator
|
|
22476
|
+
? `AVG(${field} * transformOperator(operation)) as ${attribute.alias}`
|
|
22477
|
+
: `AVG(${field}) as ${attribute.alias}`;
|
|
22478
|
+
case "sum":
|
|
22479
|
+
return useOperator
|
|
22480
|
+
? `SUM(${field} * transformOperator(operation)) as ${attribute.alias}`
|
|
22481
|
+
: `SUM(${field}) as ${attribute.alias}`;
|
|
22482
|
+
case "lit":
|
|
22483
|
+
return `${this.sqlLiteral(attribute.arg)} as ${attribute.alias}`;
|
|
22484
|
+
}
|
|
22485
|
+
}
|
|
22486
|
+
/** Emits a raw lit() argument as a SQL literal: numeric when parseable, quoted string otherwise. */
|
|
22487
|
+
sqlLiteral(raw) {
|
|
22488
|
+
return raw !== "" && !Number.isNaN(Number(raw)) ? raw : `'${raw.replace(/'/g, "''")}'`;
|
|
22489
|
+
}
|
|
22259
22490
|
/**
|
|
22260
22491
|
* generates Tuple
|
|
22261
22492
|
* [0] orderby string example: category asc
|
|
@@ -22528,6 +22759,7 @@ class DataQuery {
|
|
|
22528
22759
|
class TableDataSetFactory {
|
|
22529
22760
|
constructor() {
|
|
22530
22761
|
this.normalizedHeader = [];
|
|
22762
|
+
this.attributesByAlias = new Map();
|
|
22531
22763
|
}
|
|
22532
22764
|
/**
|
|
22533
22765
|
* Creates Tableheader based on the configured scenarios (in config)
|
|
@@ -22537,13 +22769,17 @@ class TableDataSetFactory {
|
|
|
22537
22769
|
* visualise grouping.
|
|
22538
22770
|
* finally a seperator header row is created for the header underlining (border)
|
|
22539
22771
|
*/
|
|
22540
|
-
createHeader(type, scenarios, i18n, measureScale, measureUnit, showMeasureScale) {
|
|
22772
|
+
createHeader(type, scenarios, i18n, measureScale, measureUnit, showMeasureScale, attributes = []) {
|
|
22541
22773
|
const header = [];
|
|
22542
|
-
this.
|
|
22774
|
+
this.attributesByAlias = new Map(attributes.map((attribute) => [attribute.alias, attribute]));
|
|
22775
|
+
this.normalizedHeader = this.normalizeHeader(type, scenarios, attributes);
|
|
22543
22776
|
const headerRow = new TableRow(0, 0, TableRowType.HEADER);
|
|
22544
22777
|
const separatorRow = new TableRow(1, 0, TableRowType.SEPERATORLINE);
|
|
22545
22778
|
for (const scenario of this.normalizedHeader) {
|
|
22546
|
-
|
|
22779
|
+
const attribute = this.attributesByAlias.get(scenario.name);
|
|
22780
|
+
headerRow.createElement(attribute
|
|
22781
|
+
? i18n.get(attribute.label) || attribute.label
|
|
22782
|
+
: Formatter.translateScenarioLabel(scenario.name, i18n), scenario.type, this.createColumnType(scenario), null, this.setHeaderPrefix(scenario, i18n, measureScale, measureUnit, showMeasureScale), null, null, null, null);
|
|
22547
22783
|
separatorRow.createElement(null, scenario.type, this.createColumnType(scenario), null, null, null, null, null, null);
|
|
22548
22784
|
}
|
|
22549
22785
|
header.push(headerRow);
|
|
@@ -22568,7 +22804,7 @@ class TableDataSetFactory {
|
|
|
22568
22804
|
* depending of table type operation column is used (OPT) or not (SUM | LIST)
|
|
22569
22805
|
* in addition the headers are sorted based on the ruleset and duplicates are removed
|
|
22570
22806
|
*/
|
|
22571
|
-
normalizeHeader(type, scenarios) {
|
|
22807
|
+
normalizeHeader(type, scenarios, attributes) {
|
|
22572
22808
|
let header = [
|
|
22573
22809
|
{
|
|
22574
22810
|
name: QueryColumnNames.CATEGORY,
|
|
@@ -22593,8 +22829,15 @@ class TableDataSetFactory {
|
|
|
22593
22829
|
},
|
|
22594
22830
|
];
|
|
22595
22831
|
}
|
|
22832
|
+
// attribute columns sit between the category column and the scenario columns
|
|
22833
|
+
const attributeColumns = attributes.map((attribute) => ({
|
|
22834
|
+
name: attribute.alias,
|
|
22835
|
+
group: attribute.alias,
|
|
22836
|
+
type: attribute.alias,
|
|
22837
|
+
order: undefined,
|
|
22838
|
+
}));
|
|
22596
22839
|
// NOTE: scenarios are already sorted in setConfig
|
|
22597
|
-
return [...header, ...scenarios];
|
|
22840
|
+
return [...header, ...attributeColumns, ...scenarios];
|
|
22598
22841
|
}
|
|
22599
22842
|
/**
|
|
22600
22843
|
* Creates table data colelction,
|
|
@@ -22766,6 +23009,10 @@ class TableDataSetFactory {
|
|
|
22766
23009
|
* @param subCategory
|
|
22767
23010
|
*/
|
|
22768
23011
|
translateSumCellLabel(i18nMode, i18n, value, rowGroup, subCategory, type, scenario) {
|
|
23012
|
+
if (this.attributesByAlias.has(scenario)) {
|
|
23013
|
+
// attribute values render verbatim; rows without the column (e.g. SUM) stay blank
|
|
23014
|
+
return value;
|
|
23015
|
+
}
|
|
22769
23016
|
if (Number.isNaN(Number(value)) === false) {
|
|
22770
23017
|
return value;
|
|
22771
23018
|
}
|
|
@@ -22823,6 +23070,9 @@ class TableDataSetFactory {
|
|
|
22823
23070
|
* @param value
|
|
22824
23071
|
*/
|
|
22825
23072
|
translateScenarioCSS(scenario, value) {
|
|
23073
|
+
if (this.attributesByAlias.has(scenario)) {
|
|
23074
|
+
return "attribute";
|
|
23075
|
+
}
|
|
22826
23076
|
const scenarios = new VarianceScenario(scenario);
|
|
22827
23077
|
let prefix = "pos";
|
|
22828
23078
|
if (value < 0) {
|
|
@@ -22837,6 +23087,10 @@ class TableDataSetFactory {
|
|
|
22837
23087
|
if (scenario === "category") {
|
|
22838
23088
|
return "";
|
|
22839
23089
|
}
|
|
23090
|
+
const attribute = this.attributesByAlias.get(scenario);
|
|
23091
|
+
if (attribute) {
|
|
23092
|
+
return attribute.isNumeric ? "decimal" : "";
|
|
23093
|
+
}
|
|
22840
23094
|
let unitType;
|
|
22841
23095
|
const scenarios = new VarianceScenario(scenario);
|
|
22842
23096
|
if (scenariosUnitType === withStyled.DataFormat.PERCENT) {
|
|
@@ -23018,14 +23272,14 @@ class Table {
|
|
|
23018
23272
|
this.rowCount = 0;
|
|
23019
23273
|
}
|
|
23020
23274
|
const normalizedScenarios = this.normalizeScenarios(this.config.scenarios, this.config.categoryThereOf, this.config.sortOrder);
|
|
23021
|
-
this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale);
|
|
23275
|
+
this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale, this.config.attributes);
|
|
23022
23276
|
this.bodyRows =
|
|
23023
23277
|
this.rowCount === 0 ? [] : this.dataSetFactory.createBodyRows(this.config, this.i18n, this.db, this.fromExpr);
|
|
23024
23278
|
this.state = FactoryState$3.UP_TO_DATE;
|
|
23025
23279
|
}
|
|
23026
23280
|
update() {
|
|
23027
23281
|
const normalizedScenarios = this.normalizeScenarios(this.config.scenarios, this.config.categoryThereOf, this.config.sortOrder);
|
|
23028
|
-
this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale);
|
|
23282
|
+
this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale, this.config.attributes);
|
|
23029
23283
|
this.bodyRows =
|
|
23030
23284
|
this.rowCount === 0 || !this.fromExpr
|
|
23031
23285
|
? []
|
|
@@ -23111,6 +23365,8 @@ class TableComponentConfig {
|
|
|
23111
23365
|
this.categoryThereOf = new Map();
|
|
23112
23366
|
/** Percentage-of-total sub-row definitions. */
|
|
23113
23367
|
this.partOf = [];
|
|
23368
|
+
/** Custom columns computed from dataset fields via aggregate expressions (see bn-table `attributes` prop). */
|
|
23369
|
+
this.attributes = [];
|
|
23114
23370
|
this.sortOrder = new withStyled.OrderAdapter(new StringAdapter()).default();
|
|
23115
23371
|
/** Table aggregation mode: LIST (flat), SUM (with totals), OPT (with optional totals), etc. */
|
|
23116
23372
|
this.type = TableType$2.LIST;
|
|
@@ -23174,6 +23430,9 @@ class TableComponentConfigAdapter {
|
|
|
23174
23430
|
if (withStyled.CompareUtil.isArray(data.partOf)) {
|
|
23175
23431
|
config.partOf = withStyled.AdapterUtils.adaptArray(data.partOf, this.tableDrillGroupAdapter);
|
|
23176
23432
|
}
|
|
23433
|
+
if (withStyled.CompareUtil.isArray(data.attributes)) {
|
|
23434
|
+
config.attributes = data.attributes;
|
|
23435
|
+
}
|
|
23177
23436
|
if (withStyled.CompareUtil.isExisting(data.order)) {
|
|
23178
23437
|
config.sortOrder = this.orderAdapter.adapt(data.order);
|
|
23179
23438
|
}
|
|
@@ -23281,6 +23540,7 @@ const IbcsTable = class {
|
|
|
23281
23540
|
direction: OrderDirection.ASC,
|
|
23282
23541
|
};
|
|
23283
23542
|
this.categorythereof = new Map();
|
|
23543
|
+
this.attributeColumns = [];
|
|
23284
23544
|
this.type = TableType$2.LIST;
|
|
23285
23545
|
this.categoryWidth = withStyled.TableCategoryWidth.INF;
|
|
23286
23546
|
this.dataFormatDigits = { percent: 2, decimal: 1 };
|
|
@@ -23337,6 +23597,7 @@ const IbcsTable = class {
|
|
|
23337
23597
|
thereOf: this.thereof,
|
|
23338
23598
|
partOf: this.partof,
|
|
23339
23599
|
categoryThereOf: this.categorythereof,
|
|
23600
|
+
attributes: this.attributeColumns,
|
|
23340
23601
|
order: this.order,
|
|
23341
23602
|
type: this.type,
|
|
23342
23603
|
limit: this.limit,
|