@bino-bi/bn-template-engine 1.0.0-alpha.0 → 1.0.0-alpha.11
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/LICENSE +203 -21
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-095f74d7.entry.js +1 -0
- package/dist/bn-template-engine/p-14318b0d.entry.js +1 -0
- package/dist/bn-template-engine/{p-c9f050bf.entry.js → p-2133e02b.entry.js} +1 -1
- package/dist/bn-template-engine/p-6b469808.entry.js +1 -0
- package/dist/bn-template-engine/p-7HSTE79g.js +1 -0
- package/dist/bn-template-engine/p-B4JfKvVT.js +1 -0
- package/dist/bn-template-engine/p-B_d-jp99.js +2 -0
- package/dist/bn-template-engine/p-Bi2wx-el.js +1 -0
- package/dist/bn-template-engine/p-CWiZks2h.js +1 -0
- package/dist/bn-template-engine/{p-BQp6ZPYW.js → p-DSXNgKLa.js} +1 -1
- package/dist/bn-template-engine/p-c2cbb8ea.entry.js +1 -0
- package/dist/bn-template-engine/p-e783733e.entry.js +1 -0
- package/dist/bn-template-engine/p-e94b4e31.entry.js +1 -0
- package/dist/bn-template-engine/p-fdb3e99a.entry.js +1 -0
- package/dist/cjs/bn-asset_21.cjs.entry.js +23995 -0
- package/dist/cjs/bn-grid.cjs.entry.js +6 -13
- package/dist/cjs/bn-image.cjs.entry.js +6 -13
- package/dist/cjs/bn-internationalization.cjs.entry.js +5 -7
- package/dist/cjs/bn-template-engine.cjs.js +2 -2
- package/dist/cjs/bn-template.cjs.entry.js +4 -6
- package/dist/cjs/bn-text.cjs.entry.js +10 -19
- package/dist/cjs/bn-tree.cjs.entry.js +11 -14
- package/dist/cjs/{context-protocol-BkYHFkXE.js → context-protocol-B_jipZpJ.js} +6 -2
- package/dist/cjs/editor-companion.cjs.entry.js +3 -3
- package/dist/cjs/{index-CScBFiS1.js → index-CDKG4xmO.js} +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/scaling-eyzCrFB8.js +329 -0
- package/dist/cjs/{withBodyObserver-B0_W1VOf.js → withBodyObserver-D7BKWN2N.js} +2 -2
- package/dist/cjs/{withHasError-Dspb3lIV.js → withHasError-Cl2gTQzA.js} +106 -2
- package/dist/{esm/luxon-DbyXf6dF.js → cjs/withStyled-V7xz_x1c.js} +1406 -1
- package/dist/collection/collection-manifest.json +2 -10
- package/dist/collection/components/bn-body/bn-body.css +1 -0
- package/dist/collection/components/bn-card/bn-card.css +2 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +368 -130
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +34 -10
- 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.css +1 -1
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +172 -51
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +22 -9
- 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 +173 -8
- package/dist/collection/components/bn-layout-card/bn-layout-card.css +3 -2
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +207 -32
- package/dist/collection/components/bn-layout-page/bn-layout-page.css +1 -3
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +172 -43
- package/dist/collection/components/bn-message/bn-message.js +1 -1
- package/dist/collection/components/bn-page/bn-page.js +1 -1
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.css +3 -0
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +136 -0
- package/dist/collection/components/bn-table/bn-table.js +201 -58
- package/dist/collection/components/bn-table/ibcs-table.css +7 -5
- package/dist/collection/components/bn-table/ibcs-table.js +91 -5
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +79 -31
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +3 -1
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +12 -3
- package/dist/collection/components/bn-table/utils/helper/ColumnStatistics.js +9 -1
- package/dist/collection/components/bn-template/bn-template.js +1 -1
- package/dist/collection/components/bn-text/bn-text.js +1 -1
- package/dist/collection/components/bn-title/bn-title.js +1 -9
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +1 -4
- package/dist/collection/components/bn-tree/bn-tree.js +5 -1
- package/dist/collection/components/editor-companion/editor-companion.js +1 -1
- package/dist/collection/stores/componentStyles.js +2 -0
- package/dist/collection/stores/createScopedStores.js +3 -1
- package/dist/collection/utils/DateStringFactory.js +0 -1
- package/dist/collection/utils/constants.js +35 -5
- package/dist/collection/utils/contentDecoder.js +28 -0
- package/dist/collection/utils/layoutObserver.js +88 -0
- package/dist/collection/utils/parentDimensions.js +57 -10
- package/dist/collection/utils/stackColors.js +2 -2
- package/dist/collection/utils/validate.js +5 -2
- package/dist/collection/utils/withInheritedProps.js +152 -0
- package/dist/collection/utils/withScalingGroup.js +66 -0
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGVariancesStyleGroup.js +1 -1
- package/dist/components/bn-body2.js +1 -1
- package/dist/components/bn-card2.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-message2.js +1 -1
- package/dist/components/bn-page2.js +1 -1
- package/dist/components/{test-runner-time.d.ts → bn-scaling-group.d.ts} +4 -4
- package/dist/components/bn-scaling-group.js +1 -0
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-template.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/contentDecoder.js +1 -0
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/editor-companion.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/layoutObserver.js +1 -0
- package/dist/components/scaling.js +1 -1
- package/dist/components/validate.js +1 -1
- package/dist/components/withHasError.js +1 -1
- package/dist/components/withInheritedProps.js +1 -0
- package/dist/components/withStyled.js +1 -1
- package/dist/esm/bn-asset_21.entry.js +23973 -0
- package/dist/esm/bn-grid.entry.js +4 -11
- package/dist/esm/bn-image.entry.js +4 -11
- package/dist/esm/bn-internationalization.entry.js +4 -6
- package/dist/esm/bn-template-engine.js +3 -3
- package/dist/esm/bn-template.entry.js +3 -5
- package/dist/esm/bn-text.entry.js +6 -15
- package/dist/esm/bn-tree.entry.js +9 -12
- package/dist/esm/{context-protocol-DzeqZxg6.js → context-protocol-D-o_UZ33.js} +6 -2
- package/dist/esm/editor-companion.entry.js +3 -3
- package/dist/esm/{index-B27Ax6P_.js → index-B_d-jp99.js} +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/scaling-BzbiBnuN.js +324 -0
- package/dist/esm/{withBodyObserver-gZpZiEIK.js → withBodyObserver-AFk2wwHT.js} +2 -2
- package/dist/esm/{withHasError-C48fTE2k.js → withHasError-DW_vMDUp.js} +106 -2
- package/dist/{cjs/luxon-8hyy5YD7.js → esm/withStyled-5RqF8WBL.js} +1371 -2
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +163 -110
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +4 -3
- 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/bn-chart-time.d.ts +29 -12
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +4 -3
- 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 +48 -5
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +153 -0
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +160 -1
- package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +37 -0
- package/dist/types/components/bn-table/bn-table.d.ts +32 -17
- package/dist/types/components/bn-table/ibcs-table.d.ts +20 -0
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +1 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +1 -0
- package/dist/types/components/bn-title/bn-title.d.ts +0 -1
- package/dist/types/components.d.ts +438 -461
- package/dist/types/context/context-protocol.d.ts +2 -1
- package/dist/types/stores/componentStyles.d.ts +2 -0
- package/dist/types/stores/createScopedStores.d.ts +1 -0
- package/dist/types/utils/constants.d.ts +23 -5
- package/dist/types/utils/contentDecoder.d.ts +12 -0
- package/dist/types/utils/layoutObserver.d.ts +27 -0
- package/dist/types/utils/parentDimensions.d.ts +7 -2
- package/dist/types/utils/validate.d.ts +1 -0
- package/dist/types/utils/withInheritedProps.d.ts +38 -0
- package/dist/types/utils/withScalingGroup.d.ts +14 -0
- package/package.json +4 -4
- package/readme.md +2 -3
- package/dist/bn-template-engine/assets/gpx/Chasing_Legends.gpx +0 -195076
- package/dist/bn-template-engine/assets/gpx/Fahrt_am_Nachmittag.gpx +0 -142007
- package/dist/bn-template-engine/assets/icons/gpx-finish.png +0 -0
- package/dist/bn-template-engine/assets/icons/gpx-shadow.png +0 -0
- package/dist/bn-template-engine/assets/icons/gpx-start.png +0 -0
- package/dist/bn-template-engine/assets/icons/marker-example.png +0 -0
- package/dist/bn-template-engine/assets/icons/pin-icon-end.png +0 -0
- package/dist/bn-template-engine/assets/icons/pin-icon-start.png +0 -0
- package/dist/bn-template-engine/assets/icons/pin-icon-wpt.png +0 -0
- package/dist/bn-template-engine/assets/icons/pin-shadow.png +0 -0
- package/dist/bn-template-engine/assets/icons/pin.png +0 -0
- package/dist/bn-template-engine/p--TeDldm8.js +0 -1
- package/dist/bn-template-engine/p-0e7dc113.entry.js +0 -1
- package/dist/bn-template-engine/p-1jFf17Vj.js +0 -1
- package/dist/bn-template-engine/p-264c6bad.entry.js +0 -1
- package/dist/bn-template-engine/p-326a0902.entry.js +0 -1
- package/dist/bn-template-engine/p-38a8bde3.entry.js +0 -1
- package/dist/bn-template-engine/p-577eafcd.entry.js +0 -1
- package/dist/bn-template-engine/p-5905cc43.entry.js +0 -1
- package/dist/bn-template-engine/p-5d155a72.entry.js +0 -1
- package/dist/bn-template-engine/p-65f8962a.entry.js +0 -1
- package/dist/bn-template-engine/p-6b8d1ebf.entry.js +0 -1
- package/dist/bn-template-engine/p-7995acb2.entry.js +0 -1
- package/dist/bn-template-engine/p-7afe431e.entry.js +0 -1
- package/dist/bn-template-engine/p-8014b1ac.entry.js +0 -1
- package/dist/bn-template-engine/p-80423fc8.entry.js +0 -1
- package/dist/bn-template-engine/p-91e74d42.entry.js +0 -1
- package/dist/bn-template-engine/p-930a9e29.entry.js +0 -1
- package/dist/bn-template-engine/p-93C9jL8R.js +0 -1
- package/dist/bn-template-engine/p-93ff8584.entry.js +0 -1
- package/dist/bn-template-engine/p-B0m0U4wJ.js +0 -1
- package/dist/bn-template-engine/p-B27Ax6P_.js +0 -2
- package/dist/bn-template-engine/p-B79VcHiT.js +0 -1
- package/dist/bn-template-engine/p-BBd0ZVLL.js +0 -1
- package/dist/bn-template-engine/p-BFTU3MAI.js +0 -1
- package/dist/bn-template-engine/p-BFatTBqh.js +0 -1
- package/dist/bn-template-engine/p-BYmPQYxx.js +0 -1
- package/dist/bn-template-engine/p-BhEQy-2D.js +0 -1
- package/dist/bn-template-engine/p-BtVfu16B.js +0 -1
- package/dist/bn-template-engine/p-CY1RzLjU.js +0 -1
- package/dist/bn-template-engine/p-CfWnag33.js +0 -1
- package/dist/bn-template-engine/p-CnI71OA9.js +0 -1
- package/dist/bn-template-engine/p-Cp4MVxCu.js +0 -1
- package/dist/bn-template-engine/p-DbyXf6dF.js +0 -1
- package/dist/bn-template-engine/p-TdL-LRR9.js +0 -1
- package/dist/bn-template-engine/p-_LBTIfNN.js +0 -1
- package/dist/bn-template-engine/p-a342cd3c.entry.js +0 -1
- package/dist/bn-template-engine/p-ad94cf63.entry.js +0 -1
- package/dist/bn-template-engine/p-bc37d750.entry.js +0 -1
- package/dist/bn-template-engine/p-d07a0ca3.entry.js +0 -1
- package/dist/bn-template-engine/p-e5f372af.entry.js +0 -1
- package/dist/bn-template-engine/p-e620028c.entry.js +0 -1
- package/dist/bn-template-engine/p-e81e116a.entry.js +0 -1
- package/dist/bn-template-engine/p-eca98070.entry.js +0 -1
- package/dist/bn-template-engine/p-ee6de950.entry.js +0 -1
- package/dist/bn-template-engine/p-efe0ef1e.entry.js +0 -1
- package/dist/bn-template-engine/p-f034f1b8.entry.js +0 -1
- package/dist/bn-template-engine/p-f1c1a8a3.entry.js +0 -1
- package/dist/bn-template-engine/p-fe573a1a.entry.js +0 -1
- package/dist/bn-template-engine/p-kMyLevYy.js +0 -1
- package/dist/cjs/DataFormatDigits-DmTbhF8q.js +0 -142
- package/dist/cjs/DateStringFactory-Dn0aRj2Y.js +0 -453
- package/dist/cjs/Order-B4NIqQWe.js +0 -129
- package/dist/cjs/SVGVariancesStyleGroup-Czizhngt.js +0 -7973
- package/dist/cjs/StringAdapter-0EbYMkR0.js +0 -136
- package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +0 -10
- package/dist/cjs/alasql.min-C_nHTuEQ.js +0 -306
- package/dist/cjs/bn-asset.cjs.entry.js +0 -42
- package/dist/cjs/bn-body_3.cjs.entry.js +0 -413
- package/dist/cjs/bn-card.cjs.entry.js +0 -37
- package/dist/cjs/bn-chart-structure.cjs.entry.js +0 -705
- package/dist/cjs/bn-chart-time.cjs.entry.js +0 -987
- package/dist/cjs/bn-component-style.cjs.entry.js +0 -44
- package/dist/cjs/bn-context_5.cjs.entry.js +0 -3380
- package/dist/cjs/bn-dataset.cjs.entry.js +0 -278
- package/dist/cjs/bn-layout-card.cjs.entry.js +0 -128
- package/dist/cjs/bn-layout-page.cjs.entry.js +0 -142
- package/dist/cjs/bn-map.cjs.entry.js +0 -425
- package/dist/cjs/bn-message.cjs.entry.js +0 -52
- package/dist/cjs/componentRegister-C17UFNPh.js +0 -72
- package/dist/cjs/constants-DHqQXSSd.js +0 -158
- package/dist/cjs/formatter-DIJL_crx.js +0 -215
- package/dist/cjs/ibcs-chart-structure.cjs.entry.js +0 -2906
- package/dist/cjs/ibcs-chart-time.cjs.entry.js +0 -4140
- package/dist/cjs/ibcs-map.cjs.entry.js +0 -1075
- package/dist/cjs/ibcs-title.cjs.entry.js +0 -352
- package/dist/cjs/scaling-B23eOtsC.js +0 -67
- package/dist/cjs/test-runner-card.cjs.entry.js +0 -27
- package/dist/cjs/test-runner-chart-time.cjs.entry.js +0 -230
- package/dist/cjs/test-runner-chart.cjs.entry.js +0 -326
- package/dist/cjs/test-runner-map.cjs.entry.js +0 -1862
- package/dist/cjs/test-runner-table.cjs.entry.js +0 -477
- package/dist/cjs/test-runner-time.cjs.entry.js +0 -381
- package/dist/cjs/test-runner-title.cjs.entry.js +0 -115
- package/dist/cjs/withComponentStatus-BrxL7usr.js +0 -39
- package/dist/cjs/withComponentStyle-C6KHnZHt.js +0 -128
- package/dist/cjs/withDataset-ZdN-RRTx.js +0 -146
- package/dist/cjs/withStyled-Bf-stJTR.js +0 -567
- package/dist/cjs/withTranslation-Cz0M5maV.js +0 -77
- package/dist/collection/components/bn-map/bn-map.css +0 -4
- package/dist/collection/components/bn-map/bn-map.js +0 -725
- package/dist/collection/components/bn-map/ibcs-map/assets/gpx/Chasing_Legends.gpx +0 -195076
- package/dist/collection/components/bn-map/ibcs-map/assets/gpx/Fahrt_am_Nachmittag.gpx +0 -142007
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-finish.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-shadow.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-start.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/marker-example.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-end.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-start.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-wpt.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-shadow.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/ibcs-map.css +0 -674
- package/dist/collection/components/bn-map/ibcs-map/ibcs-map.js +0 -744
- package/dist/collection/components/bn-map/ibcs-map/utils/model/GeoJsonLayer.js +0 -9
- package/dist/collection/components/bn-map/ibcs-map/utils/model/GpxLayer.js +0 -13
- package/dist/collection/components/bn-map/ibcs-map/utils/model/Marker.js +0 -11
- package/dist/collection/components/bn-map/ibcs-map/utils/model/index.js +0 -2
- package/dist/collection/test-runner/test-runner-card.js +0 -36
- package/dist/collection/test-runner/test-runner-chart-time.js +0 -234
- package/dist/collection/test-runner/test-runner-chart.js +0 -364
- package/dist/collection/test-runner/test-runner-map.js +0 -1901
- package/dist/collection/test-runner/test-runner-table.js +0 -469
- package/dist/collection/test-runner/test-runner-time.js +0 -399
- package/dist/collection/test-runner/test-runner-title.js +0 -108
- package/dist/components/bn-map.d.ts +0 -11
- package/dist/components/bn-map.js +0 -1
- package/dist/components/componentRegister.js +0 -1
- package/dist/components/ibcs-map.d.ts +0 -11
- package/dist/components/ibcs-map.js +0 -1
- package/dist/components/ibcs-map2.js +0 -1
- package/dist/components/test-runner-card.d.ts +0 -11
- package/dist/components/test-runner-card.js +0 -1
- package/dist/components/test-runner-chart-time.d.ts +0 -11
- package/dist/components/test-runner-chart-time.js +0 -1
- package/dist/components/test-runner-chart.d.ts +0 -11
- package/dist/components/test-runner-chart.js +0 -1
- package/dist/components/test-runner-map.d.ts +0 -11
- package/dist/components/test-runner-map.js +0 -1
- package/dist/components/test-runner-table.d.ts +0 -11
- package/dist/components/test-runner-table.js +0 -1
- package/dist/components/test-runner-time.js +0 -1
- package/dist/components/test-runner-title.d.ts +0 -11
- package/dist/components/test-runner-title.js +0 -1
- package/dist/components/withDataset.js +0 -1
- package/dist/esm/DataFormatDigits-Dt6gpIiZ.js +0 -137
- package/dist/esm/DateStringFactory-_Qiv0IvF.js +0 -451
- package/dist/esm/Order-B4fpLe_f.js +0 -125
- package/dist/esm/SVGVariancesStyleGroup-DlWgvpzs.js +0 -7961
- package/dist/esm/StringAdapter-BLvo1Krl.js +0 -133
- package/dist/esm/_commonjsHelpers-BFTU3MAI.js +0 -7
- package/dist/esm/alasql.min-CWu4NkIt.js +0 -304
- package/dist/esm/bn-asset.entry.js +0 -40
- package/dist/esm/bn-body_3.entry.js +0 -409
- package/dist/esm/bn-card.entry.js +0 -35
- package/dist/esm/bn-chart-structure.entry.js +0 -703
- package/dist/esm/bn-chart-time.entry.js +0 -985
- package/dist/esm/bn-component-style.entry.js +0 -42
- package/dist/esm/bn-context_5.entry.js +0 -3374
- package/dist/esm/bn-dataset.entry.js +0 -276
- package/dist/esm/bn-layout-card.entry.js +0 -126
- package/dist/esm/bn-layout-page.entry.js +0 -140
- package/dist/esm/bn-map.entry.js +0 -423
- package/dist/esm/bn-message.entry.js +0 -50
- package/dist/esm/componentRegister-BtVfu16B.js +0 -72
- package/dist/esm/constants-kMyLevYy.js +0 -158
- package/dist/esm/formatter-DTMEZ6d8.js +0 -211
- package/dist/esm/ibcs-chart-structure.entry.js +0 -2904
- package/dist/esm/ibcs-chart-time.entry.js +0 -4138
- package/dist/esm/ibcs-map.entry.js +0 -1073
- package/dist/esm/ibcs-title.entry.js +0 -350
- package/dist/esm/scaling-BBd0ZVLL.js +0 -64
- package/dist/esm/test-runner-card.entry.js +0 -25
- package/dist/esm/test-runner-chart-time.entry.js +0 -228
- package/dist/esm/test-runner-chart.entry.js +0 -324
- package/dist/esm/test-runner-map.entry.js +0 -1860
- package/dist/esm/test-runner-table.entry.js +0 -475
- package/dist/esm/test-runner-time.entry.js +0 -379
- package/dist/esm/test-runner-title.entry.js +0 -113
- package/dist/esm/withComponentStatus-elELReKt.js +0 -37
- package/dist/esm/withComponentStyle-NaxfakAG.js +0 -126
- package/dist/esm/withDataset-BT2VQCsG.js +0 -144
- package/dist/esm/withStyled-CpUTv74m.js +0 -539
- package/dist/esm/withTranslation-Do4GhleK.js +0 -75
- package/dist/types/components/bn-map/bn-map.d.ts +0 -122
- package/dist/types/components/bn-map/ibcs-map/ibcs-map.d.ts +0 -73
- package/dist/types/components/bn-map/ibcs-map/utils/model/GeoJsonLayer.d.ts +0 -8
- package/dist/types/components/bn-map/ibcs-map/utils/model/GpxLayer.d.ts +0 -11
- package/dist/types/components/bn-map/ibcs-map/utils/model/Marker.d.ts +0 -9
- package/dist/types/components/bn-map/ibcs-map/utils/model/index.d.ts +0 -2
- package/dist/types/test-runner/test-runner-card.d.ts +0 -3
- package/dist/types/test-runner/test-runner-chart-time.d.ts +0 -3
- package/dist/types/test-runner/test-runner-chart.d.ts +0 -3
- package/dist/types/test-runner/test-runner-map.d.ts +0 -3
- package/dist/types/test-runner/test-runner-table.d.ts +0 -3
- package/dist/types/test-runner/test-runner-time.d.ts +0 -3
- package/dist/types/test-runner/test-runner-title.d.ts +0 -3
|
@@ -1,3374 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement } from './index-B27Ax6P_.js';
|
|
2
|
-
import { b as getOrCreateStores, g as getStores, a as globalLabelKeys } from './context-protocol-DzeqZxg6.js';
|
|
3
|
-
import { w as withComponentStatus } from './withComponentStatus-elELReKt.js';
|
|
4
|
-
import { w as withHasError } from './withHasError-C48fTE2k.js';
|
|
5
|
-
import { w as withBodyObserver } from './withBodyObserver-gZpZiEIK.js';
|
|
6
|
-
import { j as isBlankInput, w as withStyled, v as validateScenarioList, a as validateVariancesList, i as isValidNumber, s as isValidDataFormat, f as isValidBoolean, t as isValidTableType, e as isValidInteger, u as validateThereOfJsonStr, x as validatePartOfJsonStr, c as validateOrderList, d as isValidDirection, y as isValidMeasureType, g as isValidMeasureScale, z as isTableCategoryWidth, A as validateColumnThereOfJsonStr } from './withStyled-CpUTv74m.js';
|
|
7
|
-
import { w as withComponentStyle } from './withComponentStyle-NaxfakAG.js';
|
|
8
|
-
import { w as withDataset } from './withDataset-BT2VQCsG.js';
|
|
9
|
-
import { w as withTranslation } from './withTranslation-Do4GhleK.js';
|
|
10
|
-
import { g as getParentDimensions, p as parseScaling } from './scaling-BBd0ZVLL.js';
|
|
11
|
-
import { D as DataFormat, I as I18nMode, a as TableCategoryWidth, M as MeasureType } from './constants-kMyLevYy.js';
|
|
12
|
-
import { O as OrderDirection$1, a as OrderColumn, C as CompareUtil, A as AdapterUtils, b as OrderAdapter } from './Order-B4fpLe_f.js';
|
|
13
|
-
import { F as Formatter, Q as QueryColumnNames, V as VarianceScenario } from './formatter-DTMEZ6d8.js';
|
|
14
|
-
import { a as alasql } from './alasql.min-CWu4NkIt.js';
|
|
15
|
-
import { I as IBCSRuleSet, S as StringAdapter } from './StringAdapter-BLvo1Krl.js';
|
|
16
|
-
import { D as DataAnalyzer, S as SiPrefix, a as DataFormatDigits, b as DataFormatDigitsAdapter } from './DataFormatDigits-Dt6gpIiZ.js';
|
|
17
|
-
import './componentRegister-BtVfu16B.js';
|
|
18
|
-
import './DateStringFactory-_Qiv0IvF.js';
|
|
19
|
-
import './luxon-DbyXf6dF.js';
|
|
20
|
-
import './_commonjsHelpers-BFTU3MAI.js';
|
|
21
|
-
|
|
22
|
-
const bnContextCss = () => `:host{display:block}`;
|
|
23
|
-
|
|
24
|
-
const Context = class {
|
|
25
|
-
constructor(hostRef) {
|
|
26
|
-
registerInstance(this, hostRef);
|
|
27
|
-
this.currentPageUpdate = undefined;
|
|
28
|
-
withComponentStatus(this);
|
|
29
|
-
this.errors = withHasError(this);
|
|
30
|
-
}
|
|
31
|
-
setLocale(newValue) {
|
|
32
|
-
this.stores.context.state.locale = newValue;
|
|
33
|
-
}
|
|
34
|
-
connectedCallback() {
|
|
35
|
-
// Retrieve (or create) the stores for this context element.
|
|
36
|
-
// A descendant component may have already triggered creation via
|
|
37
|
-
// getStores() if Stencil initialized it before this component.
|
|
38
|
-
this.stores = getOrCreateStores(this.element);
|
|
39
|
-
if (this.locale) {
|
|
40
|
-
this.stores.context.state.locale = this.locale;
|
|
41
|
-
}
|
|
42
|
-
this.currentPageUpdate = setTimeout(() => {
|
|
43
|
-
this.element.querySelectorAll("bn-page, bn-layout-page").forEach((page, index) => {
|
|
44
|
-
if (page.localName === "bn-layout-page") {
|
|
45
|
-
page.setAttribute("page-number", (index + 1).toString());
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
const footer = page.querySelector("bn-footer");
|
|
49
|
-
if (footer) {
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
footer.setAttribute("page-number", (index + 1).toString());
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}, 250);
|
|
56
|
-
}
|
|
57
|
-
disconnectedCallback() {
|
|
58
|
-
if (this.currentPageUpdate) {
|
|
59
|
-
clearTimeout(this.currentPageUpdate);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
componentWillLoad() {
|
|
63
|
-
// stencil needs one componenet implementing all lifecycle steps to get mixing working
|
|
64
|
-
}
|
|
65
|
-
componentDidLoad() { }
|
|
66
|
-
componentShouldUpdate() { }
|
|
67
|
-
componentWillRender() { }
|
|
68
|
-
componentDidRender() { }
|
|
69
|
-
componentWillUpdate() { }
|
|
70
|
-
componentDidUpdate() { }
|
|
71
|
-
render() {
|
|
72
|
-
return (h(Host, { key: 'b92019b909e271225baca2cf740c8301e324164e' }, h("slot", { key: '87bac4bb29bca32d961afe31355dc1bd48fff0f8' })));
|
|
73
|
-
}
|
|
74
|
-
get element() { return getElement(this); }
|
|
75
|
-
static get watchers() { return {
|
|
76
|
-
"locale": [{
|
|
77
|
-
"setLocale": 0
|
|
78
|
-
}]
|
|
79
|
-
}; }
|
|
80
|
-
};
|
|
81
|
-
Context.style = bnContextCss();
|
|
82
|
-
|
|
83
|
-
const bnDatasourceCss = () => `bn-datasource{display:none}`;
|
|
84
|
-
|
|
85
|
-
const Datasource = class {
|
|
86
|
-
constructor(hostRef) {
|
|
87
|
-
registerInstance(this, hostRef);
|
|
88
|
-
withComponentStatus(this);
|
|
89
|
-
this.errors = withHasError(this);
|
|
90
|
-
withBodyObserver(this, (data) => {
|
|
91
|
-
if (!this.stores)
|
|
92
|
-
this.stores = getStores(this.element);
|
|
93
|
-
try {
|
|
94
|
-
const json = JSON.parse(data);
|
|
95
|
-
// @ts-ignore
|
|
96
|
-
this.stores.datasources.set(this.name, json);
|
|
97
|
-
}
|
|
98
|
-
catch (e) {
|
|
99
|
-
console.error("Error parsing datasource", e, data);
|
|
100
|
-
// @ts-ignore
|
|
101
|
-
this.stores.datasources.set(this.name, []);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
render() {
|
|
106
|
-
return h(Host, { key: 'e47e62c941bb7954cabe331cb500a7d2fdd7c487' });
|
|
107
|
-
}
|
|
108
|
-
get element() { return getElement(this); }
|
|
109
|
-
};
|
|
110
|
-
Datasource.style = bnDatasourceCss();
|
|
111
|
-
|
|
112
|
-
const bnPageCss = () => `: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);height:768px;width:1024px;display:flex;flex-direction:column;page-break-after:always;overflow:hidden}:host([format=xga]){height:768px;width:1024px}:host([format=xga][orientation=portrait]){height:1024px;width:768px}:host([format=xga][orientation=landscape]){height:768px;width:1024px}:host([format=hd]){height:720px;width:1280px}:host([format=hd][orientation=portrait]){height:1280px;width:720px}:host([format=hd][orientation=landscape]){height:720px;width:1280px}:host([format=full_hd]){height:1080px;width:1920px}:host([format=full_hd][orientation=portrait]){height:1920px;width:1080px}:host([format=full_hd][orientation=landscape]){height:1080px;width:1920px}:host([format="4k"]){height:2160px;width:3840px}:host([format="4k"][orientation=portrait]){height:3840px;width:2160px}:host([format="4k"][orientation=landscape]){height:2160px;width:3840px}:host([format="4k2k"]){height:2160px;width:4096px}:host([format="4k2k"][orientation=portrait]){height:4096px;width:2160px}:host([format="4k2k"][orientation=landscape]){height:2160px;width:4096px}:host([format=a6]){height:5.83in;width:4.13in}:host([format=a6][orientation=portrait]){height:5.83in;width:4.13in}:host([format=a6][orientation=landscape]){height:4.13in;width:5.83in}:host([format=a5]){height:8.27in;width:5.83in}:host([format=a5][orientation=portrait]){height:8.27in;width:5.83in}:host([format=a5][orientation=landscape]){height:5.83in;width:8.27in}:host([format=a4]){height:11.6in;width:8.17in}:host([format=a4][orientation=portrait]){height:11.6in;width:8.17in}:host([format=a4][orientation=landscape]){height:8.17in;width:11.6in}:host([format=a3]){height:16.54in;width:11.7in}:host([format=a3][orientation=portrait]){height:16.54in;width:11.7in}:host([format=a3][orientation=landscape]){height:11.7in;width:16.54in}:host([format=a2]){height:23.4in;width:16.54in}:host([format=a2][orientation=portrait]){height:23.4in;width:16.54in}:host([format=a2][orientation=landscape]){height:16.54in;width:23.4in}:host([format=a1]){height:33.1in;width:23.4in}:host([format=a1][orientation=portrait]){height:33.1in;width:23.4in}:host([format=a1][orientation=landscape]){height:23.4in;width:33.1in}:host([format=a0]){height:46.8in;width:33.1in}:host([format=a0][orientation=portrait]){height:46.8in;width:33.1in}:host([format=a0][orientation=landscape]){height:33.1in;width:46.8in}:host([format=letter]){height:11in;width:8.5in}:host([format=letter][orientation=portrait]){height:11in;width:8.5in}:host([format=letter][orientation=landscape]){height:8.5in;width:11in}:host([format=legal]){height:14in;width:8.5in}:host([format=legal][orientation=portrait]){height:14in;width:8.5in}:host([format=legal][orientation=landscape]){height:8.5in;width:14in}:host([format=tabloid]){height:17in;width:11in}:host([format=tabloid][orientation=portrait]){height:17in;width:11in}:host([format=tabloid][orientation=landscape]){height:11in;width:17in}:host([format=ledger]){height:11in;width:17in}:host([format=ledger][orientation=portrait]){height:17in;width:11in}:host([format=ledger][orientation=landscape]){height:11in;width:17in}`;
|
|
113
|
-
|
|
114
|
-
const VALID_FORMATS = ["xga", "hd", "full-hd", "4k", "4k2k", "a4", "a3", "a2", "a1", "a0", "letter", "legal"];
|
|
115
|
-
const VALID_ORIENTATIONS = ["landscape", "portrait"];
|
|
116
|
-
const Page = class {
|
|
117
|
-
constructor(hostRef) {
|
|
118
|
-
registerInstance(this, hostRef);
|
|
119
|
-
withComponentStatus(this);
|
|
120
|
-
this.errors = withHasError(this);
|
|
121
|
-
this.componentStyle = withComponentStyle(this);
|
|
122
|
-
}
|
|
123
|
-
validateFormat(newValue) {
|
|
124
|
-
const errId = "ERR_format";
|
|
125
|
-
if (!isBlankInput(newValue) && !VALID_FORMATS.includes(newValue)) {
|
|
126
|
-
this.errors.addOrReplace({
|
|
127
|
-
id: errId,
|
|
128
|
-
type: "warning",
|
|
129
|
-
message: `format: invalid value '${newValue}' is not supported. Valid values: ${VALID_FORMATS.join(", ")}`,
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
this.errors.remove(errId);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
validateOrientation(newValue) {
|
|
137
|
-
const errId = "ERR_orientation";
|
|
138
|
-
if (!isBlankInput(newValue) && !VALID_ORIENTATIONS.includes(newValue)) {
|
|
139
|
-
this.errors.addOrReplace({
|
|
140
|
-
id: errId,
|
|
141
|
-
type: "warning",
|
|
142
|
-
message: `orientation: invalid value '${newValue}' is not supported. Valid values: ${VALID_ORIENTATIONS.join(", ")}`,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
this.errors.remove(errId);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
render() {
|
|
150
|
-
return (h(Host, { key: '7623fe9a67534d467f10d7ad25afb201e895110f', format: this.format, orientation: this.orientation, style: this.prepareStyle() }, h("slot", { key: '8a2e3cce4449d2ce5ce898aff45ca8b4b903ab6c' })));
|
|
151
|
-
}
|
|
152
|
-
prepareStyle() {
|
|
153
|
-
const pageStyle = {
|
|
154
|
-
"font-family": this.componentStyle(($) => $.global["fontFamily"]),
|
|
155
|
-
"font-size": `${this.componentStyle(($) => $.global["fontSizePx"])}px`,
|
|
156
|
-
"--bn-font-family": this.componentStyle(($) => $.global["fontFamily"]) || "'Noto Sans', sans-serif",
|
|
157
|
-
"--bn-font-size": `${this.componentStyle(($) => $.global["fontSizePx"]) || 13.3333}px`,
|
|
158
|
-
"--bn-font-color": this.componentStyle(($) => $.global["fontColor"]) || "#000000",
|
|
159
|
-
"--bn-font-background": this.componentStyle(($) => $.global["fontBackgroundColor"]) || "#ffffff",
|
|
160
|
-
};
|
|
161
|
-
return pageStyle;
|
|
162
|
-
}
|
|
163
|
-
get element() { return getElement(this); }
|
|
164
|
-
static get watchers() { return {
|
|
165
|
-
"format": [{
|
|
166
|
-
"validateFormat": 0
|
|
167
|
-
}],
|
|
168
|
-
"orientation": [{
|
|
169
|
-
"validateOrientation": 0
|
|
170
|
-
}]
|
|
171
|
-
}; }
|
|
172
|
-
};
|
|
173
|
-
Page.style = bnPageCss();
|
|
174
|
-
|
|
175
|
-
/** Sentinel value indicating all groups should be included. */
|
|
176
|
-
var GroupSelection;
|
|
177
|
-
(function (GroupSelection) {
|
|
178
|
-
GroupSelection[GroupSelection["ALL"] = -1] = "ALL";
|
|
179
|
-
})(GroupSelection || (GroupSelection = {}));
|
|
180
|
-
/**
|
|
181
|
-
* Tracks whether a factory's output is current or needs recalculation.
|
|
182
|
-
* Used to avoid redundant re-rendering when underlying data has not changed.
|
|
183
|
-
*/
|
|
184
|
-
var FactoryState;
|
|
185
|
-
(function (FactoryState) {
|
|
186
|
-
/** Output matches the current input data. */
|
|
187
|
-
FactoryState[FactoryState["UP_TO_DATE"] = 0] = "UP_TO_DATE";
|
|
188
|
-
/** Input data has changed; output needs to be regenerated. */
|
|
189
|
-
FactoryState[FactoryState["DIRTY"] = 1] = "DIRTY";
|
|
190
|
-
})(FactoryState || (FactoryState = {}));
|
|
191
|
-
/**
|
|
192
|
-
* Table aggregation modes controlling how rows are grouped and totalled.
|
|
193
|
-
*
|
|
194
|
-
* - `LIST` -- Flat list with no aggregation.
|
|
195
|
-
* - `SUM` -- Grouped rows with sum totals per group and a grand total.
|
|
196
|
-
* - `SUMNOTOTAL` -- Grouped rows with group sums but no grand total row.
|
|
197
|
-
* - `OPT` -- Operation-aware aggregation (respects the +/- operation field).
|
|
198
|
-
* - `OPTNOTOTAL` -- Operation-aware aggregation without a grand total row.
|
|
199
|
-
*/
|
|
200
|
-
var TableType;
|
|
201
|
-
(function (TableType) {
|
|
202
|
-
TableType["LIST"] = "list";
|
|
203
|
-
TableType["SUM"] = "sum";
|
|
204
|
-
TableType["SUMNOTOTAL"] = "sumnototal";
|
|
205
|
-
TableType["OPT"] = "opt";
|
|
206
|
-
TableType["OPTNOTOTAL"] = "optnototal";
|
|
207
|
-
})(TableType || (TableType = {}));
|
|
208
|
-
var OrderDirection;
|
|
209
|
-
(function (OrderDirection) {
|
|
210
|
-
OrderDirection["ASC"] = "asc";
|
|
211
|
-
OrderDirection["DESC"] = "desc";
|
|
212
|
-
})(OrderDirection || (OrderDirection = {}));
|
|
213
|
-
/**
|
|
214
|
-
* Discriminator for rendered table rows, controlling visual styling and behavior.
|
|
215
|
-
*
|
|
216
|
-
* - `HEADER` -- Column header row.
|
|
217
|
-
* - `GROUPHEAD` -- Group title row (rendered when `grouped` is true).
|
|
218
|
-
* - `SEPERATORLINE` -- Visual divider between groups.
|
|
219
|
-
* - `SUM` -- Grand total row.
|
|
220
|
-
* - `GROUPSUM` -- Sub-total row for a single group.
|
|
221
|
-
* - `DRILLELEMENT` -- "Thereof" drill-down sub-row.
|
|
222
|
-
* - `STANDARD` -- Normal data row.
|
|
223
|
-
* - `PARTELEMENT` -- "Part of" percentage row.
|
|
224
|
-
* - `ENTRY` -- Generic entry row.
|
|
225
|
-
*/
|
|
226
|
-
var TableRowType;
|
|
227
|
-
(function (TableRowType) {
|
|
228
|
-
TableRowType["HEADER"] = "HEADER";
|
|
229
|
-
TableRowType["GROUPHEAD"] = "GROUPHEAD";
|
|
230
|
-
TableRowType["SEPERATORLINE"] = "SEPERATORLINE";
|
|
231
|
-
TableRowType["SUM"] = "SUM";
|
|
232
|
-
TableRowType["GROUPSUM"] = "GROUP_SUM";
|
|
233
|
-
TableRowType["DRILLELEMENT"] = "DRILLELEMENT";
|
|
234
|
-
TableRowType["STANDARD"] = "STANDARD";
|
|
235
|
-
TableRowType["PARTELEMENT"] = "PARTELEMENT";
|
|
236
|
-
TableRowType["ENTRY"] = "ENTRY";
|
|
237
|
-
})(TableRowType || (TableRowType = {}));
|
|
238
|
-
|
|
239
|
-
const bnTableCss = () => `:host{display:inline-block;position:relative;overflow:hidden}`;
|
|
240
|
-
|
|
241
|
-
const Table$1 = class Table {
|
|
242
|
-
validateScaling(newValue) {
|
|
243
|
-
if (newValue == null || newValue === "" || newValue === "none" || newValue === "auto") {
|
|
244
|
-
this.errors.remove("ERR_scale");
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
const num = Number(newValue);
|
|
248
|
-
if (isNaN(num) || num <= 0) {
|
|
249
|
-
this.errors.addOrReplace({
|
|
250
|
-
id: "ERR_scale",
|
|
251
|
-
type: "warning",
|
|
252
|
-
message: `Invalid scale value: "${newValue}". Use "none", "auto", or a positive number.`,
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
this.errors.remove("ERR_scale");
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
constructor(hostRef) {
|
|
260
|
-
registerInstance(this, hostRef);
|
|
261
|
-
this.data = [];
|
|
262
|
-
this.datasetMeta = null;
|
|
263
|
-
this.appliedScaleFactor = 1;
|
|
264
|
-
/**
|
|
265
|
-
* A not mundane tile which should describes the shown data.
|
|
266
|
-
*/
|
|
267
|
-
this.tableTitle = "";
|
|
268
|
-
/**
|
|
269
|
-
* AlaSQL WHERE clause fragment injected into the data query to filter
|
|
270
|
-
* rows before rendering (e.g. `"category = 'Sales'"`).
|
|
271
|
-
*/
|
|
272
|
-
this.filter = "";
|
|
273
|
-
/**
|
|
274
|
-
* measureUnit displayed in table.
|
|
275
|
-
*/
|
|
276
|
-
this.measureUnit = "";
|
|
277
|
-
/**
|
|
278
|
-
* Scaling for absolute variance bar charts (ΔPY).
|
|
279
|
-
* <br /><br />
|
|
280
|
-
* Name of the 'scaling-group' which the table uses.
|
|
281
|
-
* Scaling groups are maintained globally.
|
|
282
|
-
* <br /><br />
|
|
283
|
-
* Alternatively a number which represents pixels per unit of measure.
|
|
284
|
-
* <br /><br />
|
|
285
|
-
* Example: 0.01 means 1000 units = 10 pixels width.
|
|
286
|
-
* <br /><br />
|
|
287
|
-
* Default: 0.01
|
|
288
|
-
*/
|
|
289
|
-
this.unitScaling = 0.01;
|
|
290
|
-
/**
|
|
291
|
-
* Scaling for relative variance pin charts (ΔPY%).
|
|
292
|
-
* <br /><br />
|
|
293
|
-
* Name of the 'scaling-group' which the table uses.
|
|
294
|
-
* Scaling groups are maintained globally.
|
|
295
|
-
* <br /><br />
|
|
296
|
-
* Alternatively a number which represents pixels per percentage point.
|
|
297
|
-
* <br /><br />
|
|
298
|
-
* Example: 0.5 means 100% = 50 pixels width.
|
|
299
|
-
* <br /><br />
|
|
300
|
-
* Default: 0.5
|
|
301
|
-
*/
|
|
302
|
-
this.percentageScaling = 0.5;
|
|
303
|
-
// Global scaling groups map - can be populated externally for shared scaling across components
|
|
304
|
-
this.pixelPerUnitGroupMap = new Map();
|
|
305
|
-
/**
|
|
306
|
-
* Defines the data unit type of the tables data.
|
|
307
|
-
* <br /><br />
|
|
308
|
-
* If percent is chosen all data values are converted into percent
|
|
309
|
-
* (0.02 -> 2%)
|
|
310
|
-
* <br /><br />
|
|
311
|
-
* values: <br />
|
|
312
|
-
* ```percent // decimal```
|
|
313
|
-
*/
|
|
314
|
-
this.dataFormat = "decimal";
|
|
315
|
-
/**
|
|
316
|
-
* Toggles of data should be grouped by
|
|
317
|
-
* 'rowgroup'.
|
|
318
|
-
* <br /><br />
|
|
319
|
-
* values: <br />
|
|
320
|
-
* ```true // false```
|
|
321
|
-
*/
|
|
322
|
-
this.grouped = "false";
|
|
323
|
-
/**
|
|
324
|
-
* Toggles display of measure units in table header
|
|
325
|
-
* <br /><br />
|
|
326
|
-
* values: <br />
|
|
327
|
-
* ```true // false```
|
|
328
|
-
*/
|
|
329
|
-
this.showMeasureScale = "false";
|
|
330
|
-
/**
|
|
331
|
-
* Toggles a title header for each (row-)group
|
|
332
|
-
* the title header value is found set by 'rowgroup'
|
|
333
|
-
* <br /><br />
|
|
334
|
-
* values: <br />
|
|
335
|
-
* ```true // false```
|
|
336
|
-
*
|
|
337
|
-
*/
|
|
338
|
-
this.showGroupTitle = "true";
|
|
339
|
-
/**
|
|
340
|
-
* Set the table type
|
|
341
|
-
* <br /><br />
|
|
342
|
-
* values: <br />
|
|
343
|
-
* ```list // sum // opt // sumnototal // optnototal```
|
|
344
|
-
*
|
|
345
|
-
*/
|
|
346
|
-
this.type = "list";
|
|
347
|
-
/**
|
|
348
|
-
* Set the maximum number of rows for each
|
|
349
|
-
* group. The value 0 means *no limit*
|
|
350
|
-
* <br /><br />
|
|
351
|
-
* rows wich where cut by the limit are cumulated as REST
|
|
352
|
-
*
|
|
353
|
-
*/
|
|
354
|
-
this.limit = 0;
|
|
355
|
-
/**
|
|
356
|
-
* Stringified Array of drilldown Objects {
|
|
357
|
-
"rowGroup": string,<br />
|
|
358
|
-
"category": string,<br />
|
|
359
|
-
"subCategory": string,<br />
|
|
360
|
-
},<br /><br />
|
|
361
|
-
* rowgroup, categroy defines the location of the drill
|
|
362
|
-
* subcategory is the displayed label of the data row
|
|
363
|
-
*<br /><br />
|
|
364
|
-
* example:<br />
|
|
365
|
-
* ```[{
|
|
366
|
-
"rowGroup":"Umsatz",
|
|
367
|
-
"category": "Applications",
|
|
368
|
-
"subCategory": "Applications-A",
|
|
369
|
-
},]```
|
|
370
|
-
*/
|
|
371
|
-
this.thereof = "[]";
|
|
372
|
-
/**
|
|
373
|
-
* Stringified Array of Partof Objects <br />{<br />
|
|
374
|
-
"rowGroup": string,<br />
|
|
375
|
-
"category": string<br />
|
|
376
|
-
},<br /><br />
|
|
377
|
-
* rowgroup, categroy defines the location of the drill
|
|
378
|
-
* percentage of category in rowgorup
|
|
379
|
-
*<br /><br />
|
|
380
|
-
* example:<br />
|
|
381
|
-
* ```[{
|
|
382
|
-
"rowGroups":"Umsatz",
|
|
383
|
-
"category": "Applications",
|
|
384
|
-
},]```
|
|
385
|
-
*/
|
|
386
|
-
this.partof = "[]";
|
|
387
|
-
/** List of the primary scenarios on which the order direction are applied valid scenarios are
|
|
388
|
-
* If order is set to a scenario it has also exists in scenariolist
|
|
389
|
-
* <br /><br />
|
|
390
|
-
* values: <br />
|
|
391
|
-
* ```category // categoryindex // rowgroup // rowgroup // rowgroupindex // ac[1-4] // fc[1-4] // pp[1-4] // pl[1-4] // auto```
|
|
392
|
-
* <br /><br />
|
|
393
|
-
* When set to ```auto```, order is detected from the dataset silently.
|
|
394
|
-
*/
|
|
395
|
-
this.order = "category";
|
|
396
|
-
/** Set sorting order direction
|
|
397
|
-
* <br /><br />
|
|
398
|
-
* values: <br />
|
|
399
|
-
* ```asc // desc```
|
|
400
|
-
*/
|
|
401
|
-
this.orderDirection = "asc";
|
|
402
|
-
/** Sets the Measure Type of the Table
|
|
403
|
-
* volume is different displayed and interpreted as currency
|
|
404
|
-
* names of siprefix are adapted.
|
|
405
|
-
* <br /><br />
|
|
406
|
-
* values: <br />
|
|
407
|
-
* ```volume // currency```
|
|
408
|
-
|
|
409
|
-
*/
|
|
410
|
-
this.measureType = "volume";
|
|
411
|
-
/**
|
|
412
|
-
* Sets the SiPrefix of the Mesaurements and converts the
|
|
413
|
-
* original value.
|
|
414
|
-
* <br /><br />
|
|
415
|
-
* values: <br />
|
|
416
|
-
* ```_ // k // M // G // T // P // E // Z // Y // m // μ // n // p // P // f // a // z // y // GREATEST // LEAST```
|
|
417
|
-
* <br /><br />
|
|
418
|
-
* SiPrefix overview:
|
|
419
|
-
* ``` "Y": 1E+24,```<br />
|
|
420
|
-
* ``` "Z": 1E+21,```<br />
|
|
421
|
-
* ``` "E": 1E+18,```<br />
|
|
422
|
-
* ``` "P": 1E+15,```<br />
|
|
423
|
-
* ``` "T": 1E+12,```<br />
|
|
424
|
-
* ``` "G": 1000000000,```<br />
|
|
425
|
-
* ``` "M": 1000000,```<br />
|
|
426
|
-
* ``` "k": 1000,```<br />
|
|
427
|
-
* <br />
|
|
428
|
-
* ``` "m": 0.001,```<br />
|
|
429
|
-
* ``` "μ": 0.000001,```<br />
|
|
430
|
-
* ``` "n": 0.000000001,```<br />
|
|
431
|
-
* ``` "p": 0.000000000001,```<br />
|
|
432
|
-
* ``` "f": 0.000000000000001,```<br />
|
|
433
|
-
* ``` "a": 0.000000000000000001,```<br />
|
|
434
|
-
* ``` "z": 0.000000000000000000001,```<br />
|
|
435
|
-
* ``` "y": 0.000000000000000000000001,```<br />
|
|
436
|
-
* <br /><br />
|
|
437
|
-
* Special modes:
|
|
438
|
-
* ```GREATEST``` seaches for the bigest (farest to zero) Value in the dataset and sets this value to SiPrefix<br />
|
|
439
|
-
* ```LEAST``` searches for smallest (closest to zero) Value in the dataset and sets this value to SiPrefix<br />
|
|
440
|
-
*<br /><br />
|
|
441
|
-
* ```_``` is the value for no SiPrefix the value is displayed as in the dataset stored.
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
*/
|
|
445
|
-
this.measureScale = "greatest";
|
|
446
|
-
/**
|
|
447
|
-
* Number of decimal digits in a table cell
|
|
448
|
-
*/
|
|
449
|
-
this.dataFormatDigitsDecimal = 1;
|
|
450
|
-
/**
|
|
451
|
-
* Number of percent digits in a table cell
|
|
452
|
-
*/
|
|
453
|
-
this.dataFormatDigitsPercent = 2;
|
|
454
|
-
/**
|
|
455
|
-
* Set width of category column. <br />
|
|
456
|
-
* If INF is selected the columns scaling to the min space they need
|
|
457
|
-
* seperatly.
|
|
458
|
-
* <br /><br />
|
|
459
|
-
* values:<br />
|
|
460
|
-
* ``` w5 // w10 // w15 // w20 // w25 // w50 // inf ```
|
|
461
|
-
*/
|
|
462
|
-
this.categoryWidth = "w15";
|
|
463
|
-
/**
|
|
464
|
-
* Defines which drill-column is displayed. <br />
|
|
465
|
-
* <br /><br />
|
|
466
|
-
* ```scenario``` the scenaro to drill <br/>
|
|
467
|
-
* ```group``` is a list of child columns of the parent <br/><br/>
|
|
468
|
-
* ```subGroups``` is a list of child columns of the parent <br/><br/>
|
|
469
|
-
* example:<br />
|
|
470
|
-
* ```[{"scenario": "ac1", "name": "DE", "subGroups": ["Berlin"]},
|
|
471
|
-
* {"scenario": "ac2", "name": "UK", "subGroups": []}],
|
|
472
|
-
* ```
|
|
473
|
-
*/
|
|
474
|
-
this.columnthereof = null;
|
|
475
|
-
this._autoScaleGuard = false;
|
|
476
|
-
withStyled(this);
|
|
477
|
-
withComponentStatus(this);
|
|
478
|
-
this.errors = withHasError(this);
|
|
479
|
-
this.componentStyle = withComponentStyle(this);
|
|
480
|
-
withDataset(this, (_name, data) => {
|
|
481
|
-
this.data = (data || []);
|
|
482
|
-
}, (_name, meta) => {
|
|
483
|
-
this.datasetMeta = meta;
|
|
484
|
-
});
|
|
485
|
-
this.t = withTranslation(this).t;
|
|
486
|
-
}
|
|
487
|
-
validateScenario(newValue) {
|
|
488
|
-
const errId = "ERR_scenarios";
|
|
489
|
-
const invalidScenarios = validateScenarioList(newValue);
|
|
490
|
-
if (invalidScenarios.length > 0) {
|
|
491
|
-
this.errors.addOrReplace({
|
|
492
|
-
id: errId,
|
|
493
|
-
type: "warning",
|
|
494
|
-
message: "scenarios: invalid value(s) '" + (invalidScenarios === null || invalidScenarios === void 0 ? void 0 : invalidScenarios.toString()) + "' are not supported.",
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
else {
|
|
498
|
-
this.errors.remove(errId);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
validateVariances(newValue) {
|
|
502
|
-
const errId = "ERR_variances";
|
|
503
|
-
const invalidVariances = validateVariancesList(newValue);
|
|
504
|
-
if (invalidVariances.length > 0) {
|
|
505
|
-
this.errors.addOrReplace({
|
|
506
|
-
id: errId,
|
|
507
|
-
type: "warning",
|
|
508
|
-
message: "variances: invalid value(s) '" + JSON.stringify(invalidVariances) + "' are not supported.",
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
else {
|
|
512
|
-
this.errors.remove(errId);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
validateBarColumns(newValue) {
|
|
516
|
-
const errId = "ERR_barColumns";
|
|
517
|
-
if (isBlankInput(newValue)) {
|
|
518
|
-
this.errors.remove(errId);
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
const invalidColumns = validateVariancesList(newValue);
|
|
522
|
-
if (invalidColumns.length > 0) {
|
|
523
|
-
this.errors.addOrReplace({
|
|
524
|
-
id: errId,
|
|
525
|
-
type: "warning",
|
|
526
|
-
message: "barColumns: invalid value(s) '" + JSON.stringify(invalidColumns) + "' are not supported.",
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
else {
|
|
530
|
-
this.errors.remove(errId);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
validateUnitScaling(newValue) {
|
|
534
|
-
const errId = "ERR_unitScaling";
|
|
535
|
-
if (!isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
536
|
-
this.errors.addOrReplace({
|
|
537
|
-
id: errId,
|
|
538
|
-
type: "warning",
|
|
539
|
-
message: "unitScaling: invalid value '" + newValue + "' is not supported.",
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
else {
|
|
543
|
-
this.errors.remove(errId);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
validatePercentageScaling(newValue) {
|
|
547
|
-
const errId = "ERR_percentageScaling";
|
|
548
|
-
if (!isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
549
|
-
this.errors.addOrReplace({
|
|
550
|
-
id: errId,
|
|
551
|
-
type: "warning",
|
|
552
|
-
message: "percentageScaling: invalid value '" + newValue + "' is not supported.",
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
else {
|
|
556
|
-
this.errors.remove(errId);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
validateDataFormat(newValue) {
|
|
560
|
-
const errId = "ERR_dataFormat";
|
|
561
|
-
if (!isValidDataFormat(newValue)) {
|
|
562
|
-
this.errors.addOrReplace({
|
|
563
|
-
id: errId,
|
|
564
|
-
type: "warning",
|
|
565
|
-
message: "dataFormat: invalid value(s) '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' are not supported.",
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
else {
|
|
569
|
-
this.errors.remove(errId);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
validateGrouped(newValue) {
|
|
573
|
-
const errId = "ERR_grouped";
|
|
574
|
-
if (!isValidBoolean(newValue)) {
|
|
575
|
-
this.errors.addOrReplace({
|
|
576
|
-
id: errId,
|
|
577
|
-
type: "warning",
|
|
578
|
-
message: "grouped: invalid value(s) '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' are not supported.",
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
else {
|
|
582
|
-
this.errors.remove(errId);
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
validateShowMeasureScale(newValue) {
|
|
586
|
-
const errId = "ERR_grouped";
|
|
587
|
-
if (!isValidBoolean(newValue)) {
|
|
588
|
-
this.errors.addOrReplace({
|
|
589
|
-
id: errId,
|
|
590
|
-
type: "warning",
|
|
591
|
-
message: "showMeasureScale: invalid value(s) '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' are not supported.",
|
|
592
|
-
});
|
|
593
|
-
}
|
|
594
|
-
else {
|
|
595
|
-
this.errors.remove(errId);
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
validateShowGroupTitle(newValue) {
|
|
599
|
-
const errId = "ERR_showGroupTitle";
|
|
600
|
-
if (!isValidBoolean(newValue)) {
|
|
601
|
-
this.errors.addOrReplace({
|
|
602
|
-
id: errId,
|
|
603
|
-
type: "warning",
|
|
604
|
-
message: "showGroupTitle: invalid value(s) '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' are not supported.",
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
else {
|
|
608
|
-
this.errors.remove(errId);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
validateType(newValue) {
|
|
612
|
-
const errId = "ERR_type";
|
|
613
|
-
if (!isValidTableType(newValue)) {
|
|
614
|
-
this.errors.addOrReplace({
|
|
615
|
-
id: errId,
|
|
616
|
-
type: "warning",
|
|
617
|
-
message: "type: invalid value(s) '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' are not supported.",
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
else {
|
|
621
|
-
this.errors.remove(errId);
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
validateLimit(newValue) {
|
|
625
|
-
const errId = "ERR_limit";
|
|
626
|
-
if (!isValidInteger(newValue)) {
|
|
627
|
-
this.errors.addOrReplace({
|
|
628
|
-
id: errId,
|
|
629
|
-
type: "warning",
|
|
630
|
-
message: "order: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
else {
|
|
634
|
-
this.errors.remove(errId);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
validateThereOf(newValue) {
|
|
638
|
-
const errId = "ERR_thereof";
|
|
639
|
-
const invalidElements = validateThereOfJsonStr(newValue);
|
|
640
|
-
if (invalidElements.length > 0) {
|
|
641
|
-
this.errors.addOrReplace({
|
|
642
|
-
id: errId,
|
|
643
|
-
type: "warning",
|
|
644
|
-
message: "ThereOf: invalid value(s) '" + JSON.stringify(invalidElements) + "' are not supported.",
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
else {
|
|
648
|
-
this.errors.remove(errId);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
validatePartOf(newValue) {
|
|
652
|
-
const errId = "ERR_partof";
|
|
653
|
-
const invalidElements = validatePartOfJsonStr(newValue);
|
|
654
|
-
if (invalidElements.length > 0) {
|
|
655
|
-
this.errors.addOrReplace({
|
|
656
|
-
id: errId,
|
|
657
|
-
type: "warning",
|
|
658
|
-
message: "partof: invalid value(s) '" + JSON.stringify(invalidElements) + "' are not supported.",
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
else {
|
|
662
|
-
this.errors.remove(errId);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
validateOrderList(newValue) {
|
|
666
|
-
const errId = "ERR_order";
|
|
667
|
-
const invalidElements = validateOrderList(newValue);
|
|
668
|
-
if (invalidElements.length > 0) {
|
|
669
|
-
this.errors.addOrReplace({
|
|
670
|
-
id: errId,
|
|
671
|
-
type: "warning",
|
|
672
|
-
message: "order: invalid value(s) '" + JSON.stringify(invalidElements) + "' are not supported.",
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
else {
|
|
676
|
-
this.errors.remove(errId);
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
validateOrderDirection(newValue) {
|
|
680
|
-
const errId = "ERR_orderDirection";
|
|
681
|
-
if (!isValidDirection(newValue)) {
|
|
682
|
-
this.errors.addOrReplace({
|
|
683
|
-
id: errId,
|
|
684
|
-
type: "warning",
|
|
685
|
-
message: "orderDirection: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
else {
|
|
689
|
-
this.errors.remove(errId);
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
validateMeasureType(newValue) {
|
|
693
|
-
const errId = "ERR_measureType";
|
|
694
|
-
if (!isValidMeasureType(newValue)) {
|
|
695
|
-
this.errors.addOrReplace({
|
|
696
|
-
id: errId,
|
|
697
|
-
type: "warning",
|
|
698
|
-
message: "measureType: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
else {
|
|
702
|
-
this.errors.remove(errId);
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
validateMeasureScale(newValue) {
|
|
706
|
-
const errId = "ERR_measureScale";
|
|
707
|
-
if (!isValidMeasureScale(newValue)) {
|
|
708
|
-
this.errors.addOrReplace({
|
|
709
|
-
id: errId,
|
|
710
|
-
type: "warning",
|
|
711
|
-
message: "measureScale: invalid value '" + (newValue === null || newValue === void 0 ? void 0 : newValue.toString()) + "' is not supported.",
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
else {
|
|
715
|
-
this.errors.remove(errId);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
validateDataFormatDigitsDecimal(newValue) {
|
|
719
|
-
const errId = "ERR_dataFormatDigitsDecimal";
|
|
720
|
-
if (!isValidInteger(newValue)) {
|
|
721
|
-
this.errors.addOrReplace({
|
|
722
|
-
id: errId,
|
|
723
|
-
type: "warning",
|
|
724
|
-
message: "dataFormatDigitsDecimal: invalid value(s) '" + newValue + "' are not supported.",
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
else {
|
|
728
|
-
this.errors.remove(errId);
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
validateDateFormatDigitsPercent(newValue) {
|
|
732
|
-
const errId = "ERR_dataFormatDigitsPercent";
|
|
733
|
-
if (!isValidInteger(newValue)) {
|
|
734
|
-
this.errors.addOrReplace({
|
|
735
|
-
id: errId,
|
|
736
|
-
type: "warning",
|
|
737
|
-
message: "dataFormatDigitsPercent: invalid value(s) '" + newValue + "' are not supported.",
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
else {
|
|
741
|
-
this.errors.remove(errId);
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
validateCategoryWidth(newValue) {
|
|
745
|
-
const errId = "ERR_categoryWidth";
|
|
746
|
-
if (!isTableCategoryWidth(newValue)) {
|
|
747
|
-
this.errors.addOrReplace({
|
|
748
|
-
id: errId,
|
|
749
|
-
type: "warning",
|
|
750
|
-
message: "categoryWidth: invalid value(s) '" + newValue + "' are not supported.",
|
|
751
|
-
});
|
|
752
|
-
}
|
|
753
|
-
else {
|
|
754
|
-
this.errors.remove(errId);
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
validateColumnThereOf(newValue) {
|
|
758
|
-
const invalidElements = validateColumnThereOfJsonStr(newValue);
|
|
759
|
-
const errId = "ERR_categorythereof";
|
|
760
|
-
if (invalidElements.length > 0) {
|
|
761
|
-
this.errors.addOrReplace({
|
|
762
|
-
id: errId,
|
|
763
|
-
type: "warning",
|
|
764
|
-
message: "columnthereof: invalid value(s) '" + JSON.stringify(invalidElements) + "' are not supported.",
|
|
765
|
-
});
|
|
766
|
-
}
|
|
767
|
-
else {
|
|
768
|
-
this.errors.remove(errId);
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
componentWillLoad() {
|
|
772
|
-
//this.datasouce = get("test");
|
|
773
|
-
// this.unsubscribe = onChange("test", (value) => this.datasouce = value);
|
|
774
|
-
this.validateScenario(this.scenarios);
|
|
775
|
-
this.validateVariances(this.variances);
|
|
776
|
-
this.validateDataFormat(this.dataFormat);
|
|
777
|
-
this.validateGrouped(this.grouped);
|
|
778
|
-
this.validateShowGroupTitle(this.showGroupTitle);
|
|
779
|
-
this.validateType(this.type);
|
|
780
|
-
this.validateLimit(this.limit);
|
|
781
|
-
this.validateThereOf(this.thereof);
|
|
782
|
-
this.validatePartOf(this.partof);
|
|
783
|
-
this.validateOrderDirection(this.orderDirection);
|
|
784
|
-
this.validateOrderList(this.order);
|
|
785
|
-
this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal);
|
|
786
|
-
this.validateDateFormatDigitsPercent(this.dataFormatDigitsPercent);
|
|
787
|
-
this.validateCategoryWidth(this.categoryWidth);
|
|
788
|
-
this.validateMeasureType(this.measureType);
|
|
789
|
-
this.validateMeasureScale(this.measureScale);
|
|
790
|
-
this.validateColumnThereOf(this.columnthereof);
|
|
791
|
-
this.validateShowMeasureScale(this.showMeasureScale);
|
|
792
|
-
this.validateBarColumns(this.barColumns);
|
|
793
|
-
this.validateUnitScaling(this.unitScaling);
|
|
794
|
-
this.validatePercentageScaling(this.percentageScaling);
|
|
795
|
-
this.validateScaling(this.scale);
|
|
796
|
-
}
|
|
797
|
-
disconnectedCallback() {
|
|
798
|
-
this.unsubscribe();
|
|
799
|
-
}
|
|
800
|
-
componentDidRender() {
|
|
801
|
-
var _a, _b;
|
|
802
|
-
const { mode } = parseScaling(this.scale);
|
|
803
|
-
// Only auto-scale for 'auto' and 'empty' (blank) modes
|
|
804
|
-
if (mode !== "auto" && mode !== "empty") {
|
|
805
|
-
this._autoScaleGuard = false;
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
// Skip re-measurement after the state-triggered re-render
|
|
809
|
-
if (this._autoScaleGuard) {
|
|
810
|
-
this._autoScaleGuard = false;
|
|
811
|
-
return;
|
|
812
|
-
}
|
|
813
|
-
const host = this.element;
|
|
814
|
-
const { width: parentWidth } = getParentDimensions(host);
|
|
815
|
-
if (parentWidth <= 0)
|
|
816
|
-
return;
|
|
817
|
-
// Measure at base (unscaled) font size to get true content width.
|
|
818
|
-
// This avoids the oscillation where scaled-down content fits → reset
|
|
819
|
-
// to 1 → overflows → scale down → fits → …
|
|
820
|
-
const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
|
|
821
|
-
host.style.setProperty("--bn-font-size", `${baseFontSize}px`);
|
|
822
|
-
// Reading scrollWidth forces a synchronous reflow at base size
|
|
823
|
-
const div = (_a = host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("div");
|
|
824
|
-
const unscaledWidth = (_b = div === null || div === void 0 ? void 0 : div.scrollWidth) !== null && _b !== void 0 ? _b : host.scrollWidth;
|
|
825
|
-
if (unscaledWidth <= parentWidth + 1) {
|
|
826
|
-
// Content fits at base size — no scaling needed
|
|
827
|
-
this.errors.remove("AUTO_scale");
|
|
828
|
-
if (this.appliedScaleFactor !== 1) {
|
|
829
|
-
this._autoScaleGuard = true;
|
|
830
|
-
this.appliedScaleFactor = 1;
|
|
831
|
-
}
|
|
832
|
-
return;
|
|
833
|
-
}
|
|
834
|
-
// Subtract 1px to account for sub-pixel rounding after scaling,
|
|
835
|
-
// preventing the right edge from being clipped by overflow:hidden.
|
|
836
|
-
const computedFactor = (parentWidth - 1) / unscaledWidth;
|
|
837
|
-
// Apply immediately via CSS var for smooth visual (before state re-render)
|
|
838
|
-
host.style.setProperty("--bn-font-size", `${baseFontSize * computedFactor}px`);
|
|
839
|
-
if (mode === "empty") {
|
|
840
|
-
this.errors.addOrReplace({
|
|
841
|
-
id: "AUTO_scale",
|
|
842
|
-
type: "warning",
|
|
843
|
-
message: `Auto-scaled table by factor ${computedFactor.toFixed(3)}`,
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
|
-
else {
|
|
847
|
-
this.errors.remove("AUTO_scale");
|
|
848
|
-
}
|
|
849
|
-
// Update state so bar charts re-render at the new scale
|
|
850
|
-
if (Math.abs(computedFactor - this.appliedScaleFactor) > 0.001) {
|
|
851
|
-
this._autoScaleGuard = true;
|
|
852
|
-
this.appliedScaleFactor = computedFactor;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
prepareDataFormat() {
|
|
856
|
-
var _a;
|
|
857
|
-
return DataFormat[(_a = this.dataFormat) === null || _a === void 0 ? void 0 : _a.toUpperCase()];
|
|
858
|
-
}
|
|
859
|
-
prepareGrouped() {
|
|
860
|
-
return this.grouped === "true";
|
|
861
|
-
}
|
|
862
|
-
prepareShowGroupTitle() {
|
|
863
|
-
return this.showGroupTitle === "true";
|
|
864
|
-
}
|
|
865
|
-
prepareTableType() {
|
|
866
|
-
var _a;
|
|
867
|
-
return TableType[(_a = this.type) === null || _a === void 0 ? void 0 : _a.toUpperCase()];
|
|
868
|
-
}
|
|
869
|
-
prepareLimit() {
|
|
870
|
-
return Math.floor(Number(this.limit) || 0);
|
|
871
|
-
}
|
|
872
|
-
prepareThereOf() {
|
|
873
|
-
if (this.thereof == null || this.thereof.trim() === "") {
|
|
874
|
-
return [];
|
|
875
|
-
}
|
|
876
|
-
return JSON.parse(this.thereof);
|
|
877
|
-
}
|
|
878
|
-
preparePartOf() {
|
|
879
|
-
if (this.partof == null || this.partof.trim() === "") {
|
|
880
|
-
return [];
|
|
881
|
-
}
|
|
882
|
-
return JSON.parse(this.partof);
|
|
883
|
-
}
|
|
884
|
-
prepareOrder() {
|
|
885
|
-
var _a, _b, _c;
|
|
886
|
-
const isAuto = ((_a = this.order) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
887
|
-
let orderStr = this.order;
|
|
888
|
-
if (isAuto && ((_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.suggestedOrder)) {
|
|
889
|
-
orderStr = this.datasetMeta.suggestedOrder;
|
|
890
|
-
}
|
|
891
|
-
const tableOrder = {
|
|
892
|
-
hierarchy: orderStr.split(",").map((entry) => OrderColumn[entry === null || entry === void 0 ? void 0 : entry.toUpperCase()]),
|
|
893
|
-
direction: OrderDirection$1[(_c = this.orderDirection) === null || _c === void 0 ? void 0 : _c.toUpperCase()],
|
|
894
|
-
};
|
|
895
|
-
return tableOrder;
|
|
896
|
-
}
|
|
897
|
-
prepareI18nMode() {
|
|
898
|
-
return I18nMode.META;
|
|
899
|
-
}
|
|
900
|
-
prepareI18n() {
|
|
901
|
-
const i18nMetaLabelsLocal = ["in", "category", "operation", "there_of", "part_of", "SUM_TOTAL"];
|
|
902
|
-
const i18nMetaLabelsGlobal = globalLabelKeys;
|
|
903
|
-
// system
|
|
904
|
-
const i18nMapLocal = new Map(i18nMetaLabelsLocal.map((key) => [key, this.t(".".concat(key))]));
|
|
905
|
-
const i18nMapGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
|
|
906
|
-
return new Map([...i18nMapGlobal.entries(), ...i18nMapLocal.entries()]);
|
|
907
|
-
}
|
|
908
|
-
prepareDataFormatDigits() {
|
|
909
|
-
const formatDigits = {
|
|
910
|
-
percent: this.dataFormatDigitsPercent,
|
|
911
|
-
decimal: this.dataFormatDigitsDecimal,
|
|
912
|
-
};
|
|
913
|
-
return formatDigits;
|
|
914
|
-
}
|
|
915
|
-
prepareScenarios() {
|
|
916
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
917
|
-
const isAuto = ((_a = this.scenarios) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
918
|
-
if ((isBlankInput(this.scenarios) || isAuto) && isBlankInput(this.variances)) {
|
|
919
|
-
if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
920
|
-
if (!isAuto) {
|
|
921
|
-
this.errors.addOrReplace({
|
|
922
|
-
id: "AUTO_scenarios",
|
|
923
|
-
type: "warning",
|
|
924
|
-
message: `scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`,
|
|
925
|
-
});
|
|
926
|
-
}
|
|
927
|
-
else {
|
|
928
|
-
this.errors.remove("AUTO_scenarios");
|
|
929
|
-
}
|
|
930
|
-
return this.datasetMeta.availableScenarios;
|
|
931
|
-
}
|
|
932
|
-
return [];
|
|
933
|
-
}
|
|
934
|
-
let scenarios = [];
|
|
935
|
-
if (isAuto || isBlankInput(this.scenarios)) {
|
|
936
|
-
if (((_e = (_d = this.datasetMeta) === null || _d === void 0 ? void 0 : _d.availableScenarios) === null || _e === void 0 ? void 0 : _e.length) > 0) {
|
|
937
|
-
if (!isAuto) {
|
|
938
|
-
this.errors.addOrReplace({
|
|
939
|
-
id: "AUTO_scenarios",
|
|
940
|
-
type: "warning",
|
|
941
|
-
message: `scenarios: not set, auto-detected: ${this.datasetMeta.availableScenarios.join(",")}`,
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
else {
|
|
945
|
-
this.errors.remove("AUTO_scenarios");
|
|
946
|
-
}
|
|
947
|
-
scenarios = scenarios.concat(this.datasetMeta.availableScenarios);
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
else {
|
|
951
|
-
this.errors.remove("AUTO_scenarios");
|
|
952
|
-
scenarios = scenarios.concat((_f = this.scenarios) === null || _f === void 0 ? void 0 : _f.split(","));
|
|
953
|
-
}
|
|
954
|
-
if (((_g = this.variances) === null || _g === void 0 ? void 0 : _g.trim().length) > 0) {
|
|
955
|
-
scenarios = scenarios.concat((_h = this.variances) === null || _h === void 0 ? void 0 : _h.split(","));
|
|
956
|
-
}
|
|
957
|
-
return scenarios.map((entry) => entry.trim());
|
|
958
|
-
}
|
|
959
|
-
prepareCategoryWidth() {
|
|
960
|
-
var _a;
|
|
961
|
-
if (isBlankInput(this.categoryWidth)) {
|
|
962
|
-
return TableCategoryWidth.INF;
|
|
963
|
-
}
|
|
964
|
-
return TableCategoryWidth[(_a = this.categoryWidth) === null || _a === void 0 ? void 0 : _a.toUpperCase()];
|
|
965
|
-
}
|
|
966
|
-
prepareMeasureScale() {
|
|
967
|
-
if (isBlankInput(this.measureScale)) {
|
|
968
|
-
return "GREATEST";
|
|
969
|
-
}
|
|
970
|
-
if (["_", "k", "M", "G", "T", "P", "E", "Z", "Y", "m", "μ", "n", "p", "P", "f", "a", "z", "y"].includes(this.measureScale.trim())) {
|
|
971
|
-
return this.measureScale.trim();
|
|
972
|
-
}
|
|
973
|
-
if (this.measureScale.trim().toUpperCase() === "LEAST") {
|
|
974
|
-
return this.measureScale.trim();
|
|
975
|
-
}
|
|
976
|
-
return "GREATEST";
|
|
977
|
-
}
|
|
978
|
-
prepareMeasureType() {
|
|
979
|
-
var _a;
|
|
980
|
-
if (isBlankInput(this.measureType)) {
|
|
981
|
-
return MeasureType.VOLUME;
|
|
982
|
-
}
|
|
983
|
-
return MeasureType[(_a = this.measureType) === null || _a === void 0 ? void 0 : _a.toUpperCase()];
|
|
984
|
-
}
|
|
985
|
-
prepareColumnThereOf() {
|
|
986
|
-
if (this.columnthereof == null || this.columnthereof.trim() === "") {
|
|
987
|
-
return new Map();
|
|
988
|
-
}
|
|
989
|
-
const parsedString = JSON.parse(this.columnthereof);
|
|
990
|
-
const map = new Map();
|
|
991
|
-
for (const [_key, value] of Object.entries(parsedString)) {
|
|
992
|
-
if (map.has(value["scenario"]) === false) {
|
|
993
|
-
map.set(value["scenario"], []);
|
|
994
|
-
}
|
|
995
|
-
map.get(value["scenario"]).push(value);
|
|
996
|
-
}
|
|
997
|
-
return map;
|
|
998
|
-
}
|
|
999
|
-
prepareTableTitle() {
|
|
1000
|
-
if (this.tableTitle === "" || this.tableTitle == null) {
|
|
1001
|
-
return "SUM_TOTAL";
|
|
1002
|
-
}
|
|
1003
|
-
return this.tableTitle;
|
|
1004
|
-
}
|
|
1005
|
-
prepareShowMeasureScale() {
|
|
1006
|
-
return this.showMeasureScale === "true";
|
|
1007
|
-
}
|
|
1008
|
-
prepareMeasureUnit() {
|
|
1009
|
-
if (this.measureUnit === "" || this.measureUnit == null) {
|
|
1010
|
-
return "";
|
|
1011
|
-
}
|
|
1012
|
-
return this.measureUnit;
|
|
1013
|
-
}
|
|
1014
|
-
prepareFilter() {
|
|
1015
|
-
if (this.filter.length === 0) {
|
|
1016
|
-
return "";
|
|
1017
|
-
}
|
|
1018
|
-
return this.filter;
|
|
1019
|
-
}
|
|
1020
|
-
prepareBarColumns() {
|
|
1021
|
-
if (isBlankInput(this.barColumns)) {
|
|
1022
|
-
return [];
|
|
1023
|
-
}
|
|
1024
|
-
return this.barColumns.split(",").map((col) => col.trim());
|
|
1025
|
-
}
|
|
1026
|
-
prepareUnitScaling() {
|
|
1027
|
-
if (this.pixelPerUnitGroupMap.has(this.unitScaling)) {
|
|
1028
|
-
return this.pixelPerUnitGroupMap.get(this.unitScaling);
|
|
1029
|
-
}
|
|
1030
|
-
return Number(this.unitScaling);
|
|
1031
|
-
}
|
|
1032
|
-
preparePercentageScaling() {
|
|
1033
|
-
if (this.pixelPerUnitGroupMap.has(this.percentageScaling)) {
|
|
1034
|
-
return this.pixelPerUnitGroupMap.get(this.percentageScaling);
|
|
1035
|
-
}
|
|
1036
|
-
return Number(this.percentageScaling);
|
|
1037
|
-
}
|
|
1038
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1039
|
-
getDataStructure() {
|
|
1040
|
-
const dataSetStructure = {
|
|
1041
|
-
ITableDataRow: {
|
|
1042
|
-
setName: { type: "string", isOptional: false, description: "" },
|
|
1043
|
-
date: { type: "string", isOptional: false, description: "" },
|
|
1044
|
-
operation: { type: "string", isOptional: false, description: "" },
|
|
1045
|
-
rowGroup: { type: "string", isOptional: false, description: "" },
|
|
1046
|
-
rowGroupIndex: { type: "number", isOptional: false, description: "" },
|
|
1047
|
-
category: { type: "string", isOptional: false, description: "" },
|
|
1048
|
-
categoryIndex: { type: "number", isOptional: false, description: "" },
|
|
1049
|
-
subCategory: { type: "string", isOptional: false, description: "" },
|
|
1050
|
-
subCategoryIndex: { type: "number", isOptional: false, description: "" },
|
|
1051
|
-
columnGroup: { type: "string", isOptional: false, description: "" },
|
|
1052
|
-
columnGroupIndex: { type: "number", isOptional: false, description: "" },
|
|
1053
|
-
columnSubGroup: { type: "string", isOptional: false, description: "" },
|
|
1054
|
-
columnSubGroupIndex: { type: "number", isOptional: false, description: "" },
|
|
1055
|
-
ac1: { type: "number", isOptional: false, description: "" },
|
|
1056
|
-
ac2: { type: "number", isOptional: false, description: "" },
|
|
1057
|
-
ac3: { type: "number", isOptional: false, description: "" },
|
|
1058
|
-
ac4: { type: "number", isOptional: false, description: "" },
|
|
1059
|
-
pp1: { type: "number", isOptional: false, description: "" },
|
|
1060
|
-
pp2: { type: "number", isOptional: false, description: "" },
|
|
1061
|
-
pp3: { type: "number", isOptional: false, description: "" },
|
|
1062
|
-
pp4: { type: "number", isOptional: false, description: "" },
|
|
1063
|
-
fc1: { type: "number", isOptional: false, description: "" },
|
|
1064
|
-
fc2: { type: "number", isOptional: false, description: "" },
|
|
1065
|
-
fc3: { type: "number", isOptional: false, description: "" },
|
|
1066
|
-
fc4: { type: "number", isOptional: false, description: "" },
|
|
1067
|
-
pl1: { type: "number", isOptional: false, description: "" },
|
|
1068
|
-
pl2: { type: "number", isOptional: false, description: "" },
|
|
1069
|
-
pl3: { type: "number", isOptional: false, description: "" },
|
|
1070
|
-
pl4: { type: "number", isOptional: false, description: "" },
|
|
1071
|
-
},
|
|
1072
|
-
};
|
|
1073
|
-
return dataSetStructure;
|
|
1074
|
-
}
|
|
1075
|
-
getEffectiveScaleFactor() {
|
|
1076
|
-
const { mode, factor } = parseScaling(this.scale);
|
|
1077
|
-
if (mode === "factor")
|
|
1078
|
-
return factor;
|
|
1079
|
-
if (mode === "auto" || mode === "empty")
|
|
1080
|
-
return this.appliedScaleFactor;
|
|
1081
|
-
return 1;
|
|
1082
|
-
}
|
|
1083
|
-
getFontStyles() {
|
|
1084
|
-
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
1085
|
-
return this.componentStyle(($) => {
|
|
1086
|
-
var _a, _b, _c, _d;
|
|
1087
|
-
const baseFontSize = ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333;
|
|
1088
|
-
return {
|
|
1089
|
-
"--bn-font-family": ((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontFamily"]) || "'Noto Sans', sans-serif",
|
|
1090
|
-
"--bn-font-size": `${baseFontSize * effectiveFactor}px`,
|
|
1091
|
-
"--bn-font-color": ((_c = $["global"]) === null || _c === void 0 ? void 0 : _c["fontColor"]) || "#000000",
|
|
1092
|
-
"--bn-font-background": ((_d = $["global"]) === null || _d === void 0 ? void 0 : _d["fontBackgroundColor"]) || "#ffffff",
|
|
1093
|
-
};
|
|
1094
|
-
});
|
|
1095
|
-
}
|
|
1096
|
-
render() {
|
|
1097
|
-
const fontStyles = this.getFontStyles();
|
|
1098
|
-
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
1099
|
-
return (h(Host, { key: 'ff1e93fe32fef547dfcd092016cbde05a82e54ce', style: fontStyles }, h("div", { key: '54a4539d8f67b50ed96036e66492a5a280cef987' }, h("ibcs-table", { key: '54a47b6ffd1ca979583b79339bfe19cbbaa00ce8', 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(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), scaleFactor: effectiveFactor }))));
|
|
1100
|
-
}
|
|
1101
|
-
get element() { return getElement(this); }
|
|
1102
|
-
static get watchers() { return {
|
|
1103
|
-
"scale": [{
|
|
1104
|
-
"validateScaling": 0
|
|
1105
|
-
}],
|
|
1106
|
-
"scenarios": [{
|
|
1107
|
-
"validateScenario": 0
|
|
1108
|
-
}],
|
|
1109
|
-
"variances": [{
|
|
1110
|
-
"validateVariances": 0
|
|
1111
|
-
}],
|
|
1112
|
-
"barColumns": [{
|
|
1113
|
-
"validateBarColumns": 0
|
|
1114
|
-
}],
|
|
1115
|
-
"unitScaling": [{
|
|
1116
|
-
"validateUnitScaling": 0
|
|
1117
|
-
}],
|
|
1118
|
-
"percentageScaling": [{
|
|
1119
|
-
"validatePercentageScaling": 0
|
|
1120
|
-
}],
|
|
1121
|
-
"dataFormat": [{
|
|
1122
|
-
"validateDataFormat": 0
|
|
1123
|
-
}],
|
|
1124
|
-
"grouped": [{
|
|
1125
|
-
"validateGrouped": 0
|
|
1126
|
-
}],
|
|
1127
|
-
"showMeasureScale": [{
|
|
1128
|
-
"validateShowMeasureScale": 0
|
|
1129
|
-
}],
|
|
1130
|
-
"showGroupTitle": [{
|
|
1131
|
-
"validateShowGroupTitle": 0
|
|
1132
|
-
}],
|
|
1133
|
-
"type": [{
|
|
1134
|
-
"validateType": 0
|
|
1135
|
-
}],
|
|
1136
|
-
"limit": [{
|
|
1137
|
-
"validateLimit": 0
|
|
1138
|
-
}],
|
|
1139
|
-
"thereof": [{
|
|
1140
|
-
"validateThereOf": 0
|
|
1141
|
-
}],
|
|
1142
|
-
"partof": [{
|
|
1143
|
-
"validatePartOf": 0
|
|
1144
|
-
}],
|
|
1145
|
-
"order": [{
|
|
1146
|
-
"validateOrderList": 0
|
|
1147
|
-
}],
|
|
1148
|
-
"orderDirection": [{
|
|
1149
|
-
"validateOrderDirection": 0
|
|
1150
|
-
}],
|
|
1151
|
-
"measureType": [{
|
|
1152
|
-
"validateMeasureType": 0
|
|
1153
|
-
}],
|
|
1154
|
-
"measureScale": [{
|
|
1155
|
-
"validateMeasureScale": 0
|
|
1156
|
-
}],
|
|
1157
|
-
"dataFormatDigitsDecimal": [{
|
|
1158
|
-
"validateDataFormatDigitsDecimal": 0
|
|
1159
|
-
}],
|
|
1160
|
-
"dataFormatDigitsPercent": [{
|
|
1161
|
-
"validateDateFormatDigitsPercent": 0
|
|
1162
|
-
}],
|
|
1163
|
-
"categoryWidth": [{
|
|
1164
|
-
"validateCategoryWidth": 0
|
|
1165
|
-
}],
|
|
1166
|
-
"columnthereof": [{
|
|
1167
|
-
"validateColumnThereOf": 0
|
|
1168
|
-
}]
|
|
1169
|
-
}; }
|
|
1170
|
-
};
|
|
1171
|
-
Table$1.style = bnTableCss();
|
|
1172
|
-
|
|
1173
|
-
// import {Formatter} from "../../../../utils/formatter";
|
|
1174
|
-
// import {DataFormatDigits} from "../../../../utils/model/DataFormatDigits";
|
|
1175
|
-
/**
|
|
1176
|
-
* Represents a single table cell with formatting and rendering capabilities.
|
|
1177
|
-
*
|
|
1178
|
-
* The draw() method implements a formatting pipeline:
|
|
1179
|
-
* 1. Checks for undefined/null/NaN values -- returns empty string for missing data
|
|
1180
|
-
* 2. Non-numeric values (category labels) are returned as-is
|
|
1181
|
-
* 3. Numeric values are routed through Formatter.number() with the cell's type
|
|
1182
|
-
* (decimal or percent) and configured digit precision
|
|
1183
|
-
* 4. For decimal type, the raw value is divided by measureScale before formatting,
|
|
1184
|
-
* enabling SI prefix display (e.g. "in Mio EUR")
|
|
1185
|
-
*/
|
|
1186
|
-
class Cell {
|
|
1187
|
-
constructor(scenario, index, value, cssStyle, type, prefix, prefixStyle, colSpan, measureScale) {
|
|
1188
|
-
this.prefixStyle = "prefix";
|
|
1189
|
-
this.isBarChart = false;
|
|
1190
|
-
this.key = scenario;
|
|
1191
|
-
this.index = index;
|
|
1192
|
-
this.value = value;
|
|
1193
|
-
this.prefix = prefix || "";
|
|
1194
|
-
this.cssStyle = cssStyle || "";
|
|
1195
|
-
this.prefixStyle = prefixStyle || "prefix";
|
|
1196
|
-
this.type = type;
|
|
1197
|
-
this.mark = undefined;
|
|
1198
|
-
this.colSpan = colSpan || 1;
|
|
1199
|
-
this.measureScale = measureScale || 1;
|
|
1200
|
-
}
|
|
1201
|
-
getAsHeaderList() {
|
|
1202
|
-
if (this.value == null) {
|
|
1203
|
-
return [""];
|
|
1204
|
-
}
|
|
1205
|
-
const result = [];
|
|
1206
|
-
for (const line of this.value.toString().split("<br/>")) {
|
|
1207
|
-
result.push(line);
|
|
1208
|
-
}
|
|
1209
|
-
return result;
|
|
1210
|
-
}
|
|
1211
|
-
draw(dataFormatDigits) {
|
|
1212
|
-
let cellValue = this.value;
|
|
1213
|
-
if (cellValue === "undefined" || cellValue === undefined || cellValue == null) {
|
|
1214
|
-
return "";
|
|
1215
|
-
}
|
|
1216
|
-
if (Number.isNaN(Number(cellValue))) {
|
|
1217
|
-
return cellValue;
|
|
1218
|
-
}
|
|
1219
|
-
if (this.type === "" || this.type === undefined || this.type == null) {
|
|
1220
|
-
return cellValue;
|
|
1221
|
-
}
|
|
1222
|
-
let digitsMin = dataFormatDigits.percent;
|
|
1223
|
-
let scale = dataFormatDigits.percent;
|
|
1224
|
-
if (this.type === "decimal") {
|
|
1225
|
-
cellValue = +cellValue / this.measureScale;
|
|
1226
|
-
digitsMin = dataFormatDigits.decimal;
|
|
1227
|
-
scale = dataFormatDigits.decimal;
|
|
1228
|
-
}
|
|
1229
|
-
return Formatter.number(Number(cellValue), this.type, digitsMin, scale);
|
|
1230
|
-
}
|
|
1231
|
-
drawPrefix() {
|
|
1232
|
-
if (this.prefix == null) {
|
|
1233
|
-
return "";
|
|
1234
|
-
}
|
|
1235
|
-
return this.prefix;
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
1240
|
-
* Represents a single row in an IBCS table, containing an ordered list of Cells.
|
|
1241
|
-
*
|
|
1242
|
-
* The CSS class is determined by the TableRowType:
|
|
1243
|
-
* - HEADER -> "groupheader"
|
|
1244
|
-
* - SEPERATORLINE -> "" (styled via cell-level scenario classes)
|
|
1245
|
-
* - DRILLELEMENT -> "ofit" (thereof rows)
|
|
1246
|
-
* - PARTELEMENT -> "partof" (percentage-of-parent rows)
|
|
1247
|
-
* - SUM -> "sum"
|
|
1248
|
-
* - STANDARD -> ""
|
|
1249
|
-
*
|
|
1250
|
-
* createElement() applies type-specific overrides:
|
|
1251
|
-
* - HEADER rows force "headerlabel" CSS on all cells
|
|
1252
|
-
* - SEPERATORLINE rows use the scenario name as CSS class for border styling
|
|
1253
|
-
* - PARTELEMENT rows show "-" for percent cells and force percent type on data cells
|
|
1254
|
-
*/
|
|
1255
|
-
class TableRow {
|
|
1256
|
-
constructor(index, groupIndex, type) {
|
|
1257
|
-
this.index = index;
|
|
1258
|
-
this.groupindex = groupIndex;
|
|
1259
|
-
this.type = type;
|
|
1260
|
-
this.cssStyle = this.initCssStyle();
|
|
1261
|
-
this.elements = [];
|
|
1262
|
-
}
|
|
1263
|
-
initCssStyle() {
|
|
1264
|
-
switch (this.type) {
|
|
1265
|
-
case TableRowType.HEADER: {
|
|
1266
|
-
return "groupheader";
|
|
1267
|
-
}
|
|
1268
|
-
case TableRowType.SEPERATORLINE: {
|
|
1269
|
-
return "";
|
|
1270
|
-
}
|
|
1271
|
-
case TableRowType.DRILLELEMENT: {
|
|
1272
|
-
return "ofit";
|
|
1273
|
-
}
|
|
1274
|
-
case TableRowType.PARTELEMENT: {
|
|
1275
|
-
return "partof";
|
|
1276
|
-
}
|
|
1277
|
-
case TableRowType.STANDARD: {
|
|
1278
|
-
return "";
|
|
1279
|
-
}
|
|
1280
|
-
case TableRowType.SUM: {
|
|
1281
|
-
return "sum";
|
|
1282
|
-
}
|
|
1283
|
-
default: {
|
|
1284
|
-
return "";
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
getCells() {
|
|
1289
|
-
return this.elements;
|
|
1290
|
-
}
|
|
1291
|
-
createElement(value, scenario, columnType, cellType, prefix, cellStyle, isSecondaryElement, categoryWidth, measureScale, isBarChart = false, columnStats) {
|
|
1292
|
-
let cssStyle = cellStyle;
|
|
1293
|
-
if (scenario === "category" && categoryWidth != null) {
|
|
1294
|
-
cssStyle = `category-${categoryWidth.toString()}`;
|
|
1295
|
-
}
|
|
1296
|
-
if (this.type === TableRowType.HEADER) {
|
|
1297
|
-
cssStyle = "headerlabel";
|
|
1298
|
-
}
|
|
1299
|
-
else if (this.type === TableRowType.SEPERATORLINE) {
|
|
1300
|
-
cssStyle = scenario;
|
|
1301
|
-
}
|
|
1302
|
-
if (this.type === TableRowType.PARTELEMENT) {
|
|
1303
|
-
if (cellType === "percent") {
|
|
1304
|
-
value = "-";
|
|
1305
|
-
}
|
|
1306
|
-
if (scenario !== "category" && scenario !== "operation") {
|
|
1307
|
-
cellType = "percent";
|
|
1308
|
-
cssStyle = "";
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
if (value === "-") {
|
|
1312
|
-
cssStyle = "";
|
|
1313
|
-
}
|
|
1314
|
-
let prefixStyle = "prefix-first";
|
|
1315
|
-
if (isSecondaryElement) {
|
|
1316
|
-
prefixStyle = "prefix-second";
|
|
1317
|
-
}
|
|
1318
|
-
cssStyle = `${cssStyle} ${columnType}`;
|
|
1319
|
-
const cell = new Cell(scenario, this.elements.length, value, cssStyle, cellType, prefix, prefixStyle, 1, measureScale);
|
|
1320
|
-
cell.isBarChart = isBarChart;
|
|
1321
|
-
cell.columnStats = columnStats;
|
|
1322
|
-
this.elements.push(cell);
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
// Default fallback colors (should come from componentStyle)
|
|
1327
|
-
const DEFAULT_STYLES = {
|
|
1328
|
-
positive: { stroke: "#008f96", fill: "#008f96", fillpattern: "solid" },
|
|
1329
|
-
negative: { stroke: "#ff0000", fill: "#ff0000", fillpattern: "solid" },
|
|
1330
|
-
neutral: { stroke: "#808080", fill: "#808080", fillpattern: "outlined" },
|
|
1331
|
-
scenarios: {
|
|
1332
|
-
ac: { stroke: "#404040", fill: "#404040", fillpattern: "solid" },
|
|
1333
|
-
pp: { stroke: "#A6A6A6", fill: "#A6A6A6", fillpattern: "solid" },
|
|
1334
|
-
fc: { stroke: "#404040", fill: "#ffffff", fillpattern: "hatched" },
|
|
1335
|
-
pl: { stroke: "#404040", fill: "#ffffff", fillpattern: "outlined" },
|
|
1336
|
-
},
|
|
1337
|
-
fontColor: "#000000",
|
|
1338
|
-
fontSize: 11,
|
|
1339
|
-
fontFamily: "'Noto Sans', sans-serif",
|
|
1340
|
-
unitScaling: 0.01, // Default: 1000 units = 10 pixels
|
|
1341
|
-
percentageScaling: 0.5, // Default: 100% = 50 pixels
|
|
1342
|
-
scaleFactor: 1,
|
|
1343
|
-
};
|
|
1344
|
-
const AXIS_COLOR = "#666666";
|
|
1345
|
-
/**
|
|
1346
|
-
* Creates a unique pattern ID for the SVG defs
|
|
1347
|
-
*/
|
|
1348
|
-
function getPatternId(prefix, color) {
|
|
1349
|
-
return `pattern-${prefix}-${color.replace("#", "")}`;
|
|
1350
|
-
}
|
|
1351
|
-
/**
|
|
1352
|
-
* Renders SVG pattern definitions for hatched fills
|
|
1353
|
-
*/
|
|
1354
|
-
const PatternDefs = ({ styles }) => {
|
|
1355
|
-
const s = styles.scaleFactor;
|
|
1356
|
-
const patternSize = 6 * s;
|
|
1357
|
-
const patterns = [
|
|
1358
|
-
{ id: getPatternId("pos", styles.positive.stroke), stroke: styles.positive.stroke, fill: styles.positive.fill },
|
|
1359
|
-
{ id: getPatternId("neg", styles.negative.stroke), stroke: styles.negative.stroke, fill: styles.negative.fill },
|
|
1360
|
-
{ id: getPatternId("neu", styles.neutral.stroke), stroke: styles.neutral.stroke, fill: styles.neutral.fill },
|
|
1361
|
-
];
|
|
1362
|
-
return (h("defs", null, patterns.map((p) => (h("pattern", { id: p.id, patternUnits: "userSpaceOnUse", width: patternSize, height: patternSize }, h("rect", { width: patternSize, height: patternSize, fill: "#ffffff" }), h("line", { x1: "0", y1: patternSize, x2: patternSize, y2: "0", stroke: p.stroke, "stroke-width": 1.5 * s }))))));
|
|
1363
|
-
};
|
|
1364
|
-
/**
|
|
1365
|
-
* Formats a number for display with appropriate SI prefix.
|
|
1366
|
-
*/
|
|
1367
|
-
function formatValue(value, isRelative, measureScale = 1) {
|
|
1368
|
-
let scaledValue;
|
|
1369
|
-
let absValue;
|
|
1370
|
-
const prefix = value >= 0 ? "+" : "";
|
|
1371
|
-
if (isRelative) {
|
|
1372
|
-
// Relative variance is stored as decimal (e.g., -2.0 = -200%)
|
|
1373
|
-
// Multiply by 100 to get percentage value for display
|
|
1374
|
-
scaledValue = value * 100;
|
|
1375
|
-
// Show as integer percentage with % suffix
|
|
1376
|
-
return prefix + Math.round(scaledValue).toString() + "%";
|
|
1377
|
-
}
|
|
1378
|
-
else {
|
|
1379
|
-
// Absolute variance - apply measure scale and use SI prefixes
|
|
1380
|
-
scaledValue = value / measureScale;
|
|
1381
|
-
absValue = Math.abs(scaledValue);
|
|
1382
|
-
let formatted;
|
|
1383
|
-
if (absValue >= 1000000000) {
|
|
1384
|
-
formatted = (scaledValue / 1000000000).toFixed(absValue >= 10000000000 ? 0 : 1) + "B";
|
|
1385
|
-
}
|
|
1386
|
-
else if (absValue >= 1000000) {
|
|
1387
|
-
formatted = (scaledValue / 1000000).toFixed(absValue >= 10000000 ? 0 : 1) + "M";
|
|
1388
|
-
}
|
|
1389
|
-
else if (absValue >= 1000) {
|
|
1390
|
-
formatted = (scaledValue / 1000).toFixed(absValue >= 10000 ? 0 : 1) + "K";
|
|
1391
|
-
}
|
|
1392
|
-
else {
|
|
1393
|
-
formatted = scaledValue.toFixed(absValue >= 10 ? 0 : 1);
|
|
1394
|
-
}
|
|
1395
|
-
// Remove trailing .0 if present
|
|
1396
|
-
formatted = formatted.replace(/\.0([KMB]?)$/, "$1");
|
|
1397
|
-
return prefix + formatted;
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
/**
|
|
1401
|
-
* Checks if the column is a scenario column (ac, pp, fc, pl) vs variance (d_, dr_).
|
|
1402
|
-
*/
|
|
1403
|
-
function isScenarioColumn(scenario) {
|
|
1404
|
-
const scenarioPrefix = scenario.slice(0, 2).toLowerCase();
|
|
1405
|
-
return ["ac", "pp", "fc", "pl"].includes(scenarioPrefix);
|
|
1406
|
-
}
|
|
1407
|
-
/**
|
|
1408
|
-
* Gets the scenario type from the column name (ac, pp, fc, pl).
|
|
1409
|
-
*/
|
|
1410
|
-
function getScenarioType(scenario) {
|
|
1411
|
-
const scenarioPrefix = scenario.slice(0, 2).toLowerCase();
|
|
1412
|
-
if (scenarioPrefix === "pp")
|
|
1413
|
-
return "pp";
|
|
1414
|
-
if (scenarioPrefix === "fc")
|
|
1415
|
-
return "fc";
|
|
1416
|
-
if (scenarioPrefix === "pl")
|
|
1417
|
-
return "pl";
|
|
1418
|
-
return "ac"; // default
|
|
1419
|
-
}
|
|
1420
|
-
/**
|
|
1421
|
-
* Gets the style for a scenario column (ac, pp, fc, pl).
|
|
1422
|
-
*/
|
|
1423
|
-
function getScenarioStyle(scenario, styles) {
|
|
1424
|
-
const type = getScenarioType(scenario);
|
|
1425
|
-
return styles.scenarios[type];
|
|
1426
|
-
}
|
|
1427
|
-
/**
|
|
1428
|
-
* Gets the variance style based on value and sentiment direction.
|
|
1429
|
-
* pos suffix = positive values are good (green), negative are bad (red)
|
|
1430
|
-
* neg suffix = negative values are good (green), positive are bad (red)
|
|
1431
|
-
*/
|
|
1432
|
-
function getVarianceStyle(value, isPositiveGood, styles) {
|
|
1433
|
-
const isPositive = value >= 0;
|
|
1434
|
-
if (isPositiveGood) {
|
|
1435
|
-
return isPositive ? styles.positive : styles.negative;
|
|
1436
|
-
}
|
|
1437
|
-
else {
|
|
1438
|
-
return isPositive ? styles.negative : styles.positive;
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
/**
|
|
1442
|
-
* Gets the appropriate style for a bar based on column type.
|
|
1443
|
-
* Scenarios (ac, pp, fc, pl) use scenario styles.
|
|
1444
|
-
* Variances (d_, dr_) use variance styles with pos/neg/neu coloring.
|
|
1445
|
-
*/
|
|
1446
|
-
function getBarStyle(scenario, value, isPositiveGood, styles) {
|
|
1447
|
-
if (isScenarioColumn(scenario)) {
|
|
1448
|
-
return getScenarioStyle(scenario, styles);
|
|
1449
|
-
}
|
|
1450
|
-
return getVarianceStyle(value, isPositiveGood, styles);
|
|
1451
|
-
}
|
|
1452
|
-
/**
|
|
1453
|
-
* Gets the fill value for a bar - either solid color, pattern URL, or transparent with stroke.
|
|
1454
|
-
*/
|
|
1455
|
-
function getBarFill(varianceStyle, patternPrefix) {
|
|
1456
|
-
const pattern = varianceStyle.fillpattern;
|
|
1457
|
-
if (pattern === "hatched") {
|
|
1458
|
-
return `url(#${getPatternId(patternPrefix, varianceStyle.stroke)})`;
|
|
1459
|
-
}
|
|
1460
|
-
if (pattern === "outlined") {
|
|
1461
|
-
return "transparent";
|
|
1462
|
-
}
|
|
1463
|
-
// Default: solid fill
|
|
1464
|
-
return varianceStyle.fill;
|
|
1465
|
-
}
|
|
1466
|
-
/**
|
|
1467
|
-
* Gets the stroke for a bar based on pattern type.
|
|
1468
|
-
*/
|
|
1469
|
-
function getBarStroke(varianceStyle) {
|
|
1470
|
-
const pattern = varianceStyle.fillpattern;
|
|
1471
|
-
if (pattern === "outlined") {
|
|
1472
|
-
return { stroke: varianceStyle.stroke, strokeWidth: 1.5 }; // scaled by caller via * s
|
|
1473
|
-
}
|
|
1474
|
-
// Solid and hatched bars don't need visible stroke
|
|
1475
|
-
return { stroke: "none", strokeWidth: 0 };
|
|
1476
|
-
}
|
|
1477
|
-
/**
|
|
1478
|
-
* Renders an absolute variance bar chart (d_ prefix).
|
|
1479
|
-
* Horizontal bar with centered axis, green for positive, red for negative.
|
|
1480
|
-
* Value label shown next to the bar (black text per IBCS).
|
|
1481
|
-
*
|
|
1482
|
-
* Layout: [left label area][bar area with axis][right label area]
|
|
1483
|
-
* Uses unitScaling to determine bar width (pixels per unit of measure).
|
|
1484
|
-
*/
|
|
1485
|
-
const AbsoluteVarianceBar = (props) => {
|
|
1486
|
-
const { value, scenario, height, isPositiveGood, formattedValue, measureScale, styles = DEFAULT_STYLES } = props;
|
|
1487
|
-
const s = styles.scaleFactor;
|
|
1488
|
-
const labelAreaWidth = 50 * s;
|
|
1489
|
-
const maxBarWidth = 40 * s;
|
|
1490
|
-
const barAreaWidth = maxBarWidth * 2;
|
|
1491
|
-
const totalWidth = labelAreaWidth + barAreaWidth + labelAreaWidth;
|
|
1492
|
-
const padding = 2 * s;
|
|
1493
|
-
const barHeight = height - padding * 2;
|
|
1494
|
-
const axisX = labelAreaWidth + maxBarWidth; // Axis in center of bar area
|
|
1495
|
-
// Calculate bar width using unitScaling (pixels per unit)
|
|
1496
|
-
// Clamp to maxBarWidth to prevent overflow
|
|
1497
|
-
const scaledWidth = Math.abs(value) * styles.unitScaling * s;
|
|
1498
|
-
const barWidth = Math.min(scaledWidth, maxBarWidth);
|
|
1499
|
-
const isPositive = value >= 0;
|
|
1500
|
-
const barX = isPositive ? axisX : axisX - barWidth;
|
|
1501
|
-
const barY = padding;
|
|
1502
|
-
// Get style based on column type (scenario vs variance)
|
|
1503
|
-
const barStyle = getBarStyle(scenario, value, isPositiveGood, styles);
|
|
1504
|
-
// Pattern prefix for scenarios uses scenario type, for variances uses pos/neg
|
|
1505
|
-
const patternPrefix = isScenarioColumn(scenario)
|
|
1506
|
-
? getScenarioType(scenario)
|
|
1507
|
-
: isPositiveGood
|
|
1508
|
-
? isPositive
|
|
1509
|
-
? "pos"
|
|
1510
|
-
: "neg"
|
|
1511
|
-
: isPositive
|
|
1512
|
-
? "neg"
|
|
1513
|
-
: "pos";
|
|
1514
|
-
const fillValue = getBarFill(barStyle, patternPrefix);
|
|
1515
|
-
const { stroke: barStroke, strokeWidth: barStrokeWidth } = getBarStroke(barStyle);
|
|
1516
|
-
const displayValue = formattedValue || formatValue(value, false, measureScale);
|
|
1517
|
-
// Label position: in the label area on the appropriate side
|
|
1518
|
-
// Positive values: label in right area, left-aligned
|
|
1519
|
-
// Negative values: label in left area, right-aligned
|
|
1520
|
-
const labelX = isPositive ? axisX + barWidth + 4 * s : axisX - barWidth - 4 * s;
|
|
1521
|
-
const labelAnchor = isPositive ? "start" : "end";
|
|
1522
|
-
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 }), barWidth > 0 && (h("rect", { x: barX, y: barY, width: barWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": labelAnchor, fill: styles.fontColor, "font-size": styles.fontSize, "font-family": styles.fontFamily }, displayValue)));
|
|
1523
|
-
};
|
|
1524
|
-
/**
|
|
1525
|
-
* Renders a relative variance pin chart (dr_ prefix).
|
|
1526
|
-
* Thin horizontal line from axis with dot at end and value label.
|
|
1527
|
-
*
|
|
1528
|
-
* Layout: [pin area with axis][label area on right]
|
|
1529
|
-
* Uses percentageScaling to determine pin length (pixels per percentage point).
|
|
1530
|
-
*/
|
|
1531
|
-
const RelativeVariancePin = (props) => {
|
|
1532
|
-
const { value, scenario, height, isPositiveGood, formattedValue, measureScale, styles = DEFAULT_STYLES } = props;
|
|
1533
|
-
const s = styles.scaleFactor;
|
|
1534
|
-
const maxPinLength = 25 * s;
|
|
1535
|
-
const pinAreaWidth = maxPinLength * 2 + 10 * s;
|
|
1536
|
-
const labelAreaWidth = 70 * s;
|
|
1537
|
-
const totalWidth = pinAreaWidth + labelAreaWidth;
|
|
1538
|
-
const axisX = pinAreaWidth / 2;
|
|
1539
|
-
const centerY = height / 2;
|
|
1540
|
-
// Calculate pin length using percentageScaling (pixels per percentage point)
|
|
1541
|
-
// Value is in decimal form (e.g., 0.5 = 50%), multiply by 100 to get percentage
|
|
1542
|
-
const percentValue = Math.abs(value) * 100;
|
|
1543
|
-
const scaledLength = percentValue * styles.percentageScaling * s;
|
|
1544
|
-
const pinLength = Math.min(scaledLength, maxPinLength);
|
|
1545
|
-
const isPositive = value >= 0;
|
|
1546
|
-
const pinEndX = isPositive ? axisX + pinLength : axisX - pinLength;
|
|
1547
|
-
// Get style based on column type (scenario vs variance)
|
|
1548
|
-
const barStyle = getBarStyle(scenario, value, isPositiveGood, styles);
|
|
1549
|
-
const dotRadius = 3 * s;
|
|
1550
|
-
// Show arrow for extreme values (when pin would exceed max length)
|
|
1551
|
-
const isExtreme = scaledLength > maxPinLength;
|
|
1552
|
-
const displayValue = formattedValue || formatValue(value, true, measureScale);
|
|
1553
|
-
// Label always on the right side after the pin area
|
|
1554
|
-
const labelX = pinAreaWidth + 4 * s;
|
|
1555
|
-
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: `${pinAreaWidth - 2 * s},${centerY} ${pinAreaWidth - 8 * s},${centerY - 3 * s} ${pinAreaWidth - 8 * s},${centerY + 3 * s}`, fill: barStyle.fill })), isExtreme && !isPositive && (h("polygon", { points: `${2 * s},${centerY} ${8 * s},${centerY - 3 * s} ${8 * 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": styles.fontSize, "font-style": "italic", "font-family": styles.fontFamily }, displayValue)));
|
|
1556
|
-
};
|
|
1557
|
-
/**
|
|
1558
|
-
* CellBarChart - Renders IBCS-compliant variance bar charts.
|
|
1559
|
-
*
|
|
1560
|
-
* Absolute variance (d_ prefix): Horizontal bars with centered axis
|
|
1561
|
-
* Relative variance (dr_ prefix): Pin/dot charts with value indication
|
|
1562
|
-
*
|
|
1563
|
-
* Uses componentStyle patterns from chart components for consistent styling.
|
|
1564
|
-
*/
|
|
1565
|
-
const CellBarChart = (props) => {
|
|
1566
|
-
const { value, columnStats, isRelative, styles = DEFAULT_STYLES } = props;
|
|
1567
|
-
// Handle invalid values
|
|
1568
|
-
if (value === null || value === undefined || isNaN(value) || !columnStats || columnStats.absMax === 0) {
|
|
1569
|
-
return (h("span", { class: "bar-chart-empty", style: { color: styles.fontColor, fontStyle: "italic" } }, "-"));
|
|
1570
|
-
}
|
|
1571
|
-
if (isRelative) {
|
|
1572
|
-
return h(RelativeVariancePin, Object.assign({}, props));
|
|
1573
|
-
}
|
|
1574
|
-
return h(AbsoluteVarianceBar, Object.assign({}, props));
|
|
1575
|
-
};
|
|
1576
|
-
|
|
1577
|
-
/**
|
|
1578
|
-
* Manages the GROUP BY column list for DataQuery's SQL statements and registers
|
|
1579
|
-
* the `transformOperator` AlaSQL custom function.
|
|
1580
|
-
*
|
|
1581
|
-
* `transformOperator` converts the dataset's `operation` field (`"+"` or `"-"`)
|
|
1582
|
-
* into a numeric multiplier (+1 / -1) so that SUM aggregations correctly add
|
|
1583
|
-
* or subtract rows based on their sign.
|
|
1584
|
-
*
|
|
1585
|
-
* The GROUP BY columns are composed dynamically: always category + categoryIndex,
|
|
1586
|
-
* plus operation for OPT types, plus rowGroup/rowGroupIndex when grouping is active.
|
|
1587
|
-
*/
|
|
1588
|
-
class QueryGroups {
|
|
1589
|
-
constructor(config) {
|
|
1590
|
-
alasql.fn.transformOperator = function (a) {
|
|
1591
|
-
return a === "-" ? -1 : 1;
|
|
1592
|
-
};
|
|
1593
|
-
this.groups = [QueryColumnNames.CATEGORY, QueryColumnNames.CATEGORYINDEX];
|
|
1594
|
-
if (TableType.OPT === config.type || TableType.OPTNOTOTAL === config.type) {
|
|
1595
|
-
this.groups.unshift(QueryColumnNames.OPERATION);
|
|
1596
|
-
}
|
|
1597
|
-
if (config.grouped) {
|
|
1598
|
-
this.groups.push(QueryColumnNames.ROWGROUP);
|
|
1599
|
-
this.groups.push(QueryColumnNames.ROWGROUPINDEX);
|
|
1600
|
-
}
|
|
1601
|
-
}
|
|
1602
|
-
toString() {
|
|
1603
|
-
return this.groups.map((s) => `${s}`).toString();
|
|
1604
|
-
}
|
|
1605
|
-
noCategory() {
|
|
1606
|
-
return this.groups.filter((element) => element !== QueryColumnNames.CATEGORY);
|
|
1607
|
-
}
|
|
1608
|
-
toArray() {
|
|
1609
|
-
return this.groups;
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
/**
|
|
1614
|
-
* AlaSQL-based query builder that produces the complete table result set for bn-table.
|
|
1615
|
-
*
|
|
1616
|
-
* Translates a {@link TableComponentConfig} into a series of SQL statements executed
|
|
1617
|
-
* against in-memory data rows. The pipeline handles scenario aggregation, row/column
|
|
1618
|
-
* grouping, drill-down expansion (thereof / partof), REST rows, sum rows, NaN detection,
|
|
1619
|
-
* column-level drill columns, and relative variance calculation.
|
|
1620
|
-
*/
|
|
1621
|
-
class DataQuery {
|
|
1622
|
-
constructor(config, i18n) {
|
|
1623
|
-
this.hasPartOf = false;
|
|
1624
|
-
this.config = config;
|
|
1625
|
-
this.i18n = i18n;
|
|
1626
|
-
}
|
|
1627
|
-
/**
|
|
1628
|
-
* Executes the full query pipeline and returns a segmented result set.
|
|
1629
|
-
*
|
|
1630
|
-
* Pipeline steps:
|
|
1631
|
-
* 1. Translate scenario columns into SQL aggregation expressions
|
|
1632
|
-
* 2. Run a meta query to discover row groups and their category counts
|
|
1633
|
-
* 3. For each group: generate header row, data rows, REST overflow row, and group sum row
|
|
1634
|
-
* 4. Append a total sum row (if table type requires it)
|
|
1635
|
-
* 5. Execute all accumulated SQL statements against the input data
|
|
1636
|
-
* 6. Detect NaN cells (aggregated cells with zero contributing rows)
|
|
1637
|
-
* 7. Inject thereof/partof drill rows and column-level drill columns
|
|
1638
|
-
* 8. Calculate REST columns (parent minus drilled children)
|
|
1639
|
-
* 9. Divide absolute variances by their denominator to produce relative variances
|
|
1640
|
-
*
|
|
1641
|
-
* @returns Array of row-group segments; each segment is an array of result rows.
|
|
1642
|
-
*/
|
|
1643
|
-
execute(data) {
|
|
1644
|
-
if (data.length === 0) {
|
|
1645
|
-
return [];
|
|
1646
|
-
}
|
|
1647
|
-
const queries = [];
|
|
1648
|
-
const sumGroupQueries = [];
|
|
1649
|
-
const res = [];
|
|
1650
|
-
const scenarios = this.config.scenarios
|
|
1651
|
-
.map((s) => this.translateScenarioSQL(s, false, this.config.type))
|
|
1652
|
-
.toString();
|
|
1653
|
-
const scenariosSUMQuery = this.config.scenarios
|
|
1654
|
-
.map((s) => this.translateScenarioSQL(s, true, this.config.type))
|
|
1655
|
-
.toString();
|
|
1656
|
-
const relativeScenarios = this.getRelativeScenarios();
|
|
1657
|
-
const groups = new QueryGroups(this.config);
|
|
1658
|
-
const groupsAggregated = this.config.grouped ? [QueryColumnNames.ROWGROUP, QueryColumnNames.ROWGROUPINDEX] : [];
|
|
1659
|
-
let order = ["", ""];
|
|
1660
|
-
if (this.config.sortOrder.hierarchy.length > 0) {
|
|
1661
|
-
order = this.createOrderString(this.config.sortOrder);
|
|
1662
|
-
}
|
|
1663
|
-
this.hasPartOf = this.checkConfigForPartOf();
|
|
1664
|
-
// meta defines groups and the number detail rows in each group
|
|
1665
|
-
// Bsp: 0: Object { totalrowcnt: 7, rowgroup: "Umsatz" }
|
|
1666
|
-
const meta = alasql(`SELECT COUNT(DISTINCT ${QueryColumnNames.CATEGORY}) as ${QueryColumnNames.TOTALROWCOUNT} ${groupsAggregated.length > 0 ? "," + groupsAggregated : ""}
|
|
1667
|
-
FROM ? ${groupsAggregated.length > 0 ? "GROUP BY " + groupsAggregated : ""}
|
|
1668
|
-
ORDER BY ${order[0]}`, [data]);
|
|
1669
|
-
// Creates DataSelection for LIST
|
|
1670
|
-
meta.forEach((rowGroupEntry) => {
|
|
1671
|
-
// the following variables are 'helper sections' which are used to constuct dynamicly the sql statement depending of the given config
|
|
1672
|
-
// is grouping active?
|
|
1673
|
-
const queryWhereSection = rowGroupEntry.rowGroup && rowGroupEntry.rowGroup.length > 0
|
|
1674
|
-
? `WHERE ${QueryColumnNames.ROWGROUP} = '${rowGroupEntry.rowGroup}'`
|
|
1675
|
-
: ``;
|
|
1676
|
-
// is limit active?
|
|
1677
|
-
let queryLimitSection = "";
|
|
1678
|
-
if (this.config.limit) {
|
|
1679
|
-
queryLimitSection = `LIMIT ${this.config.limit}`;
|
|
1680
|
-
}
|
|
1681
|
-
this.createGroupHeaderRow(rowGroupEntry, queries);
|
|
1682
|
-
this.createDataRow(queries, rowGroupEntry, groups, scenarios, queryWhereSection, order, queryLimitSection);
|
|
1683
|
-
this.createRestRow(rowGroupEntry, queries, groups, scenarios, queryWhereSection, order);
|
|
1684
|
-
this.createGroupSumRow(queries, sumGroupQueries, rowGroupEntry, scenariosSUMQuery, order);
|
|
1685
|
-
});
|
|
1686
|
-
this.createTotalSumRow(queries, sumGroupQueries, scenariosSUMQuery);
|
|
1687
|
-
// executes main queries
|
|
1688
|
-
queries.forEach((query) => {
|
|
1689
|
-
try {
|
|
1690
|
-
res.push(alasql(query, [data]));
|
|
1691
|
-
}
|
|
1692
|
-
catch (err) {
|
|
1693
|
-
console.error("DataQuery: SQL query execution failed", query, err);
|
|
1694
|
-
}
|
|
1695
|
-
});
|
|
1696
|
-
this.detectNaNCells(this.config.scenarios, res);
|
|
1697
|
-
this.createThereOfDrillRows(scenarios, order, data, res);
|
|
1698
|
-
this.createPartOfDrillRows(scenarios, order, sumGroupQueries, data, res);
|
|
1699
|
-
this.createThereOfDrillColumns(this.config.categoryThereOf, data, res);
|
|
1700
|
-
this.calculateColumnGroupRest(res, this.config.categoryThereOf);
|
|
1701
|
-
this.calculateRelativeVariances(res, relativeScenarios);
|
|
1702
|
-
return res;
|
|
1703
|
-
}
|
|
1704
|
-
/**
|
|
1705
|
-
* Marks aggregated cells as NaN when no source rows contributed to the sum.
|
|
1706
|
-
*
|
|
1707
|
-
* Without this step, SUM() over zero matching rows would produce 0, which is
|
|
1708
|
-
* misleading -- it would be indistinguishable from an actual zero value.
|
|
1709
|
-
* Each scenario column has a companion `_cnt` counter; when that counter is 0
|
|
1710
|
-
* the cell is overwritten with NaN. For variance scenarios, both base and delta
|
|
1711
|
-
* counters must be non-zero.
|
|
1712
|
-
*/
|
|
1713
|
-
detectNaNCells(scenarios, res) {
|
|
1714
|
-
res.forEach((group) => {
|
|
1715
|
-
group.map((row) => {
|
|
1716
|
-
scenarios.forEach((scenario) => {
|
|
1717
|
-
const varianceScenario = new VarianceScenario(scenario);
|
|
1718
|
-
if (varianceScenario.isValid === true) {
|
|
1719
|
-
if (row[varianceScenario.base + "_cnt"] === 0 || row[varianceScenario.delta + "_cnt"] === 0) {
|
|
1720
|
-
row[scenario] = Number.NaN;
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
else {
|
|
1724
|
-
if (row[scenario + "_cnt"] === 0) {
|
|
1725
|
-
row[scenario] = Number.NaN;
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
});
|
|
1729
|
-
return row;
|
|
1730
|
-
});
|
|
1731
|
-
});
|
|
1732
|
-
}
|
|
1733
|
-
/**
|
|
1734
|
-
* Creates "part-of" drill rows that express each category's value as a fraction
|
|
1735
|
-
* of its row group sum. Queries the drill subset, then divides each scenario
|
|
1736
|
-
* value by the corresponding group sum to produce a percentage.
|
|
1737
|
-
*/
|
|
1738
|
-
createPartOfDrillRows(scenarios, order, sumGroupQueries, data, res) {
|
|
1739
|
-
if (this.config.partOf == null ||
|
|
1740
|
-
this.config.partOf.length === 0 ||
|
|
1741
|
-
this.config.type === TableType.LIST ||
|
|
1742
|
-
data == null ||
|
|
1743
|
-
data.length === 0) {
|
|
1744
|
-
return;
|
|
1745
|
-
}
|
|
1746
|
-
const drillQueries = this.createPartOfQuery(scenarios, order);
|
|
1747
|
-
let resDrill = []; // set of drill (subquery result injected into resultset)
|
|
1748
|
-
drillQueries.forEach(function (query) {
|
|
1749
|
-
resDrill.push(...alasql(query, [data]));
|
|
1750
|
-
});
|
|
1751
|
-
const scenarioNames = this.exctractScenarioNames(scenarios);
|
|
1752
|
-
const rowGroupSumResultRows = [];
|
|
1753
|
-
sumGroupQueries.forEach(function (query) {
|
|
1754
|
-
rowGroupSumResultRows.push(...alasql(query, [data]));
|
|
1755
|
-
});
|
|
1756
|
-
const rowGroupSumResultMap = new Map();
|
|
1757
|
-
rowGroupSumResultRows.forEach((row) => rowGroupSumResultMap.set(row[QueryColumnNames.ROWGROUP], row));
|
|
1758
|
-
resDrill = this.reduceResDrillByCategoryGroups(resDrill, scenarioNames);
|
|
1759
|
-
resDrill.forEach(function (drillItem) {
|
|
1760
|
-
scenarioNames.forEach((key) => {
|
|
1761
|
-
try {
|
|
1762
|
-
drillItem[key] =
|
|
1763
|
-
drillItem[key] /
|
|
1764
|
-
rowGroupSumResultMap.get(drillItem[QueryColumnNames.ROWGROUP])[key];
|
|
1765
|
-
}
|
|
1766
|
-
catch (err) {
|
|
1767
|
-
console.error("DataQuery: partOf drill row calculation failed", key, err);
|
|
1768
|
-
drillItem[key] = Number.NaN;
|
|
1769
|
-
}
|
|
1770
|
-
});
|
|
1771
|
-
});
|
|
1772
|
-
this.injectDrillRowsToResultRows(resDrill, res);
|
|
1773
|
-
}
|
|
1774
|
-
/**
|
|
1775
|
-
* Generates a REST row that aggregates all data rows beyond the configured limit.
|
|
1776
|
-
* Only emitted when a limit is set and the group has more rows than the limit.
|
|
1777
|
-
*/
|
|
1778
|
-
createRestRow(rowGroupEntry, querys, groups, scenarios, queryWhereSection, order) {
|
|
1779
|
-
// Generates REST Row; sumsup the Bottom (total number of rows - limit)
|
|
1780
|
-
if (rowGroupEntry.totalRowCnt - this.config.limit > 0 && this.config.limit !== 0) {
|
|
1781
|
-
const rest_scenarios = ", SUM(ac1) as ac1, SUM(pp1) as pp1, SUM(dpp1_ac1_pos) as dpp1_ac1_pos, SUM(drpp1_ac1_pos) as drpp1_ac1_pos, SUM(dr_pp1)";
|
|
1782
|
-
querys.push(`SELECT ${QueryColumnNames.ROWNR}, 1 as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, 'NO_GROUP' as ${QueryColumnNames.ROWGROUP}, 'REST' as ${QueryColumnNames.CATEGORY} ${rest_scenarios} as dr_pp1 FROM` +
|
|
1783
|
-
` (SELECT ROWNUM() AS ${QueryColumnNames.ROWNR}, ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, '${rowGroupEntry.rowGroup || "NO_GROUP"}' as ${QueryColumnNames.ROWGROUP}, ${groups} ${scenarios.length > 0 ? ",".concat(scenarios) : ""} FROM ? ${queryWhereSection} GROUP BY ${groups} ORDER BY ${order[0]})` +
|
|
1784
|
-
` t WHERE t.rowNr > ${this.config.limit}`);
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
/** Generates the main data rows for a single row group, applying GROUP BY, ORDER, and LIMIT. */
|
|
1788
|
-
createDataRow(querys, rowGroupEntry, groups, scenarios, queryWhereSection, order, queryLimitSection) {
|
|
1789
|
-
// Generates DataRows
|
|
1790
|
-
querys.push(`SELECT ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
1791
|
-
${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
1792
|
-
'ENTRY' as ${QueryColumnNames.TYPE},
|
|
1793
|
-
'${rowGroupEntry.rowGroup || "NO_GROUP"}' as ${QueryColumnNames.ROWGROUP},
|
|
1794
|
-
'${QueryColumnNames.CATEGORYINDEX}',
|
|
1795
|
-
${groups} ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
1796
|
-
FROM ? ${queryWhereSection}
|
|
1797
|
-
GROUP BY ${groups}
|
|
1798
|
-
ORDER BY ${order[0]} ${queryLimitSection}`);
|
|
1799
|
-
}
|
|
1800
|
-
/** Generates a GROUPHEAD row used as a visual header when row grouping is active. */
|
|
1801
|
-
createGroupHeaderRow(rowGroupEntry, querys) {
|
|
1802
|
-
// Generates GroupHeader Row
|
|
1803
|
-
if (true === this.config.grouped) {
|
|
1804
|
-
const groupTitle = this.config.showGroupTitle
|
|
1805
|
-
? `,'${rowGroupEntry.rowGroup}' as ${QueryColumnNames.CATEGORY}`
|
|
1806
|
-
: "";
|
|
1807
|
-
querys.push(`SELECT ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
1808
|
-
${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
1809
|
-
'GROUPHEAD' as ${QueryColumnNames.TYPE},
|
|
1810
|
-
'${rowGroupEntry.rowGroup}' as ${QueryColumnNames.ROWGROUP} ${groupTitle}
|
|
1811
|
-
FROM ?
|
|
1812
|
-
GROUP BY '1'`);
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
/** Generates a GROUP_SUM row that aggregates all entries within a single row group. */
|
|
1816
|
-
createGroupSumRow(querys, groupSumQuery, rowGroupEntry, scenariosSUMQuery, order) {
|
|
1817
|
-
// Generates SUM Row; sumsup all rows of group
|
|
1818
|
-
if (true === this.config.grouped &&
|
|
1819
|
-
(TableType.SUM === this.config.type ||
|
|
1820
|
-
TableType.SUMNOTOTAL === this.config.type ||
|
|
1821
|
-
TableType.OPT === this.config.type ||
|
|
1822
|
-
TableType.OPTNOTOTAL === this.config.type)) {
|
|
1823
|
-
querys.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
1824
|
-
'=' as ${QueryColumnNames.OPERATION},
|
|
1825
|
-
'${rowGroupEntry.rowGroup}' as ${QueryColumnNames.ROWGROUP},
|
|
1826
|
-
ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
1827
|
-
'GROUP_SUM' as ${QueryColumnNames.TYPE} ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
1828
|
-
FROM ?
|
|
1829
|
-
WHERE ${QueryColumnNames.ROWGROUP} = '${rowGroupEntry.rowGroup}'
|
|
1830
|
-
ORDER BY ${order[0]} `);
|
|
1831
|
-
groupSumQuery.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
1832
|
-
'=' as ${QueryColumnNames.OPERATION},
|
|
1833
|
-
'${rowGroupEntry.rowGroup}' as ${QueryColumnNames.ROWGROUP},
|
|
1834
|
-
ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
1835
|
-
'GROUP_SUM' as ${QueryColumnNames.TYPE} ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
1836
|
-
FROM ?
|
|
1837
|
-
WHERE ${QueryColumnNames.ROWGROUP} = '${rowGroupEntry.rowGroup}'
|
|
1838
|
-
ORDER BY ${order[0]} `);
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
/** Generates a total SUM row across all groups (only for SUM / OPT table types). */
|
|
1842
|
-
createTotalSumRow(querys, sumGroupQueries, scenariosSUMQuery) {
|
|
1843
|
-
if (TableType.SUM === this.config.type || TableType.OPT === this.config.type) {
|
|
1844
|
-
const title = `${this.hasPartOf && this.config.grouped === false ? `${this.i18n.get("SUM_TOTAL") || "SUM_TOTAL"} ` : ""}${this.config.title}`;
|
|
1845
|
-
querys.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
1846
|
-
'${title}' as ${QueryColumnNames.ROWGROUP},
|
|
1847
|
-
'=' as ${QueryColumnNames.OPERATION},
|
|
1848
|
-
'SUM' as ${QueryColumnNames.TYPE} ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
1849
|
-
FROM ? `);
|
|
1850
|
-
}
|
|
1851
|
-
sumGroupQueries.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
1852
|
-
'SUM_TOTAL' as ${QueryColumnNames.ROWGROUP},
|
|
1853
|
-
'=' as ${QueryColumnNames.OPERATION},
|
|
1854
|
-
'SUM' as ${QueryColumnNames.TYPE} ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
1855
|
-
FROM ? `);
|
|
1856
|
-
}
|
|
1857
|
-
/**
|
|
1858
|
-
* Manually merges drill rows that AlaSQL fails to aggregate correctly.
|
|
1859
|
-
* Groups by composite key (rowNr + rowGroup + type + category) and sums scenario values.
|
|
1860
|
-
*/
|
|
1861
|
-
reduceResDrillByCategoryGroups(resDrill, scenarioNames) {
|
|
1862
|
-
// This is workarround because alasql is not merging the rows as expected.
|
|
1863
|
-
const tmpSumMap = new Map();
|
|
1864
|
-
resDrill.forEach(function (drillItem) {
|
|
1865
|
-
const key = drillItem.rowNr + drillItem.rowGroup + drillItem.type + drillItem.category;
|
|
1866
|
-
if (tmpSumMap.has(key)) {
|
|
1867
|
-
const element = tmpSumMap.get(key);
|
|
1868
|
-
scenarioNames.forEach((key) => {
|
|
1869
|
-
try {
|
|
1870
|
-
element[key] += drillItem[key];
|
|
1871
|
-
}
|
|
1872
|
-
catch (e) {
|
|
1873
|
-
console.error("DataQuery: drill row aggregation failed", key, e);
|
|
1874
|
-
}
|
|
1875
|
-
});
|
|
1876
|
-
}
|
|
1877
|
-
else {
|
|
1878
|
-
tmpSumMap.set(key, drillItem);
|
|
1879
|
-
}
|
|
1880
|
-
});
|
|
1881
|
-
return [...tmpSumMap.values()];
|
|
1882
|
-
}
|
|
1883
|
-
/**
|
|
1884
|
-
* Inserts drill (thereof/partof) rows into the result set directly after their
|
|
1885
|
-
* parent category row. Handles both grouped and ungrouped modes, disambiguating
|
|
1886
|
-
* duplicate subCategory names by appending the rowGroup in parentheses.
|
|
1887
|
-
*/
|
|
1888
|
-
injectDrillRowsToResultRows(resDrill, res) {
|
|
1889
|
-
// resDrill = resDrill.reverse();
|
|
1890
|
-
const numberOfElement = new Map();
|
|
1891
|
-
if (this.config.grouped === true) {
|
|
1892
|
-
// finds ParentElement of Drill Element and injects into result arra
|
|
1893
|
-
resDrill.forEach(function (drillItem) {
|
|
1894
|
-
res.forEach(function (resSegment) {
|
|
1895
|
-
const index = resSegment.findIndex((e) => e.category === drillItem.category && e.rowGroup === drillItem.rowGroup);
|
|
1896
|
-
if (index >= 0) {
|
|
1897
|
-
if (numberOfElement.has(`${drillItem.category}_${drillItem.rowGroup}`)) {
|
|
1898
|
-
const num = numberOfElement.get(`${drillItem.category}_${drillItem.rowGroup}`) || 0;
|
|
1899
|
-
numberOfElement.set(`${drillItem.category}_${drillItem.rowGroup}`, num + 1);
|
|
1900
|
-
}
|
|
1901
|
-
else {
|
|
1902
|
-
numberOfElement.set(`${drillItem.category}_${drillItem.rowGroup}`, 1);
|
|
1903
|
-
}
|
|
1904
|
-
drillItem[QueryColumnNames.ROWNR] = numberOfElement.get(`${drillItem.category}_${drillItem.rowGroup}`);
|
|
1905
|
-
resSegment.splice(index + drillItem[QueryColumnNames.ROWNR], 0, drillItem);
|
|
1906
|
-
}
|
|
1907
|
-
});
|
|
1908
|
-
});
|
|
1909
|
-
}
|
|
1910
|
-
else {
|
|
1911
|
-
// if no grouped mode selected matching only searching for category not for groupname
|
|
1912
|
-
const duplicateSubCategoriesList = this.findDuplicateSubCategories(resDrill);
|
|
1913
|
-
resDrill.forEach(function (drillItem) {
|
|
1914
|
-
res.forEach(function (resSegment) {
|
|
1915
|
-
const index = resSegment.findIndex((e) => e.category != null && e.category === drillItem.category);
|
|
1916
|
-
if (index >= 0) {
|
|
1917
|
-
if (numberOfElement.has(`${drillItem.category}`)) {
|
|
1918
|
-
const num = numberOfElement.get(`${drillItem.category}`) || 0;
|
|
1919
|
-
numberOfElement.set(`${drillItem.category}`, num + 1);
|
|
1920
|
-
}
|
|
1921
|
-
else {
|
|
1922
|
-
numberOfElement.set(`${drillItem.category}`, 1);
|
|
1923
|
-
}
|
|
1924
|
-
if (drillItem[QueryColumnNames.ROWNR] === 1) {
|
|
1925
|
-
drillItem.subCategory = `${drillItem.subCategory} (${drillItem.rowGroup})`;
|
|
1926
|
-
}
|
|
1927
|
-
else if (duplicateSubCategoriesList.includes(drillItem.subCategory)) {
|
|
1928
|
-
drillItem.subCategory = `${drillItem.subCategory} (${drillItem.rowGroup})`;
|
|
1929
|
-
}
|
|
1930
|
-
resSegment.splice(index + drillItem[QueryColumnNames.ROWNR], 0, drillItem);
|
|
1931
|
-
}
|
|
1932
|
-
});
|
|
1933
|
-
});
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
/**
|
|
1937
|
-
* Creates "thereof" drill rows -- sub-breakdowns shown with absolute values
|
|
1938
|
-
* beneath their parent category row. Each thereof config entry produces a
|
|
1939
|
-
* filtered/grouped SQL query whose results are spliced into the result set.
|
|
1940
|
-
*/
|
|
1941
|
-
createThereOfDrillRows(scenarios, order, data, res) {
|
|
1942
|
-
// adds drill rows if setup in config
|
|
1943
|
-
// if there of is set drilldown row is displayed with absolute numbers,
|
|
1944
|
-
// if part of is also not null a relative percenatage based of the selected basis is displayed
|
|
1945
|
-
if (this.config.thereOf === undefined || this.config.thereOf.length === 0) {
|
|
1946
|
-
return;
|
|
1947
|
-
}
|
|
1948
|
-
const drillQueries = [];
|
|
1949
|
-
const resDrill = []; // set of drill (subquery result injected into resultset)
|
|
1950
|
-
// let rollgroups = ['category']; // frage wo kommt das her ?
|
|
1951
|
-
// create drill queryies based on config
|
|
1952
|
-
this.config.thereOf.forEach((element) => {
|
|
1953
|
-
let isFirst = true;
|
|
1954
|
-
let fromString = "1 <> 1 OR ( "; // helper for strin concat 1<>1 OR ... OR ...
|
|
1955
|
-
if (!(null == element.category || 0 === element.category.length || !element.category.trim())) {
|
|
1956
|
-
// if not empty
|
|
1957
|
-
fromString += ` ${QueryColumnNames.CATEGORY} = '${element.category}'`;
|
|
1958
|
-
isFirst = false;
|
|
1959
|
-
}
|
|
1960
|
-
if (!(null == element.rowGroup || 0 === element.rowGroup.length || !element.rowGroup.trim())) {
|
|
1961
|
-
// if not empty
|
|
1962
|
-
fromString += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.ROWGROUP} = '${element.rowGroup}'`;
|
|
1963
|
-
isFirst = false;
|
|
1964
|
-
}
|
|
1965
|
-
if (!(null == element.subCategory || 0 === element.subCategory.length || !element.subCategory.trim())) {
|
|
1966
|
-
// if not empty
|
|
1967
|
-
fromString += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.SUBCATEGORY} = '${element.subCategory}'`;
|
|
1968
|
-
}
|
|
1969
|
-
fromString += `)`;
|
|
1970
|
-
drillQueries.push(`SELECT ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
1971
|
-
null as operation,
|
|
1972
|
-
'DRILLELEMENT' as ${QueryColumnNames.TYPE},
|
|
1973
|
-
${QueryColumnNames.CATEGORY},
|
|
1974
|
-
${QueryColumnNames.SUBCATEGORY},
|
|
1975
|
-
${QueryColumnNames.ROWGROUP} as ${QueryColumnNames.ROWGROUP},
|
|
1976
|
-
${scenarios}
|
|
1977
|
-
FROM ?
|
|
1978
|
-
WHERE ${fromString}
|
|
1979
|
-
GROUP BY ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}
|
|
1980
|
-
ORDER BY ${order[1]}`);
|
|
1981
|
-
});
|
|
1982
|
-
// invertet Sort directon because the later used insertion which results into expected order direction
|
|
1983
|
-
//drillQueries.push(`SELECT ROWNUM() AS ${QueryColumnNames.ROWNR}, null as operation, 'DRILLELEMENT' as ${QueryColumnNames.TYPE}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}, ${QueryColumnNames.ROWGROUP} as ${QueryColumnNames.ROWGROUP} , ${scenarios} FROM ? WHERE ${fromString} GROUP BY ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY} ORDER BY ${order[1]}`);
|
|
1984
|
-
drillQueries.forEach(function (query) {
|
|
1985
|
-
resDrill.push(...alasql(query, [data]));
|
|
1986
|
-
});
|
|
1987
|
-
this.injectDrillRowsToResultRows(resDrill, res);
|
|
1988
|
-
}
|
|
1989
|
-
/**
|
|
1990
|
-
* Converts absolute variance columns into relative (percentage) variances by dividing
|
|
1991
|
-
* each `dr_*` cell by its denominator column (the delta scenario's aggregated value).
|
|
1992
|
-
*/
|
|
1993
|
-
calculateRelativeVariances(res, relativeScenarios) {
|
|
1994
|
-
res.forEach((group) => {
|
|
1995
|
-
group.forEach((row) => {
|
|
1996
|
-
if (row[QueryColumnNames.TYPE] !== "GROUPHEAD") {
|
|
1997
|
-
relativeScenarios.forEach((value, key) => {
|
|
1998
|
-
row[key] = row[key] / row[value];
|
|
1999
|
-
});
|
|
2000
|
-
}
|
|
2001
|
-
});
|
|
2002
|
-
});
|
|
2003
|
-
}
|
|
2004
|
-
/**
|
|
2005
|
-
* Calculates REST columns for column-level thereof drills.
|
|
2006
|
-
* REST = parent scenario value minus sum of all drilled child columns.
|
|
2007
|
-
* Columns where REST is zero across all rows are removed entirely.
|
|
2008
|
-
*/
|
|
2009
|
-
calculateColumnGroupRest(res, categoryThereOf) {
|
|
2010
|
-
if (categoryThereOf == null || categoryThereOf.size === 0) {
|
|
2011
|
-
return;
|
|
2012
|
-
}
|
|
2013
|
-
const scenarioRestMap = new Map();
|
|
2014
|
-
const scenarioRestHasValuesMap = new Map();
|
|
2015
|
-
categoryThereOf.forEach((value, key) => {
|
|
2016
|
-
const categoryDrills = value;
|
|
2017
|
-
const columnsList = [];
|
|
2018
|
-
for (const drillElement of categoryDrills) {
|
|
2019
|
-
columnsList.push(`${key}##${drillElement.name}`);
|
|
2020
|
-
}
|
|
2021
|
-
scenarioRestMap.set(key, columnsList);
|
|
2022
|
-
scenarioRestHasValuesMap.set(`${key}##REST`, false);
|
|
2023
|
-
});
|
|
2024
|
-
res.forEach((group) => {
|
|
2025
|
-
group.forEach((row) => {
|
|
2026
|
-
if (row[QueryColumnNames.TYPE] !== "GROUPHEAD") {
|
|
2027
|
-
scenarioRestMap.forEach((values, key) => {
|
|
2028
|
-
let minuent = 0;
|
|
2029
|
-
values.forEach((value) => {
|
|
2030
|
-
if (row[value] !== undefined) {
|
|
2031
|
-
minuent += row[value];
|
|
2032
|
-
}
|
|
2033
|
-
});
|
|
2034
|
-
row[`${key}##REST`] = row[key] - minuent;
|
|
2035
|
-
if (row[`${key}##REST`] !== 0) {
|
|
2036
|
-
scenarioRestHasValuesMap.set(`${key}##REST`, true);
|
|
2037
|
-
}
|
|
2038
|
-
});
|
|
2039
|
-
}
|
|
2040
|
-
});
|
|
2041
|
-
});
|
|
2042
|
-
const emptyRestColumns = Array.from(scenarioRestHasValuesMap.entries())
|
|
2043
|
-
.filter(([_key, value]) => !value)
|
|
2044
|
-
.map(([key]) => key);
|
|
2045
|
-
res.forEach((group) => {
|
|
2046
|
-
group.forEach((row) => {
|
|
2047
|
-
for (const deleteColumn of emptyRestColumns) {
|
|
2048
|
-
delete row[deleteColumn];
|
|
2049
|
-
}
|
|
2050
|
-
});
|
|
2051
|
-
});
|
|
2052
|
-
}
|
|
2053
|
-
/** Collects all relative variance scenarios and maps each to its denominator column name. */
|
|
2054
|
-
getRelativeScenarios() {
|
|
2055
|
-
const relativeScenarios = new Map();
|
|
2056
|
-
this.config.scenarios.forEach((s) => {
|
|
2057
|
-
const tmp = this.createRelativeScenario(s);
|
|
2058
|
-
if (tmp != null) {
|
|
2059
|
-
relativeScenarios.set(tmp.key, tmp.value);
|
|
2060
|
-
}
|
|
2061
|
-
});
|
|
2062
|
-
return relativeScenarios;
|
|
2063
|
-
}
|
|
2064
|
-
/**
|
|
2065
|
-
* Translates a scenario identifier into a SQL aggregation expression.
|
|
2066
|
-
*
|
|
2067
|
-
* - **OPT/OPTNOTOTAL types**: Values are summed without `transformOperator` (the
|
|
2068
|
-
* operation sign is already baked into the data). Variance scenarios produce
|
|
2069
|
-
* `SUM(base - delta)`.
|
|
2070
|
-
* - **Other types**: Each value is multiplied by `transformOperator(operation)` which
|
|
2071
|
-
* converts the `"+"` / `"-"` operation field into +1 / -1, so rows with negative
|
|
2072
|
-
* operation are subtracted from the aggregate.
|
|
2073
|
-
* - **Relative variances** (`dr_*`): additionally select the delta denominator column
|
|
2074
|
-
* so `calculateRelativeVariances` can divide later.
|
|
2075
|
-
* - A companion `_cnt` column (COUNT of non-null values) is emitted for NaN detection.
|
|
2076
|
-
*/
|
|
2077
|
-
translateScenarioSQL(scenario, isSumRow, type) {
|
|
2078
|
-
const scenarios = new VarianceScenario(scenario);
|
|
2079
|
-
if (TableType.OPT === type || TableType.OPTNOTOTAL === type) {
|
|
2080
|
-
if (scenarios.isValid) {
|
|
2081
|
-
if (scenarios.type === "dr") {
|
|
2082
|
-
return `SUM(${scenarios.base} - ${scenarios.delta}) as ${scenario}, SUM(${scenarios.delta}) as dr_${scenarios.delta}`;
|
|
2083
|
-
}
|
|
2084
|
-
else {
|
|
2085
|
-
return `SUM(${scenarios.base} - ${scenarios.delta}) as ${scenario}`;
|
|
2086
|
-
}
|
|
2087
|
-
}
|
|
2088
|
-
if (isSumRow) {
|
|
2089
|
-
return `SUM(${scenario} * transformOperator(operation)) as ${scenario}, COUNT(ISNULL(${scenario})) as ${scenario}_cnt`;
|
|
2090
|
-
}
|
|
2091
|
-
return `SUM(${scenario}) as ${scenario}, COUNT(ISNULL(${scenario})) as ${scenario}_cnt`;
|
|
2092
|
-
}
|
|
2093
|
-
if (scenarios.isValid) {
|
|
2094
|
-
if (scenarios.type === "dr") {
|
|
2095
|
-
return `SUM((${scenarios.base} * transformOperator(operation)) - (${scenarios.delta} * transformOperator(operation))) as ${scenario}, SUM(${scenarios.delta} * transformOperator(operation)) as dr_${scenarios.delta}`;
|
|
2096
|
-
}
|
|
2097
|
-
else {
|
|
2098
|
-
return `SUM((${scenarios.base} * transformOperator(operation))- (${scenarios.delta} * transformOperator(operation))) as ${scenario}`;
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
|
-
return `SUM(${scenario} * transformOperator(operation)) as ${scenario}, COUNT(ISNULL(${scenario})) as ${scenario}_cnt`;
|
|
2102
|
-
}
|
|
2103
|
-
/**
|
|
2104
|
-
* generates Tuple
|
|
2105
|
-
* [0] orderby string example: category asc
|
|
2106
|
-
* [1] inverted order example: category desc
|
|
2107
|
-
* @param orderComponent
|
|
2108
|
-
*/
|
|
2109
|
-
createOrderString(orderComponent) {
|
|
2110
|
-
const base = `${orderComponent.hierarchy.toString()} ${orderComponent.direction}`;
|
|
2111
|
-
const inverted = `${orderComponent.hierarchy.toString()} ${OrderDirection.ASC === orderComponent.direction ? OrderDirection.DESC : OrderDirection.ASC}`;
|
|
2112
|
-
return [base, inverted];
|
|
2113
|
-
}
|
|
2114
|
-
/** Returns a key/value pair mapping a relative variance column to its denominator, or null for non-relative scenarios. */
|
|
2115
|
-
createRelativeScenario(scenario) {
|
|
2116
|
-
const scenarios = new VarianceScenario(scenario);
|
|
2117
|
-
if (scenarios.isValid && scenarios.type === "dr") {
|
|
2118
|
-
return { key: `${scenario}`, value: `dr_${scenarios.delta}` };
|
|
2119
|
-
}
|
|
2120
|
-
return null;
|
|
2121
|
-
}
|
|
2122
|
-
/** Parses the comma-separated SQL scenario fragment to extract the alias names (the part after `as`). */
|
|
2123
|
-
exctractScenarioNames(scenarios) {
|
|
2124
|
-
const scenarioNames = [];
|
|
2125
|
-
scenarios.split(",").forEach((item) => (item.length >= 2 ? scenarioNames.push(item.split("as")[1].trim()) : null));
|
|
2126
|
-
return scenarioNames;
|
|
2127
|
-
}
|
|
2128
|
-
/** Identifies subCategory values that appear more than once in the drill set, requiring disambiguation. */
|
|
2129
|
-
findDuplicateSubCategories(resDrill) {
|
|
2130
|
-
const uniq = resDrill
|
|
2131
|
-
.map((element) => {
|
|
2132
|
-
return {
|
|
2133
|
-
count: 1,
|
|
2134
|
-
subCategory: element.subCategory,
|
|
2135
|
-
};
|
|
2136
|
-
})
|
|
2137
|
-
.reduce((a, b) => {
|
|
2138
|
-
a[b.subCategory] = (a[b.subCategory] || 0) + b.count;
|
|
2139
|
-
return a;
|
|
2140
|
-
}, {});
|
|
2141
|
-
return Object.keys(uniq).filter((a) => uniq[a] > 1);
|
|
2142
|
-
}
|
|
2143
|
-
/** Builds the SQL query for partof drill rows, filtering to configured partOf categories. */
|
|
2144
|
-
createPartOfQuery(scenarios, order) {
|
|
2145
|
-
var _a;
|
|
2146
|
-
const drillQueries = [];
|
|
2147
|
-
let fromString = "1 <> 1 "; // helper for strin concat 1<>1 OR ... OR ...
|
|
2148
|
-
let groupName = ` ${QueryColumnNames.ROWGROUP}`;
|
|
2149
|
-
let rowNum = "ROWNUM()";
|
|
2150
|
-
(_a = this.config.partOf) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
|
|
2151
|
-
fromString += `OR (${QueryColumnNames.CATEGORY} = '${element.category}'`;
|
|
2152
|
-
if (!(null == element.rowGroup || 0 === element.rowGroup.length || !element.rowGroup.trim())) {
|
|
2153
|
-
// if not empty
|
|
2154
|
-
fromString += `and ${QueryColumnNames.ROWGROUP} = '${element.rowGroup}'`;
|
|
2155
|
-
}
|
|
2156
|
-
if (this.config.grouped === false) {
|
|
2157
|
-
groupName = ` 'SUM_TOTAL' as ${QueryColumnNames.ROWGROUP} `;
|
|
2158
|
-
rowNum = "1";
|
|
2159
|
-
}
|
|
2160
|
-
fromString += `)`;
|
|
2161
|
-
});
|
|
2162
|
-
// let dimensionGroups = `${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}, ${QueryColumnNames.ROWGROUP}`;
|
|
2163
|
-
// invertet Sort directon because the later used insertion which results into expected order direction
|
|
2164
|
-
drillQueries.push(`SELECT ${rowNum} AS ${QueryColumnNames.ROWNR},
|
|
2165
|
-
'PARTELEMENT' as ${QueryColumnNames.TYPE},
|
|
2166
|
-
${QueryColumnNames.CATEGORY},
|
|
2167
|
-
${groupName},
|
|
2168
|
-
${scenarios}
|
|
2169
|
-
FROM ?
|
|
2170
|
-
WHERE ${fromString}
|
|
2171
|
-
GROUP BY ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.TYPE}
|
|
2172
|
-
ORDER BY ${order[1]}`);
|
|
2173
|
-
return drillQueries;
|
|
2174
|
-
}
|
|
2175
|
-
checkConfigForPartOf() {
|
|
2176
|
-
if (this.config.partOf == null || this.config.partOf.length === 0) {
|
|
2177
|
-
return false;
|
|
2178
|
-
}
|
|
2179
|
-
return true;
|
|
2180
|
-
}
|
|
2181
|
-
/**
|
|
2182
|
-
* Creates column-level thereof drill breakdowns for the configured `categoryThereOf` map.
|
|
2183
|
-
*
|
|
2184
|
-
* For each scenario key, queries are generated at multiple aggregation levels
|
|
2185
|
-
* (ENTRY, DRILLELEMENT, GROUP_SUM, SUM) crossed with column dimensions
|
|
2186
|
-
* (COLUMNGROUP, SUBGROUP). Results are stored as new properties on existing
|
|
2187
|
-
* result rows using the `"##"` separator convention: `scenario##columnGroup` or
|
|
2188
|
-
* `scenario##columnGroup##columnSubGroup`.
|
|
2189
|
-
*/
|
|
2190
|
-
createThereOfDrillColumns(categoryThereOf, data, res) {
|
|
2191
|
-
if (categoryThereOf == null || categoryThereOf.size === 0) {
|
|
2192
|
-
return;
|
|
2193
|
-
}
|
|
2194
|
-
const drillQueries = [];
|
|
2195
|
-
const resDrill = [];
|
|
2196
|
-
categoryThereOf.forEach((value, key) => {
|
|
2197
|
-
let whereClause = "1 <> 1 ";
|
|
2198
|
-
value.forEach((drillColumn) => {
|
|
2199
|
-
whereClause += ` or columnGroup = '${drillColumn.name}' `;
|
|
2200
|
-
});
|
|
2201
|
-
drillQueries.push(`SELECT 'ENTRY' as rowlevel,
|
|
2202
|
-
'COLUMNGROUP' as columnlevel,
|
|
2203
|
-
rowGroup,
|
|
2204
|
-
category,
|
|
2205
|
-
columnGroup,
|
|
2206
|
-
'${key}' as scenario,
|
|
2207
|
-
sum(${key} * transformOperator(operation)) as val
|
|
2208
|
-
FROM ?
|
|
2209
|
-
WHERE ${whereClause}
|
|
2210
|
-
GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`);
|
|
2211
|
-
drillQueries.push(`SELECT 'ENTRY' as rowlevel,
|
|
2212
|
-
'SUBGROUP' as columnlevel,
|
|
2213
|
-
rowGroup,
|
|
2214
|
-
category,
|
|
2215
|
-
columnGroup,
|
|
2216
|
-
columnSubGroup,
|
|
2217
|
-
'${key}' as scenario,
|
|
2218
|
-
sum(${key} * transformOperator(operation)) as val
|
|
2219
|
-
FROM ?
|
|
2220
|
-
WHERE ${whereClause}
|
|
2221
|
-
GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`);
|
|
2222
|
-
drillQueries.push(`SELECT 'DRILLELEMENT' as rowlevel,
|
|
2223
|
-
'COLUMNGROUP' as columnlevel,
|
|
2224
|
-
rowGroup,
|
|
2225
|
-
category,
|
|
2226
|
-
subCategory,
|
|
2227
|
-
columnGroup,
|
|
2228
|
-
'${key}' as scenario,
|
|
2229
|
-
sum(${key} * transformOperator(operation)) as val
|
|
2230
|
-
FROM ?
|
|
2231
|
-
WHERE ${whereClause}
|
|
2232
|
-
GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`);
|
|
2233
|
-
drillQueries.push(`SELECT 'DRILLELEMENT' as rowlevel,
|
|
2234
|
-
'SUBGROUP' as columnlevel,
|
|
2235
|
-
rowGroup,
|
|
2236
|
-
category,
|
|
2237
|
-
subCategory,
|
|
2238
|
-
columnGroup,
|
|
2239
|
-
columnSubGroup,
|
|
2240
|
-
'${key}' as scenario,
|
|
2241
|
-
sum(${key} * transformOperator(operation)) as val
|
|
2242
|
-
FROM ?
|
|
2243
|
-
WHERE ${whereClause}
|
|
2244
|
-
GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`);
|
|
2245
|
-
drillQueries.push(`SELECT 'GROUP_SUM' as rowlevel,
|
|
2246
|
-
'COLUMNGROUP' as columnlevel,
|
|
2247
|
-
rowGroup,
|
|
2248
|
-
columnGroup,
|
|
2249
|
-
'${key}' as scenario,
|
|
2250
|
-
sum(${key} * transformOperator(operation)) as val
|
|
2251
|
-
FROM ?
|
|
2252
|
-
WHERE ${whereClause}
|
|
2253
|
-
GROUP BY rowlevel, rowGroup, columnGroup, scenario`);
|
|
2254
|
-
drillQueries.push(`SELECT 'GROUP_SUM' as rowlevel,
|
|
2255
|
-
'SUBGROUP' as columnlevel,
|
|
2256
|
-
rowGroup,
|
|
2257
|
-
columnGroup,
|
|
2258
|
-
columnSubGroup,
|
|
2259
|
-
'${key}' as scenario,
|
|
2260
|
-
sum(${key} * transformOperator(operation)) as val
|
|
2261
|
-
FROM ?
|
|
2262
|
-
WHERE ${whereClause}
|
|
2263
|
-
GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`);
|
|
2264
|
-
drillQueries.push(`SELECT 'SUM' as rowlevel,
|
|
2265
|
-
'COLUMNGROUP' as columnlevel,
|
|
2266
|
-
columnGroup,
|
|
2267
|
-
'${key}' as scenario,
|
|
2268
|
-
sum(${key} * transformOperator(operation)) as val
|
|
2269
|
-
FROM ?
|
|
2270
|
-
WHERE ${whereClause}
|
|
2271
|
-
GROUP BY rowlevel, columnGroup, scenario`);
|
|
2272
|
-
drillQueries.push(`SELECT 'SUM' as rowlevel,
|
|
2273
|
-
'SUBGROUP' as columnlevel,
|
|
2274
|
-
columnGroup,
|
|
2275
|
-
columnSubGroup,
|
|
2276
|
-
'${key}' as scenario,
|
|
2277
|
-
sum(${key} * transformOperator(operation)) as val
|
|
2278
|
-
FROM ?
|
|
2279
|
-
WHERE ${whereClause}
|
|
2280
|
-
GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`);
|
|
2281
|
-
});
|
|
2282
|
-
for (const query of drillQueries) {
|
|
2283
|
-
resDrill.push(...alasql(query, [data]));
|
|
2284
|
-
}
|
|
2285
|
-
this.injectDrillColumnsToResultRows(resDrill, res);
|
|
2286
|
-
}
|
|
2287
|
-
/**
|
|
2288
|
-
* Merges column-drill query results into existing result rows by matching
|
|
2289
|
-
* row type, category, subCategory, and rowGroup. Uses the `"##"` separator
|
|
2290
|
-
* to form composite property keys for drill column values.
|
|
2291
|
-
*/
|
|
2292
|
-
injectDrillColumnsToResultRows(resDrill, res) {
|
|
2293
|
-
const separator = "##";
|
|
2294
|
-
for (const drillElement of resDrill) {
|
|
2295
|
-
for (const tableSegment of res) {
|
|
2296
|
-
for (const row of tableSegment) {
|
|
2297
|
-
if (row.type !== drillElement.rowlevel) {
|
|
2298
|
-
continue;
|
|
2299
|
-
}
|
|
2300
|
-
if ("ENTRY" === drillElement.rowlevel) {
|
|
2301
|
-
if (drillElement.columnlevel === "COLUMNGROUP" && row.category === drillElement.category) {
|
|
2302
|
-
row[drillElement.scenario + separator + drillElement.columnGroup] = drillElement.val;
|
|
2303
|
-
}
|
|
2304
|
-
else if (drillElement.columnlevel === "SUBGROUP" && row.category === drillElement.category) {
|
|
2305
|
-
row[drillElement.scenario + separator + drillElement.columnGroup + separator + drillElement.columnSubGroup] = drillElement.val;
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
else if ("DRILLELEMENT" === drillElement.rowlevel) {
|
|
2309
|
-
if (drillElement.columnlevel === "COLUMNGROUP" &&
|
|
2310
|
-
row.category === drillElement.category &&
|
|
2311
|
-
row.subCategory === drillElement.subCategory) {
|
|
2312
|
-
row[drillElement.scenario + separator + drillElement.columnGroup] = drillElement.val;
|
|
2313
|
-
}
|
|
2314
|
-
else if (drillElement.columnlevel === "SUBGROUP" &&
|
|
2315
|
-
row.category === drillElement.category &&
|
|
2316
|
-
row.subCategory === drillElement.subCategory) {
|
|
2317
|
-
row[drillElement.scenario + separator + drillElement.columnGroup + separator + drillElement.columnSubGroup] = drillElement.val;
|
|
2318
|
-
}
|
|
2319
|
-
else if (drillElement.columnlevel === "COLUMNGROUP" &&
|
|
2320
|
-
row.category === drillElement.category &&
|
|
2321
|
-
row.subCategory === `${drillElement.subCategory} (${drillElement.rowGroup})`) {
|
|
2322
|
-
row[drillElement.scenario + separator + drillElement.columnGroup] = drillElement.val;
|
|
2323
|
-
}
|
|
2324
|
-
else if (drillElement.columnlevel === "SUBGROUP" &&
|
|
2325
|
-
row.category === drillElement.category &&
|
|
2326
|
-
row.subCategory === `${drillElement.subCategory} (${drillElement.rowGroup})`) {
|
|
2327
|
-
row[drillElement.scenario + separator + drillElement.columnGroup + separator + drillElement.columnSubGroup] = drillElement.val;
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
else if ("SUM" === drillElement.rowlevel) {
|
|
2331
|
-
if (drillElement.columnlevel === "COLUMNGROUP" &&
|
|
2332
|
-
row.category === drillElement.category &&
|
|
2333
|
-
row.subCategory === drillElement.subCategory) {
|
|
2334
|
-
row[drillElement.scenario + separator + drillElement.columnGroup] = drillElement.val;
|
|
2335
|
-
}
|
|
2336
|
-
if (drillElement.columnlevel === "SUBGROUP" &&
|
|
2337
|
-
row.category === drillElement.category &&
|
|
2338
|
-
row.subCategory === drillElement.subCategory) {
|
|
2339
|
-
row[drillElement.scenario + separator + drillElement.columnGroup + separator + drillElement.columnSubGroup] = drillElement.val;
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
else if ("GROUP_SUM" === drillElement.rowlevel) {
|
|
2343
|
-
if (drillElement.columnlevel === "COLUMNGROUP" &&
|
|
2344
|
-
row.category === drillElement.category &&
|
|
2345
|
-
row.subCategory === drillElement.subCategory) {
|
|
2346
|
-
row[drillElement.scenario + separator + drillElement.columnGroup] = drillElement.val;
|
|
2347
|
-
}
|
|
2348
|
-
if (drillElement.columnlevel === "SUBGROUP" &&
|
|
2349
|
-
row.category === drillElement.category &&
|
|
2350
|
-
row.subCategory === drillElement.subCategory) {
|
|
2351
|
-
row[drillElement.scenario + separator + drillElement.columnGroup + separator + drillElement.columnSubGroup] = drillElement.val;
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
/**
|
|
2361
|
-
* Transforms raw query results into structured TableRow collections for header and body.
|
|
2362
|
-
*
|
|
2363
|
-
* Header normalization: prepends fixed columns (operation, category) to the configured
|
|
2364
|
-
* scenarios, then translates labels via i18n and adds separator rows for IBCS-style borders.
|
|
2365
|
-
*
|
|
2366
|
-
* Body row creation: iterates DataQuery results grouped by rowGroup, creates detail rows
|
|
2367
|
-
* with type-specific logic (GROUPHEAD, SUM, DRILLELEMENT, PARTELEMENT, ENTRY), and
|
|
2368
|
-
* translates cell values/prefixes via i18n. Supports inline bar chart columns via
|
|
2369
|
-
* columnStats calculation.
|
|
2370
|
-
*/
|
|
2371
|
-
class TableDataSetFactory {
|
|
2372
|
-
constructor() {
|
|
2373
|
-
this.normalizedHeader = [];
|
|
2374
|
-
}
|
|
2375
|
-
/**
|
|
2376
|
-
* Creates Tableheader based on the configured scenarios (in config)
|
|
2377
|
-
* the created header is stored in the dataset json
|
|
2378
|
-
* the lables are translated based on the used i18n map
|
|
2379
|
-
* based on the structure of the scenarios 'spacer'coulumns are added, to
|
|
2380
|
-
* visualise grouping.
|
|
2381
|
-
* finally a seperator header row is created for the header underlining (border)
|
|
2382
|
-
*/
|
|
2383
|
-
createHeader(type, scenarios, i18n, measureScale, measureUnit, showMeasureScale) {
|
|
2384
|
-
const header = [];
|
|
2385
|
-
this.normalizedHeader = this.normalizeHeader(type, scenarios);
|
|
2386
|
-
const headerRow = new TableRow(0, 0, TableRowType.HEADER);
|
|
2387
|
-
const separatorRow = new TableRow(1, 0, TableRowType.SEPERATORLINE);
|
|
2388
|
-
for (const scenario of this.normalizedHeader) {
|
|
2389
|
-
headerRow.createElement(Formatter.translateScenarioLabel(scenario.name, i18n), scenario.type, this.createColumnType(scenario), null, this.setHeaderPrefix(scenario, i18n, measureScale, measureUnit, showMeasureScale), null, null, null, null);
|
|
2390
|
-
separatorRow.createElement(null, scenario.type, this.createColumnType(scenario), null, null, null, null, null, null);
|
|
2391
|
-
}
|
|
2392
|
-
header.push(headerRow);
|
|
2393
|
-
header.push(separatorRow);
|
|
2394
|
-
return header;
|
|
2395
|
-
}
|
|
2396
|
-
setHeaderPrefix(scenario, i18n, measureScale, measureUnit, showMeasureScale) {
|
|
2397
|
-
let prefix = "";
|
|
2398
|
-
if (scenario.name === "category" && showMeasureScale) {
|
|
2399
|
-
if (measureScale.prefix.length !== 0 || measureUnit.length !== 0) {
|
|
2400
|
-
prefix = Formatter.translateScenarioLabel("in", i18n) + " " + measureScale.prefix + measureUnit;
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
if (scenario.order) {
|
|
2404
|
-
prefix += Formatter.translateScenarioLabel("ORDER_" + scenario.order, i18n);
|
|
2405
|
-
}
|
|
2406
|
-
return prefix;
|
|
2407
|
-
}
|
|
2408
|
-
/**
|
|
2409
|
-
* combines the default columnnames (operation and category) with the
|
|
2410
|
-
* configured scenarios.
|
|
2411
|
-
* depending of table type operation column is used (OPT) or not (SUM | LIST)
|
|
2412
|
-
* in addition the headers are sorted based on the ruleset and duplicates are removed
|
|
2413
|
-
*/
|
|
2414
|
-
normalizeHeader(type, scenarios) {
|
|
2415
|
-
let header = [
|
|
2416
|
-
{
|
|
2417
|
-
name: QueryColumnNames.CATEGORY,
|
|
2418
|
-
group: QueryColumnNames.CATEGORY,
|
|
2419
|
-
type: QueryColumnNames.CATEGORY,
|
|
2420
|
-
order: undefined,
|
|
2421
|
-
},
|
|
2422
|
-
];
|
|
2423
|
-
if (TableType.OPT === type || TableType.OPTNOTOTAL === type) {
|
|
2424
|
-
header = [
|
|
2425
|
-
{
|
|
2426
|
-
name: QueryColumnNames.OPERATION,
|
|
2427
|
-
group: QueryColumnNames.OPERATION,
|
|
2428
|
-
type: QueryColumnNames.OPERATION,
|
|
2429
|
-
order: undefined,
|
|
2430
|
-
},
|
|
2431
|
-
{
|
|
2432
|
-
name: QueryColumnNames.CATEGORY,
|
|
2433
|
-
group: QueryColumnNames.CATEGORY,
|
|
2434
|
-
type: QueryColumnNames.CATEGORY,
|
|
2435
|
-
order: undefined,
|
|
2436
|
-
},
|
|
2437
|
-
];
|
|
2438
|
-
}
|
|
2439
|
-
// NOTE: scenarios are already sorted in setConfig
|
|
2440
|
-
return [...header, ...scenarios];
|
|
2441
|
-
}
|
|
2442
|
-
/**
|
|
2443
|
-
* Creates table data colelction,
|
|
2444
|
-
* eachh row consists of data columns and 'spacer' columns which are needed to seperate
|
|
2445
|
-
* the columns correctyl (IBCS style)
|
|
2446
|
-
*/
|
|
2447
|
-
createBodyRows(config, i18n, data) {
|
|
2448
|
-
const bodyRows = [];
|
|
2449
|
-
let iGroupIndex = -1; // index used in detailRow JSON to count the current group
|
|
2450
|
-
const queryData = new DataQuery(config, i18n).execute(data); // collection of all query results
|
|
2451
|
-
// Calculate column statistics for bar columns
|
|
2452
|
-
const columnStatsMap = this.calculateColumnStatistics(queryData, config.barColumns);
|
|
2453
|
-
for (const groupData of queryData) {
|
|
2454
|
-
// groupData is a collection of dataRows, each group base on a query and represents a 'row' group
|
|
2455
|
-
iGroupIndex += 1;
|
|
2456
|
-
const iRowIndex = -1;
|
|
2457
|
-
bodyRows.push(...this.createRow(config.i18n, i18n, config.scenariosUnitType, groupData, iGroupIndex, iRowIndex, config.categoryWidth, config.measureScale, config.barColumns, columnStatsMap));
|
|
2458
|
-
}
|
|
2459
|
-
return bodyRows;
|
|
2460
|
-
}
|
|
2461
|
-
/**
|
|
2462
|
-
* Calculate min/max statistics for bar chart columns across all query data.
|
|
2463
|
-
*/
|
|
2464
|
-
calculateColumnStatistics(queryData, barColumns) {
|
|
2465
|
-
const statsMap = new Map();
|
|
2466
|
-
if (!barColumns || barColumns.length === 0) {
|
|
2467
|
-
return statsMap;
|
|
2468
|
-
}
|
|
2469
|
-
// Initialize stats for each bar column
|
|
2470
|
-
for (const column of barColumns) {
|
|
2471
|
-
statsMap.set(column, { min: Infinity, max: -Infinity, absMax: 0 });
|
|
2472
|
-
}
|
|
2473
|
-
// Iterate through all groups and rows
|
|
2474
|
-
for (const groupData of queryData) {
|
|
2475
|
-
for (const row of groupData) {
|
|
2476
|
-
for (const column of barColumns) {
|
|
2477
|
-
const value = this.extractColumnValue(row, column);
|
|
2478
|
-
if (value !== null && !isNaN(value)) {
|
|
2479
|
-
const stats = statsMap.get(column);
|
|
2480
|
-
stats.min = Math.min(stats.min, value);
|
|
2481
|
-
stats.max = Math.max(stats.max, value);
|
|
2482
|
-
}
|
|
2483
|
-
}
|
|
2484
|
-
}
|
|
2485
|
-
}
|
|
2486
|
-
// Finalize absMax values
|
|
2487
|
-
for (const [column, stats] of statsMap) {
|
|
2488
|
-
if (stats.min === Infinity || stats.max === -Infinity) {
|
|
2489
|
-
stats.min = 0;
|
|
2490
|
-
stats.max = 0;
|
|
2491
|
-
}
|
|
2492
|
-
stats.absMax = Math.max(Math.abs(stats.min), Math.abs(stats.max));
|
|
2493
|
-
statsMap.set(column, stats);
|
|
2494
|
-
}
|
|
2495
|
-
return statsMap;
|
|
2496
|
-
}
|
|
2497
|
-
/**
|
|
2498
|
-
* Extract a numeric value from a row for a given column name.
|
|
2499
|
-
* Handles the various naming conventions used in the table data.
|
|
2500
|
-
*/
|
|
2501
|
-
extractColumnValue(row, column) {
|
|
2502
|
-
// Try direct access
|
|
2503
|
-
if (row[column] !== undefined) {
|
|
2504
|
-
const val = Number(row[column]);
|
|
2505
|
-
return isNaN(val) ? null : val;
|
|
2506
|
-
}
|
|
2507
|
-
// Search for keys that match the column (handles scenario## prefix patterns)
|
|
2508
|
-
for (const key of Object.keys(row)) {
|
|
2509
|
-
if (key === column || key.endsWith("##" + column) || key === column + "##" + column) {
|
|
2510
|
-
const val = Number(row[key]);
|
|
2511
|
-
if (!isNaN(val)) {
|
|
2512
|
-
return val;
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
}
|
|
2516
|
-
return null;
|
|
2517
|
-
}
|
|
2518
|
-
/**
|
|
2519
|
-
* Helper funciton to generate a new Table Row,
|
|
2520
|
-
* it calls itsself recursive if a drilldown is set by the config file.
|
|
2521
|
-
* a drilldown is detected if there is a colection of rows in .drill
|
|
2522
|
-
*
|
|
2523
|
-
* @param i18nMode
|
|
2524
|
-
* @param i18n
|
|
2525
|
-
* @param scenariosUnitType
|
|
2526
|
-
* @param groupData
|
|
2527
|
-
* @param iGroupIndex
|
|
2528
|
-
* @param iRowIndex
|
|
2529
|
-
* @param categoryWidth
|
|
2530
|
-
* @param measureScale
|
|
2531
|
-
* @param barColumns
|
|
2532
|
-
* @param columnStatsMap
|
|
2533
|
-
*/
|
|
2534
|
-
createRow(i18nMode, i18n, scenariosUnitType, groupData, iGroupIndex, iRowIndex, categoryWidth, measureScale, barColumns, columnStatsMap) {
|
|
2535
|
-
var _a;
|
|
2536
|
-
const result = [];
|
|
2537
|
-
for (const rawDataRow of groupData) {
|
|
2538
|
-
iRowIndex += 1;
|
|
2539
|
-
// create next table row
|
|
2540
|
-
const groupName = rawDataRow[QueryColumnNames.ROWGROUP];
|
|
2541
|
-
const subCategory = rawDataRow[QueryColumnNames.SUBCATEGORY];
|
|
2542
|
-
const type = rawDataRow[QueryColumnNames.TYPE];
|
|
2543
|
-
const isSecondElement = rawDataRow[QueryColumnNames.ROWNR] >= 2;
|
|
2544
|
-
const detailsRow = this.createDetailRow(type, iRowIndex, iGroupIndex, groupData.length);
|
|
2545
|
-
for (const scenario of this.normalizedHeader) {
|
|
2546
|
-
const value = this.getRawDataRowElement(rawDataRow, scenario);
|
|
2547
|
-
const isBarChart = (_a = barColumns === null || barColumns === void 0 ? void 0 : barColumns.includes(scenario.type)) !== null && _a !== void 0 ? _a : false;
|
|
2548
|
-
const columnStats = isBarChart ? columnStatsMap === null || columnStatsMap === void 0 ? void 0 : columnStatsMap.get(scenario.type) : undefined;
|
|
2549
|
-
detailsRow.createElement(this.translateSumCellLabel(i18nMode, i18n, value, groupName, subCategory, type, scenario.type), scenario.type, this.createColumnType(scenario), this.setCellType(scenario.type, scenariosUnitType), this.translateCellPrefix(i18n, type, scenario.type), this.translateScenarioCSS(scenario.type, value), isSecondElement, categoryWidth, measureScale === null || measureScale === void 0 ? void 0 : measureScale.value, isBarChart, columnStats);
|
|
2550
|
-
}
|
|
2551
|
-
result.push(detailsRow);
|
|
2552
|
-
}
|
|
2553
|
-
return result;
|
|
2554
|
-
}
|
|
2555
|
-
getRawDataRowElement(rawDataRow, scenario) {
|
|
2556
|
-
if (scenario.name === scenario.group && scenario.name === scenario.type) {
|
|
2557
|
-
// Default Sum Scenario (e.g. AC)
|
|
2558
|
-
return rawDataRow[scenario.name];
|
|
2559
|
-
}
|
|
2560
|
-
else if (scenario.name === scenario.group && scenario.name !== scenario.type) {
|
|
2561
|
-
return rawDataRow[scenario.type + "##" + scenario.name];
|
|
2562
|
-
}
|
|
2563
|
-
return rawDataRow[scenario.type + "##" + scenario.group + "##" + scenario.name];
|
|
2564
|
-
}
|
|
2565
|
-
/**
|
|
2566
|
-
* Crates a detail row depending on the radDataRow Type
|
|
2567
|
-
* it switches between header, sum and standard,
|
|
2568
|
-
*
|
|
2569
|
-
* @param type valid values GROUPHEADER, SUM other values are interpreted as standard
|
|
2570
|
-
* @param rowIndex
|
|
2571
|
-
* @param groupIndex
|
|
2572
|
-
* @param maxIndex total number of rows
|
|
2573
|
-
*/
|
|
2574
|
-
createDetailRow(type, rowIndex, groupIndex, maxIndex) {
|
|
2575
|
-
switch (type) {
|
|
2576
|
-
case TableRowType.GROUPHEAD:
|
|
2577
|
-
return new TableRow(rowIndex, groupIndex, TableRowType.HEADER);
|
|
2578
|
-
case TableRowType.SUM:
|
|
2579
|
-
return new TableRow(maxIndex + 2, groupIndex, TableRowType.SUM);
|
|
2580
|
-
case TableRowType.GROUPSUM:
|
|
2581
|
-
return new TableRow(maxIndex + 2, groupIndex, TableRowType.SUM);
|
|
2582
|
-
case TableRowType.DRILLELEMENT:
|
|
2583
|
-
return new TableRow(maxIndex + 2, groupIndex, TableRowType.DRILLELEMENT);
|
|
2584
|
-
case TableRowType.PARTELEMENT:
|
|
2585
|
-
return new TableRow(maxIndex + 2, groupIndex, TableRowType.PARTELEMENT);
|
|
2586
|
-
default:
|
|
2587
|
-
return new TableRow(rowIndex, groupIndex, TableRowType.STANDARD);
|
|
2588
|
-
}
|
|
2589
|
-
}
|
|
2590
|
-
/**
|
|
2591
|
-
* Translates Cell-Value (value) if possible,
|
|
2592
|
-
* Numbers are not translated, just category names,
|
|
2593
|
-
* if it is a SUM ROW rowGroup is used
|
|
2594
|
-
* if it is a variance in OPT mode the absolute value is used
|
|
2595
|
-
*
|
|
2596
|
-
* @param value
|
|
2597
|
-
* @param rowGroup
|
|
2598
|
-
* @param type
|
|
2599
|
-
* @param scenario
|
|
2600
|
-
* @param subCategory
|
|
2601
|
-
*/
|
|
2602
|
-
translateSumCellLabel(i18nMode, i18n, value, rowGroup, subCategory, type, scenario) {
|
|
2603
|
-
if (Number.isNaN(Number(value)) === false) {
|
|
2604
|
-
return value;
|
|
2605
|
-
}
|
|
2606
|
-
if (this.isOperationColumn(scenario)) {
|
|
2607
|
-
return value;
|
|
2608
|
-
}
|
|
2609
|
-
if (this.isGroupHeadCategory(type, scenario)) {
|
|
2610
|
-
if (i18nMode === I18nMode.ALL) {
|
|
2611
|
-
return `${i18n.get(value) || value}`;
|
|
2612
|
-
}
|
|
2613
|
-
return value;
|
|
2614
|
-
}
|
|
2615
|
-
if (this.isEntryCategory(type, scenario)) {
|
|
2616
|
-
if (i18nMode === I18nMode.ALL) {
|
|
2617
|
-
return `${i18n.get(value) || value}`;
|
|
2618
|
-
}
|
|
2619
|
-
return value;
|
|
2620
|
-
}
|
|
2621
|
-
if (this.isDrillElementCategory(type, scenario)) {
|
|
2622
|
-
if (i18nMode === I18nMode.ALL) {
|
|
2623
|
-
return `${i18n.get(subCategory) || subCategory}`;
|
|
2624
|
-
}
|
|
2625
|
-
return `${subCategory}`;
|
|
2626
|
-
}
|
|
2627
|
-
if (this.isPartElementCategory(type, scenario)) {
|
|
2628
|
-
// translate allways because of default sum symbol.
|
|
2629
|
-
if (i18nMode === I18nMode.ALL || rowGroup === "SUM_TOTAL") {
|
|
2630
|
-
return `${i18n.get(rowGroup) || rowGroup}`;
|
|
2631
|
-
}
|
|
2632
|
-
return `${rowGroup}`;
|
|
2633
|
-
}
|
|
2634
|
-
if (this.isSumElementCategory(type, scenario)) {
|
|
2635
|
-
if (i18nMode === I18nMode.ALL || rowGroup === "SUM_TOTAL") {
|
|
2636
|
-
return `${i18n.get(rowGroup) || rowGroup}`;
|
|
2637
|
-
}
|
|
2638
|
-
return rowGroup;
|
|
2639
|
-
}
|
|
2640
|
-
if ("GROUPHEAD" === type && value == null) {
|
|
2641
|
-
return value;
|
|
2642
|
-
}
|
|
2643
|
-
if (Number.isNaN(Number(value))) {
|
|
2644
|
-
return "-";
|
|
2645
|
-
}
|
|
2646
|
-
else {
|
|
2647
|
-
return Number(value);
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
|
-
isOperationColumn(scenario) {
|
|
2651
|
-
return scenario === "operation";
|
|
2652
|
-
}
|
|
2653
|
-
/**
|
|
2654
|
-
* converts Scenario to CSS class
|
|
2655
|
-
*
|
|
2656
|
-
* @param scenario
|
|
2657
|
-
* @param value
|
|
2658
|
-
*/
|
|
2659
|
-
translateScenarioCSS(scenario, value) {
|
|
2660
|
-
const scenarios = new VarianceScenario(scenario);
|
|
2661
|
-
let prefix = "pos";
|
|
2662
|
-
if (value < 0) {
|
|
2663
|
-
prefix = "neg";
|
|
2664
|
-
}
|
|
2665
|
-
if (scenarios.isValid) {
|
|
2666
|
-
return prefix + "_" + scenarios.direction + (scenarios.type === "dr" ? " relative_variance" : "");
|
|
2667
|
-
}
|
|
2668
|
-
return scenario;
|
|
2669
|
-
}
|
|
2670
|
-
setCellType(scenario, scenariosUnitType) {
|
|
2671
|
-
if (scenario === "category") {
|
|
2672
|
-
return "";
|
|
2673
|
-
}
|
|
2674
|
-
let unitType;
|
|
2675
|
-
const scenarios = new VarianceScenario(scenario);
|
|
2676
|
-
if (scenariosUnitType === DataFormat.PERCENT) {
|
|
2677
|
-
unitType = "percent";
|
|
2678
|
-
if (scenarios.isValid && scenarios.type === "d") {
|
|
2679
|
-
unitType = "decimal";
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
else {
|
|
2683
|
-
unitType = "decimal";
|
|
2684
|
-
if (scenarios.isValid && scenarios.type === "dr") {
|
|
2685
|
-
unitType = "percent";
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
return unitType;
|
|
2689
|
-
}
|
|
2690
|
-
isDrillElementCategory(type, scenario) {
|
|
2691
|
-
return "DRILLELEMENT" === type && "category" === scenario;
|
|
2692
|
-
}
|
|
2693
|
-
isPartElementCategory(type, scenario) {
|
|
2694
|
-
return "PARTELEMENT" === type && "category" === scenario;
|
|
2695
|
-
}
|
|
2696
|
-
isSumElementCategory(type, scenario) {
|
|
2697
|
-
return ("GROUP_SUM" === type || "SUM" === type) && "category" === scenario;
|
|
2698
|
-
}
|
|
2699
|
-
isEntryCategory(type, scenario) {
|
|
2700
|
-
return "ENTRY" === type && "category" === scenario;
|
|
2701
|
-
}
|
|
2702
|
-
isGroupHeadCategory(type, scenario) {
|
|
2703
|
-
return "GROUPHEAD" === type && "category" === scenario;
|
|
2704
|
-
}
|
|
2705
|
-
translateCellPrefix(i18n, type, scenario) {
|
|
2706
|
-
if (this.isOperationColumn(scenario)) {
|
|
2707
|
-
return null;
|
|
2708
|
-
}
|
|
2709
|
-
if (this.isGroupHeadCategory(type, scenario)) {
|
|
2710
|
-
return null;
|
|
2711
|
-
}
|
|
2712
|
-
if (this.isEntryCategory(type, scenario)) {
|
|
2713
|
-
return null;
|
|
2714
|
-
}
|
|
2715
|
-
if (this.isDrillElementCategory(type, scenario)) {
|
|
2716
|
-
return `${i18n.get("there_of")} `;
|
|
2717
|
-
}
|
|
2718
|
-
if (this.isPartElementCategory(type, scenario)) {
|
|
2719
|
-
// translate allways because of default sum symbol.
|
|
2720
|
-
return `${i18n.get("part_of")} `;
|
|
2721
|
-
}
|
|
2722
|
-
return null;
|
|
2723
|
-
}
|
|
2724
|
-
createColumnType(scenario) {
|
|
2725
|
-
if (scenario.name === scenario.group && scenario.name === scenario.type) {
|
|
2726
|
-
return "base";
|
|
2727
|
-
}
|
|
2728
|
-
if (scenario.name === scenario.group) {
|
|
2729
|
-
return "columnGroup";
|
|
2730
|
-
}
|
|
2731
|
-
return "columnSubGroup";
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
|
|
2735
|
-
/**
|
|
2736
|
-
* High-level controller for IBCS table generation.
|
|
2737
|
-
*
|
|
2738
|
-
* Coordinates the data pipeline: raw data is filtered via AlaSQL, scenarios are
|
|
2739
|
-
* sorted by the visualization rule set, and TableDataSetFactory produces the
|
|
2740
|
-
* header rows (with i18n-translated labels) and body rows (with grouped/drilled data).
|
|
2741
|
-
*
|
|
2742
|
-
* Uses a dirty-flag pattern (FactoryState) to lazily regenerate header/body rows
|
|
2743
|
-
* only when configuration, data, or i18n changes. getHeader() and getBody() trigger
|
|
2744
|
-
* regeneration if the state is dirty.
|
|
2745
|
-
*/
|
|
2746
|
-
class Table {
|
|
2747
|
-
/**
|
|
2748
|
-
* Initialises all Variables for the DataSet, created by the factory
|
|
2749
|
-
* @param ruleSet
|
|
2750
|
-
*/
|
|
2751
|
-
constructor(ruleSet, data, config) {
|
|
2752
|
-
this.data = [];
|
|
2753
|
-
this.headerRows = [];
|
|
2754
|
-
this.bodyRows = [];
|
|
2755
|
-
this.ruleSet = ruleSet || new IBCSRuleSet();
|
|
2756
|
-
this.dataSetFactory = new TableDataSetFactory();
|
|
2757
|
-
this.config = this.initConfig(config);
|
|
2758
|
-
this.i18n = this.initI18n(new Map());
|
|
2759
|
-
this.setData(data, config.filter);
|
|
2760
|
-
this.state = FactoryState.DIRTY;
|
|
2761
|
-
}
|
|
2762
|
-
/**
|
|
2763
|
-
* Init load of translation dictionary map
|
|
2764
|
-
* map is used to translate lables in the table
|
|
2765
|
-
*
|
|
2766
|
-
* example:
|
|
2767
|
-
* ```
|
|
2768
|
-
* let i18n: Map<string, string> = new Map();
|
|
2769
|
-
* [{key: 'ac',value: 'AC'}].forEach(function(entry){
|
|
2770
|
-
* i18n.set(entry.key, entry.value);
|
|
2771
|
-
* })
|
|
2772
|
-
* ```
|
|
2773
|
-
* @param i18n
|
|
2774
|
-
*/
|
|
2775
|
-
setI18n(i18n) {
|
|
2776
|
-
this.i18n = this.initI18n(i18n);
|
|
2777
|
-
}
|
|
2778
|
-
initI18n(i18n) {
|
|
2779
|
-
const defaultI18n = new Map([
|
|
2780
|
-
["", ""],
|
|
2781
|
-
["SEPERATOR_WS", ", "],
|
|
2782
|
-
["in", "in"],
|
|
2783
|
-
["ORDER_asc", "↑"],
|
|
2784
|
-
["ORDER_desc", "↓"],
|
|
2785
|
-
["ac1", "AC"],
|
|
2786
|
-
["pp1", "PY"],
|
|
2787
|
-
["fc1", "FC"],
|
|
2788
|
-
["pl1", "PL"],
|
|
2789
|
-
["ac2", "AC2"],
|
|
2790
|
-
["pp2", "PY2"],
|
|
2791
|
-
["fc2", "FC2"],
|
|
2792
|
-
["pl2", "PL2"],
|
|
2793
|
-
["ac3", "AC3"],
|
|
2794
|
-
["pp3", "PY3"],
|
|
2795
|
-
["fc3", "FC3"],
|
|
2796
|
-
["pl3", "PL3"],
|
|
2797
|
-
["ac4", "AC4"],
|
|
2798
|
-
["pp4", "PY4"],
|
|
2799
|
-
["fc4", "FC4"],
|
|
2800
|
-
["pl4", "PL4"],
|
|
2801
|
-
["in", "in"],
|
|
2802
|
-
["category", " "],
|
|
2803
|
-
["operation", " "],
|
|
2804
|
-
["there_of", "davon"],
|
|
2805
|
-
["part_of", "in % von"],
|
|
2806
|
-
["ibcssymbol_delta_ac", "Δ{%}"],
|
|
2807
|
-
["ibcssymbol_delta_generic", "Δ({%})"],
|
|
2808
|
-
["ibcssymbol_delta_ac_relative", "Δ{%}%"],
|
|
2809
|
-
["ibcssymbol_delta_generic_relative", "Δ({%})%"],
|
|
2810
|
-
["SUM_TOTAL", "❖"],
|
|
2811
|
-
]);
|
|
2812
|
-
this.state = FactoryState.DIRTY; // mark dataSet for update
|
|
2813
|
-
return new Map([...defaultI18n, ...(i18n || new Map())]);
|
|
2814
|
-
}
|
|
2815
|
-
initConfig(config) {
|
|
2816
|
-
this.state = FactoryState.DIRTY; // mark dataSet for update
|
|
2817
|
-
const tmpConfig = config;
|
|
2818
|
-
// sorting scenario order based on Ruleset
|
|
2819
|
-
const self = this;
|
|
2820
|
-
config.scenarios.sort((n1, n2) => {
|
|
2821
|
-
return self.ruleSet.getScenarioSorIndex(n1) - self.ruleSet.getScenarioSorIndex(n2);
|
|
2822
|
-
});
|
|
2823
|
-
return tmpConfig;
|
|
2824
|
-
}
|
|
2825
|
-
/**
|
|
2826
|
-
* loads and varifies configuration which describes
|
|
2827
|
-
* the filte for the to be generated dataset
|
|
2828
|
-
*
|
|
2829
|
-
* missing but necessary attributes are replaced by default values
|
|
2830
|
-
*
|
|
2831
|
-
* @param config
|
|
2832
|
-
*/
|
|
2833
|
-
setConfig(config) {
|
|
2834
|
-
this.config = this.initConfig(config);
|
|
2835
|
-
}
|
|
2836
|
-
setData(data, filter) {
|
|
2837
|
-
if (data == null) {
|
|
2838
|
-
return;
|
|
2839
|
-
}
|
|
2840
|
-
if (filter != null && filter.length > 0) {
|
|
2841
|
-
try {
|
|
2842
|
-
this.data = alasql(`SELECT * FROM ? WHERE ${filter}`, [data]);
|
|
2843
|
-
}
|
|
2844
|
-
catch (e) {
|
|
2845
|
-
console.error("Table: filter query failed, using unfiltered data", filter, e);
|
|
2846
|
-
this.data = data;
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
else {
|
|
2850
|
-
this.data = data;
|
|
2851
|
-
}
|
|
2852
|
-
const normalizedScenarios = this.normalizeScenarios(this.config.scenarios, this.config.categoryThereOf, this.config.sortOrder);
|
|
2853
|
-
this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale);
|
|
2854
|
-
this.bodyRows = this.dataSetFactory.createBodyRows(this.config, this.i18n, this.data);
|
|
2855
|
-
this.state = FactoryState.UP_TO_DATE;
|
|
2856
|
-
}
|
|
2857
|
-
update() {
|
|
2858
|
-
const normalizedScenarios = this.normalizeScenarios(this.config.scenarios, this.config.categoryThereOf, this.config.sortOrder);
|
|
2859
|
-
this.headerRows = this.dataSetFactory.createHeader(this.config.type, normalizedScenarios, this.i18n, this.config.measureScale, this.config.measureUnit, this.config.showMeasureScale);
|
|
2860
|
-
this.bodyRows = this.dataSetFactory.createBodyRows(this.config, this.i18n, this.data);
|
|
2861
|
-
this.state = FactoryState.UP_TO_DATE;
|
|
2862
|
-
}
|
|
2863
|
-
getHeader() {
|
|
2864
|
-
if (this.state === FactoryState.DIRTY) {
|
|
2865
|
-
this.update();
|
|
2866
|
-
}
|
|
2867
|
-
return this.headerRows;
|
|
2868
|
-
}
|
|
2869
|
-
getBody() {
|
|
2870
|
-
if (this.state === FactoryState.DIRTY) {
|
|
2871
|
-
this.update();
|
|
2872
|
-
}
|
|
2873
|
-
return this.bodyRows;
|
|
2874
|
-
}
|
|
2875
|
-
normalizeScenarios(scenarios, categoryThereOf, order) {
|
|
2876
|
-
var _a;
|
|
2877
|
-
const normalizedScenarios = [];
|
|
2878
|
-
for (const scenario of scenarios) {
|
|
2879
|
-
if (categoryThereOf === null || categoryThereOf === void 0 ? void 0 : categoryThereOf.has(scenario)) {
|
|
2880
|
-
const categoryDrills = categoryThereOf.get(scenario);
|
|
2881
|
-
for (const drillElement of categoryDrills) {
|
|
2882
|
-
normalizedScenarios.push({
|
|
2883
|
-
name: drillElement.name,
|
|
2884
|
-
group: drillElement.name,
|
|
2885
|
-
type: scenario,
|
|
2886
|
-
order: undefined,
|
|
2887
|
-
});
|
|
2888
|
-
for (const drillSubElement of drillElement.subGroups) {
|
|
2889
|
-
normalizedScenarios.push({
|
|
2890
|
-
name: drillSubElement,
|
|
2891
|
-
group: drillElement.name,
|
|
2892
|
-
type: scenario,
|
|
2893
|
-
order: undefined,
|
|
2894
|
-
});
|
|
2895
|
-
}
|
|
2896
|
-
}
|
|
2897
|
-
normalizedScenarios.push({ name: "REST", group: "REST", type: scenario, order: undefined });
|
|
2898
|
-
}
|
|
2899
|
-
let orderDirection = undefined;
|
|
2900
|
-
if (((_a = order === null || order === void 0 ? void 0 : order.hierarchy) === null || _a === void 0 ? void 0 : _a.at(0)) === scenario) {
|
|
2901
|
-
orderDirection = order.direction;
|
|
2902
|
-
}
|
|
2903
|
-
normalizedScenarios.push({ name: scenario, group: scenario, type: scenario, order: orderDirection });
|
|
2904
|
-
}
|
|
2905
|
-
return normalizedScenarios;
|
|
2906
|
-
}
|
|
2907
|
-
hasNoData() {
|
|
2908
|
-
return this.data.length === 0;
|
|
2909
|
-
}
|
|
2910
|
-
}
|
|
2911
|
-
|
|
2912
|
-
/**
|
|
2913
|
-
* Configuration for an IBCS table component.
|
|
2914
|
-
*
|
|
2915
|
-
* Controls table behavior including drill-down groups, data formatting, and display modes.
|
|
2916
|
-
*
|
|
2917
|
-
* Drill-down concepts:
|
|
2918
|
-
* - **thereOf** -- Sub-rows that break down a parent row's total (e.g. "thereof: domestic / international").
|
|
2919
|
-
* Configured as an array of {@link TableDrillGroup} filters.
|
|
2920
|
-
* - **partOf** -- Rows shown as a percentage share of a parent total.
|
|
2921
|
-
* Also configured via {@link TableDrillGroup} filters.
|
|
2922
|
-
* - **categoryThereOf** -- Column-level drill-down using the `##` separator convention in category names
|
|
2923
|
-
* (e.g. `"Revenue##Product A"`) to expand a single category column into detail sub-columns.
|
|
2924
|
-
* The Map key is the parent category, values are the detail records.
|
|
2925
|
-
*/
|
|
2926
|
-
class TableComponentConfig {
|
|
2927
|
-
constructor() {
|
|
2928
|
-
this.title = "";
|
|
2929
|
-
/** Active scenario column names (e.g. `["ac1", "pl1"]`). */
|
|
2930
|
-
this.scenarios = [];
|
|
2931
|
-
/** Number format for scenario values (decimal, percent, etc.). */
|
|
2932
|
-
this.scenariosUnitType = DataFormat.DECIMAL;
|
|
2933
|
-
/** When true, rows are visually grouped by rowGroup. */
|
|
2934
|
-
this.grouped = false;
|
|
2935
|
-
this.showGroupTitle = true;
|
|
2936
|
-
/** Drill-down sub-row definitions -- "thereof" breakdowns within a category. */
|
|
2937
|
-
this.thereOf = [];
|
|
2938
|
-
/** Column-level drill-down using `##` separator in category names. */
|
|
2939
|
-
this.categoryThereOf = new Map();
|
|
2940
|
-
/** Percentage-of-total sub-row definitions. */
|
|
2941
|
-
this.partOf = [];
|
|
2942
|
-
this.sortOrder = new OrderAdapter(new StringAdapter()).default();
|
|
2943
|
-
/** Table aggregation mode: LIST (flat), SUM (with totals), OPT (with optional totals), etc. */
|
|
2944
|
-
this.type = TableType.LIST;
|
|
2945
|
-
/** Maximum rows to display; 0 means unlimited. */
|
|
2946
|
-
this.limit = 0;
|
|
2947
|
-
this.i18n = I18nMode.ALL;
|
|
2948
|
-
/** Proportion of table width allocated to the category label column. */
|
|
2949
|
-
this.categoryWidth = TableCategoryWidth.W25;
|
|
2950
|
-
/** SI prefix for measure scaling (e.g. "k" for thousands, "M" for millions). */
|
|
2951
|
-
this.measureScale = new SiPrefix();
|
|
2952
|
-
/** Unit label displayed in the table header (e.g. "EUR", "USD"). */
|
|
2953
|
-
this.measureUnit = "";
|
|
2954
|
-
/** Whether the measure represents a volume or a ratio, affecting formatting. */
|
|
2955
|
-
this.measureType = MeasureType.VOLUME;
|
|
2956
|
-
this.showMeasureScale = true;
|
|
2957
|
-
/** AlaSQL WHERE clause for additional row filtering. */
|
|
2958
|
-
this.filter = "";
|
|
2959
|
-
/** Scenario columns to render as inline bar charts instead of numbers. */
|
|
2960
|
-
this.barColumns = [];
|
|
2961
|
-
}
|
|
2962
|
-
}
|
|
2963
|
-
/**
|
|
2964
|
-
* Converts untyped JSON into a validated {@link TableComponentConfig}.
|
|
2965
|
-
*
|
|
2966
|
-
* Requires the raw dataset for measure scale auto-calculation when `measureScale` is set to "auto".
|
|
2967
|
-
*/
|
|
2968
|
-
class TableComponentConfigAdapter {
|
|
2969
|
-
constructor(tableDrillGroupAdapter, stringAdapter, orderAdapter, dataSet) {
|
|
2970
|
-
this.tableDrillGroupAdapter = tableDrillGroupAdapter;
|
|
2971
|
-
this.stringAdapter = stringAdapter;
|
|
2972
|
-
this.orderAdapter = orderAdapter;
|
|
2973
|
-
this.dataSet = dataSet;
|
|
2974
|
-
}
|
|
2975
|
-
adapt(data) {
|
|
2976
|
-
const config = new TableComponentConfig();
|
|
2977
|
-
if (CompareUtil.isString(data.title)) {
|
|
2978
|
-
config.title = data.title;
|
|
2979
|
-
}
|
|
2980
|
-
if (CompareUtil.isArray(data.scenarios)) {
|
|
2981
|
-
config.scenarios = AdapterUtils.adaptArray(data.scenarios, this.stringAdapter);
|
|
2982
|
-
}
|
|
2983
|
-
if (CompareUtil.isExisting(data.scenariosUnitType)) {
|
|
2984
|
-
config.scenariosUnitType = data.scenariosUnitType;
|
|
2985
|
-
}
|
|
2986
|
-
if (CompareUtil.isBoolean(data.grouped)) {
|
|
2987
|
-
config.grouped = data.grouped;
|
|
2988
|
-
}
|
|
2989
|
-
if (CompareUtil.isBoolean(data.showGroupTitle)) {
|
|
2990
|
-
config.showGroupTitle = data.showGroupTitle;
|
|
2991
|
-
}
|
|
2992
|
-
if (CompareUtil.isBoolean(data.showMeasureScale)) {
|
|
2993
|
-
config.showMeasureScale = data.showMeasureScale;
|
|
2994
|
-
}
|
|
2995
|
-
if (CompareUtil.isArray(data.thereOf)) {
|
|
2996
|
-
config.thereOf = AdapterUtils.adaptArray(data.thereOf, this.tableDrillGroupAdapter);
|
|
2997
|
-
}
|
|
2998
|
-
if (CompareUtil.isExisting(data.categoryThereOf)) {
|
|
2999
|
-
config.categoryThereOf = data.categoryThereOf;
|
|
3000
|
-
}
|
|
3001
|
-
if (CompareUtil.isArray(data.partOf)) {
|
|
3002
|
-
config.partOf = AdapterUtils.adaptArray(data.partOf, this.tableDrillGroupAdapter);
|
|
3003
|
-
}
|
|
3004
|
-
if (CompareUtil.isExisting(data.order)) {
|
|
3005
|
-
config.sortOrder = this.orderAdapter.adapt(data.order);
|
|
3006
|
-
}
|
|
3007
|
-
if (CompareUtil.isExisting(data.type)) {
|
|
3008
|
-
config.type = data.type;
|
|
3009
|
-
}
|
|
3010
|
-
if (CompareUtil.isNumber(data.limit)) {
|
|
3011
|
-
config.limit = data.limit;
|
|
3012
|
-
}
|
|
3013
|
-
if (CompareUtil.isExisting(data.i18n)) {
|
|
3014
|
-
config.i18n = data.i18n;
|
|
3015
|
-
}
|
|
3016
|
-
if (CompareUtil.isExisting(data.categoryWidth)) {
|
|
3017
|
-
config.categoryWidth = data.categoryWidth;
|
|
3018
|
-
}
|
|
3019
|
-
if (CompareUtil.isExisting(data.measureScale)) {
|
|
3020
|
-
config.measureScale = DataAnalyzer.calculateMeasureScale(this.dataSet, config.scenarios, data.measureScale);
|
|
3021
|
-
}
|
|
3022
|
-
if (CompareUtil.isExisting(data.measureType)) {
|
|
3023
|
-
config.measureType = data.measureType;
|
|
3024
|
-
}
|
|
3025
|
-
if (CompareUtil.isString(data.measureUnit)) {
|
|
3026
|
-
config.measureUnit = data.measureUnit;
|
|
3027
|
-
}
|
|
3028
|
-
if (CompareUtil.isString(data.filter)) {
|
|
3029
|
-
config.filter = data.filter.trim();
|
|
3030
|
-
}
|
|
3031
|
-
if (CompareUtil.isArray(data.barColumns)) {
|
|
3032
|
-
config.barColumns = data.barColumns;
|
|
3033
|
-
}
|
|
3034
|
-
return config;
|
|
3035
|
-
}
|
|
3036
|
-
default() {
|
|
3037
|
-
return new TableComponentConfig();
|
|
3038
|
-
}
|
|
3039
|
-
}
|
|
3040
|
-
|
|
3041
|
-
// import { IAdapter } from "../../../../utils/helper/IAdapter";
|
|
3042
|
-
// import { CompareUtil } from "../../../../utils/helper/CompareUtil";
|
|
3043
|
-
/**
|
|
3044
|
-
* Filter definition for a table drill-down operation (thereOf or partOf).
|
|
3045
|
-
*
|
|
3046
|
-
* Identifies which rows in the dataset participate in a drill-down group by matching
|
|
3047
|
-
* on the three-level row hierarchy. For partOf drill-downs, the {@link partOf} field
|
|
3048
|
-
* names the parent category whose total is used as the 100% reference.
|
|
3049
|
-
*/
|
|
3050
|
-
class TableDrillGroup {
|
|
3051
|
-
constructor() {
|
|
3052
|
-
this.rowGroup = "";
|
|
3053
|
-
this.category = "";
|
|
3054
|
-
this.subCategory = "";
|
|
3055
|
-
/** Parent category name for percentage-of-total (partOf) calculations. Empty for thereOf groups. */
|
|
3056
|
-
this.partOf = "";
|
|
3057
|
-
}
|
|
3058
|
-
}
|
|
3059
|
-
/** Converts untyped JSON into a validated {@link TableDrillGroup}. */
|
|
3060
|
-
class TableDrillGroupAdapter {
|
|
3061
|
-
constructor() { }
|
|
3062
|
-
adapt(data) {
|
|
3063
|
-
const group = new TableDrillGroup();
|
|
3064
|
-
if (CompareUtil.isString(data.rowGroup)) {
|
|
3065
|
-
group.rowGroup = data.rowGroup;
|
|
3066
|
-
}
|
|
3067
|
-
if (CompareUtil.isString(data.category)) {
|
|
3068
|
-
group.category = data.category;
|
|
3069
|
-
}
|
|
3070
|
-
if (CompareUtil.isString(data.subCategory)) {
|
|
3071
|
-
group.subCategory = data.subCategory;
|
|
3072
|
-
}
|
|
3073
|
-
if (CompareUtil.isString(data.partOf)) {
|
|
3074
|
-
group.partOf = data.partOf;
|
|
3075
|
-
}
|
|
3076
|
-
return group;
|
|
3077
|
-
}
|
|
3078
|
-
default() {
|
|
3079
|
-
return new TableDrillGroup();
|
|
3080
|
-
}
|
|
3081
|
-
}
|
|
3082
|
-
|
|
3083
|
-
// import { IAdapter } from "../../../../utils/helper/IAdapter";
|
|
3084
|
-
// import { CompareUtil } from "../../../../utils/helper/CompareUtil";
|
|
3085
|
-
/**
|
|
3086
|
-
* IBCS-compliant data row for table visualizations.
|
|
3087
|
-
*
|
|
3088
|
-
* Represents a single record with a three-level row hierarchy (rowGroup > category > subCategory),
|
|
3089
|
-
* a two-level column hierarchy (columnGroup > columnSubGroup), and 16 scenario value slots across
|
|
3090
|
-
* four scenario types: actual (ac1-4), previous period (pp1-4), forecast (fc1-4), and plan (pl1-4).
|
|
3091
|
-
*
|
|
3092
|
-
* The {@link operation} field controls how this row participates in aggregations:
|
|
3093
|
-
* `"+"` adds and `"-"` subtracts the row's values. This is converted to a numeric multiplier
|
|
3094
|
-
* by `transformOperator()` in the SQL query engine.
|
|
3095
|
-
*/
|
|
3096
|
-
class TableDataRow {
|
|
3097
|
-
constructor() {
|
|
3098
|
-
/** Aggregation operator: `"+"` adds values, `"-"` subtracts them in SUM/OPT roll-ups. */
|
|
3099
|
-
this.operation = "+";
|
|
3100
|
-
}
|
|
3101
|
-
addRowGroup(name, index) {
|
|
3102
|
-
this.rowGroup = name;
|
|
3103
|
-
this.rowGroupIndex = index;
|
|
3104
|
-
}
|
|
3105
|
-
addCategory(name, index) {
|
|
3106
|
-
this.category = name;
|
|
3107
|
-
this.categoryIndex = index;
|
|
3108
|
-
}
|
|
3109
|
-
addSubCategory(name, index) {
|
|
3110
|
-
this.subCategory = name;
|
|
3111
|
-
this.subCategoryIndex = index;
|
|
3112
|
-
}
|
|
3113
|
-
addColumnGroup(name, index) {
|
|
3114
|
-
this.columnGroup = name;
|
|
3115
|
-
this.columnGroupIndex = index;
|
|
3116
|
-
}
|
|
3117
|
-
addSubColumnGroup(name, index) {
|
|
3118
|
-
this.columnSubGroup = name;
|
|
3119
|
-
this.columnSubGroupIndex = index;
|
|
3120
|
-
}
|
|
3121
|
-
}
|
|
3122
|
-
/**
|
|
3123
|
-
* Converts untyped JSON records into validated {@link TableDataRow} instances.
|
|
3124
|
-
*
|
|
3125
|
-
* Only assigns fields that pass type validation via {@link CompareUtil}, so malformed
|
|
3126
|
-
* input data is silently dropped and defaults are preserved.
|
|
3127
|
-
*/
|
|
3128
|
-
class TableDataRowAdapter {
|
|
3129
|
-
constructor() { }
|
|
3130
|
-
adapt(data) {
|
|
3131
|
-
const dataRow = new TableDataRow();
|
|
3132
|
-
if (CompareUtil.isOperator(data.operation)) {
|
|
3133
|
-
dataRow.operation = data.operation;
|
|
3134
|
-
}
|
|
3135
|
-
if (CompareUtil.isNumber(data.rowGroupIndex) && CompareUtil.isString(data.rowGroup)) {
|
|
3136
|
-
dataRow.addRowGroup(data.rowGroup, data.rowGroupIndex);
|
|
3137
|
-
}
|
|
3138
|
-
if (CompareUtil.isNumber(data.categoryIndex) && CompareUtil.isString(data.category)) {
|
|
3139
|
-
dataRow.addCategory(data.category, data.categoryIndex);
|
|
3140
|
-
}
|
|
3141
|
-
if (CompareUtil.isNumber(data.subCategoryIndex) && CompareUtil.isString(data.subCategory)) {
|
|
3142
|
-
dataRow.addSubCategory(data.subCategory, data.subCategoryIndex);
|
|
3143
|
-
}
|
|
3144
|
-
if (CompareUtil.isNumber(data.columnGroupIndex) && CompareUtil.isString(data.columnGroup)) {
|
|
3145
|
-
dataRow.addColumnGroup(data.columnGroup, data.columnGroupIndex);
|
|
3146
|
-
}
|
|
3147
|
-
if (CompareUtil.isNumber(data.columnSubGroupIndex) && CompareUtil.isString(data.columnSubGroup)) {
|
|
3148
|
-
dataRow.addSubColumnGroup(data.columnSubGroup, data.columnSubGroupIndex);
|
|
3149
|
-
}
|
|
3150
|
-
this.setActualValues(data, dataRow);
|
|
3151
|
-
this.setPlanValues(data, dataRow);
|
|
3152
|
-
this.setPreviousPeriodValues(data, dataRow);
|
|
3153
|
-
this.setForecastValues(data, dataRow);
|
|
3154
|
-
return dataRow;
|
|
3155
|
-
}
|
|
3156
|
-
default() {
|
|
3157
|
-
return new TableDataRow();
|
|
3158
|
-
}
|
|
3159
|
-
setActualValues(data, dataRow) {
|
|
3160
|
-
if (CompareUtil.isNumber(data.ac1)) {
|
|
3161
|
-
dataRow.ac1 = data.ac1;
|
|
3162
|
-
}
|
|
3163
|
-
if (CompareUtil.isNumber(data.ac2)) {
|
|
3164
|
-
dataRow.ac2 = data.ac2;
|
|
3165
|
-
}
|
|
3166
|
-
if (CompareUtil.isNumber(data.ac3)) {
|
|
3167
|
-
dataRow.ac3 = data.ac3;
|
|
3168
|
-
}
|
|
3169
|
-
if (CompareUtil.isNumber(data.ac4)) {
|
|
3170
|
-
dataRow.ac4 = data.ac4;
|
|
3171
|
-
}
|
|
3172
|
-
}
|
|
3173
|
-
setPlanValues(data, dataRow) {
|
|
3174
|
-
if (CompareUtil.isNumber(data.pp1)) {
|
|
3175
|
-
dataRow.pp1 = data.pp1;
|
|
3176
|
-
}
|
|
3177
|
-
if (CompareUtil.isNumber(data.pp2)) {
|
|
3178
|
-
dataRow.pp2 = data.pp2;
|
|
3179
|
-
}
|
|
3180
|
-
if (CompareUtil.isNumber(data.pp3)) {
|
|
3181
|
-
dataRow.pp3 = data.pp3;
|
|
3182
|
-
}
|
|
3183
|
-
if (CompareUtil.isNumber(data.pp4)) {
|
|
3184
|
-
dataRow.pp4 = data.pp4;
|
|
3185
|
-
}
|
|
3186
|
-
}
|
|
3187
|
-
setPreviousPeriodValues(data, dataRow) {
|
|
3188
|
-
if (CompareUtil.isNumber(data.pl1)) {
|
|
3189
|
-
dataRow.pl1 = data.pl1;
|
|
3190
|
-
}
|
|
3191
|
-
if (CompareUtil.isNumber(data.pl2)) {
|
|
3192
|
-
dataRow.pl2 = data.pl2;
|
|
3193
|
-
}
|
|
3194
|
-
if (CompareUtil.isNumber(data.pl3)) {
|
|
3195
|
-
dataRow.pl3 = data.pl3;
|
|
3196
|
-
}
|
|
3197
|
-
if (CompareUtil.isNumber(data.pl4)) {
|
|
3198
|
-
dataRow.pl4 = data.pl4;
|
|
3199
|
-
}
|
|
3200
|
-
}
|
|
3201
|
-
setForecastValues(data, dataRow) {
|
|
3202
|
-
if (CompareUtil.isNumber(data.fc1)) {
|
|
3203
|
-
dataRow.fc1 = data.fc1;
|
|
3204
|
-
}
|
|
3205
|
-
if (CompareUtil.isNumber(data.fc2)) {
|
|
3206
|
-
dataRow.fc2 = data.fc2;
|
|
3207
|
-
}
|
|
3208
|
-
if (CompareUtil.isNumber(data.fc3)) {
|
|
3209
|
-
dataRow.fc3 = data.fc3;
|
|
3210
|
-
}
|
|
3211
|
-
if (CompareUtil.isNumber(data.fc4)) {
|
|
3212
|
-
dataRow.fc4 = data.fc4;
|
|
3213
|
-
}
|
|
3214
|
-
}
|
|
3215
|
-
}
|
|
3216
|
-
|
|
3217
|
-
const ibcsTableCss = () => `:host{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral{text-align:right}.category-inf{max-width:1000em}.category-w100{max-width:100em}.category-w50{max-width:50em}.category-w25{max-width:25em}.category-w20{max-width:20em}.category-w15{max-width:15em}.category-w10{max-width:10em}.category-w5{max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em dashed #ddd;padding-left:0.5em;max-width:15em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}`;
|
|
3218
|
-
|
|
3219
|
-
const IbcsTable = class {
|
|
3220
|
-
constructor(hostRef) {
|
|
3221
|
-
registerInstance(this, hostRef);
|
|
3222
|
-
this.data = [];
|
|
3223
|
-
this.tableTitle = "SUM_TOTAL";
|
|
3224
|
-
this.scenarios = [];
|
|
3225
|
-
this.scenariosDataFormat = DataFormat.DECIMAL;
|
|
3226
|
-
this.grouped = false;
|
|
3227
|
-
this.limit = 0;
|
|
3228
|
-
this.showGroupTitle = true;
|
|
3229
|
-
this.thereof = [];
|
|
3230
|
-
this.partof = [];
|
|
3231
|
-
this.order = {
|
|
3232
|
-
hierarchy: [],
|
|
3233
|
-
direction: OrderDirection.ASC,
|
|
3234
|
-
};
|
|
3235
|
-
this.categorythereof = new Map();
|
|
3236
|
-
this.type = TableType.LIST;
|
|
3237
|
-
this.categoryWidth = TableCategoryWidth.INF;
|
|
3238
|
-
this.dataFormatDigits = { percent: 2, decimal: 1 };
|
|
3239
|
-
this.i18n = new Map();
|
|
3240
|
-
this.i18nMode = I18nMode.ALL;
|
|
3241
|
-
this.measureScale = "_";
|
|
3242
|
-
this.measureUnit = "";
|
|
3243
|
-
this.showMeasureScale = true;
|
|
3244
|
-
this.measureType = MeasureType.VOLUME;
|
|
3245
|
-
this.filter = "";
|
|
3246
|
-
this.barColumns = [];
|
|
3247
|
-
this.unitScaling = 0.01;
|
|
3248
|
-
this.percentageScaling = 0.5;
|
|
3249
|
-
this.scaleFactor = 1;
|
|
3250
|
-
this.componentDataFormatDigits = new DataFormatDigits();
|
|
3251
|
-
this.componentStyle = withComponentStyle(this);
|
|
3252
|
-
}
|
|
3253
|
-
render() {
|
|
3254
|
-
const helper = () => {
|
|
3255
|
-
if (this.table === undefined) {
|
|
3256
|
-
return;
|
|
3257
|
-
}
|
|
3258
|
-
if (this.table.hasNoData()) {
|
|
3259
|
-
const errorMsg = this.i18n.get("NO_DATA") || "==No Data==";
|
|
3260
|
-
return h("p", { class: "warning" }, errorMsg);
|
|
3261
|
-
}
|
|
3262
|
-
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.cssStyle + " " + cell.type }, 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, styles: this.barChartStyles })) : (cell.draw(this.componentDataFormatDigits)))))))))));
|
|
3263
|
-
};
|
|
3264
|
-
return h(Host, null, helper());
|
|
3265
|
-
}
|
|
3266
|
-
componentWillRender() {
|
|
3267
|
-
const config = this.prepareConfig();
|
|
3268
|
-
const data = this.prepareData();
|
|
3269
|
-
this.componentDataFormatDigits = new DataFormatDigitsAdapter().adapt(this.dataFormatDigits);
|
|
3270
|
-
this.barChartStyles = this.prepareBarChartStyles();
|
|
3271
|
-
this.table = new Table(new IBCSRuleSet(), data, config);
|
|
3272
|
-
this.table.setI18n(this.i18n);
|
|
3273
|
-
}
|
|
3274
|
-
prepareConfig() {
|
|
3275
|
-
const config = new TableComponentConfigAdapter(new TableDrillGroupAdapter(), new StringAdapter(), new OrderAdapter(new StringAdapter()), this.data).adapt({
|
|
3276
|
-
title: this.tableTitle,
|
|
3277
|
-
scenarios: this.scenarios,
|
|
3278
|
-
scenariosUnitType: this.scenariosDataFormat,
|
|
3279
|
-
grouped: this.grouped,
|
|
3280
|
-
showGroupTitle: this.showGroupTitle,
|
|
3281
|
-
thereOf: this.thereof,
|
|
3282
|
-
partOf: this.partof,
|
|
3283
|
-
categoryThereOf: this.categorythereof,
|
|
3284
|
-
order: this.order,
|
|
3285
|
-
type: this.type,
|
|
3286
|
-
limit: this.limit,
|
|
3287
|
-
i18n: this.i18nMode,
|
|
3288
|
-
categoryWidth: this.categoryWidth,
|
|
3289
|
-
measureScale: this.measureScale,
|
|
3290
|
-
measureUnit: this.measureUnit,
|
|
3291
|
-
measureType: this.measureType,
|
|
3292
|
-
showMeasureScale: this.showMeasureScale,
|
|
3293
|
-
filter: this.filter,
|
|
3294
|
-
barColumns: this.barColumns,
|
|
3295
|
-
});
|
|
3296
|
-
return config;
|
|
3297
|
-
}
|
|
3298
|
-
prepareData() {
|
|
3299
|
-
return AdapterUtils.adaptArray(this.data, new TableDataRowAdapter());
|
|
3300
|
-
}
|
|
3301
|
-
/**
|
|
3302
|
-
* Prepares bar chart styles from componentStyle store.
|
|
3303
|
-
* Uses the same variance styles as bn-chart-time for consistency.
|
|
3304
|
-
* Supports fillpattern for different visual treatments (solid, hatched, outlined).
|
|
3305
|
-
* Scenario styles (ac, pp, fc, pl) use barStyles for IBCS-compliant grayscale coloring.
|
|
3306
|
-
*/
|
|
3307
|
-
prepareBarChartStyles() {
|
|
3308
|
-
return this.componentStyle(($) => {
|
|
3309
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
3310
|
-
const varianceStyles = (_a = $["bn-chart-time"]) === null || _a === void 0 ? void 0 : _a["varianceStyles"];
|
|
3311
|
-
const barStyles = (_b = $["bn-chart-time"]) === null || _b === void 0 ? void 0 : _b["barStyles"];
|
|
3312
|
-
// Default variance styles with fillpattern
|
|
3313
|
-
const defaultPos = { stroke: "#008f96", fill: "#008f96", fillpattern: "solid" };
|
|
3314
|
-
const defaultNeg = { stroke: "#ff0000", fill: "#ff0000", fillpattern: "solid" };
|
|
3315
|
-
const defaultNeu = { stroke: "#808080", fill: "#808080", fillpattern: "outlined" };
|
|
3316
|
-
// Default scenario styles (IBCS grayscale)
|
|
3317
|
-
const defaultAc = { stroke: "#404040", fill: "#404040", fillpattern: "solid" };
|
|
3318
|
-
const defaultPp = { stroke: "#A6A6A6", fill: "#A6A6A6", fillpattern: "solid" };
|
|
3319
|
-
const defaultFc = { stroke: "#404040", fill: "#ffffff", fillpattern: "hatched" };
|
|
3320
|
-
const defaultPl = { stroke: "#404040", fill: "#ffffff", fillpattern: "outlined" };
|
|
3321
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3322
|
-
return {
|
|
3323
|
-
positive: {
|
|
3324
|
-
stroke: ((_c = varianceStyles === null || varianceStyles === void 0 ? void 0 : varianceStyles.pos) === null || _c === void 0 ? void 0 : _c.stroke) || defaultPos.stroke,
|
|
3325
|
-
fill: ((_d = varianceStyles === null || varianceStyles === void 0 ? void 0 : varianceStyles.pos) === null || _d === void 0 ? void 0 : _d.fill) || defaultPos.fill,
|
|
3326
|
-
fillpattern: ((_e = varianceStyles === null || varianceStyles === void 0 ? void 0 : varianceStyles.pos) === null || _e === void 0 ? void 0 : _e.fillpattern) || defaultPos.fillpattern,
|
|
3327
|
-
},
|
|
3328
|
-
negative: {
|
|
3329
|
-
stroke: ((_f = varianceStyles === null || varianceStyles === void 0 ? void 0 : varianceStyles.neg) === null || _f === void 0 ? void 0 : _f.stroke) || defaultNeg.stroke,
|
|
3330
|
-
fill: ((_g = varianceStyles === null || varianceStyles === void 0 ? void 0 : varianceStyles.neg) === null || _g === void 0 ? void 0 : _g.fill) || defaultNeg.fill,
|
|
3331
|
-
fillpattern: ((_h = varianceStyles === null || varianceStyles === void 0 ? void 0 : varianceStyles.neg) === null || _h === void 0 ? void 0 : _h.fillpattern) || defaultNeg.fillpattern,
|
|
3332
|
-
},
|
|
3333
|
-
neutral: {
|
|
3334
|
-
stroke: ((_j = varianceStyles === null || varianceStyles === void 0 ? void 0 : varianceStyles.neu) === null || _j === void 0 ? void 0 : _j.stroke) || defaultNeu.stroke,
|
|
3335
|
-
fill: ((_k = varianceStyles === null || varianceStyles === void 0 ? void 0 : varianceStyles.neu) === null || _k === void 0 ? void 0 : _k.fill) || defaultNeu.fill,
|
|
3336
|
-
fillpattern: ((_l = varianceStyles === null || varianceStyles === void 0 ? void 0 : varianceStyles.neu) === null || _l === void 0 ? void 0 : _l.fillpattern) || defaultNeu.fillpattern,
|
|
3337
|
-
},
|
|
3338
|
-
scenarios: {
|
|
3339
|
-
ac: {
|
|
3340
|
-
stroke: ((_m = barStyles === null || barStyles === void 0 ? void 0 : barStyles.ac) === null || _m === void 0 ? void 0 : _m.stroke) || defaultAc.stroke,
|
|
3341
|
-
fill: ((_o = barStyles === null || barStyles === void 0 ? void 0 : barStyles.ac) === null || _o === void 0 ? void 0 : _o.fill) || defaultAc.fill,
|
|
3342
|
-
fillpattern: ((_p = barStyles === null || barStyles === void 0 ? void 0 : barStyles.ac) === null || _p === void 0 ? void 0 : _p.fillpattern) || defaultAc.fillpattern,
|
|
3343
|
-
},
|
|
3344
|
-
pp: {
|
|
3345
|
-
stroke: ((_q = barStyles === null || barStyles === void 0 ? void 0 : barStyles.pp) === null || _q === void 0 ? void 0 : _q.stroke) || defaultPp.stroke,
|
|
3346
|
-
fill: ((_r = barStyles === null || barStyles === void 0 ? void 0 : barStyles.pp) === null || _r === void 0 ? void 0 : _r.fill) || defaultPp.fill,
|
|
3347
|
-
fillpattern: ((_s = barStyles === null || barStyles === void 0 ? void 0 : barStyles.pp) === null || _s === void 0 ? void 0 : _s.fillpattern) || defaultPp.fillpattern,
|
|
3348
|
-
},
|
|
3349
|
-
fc: {
|
|
3350
|
-
stroke: ((_t = barStyles === null || barStyles === void 0 ? void 0 : barStyles.fc) === null || _t === void 0 ? void 0 : _t.stroke) || defaultFc.stroke,
|
|
3351
|
-
fill: ((_u = barStyles === null || barStyles === void 0 ? void 0 : barStyles.fc) === null || _u === void 0 ? void 0 : _u.fill) || defaultFc.fill,
|
|
3352
|
-
fillpattern: ((_v = barStyles === null || barStyles === void 0 ? void 0 : barStyles.fc) === null || _v === void 0 ? void 0 : _v.fillpattern) || defaultFc.fillpattern,
|
|
3353
|
-
},
|
|
3354
|
-
pl: {
|
|
3355
|
-
stroke: ((_w = barStyles === null || barStyles === void 0 ? void 0 : barStyles.pl) === null || _w === void 0 ? void 0 : _w.stroke) || defaultPl.stroke,
|
|
3356
|
-
fill: ((_x = barStyles === null || barStyles === void 0 ? void 0 : barStyles.pl) === null || _x === void 0 ? void 0 : _x.fill) || defaultPl.fill,
|
|
3357
|
-
fillpattern: ((_y = barStyles === null || barStyles === void 0 ? void 0 : barStyles.pl) === null || _y === void 0 ? void 0 : _y.fillpattern) || defaultPl.fillpattern,
|
|
3358
|
-
},
|
|
3359
|
-
},
|
|
3360
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
3361
|
-
fontColor: ((_z = $["global"]) === null || _z === void 0 ? void 0 : _z["fontColor"]) || "#000000",
|
|
3362
|
-
fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) * 0.85 * this.scaleFactor,
|
|
3363
|
-
fontFamily: ((_1 = $["global"]) === null || _1 === void 0 ? void 0 : _1["fontFamily"]) || "'Noto Sans', sans-serif",
|
|
3364
|
-
unitScaling: this.unitScaling,
|
|
3365
|
-
percentageScaling: this.percentageScaling,
|
|
3366
|
-
scaleFactor: this.scaleFactor,
|
|
3367
|
-
};
|
|
3368
|
-
});
|
|
3369
|
-
}
|
|
3370
|
-
get element() { return getElement(this); }
|
|
3371
|
-
};
|
|
3372
|
-
IbcsTable.style = ibcsTableCss();
|
|
3373
|
-
|
|
3374
|
-
export { Context as bn_context, Datasource as bn_datasource, Page as bn_page, Table$1 as bn_table, IbcsTable as ibcs_table };
|