@bino-bi/bn-template-engine 1.0.0-alpha.3 → 1.0.0-alpha.5
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-1265d8d3.entry.js +1 -0
- package/dist/bn-template-engine/p-15516dac.entry.js +1 -0
- package/dist/bn-template-engine/p-1c716641.entry.js +1 -0
- package/dist/bn-template-engine/p-27cc8dc0.entry.js +1 -0
- package/dist/bn-template-engine/p-3b4c7425.entry.js +1 -0
- package/dist/bn-template-engine/p-4426d484.entry.js +1 -0
- package/dist/bn-template-engine/p-51f8dc9e.entry.js +1 -0
- package/dist/bn-template-engine/p-53d4e690.entry.js +1 -0
- package/dist/bn-template-engine/p-5KQYRQLK.js +1 -0
- package/dist/bn-template-engine/p-7337e03d.entry.js +1 -0
- package/dist/bn-template-engine/{p-0f1504f3.entry.js → p-75e97c87.entry.js} +1 -1
- package/dist/bn-template-engine/p-7a560278.entry.js +1 -0
- package/dist/bn-template-engine/p-BYBpC0EO.js +1 -0
- package/dist/bn-template-engine/p-BfXY5dsy.js +1 -0
- package/dist/bn-template-engine/p-BgnHJQ9Q.js +1 -0
- package/dist/bn-template-engine/{p-B4ySv9KQ.js → p-Bhd_WSML.js} +1 -1
- package/dist/bn-template-engine/p-Bka-Z6jo.js +1 -0
- package/dist/bn-template-engine/p-Bnhh02CF.js +1 -0
- package/dist/bn-template-engine/p-C7dQL8CS.js +1 -0
- package/dist/bn-template-engine/p-CL1RYuNU.js +1 -0
- package/dist/bn-template-engine/p-CYwd_ZNM.js +1 -0
- package/dist/bn-template-engine/p-ChlK-T9I.js +1 -0
- package/dist/bn-template-engine/p-DHezf8pZ.js +1 -0
- package/dist/bn-template-engine/{p-DVMu6dEy.js → p-DlppAFq9.js} +1 -1
- package/dist/bn-template-engine/p-DvDDgmcV.js +1 -0
- package/dist/bn-template-engine/p-DvvwfRQG.js +1 -0
- package/dist/bn-template-engine/{p-DG-1MR_T.js → p-P7pGJBgc.js} +1 -1
- package/dist/bn-template-engine/p-abc0067c.entry.js +1 -0
- package/dist/bn-template-engine/p-b34eaf86.entry.js +1 -0
- package/dist/bn-template-engine/p-bdb8b44c.entry.js +1 -0
- package/dist/bn-template-engine/p-c44fcb8e.entry.js +1 -0
- package/dist/bn-template-engine/p-c7e1a49b.entry.js +1 -0
- package/dist/bn-template-engine/p-d9003041.entry.js +1 -0
- package/dist/bn-template-engine/p-daa7ffa3.entry.js +1 -0
- package/dist/bn-template-engine/p-e084f50a.entry.js +1 -0
- package/dist/bn-template-engine/p-eaba6658.entry.js +1 -0
- package/dist/bn-template-engine/{p-C0yAPzJz.js → p-u8igQLRZ.js} +1 -1
- package/dist/cjs/{DataFormatDigits-DAmZzqbD.js → DataFormatDigits-DKcOeLNK.js} +1 -1
- package/dist/cjs/{DateStringFactory-CcluhpGI.js → DateStringFactory-CSKvbS8K.js} +1 -1
- package/dist/cjs/{Order-BKoDS21t.js → Order-iG11HI4R.js} +8 -5
- package/dist/cjs/{SVGVariancesStyleGroup-DYYAU-81.js → SVGVariancesStyleGroup-K-Tw6lOD.js} +1 -14
- package/dist/cjs/bn-asset.cjs.entry.js +5 -4
- package/dist/cjs/bn-body_4.cjs.entry.js +15 -13
- package/dist/cjs/bn-card.cjs.entry.js +5 -4
- package/dist/cjs/{ibcs-chart-structure.cjs.entry.js → bn-chart-structure_5.cjs.entry.js} +1074 -30
- package/dist/cjs/bn-chart-time.cjs.entry.js +38 -12
- package/dist/cjs/bn-component-style.cjs.entry.js +5 -4
- package/dist/cjs/bn-dataset.cjs.entry.js +38 -9
- package/dist/cjs/bn-grid.cjs.entry.js +9 -7
- package/dist/cjs/bn-image.cjs.entry.js +9 -7
- package/dist/cjs/bn-internationalization.cjs.entry.js +5 -4
- package/dist/cjs/bn-layout-card.cjs.entry.js +3 -2
- package/dist/cjs/bn-layout-page.cjs.entry.js +2 -1
- package/dist/cjs/bn-message.cjs.entry.js +5 -4
- package/dist/cjs/bn-table.cjs.entry.js +981 -0
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +3 -2
- package/dist/cjs/bn-text.cjs.entry.js +11 -9
- package/dist/cjs/bn-tree.cjs.entry.js +9 -7
- package/dist/cjs/contentDecoder-JxOldq1e.js +419 -0
- package/dist/cjs/{context-protocol-CRPmux5D.js → context-protocol-DRQWrwsA.js} +2 -0
- package/dist/cjs/editor-companion.cjs.entry.js +1 -1
- package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +57 -0
- package/dist/cjs/ibcs-chart-time.cjs.entry.js +22 -18
- package/dist/cjs/{bn-context_5.cjs.entry.js → ibcs-table.cjs.entry.js} +122 -1293
- package/dist/cjs/{StringAdapter-Bneo8T4k.js → ibcsRuleSet-DgUoXOfd.js} +10 -10
- package/dist/cjs/index-Dm85hG6t.js +65 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-D8sIIKft.js → scaling-9Tz595RQ.js} +7 -7
- package/dist/cjs/{withHasError-B8gHkfV2.js → utils-CwHIVbbL.js} +1 -69
- package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-CKpSD8UT.js} +3 -3
- package/dist/cjs/{withComponentStatus-_x4LQZ0N.js → withComponentStatus-Bw70BhO0.js} +5 -5
- package/dist/cjs/{withComponentStyle-DMtic_9Y.js → withComponentStyle-aIbTCtfj.js} +5 -5
- package/dist/cjs/withHasError-D7ue5vAv.js +72 -0
- package/dist/cjs/{withStyled-CW30Bh6c.js → withStyled-CS1Yp4sv.js} +8 -61
- package/dist/cjs/{withTranslation-CWPAIRjh.js → withTranslation-rwgyITqe.js} +5 -5
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +226 -99
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +13 -3
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +94 -11
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +11 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +8 -6
- package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +4 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +28 -4
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +3 -3
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -4
- package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +4 -0
- package/dist/collection/components/bn-dataset/bn-dataset.js +49 -2
- package/dist/collection/components/bn-datasource/bn-datasource.js +46 -3
- package/dist/collection/components/bn-table/bn-table.js +20 -21
- package/dist/collection/components/bn-table/ibcs-table.js +2 -2
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +58 -41
- package/dist/collection/stores/componentStyles.js +2 -0
- package/dist/collection/utils/constants.js +8 -5
- package/dist/collection/utils/contentDecoder.js +28 -0
- package/dist/collection/utils/stackColors.js +2 -2
- package/dist/collection/utils/validate.js +1 -1
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGVariancesStyleGroup.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-table.js +1 -1
- package/dist/components/contentDecoder.js +1 -0
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/emotion-hash.esm.js +1 -0
- 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/ibcsRuleSet.js +1 -1
- package/dist/components/validate.js +1 -1
- package/dist/components/withStyled.js +1 -1
- package/dist/esm/{DataFormatDigits--qIbKvXa.js → DataFormatDigits-oSZ1hBKE.js} +1 -1
- package/dist/esm/{DateStringFactory-XWdUjsn8.js → DateStringFactory-CSGz6TDk.js} +1 -1
- package/dist/esm/{Order-sqjrku2z.js → Order-Bnhh02CF.js} +9 -6
- package/dist/esm/{SVGVariancesStyleGroup-ibg3sLjM.js → SVGVariancesStyleGroup-CqTjrZYg.js} +2 -13
- package/dist/esm/bn-asset.entry.js +5 -4
- package/dist/esm/bn-body_4.entry.js +11 -9
- package/dist/esm/bn-card.entry.js +5 -4
- package/dist/esm/{ibcs-chart-structure.entry.js → bn-chart-structure_5.entry.js} +1064 -24
- package/dist/esm/bn-chart-time.entry.js +38 -12
- package/dist/esm/bn-component-style.entry.js +5 -4
- package/dist/esm/bn-dataset.entry.js +35 -6
- package/dist/esm/bn-grid.entry.js +9 -7
- package/dist/esm/bn-image.entry.js +9 -7
- package/dist/esm/bn-internationalization.entry.js +5 -4
- package/dist/esm/bn-layout-card.entry.js +3 -2
- package/dist/esm/bn-layout-page.entry.js +2 -1
- package/dist/esm/bn-message.entry.js +5 -4
- package/dist/esm/bn-table.entry.js +979 -0
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +3 -2
- package/dist/esm/bn-text.entry.js +11 -9
- package/dist/esm/bn-tree.entry.js +9 -7
- package/dist/esm/contentDecoder-oMmxz6nJ.js +416 -0
- package/dist/esm/{context-protocol-Bz5klD-F.js → context-protocol-BHnQsVsr.js} +2 -0
- package/dist/esm/editor-companion.entry.js +1 -1
- package/dist/esm/emotion-hash.esm-BYBpC0EO.js +55 -0
- package/dist/esm/ibcs-chart-time.entry.js +15 -11
- package/dist/esm/{bn-context_5.entry.js → ibcs-table.entry.js} +69 -1236
- package/dist/esm/{StringAdapter-BCLJpQQ8.js → ibcsRuleSet-K4ytuA1f.js} +10 -10
- package/dist/esm/index-DHezf8pZ.js +65 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{scaling-C6K8FYSF.js → scaling-Cehc74IE.js} +2 -2
- package/dist/esm/{withHasError-B3QX2emi.js → utils-DvvwfRQG.js} +1 -69
- package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-FQ8NwCIz.js} +1 -1
- package/dist/esm/{withComponentStatus-DodoSXe-.js → withComponentStatus-DWjDYtZ7.js} +1 -1
- package/dist/esm/{withComponentStyle-BerJY64r.js → withComponentStyle-9uP_hcDq.js} +2 -2
- package/dist/esm/withHasError-FyY5mQ_3.js +70 -0
- package/dist/esm/{withStyled-D1fAWJ3g.js → withStyled--qQWquTH.js} +6 -59
- package/dist/esm/{withTranslation-mimbJdER.js → withTranslation-BqD0Kp7b.js} +2 -2
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +155 -109
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +7 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +2 -0
- package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +1 -0
- package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +1 -0
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +6 -0
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +8 -0
- package/dist/types/components/bn-table/bn-table.d.ts +10 -8
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +0 -2
- package/dist/types/components.d.ts +102 -38
- package/dist/types/stores/componentStyles.d.ts +2 -0
- package/dist/types/utils/constants.d.ts +8 -5
- package/dist/types/utils/contentDecoder.d.ts +12 -0
- package/package.json +2 -1
- package/dist/bn-template-engine/p-05a82a77.entry.js +0 -1
- package/dist/bn-template-engine/p-1970906d.entry.js +0 -1
- package/dist/bn-template-engine/p-1dbd339c.entry.js +0 -1
- package/dist/bn-template-engine/p-2e68cf09.entry.js +0 -1
- package/dist/bn-template-engine/p-31cc6a2d.entry.js +0 -1
- package/dist/bn-template-engine/p-37881d05.entry.js +0 -1
- package/dist/bn-template-engine/p-3b894997.entry.js +0 -1
- package/dist/bn-template-engine/p-50e49732.entry.js +0 -1
- package/dist/bn-template-engine/p-6c7c0455.entry.js +0 -1
- package/dist/bn-template-engine/p-6da93eae.entry.js +0 -1
- package/dist/bn-template-engine/p-701e1578.entry.js +0 -1
- package/dist/bn-template-engine/p-8tsCnxIz.js +0 -1
- package/dist/bn-template-engine/p-997b2fe4.entry.js +0 -1
- package/dist/bn-template-engine/p-BL8gyUwE.js +0 -1
- package/dist/bn-template-engine/p-BSfqOkN_.js +0 -1
- package/dist/bn-template-engine/p-CRLgp9-v.js +0 -1
- package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
- package/dist/bn-template-engine/p-DRikHQE-.js +0 -1
- package/dist/bn-template-engine/p-DtdQCMzj.js +0 -1
- package/dist/bn-template-engine/p-a90f1cbe.entry.js +0 -1
- package/dist/bn-template-engine/p-b7bec050.entry.js +0 -1
- package/dist/bn-template-engine/p-d7f0cbaf.entry.js +0 -1
- package/dist/bn-template-engine/p-dfb61aa5.entry.js +0 -1
- package/dist/bn-template-engine/p-ece17f84.entry.js +0 -1
- package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
- package/dist/bn-template-engine/p-fd427179.entry.js +0 -1
- package/dist/bn-template-engine/p-sqjrku2z.js +0 -1
- package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
- package/dist/cjs/bn-chart-structure.cjs.entry.js +0 -700
- package/dist/esm/bn-chart-structure.entry.js +0 -698
|
@@ -62,11 +62,11 @@ export class Table {
|
|
|
62
62
|
* values:<br />
|
|
63
63
|
* ``` w5 // w10 // w15 // w20 // w25 // w30 // w40 // w60 // w80 // w100 ```
|
|
64
64
|
*/
|
|
65
|
-
this.barColumnWidth = "
|
|
65
|
+
this.barColumnWidth = "w10";
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
67
|
+
* Pixels per unit for absolute variance bar charts (ΔPY).
|
|
68
|
+
* Controls bar width: barWidth = value × unitScaling.
|
|
69
|
+
* Bars exceeding barColumnWidth are shown with an arrow indicator.
|
|
70
70
|
* <br /><br />
|
|
71
71
|
* Default: 0.01
|
|
72
72
|
*/
|
|
@@ -596,7 +596,6 @@ export class Table {
|
|
|
596
596
|
this.unsubscribe();
|
|
597
597
|
}
|
|
598
598
|
componentDidRender() {
|
|
599
|
-
var _a, _b;
|
|
600
599
|
const { mode } = parseScaling(this.scale);
|
|
601
600
|
// Only auto-scale for 'auto' and 'empty' (blank) modes
|
|
602
601
|
if (mode !== "auto" && mode !== "empty") {
|
|
@@ -612,18 +611,21 @@ export class Table {
|
|
|
612
611
|
const { width: parentWidth } = getParentDimensions(host);
|
|
613
612
|
if (parentWidth <= 0)
|
|
614
613
|
return;
|
|
615
|
-
// Measure at base (unscaled) font size to get true content width.
|
|
616
|
-
// This avoids the oscillation where scaled-down content fits → reset
|
|
617
|
-
// to 1 → overflows → scale down → fits → …
|
|
618
614
|
const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
|
|
619
|
-
host
|
|
620
|
-
//
|
|
621
|
-
const
|
|
622
|
-
const
|
|
615
|
+
// Measure current content width. host has overflow:hidden, so scrollWidth
|
|
616
|
+
// reliably includes full content including shadow DOM overflow.
|
|
617
|
+
const currentWidth = host.scrollWidth;
|
|
618
|
+
const currentFactor = this.appliedScaleFactor;
|
|
619
|
+
// Both em-based and SVG-based dimensions scale proportionally with the
|
|
620
|
+
// factor, so dividing by the current factor recovers the base-size width.
|
|
621
|
+
// This avoids resetting --bn-font-size to base which only changes em
|
|
622
|
+
// widths but not SVG pixel attributes, causing measurement mismatch.
|
|
623
|
+
const unscaledWidth = currentFactor > 0 ? currentWidth / currentFactor : currentWidth;
|
|
623
624
|
if (unscaledWidth <= parentWidth + 1) {
|
|
624
625
|
// Content fits at base size — no scaling needed
|
|
625
626
|
this.errors.remove("AUTO_scale");
|
|
626
627
|
if (this.appliedScaleFactor !== 1) {
|
|
628
|
+
host.style.setProperty("--bn-font-size", `${baseFontSize}px`);
|
|
627
629
|
this._autoScaleGuard = true;
|
|
628
630
|
this.appliedScaleFactor = 1;
|
|
629
631
|
}
|
|
@@ -822,7 +824,7 @@ export class Table {
|
|
|
822
824
|
if (preset) {
|
|
823
825
|
return BAR_COLUMN_WIDTH_EM[preset];
|
|
824
826
|
}
|
|
825
|
-
return BAR_COLUMN_WIDTH_EM[TableBarColumnWidth.
|
|
827
|
+
return BAR_COLUMN_WIDTH_EM[TableBarColumnWidth.W10];
|
|
826
828
|
}
|
|
827
829
|
prepareBarColumns() {
|
|
828
830
|
if (isBlankInput(this.barColumns)) {
|
|
@@ -903,7 +905,7 @@ export class Table {
|
|
|
903
905
|
render() {
|
|
904
906
|
const fontStyles = this.getFontStyles();
|
|
905
907
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
906
|
-
return (h(Host, { key: '
|
|
908
|
+
return (h(Host, { key: '3690ce4fee5e38012a2f956035110cc3e2500b39', style: fontStyles }, h("div", { key: 'e6481956a6873beefb15ea7369a7352d2662c1a2' }, h("ibcs-table", { key: '3260517d31fa04294c8df293a6fefd88b129f7b6', data: this.data, "table-title": this.prepareTableTitle(), scenarios: this.prepareScenarios(), "scenarios-data-format": this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), type: this.prepareTableType(), "category-width": this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), "i18n-mode": this.prepareI18nMode(), "measure-scale": this.prepareMeasureScale(), "measure-type": this.prepareMeasureType(), "measure-unit": this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), scaleFactor: effectiveFactor }))));
|
|
907
909
|
}
|
|
908
910
|
static get is() { return "bn-table"; }
|
|
909
911
|
static get encapsulation() { return "shadow"; }
|
|
@@ -934,7 +936,7 @@ export class Table {
|
|
|
934
936
|
"name": "example",
|
|
935
937
|
"text": "// Auto-scale to parent (silent)\n<bn-table scale=\"auto\" ...></bn-table>\n\n// Fixed 50 % reduction\n<bn-table scale=\"0.5\" ...></bn-table>\n\n// Double size\n<bn-table scale=\"2\" ...></bn-table>\n\n// No scaling \u2014 always render at base font size\n<bn-table scale=\"none\" ...></bn-table>"
|
|
936
938
|
}],
|
|
937
|
-
"text": "Controls proportional scaling of the entire table relative to the\navailable parent width. All visual dimensions scale together: font size,\nem-based spacing/padding, SVG bar-chart widths, pin lengths, dot radii,\npattern fills, axis strokes, and label offsets.\n\nScaling is driven by a single factor applied to the base font size\n(`global.fontSizePx` from the component-style store, default 13.3333 px).\nBecause the table's SCSS uses `em` units for padding, borders, and\ncolumn widths, changing the font size cascades to all layout dimensions.\nSVG elements (bars, pins, patterns) receive the factor via the\n`scaleFactor` prop on `ibcs-table` and multiply every pixel constant\nby it, so they stay proportional to the surrounding text.\n\n| Value | Behavior |\n|---------------------|----------------------------------------------------------------------------------|\n| not set / `\"\"` | Auto-scale to fit parent width; emit `AUTO_scale` warning with the applied factor |\n| `\"none\"` | No scaling (render at base font size regardless of available space) |\n| `\"auto\"` | Auto-scale to fit parent width silently (no warning) |\n| `\"0.5\"`, `\"1.2\"`, \u2026 | Fixed factor \u2014 apply `baseFontSize \u00D7 factor` |\n\n**Auto-scale algorithm** (modes `\"\"` and `\"auto\"`):\n1. After each render, the
|
|
939
|
+
"text": "Controls proportional scaling of the entire table relative to the\navailable parent width. All visual dimensions scale together: font size,\nem-based spacing/padding, SVG bar-chart widths, pin lengths, dot radii,\npattern fills, axis strokes, and label offsets.\n\nScaling is driven by a single factor applied to the base font size\n(`global.fontSizePx` from the component-style store, default 13.3333 px).\nBecause the table's SCSS uses `em` units for padding, borders, and\ncolumn widths, changing the font size cascades to all layout dimensions.\nSVG elements (bars, pins, patterns) receive the factor via the\n`scaleFactor` prop on `ibcs-table` and multiply every pixel constant\nby it, so they stay proportional to the surrounding text.\n\n| Value | Behavior |\n|---------------------|----------------------------------------------------------------------------------|\n| not set / `\"\"` | Auto-scale to fit parent width; emit `AUTO_scale` warning with the applied factor |\n| `\"none\"` | No scaling (render at base font size regardless of available space) |\n| `\"auto\"` | Auto-scale to fit parent width silently (no warning) |\n| `\"0.5\"`, `\"1.2\"`, \u2026 | Fixed factor \u2014 apply `baseFontSize \u00D7 factor` |\n\n**Auto-scale algorithm** (modes `\"\"` and `\"auto\"`):\n1. After each render, the current `scrollWidth` of the host element is\n divided by the current `appliedScaleFactor` to derive the unscaled\n content width. This avoids resetting `--bn-font-size` to base (which\n would only affect em-based widths but not SVG pixel attributes).\n2. This unscaled width is compared against the parent's content-box\n width (via `getParentDimensions`).\n3. If the table overflows, `factor = parentWidth / unscaledWidth`\n is computed and applied to both the CSS variable and the\n `appliedScaleFactor` state (which re-renders the SVG charts).\n4. A guard flag (`_autoScaleGuard`) prevents the subsequent\n state-triggered re-render from re-measuring, avoiding an infinite\n measure \u2192 scale \u2192 fits \u2192 reset \u2192 overflow loop.\n\nInvalid values (negative numbers, non-numeric strings that are not\n`\"none\"` or `\"auto\"`) fall back to the default behaviour (auto + warning)\nand emit an `ERR_scale` warning."
|
|
938
940
|
},
|
|
939
941
|
"getter": false,
|
|
940
942
|
"setter": false,
|
|
@@ -1076,7 +1078,7 @@ export class Table {
|
|
|
1076
1078
|
"setter": false,
|
|
1077
1079
|
"reflect": false,
|
|
1078
1080
|
"attribute": "bar-column-width",
|
|
1079
|
-
"defaultValue": "\"
|
|
1081
|
+
"defaultValue": "\"w10\""
|
|
1080
1082
|
},
|
|
1081
1083
|
"unitScaling": {
|
|
1082
1084
|
"type": "any",
|
|
@@ -1089,11 +1091,8 @@ export class Table {
|
|
|
1089
1091
|
"required": false,
|
|
1090
1092
|
"optional": false,
|
|
1091
1093
|
"docs": {
|
|
1092
|
-
"tags": [
|
|
1093
|
-
|
|
1094
|
-
"text": "Bars now scale proportionally via column statistics. Kept for backward compatibility.\n<br /><br />\nScaling for absolute variance bar charts (\u0394PY).\n<br /><br />\nDefault: 0.01"
|
|
1095
|
-
}],
|
|
1096
|
-
"text": ""
|
|
1094
|
+
"tags": [],
|
|
1095
|
+
"text": "Pixels per unit for absolute variance bar charts (\u0394PY).\nControls bar width: barWidth = value \u00D7 unitScaling.\nBars exceeding barColumnWidth are shown with an arrow indicator.\n<br /><br />\nDefault: 0.01"
|
|
1097
1096
|
},
|
|
1098
1097
|
"getter": false,
|
|
1099
1098
|
"setter": false,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { OrderDirection, TableType } from "./utils/model";
|
|
2
|
+
import { OrderDirection, TableRowType, TableType } from "./utils/model";
|
|
3
3
|
import { Table } from "./utils/Table";
|
|
4
4
|
import { TableComponentConfigAdapter } from "./utils/model/TableComponentConfig";
|
|
5
5
|
import { TableDrillGroupAdapter } from "./utils/model/TableDrillGroup";
|
|
@@ -64,7 +64,7 @@ export class IbcsTable {
|
|
|
64
64
|
const errorMsg = this.i18n.get("NO_DATA") || "==No Data==";
|
|
65
65
|
return h("p", { class: "warning" }, errorMsg);
|
|
66
66
|
}
|
|
67
|
-
return (h("table", null, h("thead", null, this.table.getHeader().map((row) => (h("tr", { class: row.cssStyle }, row.getCells().map((cell) => (h("th", { colSpan: cell.colSpan, class: cell.cssStyle }, cell.getAsHeaderList().map((line, i, arr) => (h("span", null, i === arr.length - 1 ? (h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (h("span", null, line, cell.drawPrefix(), h("br", null))))))))))))), h("tbody", null, this.table.getBody().map((row) => (h("tr", { class: row.cssStyle }, row === null || row === void 0 ? void 0 : row.getCells().map((cell) => (h("td", { colSpan: cell.colSpan, class: cell.type ? `${cell.cssStyle} ${cell.type}` : cell.cssStyle }, cell.prefix != null ? (h("span", { class: cell.cssStyle + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart && cell.columnStats ? (h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, maxBarWidth: this.barColumnMaxWidth, styles: this.barChartStyles })) : (cell.draw(this.componentDataFormatDigits)))))))))));
|
|
67
|
+
return (h("table", null, h("thead", null, this.table.getHeader().map((row) => (h("tr", { class: row.cssStyle }, row.getCells().map((cell) => (h("th", { colSpan: cell.colSpan, class: cell.cssStyle }, cell.getAsHeaderList().map((line, i, arr) => (h("span", null, i === arr.length - 1 ? (h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (h("span", null, line, cell.drawPrefix(), h("br", null))))))))))))), h("tbody", null, this.table.getBody().map((row) => (h("tr", { class: row.cssStyle }, row === null || row === void 0 ? void 0 : row.getCells().map((cell) => (h("td", { colSpan: cell.colSpan, class: cell.type ? `${cell.cssStyle} ${cell.type}` : cell.cssStyle }, cell.prefix != null ? (h("span", { class: cell.cssStyle + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart && cell.columnStats && row.type !== TableRowType.SUM ? (h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, maxBarWidth: this.barColumnMaxWidth, styles: this.barChartStyles })) : (cell.draw(this.componentDataFormatDigits)))))))))));
|
|
68
68
|
};
|
|
69
69
|
return h(Host, null, helper());
|
|
70
70
|
}
|
|
@@ -151,35 +151,59 @@ function getBarStroke(varianceStyle) {
|
|
|
151
151
|
return { stroke: "none", strokeWidth: 0 };
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* majority of bars remain at a useful size. Values exceeding the effective max are
|
|
157
|
-
* flagged as "extreme" and rendered with an arrow indicator.
|
|
158
|
-
*
|
|
159
|
-
* Algorithm: effectiveMax = median * EXTREME_THRESHOLD (default 3×).
|
|
160
|
-
* If this would be less than absMax, some values are extreme.
|
|
161
|
-
* If the median is 0 (e.g. single value), falls back to absMax.
|
|
154
|
+
* Renders a zigzag break indicator at a given x position, matching the structure chart style.
|
|
155
|
+
* Two mirrored zigzag lines with a white background covering the break gap.
|
|
162
156
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
157
|
+
function renderZigzagBreak(breakX, breakGap, yTop, barHeight, s) {
|
|
158
|
+
const midX = breakX + breakGap / 2;
|
|
159
|
+
const halfGap = breakGap * 0.35;
|
|
160
|
+
const zigCount = 3;
|
|
161
|
+
const segHeight = barHeight / zigCount;
|
|
162
|
+
const amplitude = breakGap * 0.3;
|
|
163
|
+
let leftPath = `M ${midX - halfGap} ${yTop}`;
|
|
164
|
+
for (let i = 0; i < zigCount; i++) {
|
|
165
|
+
const y1 = yTop + segHeight * (i + 0.5);
|
|
166
|
+
const y2 = yTop + segHeight * (i + 1);
|
|
167
|
+
leftPath += ` L ${midX - halfGap - amplitude} ${y1} L ${midX - halfGap} ${y2}`;
|
|
168
|
+
}
|
|
169
|
+
let rightPath = `M ${midX + halfGap} ${yTop}`;
|
|
170
|
+
for (let i = 0; i < zigCount; i++) {
|
|
171
|
+
const y1 = yTop + segHeight * (i + 0.5);
|
|
172
|
+
const y2 = yTop + segHeight * (i + 1);
|
|
173
|
+
rightPath += ` L ${midX + halfGap + amplitude} ${y1} L ${midX + halfGap} ${y2}`;
|
|
167
174
|
}
|
|
168
|
-
|
|
169
|
-
|
|
175
|
+
return [
|
|
176
|
+
h("rect", { x: breakX, y: yTop - 1, width: breakGap, height: barHeight + 2, fill: "#ffffff" }),
|
|
177
|
+
h("path", { d: leftPath, fill: "none", stroke: "#000000", "stroke-width": 1 * s }),
|
|
178
|
+
h("path", { d: rightPath, fill: "none", stroke: "#000000", "stroke-width": 1 * s }),
|
|
179
|
+
];
|
|
170
180
|
}
|
|
171
181
|
/**
|
|
172
182
|
* Renders an absolute variance bar chart (d_ prefix).
|
|
173
183
|
* Horizontal bar with centered axis, green for positive, red for negative.
|
|
174
|
-
*
|
|
184
|
+
* When a bar exceeds maxBarWidth it is drawn as an overdrive bar:
|
|
185
|
+
* base segment + zigzag break + proportional overdrive stub (like structure chart).
|
|
175
186
|
*
|
|
176
187
|
* Layout: [left label area][bar area with axis][right label area]
|
|
177
188
|
*/
|
|
178
189
|
const AbsoluteVarianceBar = (props) => {
|
|
179
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm =
|
|
190
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm = 10, styles = DEFAULT_STYLES, } = props;
|
|
180
191
|
const s = styles.scaleFactor;
|
|
192
|
+
const fs = styles.fontSize;
|
|
181
193
|
const labelAreaWidth = 38 * s;
|
|
182
|
-
const maxBarWidth = maxBarWidthEm *
|
|
194
|
+
const maxBarWidth = maxBarWidthEm * fs;
|
|
195
|
+
// Overdrive layout constants
|
|
196
|
+
const breakGap = 4 * s;
|
|
197
|
+
const overdriveZoneWidth = maxBarWidth * 0.15;
|
|
198
|
+
const cutWidth = maxBarWidth - breakGap - overdriveZoneWidth;
|
|
199
|
+
// Direct unit scaling via fontSize
|
|
200
|
+
const scaledWidth = Math.abs(value) * styles.unitScaling * fs;
|
|
201
|
+
const isExtreme = scaledWidth > cutWidth;
|
|
202
|
+
// Compute proportional overdrive width across the column
|
|
203
|
+
const maxScaledWidth = columnStats.absMax * styles.unitScaling * fs;
|
|
204
|
+
const maxOverflow = Math.max(0, maxScaledWidth - cutWidth);
|
|
205
|
+
const overflowAmount = Math.max(0, scaledWidth - cutWidth);
|
|
206
|
+
const overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
|
|
183
207
|
// Adaptive axis placement based on data range
|
|
184
208
|
const hasNeg = columnStats.min < 0;
|
|
185
209
|
const hasPos = columnStats.max > 0;
|
|
@@ -190,18 +214,10 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
190
214
|
const padding = 2 * s;
|
|
191
215
|
const barHeight = height - padding * 2;
|
|
192
216
|
const axisX = (hasNeg ? labelAreaWidth : 0) + negBarWidth;
|
|
193
|
-
// Proportional scaling with outlier detection
|
|
194
|
-
const effectiveMax = computeEffectiveMax(columnStats);
|
|
195
|
-
const absValue = Math.abs(value);
|
|
196
|
-
const proportion = effectiveMax > 0 ? absValue / effectiveMax : 0;
|
|
197
|
-
const isExtreme = absValue > effectiveMax;
|
|
198
|
-
const barWidth = Math.min(proportion, 1) * maxBarWidth;
|
|
199
|
-
const isPositive = value >= 0;
|
|
200
|
-
const barX = isPositive ? axisX : axisX - barWidth;
|
|
201
217
|
const barY = padding;
|
|
218
|
+
const isPositive = value >= 0;
|
|
202
219
|
// Get style based on column type (scenario vs variance)
|
|
203
220
|
const barStyle = getBarStyle(scenario, value, isPositiveGood, styles);
|
|
204
|
-
// Pattern prefix for scenarios uses scenario type, for variances uses pos/neg
|
|
205
221
|
const patternPrefix = isScenarioColumn(scenario)
|
|
206
222
|
? getScenarioType(scenario)
|
|
207
223
|
: isPositiveGood
|
|
@@ -214,13 +230,14 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
214
230
|
const fillValue = getBarFill(barStyle, patternPrefix);
|
|
215
231
|
const { stroke: barStroke, strokeWidth: barStrokeWidth } = getBarStroke(barStyle);
|
|
216
232
|
const displayValue = formattedValue || formatValue(value, false, measureScale);
|
|
217
|
-
//
|
|
218
|
-
|
|
219
|
-
//
|
|
220
|
-
const
|
|
233
|
+
// Normal bar width (clamped to cutWidth when extreme)
|
|
234
|
+
const baseBarWidth = isExtreme ? cutWidth : scaledWidth;
|
|
235
|
+
// Label position accounts for overdrive
|
|
236
|
+
const totalVisualWidth = isExtreme ? cutWidth + breakGap + overdriveWidth : scaledWidth;
|
|
237
|
+
const labelX = isPositive ? axisX + totalVisualWidth + 4 * s : axisX - totalVisualWidth - 4 * s;
|
|
221
238
|
const labelAnchor = isPositive ? "start" : "end";
|
|
222
|
-
|
|
223
|
-
|
|
239
|
+
return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart absolute-variance", style: { overflow: "visible" } }, h(PatternDefs, { styles: styles }), h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), baseBarWidth > 0 && (h("rect", { x: isPositive ? axisX : axisX - baseBarWidth, y: barY, width: baseBarWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), isExtreme && overdriveWidth > 0 && (h("rect", { x: isPositive ? axisX + cutWidth + breakGap : axisX - cutWidth - breakGap - overdriveWidth, y: barY, width: overdriveWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), isExtreme &&
|
|
240
|
+
renderZigzagBreak(isPositive ? axisX + cutWidth : axisX - cutWidth - breakGap, breakGap, barY, barHeight, s), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": labelAnchor, fill: styles.fontColor, "font-size": fs, "font-family": styles.fontFamily }, displayValue)));
|
|
224
241
|
};
|
|
225
242
|
/**
|
|
226
243
|
* Renders a relative variance pin chart (dr_ prefix).
|
|
@@ -230,10 +247,11 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
230
247
|
* Uses percentageScaling to determine pin length (pixels per percentage point).
|
|
231
248
|
*/
|
|
232
249
|
const RelativeVariancePin = (props) => {
|
|
233
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm =
|
|
250
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm = 10, styles = DEFAULT_STYLES, } = props;
|
|
234
251
|
const s = styles.scaleFactor;
|
|
252
|
+
const fs = styles.fontSize;
|
|
235
253
|
// Pin length is ~2/3 of bar width for visual balance
|
|
236
|
-
const maxPinLength = Math.round(maxBarWidthEm * 0.67 *
|
|
254
|
+
const maxPinLength = Math.round(maxBarWidthEm * 0.67 * fs);
|
|
237
255
|
const pinPadding = 5 * s;
|
|
238
256
|
// Adaptive axis placement based on data range
|
|
239
257
|
const hasNeg = columnStats.min < 0;
|
|
@@ -245,12 +263,11 @@ const RelativeVariancePin = (props) => {
|
|
|
245
263
|
const totalWidth = pinAreaWidth + labelAreaWidth;
|
|
246
264
|
const axisX = negPinWidth;
|
|
247
265
|
const centerY = height / 2;
|
|
248
|
-
//
|
|
249
|
-
const
|
|
250
|
-
const
|
|
251
|
-
const
|
|
252
|
-
const
|
|
253
|
-
const pinLength = Math.min(proportion, 1) * maxPinLength;
|
|
266
|
+
// Direct unit scaling via fontSize
|
|
267
|
+
const percentValue = Math.abs(value) * 100;
|
|
268
|
+
const scaledLength = percentValue * styles.percentageScaling * fs;
|
|
269
|
+
const isExtreme = scaledLength > maxPinLength;
|
|
270
|
+
const pinLength = Math.min(scaledLength, maxPinLength);
|
|
254
271
|
const isPositive = value >= 0;
|
|
255
272
|
const pinEndX = isPositive ? axisX + pinLength : axisX - pinLength;
|
|
256
273
|
// Get style based on column type (scenario vs variance)
|
|
@@ -259,7 +276,7 @@ const RelativeVariancePin = (props) => {
|
|
|
259
276
|
const displayValue = formattedValue || formatValue(value, true, measureScale);
|
|
260
277
|
// Label always on the right side after the pin area
|
|
261
278
|
const labelX = pinAreaWidth + 4 * s;
|
|
262
|
-
return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), !isExtreme && h("circle", { cx: pinEndX, cy: centerY, r: dotRadius, fill: styles.fontColor }), h("line", { x1: axisX, y1: centerY, x2: pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": 2 * s }), isExtreme && isPositive && (h("polygon", { points: `${axisX + maxPinLength},${centerY} ${axisX + maxPinLength - 6 * s},${centerY - 3 * s} ${axisX + maxPinLength - 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), isExtreme && !isPositive && (h("polygon", { points: `${axisX - maxPinLength},${centerY} ${axisX - maxPinLength + 6 * s},${centerY - 3 * s} ${axisX - maxPinLength + 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": "start", fill: styles.fontColor, "font-size":
|
|
279
|
+
return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), !isExtreme && h("circle", { cx: pinEndX, cy: centerY, r: dotRadius, fill: styles.fontColor }), h("line", { x1: axisX, y1: centerY, x2: pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": 2 * s }), isExtreme && isPositive && (h("polygon", { points: `${axisX + maxPinLength},${centerY} ${axisX + maxPinLength - 6 * s},${centerY - 3 * s} ${axisX + maxPinLength - 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), isExtreme && !isPositive && (h("polygon", { points: `${axisX - maxPinLength},${centerY} ${axisX - maxPinLength + 6 * s},${centerY - 3 * s} ${axisX - maxPinLength + 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": "start", fill: styles.fontColor, "font-size": fs, "font-style": "italic", "font-family": styles.fontFamily }, displayValue)));
|
|
263
280
|
};
|
|
264
281
|
/**
|
|
265
282
|
* CellBarChart - Renders IBCS-compliant variance bar charts.
|
|
@@ -41,6 +41,7 @@ export const SYSTEM_STYLE_DEFAULTS = {
|
|
|
41
41
|
neg: { stroke: "#ff0000", fill: "#ff0000", width: 0.1 },
|
|
42
42
|
neu: { stroke: "#808080", fill: "#808080", width: 0.1 },
|
|
43
43
|
},
|
|
44
|
+
stackColors: ["#000000", "#c0c0c0", "#808080"],
|
|
44
45
|
padding: {
|
|
45
46
|
top: 10,
|
|
46
47
|
left: 10,
|
|
@@ -83,6 +84,7 @@ export const SYSTEM_STYLE_DEFAULTS = {
|
|
|
83
84
|
neg: { stroke: "#ff0000", fill: "#ff0000", width: 0.1 },
|
|
84
85
|
neu: { stroke: "#808080", fill: "#808080", width: 0.1 },
|
|
85
86
|
},
|
|
87
|
+
stackColors: ["#000000", "#c0c0c0", "#808080"],
|
|
86
88
|
padding: {
|
|
87
89
|
top: 10,
|
|
88
90
|
left: 10,
|
|
@@ -154,13 +154,16 @@ export var ChartMode;
|
|
|
154
154
|
ChartMode["LINE"] = "line";
|
|
155
155
|
ChartMode["AUTO"] = "auto";
|
|
156
156
|
})(ChartMode || (ChartMode = {}));
|
|
157
|
-
/**
|
|
157
|
+
/**
|
|
158
|
+
* Stacking dimension for multi-segment bar charts.
|
|
159
|
+
* - SCENARIOS: stack the scenarios from the `scenarios` prop end-to-end
|
|
160
|
+
* - DIMENSIONS: stack by the next-lower hierarchy level derived from the `level` prop
|
|
161
|
+
* (rowGroup → category, category → subCategory)
|
|
162
|
+
*/
|
|
158
163
|
export var StackBy;
|
|
159
164
|
(function (StackBy) {
|
|
160
|
-
StackBy["
|
|
161
|
-
StackBy["
|
|
162
|
-
StackBy["SUBCATEGORY"] = "subcategory";
|
|
163
|
-
StackBy["ROWGROUP"] = "rowgroup";
|
|
165
|
+
StackBy["SCENARIOS"] = "scenarios";
|
|
166
|
+
StackBy["DIMENSIONS"] = "dimensions";
|
|
164
167
|
})(StackBy || (StackBy = {}));
|
|
165
168
|
/**
|
|
166
169
|
* How stacked values are presented.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import hash from "@emotion/hash";
|
|
2
|
+
import { gunzipSync } from "fflate";
|
|
3
|
+
/**
|
|
4
|
+
* Compute a short deterministic hash of a string.
|
|
5
|
+
*/
|
|
6
|
+
export function computeContentHash(text) {
|
|
7
|
+
return hash(text);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Decode a compressed payload in the format `<hash>:<base64_gzip>`.
|
|
11
|
+
* Returns the embedded hash and the decompressed JSON string.
|
|
12
|
+
*/
|
|
13
|
+
export function decodeCompressedContent(text) {
|
|
14
|
+
const colonIndex = text.indexOf(":");
|
|
15
|
+
if (colonIndex === -1) {
|
|
16
|
+
throw new Error("Invalid compressed format: missing ':' separator");
|
|
17
|
+
}
|
|
18
|
+
const embeddedHash = text.slice(0, colonIndex);
|
|
19
|
+
const base64Data = text.slice(colonIndex + 1);
|
|
20
|
+
const binaryString = atob(base64Data);
|
|
21
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
22
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
23
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
24
|
+
}
|
|
25
|
+
const decompressed = gunzipSync(bytes);
|
|
26
|
+
const json = new TextDecoder().decode(decompressed);
|
|
27
|
+
return { hash: embeddedHash, json };
|
|
28
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Default fill colors cycled through for stacked chart segments. */
|
|
2
|
-
export const STACK_FILLS = ["#
|
|
2
|
+
export const STACK_FILLS = ["#000000", "#c0c0c0", "#808080"];
|
|
3
3
|
/** Default stroke colors cycled through for stacked chart segments. */
|
|
4
|
-
export const STACK_STROKES = ["#
|
|
4
|
+
export const STACK_STROKES = ["#000000", "#c0c0c0", "#808080"];
|
|
5
5
|
/**
|
|
6
6
|
* IBCS rendering order: back-to-front (PL behind FC behind PP behind AC).
|
|
7
7
|
* Used to ensure correct visual layering when scenarios overlap.
|
|
@@ -294,7 +294,7 @@ export function validateStackConfig(value) {
|
|
|
294
294
|
errors.push("stack: 'by' is required");
|
|
295
295
|
}
|
|
296
296
|
else {
|
|
297
|
-
const validBy = ["
|
|
297
|
+
const validBy = ["scenarios", "dimensions"];
|
|
298
298
|
if (!validBy.includes(config.by)) {
|
|
299
299
|
errors.push(`stack: 'by' must be one of: ${validBy.join(", ")}`);
|
|
300
300
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./alasql.min.js";import{
|
|
1
|
+
import{a as e}from"./alasql.min.js";import{j as t}from"./Order.js";class a{constructor(e="",t=1){this.prefix=e,this.value=t}}var s;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(s||(s={}));class r{static calculateMeasureScale(t,s,r){var n;if("_"===r)return new a;if(null!=r&&[...this.unitsLeast,...this.unitsGreat].includes(r))return this.lookupPrefix(r);if(0===s.length)return new a;const i=`SELECT MAX(GREATEST(${s.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`,u=`SELECT MIN(LEAST(${s.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`;let c=i;"LEAST"===(null==r?void 0:r.toUpperCase())&&(c=u);const l=null===(n=e(c,[t])[0])||void 0===n?void 0:n.prefixvalue;return this.determinePrefix(Math.abs(l))}static determinePrefix(e){if(e>=1e3){const t=Math.floor(Math.floor(Math.abs(e)).toString().length/3),s=+Math.pow(1e3,t);return new a(this.unitsGreat[t-1],s)}if(e<=.001){const t=Math.floor(Math.abs(e).toString().length/3),s=1/Math.pow(1e3,t);return new a(this.unitsLeast[t-1],s)}return new a}static lookupPrefix(e){return new a(e,s[e])}}r.unitsGreat=["k","M","G","T","P","E","Z","Y"],r.unitsLeast=["m","my","n","p","P","f","a","z","y"];class n{constructor(e=2,t=1){this.percent=e,this.decimal=t}}class i{adapt(e){const a=new n;return t.isNumber(e.percent)&&(a.percent=e.percent),t.isNumber(e.decimal)&&(a.decimal=e.decimal),a}default(){return new n}}export{r as D,a as S,n as a,i as b}
|