@bino-bi/bn-template-engine 1.0.0-alpha.8 → 1.0.0-next.19
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-19bbac66.entry.js +1 -0
- package/dist/bn-template-engine/p-209351c9.entry.js +1 -0
- package/dist/bn-template-engine/p-22d0fb7a.entry.js +1 -0
- package/dist/bn-template-engine/p-2e6dc267.entry.js +1 -0
- package/dist/bn-template-engine/p-485d23d7.entry.js +1 -0
- package/dist/bn-template-engine/p-74c5a95d.entry.js +1 -0
- package/dist/bn-template-engine/p-7bdc0e28.entry.js +1 -0
- package/dist/bn-template-engine/p-83c71b16.entry.js +1 -0
- package/dist/bn-template-engine/p-90806e7a.entry.js +1 -0
- package/dist/bn-template-engine/p-9879c9b2.entry.js +1 -0
- package/dist/bn-template-engine/p-BA48JiHe.js +1 -0
- package/dist/bn-template-engine/p-BWKdb9ym.js +1 -0
- package/dist/bn-template-engine/p-BZV1b5VH.js +1 -0
- package/dist/bn-template-engine/p-Bdfxd_Ke.js +1 -0
- package/dist/bn-template-engine/p-BjBz5cSL.js +1 -0
- package/dist/bn-template-engine/p-BqhIhYr1.js +1 -0
- package/dist/bn-template-engine/p-C0Pwqx-O.js +1 -0
- package/dist/bn-template-engine/p-CiudZRQr.js +1 -0
- package/dist/bn-template-engine/p-DTuaq8Pj.js +1 -0
- package/dist/bn-template-engine/p-DY7YYmpa.js +1 -0
- package/dist/bn-template-engine/p-Dg9OcXAO.js +1 -0
- package/dist/bn-template-engine/p-DsTzlzxQ.js +1 -0
- package/dist/bn-template-engine/p-X6CxL6W-.js +1 -0
- package/dist/bn-template-engine/p-a8291de2.entry.js +1 -0
- package/dist/bn-template-engine/p-aakBGfzL.js +1 -0
- package/dist/bn-template-engine/p-b25455a7.entry.js +1 -0
- package/dist/bn-template-engine/p-e96da91f.entry.js +1 -0
- package/dist/bn-template-engine/p-eca8e2e2.entry.js +1 -0
- package/dist/bn-template-engine/p-f9dfd120.entry.js +1 -0
- package/dist/bn-template-engine/p-rdqTC0_5.js +1 -0
- package/dist/cjs/AxisConfig-VnVelfSV.js +233 -0
- package/dist/cjs/LabelCollisionManager-nfD5P__k.js +412 -0
- package/dist/cjs/NumericScale-BAyYXpKL.js +107 -0
- package/dist/cjs/Order-DobBozQC.js +87 -0
- package/dist/cjs/SVGStyle-BQOmGWLX.js +8209 -0
- package/dist/cjs/SVGVariancesStyleGroup-DCGfHrqh.js +50 -0
- package/dist/cjs/VarianceMeasure-NY9yhiNV.js +372 -0
- package/dist/cjs/XYChartDataRow-B7OKrAcC.js +829 -0
- package/dist/cjs/bn-asset_21.cjs.entry.js +16047 -0
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +762 -0
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +785 -0
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +658 -0
- package/dist/cjs/bn-grid.cjs.entry.js +5 -3
- package/dist/cjs/bn-image.cjs.entry.js +5 -3
- package/dist/cjs/bn-internationalization.cjs.entry.js +10 -8
- package/dist/cjs/bn-ruleset.cjs.entry.js +41 -0
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +8 -79
- package/dist/cjs/bn-tree.cjs.entry.js +9 -3
- package/dist/cjs/context-protocol-BDrMkhc4.js +9499 -0
- package/dist/cjs/editor-companion.cjs.entry.js +13 -6
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +624 -0
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +673 -0
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +667 -0
- package/dist/cjs/layoutObserver-o03YUfn_.js +199 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sanitizeHtml-LuZr1IMd.js +85 -0
- package/dist/cjs/scaling-DKZyjWj5.js +587 -0
- package/dist/cjs/{withBodyObserver-D7BKWN2N.js → withBodyObserver-BKUE_ypL.js} +12 -7
- package/dist/cjs/withScalingGroup-BmcRlWBs.js +73 -0
- package/dist/cjs/withStyled-CRiC9fzc.js +1137 -0
- package/dist/collection/collection-manifest.json +9 -1
- 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-bubble/bn-chart-bubble.css +10 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +1110 -0
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.css +9 -0
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.js +653 -0
- package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +472 -0
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.css +10 -0
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +1014 -0
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.css +9 -0
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +538 -0
- package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +440 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +132 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +89 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/index.js +2 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.css +10 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +965 -0
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.css +9 -0
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.js +580 -0
- package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +409 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +127 -41
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +103 -36
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +82 -58
- package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +46 -4
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +5 -4
- package/dist/collection/components/bn-chart-time/bn-chart-time.css +1 -1
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +162 -42
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +94 -31
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +132 -74
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +5 -4
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +2 -0
- package/dist/collection/components/bn-component-style/bn-component-style.js +1 -1
- package/dist/collection/components/bn-context/bn-context.js +1 -1
- package/dist/collection/components/bn-dataset/bn-dataset.js +226 -23
- package/dist/collection/components/bn-datasource/bn-datasource.js +163 -12
- package/dist/collection/components/bn-footer/bn-footer.js +1 -1
- package/dist/collection/components/bn-grid/bn-grid.js +1 -1
- package/dist/collection/components/bn-image/bn-image.js +1 -1
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +10 -7
- package/dist/collection/components/bn-layout-card/bn-layout-card.css +8 -3
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +98 -35
- package/dist/collection/components/bn-layout-page/bn-layout-page.css +5 -3
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +98 -25
- package/dist/collection/components/bn-message/bn-message.css +6 -2
- package/dist/collection/components/bn-message/bn-message.js +3 -2
- package/dist/collection/components/bn-page/bn-page.js +1 -1
- package/dist/collection/components/bn-ruleset/bn-ruleset.css +3 -0
- package/dist/collection/components/bn-ruleset/bn-ruleset.js +68 -0
- 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 +317 -61
- package/dist/collection/components/bn-table/ibcs-table.css +8 -0
- package/dist/collection/components/bn-table/ibcs-table.js +161 -32
- package/dist/collection/components/bn-table/utils/Table.js +72 -28
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +13 -8
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +3 -2
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +47 -0
- package/dist/collection/components/bn-table/utils/elements/index.js +1 -0
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +117 -22
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +380 -50
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +140 -0
- package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +4 -9
- package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +166 -0
- package/dist/collection/components/bn-table/utils/helper/index.js +2 -0
- package/dist/collection/components/bn-table/utils/model/TableAttribute.js +46 -0
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +20 -4
- package/dist/collection/components/bn-template/bn-template.js +1 -1
- package/dist/collection/components/bn-text/bn-text.js +2 -75
- package/dist/collection/components/bn-title/bn-title.js +27 -3
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.css +4 -0
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +29 -6
- package/dist/collection/components/bn-title/ibcs-title/utils/Title.js +3 -0
- package/dist/collection/components/bn-tree/bn-tree.js +5 -1
- package/dist/collection/components/editor-companion/editor-companion.js +12 -5
- package/dist/collection/context/scopedDb.js +127 -0
- package/dist/collection/stores/componentStyles.js +67 -0
- package/dist/collection/stores/createScopedStores.js +11 -5
- package/dist/collection/stores/internationalization.js +68 -0
- package/dist/collection/stores/ruleSets.js +46 -0
- package/dist/collection/utils/constants.js +5 -0
- package/dist/collection/utils/dataAnalyzer.js +14 -8
- package/dist/collection/utils/ibcsRuleSet.js +14 -26
- package/dist/collection/utils/layoutObserver.js +88 -0
- package/dist/collection/utils/parentDimensions.js +71 -15
- package/dist/collection/utils/sanitizeHtml.js +81 -0
- package/dist/collection/utils/validate.js +47 -0
- package/dist/collection/utils/withBodyObserver.js +12 -7
- package/dist/collection/utils/withComponentStyle.js +3 -5
- package/dist/collection/utils/withDataset.js +43 -39
- package/dist/collection/utils/withDatasource.js +28 -18
- package/dist/collection/utils/withInheritedProps.js +26 -1
- package/dist/collection/utils/withRuleSet.js +105 -0
- package/dist/collection/utils/withScalingGroup.js +69 -0
- package/dist/collection/utils/withTranslation.js +50 -14
- package/dist/collection/utils/xy/FacetGrid.js +36 -0
- package/dist/collection/utils/xy/IsoCurves.js +156 -0
- package/dist/collection/utils/xy/NumericScale.js +103 -0
- package/dist/collection/utils/xy/PointLabeler.js +96 -0
- package/dist/collection/utils/xy/RadiusScale.js +42 -0
- package/dist/collection/utils/xy/SeriesPalette.js +80 -0
- package/dist/collection/utils/xy/VarianceMeasure.js +76 -0
- package/dist/collection/utils/xy/XYFrame.js +120 -0
- package/dist/collection/utils/xy/XYLegend.js +107 -0
- package/dist/collection/utils/xy/model/AxisConfig.js +221 -0
- package/dist/collection/utils/xy/model/ScaleFactorsXYChart.js +69 -0
- package/dist/collection/utils/xy/model/XYChartDataRow.js +0 -0
- package/dist/collection/utils/xy/model/XYChartStyle.js +52 -0
- package/dist/components/AxisConfig.js +1 -0
- package/dist/components/CompareUtil.js +1 -0
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/LabelCollisionManager.js +1 -0
- package/dist/components/NumericScale.js +1 -0
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGVariancesStyleGroup.js +1 -1
- package/dist/components/SiPrefix.js +1 -0
- package/dist/components/StringAdapter.js +1 -0
- package/dist/components/VarianceMeasure.js +1 -0
- package/dist/components/XYChartDataRow.js +1 -0
- package/dist/components/bn-body2.js +1 -1
- package/dist/components/bn-card2.js +1 -1
- package/dist/components/bn-chart-bubble.d.ts +11 -0
- package/dist/components/bn-chart-bubble.js +1 -0
- package/dist/components/bn-chart-bullet.d.ts +11 -0
- package/dist/components/bn-chart-bullet.js +1 -0
- package/dist/components/bn-chart-scatter.d.ts +11 -0
- package/dist/components/bn-chart-scatter.js +1 -0
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer2.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.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/bn-ruleset.d.ts +11 -0
- package/dist/components/bn-ruleset.js +1 -0
- package/dist/components/bn-scaling-group.d.ts +11 -0
- 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/context-protocol.js +1 -1
- package/dist/components/editor-companion.js +1 -1
- package/dist/components/formatter.js +1 -0
- package/dist/components/ibcs-chart-bubble.d.ts +11 -0
- package/dist/components/ibcs-chart-bubble.js +1 -0
- package/dist/components/ibcs-chart-bubble2.js +1 -0
- package/dist/components/ibcs-chart-bullet.d.ts +11 -0
- package/dist/components/ibcs-chart-bullet.js +1 -0
- package/dist/components/ibcs-chart-bullet2.js +1 -0
- package/dist/components/ibcs-chart-scatter.d.ts +11 -0
- package/dist/components/ibcs-chart-scatter.js +1 -0
- package/dist/components/ibcs-chart-scatter2.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/layoutObserver.js +1 -0
- package/dist/components/luxon.js +1 -0
- package/dist/components/main.js +1 -0
- package/dist/components/merge.js +1 -0
- package/dist/components/sanitizeHtml.js +1 -0
- package/dist/components/stackColors.js +1 -0
- package/dist/components/validate.js +1 -1
- package/dist/components/withBodyObserver.js +1 -1
- package/dist/components/withComponentStyle.js +1 -1
- package/dist/components/withDataset.js +1 -0
- package/dist/components/withRuleSet.js +1 -0
- package/dist/components/withScalingGroup.js +1 -0
- package/dist/components/withStyled.js +1 -1
- package/dist/components/withTranslation.js +1 -1
- package/dist/esm/AxisConfig-C_zWCKlL.js +224 -0
- package/dist/esm/LabelCollisionManager-8swVQHKA.js +404 -0
- package/dist/esm/NumericScale-DsTzlzxQ.js +105 -0
- package/dist/esm/Order-BPeWfygb.js +83 -0
- package/dist/esm/SVGStyle-BxEDw9zh.js +8199 -0
- package/dist/esm/SVGVariancesStyleGroup-DRQYvSDD.js +48 -0
- package/dist/esm/VarianceMeasure-DnwNKspZ.js +364 -0
- package/dist/esm/XYChartDataRow-DeV4r-Wm.js +820 -0
- package/dist/esm/bn-asset_21.entry.js +16025 -0
- package/dist/esm/bn-chart-bubble.entry.js +760 -0
- package/dist/esm/bn-chart-bullet.entry.js +783 -0
- package/dist/esm/bn-chart-scatter.entry.js +656 -0
- package/dist/esm/bn-grid.entry.js +5 -3
- package/dist/esm/bn-image.entry.js +5 -3
- package/dist/esm/bn-internationalization.entry.js +10 -8
- package/dist/esm/bn-ruleset.entry.js +39 -0
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +1 -1
- package/dist/esm/bn-text.entry.js +7 -78
- package/dist/esm/bn-tree.entry.js +9 -3
- package/dist/esm/context-protocol-1Yj1uKvh.js +9484 -0
- package/dist/esm/editor-companion.entry.js +13 -6
- package/dist/esm/ibcs-chart-bubble.entry.js +622 -0
- package/dist/esm/ibcs-chart-bullet.entry.js +671 -0
- package/dist/esm/ibcs-chart-scatter.entry.js +665 -0
- package/dist/esm/layoutObserver-BG5dOBYH.js +196 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sanitizeHtml-BA48JiHe.js +83 -0
- package/dist/esm/scaling-CeSRcRl1.js +579 -0
- package/dist/esm/{withBodyObserver-AFk2wwHT.js → withBodyObserver-IokS6fHD.js} +12 -7
- package/dist/esm/withScalingGroup-Br70pAv9.js +71 -0
- package/dist/esm/withStyled-Br2DGTPs.js +1104 -0
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +193 -0
- package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +58 -0
- package/dist/types/components/bn-chart-bubble/utils/BubbleChart.d.ts +91 -0
- package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +172 -0
- package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +52 -0
- package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +91 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +70 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +43 -0
- package/dist/types/components/bn-chart-bullet/utils/model/index.d.ts +2 -0
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +172 -0
- package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +53 -0
- package/dist/types/components/bn-chart-scatter/utils/ScatterChart.d.ts +66 -0
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +19 -5
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +13 -6
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +16 -12
- package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +16 -1
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +5 -3
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +53 -13
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +13 -6
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +16 -12
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +5 -3
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +47 -5
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +53 -6
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +35 -8
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +32 -1
- package/dist/types/components/bn-message/bn-message.d.ts +5 -2
- package/dist/types/components/bn-ruleset/bn-ruleset.d.ts +8 -0
- package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +37 -0
- package/dist/types/components/bn-table/bn-table.d.ts +74 -12
- package/dist/types/components/bn-table/ibcs-table.d.ts +27 -4
- package/dist/types/components/bn-table/utils/Table.d.ts +16 -6
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +33 -0
- package/dist/types/components/bn-table/utils/elements/TableRow.d.ts +2 -1
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +21 -0
- package/dist/types/components/bn-table/utils/elements/index.d.ts +1 -0
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +17 -9
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +35 -3
- package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +37 -0
- package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +4 -5
- package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +55 -0
- package/dist/types/components/bn-table/utils/helper/index.d.ts +2 -0
- package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +22 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +12 -3
- package/dist/types/components/bn-table/utils/model/index.d.ts +21 -0
- package/dist/types/components/bn-title/bn-title.d.ts +11 -1
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +2 -0
- package/dist/types/components/bn-title/ibcs-title/utils/Title.d.ts +1 -0
- package/dist/types/components/editor-companion/editor-companion.d.ts +2 -0
- package/dist/types/components.d.ts +1691 -120
- package/dist/types/context/context-protocol.d.ts +7 -3
- package/dist/types/context/scopedDb.d.ts +37 -0
- package/dist/types/stores/componentStyles.d.ts +41 -0
- package/dist/types/stores/createScopedStores.d.ts +4 -2
- package/dist/types/stores/ruleSets.d.ts +40 -0
- package/dist/types/utils/DateStringFactory.d.ts +1 -1
- package/dist/types/utils/constants.d.ts +5 -0
- package/dist/types/utils/dataAnalyzer.d.ts +2 -1
- package/dist/types/utils/ibcsRuleSet.d.ts +6 -1
- package/dist/types/utils/layoutObserver.d.ts +27 -0
- package/dist/types/utils/model/ChartStyles.d.ts +2 -1
- package/dist/types/utils/parentDimensions.d.ts +1 -1
- package/dist/types/utils/sanitizeHtml.d.ts +6 -0
- package/dist/types/utils/validate.d.ts +18 -0
- package/dist/types/utils/withDataset.d.ts +6 -2
- package/dist/types/utils/withDatasource.d.ts +3 -3
- package/dist/types/utils/withInheritedProps.d.ts +19 -0
- package/dist/types/utils/withRuleSet.d.ts +24 -0
- package/dist/types/utils/withScalingGroup.d.ts +14 -0
- package/dist/types/utils/withTranslation.d.ts +12 -4
- package/dist/types/utils/xy/FacetGrid.d.ts +27 -0
- package/dist/types/utils/xy/IsoCurves.d.ts +46 -0
- package/dist/types/utils/xy/NumericScale.d.ts +41 -0
- package/dist/types/utils/xy/PointLabeler.d.ts +58 -0
- package/dist/types/utils/xy/RadiusScale.d.ts +26 -0
- package/dist/types/utils/xy/SeriesPalette.d.ts +59 -0
- package/dist/types/utils/xy/VarianceMeasure.d.ts +37 -0
- package/dist/types/utils/xy/XYFrame.d.ts +44 -0
- package/dist/types/utils/xy/XYLegend.d.ts +43 -0
- package/dist/types/utils/xy/model/AxisConfig.d.ts +96 -0
- package/dist/types/utils/xy/model/ScaleFactorsXYChart.d.ts +36 -0
- package/dist/types/utils/xy/model/XYChartDataRow.d.ts +157 -0
- package/dist/types/utils/xy/model/XYChartStyle.d.ts +31 -0
- package/package.json +5 -4
- package/readme.md +9 -5
- package/dist/bn-template-engine/p-0d41c5d8.entry.js +0 -1
- package/dist/bn-template-engine/p-67538176.entry.js +0 -1
- package/dist/bn-template-engine/p-825a07a8.entry.js +0 -1
- package/dist/bn-template-engine/p-916296a5.entry.js +0 -1
- package/dist/bn-template-engine/p-96006b06.entry.js +0 -1
- package/dist/bn-template-engine/p-Ck-NYtot.js +0 -1
- package/dist/bn-template-engine/p-CnDq0oVa.js +0 -1
- package/dist/bn-template-engine/p-DSXNgKLa.js +0 -1
- package/dist/bn-template-engine/p-bc711fb0.entry.js +0 -1
- package/dist/bn-template-engine/p-e6f646b1.entry.js +0 -1
- package/dist/bn-template-engine/p-f41d9242.entry.js +0 -1
- package/dist/bn-template-engine/p-gFbbuhtl.js +0 -1
- package/dist/cjs/bn-asset_20.cjs.entry.js +0 -23541
- package/dist/cjs/context-protocol-ohYzcb5F.js +0 -663
- package/dist/cjs/scaling-CIAClQR5.js +0 -314
- package/dist/cjs/withStyled-qd94SSb4.js +0 -9535
- package/dist/collection/stores/datasets.js +0 -14
- package/dist/collection/stores/datasources.js +0 -14
- package/dist/components/_commonjsHelpers.js +0 -1
- package/dist/components/alasql.min.js +0 -1
- package/dist/components/ibcsRuleSet.js +0 -1
- package/dist/components/scaling.js +0 -1
- package/dist/components/withInheritedProps.js +0 -1
- package/dist/esm/bn-asset_20.entry.js +0 -23520
- package/dist/esm/context-protocol-DdbSplvE.js +0 -656
- package/dist/esm/scaling-DGKKkuL9.js +0 -309
- package/dist/esm/withStyled-BIkqU2w4.js +0 -9501
- package/dist/types/stores/datasets.d.ts +0 -14
- package/dist/types/stores/datasources.d.ts +0 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import alasql from "alasql";
|
|
2
1
|
import { OrderDirection, TableType } from "../model";
|
|
3
2
|
import { QueryGroups } from "./QueryGroup";
|
|
3
|
+
import { coerceBucketKey, INTERVAL_NONE, intervalBucketSQL } from "./IntervalColumns";
|
|
4
4
|
import { QueryColumnNames, VarianceScenario } from "../../../../utils/model";
|
|
5
5
|
/**
|
|
6
6
|
* AlaSQL-based query builder that produces the complete table result set for bn-table.
|
|
@@ -30,12 +30,14 @@ export class DataQuery {
|
|
|
30
30
|
* 8. Calculate REST columns (parent minus drilled children)
|
|
31
31
|
* 9. Divide absolute variances by their denominator to produce relative variances
|
|
32
32
|
*
|
|
33
|
+
* @param db - The shared alasql database.
|
|
34
|
+
* @param fromExpr - SQL FROM-clause expression naming the source table or filtered view.
|
|
33
35
|
* @returns Array of row-group segments; each segment is an array of result rows.
|
|
34
36
|
*/
|
|
35
|
-
execute(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
execute(db, fromExpr) {
|
|
38
|
+
var _a;
|
|
39
|
+
this.db = db;
|
|
40
|
+
this.fromExpr = fromExpr;
|
|
39
41
|
const queries = [];
|
|
40
42
|
const sumGroupQueries = [];
|
|
41
43
|
const res = [];
|
|
@@ -46,6 +48,7 @@ export class DataQuery {
|
|
|
46
48
|
.map((s) => this.translateScenarioSQL(s, true, this.config.type))
|
|
47
49
|
.toString();
|
|
48
50
|
const relativeScenarios = this.getRelativeScenarios();
|
|
51
|
+
const attributesSQL = this.config.attributes.map((attribute) => this.translateAttributeSQL(attribute)).toString();
|
|
49
52
|
const groups = new QueryGroups(this.config);
|
|
50
53
|
const groupsAggregated = this.config.grouped ? [QueryColumnNames.ROWGROUP, QueryColumnNames.ROWGROUPINDEX] : [];
|
|
51
54
|
let order = ["", ""];
|
|
@@ -55,9 +58,20 @@ export class DataQuery {
|
|
|
55
58
|
this.hasPartOf = this.checkConfigForPartOf();
|
|
56
59
|
// meta defines groups and the number detail rows in each group
|
|
57
60
|
// Bsp: 0: Object { totalrowcnt: 7, rowgroup: "Umsatz" }
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
let meta;
|
|
62
|
+
try {
|
|
63
|
+
meta = db.exec(`SELECT COUNT(DISTINCT ${QueryColumnNames.CATEGORY}) as ${QueryColumnNames.TOTALROWCOUNT} ${groupsAggregated.length > 0 ? "," + groupsAggregated : ""}
|
|
64
|
+
FROM ${fromExpr} ${groupsAggregated.length > 0 ? "GROUP BY " + groupsAggregated : ""}
|
|
65
|
+
ORDER BY ${order[0]}`);
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
console.error("DataQuery: meta query failed", e);
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
if (meta.length === 0 ||
|
|
72
|
+
(meta.length === 1 && ((_a = meta[0][QueryColumnNames.TOTALROWCOUNT]) !== null && _a !== void 0 ? _a : 0) === 0 && groupsAggregated.length === 0)) {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
61
75
|
// Creates DataSelection for LIST
|
|
62
76
|
meta.forEach((rowGroupEntry) => {
|
|
63
77
|
// the following variables are 'helper sections' which are used to constuct dynamicly the sql statement depending of the given config
|
|
@@ -71,7 +85,7 @@ export class DataQuery {
|
|
|
71
85
|
queryLimitSection = `LIMIT ${this.config.limit}`;
|
|
72
86
|
}
|
|
73
87
|
this.createGroupHeaderRow(rowGroupEntry, queries);
|
|
74
|
-
this.createDataRow(queries, rowGroupEntry, groups, scenarios, queryWhereSection, order, queryLimitSection);
|
|
88
|
+
this.createDataRow(queries, rowGroupEntry, groups, scenarios, attributesSQL, queryWhereSection, order, queryLimitSection);
|
|
75
89
|
this.createRestRow(rowGroupEntry, queries, groups, scenarios, queryWhereSection, order);
|
|
76
90
|
this.createGroupSumRow(queries, sumGroupQueries, rowGroupEntry, scenariosSUMQuery, order);
|
|
77
91
|
});
|
|
@@ -79,16 +93,17 @@ export class DataQuery {
|
|
|
79
93
|
// executes main queries
|
|
80
94
|
queries.forEach((query) => {
|
|
81
95
|
try {
|
|
82
|
-
res.push(
|
|
96
|
+
res.push(db.exec(query));
|
|
83
97
|
}
|
|
84
98
|
catch (err) {
|
|
85
99
|
console.error("DataQuery: SQL query execution failed", query, err);
|
|
86
100
|
}
|
|
87
101
|
});
|
|
88
102
|
this.detectNaNCells(this.config.scenarios, res);
|
|
89
|
-
this.createThereOfDrillRows(scenarios,
|
|
90
|
-
this.createPartOfDrillRows(scenarios, order, sumGroupQueries,
|
|
91
|
-
this.
|
|
103
|
+
this.createThereOfDrillRows(scenarios, attributesSQL, order, res);
|
|
104
|
+
this.createPartOfDrillRows(scenarios, order, sumGroupQueries, res);
|
|
105
|
+
this.createIntervalColumns(res);
|
|
106
|
+
this.createThereOfDrillColumns(this.config.categoryThereOf, res);
|
|
92
107
|
this.calculateColumnGroupRest(res, this.config.categoryThereOf);
|
|
93
108
|
this.calculateRelativeVariances(res, relativeScenarios);
|
|
94
109
|
return res;
|
|
@@ -127,23 +142,20 @@ export class DataQuery {
|
|
|
127
142
|
* of its row group sum. Queries the drill subset, then divides each scenario
|
|
128
143
|
* value by the corresponding group sum to produce a percentage.
|
|
129
144
|
*/
|
|
130
|
-
createPartOfDrillRows(scenarios, order, sumGroupQueries,
|
|
131
|
-
if (this.config.partOf == null ||
|
|
132
|
-
this.config.partOf.length === 0 ||
|
|
133
|
-
this.config.type === TableType.LIST ||
|
|
134
|
-
data == null ||
|
|
135
|
-
data.length === 0) {
|
|
145
|
+
createPartOfDrillRows(scenarios, order, sumGroupQueries, res) {
|
|
146
|
+
if (this.config.partOf == null || this.config.partOf.length === 0 || this.config.type === TableType.LIST) {
|
|
136
147
|
return;
|
|
137
148
|
}
|
|
138
149
|
const drillQueries = this.createPartOfQuery(scenarios, order);
|
|
139
150
|
let resDrill = []; // set of drill (subquery result injected into resultset)
|
|
151
|
+
const db = this.db;
|
|
140
152
|
drillQueries.forEach(function (query) {
|
|
141
|
-
resDrill.push(...
|
|
153
|
+
resDrill.push(...db.exec(query));
|
|
142
154
|
});
|
|
143
155
|
const scenarioNames = this.exctractScenarioNames(scenarios);
|
|
144
156
|
const rowGroupSumResultRows = [];
|
|
145
157
|
sumGroupQueries.forEach(function (query) {
|
|
146
|
-
rowGroupSumResultRows.push(...
|
|
158
|
+
rowGroupSumResultRows.push(...db.exec(query));
|
|
147
159
|
});
|
|
148
160
|
const rowGroupSumResultMap = new Map();
|
|
149
161
|
rowGroupSumResultRows.forEach((row) => rowGroupSumResultMap.set(row[QueryColumnNames.ROWGROUP], row));
|
|
@@ -170,22 +182,25 @@ export class DataQuery {
|
|
|
170
182
|
createRestRow(rowGroupEntry, querys, groups, scenarios, queryWhereSection, order) {
|
|
171
183
|
// Generates REST Row; sumsup the Bottom (total number of rows - limit)
|
|
172
184
|
if (rowGroupEntry.totalRowCnt - this.config.limit > 0 && this.config.limit !== 0) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
185
|
+
// sums every column the inner subquery produces (scenario values, _cnt companions, dr_* denominators)
|
|
186
|
+
const restScenarios = this.exctractScenarioNames(scenarios)
|
|
187
|
+
.map((name) => `SUM(${name}) as ${name}`)
|
|
188
|
+
.join(", ");
|
|
189
|
+
querys.push(`SELECT ${QueryColumnNames.ROWNR}, 1 as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, 'NO_GROUP' as ${QueryColumnNames.ROWGROUP}, 'REST' as ${QueryColumnNames.CATEGORY} ${restScenarios.length > 0 ? ", " + restScenarios : ""} FROM` +
|
|
190
|
+
` (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 ${this.fromExpr} ${queryWhereSection} GROUP BY ${groups} ORDER BY ${order[0]})` +
|
|
176
191
|
` t WHERE t.rowNr > ${this.config.limit}`);
|
|
177
192
|
}
|
|
178
193
|
}
|
|
179
194
|
/** Generates the main data rows for a single row group, applying GROUP BY, ORDER, and LIMIT. */
|
|
180
|
-
createDataRow(querys, rowGroupEntry, groups, scenarios, queryWhereSection, order, queryLimitSection) {
|
|
195
|
+
createDataRow(querys, rowGroupEntry, groups, scenarios, attributes, queryWhereSection, order, queryLimitSection) {
|
|
181
196
|
// Generates DataRows
|
|
182
197
|
querys.push(`SELECT ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
183
198
|
${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
184
199
|
'ENTRY' as ${QueryColumnNames.TYPE},
|
|
185
200
|
'${rowGroupEntry.rowGroup || "NO_GROUP"}' as ${QueryColumnNames.ROWGROUP},
|
|
186
201
|
'${QueryColumnNames.CATEGORYINDEX}',
|
|
187
|
-
${groups} ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
188
|
-
FROM
|
|
202
|
+
${groups} ${scenarios.length > 0 ? ",".concat(scenarios) : ""} ${attributes.length > 0 ? ",".concat(attributes) : ""}
|
|
203
|
+
FROM ${this.fromExpr} ${queryWhereSection}
|
|
189
204
|
GROUP BY ${groups}
|
|
190
205
|
ORDER BY ${order[0]} ${queryLimitSection}`);
|
|
191
206
|
}
|
|
@@ -200,7 +215,7 @@ export class DataQuery {
|
|
|
200
215
|
${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
201
216
|
'GROUPHEAD' as ${QueryColumnNames.TYPE},
|
|
202
217
|
'${rowGroupEntry.rowGroup}' as ${QueryColumnNames.ROWGROUP} ${groupTitle}
|
|
203
|
-
FROM
|
|
218
|
+
FROM ${this.fromExpr}
|
|
204
219
|
GROUP BY '1'`);
|
|
205
220
|
}
|
|
206
221
|
}
|
|
@@ -217,7 +232,7 @@ export class DataQuery {
|
|
|
217
232
|
'${rowGroupEntry.rowGroup}' as ${QueryColumnNames.ROWGROUP},
|
|
218
233
|
ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
219
234
|
'GROUP_SUM' as ${QueryColumnNames.TYPE} ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
220
|
-
FROM
|
|
235
|
+
FROM ${this.fromExpr}
|
|
221
236
|
WHERE ${QueryColumnNames.ROWGROUP} = '${rowGroupEntry.rowGroup}'
|
|
222
237
|
ORDER BY ${order[0]} `);
|
|
223
238
|
groupSumQuery.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
@@ -225,26 +240,35 @@ export class DataQuery {
|
|
|
225
240
|
'${rowGroupEntry.rowGroup}' as ${QueryColumnNames.ROWGROUP},
|
|
226
241
|
ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
227
242
|
'GROUP_SUM' as ${QueryColumnNames.TYPE} ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
228
|
-
FROM
|
|
243
|
+
FROM ${this.fromExpr}
|
|
229
244
|
WHERE ${QueryColumnNames.ROWGROUP} = '${rowGroupEntry.rowGroup}'
|
|
230
245
|
ORDER BY ${order[0]} `);
|
|
231
246
|
}
|
|
232
247
|
}
|
|
233
248
|
/** Generates a total SUM row across all groups (only for SUM / OPT table types). */
|
|
234
249
|
createTotalSumRow(querys, sumGroupQueries, scenariosSUMQuery) {
|
|
250
|
+
var _a;
|
|
235
251
|
if (TableType.SUM === this.config.type || TableType.OPT === this.config.type) {
|
|
236
|
-
|
|
252
|
+
// An empty label falls back to the SUM_TOTAL key, which tableDataSetFactory
|
|
253
|
+
// resolves to the IBCS total symbol (❖).
|
|
254
|
+
const label = ((_a = this.config.title) === null || _a === void 0 ? void 0 : _a.trim()) || "SUM_TOTAL";
|
|
255
|
+
// In an ungrouped partof table the total row is what the "in % of ❖" rows
|
|
256
|
+
// refer to, so a custom label gets the symbol prepended. The default label
|
|
257
|
+
// already IS that symbol — prefixing it would yield the literal
|
|
258
|
+
// "❖ SUM_TOTAL", which no longer matches the key and stays untranslated.
|
|
259
|
+
const prefixSymbol = this.hasPartOf && this.config.grouped === false && label !== "SUM_TOTAL";
|
|
260
|
+
const title = prefixSymbol ? `${this.i18n.get("SUM_TOTAL") || "SUM_TOTAL"} ${label}` : label;
|
|
237
261
|
querys.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
238
262
|
'${title}' as ${QueryColumnNames.ROWGROUP},
|
|
239
263
|
'=' as ${QueryColumnNames.OPERATION},
|
|
240
264
|
'SUM' as ${QueryColumnNames.TYPE} ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
241
|
-
FROM
|
|
265
|
+
FROM ${this.fromExpr} `);
|
|
242
266
|
}
|
|
243
267
|
sumGroupQueries.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
244
268
|
'SUM_TOTAL' as ${QueryColumnNames.ROWGROUP},
|
|
245
269
|
'=' as ${QueryColumnNames.OPERATION},
|
|
246
270
|
'SUM' as ${QueryColumnNames.TYPE} ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
247
|
-
FROM
|
|
271
|
+
FROM ${this.fromExpr} `);
|
|
248
272
|
}
|
|
249
273
|
/**
|
|
250
274
|
* Manually merges drill rows that AlaSQL fails to aggregate correctly.
|
|
@@ -330,7 +354,7 @@ export class DataQuery {
|
|
|
330
354
|
* beneath their parent category row. Each thereof config entry produces a
|
|
331
355
|
* filtered/grouped SQL query whose results are spliced into the result set.
|
|
332
356
|
*/
|
|
333
|
-
createThereOfDrillRows(scenarios,
|
|
357
|
+
createThereOfDrillRows(scenarios, attributes, order, res) {
|
|
334
358
|
// adds drill rows if setup in config
|
|
335
359
|
// if there of is set drilldown row is displayed with absolute numbers,
|
|
336
360
|
// if part of is also not null a relative percenatage based of the selected basis is displayed
|
|
@@ -365,16 +389,15 @@ export class DataQuery {
|
|
|
365
389
|
${QueryColumnNames.CATEGORY},
|
|
366
390
|
${QueryColumnNames.SUBCATEGORY},
|
|
367
391
|
${QueryColumnNames.ROWGROUP} as ${QueryColumnNames.ROWGROUP},
|
|
368
|
-
${scenarios}
|
|
369
|
-
FROM
|
|
392
|
+
${scenarios} ${attributes.length > 0 ? ",".concat(attributes) : ""}
|
|
393
|
+
FROM ${this.fromExpr}
|
|
370
394
|
WHERE ${fromString}
|
|
371
395
|
GROUP BY ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}
|
|
372
396
|
ORDER BY ${order[1]}`);
|
|
373
397
|
});
|
|
374
|
-
|
|
375
|
-
//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]}`);
|
|
398
|
+
const db = this.db;
|
|
376
399
|
drillQueries.forEach(function (query) {
|
|
377
|
-
resDrill.push(...
|
|
400
|
+
resDrill.push(...db.exec(query));
|
|
378
401
|
});
|
|
379
402
|
this.injectDrillRowsToResultRows(resDrill, res);
|
|
380
403
|
}
|
|
@@ -442,6 +465,273 @@ export class DataQuery {
|
|
|
442
465
|
});
|
|
443
466
|
});
|
|
444
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* Adds per-interval-bucket values to the result rows when the bn-table
|
|
470
|
+
* `interval` attribute is active. Side queries aggregate the source rows per
|
|
471
|
+
* bucket (`normalizeDate(date, …)` for date intervals, setname otherwise) at
|
|
472
|
+
* every row level (ENTRY, GROUP_SUM, SUM, DRILLELEMENT, PARTELEMENT) and the
|
|
473
|
+
* results are stored on the existing rows as composite keys
|
|
474
|
+
* `<scenario>##<bucketKey>` — the same convention as the columnthereof drill
|
|
475
|
+
* columns (which are mutually exclusive with interval).
|
|
476
|
+
*
|
|
477
|
+
* Row selection (ORDER BY / LIMIT) stays anchored on the un-bucketed base
|
|
478
|
+
* queries, so every bucket shows the same category set. REST values are
|
|
479
|
+
* computed in JS as the per-bucket sum of the categories that are not
|
|
480
|
+
* displayed, matching the un-bucketed REST query semantics.
|
|
481
|
+
*/
|
|
482
|
+
createIntervalColumns(res) {
|
|
483
|
+
var _a, _b, _c, _d, _e;
|
|
484
|
+
if (this.config.interval === INTERVAL_NONE ||
|
|
485
|
+
this.config.categoryThereOf.size > 0 ||
|
|
486
|
+
this.config.scenarios.length === 0) {
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
const separator = "##";
|
|
490
|
+
const bucketSource = `(SELECT *, ${intervalBucketSQL(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`;
|
|
491
|
+
const scenarios = this.config.scenarios
|
|
492
|
+
.map((s) => this.translateScenarioSQL(s, false, this.config.type))
|
|
493
|
+
.toString();
|
|
494
|
+
const scenariosSUMQuery = this.config.scenarios
|
|
495
|
+
.map((s) => this.translateScenarioSQL(s, true, this.config.type))
|
|
496
|
+
.toString();
|
|
497
|
+
const entryAliases = this.exctractScenarioNames(scenarios);
|
|
498
|
+
const relativeScenarios = this.getRelativeScenarios();
|
|
499
|
+
const groups = new QueryGroups(this.config);
|
|
500
|
+
const isOpt = TableType.OPT === this.config.type || TableType.OPTNOTOTAL === this.config.type;
|
|
501
|
+
const isSumTypeGrouped = this.config.grouped &&
|
|
502
|
+
(TableType.SUM === this.config.type ||
|
|
503
|
+
TableType.SUMNOTOTAL === this.config.type ||
|
|
504
|
+
TableType.OPT === this.config.type ||
|
|
505
|
+
TableType.OPTNOTOTAL === this.config.type);
|
|
506
|
+
const hasPartOfActive = this.checkConfigForPartOf() && this.config.type !== TableType.LIST;
|
|
507
|
+
const exec = (query) => {
|
|
508
|
+
try {
|
|
509
|
+
return this.db.exec(query);
|
|
510
|
+
}
|
|
511
|
+
catch (err) {
|
|
512
|
+
console.error("DataQuery: interval query failed", query, err);
|
|
513
|
+
return [];
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
// mirrors detectNaNCells + calculateRelativeVariances for a single bucket row
|
|
517
|
+
const finalizeBucketRow = (row) => {
|
|
518
|
+
this.config.scenarios.forEach((scenario) => {
|
|
519
|
+
const varianceScenario = new VarianceScenario(scenario);
|
|
520
|
+
if (varianceScenario.isValid === true) {
|
|
521
|
+
if (row[varianceScenario.base + "_cnt"] === 0 || row[varianceScenario.delta + "_cnt"] === 0) {
|
|
522
|
+
row[scenario] = Number.NaN;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
else if (row[scenario + "_cnt"] === 0) {
|
|
526
|
+
row[scenario] = Number.NaN;
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
relativeScenarios.forEach((value, key) => {
|
|
530
|
+
row[key] = row[key] / row[value];
|
|
531
|
+
});
|
|
532
|
+
return row;
|
|
533
|
+
};
|
|
534
|
+
const writeBucketValues = (target, source, bucketKey) => {
|
|
535
|
+
for (const scenario of this.config.scenarios) {
|
|
536
|
+
target[scenario + separator + bucketKey] = source[scenario];
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
const entryRowsRaw = exec(`SELECT ${groups}, __interval ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
540
|
+
FROM ${bucketSource}
|
|
541
|
+
GROUP BY ${groups}, __interval`);
|
|
542
|
+
// REST rows first: the math needs the raw (not yet finalized) entry aliases
|
|
543
|
+
if (this.config.limit > 0) {
|
|
544
|
+
for (let segmentIndex = 0; segmentIndex < res.length; segmentIndex++) {
|
|
545
|
+
const restRow = res[segmentIndex].find((row) => row.type === "ENTRY" && row.category === "REST");
|
|
546
|
+
if (!restRow) {
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
// nearest preceding segment holding the displayed ENTRY rows
|
|
550
|
+
let entrySegment;
|
|
551
|
+
for (let i = segmentIndex - 1; i >= 0 && !entrySegment; i--) {
|
|
552
|
+
const candidate = res[i].filter((row) => row.type === "ENTRY" && row.category !== "REST");
|
|
553
|
+
if (candidate.length > 0) {
|
|
554
|
+
entrySegment = candidate;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
if (!entrySegment) {
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
const displayedCategories = new Set(entrySegment.map((row) => row.category));
|
|
561
|
+
const restGroup = entrySegment[0].rowGroup;
|
|
562
|
+
const restByBucket = new Map();
|
|
563
|
+
for (const entryRow of entryRowsRaw) {
|
|
564
|
+
if (this.config.grouped && entryRow.rowGroup !== restGroup) {
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
if (displayedCategories.has(entryRow.category)) {
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
const bucketKey = coerceBucketKey(entryRow.__interval);
|
|
571
|
+
let bucketSum = restByBucket.get(bucketKey);
|
|
572
|
+
if (!bucketSum) {
|
|
573
|
+
bucketSum = {};
|
|
574
|
+
restByBucket.set(bucketKey, bucketSum);
|
|
575
|
+
}
|
|
576
|
+
for (const alias of entryAliases) {
|
|
577
|
+
bucketSum[alias] = ((_a = bucketSum[alias]) !== null && _a !== void 0 ? _a : 0) + ((_b = entryRow[alias]) !== null && _b !== void 0 ? _b : 0);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
restByBucket.forEach((bucketSum, bucketKey) => {
|
|
581
|
+
writeBucketValues(restRow, finalizeBucketRow(bucketSum), bucketKey);
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
for (const entryRow of entryRowsRaw) {
|
|
586
|
+
const bucketKey = coerceBucketKey(entryRow.__interval);
|
|
587
|
+
finalizeBucketRow(entryRow);
|
|
588
|
+
for (const segment of res) {
|
|
589
|
+
for (const row of segment) {
|
|
590
|
+
if (row.type !== "ENTRY" || row.category === "REST" || row.category !== entryRow.category) {
|
|
591
|
+
continue;
|
|
592
|
+
}
|
|
593
|
+
if (this.config.grouped && row.rowGroup !== entryRow.rowGroup) {
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
if (isOpt && row.operation !== entryRow.operation) {
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
writeBucketValues(row, entryRow, bucketKey);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
const groupTotalRowsRaw = isSumTypeGrouped || (hasPartOfActive && this.config.grouped)
|
|
604
|
+
? exec(`SELECT ${QueryColumnNames.ROWGROUP}, __interval ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
605
|
+
FROM ${bucketSource}
|
|
606
|
+
GROUP BY ${QueryColumnNames.ROWGROUP}, __interval`)
|
|
607
|
+
: [];
|
|
608
|
+
const groupTotalsByKey = new Map();
|
|
609
|
+
groupTotalRowsRaw.forEach((row) => groupTotalsByKey.set(`${row.rowGroup}${separator}${coerceBucketKey(row.__interval)}`, row));
|
|
610
|
+
if (isSumTypeGrouped) {
|
|
611
|
+
for (const totalRow of groupTotalRowsRaw) {
|
|
612
|
+
const bucketKey = coerceBucketKey(totalRow.__interval);
|
|
613
|
+
const finalized = finalizeBucketRow(Object.assign({}, totalRow));
|
|
614
|
+
for (const segment of res) {
|
|
615
|
+
for (const row of segment) {
|
|
616
|
+
if (row.type === "GROUP_SUM" && row.rowGroup === totalRow.rowGroup) {
|
|
617
|
+
writeBucketValues(row, finalized, bucketKey);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
const hasTotalSumRow = TableType.SUM === this.config.type || TableType.OPT === this.config.type;
|
|
624
|
+
const sumTotalRowsRaw = hasTotalSumRow || (hasPartOfActive && !this.config.grouped)
|
|
625
|
+
? exec(`SELECT __interval ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
626
|
+
FROM ${bucketSource}
|
|
627
|
+
GROUP BY __interval`)
|
|
628
|
+
: [];
|
|
629
|
+
const sumTotalsByBucket = new Map();
|
|
630
|
+
sumTotalRowsRaw.forEach((row) => sumTotalsByBucket.set(coerceBucketKey(row.__interval), row));
|
|
631
|
+
if (hasTotalSumRow) {
|
|
632
|
+
for (const totalRow of sumTotalRowsRaw) {
|
|
633
|
+
const bucketKey = coerceBucketKey(totalRow.__interval);
|
|
634
|
+
const finalized = finalizeBucketRow(Object.assign({}, totalRow));
|
|
635
|
+
for (const segment of res) {
|
|
636
|
+
for (const row of segment) {
|
|
637
|
+
if (row.type === "SUM") {
|
|
638
|
+
writeBucketValues(row, finalized, bucketKey);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
if (this.config.thereOf != null && this.config.thereOf.length > 0) {
|
|
645
|
+
const drillRows = [];
|
|
646
|
+
this.config.thereOf.forEach((element) => {
|
|
647
|
+
drillRows.push(...exec(`SELECT ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}, __interval ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
648
|
+
FROM ${bucketSource}
|
|
649
|
+
WHERE ${this.createThereOfWhereClause(element)}
|
|
650
|
+
GROUP BY ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}, __interval`));
|
|
651
|
+
});
|
|
652
|
+
for (const drillRow of drillRows) {
|
|
653
|
+
const bucketKey = coerceBucketKey(drillRow.__interval);
|
|
654
|
+
finalizeBucketRow(drillRow);
|
|
655
|
+
for (const segment of res) {
|
|
656
|
+
for (const row of segment) {
|
|
657
|
+
if (row.type !== "DRILLELEMENT" || row.category !== drillRow.category) {
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
if (row.subCategory !== drillRow.subCategory &&
|
|
661
|
+
row.subCategory !== `${drillRow.subCategory} (${drillRow.rowGroup})`) {
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
writeBucketValues(row, drillRow, bucketKey);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if (hasPartOfActive) {
|
|
670
|
+
let partWhere = "1 <> 1 ";
|
|
671
|
+
(_c = this.config.partOf) === null || _c === void 0 ? void 0 : _c.forEach((element) => {
|
|
672
|
+
partWhere += `OR (${QueryColumnNames.CATEGORY} = '${element.category}'`;
|
|
673
|
+
if (!(null == element.rowGroup || 0 === element.rowGroup.length || !element.rowGroup.trim())) {
|
|
674
|
+
partWhere += `and ${QueryColumnNames.ROWGROUP} = '${element.rowGroup}'`;
|
|
675
|
+
}
|
|
676
|
+
partWhere += `)`;
|
|
677
|
+
});
|
|
678
|
+
const groupName = this.config.grouped
|
|
679
|
+
? `${QueryColumnNames.ROWGROUP}`
|
|
680
|
+
: `'SUM_TOTAL' as ${QueryColumnNames.ROWGROUP}`;
|
|
681
|
+
const partRowsRaw = exec(`SELECT ${QueryColumnNames.CATEGORY}, ${groupName}, __interval ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
682
|
+
FROM ${bucketSource}
|
|
683
|
+
WHERE ${partWhere}
|
|
684
|
+
GROUP BY ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, __interval`);
|
|
685
|
+
// merge rows sharing (rowGroup, category, bucket) — mirrors reduceResDrillByCategoryGroups
|
|
686
|
+
const partByKey = new Map();
|
|
687
|
+
for (const partRow of partRowsRaw) {
|
|
688
|
+
const key = `${partRow.rowGroup}${separator}${partRow.category}${separator}${coerceBucketKey(partRow.__interval)}`;
|
|
689
|
+
const existing = partByKey.get(key);
|
|
690
|
+
if (existing) {
|
|
691
|
+
for (const alias of entryAliases) {
|
|
692
|
+
existing[alias] = ((_d = existing[alias]) !== null && _d !== void 0 ? _d : 0) + ((_e = partRow[alias]) !== null && _e !== void 0 ? _e : 0);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
partByKey.set(key, partRow);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
partByKey.forEach((partRow) => {
|
|
700
|
+
const bucketKey = coerceBucketKey(partRow.__interval);
|
|
701
|
+
const totals = this.config.grouped
|
|
702
|
+
? groupTotalsByKey.get(`${partRow.rowGroup}${separator}${bucketKey}`)
|
|
703
|
+
: sumTotalsByBucket.get(bucketKey);
|
|
704
|
+
for (const alias of entryAliases) {
|
|
705
|
+
partRow[alias] = partRow[alias] / (totals ? totals[alias] : Number.NaN);
|
|
706
|
+
}
|
|
707
|
+
finalizeBucketRow(partRow);
|
|
708
|
+
for (const segment of res) {
|
|
709
|
+
for (const row of segment) {
|
|
710
|
+
if (row.type === "PARTELEMENT" && row.category === partRow.category && row.rowGroup === partRow.rowGroup) {
|
|
711
|
+
writeBucketValues(row, partRow, bucketKey);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
/** Builds the thereof filter for interval side queries (mirrors the WHERE construction in createThereOfDrillRows). */
|
|
719
|
+
createThereOfWhereClause(element) {
|
|
720
|
+
let isFirst = true;
|
|
721
|
+
let whereClause = "1 <> 1 OR ( ";
|
|
722
|
+
if (!(null == element.category || 0 === element.category.length || !element.category.trim())) {
|
|
723
|
+
whereClause += ` ${QueryColumnNames.CATEGORY} = '${element.category}'`;
|
|
724
|
+
isFirst = false;
|
|
725
|
+
}
|
|
726
|
+
if (!(null == element.rowGroup || 0 === element.rowGroup.length || !element.rowGroup.trim())) {
|
|
727
|
+
whereClause += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.ROWGROUP} = '${element.rowGroup}'`;
|
|
728
|
+
isFirst = false;
|
|
729
|
+
}
|
|
730
|
+
if (!(null == element.subCategory || 0 === element.subCategory.length || !element.subCategory.trim())) {
|
|
731
|
+
whereClause += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.SUBCATEGORY} = '${element.subCategory}'`;
|
|
732
|
+
}
|
|
733
|
+
return whereClause + `)`;
|
|
734
|
+
}
|
|
445
735
|
/** Collects all relative variance scenarios and maps each to its denominator column name. */
|
|
446
736
|
getRelativeScenarios() {
|
|
447
737
|
const relativeScenarios = new Map();
|
|
@@ -492,6 +782,45 @@ export class DataQuery {
|
|
|
492
782
|
}
|
|
493
783
|
return `SUM(${scenario} * transformOperator(operation)) as ${scenario}, COUNT(ISNULL(${scenario})) as ${scenario}_cnt`;
|
|
494
784
|
}
|
|
785
|
+
/**
|
|
786
|
+
* Translates an attribute definition into a SQL aggregate expression aliased
|
|
787
|
+
* to the attribute's safe column alias (`attr_N`).
|
|
788
|
+
*
|
|
789
|
+
* `sum`/`avg` on scenario fields respect the row operation sign via
|
|
790
|
+
* `transformOperator`, consistent with {@link translateScenarioSQL}; for
|
|
791
|
+
* OPT/OPTNOTOTAL types the sign is already baked into the data.
|
|
792
|
+
*/
|
|
793
|
+
translateAttributeSQL(attribute) {
|
|
794
|
+
const field = `[${attribute.arg}]`;
|
|
795
|
+
const isScenarioField = /^(ac|pp|fc|pl)[1-4]$/.test(attribute.arg);
|
|
796
|
+
const useOperator = isScenarioField && this.config.type !== TableType.OPT && this.config.type !== TableType.OPTNOTOTAL;
|
|
797
|
+
switch (attribute.fn) {
|
|
798
|
+
case "set":
|
|
799
|
+
return `SETAGG(${field}) as ${attribute.alias}`;
|
|
800
|
+
case "first":
|
|
801
|
+
return `FIRST(${field}) as ${attribute.alias}`;
|
|
802
|
+
case "last":
|
|
803
|
+
return `LAST(${field}) as ${attribute.alias}`;
|
|
804
|
+
case "min":
|
|
805
|
+
return `MIN(${field}) as ${attribute.alias}`;
|
|
806
|
+
case "max":
|
|
807
|
+
return `MAX(${field}) as ${attribute.alias}`;
|
|
808
|
+
case "avg":
|
|
809
|
+
return useOperator
|
|
810
|
+
? `AVG(${field} * transformOperator(operation)) as ${attribute.alias}`
|
|
811
|
+
: `AVG(${field}) as ${attribute.alias}`;
|
|
812
|
+
case "sum":
|
|
813
|
+
return useOperator
|
|
814
|
+
? `SUM(${field} * transformOperator(operation)) as ${attribute.alias}`
|
|
815
|
+
: `SUM(${field}) as ${attribute.alias}`;
|
|
816
|
+
case "lit":
|
|
817
|
+
return `${this.sqlLiteral(attribute.arg)} as ${attribute.alias}`;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
/** Emits a raw lit() argument as a SQL literal: numeric when parseable, quoted string otherwise. */
|
|
821
|
+
sqlLiteral(raw) {
|
|
822
|
+
return raw !== "" && !Number.isNaN(Number(raw)) ? raw : `'${raw.replace(/'/g, "''")}'`;
|
|
823
|
+
}
|
|
495
824
|
/**
|
|
496
825
|
* generates Tuple
|
|
497
826
|
* [0] orderby string example: category asc
|
|
@@ -558,7 +887,7 @@ export class DataQuery {
|
|
|
558
887
|
${QueryColumnNames.CATEGORY},
|
|
559
888
|
${groupName},
|
|
560
889
|
${scenarios}
|
|
561
|
-
FROM
|
|
890
|
+
FROM ${this.fromExpr}
|
|
562
891
|
WHERE ${fromString}
|
|
563
892
|
GROUP BY ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.TYPE}
|
|
564
893
|
ORDER BY ${order[1]}`);
|
|
@@ -579,12 +908,13 @@ export class DataQuery {
|
|
|
579
908
|
* result rows using the `"##"` separator convention: `scenario##columnGroup` or
|
|
580
909
|
* `scenario##columnGroup##columnSubGroup`.
|
|
581
910
|
*/
|
|
582
|
-
createThereOfDrillColumns(categoryThereOf,
|
|
911
|
+
createThereOfDrillColumns(categoryThereOf, res) {
|
|
583
912
|
if (categoryThereOf == null || categoryThereOf.size === 0) {
|
|
584
913
|
return;
|
|
585
914
|
}
|
|
586
915
|
const drillQueries = [];
|
|
587
916
|
const resDrill = [];
|
|
917
|
+
const fromExpr = this.fromExpr;
|
|
588
918
|
categoryThereOf.forEach((value, key) => {
|
|
589
919
|
let whereClause = "1 <> 1 ";
|
|
590
920
|
value.forEach((drillColumn) => {
|
|
@@ -597,7 +927,7 @@ export class DataQuery {
|
|
|
597
927
|
columnGroup,
|
|
598
928
|
'${key}' as scenario,
|
|
599
929
|
sum(${key} * transformOperator(operation)) as val
|
|
600
|
-
FROM
|
|
930
|
+
FROM ${fromExpr}
|
|
601
931
|
WHERE ${whereClause}
|
|
602
932
|
GROUP BY rowlevel, rowGroup, category, columnGroup, scenario`);
|
|
603
933
|
drillQueries.push(`SELECT 'ENTRY' as rowlevel,
|
|
@@ -608,7 +938,7 @@ export class DataQuery {
|
|
|
608
938
|
columnSubGroup,
|
|
609
939
|
'${key}' as scenario,
|
|
610
940
|
sum(${key} * transformOperator(operation)) as val
|
|
611
|
-
FROM
|
|
941
|
+
FROM ${fromExpr}
|
|
612
942
|
WHERE ${whereClause}
|
|
613
943
|
GROUP BY rowlevel, rowGroup, category, columnGroup, columnSubGroup, scenario`);
|
|
614
944
|
drillQueries.push(`SELECT 'DRILLELEMENT' as rowlevel,
|
|
@@ -619,7 +949,7 @@ export class DataQuery {
|
|
|
619
949
|
columnGroup,
|
|
620
950
|
'${key}' as scenario,
|
|
621
951
|
sum(${key} * transformOperator(operation)) as val
|
|
622
|
-
FROM
|
|
952
|
+
FROM ${fromExpr}
|
|
623
953
|
WHERE ${whereClause}
|
|
624
954
|
GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, scenario`);
|
|
625
955
|
drillQueries.push(`SELECT 'DRILLELEMENT' as rowlevel,
|
|
@@ -631,7 +961,7 @@ export class DataQuery {
|
|
|
631
961
|
columnSubGroup,
|
|
632
962
|
'${key}' as scenario,
|
|
633
963
|
sum(${key} * transformOperator(operation)) as val
|
|
634
|
-
FROM
|
|
964
|
+
FROM ${fromExpr}
|
|
635
965
|
WHERE ${whereClause}
|
|
636
966
|
GROUP BY rowlevel, rowGroup, category, subCategory, columnGroup, columnSubGroup, scenario`);
|
|
637
967
|
drillQueries.push(`SELECT 'GROUP_SUM' as rowlevel,
|
|
@@ -640,7 +970,7 @@ export class DataQuery {
|
|
|
640
970
|
columnGroup,
|
|
641
971
|
'${key}' as scenario,
|
|
642
972
|
sum(${key} * transformOperator(operation)) as val
|
|
643
|
-
FROM
|
|
973
|
+
FROM ${fromExpr}
|
|
644
974
|
WHERE ${whereClause}
|
|
645
975
|
GROUP BY rowlevel, rowGroup, columnGroup, scenario`);
|
|
646
976
|
drillQueries.push(`SELECT 'GROUP_SUM' as rowlevel,
|
|
@@ -650,7 +980,7 @@ export class DataQuery {
|
|
|
650
980
|
columnSubGroup,
|
|
651
981
|
'${key}' as scenario,
|
|
652
982
|
sum(${key} * transformOperator(operation)) as val
|
|
653
|
-
FROM
|
|
983
|
+
FROM ${fromExpr}
|
|
654
984
|
WHERE ${whereClause}
|
|
655
985
|
GROUP BY rowlevel, rowGroup, columnGroup, columnSubGroup, scenario`);
|
|
656
986
|
drillQueries.push(`SELECT 'SUM' as rowlevel,
|
|
@@ -658,7 +988,7 @@ export class DataQuery {
|
|
|
658
988
|
columnGroup,
|
|
659
989
|
'${key}' as scenario,
|
|
660
990
|
sum(${key} * transformOperator(operation)) as val
|
|
661
|
-
FROM
|
|
991
|
+
FROM ${fromExpr}
|
|
662
992
|
WHERE ${whereClause}
|
|
663
993
|
GROUP BY rowlevel, columnGroup, scenario`);
|
|
664
994
|
drillQueries.push(`SELECT 'SUM' as rowlevel,
|
|
@@ -667,12 +997,12 @@ export class DataQuery {
|
|
|
667
997
|
columnSubGroup,
|
|
668
998
|
'${key}' as scenario,
|
|
669
999
|
sum(${key} * transformOperator(operation)) as val
|
|
670
|
-
FROM
|
|
1000
|
+
FROM ${fromExpr}
|
|
671
1001
|
WHERE ${whereClause}
|
|
672
1002
|
GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`);
|
|
673
1003
|
});
|
|
674
1004
|
for (const query of drillQueries) {
|
|
675
|
-
resDrill.push(...
|
|
1005
|
+
resDrill.push(...this.db.exec(query));
|
|
676
1006
|
}
|
|
677
1007
|
this.injectDrillColumnsToResultRows(resDrill, res);
|
|
678
1008
|
}
|